diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
commit | c663b6440964f6ac48027143ac9e63298991f9d0 (patch) | |
tree | 6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kicker/applets/naughty | |
parent | a061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff) | |
download | tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker/applets/naughty')
-rw-r--r-- | kicker/applets/naughty/NaughtyApplet.cpp | 40 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyApplet.h | 10 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyConfigDialog.cpp | 10 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyConfigDialog.h | 6 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyProcessMonitor.cpp | 88 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyProcessMonitor.h | 10 |
6 files changed, 82 insertions, 82 deletions
diff --git a/kicker/applets/naughty/NaughtyApplet.cpp b/kicker/applets/naughty/NaughtyApplet.cpp index c256aa36f..44f2229ec 100644 --- a/kicker/applets/naughty/NaughtyApplet.cpp +++ b/kicker/applets/naughty/NaughtyApplet.cpp @@ -22,9 +22,9 @@ #include "NaughtyProcessMonitor.h" #include "NaughtyConfigDialog.h" -#include <qmessagebox.h> -#include <qtoolbutton.h> -#include <qlayout.h> +#include <tqmessagebox.h> +#include <tqtoolbutton.h> +#include <tqlayout.h> #include <kiconloader.h> #include <kglobal.h> @@ -34,11 +34,11 @@ #include <klocale.h> #include <kpopupmenu.h> #include <kmessagebox.h> -#include <qpushbutton.h> +#include <tqpushbutton.h> extern "C" { - KDE_EXPORT KPanelApplet* init(QWidget * parent, const QString & configFile) + KDE_EXPORT KPanelApplet* init(TQWidget * parent, const TQString & configFile) { KGlobal::locale()->insertCatalogue("naughtyapplet"); @@ -55,10 +55,10 @@ extern "C" NaughtyApplet::NaughtyApplet ( - const QString & configFile, + const TQString & configFile, Type t, int actions, - QWidget * parent, + TQWidget * parent, const char * name ) : KPanelApplet(configFile, t, actions, parent, name) @@ -69,27 +69,27 @@ NaughtyApplet::NaughtyApplet button_ = new SimpleButton(this); button_->setFixedSize(20, 20); - QVBoxLayout * layout = new QVBoxLayout(this); + TQVBoxLayout * layout = new TQVBoxLayout(this); layout->addWidget(button_); monitor_ = new NaughtyProcessMonitor(2, 20, this); connect ( - button_, SIGNAL(clicked()), - this, SLOT(slotPreferences()) + button_, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotPreferences()) ); connect ( - monitor_, SIGNAL(runawayProcess(ulong, const QString &)), - this, SLOT(slotWarn(ulong, const QString &)) + monitor_, TQT_SIGNAL(runawayProcess(ulong, const TQString &)), + this, TQT_SLOT(slotWarn(ulong, const TQString &)) ); connect ( - monitor_, SIGNAL(load(uint)), - this, SLOT(slotLoad(uint)) + monitor_, TQT_SIGNAL(load(uint)), + this, TQT_SLOT(slotLoad(uint)) ); loadSettings(); @@ -103,17 +103,17 @@ NaughtyApplet::~NaughtyApplet() } void -NaughtyApplet::slotWarn(ulong pid, const QString & name) +NaughtyApplet::slotWarn(ulong pid, const TQString & name) { if (ignoreList_.contains(name)) return; - QString s = i18n("A program called '%1' is slowing down the others " + TQString s = i18n("A program called '%1' is slowing down the others " "on your machine. It may have a bug that is causing " "this, or it may just be busy.\n" "Would you like to try to stop the program?"); - int retval = KMessageBox::warningYesNo(this, s.arg(name), QString::null, i18n("Stop"), i18n("Keep Running")); + int retval = KMessageBox::warningYesNo(this, s.arg(name), TQString::null, i18n("Stop"), i18n("Keep Running")); if (KMessageBox::Yes == retval) monitor_->kill(pid); @@ -121,7 +121,7 @@ NaughtyApplet::slotWarn(ulong pid, const QString & name) { s = i18n("In future, should busy programs called '%1' be ignored?"); - retval = KMessageBox::questionYesNo(this, s.arg(name), QString::null, i18n("Ignore"), i18n("Do Not Ignore")); + retval = KMessageBox::questionYesNo(this, s.arg(name), TQString::null, i18n("Ignore"), i18n("Do Not Ignore")); if (KMessageBox::Yes == retval) { @@ -187,9 +187,9 @@ NaughtyApplet::preferences() this ); - QDialog::DialogCode retval = QDialog::DialogCode(d.exec()); + TQDialog::DialogCode retval = TQDialog::DialogCode(d.exec()); - if (QDialog::Accepted == retval) + if (TQDialog::Accepted == retval) { ignoreList_ = d.ignoreList(); monitor_->setInterval(d.updateInterval()); diff --git a/kicker/applets/naughty/NaughtyApplet.h b/kicker/applets/naughty/NaughtyApplet.h index 00df51ec4..b9da7b3f9 100644 --- a/kicker/applets/naughty/NaughtyApplet.h +++ b/kicker/applets/naughty/NaughtyApplet.h @@ -22,7 +22,7 @@ #define NAUGHTY_H #include <kpanelapplet.h> -#include <qstringlist.h> +#include <tqstringlist.h> #include "simplebutton.h" @@ -37,10 +37,10 @@ class NaughtyApplet : public KPanelApplet NaughtyApplet ( - const QString & configFile, + const TQString & configFile, Type t = Normal, int actions = 0, - QWidget * parent = 0, + TQWidget * parent = 0, const char * name = 0 ); @@ -55,7 +55,7 @@ class NaughtyApplet : public KPanelApplet protected slots: - void slotWarn(ulong pid, const QString & name); + void slotWarn(ulong pid, const TQString & name); void slotLoad(uint); void slotPreferences(); @@ -70,7 +70,7 @@ class NaughtyApplet : public KPanelApplet NaughtyProcessMonitor * monitor_; SimpleButton * button_; - QStringList ignoreList_; + TQStringList ignoreList_; }; #endif diff --git a/kicker/applets/naughty/NaughtyConfigDialog.cpp b/kicker/applets/naughty/NaughtyConfigDialog.cpp index e03a955cc..57146778d 100644 --- a/kicker/applets/naughty/NaughtyConfigDialog.cpp +++ b/kicker/applets/naughty/NaughtyConfigDialog.cpp @@ -21,17 +21,17 @@ #include <keditlistbox.h> #include <knuminput.h> #include <klocale.h> -#include <qvbox.h> +#include <tqvbox.h> #include "NaughtyConfigDialog.h" #include "NaughtyConfigDialog.moc" NaughtyConfigDialog::NaughtyConfigDialog ( - const QStringList & items, + const TQStringList & items, uint updateInterval, uint threshold, - QWidget * parent, + TQWidget * parent, const char * name ) : @@ -46,7 +46,7 @@ NaughtyConfigDialog::NaughtyConfigDialog true ) { - QVBox * v = new QVBox(this); + TQVBox * v = new TQVBox(this); setMainWidget(v); kini_updateInterval_ = new KIntNumInput(updateInterval, v); @@ -88,7 +88,7 @@ NaughtyConfigDialog::threshold() const QStringList NaughtyConfigDialog::ignoreList() const { - QStringList retval; + TQStringList retval; for (int i = 0; i < listBox_->count(); i++) retval << listBox_->text(i); diff --git a/kicker/applets/naughty/NaughtyConfigDialog.h b/kicker/applets/naughty/NaughtyConfigDialog.h index 485cbf14f..2f5ca311f 100644 --- a/kicker/applets/naughty/NaughtyConfigDialog.h +++ b/kicker/applets/naughty/NaughtyConfigDialog.h @@ -34,16 +34,16 @@ class NaughtyConfigDialog : public KDialogBase NaughtyConfigDialog ( - const QStringList & items, + const TQStringList & items, uint interval, uint threshold, - QWidget * parent = 0, + TQWidget * parent = 0, const char * name = 0 ); ~NaughtyConfigDialog(); - QStringList ignoreList() const; + TQStringList ignoreList() const; uint updateInterval() const; uint threshold() const; diff --git a/kicker/applets/naughty/NaughtyProcessMonitor.cpp b/kicker/applets/naughty/NaughtyProcessMonitor.cpp index f9d352902..37cba7a37 100644 --- a/kicker/applets/naughty/NaughtyProcessMonitor.cpp +++ b/kicker/applets/naughty/NaughtyProcessMonitor.cpp @@ -33,14 +33,14 @@ #include <signal.h> #include <unistd.h> -#include <qfile.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qtextstream.h> -#include <qdir.h> -#include <qtimer.h> -#include <qmap.h> -#include <qdatetime.h> +#include <tqfile.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqtextstream.h> +#include <tqdir.h> +#include <tqtimer.h> +#include <tqmap.h> +#include <tqdatetime.h> #include <klocale.h> @@ -64,12 +64,12 @@ class NaughtyProcessMonitorPrivate } uint interval_; - QTimer * timer_; - QMap<ulong, uint> loadMap_; - QMap<ulong, uint> scoreMap_; + TQTimer * timer_; + TQMap<ulong, uint> loadMap_; + TQMap<ulong, uint> scoreMap_; #ifdef __OpenBSD__ - QMap<ulong, uint> cacheLoadMap_; - QMap<ulong, uid_t> uidMap_; + TQMap<ulong, uint> cacheLoadMap_; + TQMap<ulong, uid_t> uidMap_; #endif uint oldLoad_; uint triggerLevel_; @@ -86,16 +86,16 @@ NaughtyProcessMonitor::NaughtyProcessMonitor ( uint interval, uint triggerLevel, - QObject * parent, + TQObject * parent, const char * name ) - : QObject(parent, name) + : TQObject(parent, name) { d = new NaughtyProcessMonitorPrivate; d->interval_ = interval * 1000; d->triggerLevel_ = triggerLevel; - d->timer_ = new QTimer(this); - connect(d->timer_, SIGNAL(timeout()), this, SLOT(slotTimeout())); + d->timer_ = new TQTimer(this); + connect(d->timer_, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout())); } NaughtyProcessMonitor::~NaughtyProcessMonitor() @@ -151,9 +151,9 @@ NaughtyProcessMonitor::slotTimeout() if (cpu > d->triggerLevel_ * (d->interval_ / 1000)) { uint load; - QValueList<ulong> l(pidList()); + TQValueList<ulong> l(pidList()); - for (QValueList<ulong>::ConstIterator it(l.begin()); it != l.end(); ++it) + for (TQValueList<ulong>::ConstIterator it(l.begin()); it != l.end(); ++it) if (getLoad(*it, load)) _process(*it, load); } @@ -196,19 +196,19 @@ NaughtyProcessMonitor::_process(ulong pid, uint load) NaughtyProcessMonitor::canKill(ulong pid) const { #ifdef __linux__ - QFile f("/proc/" + QString::number(pid) + "/status"); + TQFile f("/proc/" + TQString::number(pid) + "/status"); if (!f.open(IO_ReadOnly)) return false; - QTextStream t(&f); + TQTextStream t(&f); - QString s; + TQString s; while (!t.atEnd() && s.left(4) != "Uid:") s = t.readLine(); - QStringList l(QStringList::split('\t', s)); + TQStringList l(TQStringList::split('\t', s)); uint a(l[1].toUInt()); @@ -236,12 +236,12 @@ NaughtyProcessMonitor::processName(ulong pid) const { #if defined(__linux__) || defined(__OpenBSD__) #ifdef __linux__ - QFile f("/proc/" + QString::number(pid) + "/cmdline"); + TQFile f("/proc/" + TQString::number(pid) + "/cmdline"); if (!f.open(IO_ReadOnly)) return i18n("Unknown"); - QCString s; + TQCString s; while (true) { @@ -255,7 +255,7 @@ NaughtyProcessMonitor::processName(ulong pid) const } // Now strip 'kdeinit:' prefix. - QString unicode(QString::fromLocal8Bit(s)); + TQString unicode(TQString::fromLocal8Bit(s)); #elif defined(__OpenBSD__) int mib[4] ; @@ -280,14 +280,14 @@ NaughtyProcessMonitor::processName(ulong pid) const } // Now strip 'kdeinit:' prefix. - QString unicode(QString::fromLocal8Bit(argv[0])); + TQString unicode(TQString::fromLocal8Bit(argv[0])); free (argv) ; #endif - QStringList parts(QStringList::split(' ', unicode)); + TQStringList parts(TQStringList::split(' ', unicode)); - QString processName = parts[0] == "kdeinit:" ? parts[1] : parts[0]; + TQString processName = parts[0] == "kdeinit:" ? parts[1] : parts[0]; int lastSlash = processName.findRev('/'); @@ -299,7 +299,7 @@ NaughtyProcessMonitor::processName(ulong pid) const #else Q_UNUSED( pid ); - return QString::null; + return TQString::null; #endif } @@ -307,18 +307,18 @@ NaughtyProcessMonitor::processName(ulong pid) const NaughtyProcessMonitor::cpuLoad() const { #ifdef __linux__ - QFile f("/proc/stat"); + TQFile f("/proc/stat"); if (!f.open(IO_ReadOnly)) return 0; bool forgetThisOne = 0 == d->oldLoad_; - QTextStream t(&f); + TQTextStream t(&f); - QString s = t.readLine(); + TQString s = t.readLine(); - QStringList l(QStringList::split(' ', s)); + TQStringList l(TQStringList::split(' ', s)); uint user = l[1].toUInt(); uint sys = l[3].toUInt(); @@ -355,15 +355,15 @@ NaughtyProcessMonitor::cpuLoad() const #endif } - QValueList<ulong> + TQValueList<ulong> NaughtyProcessMonitor::pidList() const { #ifdef __linux__ - QStringList dl(QDir("/proc").entryList()); + TQStringList dl(TQDir("/proc").entryList()); - QValueList<ulong> pl; + TQValueList<ulong> pl; - for (QStringList::ConstIterator it(dl.begin()); it != dl.end(); ++it) + for (TQStringList::ConstIterator it(dl.begin()); it != dl.end(); ++it) if (((*it)[0].isDigit())) pl << (*it).toUInt(); @@ -374,7 +374,7 @@ NaughtyProcessMonitor::pidList() const size_t size ; struct kinfo_proc *kp ; int i ; - QValueList<ulong> l; + TQValueList<ulong> l; // fetch number of processes @@ -421,7 +421,7 @@ NaughtyProcessMonitor::pidList() const return l ; #else - QValueList<ulong> l; + TQValueList<ulong> l; return l; #endif } @@ -430,16 +430,16 @@ NaughtyProcessMonitor::pidList() const NaughtyProcessMonitor::getLoad(ulong pid, uint & load) const { #ifdef __linux__ - QFile f("/proc/" + QString::number(pid) + "/stat"); + TQFile f("/proc/" + TQString::number(pid) + "/stat"); if (!f.open(IO_ReadOnly)) return false; - QTextStream t(&f); + TQTextStream t(&f); - QString line(t.readLine()); + TQString line(t.readLine()); - QStringList fields(QStringList::split(' ', line)); + TQStringList fields(TQStringList::split(' ', line)); uint userTime (fields[13].toUInt()); uint sysTime (fields[14].toUInt()); diff --git a/kicker/applets/naughty/NaughtyProcessMonitor.h b/kicker/applets/naughty/NaughtyProcessMonitor.h index d7023dbd7..cc5c91cfc 100644 --- a/kicker/applets/naughty/NaughtyProcessMonitor.h +++ b/kicker/applets/naughty/NaughtyProcessMonitor.h @@ -21,7 +21,7 @@ #ifndef NAUGHTY_PROCESS_MONITOR_H #define NAUGHTY_PROCESS_MONITOR_H -#include <qobject.h> +#include <tqobject.h> class NaughtyProcessMonitorPrivate; @@ -35,7 +35,7 @@ class NaughtyProcessMonitor : public QObject ( uint interval, uint triggerLevel, - QObject * parent = 0, + TQObject * parent = 0, const char * name = 0 ); @@ -50,9 +50,9 @@ class NaughtyProcessMonitor : public QObject void setInterval(uint); virtual uint cpuLoad() const; - virtual QValueList<ulong> pidList() const; + virtual TQValueList<ulong> pidList() const; virtual bool getLoad(ulong pid, uint & load) const; - virtual QString processName(ulong pid) const; + virtual TQString processName(ulong pid) const; virtual bool canKill(ulong pid) const; virtual bool kill(ulong pid) const; @@ -63,7 +63,7 @@ class NaughtyProcessMonitor : public QObject signals: void load(uint); - void runawayProcess(ulong pid, const QString & name); + void runawayProcess(ulong pid, const TQString & name); private: |