From e72017be3c12fc6fe115cd3fc1bcc70de0facf77 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 30 Jun 2011 18:34:37 +0000 Subject: TQt4 port knetload This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetload@1238870 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- knetload/devicedialog.cpp | 30 +++++++-------- knetload/devicedialog.h | 9 +++-- knetload/icontoggleaction.cpp | 36 +++++++++--------- knetload/icontoggleaction.h | 33 ++++++++-------- knetload/knetdock.cpp | 4 +- knetload/knetdock.h | 2 +- knetload/knetload.cpp | 48 +++++++++++------------ knetload/knetload.h | 23 +++++------ knetload/knetproc.cpp | 6 +-- knetload/knetproc.h | 12 +++--- knetload/scaledialog.cpp | 26 ++++++------- knetload/scaledialog.h | 5 ++- knetload/speeddialog.cpp | 24 ++++++------ knetload/speeddialog.h | 5 ++- knetload/statdock.cpp | 56 +++++++++++++-------------- knetload/statdock.h | 37 +++++++++--------- knetload/statpopup.cpp | 88 +++++++++++++++++++++---------------------- knetload/statpopup.h | 35 ++++++++--------- 18 files changed, 243 insertions(+), 236 deletions(-) diff --git a/knetload/devicedialog.cpp b/knetload/devicedialog.cpp index 3a0f861..ab00fdb 100644 --- a/knetload/devicedialog.cpp +++ b/knetload/devicedialog.cpp @@ -15,11 +15,11 @@ #include #include -#include -#include +#include +#include #ifdef Q_OS_LINUX -#include +#include #include #include #include @@ -27,13 +27,13 @@ #define MAX_NET_DEV_LINE 512 -DeviceDialog::DeviceDialog(const QString& defaultDevice, QWidget* parent) : - KDialogBase(parent, "device dialog", true, +DeviceDialog::DeviceDialog(const TQString& defaultDevice, TQWidget* tqparent) : + KDialogBase(tqparent, "device dialog", true, i18n("Select Network Device"), Ok|Cancel, Ok), device(defaultDevice) { - QHBox* page = makeHBoxMainWidget(); + TQHBox* page = makeHBoxMainWidget(); - new QLabel(i18n("Network device to monitor:"), page); + new TQLabel(i18n("Network device to monitor:"), page); // Items in the combo box are not wrapped with i18n() since they're // literal interface names. @@ -45,11 +45,11 @@ DeviceDialog::DeviceDialog(const QString& defaultDevice, QWidget* parent) : deviceBox->insertItem("ippp0"); deviceBox->insertItem("ppp0"); #else - if ( QDir::root().exists("/sys/class/net") ) + if ( TQDir::root().exists("/sys/class/net") ) { // Exists /sys, 2.6 series kernel - QDir sys("/sys/class/net"); - QStringList l = sys.entryList(); - for(QStringList::iterator it = l.begin(); it != l.end(); it++) + TQDir sys("/sys/class/net"); + TQStringList l = sys.entryList(); + for(TQStringList::iterator it = l.begin(); it != l.end(); it++) { if ( (*it)[0] == '.' ) continue; @@ -91,15 +91,15 @@ DeviceDialog::DeviceDialog(const QString& defaultDevice, QWidget* parent) : #endif deviceBox->setCurrentText(defaultDevice); - connect(deviceBox, SIGNAL(textChanged(const QString&)), - this, SLOT(updateDevice(const QString&))); + connect(deviceBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(updateDevice(const TQString&))); } -const QString& DeviceDialog::getDevice() const { +const TQString& DeviceDialog::getDevice() const { return device; } -void DeviceDialog::updateDevice(const QString& text) { +void DeviceDialog::updateDevice(const TQString& text) { device = text; } diff --git a/knetload/devicedialog.h b/knetload/devicedialog.h index 6152671..fcaa7cf 100644 --- a/knetload/devicedialog.h +++ b/knetload/devicedialog.h @@ -22,29 +22,30 @@ */ class DeviceDialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: /** * Constructor. */ - DeviceDialog(const QString& defaultDevice, QWidget* parent); + DeviceDialog(const TQString& defaultDevice, TQWidget* tqparent); /** * Returns the device currently selected in the dialog. * This is valid after the dialog has closed, though the string * itself will be destroyed when this object is deleted. */ - const QString& getDevice() const; + const TQString& getDevice() const; private slots: /** * Updates the device variable to reflect the latest changes in * the device combo box. */ - virtual void updateDevice(const QString&); + virtual void updateDevice(const TQString&); private: - QString device; + TQString device; /**< The device currently selected in the device combo box. */ }; diff --git a/knetload/icontoggleaction.cpp b/knetload/icontoggleaction.cpp index 521a213..3c39554 100644 --- a/knetload/icontoggleaction.cpp +++ b/knetload/icontoggleaction.cpp @@ -14,39 +14,39 @@ #include "icontoggleaction.h" IconToggleAction::IconToggleAction( - const QString& useTextUnchecked, const QString& useIconUnchecked, - const QString& useTextChecked, const QString& useIconChecked, - const KShortcut& cut, const QObject* receiver, const char* slot, - QObject* parent, const char* name) : + const TQString& useTextUnchecked, const TQString& useIconUnchecked, + const TQString& useTextChecked, const TQString& useIconChecked, + const KShortcut& cut, const TQObject* receiver, const char* slot, + TQObject* tqparent, const char* name) : KToggleAction(useTextUnchecked, useIconUnchecked, cut, receiver, - slot, parent, name), + slot, tqparent, name), textChecked(useTextChecked), textUnchecked(useTextUnchecked), iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) { } -IconToggleAction::IconToggleAction(const QString& useText, - const QString& useIconUnchecked, const QString& useIconChecked, - const KShortcut& cut, const QObject* receiver, const char* slot, - QObject* parent, const char* name) : +IconToggleAction::IconToggleAction(const TQString& useText, + const TQString& useIconUnchecked, const TQString& useIconChecked, + const KShortcut& cut, const TQObject* receiver, const char* slot, + TQObject* tqparent, const char* name) : KToggleAction(useText, useIconUnchecked, cut, receiver, - slot, parent, name), + slot, tqparent, name), textChecked(useText), textUnchecked(useText), iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) { } IconToggleAction::IconToggleAction( - const QString& useTextUnchecked, const QString& useIconUnchecked, - const QString& useTextChecked, const QString& useIconChecked, - const KShortcut& cut, QObject* parent, const char* name) : - KToggleAction(useTextUnchecked, useIconUnchecked, cut, parent, name), + const TQString& useTextUnchecked, const TQString& useIconUnchecked, + const TQString& useTextChecked, const TQString& useIconChecked, + const KShortcut& cut, TQObject* tqparent, const char* name) : + KToggleAction(useTextUnchecked, useIconUnchecked, cut, tqparent, name), textChecked(useTextChecked), textUnchecked(useTextUnchecked), iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) { } -IconToggleAction::IconToggleAction(const QString& useText, - const QString& useIconUnchecked, const QString& useIconChecked, - const KShortcut& cut, QObject* parent, const char* name) : - KToggleAction(useText, useIconUnchecked, cut, parent, name), +IconToggleAction::IconToggleAction(const TQString& useText, + const TQString& useIconUnchecked, const TQString& useIconChecked, + const KShortcut& cut, TQObject* tqparent, const char* name) : + KToggleAction(useText, useIconUnchecked, cut, tqparent, name), textChecked(useText), textUnchecked(useText), iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) { } diff --git a/knetload/icontoggleaction.h b/knetload/icontoggleaction.h index 469f763..9758291 100644 --- a/knetload/icontoggleaction.h +++ b/knetload/icontoggleaction.h @@ -22,28 +22,29 @@ */ class IconToggleAction : public KToggleAction { Q_OBJECT + TQ_OBJECT public: /** * Constructors. */ IconToggleAction( - const QString& useTextUnchecked, const QString& useIconUnchecked, - const QString& useTextChecked, const QString& useIconChecked, - const KShortcut& cut, const QObject* receiver, const char* slot, - QObject* parent, const char* name = 0); - IconToggleAction(const QString& useText, - const QString& useIconUnchecked, const QString& useIconChecked, - const KShortcut& cut, const QObject* receiver, const char* slot, - QObject* parent, const char* name = 0); + const TQString& useTextUnchecked, const TQString& useIconUnchecked, + const TQString& useTextChecked, const TQString& useIconChecked, + const KShortcut& cut, const TQObject* receiver, const char* slot, + TQObject* tqparent, const char* name = 0); + IconToggleAction(const TQString& useText, + const TQString& useIconUnchecked, const TQString& useIconChecked, + const KShortcut& cut, const TQObject* receiver, const char* slot, + TQObject* tqparent, const char* name = 0); IconToggleAction( - const QString& useTextUnchecked, const QString& useIconUnchecked, - const QString& useTextChecked, const QString& useIconChecked, - const KShortcut& cut = KShortcut(), QObject* parent = 0, + const TQString& useTextUnchecked, const TQString& useIconUnchecked, + const TQString& useTextChecked, const TQString& useIconChecked, + const KShortcut& cut = KShortcut(), TQObject* tqparent = 0, const char* name = 0); - IconToggleAction(const QString& useText, - const QString& useIconUnchecked, const QString& useIconChecked, - const KShortcut& cut = KShortcut(), QObject* parent = 0, + IconToggleAction(const TQString& useText, + const TQString& useIconUnchecked, const TQString& useIconChecked, + const KShortcut& cut = KShortcut(), TQObject* tqparent = 0, const char* name = 0); /** @@ -52,9 +53,9 @@ class IconToggleAction : public KToggleAction { virtual void setChecked(bool); private: - QString textChecked, textUnchecked; + TQString textChecked, textUnchecked; /**< The labels to use in the checked and unchecked states. */ - QString iconChecked, iconUnchecked; + TQString iconChecked, iconUnchecked; /**< The icons to use in the checked and unchecked states. */ }; diff --git a/knetload/knetdock.cpp b/knetload/knetdock.cpp index 05cf192..81bc96e 100644 --- a/knetload/knetdock.cpp +++ b/knetload/knetdock.cpp @@ -15,8 +15,8 @@ #include -KNetDock::KNetDock(int whichDock, bool dirIn, StatPopup* parent, +KNetDock::KNetDock(int whichDock, bool dirIn, StatPopup* tqparent, const char* name) : - StatDock(whichDock, dirIn ? i18n("IN").utf8() : i18n("OUT").utf8(), parent, name) { + StatDock(whichDock, dirIn ? i18n("IN").utf8() : i18n("OUT").utf8(), tqparent, name) { } diff --git a/knetload/knetdock.h b/knetload/knetdock.h index 0ebe26f..230ccf0 100644 --- a/knetload/knetdock.h +++ b/knetload/knetdock.h @@ -29,7 +29,7 @@ public: * incoming traffic and \c false if this diagram represents outgoing * traffic. */ - KNetDock(int whichDock, bool dirIn, StatPopup *parent = 0, + KNetDock(int whichDock, bool dirIn, StatPopup *tqparent = 0, const char* name = 0); }; diff --git a/knetload/knetload.cpp b/knetload/knetload.cpp index 84f2627..aa700cd 100644 --- a/knetload/knetload.cpp +++ b/knetload/knetload.cpp @@ -23,13 +23,13 @@ #include #include #include -#include +#include #define DEFAULT_SCALE 128000 #define MAX_NET_DEV_LINE 512 -KNetLoad::KNetLoad(QWidget *parent, const char *name) : - StatPopup(false, parent, name) { +KNetLoad::KNetLoad(TQWidget *tqparent, const char *name) : + StatPopup(false, tqparent, name) { // Create the raw network data reader. proc = new KNetProc(); @@ -41,11 +41,11 @@ KNetLoad::KNetLoad(QWidget *parent, const char *name) : stockDevice.push_back("ppp0"); stockDeviceIconOff.push_back("devppp0"); stockDeviceIconOn.push_back("devppp0on"); stockDevice.push_back("ippp0"); stockDeviceIconOff.push_back("devippp0"); stockDeviceIconOn.push_back("devippp0on"); #else - if ( QDir::root().exists("/sys/class/net") ) + if ( TQDir::root().exists("/sys/class/net") ) { // Exists /sys, 2.6 series kernel - QDir sys("/sys/class/net"); - QStringList l = sys.entryList(); - for(QStringList::iterator it = l.begin(); it != l.end(); it++) + TQDir sys("/sys/class/net"); + TQStringList l = sys.entryList(); + for(TQStringList::iterator it = l.begin(); it != l.end(); it++) { if ( (*it)[0] == '.' ) continue; @@ -54,13 +54,13 @@ KNetLoad::KNetLoad(QWidget *parent, const char *name) : if ( *it == "lo" ) { stockDeviceIconOn.push_back("devloon"); stockDeviceIconOff.push_back("devlo"); - } else if ( (*it).find("eth") == 0 ) { + } else if ( (*it).tqfind("eth") == 0 ) { stockDeviceIconOn.push_back("deveth0on"); stockDeviceIconOff.push_back("deveth0"); - } else if ( (*it).find("ppp") == 0 ) { + } else if ( (*it).tqfind("ppp") == 0 ) { stockDeviceIconOn.push_back("devppp0on"); stockDeviceIconOff.push_back("devppp0"); - } else if ( (*it).find("ippp") == 0 ) { + } else if ( (*it).tqfind("ippp") == 0 ) { stockDeviceIconOn.push_back("devippp0on"); stockDeviceIconOff.push_back("devippp0"); } else { @@ -139,7 +139,7 @@ KNetLoad::~KNetLoad() { delete proc; } -void KNetLoad::setDevice(const QString& newDevice) { +void KNetLoad::setDevice(const TQString& newDevice) { proc->setDevice(newDevice); clearHistory(); updateDeviceMenus(); @@ -161,7 +161,7 @@ void KNetLoad::setDevice(int deviceIndex) { // It's a custom device. Open a dialog. DeviceDialog dlg(proc->getDevice(), firstDock()); if (dlg.exec()) { - QString newDevice = dlg.getDevice().stripWhiteSpace(); + TQString newDevice = dlg.getDevice().stripWhiteSpace(); if (newDevice.isEmpty()) KMessageBox::error(firstDock(), i18n("The device name cannot be empty.")); @@ -224,12 +224,12 @@ void KNetLoad::setScaleOut(int scale) { config->sync(); } -QString KNetLoad::dockName(int which) const { +TQString KNetLoad::dockName(int which) const { return (which == 0 ? i18n("In") : i18n("Out")); } -QColor KNetLoad::defaultDockColor(int which) const { - return (which == 0 ? QColor(0, 0, 255) : QColor(255, 0, 255)); +TQColor KNetLoad::defaultDockColor(int which) const { + return (which == 0 ? TQColor(0, 0, 255) : TQColor(255, 0, 255)); } void KNetLoad::setupCustomActions() { @@ -254,7 +254,7 @@ void KNetLoad::insertCustomItems(KPopupMenu* menu) { stockDevice[i], i); deviceMenu->insertItem(SmallIcon("devother"), i18n("Other...")); updateDeviceMenu(deviceMenu); - connect(deviceMenu, SIGNAL(activated(int)), this, SLOT(setDevice(int))); + connect(deviceMenu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setDevice(int))); menu->insertItem(SmallIcon("devselect"), i18n("&Device"), deviceMenu); // Scale menus. The menu item IDs are the scales themselves (in bits @@ -274,7 +274,7 @@ void KNetLoad::insertCustomItems(KPopupMenu* menu) { scaleInMenu->insertItem(i18n("10MBit/s"), 10000000); scaleInMenu->insertItem(i18n("Other...")); updateScaleInMenu(scaleInMenu); - connect(scaleInMenu, SIGNAL(activated(int)), this, SLOT(setScaleIn(int))); + connect(scaleInMenu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setScaleIn(int))); menu->insertItem(SmallIcon("scalein"), i18n("&Scale (In)"), scaleInMenu); KPopupMenu* scaleOutMenu = new KPopupMenu(menu); @@ -294,7 +294,7 @@ void KNetLoad::insertCustomItems(KPopupMenu* menu) { scaleOutMenu->insertSeparator(); scaleOutMenu->insertItem(i18n("Same as for in"), 0); updateScaleOutMenu(scaleOutMenu); - connect(scaleOutMenu, SIGNAL(activated(int)), this, SLOT(setScaleOut(int))); + connect(scaleOutMenu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setScaleOut(int))); menu->insertItem(SmallIcon("scaleout"), i18n("&Scale (Out)"), scaleOutMenu); // The final separator. @@ -328,12 +328,12 @@ void KNetLoad::takeReadingInternal() { fullReading = i18n( "Current In: %1 KBit/s, Total In: %2 MB.\n" "Current Out: %3 KBit/s, Total Out: %4 MB.") - .arg(KGlobal::locale()->formatNumber((int)((bitRateIn + 50) / 100) / 10.0)).arg(KGlobal::locale()->formatNumber(proc->totalMbIn())) - .arg(KGlobal::locale()->formatNumber((int)((bitRateOut + 50) / 100) / 10.0)).arg(KGlobal::locale()->formatNumber(proc->totalMbOut())); + .tqarg(KGlobal::locale()->formatNumber((int)((bitRateIn + 50) / 100) / 10.0)).tqarg(KGlobal::locale()->formatNumber(proc->totalMbIn())) + .tqarg(KGlobal::locale()->formatNumber((int)((bitRateOut + 50) / 100) / 10.0)).tqarg(KGlobal::locale()->formatNumber(proc->totalMbOut())); } void KNetLoad::updateDeviceMenu(KPopupMenu* menu) { - const QString& dev = proc->getDevice(); + const TQString& dev = proc->getDevice(); // Update the checked/unchecked states of menu items. bool found = false; @@ -369,7 +369,7 @@ void KNetLoad::updateDeviceMenu(KPopupMenu* menu) { menu->setItemChecked(otherId, false); } else { menu->changeItem(otherId, SmallIcon("devotheron"), - QString(i18n("Other (%1)...")).arg(dev)); + TQString(i18n("Other (%1)...")).tqarg(dev)); menu->setItemChecked(otherId, true); } } @@ -403,7 +403,7 @@ void KNetLoad::updateScaleInMenu(KPopupMenu* menu) { if (found) menu->changeItem(otherId, i18n("Other...")); else { - QString text = i18n("Other (%1KBit/s)...").arg(int(((float) scaleIn) / 1000)); + TQString text = i18n("Other (%1KBit/s)...").tqarg(int(((float) scaleIn) / 1000)); menu->changeItem(otherId, text); } @@ -441,7 +441,7 @@ void KNetLoad::updateScaleOutMenu(KPopupMenu* menu) { if (found) menu->changeItem(otherId, i18n("Other...")); else { - QString text = i18n("Other (%1KBit/s)...").arg(int(((float) scaleOut) / 1000)); + TQString text = i18n("Other (%1KBit/s)...").tqarg(int(((float) scaleOut) / 1000)); menu->changeItem(otherId, text); } diff --git a/knetload/knetload.h b/knetload/knetload.h index c371325..e3c6ab8 100644 --- a/knetload/knetload.h +++ b/knetload/knetload.h @@ -16,7 +16,7 @@ #include "statpopup.h" -#include +#include class KAction; class KNetProc; @@ -27,19 +27,20 @@ class KPopupMenu; */ class KNetLoad : public StatPopup { Q_OBJECT + TQ_OBJECT public: /** * Constructor and destructor. */ - KNetLoad(QWidget *parent = 0, const char *name = 0); + KNetLoad(TQWidget *tqparent = 0, const char *name = 0); ~KNetLoad(); public slots: /** * Slots for menu items. */ - void setDevice(const QString& newDevice); + void setDevice(const TQString& newDevice); void setDevice(int deviceIndex); void setScaleIn(int scale); void setScaleOut(int scale); @@ -48,8 +49,8 @@ protected: /** * Overrides from StatPopup. */ - virtual QString dockName(int which) const; - virtual QColor defaultDockColor(int which) const; + virtual TQString dockName(int which) const; + virtual TQColor defaultDockColor(int which) const; virtual void setupCustomActions(); virtual void insertCustomItems(KPopupMenu* menu); virtual void takeReadingInternal(); @@ -84,13 +85,13 @@ private: /** * Lists of menus that must be kept up-to-date. */ - QPtrList deviceMenus; - QPtrList scaleInMenus; - QPtrList scaleOutMenus; + TQPtrList deviceMenus; + TQPtrList scaleInMenus; + TQPtrList scaleOutMenus; - QStringList stockDevice; - QStringList stockDeviceIconOn; - QStringList stockDeviceIconOff; + TQStringList stockDevice; + TQStringList stockDeviceIconOn; + TQStringList stockDeviceIconOff; }; #endif diff --git a/knetload/knetproc.cpp b/knetload/knetproc.cpp index 311afc4..61ae5a6 100644 --- a/knetload/knetproc.cpp +++ b/knetload/knetproc.cpp @@ -33,7 +33,7 @@ // Linux-specific includes. #ifdef Q_OS_LINUX -#include +#include #endif /** @@ -90,7 +90,7 @@ KNetProc::KNetProc() { // ========== Linux-specific (begin) ========== #ifdef Q_OS_LINUX - useSys = QDir::home().exists("/sys/class/net"); + useSys = TQDir::home().exists("/sys/class/net"); #endif // ========== Linux-specific (end) ========== } @@ -106,7 +106,7 @@ KNetProc::~KNetProc() { // ========== BSD-specific (end) ========== } -void KNetProc::setDevice(const QString &interface) { +void KNetProc::setDevice(const TQString &interface) { // Actually set the device. device = interface; diff --git a/knetload/knetproc.h b/knetload/knetproc.h index ea5ec8b..4ca8a95 100644 --- a/knetload/knetproc.h +++ b/knetload/knetproc.h @@ -14,8 +14,8 @@ #ifndef __KNETPROC_H #define __KNETPROC_H -#include -#include +#include +#include /** * A class used to read raw network throughput details from the system. @@ -46,12 +46,12 @@ public: * * An initial set of total traffic readings will be taken. */ - void setDevice(const QString &interface); + void setDevice(const TQString &interface); /** * Returns the network device currently being monitored. */ - QString getDevice() const; + TQString getDevice() const; /** * Takes a fresh set of throughput readings. The values returned by @@ -86,7 +86,7 @@ private: /** * Device and results of readings. */ - QString device; + TQString device; /**< The interface name of the device to monitor. */ float currIn, currOut; /**< Total traffic in bytes from the last reading. */ @@ -122,7 +122,7 @@ private: // ========== Linux specific (end) ========== }; -inline QString KNetProc::getDevice() const { +inline TQString KNetProc::getDevice() const { return device; } diff --git a/knetload/scaledialog.cpp b/knetload/scaledialog.cpp index 62acadf..d74ada7 100644 --- a/knetload/scaledialog.cpp +++ b/knetload/scaledialog.cpp @@ -16,35 +16,35 @@ #include #include #include -#include -#include -#include +#include +#include +#include -ScaleDialog::ScaleDialog(int defaultScale, const QString &title, - QWidget* parent) : - KDialogBase(parent, "scale dialog", true, title, Ok|Cancel, Ok), +ScaleDialog::ScaleDialog(int defaultScale, const TQString &title, + TQWidget* tqparent) : + KDialogBase(tqparent, "scale dialog", true, title, Ok|Cancel, Ok), scale(defaultScale) { - QHBox* page = makeHBoxMainWidget(); + TQHBox* page = makeHBoxMainWidget(); - new QLabel(i18n("Scale in KBit/s:"), page); + new TQLabel(i18n("Scale in KBit/s:"), page); - QString scaleStr; + TQString scaleStr; scaleStr.setNum(defaultScale); KLineEdit* scaleBox = new KLineEdit(scaleStr, page); - QIntValidator* val = new QIntValidator(this); + TQIntValidator* val = new TQIntValidator(TQT_TQOBJECT(this)); val->setBottom(1); scaleBox->setValidator(val); - connect(scaleBox, SIGNAL(textChanged(const QString&)), - this, SLOT(updateScale(const QString&))); + connect(scaleBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(updateScale(const TQString&))); } int ScaleDialog::getScale() const { return scale; } -void ScaleDialog::updateScale(const QString& text) { +void ScaleDialog::updateScale(const TQString& text) { scale = text.toInt(); } diff --git a/knetload/scaledialog.h b/knetload/scaledialog.h index 89f62b1..0db9af4 100644 --- a/knetload/scaledialog.h +++ b/knetload/scaledialog.h @@ -21,12 +21,13 @@ */ class ScaleDialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: /** * Constructor. */ - ScaleDialog(int defaultScale, const QString & title, QWidget* parent); + ScaleDialog(int defaultScale, const TQString & title, TQWidget* tqparent); /** * Returns the scale currently selected in the dialog. @@ -39,7 +40,7 @@ class ScaleDialog : public KDialogBase { * Updates the scale variable to reflect the latest changes in * the scale entry box. */ - virtual void updateScale(const QString&); + virtual void updateScale(const TQString&); private: int scale; diff --git a/knetload/speeddialog.cpp b/knetload/speeddialog.cpp index a2be1ba..8326b08 100644 --- a/knetload/speeddialog.cpp +++ b/knetload/speeddialog.cpp @@ -16,30 +16,30 @@ #include #include #include -#include -#include -#include +#include +#include +#include static int stockSpeed[] = { 100, 150, 200, 250, 300, 400, 600, 800, 1000, 1200, 1500, 2000, 2500, 3000, 4000, 5000, 0 }; -SpeedDialog::SpeedDialog(int defaultSpeed, QWidget* parent) : - KDialogBase(parent, "speed dialog", true, +SpeedDialog::SpeedDialog(int defaultSpeed, TQWidget* tqparent) : + KDialogBase(tqparent, "speed dialog", true, i18n("Select Speed"), Ok|Cancel, Ok), speed(defaultSpeed) { - QHBox* page = makeHBoxMainWidget(); + TQHBox* page = makeHBoxMainWidget(); - new QLabel(i18n("Update interval in milliseconds:"), page); + new TQLabel(i18n("Update interval in milliseconds:"), page); KComboBox* speedBox = new KComboBox(true, page); - QIntValidator* val = new QIntValidator(this); + TQIntValidator* val = new TQIntValidator(TQT_TQOBJECT(this)); val->setBottom(1); speedBox->setValidator(val); - QString speedStr; + TQString speedStr; for (int i = 0; stockSpeed[i]; i++) { speedStr.setNum(stockSpeed[i]); speedBox->insertItem(speedStr); @@ -48,15 +48,15 @@ SpeedDialog::SpeedDialog(int defaultSpeed, QWidget* parent) : speedStr.setNum(defaultSpeed); speedBox->setCurrentText(speedStr); - connect(speedBox, SIGNAL(textChanged(const QString&)), - this, SLOT(updateSpeed(const QString&))); + connect(speedBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(updateSpeed(const TQString&))); } int SpeedDialog::getSpeed() const { return speed; } -void SpeedDialog::updateSpeed(const QString& text) { +void SpeedDialog::updateSpeed(const TQString& text) { speed = text.toInt(); } diff --git a/knetload/speeddialog.h b/knetload/speeddialog.h index 491a6be..aade140 100644 --- a/knetload/speeddialog.h +++ b/knetload/speeddialog.h @@ -21,12 +21,13 @@ */ class SpeedDialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: /** * Constructor. */ - SpeedDialog(int defaultSpeed, QWidget* parent); + SpeedDialog(int defaultSpeed, TQWidget* tqparent); /** * Returns the speed currently selected in the dialog. @@ -39,7 +40,7 @@ class SpeedDialog : public KDialogBase { * Updates the speed variable to reflect the latest changes in * the speed combo box. */ - virtual void updateSpeed(const QString&); + virtual void updateSpeed(const TQString&); private: int speed; diff --git a/knetload/statdock.cpp b/knetload/statdock.cpp index 13eac11..50f2cf9 100644 --- a/knetload/statdock.cpp +++ b/knetload/statdock.cpp @@ -13,19 +13,19 @@ #include "statdock.h" #include "statpopup.h" -#include +#include const int StatDock::fillLines = 0; const int StatDock::fillBars = 1; const int StatDock::fillShaded = 2; -const QColor StatDock::colorGrid(120, 120, 120); -const QColor StatDock::colorGridInactive(60, 60, 60); -const QColor StatDock::colorLabel(255, 255, 255); -const QColor StatDock::colorLabelInactive(125, 125, 125); -const QColor StatDock::colorLower(255, 255, 255); -const QColor StatDock::colorLowerInactive(125, 125, 125); -const QColor StatDock::colorBlack(0, 0, 0); +const TQColor StatDock::colorGrid(120, 120, 120); +const TQColor StatDock::colorGridInactive(60, 60, 60); +const TQColor StatDock::colorLabel(255, 255, 255); +const TQColor StatDock::colorLabelInactive(125, 125, 125); +const TQColor StatDock::colorLower(255, 255, 255); +const TQColor StatDock::colorLowerInactive(125, 125, 125); +const TQColor StatDock::colorBlack(0, 0, 0); //#define DOCK_SIZE 24 #define DOCK_SIZE width() @@ -33,9 +33,9 @@ const QColor StatDock::colorBlack(0, 0, 0); #define SOFT_STEP 3 StatDock::StatDock(int whichDock, const char* useLabel, - StatPopup *parent, const char *name) : - KSystemTray(parent,name), - label(QString::fromUtf8(useLabel)), + StatPopup *tqparent, const char *name) : + KSystemTray(tqparent,name), + label(TQString::fromUtf8(useLabel)), bufUpper(0), bufLower(0), pos(0) { @@ -48,7 +48,7 @@ StatDock::StatDock(int whichDock, const char* useLabel, bufUpper[i] = bufLower[i] = 0; // Initialise the display. - parent->initDock(this, contextMenu(), whichDock); + tqparent->initDock(this, contextMenu(), whichDock); setBackgroundColor(colorBlack); resize(DOCK_SIZE, DOCK_SIZE); show(); @@ -59,7 +59,7 @@ StatDock::~StatDock() { delete[] bufLower; } -void StatDock::resizeEvent ( QResizeEvent * ) +void StatDock::resizeEvent ( TQResizeEvent * ) { // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes int* bufUpperOld; @@ -78,54 +78,54 @@ void StatDock::resizeEvent ( QResizeEvent * ) delete[] bufUpperOld; delete[] bufLowerOld; - repaint(); + tqrepaint(); } void StatDock::setGrid(bool set) { grid = set; - repaint(); + tqrepaint(); } void StatDock::setActive(bool set) { active = set; - repaint(); + tqrepaint(); } void StatDock::setSoft(bool set) { soft = set; - repaint(); + tqrepaint(); } void StatDock::setSplit(bool set) { split = set; - repaint(); + tqrepaint(); } void StatDock::setLabelled(bool set) { labelled = set; - repaint(); + tqrepaint(); } void StatDock::setLabel(const char* set) { label = set; - repaint(); + tqrepaint(); } void StatDock::setFill(int set) { fill = set; - repaint(); + tqrepaint(); } -void StatDock::setColor(const QColor& set) { +void StatDock::setColor(const TQColor& set) { colorUpper = set; colorUpperInactive = colorUpper.dark(); - repaint(); + tqrepaint(); } void StatDock::clearHistory(void) { for (i = 0; i < DOCK_SIZE; i++) bufUpper[i] = bufLower[i] = 0; - repaint(); + tqrepaint(); } void StatDock::addPercentReading(int upper, int lower) { @@ -164,11 +164,11 @@ void StatDock::addPercentReading(int upper, int lower) { } // Refresh the diagram. - repaint(); + tqrepaint(); } -void StatDock::paintEvent(QPaintEvent*) { - QPainter p(this); +void StatDock::paintEvent(TQPaintEvent*) { + TQPainter p(this); // Start by drawing the grid. if(grid) { @@ -261,7 +261,7 @@ void StatDock::paintEvent(QPaintEvent*) { // Finally label the diagrams. if(labelled) { - p.setFont(QFont( "Helvetica", ((8*DOCK_SIZE)/24) )); + p.setFont(TQFont( "Helvetica", ((8*DOCK_SIZE)/24) )); p.setPen((active) ? colorLabel : colorLabelInactive); p.drawText(rect(), AlignLeft | AlignTop, label); } diff --git a/knetload/statdock.h b/knetload/statdock.h index c3e715a..013de98 100644 --- a/knetload/statdock.h +++ b/knetload/statdock.h @@ -14,7 +14,7 @@ #ifndef __STATDOCK_H #define __STATDOCK_H -#include +#include #include class StatPopup; @@ -29,11 +29,12 @@ class StatPopup; * with the upper readings shown above the lower readings. When diagram * splitting is switched off, only the upper readings will be displayed. * - * The parent window of a StatDock must be a StatPopup, which provides + * The tqparent window of a StatDock must be a StatPopup, which provides * all of the actions in this window's context menu. */ class StatDock : public KSystemTray { Q_OBJECT + TQ_OBJECT public: /** @@ -46,26 +47,26 @@ public: /** * Colour constants. */ - static const QColor colorGrid; - static const QColor colorGridInactive; - static const QColor colorLabel; - static const QColor colorLabelInactive; - static const QColor colorLower; - static const QColor colorLowerInactive; - static const QColor colorBlack; + static const TQColor colorGrid; + static const TQColor colorGridInactive; + static const TQColor colorLabel; + static const TQColor colorLabelInactive; + static const TQColor colorLower; + static const TQColor colorLowerInactive; + static const TQColor colorBlack; public: /** * Constructor and destructor. * - * Note that the constructor will call parent->initDock(). + * Note that the constructor will call tqparent->initDock(). * * Parameter whichDock must be 0 or 1 to specify whether this dock - * will become dock[0] or dock[1] in the given StatPopup parent. + * will become dock[0] or dock[1] in the given StatPopup tqparent. * Parameter useLabel should contain the label that will be drawn on * the diagram if labelling is enabled. */ - StatDock(int whichDock, const char* useLabel, StatPopup *parent, + StatDock(int whichDock, const char* useLabel, StatPopup *tqparent, const char *name = 0); ~StatDock(); @@ -79,7 +80,7 @@ public: void setLabelled(bool); void setLabel(const char*); void setFill(int); - void setColor(const QColor&); + void setColor(const TQColor&); public slots: /** @@ -108,7 +109,7 @@ private: /** * Repaint this system tray window with a fresh diagram. */ - void paintEvent(QPaintEvent*); + void paintEvent(TQPaintEvent*); private: /** @@ -125,13 +126,13 @@ private: /**< Are we displaying both upper and lower readings? */ bool labelled; /**< Should this diagram be labelled? */ - QString label; + TQString label; /**< The specific label to draw on this diagram. */ int fill; /**< Specifies which of the predefined fill styles to use. */ - QColor colorUpper; + TQColor colorUpper; /**< Colour for displaying the upper readings. */ - QColor colorUpperInactive; + TQColor colorUpperInactive; /**< Colour for displaying the upper readings whilst the diagram is inactive. */ @@ -157,7 +158,7 @@ private: /**< Temporary variables used during computations. */ protected: - void resizeEvent ( QResizeEvent * ); + void resizeEvent ( TQResizeEvent * ); }; #endif diff --git a/knetload/statpopup.cpp b/knetload/statpopup.cpp index ef64c61..2ce8c4f 100644 --- a/knetload/statpopup.cpp +++ b/knetload/statpopup.cpp @@ -16,8 +16,8 @@ #include "statdock.h" #include "statpopup.h" -#include -#include +#include +#include #include #include #include @@ -33,11 +33,11 @@ #define TEXT_EXPANSION_HORIZONTAL 10 #define TEXT_EXPANSION_VERTICAL 3 -const QColor StatPopup::colorBorder(0, 0, 0); +const TQColor StatPopup::colorBorder(0, 0, 0); -StatPopup::StatPopup(bool useSupportSplit, QWidget *parent, const char *name) : - QWidget(parent, name, Qt::WStyle_Customize | Qt::WStyle_NoBorder | - Qt::WStyle_StaysOnTop | Qt::WDestructiveClose | Qt::WType_TopLevel), +StatPopup::StatPopup(bool useSupportSplit, TQWidget *tqparent, const char *name) : + TQWidget(tqparent, name, TQt::WStyle_Customize | TQt::WStyle_NoBorder | + TQt::WStyle_StaysOnTop | TQt::WDestructiveClose | TQt::WType_TopLevel), supportSplit(useSupportSplit) { // Window management. KWin::setState(winId(), NET::SkipTaskbar | NET::SkipPager); @@ -60,8 +60,8 @@ StatPopup::StatPopup(bool useSupportSplit, QWidget *parent, const char *name) : coll = new KActionCollection(this); // Set up a timer for our periodic updates. - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(takeReading())); + timer = new TQTimer(this); + connect(timer, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(takeReading())); } StatPopup::~StatPopup() { @@ -291,9 +291,9 @@ void StatPopup::setGrid(bool set) { void StatPopup::selectColor0() { if (dock[0]) { - QColor ans; + TQColor ans; if (KColorDialog::getColor(ans, color[0], firstDock()) == - QDialog::Accepted) { + TQDialog::Accepted) { color[0] = ans; dock[0]->setColor(ans); @@ -306,9 +306,9 @@ void StatPopup::selectColor0() { void StatPopup::selectColor1() { if (dock[1]) { - QColor ans; + TQColor ans; if (KColorDialog::getColor(ans, color[1], firstDock()) == - QDialog::Accepted) { + TQDialog::Accepted) { color[1] = ans; dock[1]->setColor(ans); @@ -344,30 +344,30 @@ void StatPopup::setupActions() { bVal = config->readBoolEntry("Active", true); actActive = new KToggleAction(i18n("&Active"), 0, coll, "active"); actActive->setChecked(bVal); - connect(actActive, SIGNAL(toggled(bool)), this, SLOT(setActive(bool))); + connect(actActive, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setActive(bool))); actClearHistory = new KAction(i18n("&Clear"), "editdelete", 0, - this, SLOT(clearHistory()), coll, "clear"); + TQT_TQOBJECT(this), TQT_SLOT(clearHistory()), coll, "clear"); speed = config->readNumEntry("Speed", DEFAULT_SPEED); actSpeed = new KAction(i18n("&Speed..."), "speedarrow", 0, - this, SLOT(selectSpeed()), coll, "speed"); + TQT_TQOBJECT(this), TQT_SLOT(selectSpeed()), coll, "speed"); if (supportSplit) { bVal = config->readBoolEntry("Split", true); actSplit = new IconToggleAction(i18n("Sp&lit Graph"), "split", i18n("Graph Sp&litting Enabled"), "spliton", 0, coll, "split"); actSplit->setChecked(bVal); - connect(actSplit, SIGNAL(toggled(bool)), this, SLOT(setSplit(bool))); + connect(actSplit, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setSplit(bool))); } iVal = config->readNumEntry("StyleID", StatDock::fillShaded); actFillLines = new IconToggleAction(i18n("&Lines"), "lines", "lineson", 0, - this, SLOT(setFillLines()), coll, "filllines"); + TQT_TQOBJECT(this), TQT_SLOT(setFillLines()), coll, "filllines"); actFillBars = new IconToggleAction(i18n("&Bars"), "bars", "barson", 0, - this, SLOT(setFillBars()), coll, "fillbars"); + TQT_TQOBJECT(this), TQT_SLOT(setFillBars()), coll, "fillbars"); actFillShaded = new IconToggleAction(i18n("&Shaded"), "shaded", "shadedon", - 0, this, SLOT(setFillShaded()), coll, "fillshaded"); + 0, TQT_TQOBJECT(this), TQT_SLOT(setFillShaded()), coll, "fillshaded"); if (iVal == StatDock::fillLines) setFillLines(); else if (iVal == StatDock::fillBars) @@ -379,37 +379,37 @@ void StatPopup::setupActions() { actSoft = new IconToggleAction(i18n("So&ft Curves"), "soft", i18n("So&ft Curves Enabled"), "softon", 0, coll, "soft"); actSoft->setChecked(bVal); - connect(actSoft, SIGNAL(toggled(bool)), this, SLOT(setSoft(bool))); + connect(actSoft, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setSoft(bool))); bVal = config->readBoolEntry("Labelled", true); actLabelled= new IconToggleAction(i18n("Show &Labels"), "labels", i18n("&Labels Enabled"), "labelson", 0, coll, "labelled"); actLabelled->setChecked(bVal); - connect(actLabelled, SIGNAL(toggled(bool)), this, SLOT(setLabelled(bool))); + connect(actLabelled, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setLabelled(bool))); bVal = config->readBoolEntry("Grid", true); actGrid = new IconToggleAction(i18n("Show &Grid"), "grid", i18n("&Grid Enabled"), "gridon", 0, coll, "grid"); actGrid->setChecked(bVal); - connect(actGrid, SIGNAL(toggled(bool)), this, SLOT(setGrid(bool))); + connect(actGrid, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setGrid(bool))); color[0] = defaultDockColor(0); color[0] = config->readColorEntry("Color0", color); - actColor0 = new KAction(QString(i18n("Color (%1)...")).arg(dockName(0)), - "color0", 0, this, SLOT(selectColor0()), coll, "color0"); + actColor0 = new KAction(TQString(i18n("Color (%1)...")).tqarg(dockName(0)), + "color0", 0, TQT_TQOBJECT(this), TQT_SLOT(selectColor0()), coll, "color0"); actColor0->setEnabled(false); color[1] = defaultDockColor(1); color[1] = config->readColorEntry("Color1", color + 1); - actColor1 = new KAction(QString(i18n("Color (%1)...")).arg(dockName(1)), - "color1", 0, this, SLOT(selectColor1()), coll, "color1"); + actColor1 = new KAction(TQString(i18n("Color (%1)...")).tqarg(dockName(1)), + "color1", 0, TQT_TQOBJECT(this), TQT_SLOT(selectColor1()), coll, "color1"); actColor1->setEnabled(false); setupCustomActions(); } -void StatPopup::paintEvent(QPaintEvent*) { - QPainter p(this); +void StatPopup::paintEvent(TQPaintEvent*) { + TQPainter p(this); // Draw the border. p.setPen(colorBorder); @@ -424,12 +424,12 @@ void StatPopup::paintEvent(QPaintEvent*) { // Draw the text. p.setFont(font()); - p.setPen(colorGroup().foreground()); + p.setPen(tqcolorGroup().foreground()); p.drawText(rect(), AlignHCenter | AlignVCenter, fullReading); } -void StatPopup::mousePressEvent(QMouseEvent* e) { - if(e->button() == RightButton) { +void StatPopup::mousePressEvent(TQMouseEvent* e) { + if(e->button() == Qt::RightButton) { // Hide the pop-up. hide(); } else { @@ -437,45 +437,45 @@ void StatPopup::mousePressEvent(QMouseEvent* e) { isDragged = true; relX = e->x(); relY = e->y(); - repaint(); + tqrepaint(); } } -void StatPopup::mouseMoveEvent(QMouseEvent* e) { +void StatPopup::mouseMoveEvent(TQMouseEvent* e) { // In the middle of a drag operation. move(e->globalX() - relX, e->globalY() - relY); } -void StatPopup::mouseReleaseEvent(QMouseEvent* e) { +void StatPopup::mouseReleaseEvent(TQMouseEvent* e) { // The end of a drag operation. move(e->globalX() - relX, e->globalY() - relY); isDragged = false; - repaint(); + tqrepaint(); } -void StatPopup::closeEvent(QCloseEvent* e) { +void StatPopup::closeEvent(TQCloseEvent* e) { // We're about to close. Save the current state for the last time. savePopupState(); closing = true; - QWidget::closeEvent(e); + TQWidget::closeEvent(e); } -void StatPopup::hideEvent(QHideEvent* e) { +void StatPopup::hideEvent(TQHideEvent* e) { // We're about to hide. Save the current state if we're not // closing altogether. if (! closing) savePopupState(); - QWidget::hideEvent(e); + TQWidget::hideEvent(e); } -void StatPopup::showEvent(QShowEvent* e) { +void StatPopup::showEvent(TQShowEvent* e) { // Make sure we're up-to-date and properly resized. if (isActive()) takeReading(); else resizeToText(); - QWidget::showEvent(e); + TQWidget::showEvent(e); } void StatPopup::takeReading() { @@ -492,17 +492,17 @@ void StatPopup::takeReading() { if (resizeRequested) resizeToText(); - repaint(); + tqrepaint(); } } void StatPopup::resizeToText() { resizeRequested = false; - QSize size = fontMetrics().size(0, fullReading); + TQSize size = fontMetrics().size(0, fullReading); resize(size.width() + 2 * TEXT_EXPANSION_HORIZONTAL, size.height() + 2 * TEXT_EXPANSION_VERTICAL); - repaint(); + tqrepaint(); } diff --git a/knetload/statpopup.h b/knetload/statpopup.h index f98d48b..7c5f358 100644 --- a/knetload/statpopup.h +++ b/knetload/statpopup.h @@ -14,7 +14,7 @@ #ifndef __STATPOPUP_H #define __STATPOPUP_H -#include +#include class KAction; class KActionCollection; @@ -23,7 +23,7 @@ class KPopupMenu; class KRadioAction; class KSelectAction; class KToggleAction; -class QTimer; +class TQTimer; class StatDock; /** @@ -47,14 +47,15 @@ class StatDock; * require either subclass initialisation or an existing system tray * window. */ -class StatPopup : public QWidget { +class StatPopup : public TQWidget { Q_OBJECT + TQ_OBJECT public: /** * Colour constants. */ - static const QColor colorBorder; + static const TQColor colorBorder; public: /** @@ -64,7 +65,7 @@ public: * any configuration information. See the general class notes also * for a list of other routines this constructor will not call. */ - StatPopup(bool useSupportSplit, QWidget *parent = 0, const char *name = 0); + StatPopup(bool useSupportSplit, TQWidget *tqparent = 0, const char *name = 0); ~StatPopup(); /** @@ -141,8 +142,8 @@ protected: * The argument given will be either 0 or 1, referring to window * dock[0] or dock[1] respectively. */ - virtual QString dockName(int which) const = 0; - virtual QColor defaultDockColor(int which) const = 0; + virtual TQString dockName(int which) const = 0; + virtual TQColor defaultDockColor(int which) const = 0; /** * Take a fresh reading. Subclasses must override this routine. @@ -208,21 +209,21 @@ protected: /** * Custom painting routine. */ - void paintEvent(QPaintEvent *); + void paintEvent(TQPaintEvent *); /** * Overrides for dragging support. */ - void mousePressEvent(QMouseEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); + void mousePressEvent(TQMouseEvent *); + void mouseReleaseEvent(TQMouseEvent *); + void mouseMoveEvent(TQMouseEvent *); /** * Overrides for saving the popup state. */ - void closeEvent(QCloseEvent *); - void hideEvent(QHideEvent *); - void showEvent(QShowEvent *); + void closeEvent(TQCloseEvent *); + void hideEvent(TQHideEvent *); + void showEvent(TQShowEvent *); protected slots: /** @@ -251,7 +252,7 @@ protected: int lower[2]; /**< The lower readings taken during the last reading, one for each system tray window. */ - QString fullReading; + TQString fullReading; /**< A full string describing the last reading taken, to be displayed in this pop-up. */ @@ -267,7 +268,7 @@ private: /** * Update support. */ - QTimer* timer; + TQTimer* timer; /**< The timer handling periodic updates. */ int speed; /**< The frequency of updates in milliseconds. */ @@ -275,7 +276,7 @@ private: /** * Diagram support. */ - QColor color[2]; + TQColor color[2]; /**< The colours used in the two system tray diagrams. */ int fillStyle; /**< The fill style used in the system tray diagrams. */ -- cgit v1.2.3