historywindow.cpp
author insilmaril
Wed, 06 Sep 2006 12:47:06 +0000
changeset 380 5f6e176e9718
parent 377 5391ab620c95
child 381 c79df732d095
permissions -rw-r--r--
1.8.55 New history window and showtextwindow
     1 #include "historywindow.h"
     2 
     3 HistoryWindow::HistoryWindow (QWidget *parent):QDialog (parent)
     4 {
     5 	ui.setupUi (this);
     6 	ui.historyTable->setRowCount (20);
     7 	ui.historyTable->setColumnCount (3);
     8 
     9 	
    10 	QTableWidgetItem *item;
    11 
    12 	item= new QTableWidgetItem(tr("Action"));
    13 	ui.historyTable->setHorizontalHeaderItem(0, item);
    14 	
    15 	item= new QTableWidgetItem(tr("Comment"));
    16 	ui.historyTable->setHorizontalHeaderItem(1, item);
    17 	
    18 	item= new QTableWidgetItem(tr("Undo action"));
    19 	ui.historyTable->setHorizontalHeaderItem(2, item);
    20 
    21 	ui.historyTable->setSelectionBehavior (QAbstractItemView::SelectRows);
    22 }
    23 
    24 
    25 void HistoryWindow::update(SimpleSettings &set)
    26 {
    27 	//int rows=set.readNumEntry("/history/undosTotal");
    28 	//ui.historyTable->setRowCount (rows);
    29 
    30 	int i;
    31 	for (i=0;i<= set.readNumEntry("/history/undosAvail",0); i++)
    32 	{
    33 		QTableWidgetItem *item;
    34 
    35 		item= new QTableWidgetItem(set.readEntry(QString("/history/step-%1/redoCommand").arg(i)));
    36 		ui.historyTable->setItem(i, 0, item);
    37 
    38 		item= new QTableWidgetItem(set.readEntry(QString("/history/step-%1/comment").arg(i)));
    39 		ui.historyTable->setItem(i, 1, item);
    40 
    41 		item=new QTableWidgetItem(set.readEntry(QString("/history/step-%1/undoCommand").arg(i)));
    42 		ui.historyTable->setItem(i, 2, item);
    43 	}
    44 
    45 	ui.historyTable->resizeColumnsToContents();
    46 }