void ThreadList::updateSorting() { switch(sort_column) { case COL_ID: sortByID(); break; case COL_LOCATION: sortByLocation(); break; case COL_CPUUSAGE: sortByCpuUsage(); break; } fillList(); }
Monitor::Monitor(QWidget *parent) : QWidget(parent), ui(new Ui::Monitor) { qDebug("Monitor Init"); ui->setupUi(this); //Initialize the table ui->table->setColumnHidden(TASK_TIME_COL, true); ui->table->setColumnHidden(DELTA_TASK_TIME_COL, true); ui->table->setColumnWidth(STACK_HEAP_COL, 170); ui->table->setColumnWidth(PROCESS_ID_COL, 150); ui->table->setColumnWidth(THREAD_ID_COL, 145); ui->table->setColumnWidth(PRIO_COL, 145); ui->table->setColumnWidth(CPU_COL, 145); connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(updateAll())); ui->killButton->setToolTip("Kill Selected User Process"); sortColumn = PROCESS_ID_COL; sortAscendingAction = new QAction( "Sort Ascending", ui->table ); sortAscendingAction->setCheckable(true); sortAscendingAction->setChecked(true); sortOrder = Qt::AscendingOrder; sortDescendingAction = new QAction( "Sort Descending", ui->table ); sortDescendingAction->setCheckable(true); sortDescendingAction->setChecked(false); QAction * separator = new QAction( "", ui->table ); separator->setSeparator(true); sortByProcessIdAction = new QAction( "Sort By Process ID", ui->table ); sortByProcessIdAction->setCheckable(true); sortByProcessIdAction->setChecked(true); sortColumn = PROCESS_ID_COL; sortByNameAction = new QAction( "Sort By Name", ui->table ); sortByNameAction->setCheckable(true); sortByCpuUsageAction = new QAction( "Sort By CPU Usage", ui->table ); sortByCpuUsageAction->setCheckable(true); sortByMemoryUsageAction = new QAction( "Sort By Allocated Memory", ui->table ); sortByMemoryUsageAction->setCheckable(true); connect( sortAscendingAction, SIGNAL( changed() ), this, SLOT( sortAscending() ) ); connect( sortDescendingAction, SIGNAL( changed() ), this, SLOT( sortDescending() ) ); connect( sortByProcessIdAction, SIGNAL( changed() ), this, SLOT( sortByProcessId() ) ); connect( sortByNameAction, SIGNAL( changed() ), this, SLOT( sortByName() ) ); connect( sortByCpuUsageAction, SIGNAL( changed() ), this, SLOT( sortByCpuUsage() ) ); connect( sortByMemoryUsageAction, SIGNAL( changed() ), this, SLOT( sortByMemoryUsage() ) ); /* ui->table->setContextMenuPolicy( Qt::ActionsContextMenu ); ui->table->addAction ( sortAscendingAction ); ui->table->addAction ( sortDescendingAction ); ui->table->addAction ( separator ); ui->table->addAction ( sortByProcessIdAction ); ui->table->addAction ( sortByNameAction ); ui->table->addAction ( sortByCpuUsageAction ); ui->table->addAction ( sortByMemoryUsageAction ); */ ui->notConnectedWidget->setObjectName("bordered"); ui->killButton->setObjectName("blueButton"); ui->killButton->setText(CFont::iconRemove()); ui->killButton->setToolTip("Kill process"); ui->continueButton->setObjectName("blueButton"); ui->continueButton->setText(CFont::iconPlay()); ui->continueButton->setToolTip("Continue process"); ui->pauseButton->setObjectName("blueButton"); ui->pauseButton->setText(CFont::iconPause()); ui->pauseButton->setToolTip("Pause process"); ui->termButton->setObjectName("blueButton"); ui->termButton->setText(CFont::iconStop()); ui->termButton->setToolTip("Terminate process"); ui->notConnectedLabel->setText(CFont::icomoon(CFont::iconInfoSign()) + " Not Connected"); ui->notConnectedLabel->setObjectName("acceptLabel"); ui->notConnectedLabel->setEnabled(false); ui->notConnectedWidget->setVisible(false); qDebug("Monitor Init Complete"); }