minor bugfixes
authorinsilmaril
Thu, 17 May 2007 20:19:03 +0000
changeset 489f0e482cd84f0
parent 488 bd28847feede
child 490 a6499713d8ae
minor bugfixes
historywindow.cpp
     1.1 --- a/historywindow.cpp	Thu May 17 20:19:03 2007 +0000
     1.2 +++ b/historywindow.cpp	Thu May 17 20:19:03 2007 +0000
     1.3 @@ -9,7 +9,7 @@
     1.4  HistoryWindow::HistoryWindow (QWidget *parent):QDialog (parent)
     1.5  {
     1.6  	ui.setupUi (this);
     1.7 -	ui.historyTable->setRowCount (20);
     1.8 +	ui.historyTable->setRowCount (settings.value( "/mapeditor/stepsTotal",75).toInt());
     1.9  	ui.historyTable->setColumnCount (3);
    1.10  
    1.11  	
    1.12 @@ -35,14 +35,22 @@
    1.13  
    1.14  	// Load Settings
    1.15  
    1.16 -	for (int i=0; i<3; ++i)
    1.17 -		ui.historyTable->setColumnWidth (i,settings.value( QString("/historywindow/geometry/columnWidth/%1").arg(i),150).toInt());
    1.18 +	resize (settings.value ( "/satellite/historywindow/geometry/size", QSize(1000,400)).toSize());
    1.19 +	move   (settings.value ( "/satellite/historywindow/geometry/pos", QPoint (0,450)).toPoint());
    1.20 +
    1.21 +	ui.historyTable->setColumnWidth (0,settings.value("/satellite/historywindow/geometry/columnWidth/0",250).toInt());
    1.22 +	ui.historyTable->setColumnWidth (1,settings.value("/satellite/historywindow/geometry/columnWidth/1",350).toInt());
    1.23 +	ui.historyTable->setColumnWidth (2,settings.value("/satellite/historywindow/geometry/columnWidth/2",250).toInt());
    1.24  }
    1.25  
    1.26  HistoryWindow::~HistoryWindow()
    1.27  {
    1.28 +	// Save settings
    1.29 +	settings.setValue( "/satellite/historywindow/geometry/size", size() );
    1.30 +	settings.setValue( "/satellite/historywindow/geometry/pos", pos() );
    1.31 +
    1.32  	for (int i=0; i<3; ++i)
    1.33 -		settings.setValue( QString("/historywindow/geometry/columnWidth/%1").arg(i), ui.historyTable->columnWidth (i) );
    1.34 +		settings.setValue( QString("/satellite/historywindow/geometry/columnWidth/%1").arg(i), ui.historyTable->columnWidth (i) );
    1.35  }
    1.36  
    1.37  void HistoryWindow::clearRow(int row)
    1.38 @@ -81,6 +89,9 @@
    1.39  	int r=undosAvail-1;
    1.40  	QTableWidgetItem *item;
    1.41  
    1.42 +	// Update number of rows
    1.43 +	ui.historyTable->setRowCount (undosAvail + redosAvail +1);
    1.44 +
    1.45  	// Update buttons
    1.46  	if (undosAvail<1)
    1.47  		ui.undoButton->setEnabled (false);
    1.48 @@ -132,18 +143,17 @@
    1.49  	for (i=undosAvail+redosAvail+1;i<= stepsTotal; i++)
    1.50  		clearRow (i);
    1.51  
    1.52 -	ui.historyTable->resizeColumnsToContents();
    1.53 +	//ui.historyTable->resizeColumnsToContents();
    1.54  }
    1.55  
    1.56  void HistoryWindow::setStepsTotal (int st)
    1.57  {
    1.58  	// Number of steps + "current" bar
    1.59  	ui.historyTable->setRowCount (st+1);
    1.60 -
    1.61  }
    1.62  
    1.63  
    1.64 -void HistoryWindow::closeEvent (QCloseEvent *ce)
    1.65 +void HistoryWindow::closeEvent (QCloseEvent *)
    1.66  {
    1.67  	emit (windowClosed() );
    1.68  }
    1.69 @@ -160,5 +170,6 @@
    1.70  
    1.71  void HistoryWindow::select()
    1.72  {
    1.73 +	cout <<"HW::select  "<<ui.historyTable->row (ui.historyTable->selectedItems().first())<<endl;
    1.74  	mainWindow->gotoHistoryStep (ui.historyTable->row (ui.historyTable->selectedItems().first()));
    1.75  }