summaryrefslogtreecommitdiffstats
path: root/ksysguard/gui/SensorDisplayLib/ProcessController.h
diff options
context:
space:
mode:
Diffstat (limited to 'ksysguard/gui/SensorDisplayLib/ProcessController.h')
-rw-r--r--ksysguard/gui/SensorDisplayLib/ProcessController.h154
1 files changed, 154 insertions, 0 deletions
diff --git a/ksysguard/gui/SensorDisplayLib/ProcessController.h b/ksysguard/gui/SensorDisplayLib/ProcessController.h
new file mode 100644
index 000000000..f834efbb6
--- /dev/null
+++ b/ksysguard/gui/SensorDisplayLib/ProcessController.h
@@ -0,0 +1,154 @@
+/*
+ KSysGuard, the KDE System Guard
+
+ Copyright (c) 1999, 2000 Chris Schlaeger <cs@kde.org>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of version 2 of the GNU General Public
+ License as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ KSysGuard is currently maintained by Chris Schlaeger <cs@kde.org>.
+ Please do not commit any changes without consulting me first. Thanks!
+
+*/
+
+#ifndef _ProcessController_h_
+#define _ProcessController_h_
+
+#include <qdict.h>
+#include <qwidget.h>
+
+#include <kapplication.h>
+
+#include <SensorDisplay.h>
+
+#include "ProcessList.h"
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QCheckBox;
+class QComboBox;
+class KPushButton;
+class KListViewSearchLineWidget;
+
+extern KApplication* Kapp;
+
+/**
+ * This widget implements a process list page. Besides the process
+ * list which is implemented as a ProcessList, it contains two
+ * comboxes and two buttons. The combo boxes are used to set the
+ * update rate and the process filter. The buttons are used to force
+ * an immediate update and to kill a process.
+ */
+class ProcessController : public KSGRD::SensorDisplay
+{
+ Q_OBJECT
+
+public:
+ ProcessController(QWidget* parent = 0, const char* name = 0, const QString &title = QString::null, bool nf = false);
+ virtual ~ProcessController() { }
+
+ void resizeEvent(QResizeEvent*);
+
+ bool restoreSettings(QDomElement& element);
+
+ bool saveSettings(QDomDocument& doc, QDomElement& element, bool save = true);
+
+ void refreshList(void)
+ {
+ updateList();
+ }
+
+ virtual void timerEvent(QTimerEvent*)
+ {
+ updateList();
+ }
+
+ virtual bool addSensor(const QString&, const QString&, const QString&, const QString&);
+
+ virtual void answerReceived(int id, const QString& answer);
+
+ virtual void sensorError(int, bool err);
+
+ void configureSettings() { }
+
+ virtual bool hasSettingsDialog() const
+ {
+ return (false);
+ }
+
+public slots:
+ void setSearchFocus();
+ void fixTabOrder();
+ void filterModeChanged(int filter)
+ {
+ pList->setFilterMode(filter);
+ updateList();
+ setModified(true);
+ }
+
+ void setTreeView(bool tv)
+ {
+ pList->setTreeView(tv);
+ updateList();
+ setModified(true);
+ }
+
+ virtual void setModified(bool mfd)
+ {
+ if (mfd != modified())
+ {
+ SensorDisplay::setModified( mfd );
+ if (!mfd)
+ pList->setModified(0);
+ emit modified(modified());
+ }
+ }
+
+ void killProcess();
+ void killProcess(int pid, int sig);
+
+ void reniceProcess(const QValueList<int> &pids, int niceValue);
+
+ void updateList();
+
+signals:
+ void setFilterMode(int);
+
+private:
+ QVBoxLayout* gm;
+
+ bool killSupported;
+
+ /// The process list.
+ ProcessList* pList;
+ ///Layout for the search line and process filter combo box
+ QHBoxLayout* gmSearch;
+ KListViewSearchLineWidget *pListSearchLine;
+
+ QHBoxLayout* gm1;
+
+ /// Checkbox to switch between tree and list view
+ QCheckBox* xbTreeView;
+
+ /// This combo boxes control the process filter.
+ QComboBox* cbFilter;
+
+ /// These buttons force an immedeate refresh or kill a process.
+ KPushButton* bRefresh;
+ KPushButton* bKill;
+
+ /// Dictionary for header translations.
+ QDict<QString> dict;
+};
+
+#endif