@@ -86,6 +86,8 @@ TProcGui::TProcGui(QWidget *parent) : QMainWindow(parent), ui(new Ui::procgui)
86
86
}
87
87
TSortProxy *sortProxy=new TSortProxy (g_config.getFields (),this );
88
88
ui->processList ->setModel (sortProxy);
89
+ ui->autoRefresh ->setCheckState (Qt::Checked);
90
+
89
91
connect (ui->action_Exit ,SIGNAL (triggered ()),qApp,SLOT (quit ()));
90
92
connect (ui->actionFields ,SIGNAL (triggered ()),this ,SLOT (fieldsDialog ()));
91
93
connect (ui->actionAbout ,SIGNAL (triggered ()), this ,SLOT (about ()));
@@ -96,6 +98,7 @@ TProcGui::TProcGui(QWidget *parent) : QMainWindow(parent), ui(new Ui::procgui)
96
98
connect (ui->detailsButton ,SIGNAL (clicked ()),this ,SLOT (showDetails ()));
97
99
connect (ui->displayAsTree ,SIGNAL (clicked ()),this ,SLOT (checkDisplayAsTree ()));
98
100
connect (ui->priority ,SIGNAL (clicked ()),this ,SLOT (showPriorityDialog ()));
101
+ connect (ui->autoRefresh ,SIGNAL (clicked ()),this ,SLOT (clickAutoRefresh ()));
99
102
ui->displayAsTree ->setCheckState (g_config.getDisplayAsTree ()?Qt::Checked:Qt::Unchecked);
100
103
ui->processList ->setItemDelegate (new TGridDelegate (ui->processList ));
101
104
userSelection=new QTableView (this );
@@ -104,7 +107,7 @@ TProcGui::TProcGui(QWidget *parent) : QMainWindow(parent), ui(new Ui::procgui)
104
107
userSelection->setSelectionMode (QAbstractItemView::SingleSelection);
105
108
userSelection->verticalHeader ()->setVisible (false );
106
109
refreshTimeout ();
107
- refresh.setInterval (1024 );
110
+ refresh.setInterval (1000 );
108
111
refresh.start ();
109
112
}
110
113
@@ -123,24 +126,39 @@ void TProcGui::about()
123
126
l_about.exec ();
124
127
}
125
128
129
+ /* *
130
+ * Event fired when user clicks the autorefresh checkbox.
131
+ * This method togles autorefresh
132
+ */
133
+ void TProcGui::clickAutoRefresh ()
134
+ {
135
+ if (ui->autoRefresh ->checkState ()==Qt::Checked){
136
+ refresh.start ();
137
+ } else {
138
+ refresh.stop ();
139
+ }
140
+ }
141
+
142
+
126
143
/* *
127
144
* Show the PropertyDialog for changing the proces priority
128
145
*/
129
146
void TProcGui::showPriorityDialog ()
130
147
{
131
- printf (" Help\n " );
132
148
if (ui->processList ->selectionModel ()->selectedRows ().count ()>0 ){
149
+ refresh.stop ();
133
150
pid_t l_pid=ui->processList ->selectionModel ()->selectedRows ().first ().data (Qt::UserRole+1 ).toUInt ();
134
151
TProcessInfo *l_info=processInfo->getByPid (l_pid);
135
152
PriorityDialog l_dialog (l_info);
136
153
l_dialog.exec ();
154
+ refresh.start ();
155
+ refreshTimeout ();
137
156
}
138
157
139
158
140
159
}
141
160
142
161
143
-
144
162
/* *
145
163
* Fills/refresh the list with users. Before the refresh, the current selection is saved and restored after the refresh.
146
164
* The list is sorted on the description. The associated data item is the user id.
0 commit comments