historywindow.cpp
changeset 391 59106708b5b5
parent 381 c79df732d095
child 393 053b8645e3e9
     1.1 --- a/historywindow.cpp	Fri Sep 08 12:30:09 2006 +0000
     1.2 +++ b/historywindow.cpp	Mon Oct 16 12:42:54 2006 +0000
     1.3 @@ -10,13 +10,13 @@
     1.4  	
     1.5  	QTableWidgetItem *item;
     1.6  
     1.7 -	item= new QTableWidgetItem(tr("Action"));
     1.8 +	item= new QTableWidgetItem(tr("Action","Table with actions"));
     1.9  	ui.historyTable->setHorizontalHeaderItem(0, item);
    1.10  	
    1.11 -	item= new QTableWidgetItem(tr("Comment"));
    1.12 +	item= new QTableWidgetItem(tr("Comment","Table with actions"));
    1.13  	ui.historyTable->setHorizontalHeaderItem(1, item);
    1.14  	
    1.15 -	item= new QTableWidgetItem(tr("Undo action"));
    1.16 +	item= new QTableWidgetItem(tr("Undo action","Table with actions"));
    1.17  	ui.historyTable->setHorizontalHeaderItem(2, item);
    1.18  
    1.19  	ui.historyTable->setSelectionBehavior (QAbstractItemView::SelectRows);
    1.20 @@ -27,6 +27,17 @@
    1.21  }
    1.22  
    1.23  
    1.24 +void HistoryWindow::clearRow(int row)
    1.25 +{
    1.26 +	QTableWidgetItem *it;
    1.27 +	it=ui.historyTable->item (row,0);
    1.28 +	if (it) it->setText ("");
    1.29 +	it=ui.historyTable->item (row,1);
    1.30 +	if (it) it->setText ("");
    1.31 +	it=ui.historyTable->item (row,2);
    1.32 +	if (it) it->setText ("");
    1.33 +}
    1.34 +
    1.35  void HistoryWindow::updateRow(int row, int step, SimpleSettings &set)
    1.36  {
    1.37  	QTableWidgetItem *item;
    1.38 @@ -63,7 +74,7 @@
    1.39  	else	
    1.40  		ui.redoButton->setEnabled (true);
    1.41  
    1.42 -	// Update table
    1.43 +	// Update undos in table
    1.44  	for (i=undosAvail; i>0; i--)
    1.45  	{
    1.46  		updateRow (r,s,set);
    1.47 @@ -83,20 +94,24 @@
    1.48  			ui.historyTable->setItem(undosAvail, i, item);
    1.49  		}
    1.50  	}
    1.51 -	item=new QTableWidgetItem(" - " +tr("Current state","current bar in history hwindow")+ " - ");
    1.52 +	item=new QTableWidgetItem(" - " +tr("Current state","Current bar in history hwindow")+ " - ");
    1.53  	item->setBackgroundColor (c);
    1.54  	ui.historyTable->setItem(undosAvail, 1, item);
    1.55  
    1.56  
    1.57 +	// Update Redos in table
    1.58  	s=curStep;
    1.59  	s++; if (s>stepsTotal) s=1;
    1.60 -
    1.61  	for (i=1;i<= redosAvail; i++)
    1.62  	{
    1.63  		updateRow (undosAvail+i,s,set);
    1.64  		s++; if (s>stepsTotal) s=1;
    1.65  	}
    1.66  
    1.67 +	// Delete the rest
    1.68 +	for (i=undosAvail+redosAvail+1;i<= stepsTotal; i++)
    1.69 +		clearRow (i);
    1.70 +
    1.71  	ui.historyTable->resizeColumnsToContents();
    1.72  }
    1.73