summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 19:04:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 19:04:06 +0000
commit068115608dea3467ea28e9b85547657da8d632e7 (patch)
tree14aa4204bba0f2bd32929ebe5bae3ce3c8ca60ba
parentf420d77148efca3cc1a5769f3321ab1ebdb1ba26 (diff)
downloadknetstats-068115608dea3467ea28e9b85547657da8d632e7.tar.gz
knetstats-068115608dea3467ea28e9b85547657da8d632e7.zip
TQt4 convert knetstats
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetstats@1238873 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--src/src/chart.cpp22
-rw-r--r--src/src/chart.h12
-rw-r--r--src/src/configure.cpp48
-rw-r--r--src/src/configure.h25
-rw-r--r--src/src/configurebase.ui88
-rw-r--r--src/src/interface.cpp4
-rw-r--r--src/src/interface.h16
-rw-r--r--src/src/knetstats.cpp46
-rw-r--r--src/src/knetstats.h11
-rw-r--r--src/src/knetstatsview.cpp124
-rw-r--r--src/src/knetstatsview.h61
-rw-r--r--src/src/statistics.cpp36
-rw-r--r--src/src/statistics.h17
-rw-r--r--src/src/statisticsbase.ui98
14 files changed, 306 insertions, 302 deletions
diff --git a/src/src/chart.cpp b/src/src/chart.cpp
index 9f48f14..9aad2d0 100644
--- a/src/src/chart.cpp
+++ b/src/src/chart.cpp
@@ -19,19 +19,19 @@
***************************************************************************/
#include "chart.h"
-#include <qpainter.h>
-#include <qbrush.h>
+#include <tqpainter.h>
+#include <tqbrush.h>
-Chart::Chart(QWidget* parent, const double* uploadBuffer, const double* downloadBuffer, int bufferSize, const int* ptr, const double* maxspeed) : QWidget(parent), mUplBuffer(uploadBuffer), mDldBuffer(downloadBuffer), mBufferSize(bufferSize), mPtr(ptr), mMaxSpeed(maxspeed) {
- setWFlags(Qt::WNoAutoErase);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+Chart::Chart(TQWidget* tqparent, const double* uploadBuffer, const double* downloadBuffer, int bufferSize, const int* ptr, const double* maxspeed) : TQWidget(tqparent), mUplBuffer(uploadBuffer), mDldBuffer(downloadBuffer), mBufferSize(bufferSize), mPtr(ptr), mMaxSpeed(maxspeed) {
+ setWFlags(TQt::WNoAutoErase);
+ tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
}
-void Chart::paintEvent(QPaintEvent*) {
- QPainter paint(this);
- paint.setBackgroundColor(Qt::black);
+void Chart::paintEvent(TQPaintEvent*) {
+ TQPainter paint(this);
+ paint.setBackgroundColor(TQt::black);
paint.setBackgroundMode(Qt::OpaqueMode);
- QBrush brush(QColor(0x33, 0x33, 0x33), CrossPattern);
+ TQBrush brush(TQColor(0x33, 0x33, 0x33), CrossPattern);
paint.fillRect(0, 0, width(), height(), brush);
const double step = width()/double(mBufferSize);
@@ -48,9 +48,9 @@ void Chart::paintEvent(QPaintEvent*) {
i = mBufferSize-1;
int rxY = HEIGHT - int(HEIGHT * (mDldBuffer[i]/(*mMaxSpeed)));
int txY = HEIGHT - int(HEIGHT * (mUplBuffer[i]/(*mMaxSpeed)));
- paint.setPen(Qt::green);
+ paint.setPen(TQt::green);
paint.drawLine(lastX, lastRxY, x, rxY);
- paint.setPen(Qt::red);
+ paint.setPen(TQt::red);
paint.drawLine(lastX, lastTxY, x, txY);
//qDebug("%d => %d", i, int(mSpeedHistoryRx[i]));
lastX = x;
diff --git a/src/src/chart.h b/src/src/chart.h
index 2e89540..346eb40 100644
--- a/src/src/chart.h
+++ b/src/src/chart.h
@@ -21,16 +21,16 @@
#ifndef CHART_H
#define CHART_H
-#include <qwidget.h>
+#include <tqwidget.h>
-class QPaintEvent;
+class TQPaintEvent;
-class Chart : public QWidget {
+class Chart : public TQWidget {
public:
- Chart(QWidget* parent, const double* uploadBuffer, const double* downloadBuffer, int bufferSize, const int* ptr, const double* maxspeed);
- QSize sizeHint() { return QSize(200, 100); }
+ Chart(TQWidget* tqparent, const double* uploadBuffer, const double* downloadBuffer, int bufferSize, const int* ptr, const double* maxspeed);
+ TQSize tqsizeHint() { return TQSize(200, 100); }
protected:
- void paintEvent( QPaintEvent* ev );
+ void paintEvent( TQPaintEvent* ev );
private:
const double* mUplBuffer;
diff --git a/src/src/configure.cpp b/src/src/configure.cpp
index 4e10636..93258b1 100644
--- a/src/src/configure.cpp
+++ b/src/src/configure.cpp
@@ -21,13 +21,13 @@
#include "configure.h"
#include "knetstats.h"
-// Qt includes
-#include <qstringlist.h>
-#include <qlistbox.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qwidgetstack.h>
-#include <qpopupmenu.h>
+// TQt includes
+#include <tqstringlist.h>
+#include <tqlistbox.h>
+#include <tqcheckbox.h>
+#include <tqlabel.h>
+#include <tqwidgetstack.h>
+#include <tqpopupmenu.h>
// Kde includes
#include <kapplication.h>
#include <klocale.h>
@@ -41,30 +41,30 @@
#include <kpushbutton.h>
-Configure::Configure(KNetStats* parent, const InterfaceMap& ifs) : ConfigureBase(parent) {
+Configure::Configure(KNetStats* tqparent, const InterfaceMap& ifs) : ConfigureBase(tqparent) {
// Load configuration
KIconLoader* loader = kapp->iconLoader();
- QPixmap iconPCI = loader->loadIcon("icon_pci.png", KIcon::Small, 16);
+ TQPixmap iconPCI = loader->loadIcon("icon_pci.png", KIcon::Small, 16);
// Clone the configuration.
for (InterfaceMap::ConstIterator it = ifs.begin(); it != ifs.end(); ++it) {
mInterfaces->insertItem(iconPCI, it.key());
mConfig[it.key()] = it.data()->options();
-// parent->readInterfaceOptions(*it, &mConfig[*it]);
+// tqparent->readInterfaceOptions(*it, &mConfig[*it]);
}
mInterfaces->setCurrentItem(0);
changeInterface(mInterfaces->selectedItem());
- connect(mInterfaces, SIGNAL(selectionChanged(QListBoxItem*)), this, SLOT(changeInterface(QListBoxItem*)));
- connect(mTheme, SIGNAL(activated(int)), this, SLOT(changeTheme(int)));
- //connect(mInterfaces, SIGNAL(contextMenuRequested(QListBoxItem*, const QPoint&)), this, SLOT(showInterfaceContextMenu(QListBoxItem*, const QPoint&)));
+ connect(mInterfaces, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), this, TQT_SLOT(changeInterface(TQListBoxItem*)));
+ connect(mTheme, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeTheme(int)));
+ //connect(mInterfaces, TQT_SIGNAL(contextMenuRequested(TQListBoxItem*, const TQPoint&)), this, TQT_SLOT(showInterfaceContextMenu(TQListBoxItem*, const TQPoint&)));
}
-void Configure::changeInterface(QListBoxItem* item) {
- QString interface = item->text();
+void Configure::changeInterface(TQListBoxItem* item) {
+ TQString interface = item->text();
if (!mCurrentItem.isEmpty())
{
@@ -132,24 +132,24 @@ bool Configure::canSaveConfig()
void Configure::changeTheme(int theme)
{
KIconLoader* loader = kapp->iconLoader();
- mIconError->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_error.png",
+ mIconError->setPixmap(loader->loadIcon("theme"+TQString::number(theme)+"_error.png",
KIcon::Panel, ICONSIZE));
- mIconNone->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_none.png",
+ mIconNone->setPixmap(loader->loadIcon("theme"+TQString::number(theme)+"_none.png",
KIcon::Panel, ICONSIZE));
- mIconTx->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_tx.png",
+ mIconTx->setPixmap(loader->loadIcon("theme"+TQString::number(theme)+"_tx.png",
KIcon::Panel, ICONSIZE));
- mIconRx->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_rx.png",
+ mIconRx->setPixmap(loader->loadIcon("theme"+TQString::number(theme)+"_rx.png",
KIcon::Panel, ICONSIZE));
- mIconBoth->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_both.png",
+ mIconBoth->setPixmap(loader->loadIcon("theme"+TQString::number(theme)+"_both.png",
KIcon::Panel, ICONSIZE));
}
/*
-void Configure::showInterfaceContextMenu(QListBoxItem* item, const QPoint& point) {
+void Configure::showInterfaceContextMenu(TQListBoxItem* item, const TQPoint& point) {
if (!item && mConfig.size() == 1)
return;
- QPixmap icon = kapp->iconLoader()->loadIcon("editdelete", KIcon::Small, 16);
- QPopupMenu* menu = new QPopupMenu(this);
- menu->insertItem(icon, i18n("Renomve Interface"), this, SLOT(removeInterface()));
+ TQPixmap icon = kapp->iconLoader()->loadIcon("editdelete", KIcon::Small, 16);
+ TQPopupMenu* menu = new TQPopupMenu(this);
+ menu->insertItem(icon, i18n("Renomve Interface"), this, TQT_SLOT(removeInterface()));
menu->exec(point);
}
diff --git a/src/src/configure.h b/src/src/configure.h
index a0098f7..e35f100 100644
--- a/src/src/configure.h
+++ b/src/src/configure.h
@@ -23,20 +23,20 @@
#include "configurebase.h"
#include "interface.h"
-#include <qstring.h>
-#include <qmap.h>
-#include <qfont.h>
-#include <qcolor.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
+#include <tqstring.h>
+#include <tqmap.h>
+#include <tqfont.h>
+#include <tqcolor.h>
+#include <tqpixmap.h>
+#include <tqstringlist.h>
static const int ICONSIZE = 22;
class KNetStats;
-class QListBoxItem;
+class TQListBoxItem;
-typedef QMap<QString, KNetStatsView::Options> OptionsMap;
+typedef TQMap<TQString, KNetStatsView::Options> OptionsMap;
/**
@@ -45,20 +45,21 @@ typedef QMap<QString, KNetStatsView::Options> OptionsMap;
class Configure : public ConfigureBase
{
Q_OBJECT
+ TQ_OBJECT
public:
- Configure(KNetStats* parent, const InterfaceMap& ifs);
+ Configure(KNetStats* tqparent, const InterfaceMap& ifs);
const OptionsMap& currentConfig() const { return mConfig; }
bool canSaveConfig();
const OptionsMap& options() const { return mConfig; }
private:
- QString mCurrentItem;
+ TQString mCurrentItem;
OptionsMap mConfig;
protected slots:
- void changeInterface(QListBoxItem* item);
+ void changeInterface(TQListBoxItem* item);
void changeTheme(int theme);
- //void showInterfaceContextMenu(QListBoxItem* item, const QPoint& point);
+ //void showInterfaceContextMenu(TQListBoxItem* item, const TQPoint& point);
//void removeInterface();
};
diff --git a/src/src/configurebase.ui b/src/src/configurebase.ui
index 4444be0..a148132 100644
--- a/src/src/configurebase.ui
+++ b/src/src/configurebase.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>ConfigureBase</class>
-<widget class="QDialog">
+<widget class="TQDialog">
<property name="name">
<cstring>ConfigureBase</cstring>
</property>
@@ -30,9 +30,9 @@
<property name="resizeMode">
<enum>Minimum</enum>
</property>
- <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <widget class="TQLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>layout7</cstring>
+ <cstring>tqlayout7</cstring>
</property>
<hbox>
<property name="name">
@@ -48,7 +48,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>120</width>
<height>20</height>
@@ -84,7 +84,7 @@
</widget>
</hbox>
</widget>
- <widget class="QListBox" row="0" column="0" rowspan="2" colspan="1">
+ <widget class="TQListBox" row="0" column="0" rowspan="2" colspan="1">
<property name="name">
<cstring>mInterfaces</cstring>
</property>
@@ -97,7 +97,7 @@
</sizepolicy>
</property>
</widget>
- <widget class="QGroupBox" row="1" column="1">
+ <widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>mAppearanceGroup</cstring>
</property>
@@ -116,11 +116,11 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QWidgetStack" row="0" column="0">
+ <widget class="TQWidgetStack" row="0" column="0">
<property name="name">
<cstring>mWdgStack</cstring>
</property>
- <widget class="QWidget">
+ <widget class="TQWidget">
<property name="name">
<cstring>mIconPage</cstring>
</property>
@@ -134,15 +134,15 @@
<property name="margin">
<number>0</number>
</property>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout5</cstring>
+ <cstring>tqlayout5</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>mLabel4</cstring>
</property>
@@ -150,7 +150,7 @@
<string>Theme:</string>
</property>
</widget>
- <widget class="QComboBox">
+ <widget class="TQComboBox">
<item>
<property name="text">
<string>Classic</string>
@@ -190,7 +190,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>21</width>
<height>20</height>
@@ -199,15 +199,15 @@
</spacer>
</hbox>
</widget>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout7_2</cstring>
+ <cstring>tqlayout7_2</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>mIconError</cstring>
</property>
@@ -219,7 +219,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
+ <property name="tqminimumSize">
<size>
<width>22</width>
<height>22</height>
@@ -239,14 +239,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>mIconNone</cstring>
</property>
@@ -258,7 +258,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
+ <property name="tqminimumSize">
<size>
<width>22</width>
<height>22</height>
@@ -278,14 +278,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>mIconTx</cstring>
</property>
@@ -297,7 +297,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
+ <property name="tqminimumSize">
<size>
<width>22</width>
<height>22</height>
@@ -317,14 +317,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>mIconRx</cstring>
</property>
@@ -336,7 +336,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
+ <property name="tqminimumSize">
<size>
<width>22</width>
<height>22</height>
@@ -356,14 +356,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>mIconBoth</cstring>
</property>
@@ -375,7 +375,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
+ <property name="tqminimumSize">
<size>
<width>22</width>
<height>22</height>
@@ -397,7 +397,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
@@ -406,7 +406,7 @@
</spacer>
</vbox>
</widget>
- <widget class="QWidget">
+ <widget class="TQWidget">
<property name="name">
<cstring>mTextPage</cstring>
</property>
@@ -428,7 +428,7 @@
<string></string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>mLabel5</cstring>
</property>
@@ -457,7 +457,7 @@
</sizepolicy>
</property>
</widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>mLabel6</cstring>
</property>
@@ -467,7 +467,7 @@
</widget>
</grid>
</widget>
- <widget class="QWidget">
+ <widget class="TQWidget">
<property name="name">
<cstring>mBarsPage</cstring>
</property>
@@ -481,7 +481,7 @@
<property name="margin">
<number>0</number>
</property>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>mChartBgLabel</cstring>
</property>
@@ -497,7 +497,7 @@
<string></string>
</property>
</widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>mLabel7</cstring>
</property>
@@ -505,7 +505,7 @@
<string>Upload color:</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>mLabel8</cstring>
</property>
@@ -529,7 +529,7 @@
<string></string>
</property>
</widget>
- <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+ <widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>mChartTransparentBackground</cstring>
</property>
@@ -542,7 +542,7 @@
</widget>
</grid>
</widget>
- <widget class="QGroupBox" row="0" column="1">
+ <widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>mConfigurationGroup</cstring>
</property>
@@ -581,7 +581,7 @@
<cstring>mViewMode</cstring>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>mLabel3</cstring>
</property>
@@ -589,14 +589,14 @@
<string>View mode:</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>mLabel2</cstring>
</property>
<property name="text">
<string>Update interval:</string>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
@@ -617,7 +617,7 @@
<string>ms</string>
</property>
</widget>
- <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>mMonitoring</cstring>
</property>
@@ -666,7 +666,7 @@
<tabstop>mChartBgColor</tabstop>
<tabstop>mChartTransparentBackground</tabstop>
</tabstops>
-<layoutdefaults spacing="6" margin="11"/>
+<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
diff --git a/src/src/interface.cpp b/src/src/interface.cpp
index 26a02a5..3a8a7bb 100644
--- a/src/src/interface.cpp
+++ b/src/src/interface.cpp
@@ -14,7 +14,7 @@
#include <kapp.h>
#include <kconfig.h>
-Interface::Interface(KNetStats* parent, const QString& name) : mName(name), mView(0), mParent(parent) {
+Interface::Interface(KNetStats* tqparent, const TQString& name) : mName(name), mView(0), mParent(tqparent) {
update();
}
@@ -50,7 +50,7 @@ KNetStatsView::Options Interface::options() {
}
}
-void Interface::say(const QString& message) {
+void Interface::say(const TQString& message) {
if (mView)
mView->say(message);
}
diff --git a/src/src/interface.h b/src/src/interface.h
index 71b29f8..4ad1323 100644
--- a/src/src/interface.h
+++ b/src/src/interface.h
@@ -13,12 +13,12 @@
#ifndef INTERFACE_H
#define INTERFACE_H
-#include <qstring.h>
+#include <tqstring.h>
#include "knetstatsview.h"
class KNetStats;
class Interface {
- QString mName;
+ TQString mName;
KNetStatsView* mView;
KNetStats* mParent;
@@ -26,10 +26,10 @@ class Interface {
public:
/**
* Constructs a new interface.
- * \param parent parent of the view of this interface.
- * \param name name of this interface (not the QObject name!!)
+ * \param tqparent tqparent of the view of this interface.
+ * \param name name of this interface (not the TQObject name!!)
*/
- Interface(KNetStats* parent, const QString& name);
+ Interface(KNetStats* tqparent, const TQString& name);
/**
* Set this interface visible to the user via a KNetStatsView.
@@ -39,13 +39,13 @@ public:
void update();
- void say(const QString& message);
+ void say(const TQString& message);
KNetStatsView::Options options();
};
-#include <qmap.h>
-typedef QMap<QString, Interface*> InterfaceMap;
+#include <tqmap.h>
+typedef TQMap<TQString, Interface*> InterfaceMap;
#endif
diff --git a/src/src/knetstats.cpp b/src/src/knetstats.cpp
index e02e3f6..0dc149c 100644
--- a/src/src/knetstats.cpp
+++ b/src/src/knetstats.cpp
@@ -23,10 +23,10 @@
#include "configure.h"
#include "interface.h"
-// Qt includes
-#include <qstringlist.h>
-#include <qdir.h>
-#include <qtimer.h>
+// TQt includes
+#include <tqstringlist.h>
+#include <tqdir.h>
+#include <tqtimer.h>
// KDE includes
#include <kconfig.h>
#include <kglobal.h>
@@ -43,7 +43,7 @@
#include <kiconloader.h>
#include <kpushbutton.h>
-KNetStats::KNetStats() : QWidget(0, "knetstats"), mConfigure(0), mBoot(true) {
+KNetStats::KNetStats() : TQWidget(0, "knetstats"), mConfigure(0), mBoot(true) {
setupUi();
int count;
detectNewInterfaces(&count);
@@ -53,8 +53,8 @@ KNetStats::KNetStats() : QWidget(0, "knetstats"), mConfigure(0), mBoot(true) {
mBoot = false;
- QTimer* timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(detectNewInterfaces()));
+ TQTimer* timer = new TQTimer(this);
+ connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(detectNewInterfaces()));
timer->start(IF_DETECTION_INTERVAL);
}
@@ -70,26 +70,26 @@ void KNetStats::setupUi() {
mActionCollection = new KActionCollection(this);
mContextMenu = new KPopupMenu(this);
mContextMenu->insertTitle( kapp->miniIcon(), kapp->caption() );
- KAction* configure = KStdAction::preferences(this, SLOT(configure()), mActionCollection, "configure");
+ KAction* configure = KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(configure()), mActionCollection, "configure");
configure->plug(mContextMenu);
mContextMenu->insertSeparator();
- KHelpMenu* helpmenu = new KHelpMenu(this, QString::null, false);
+ KHelpMenu* helpmenu = new KHelpMenu(this, TQString(), false);
mContextMenu->insertItem( i18n("&Help"), helpmenu->menu() );
mContextMenu->insertSeparator();
- KAction* quitAction = KStdAction::quit(kapp, SLOT(quit()), mActionCollection);
+ KAction* quitAction = KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), mActionCollection);
quitAction->plug(mContextMenu);
- connect(helpmenu, SIGNAL(showAboutApplication()), this, SLOT(about()));
+ connect(helpmenu, TQT_SIGNAL(showAboutApplication()), this, TQT_SLOT(about()));
}
-QStringList KNetStats::scanInterfaces() {
- QDir dir("/sys/class/net");
+TQStringList KNetStats::scanInterfaces() {
+ TQDir dir("/sys/class/net");
if (!dir.exists()) {
KMessageBox::error(0, i18n("You need kernel 2.6.x with support to the /sys filesystem."));
- return QStringList();
+ return TQStringList();
} else {
- QStringList list = dir.entryList(QDir::Dirs);
+ TQStringList list = dir.entryList(TQDir::Dirs);
list.pop_front(); // removes "." and ".." entries
list.pop_front();
return list;
@@ -106,9 +106,9 @@ bool KNetStats::configure() {
}*/
mConfigure = new Configure(this, mInterfaces);
- connect(mConfigure->mOk, SIGNAL(clicked()), this, SLOT(configOk()));
- connect(mConfigure->mApply, SIGNAL(clicked()), this, SLOT(configApply()));
- connect(mConfigure->mCancel, SIGNAL(clicked()), this, SLOT(configCancel()));
+ connect(mConfigure->mOk, TQT_SIGNAL(clicked()), this, TQT_SLOT(configOk()));
+ connect(mConfigure->mApply, TQT_SIGNAL(clicked()), this, TQT_SLOT(configApply()));
+ connect(mConfigure->mCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(configCancel()));
mConfigure->show();
}
return true;
@@ -167,10 +167,10 @@ void KNetStats::about() {
void KNetStats::detectNewInterfaces(int* count_ptr) {
int count = 0;
- const QStringList& interfaces = KNetStats::scanInterfaces();
- QStringList::ConstIterator i = interfaces.begin();
+ const TQStringList& interfaces = KNetStats::scanInterfaces();
+ TQStringList::ConstIterator i = interfaces.begin();
for(; i != interfaces.end(); ++i) {
- InterfaceMap::Iterator elem = mInterfaces.find(*i);
+ InterfaceMap::Iterator elem = mInterfaces.tqfind(*i);
if (elem == mInterfaces.end())
if (createInterface(*i))
count++;
@@ -179,12 +179,12 @@ void KNetStats::detectNewInterfaces(int* count_ptr) {
*count_ptr = count;
}
-bool KNetStats::createInterface(const QString& name) {
+bool KNetStats::createInterface(const TQString& name) {
// Cria a interface e adiciona em mInterfaces.
Interface* interface = new Interface(this, name);
mInterfaces.insert(name, interface);
if (!mBoot)
- interface->say(i18n("New interface detected: %1").arg(name));
+ interface->say(i18n("New interface detected: %1").tqarg(name));
return interface->isVisible();
}
diff --git a/src/src/knetstats.h b/src/src/knetstats.h
index 4282890..33ce801 100644
--- a/src/src/knetstats.h
+++ b/src/src/knetstats.h
@@ -21,9 +21,9 @@
#ifndef KNETSTATS_H
#define KNETSTATS_H
-#include <qwidget.h>
+#include <tqwidget.h>
#include <set>
-#include <qstring.h>
+#include <tqstring.h>
#include "configure.h"
class KNetStatsView;
@@ -34,9 +34,10 @@ class KActionCollection;
class Interface;
-class KNetStats : public QWidget
+class KNetStats : public TQWidget
{
Q_OBJECT
+ TQ_OBJECT
enum {
IF_DETECTION_INTERVAL = 5000
@@ -52,7 +53,7 @@ public:
* \brief Search for network interfaces parsing /proc/net/dev
* \return A StringList with the network interface names
*/
- static QStringList scanInterfaces();
+ static TQStringList scanInterfaces();
int numInterfaces() const { return mInterfaces.size(); }
@@ -86,7 +87,7 @@ private:
void clearOptions(OptionsMap* options);
void setupUi();
// Creates a new interface, returns true or false if the new interface is visible or not.
- bool createInterface(const QString& interface);
+ bool createInterface(const TQString& interface);
};
diff --git a/src/src/knetstatsview.cpp b/src/src/knetstatsview.cpp
index ea480ab..501e092 100644
--- a/src/src/knetstatsview.cpp
+++ b/src/src/knetstatsview.cpp
@@ -36,15 +36,15 @@
#include <khelpmenu.h>
#include <kpassivepopup.h>
-// Qt headers
-#include <qtimer.h>
-#include <qfile.h>
-#include <qtooltip.h>
-#include <qcursor.h>
-#include <qevent.h>
-#include <qfont.h>
-#include <qfontmetrics.h>
-#include <qpainter.h>
+// TQt headers
+#include <tqtimer.h>
+#include <tqfile.h>
+#include <tqtooltip.h>
+#include <tqcursor.h>
+#include <tqevent.h>
+#include <tqfont.h>
+#include <tqfontmetrics.h>
+#include <tqpainter.h>
// C headers
#include <cstring>
@@ -63,8 +63,8 @@ extern "C" {
extern const char* programName;
-KNetStatsView::KNetStatsView(KNetStats* parent, const QString& interface)
-: KSystemTray(parent, 0), mSysDevPath("/sys/class/net/"+interface+"/"), mInterface(interface) {
+KNetStatsView::KNetStatsView(KNetStats* tqparent, const TQString& interface)
+: KSystemTray(tqparent, 0), mSysDevPath("/sys/class/net/"+interface+"/"), mInterface(interface) {
mFdSock = 0;
mFirstUpdate = true;
mMaxSpeedAge = 0;
@@ -81,15 +81,15 @@ KNetStatsView::KNetStatsView(KNetStats* parent, const QString& interface)
memset(&mDevInfo, 0, sizeof(mDevInfo));
strcpy(mDevInfo.ifr_name, mInterface.latin1());
- setTextFormat(Qt::PlainText);
- mContextMenu = parent->contextMenu();
+ setTextFormat(TQt::PlainText);
+ mContextMenu = tqparent->contextMenu();
show();
// Timer
- mTimer = new QTimer(this, "timer");
- connect(mTimer, SIGNAL(timeout()), this, SLOT(updateStats(void)));
+ mTimer = new TQTimer(this, "timer");
+ connect(mTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateStats(void)));
- QToolTip::add(this, i18n("Monitoring %1").arg(mInterface));
+ TQToolTip::add(this, i18n("Monitoring %1").tqarg(mInterface));
setup();
mStatistics = new Statistics(this);
}
@@ -106,25 +106,25 @@ void KNetStatsView::setup() {
else if (mOptions.mViewMode == Icon) {
// Load Icons
KIconLoader* loader = kapp->iconLoader();
- mIconError = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_error.png",
+ mIconError = loader->loadIcon("theme"+TQString::number(mOptions.mTheme)+"_error.png",
KIcon::Panel, ICONSIZE);
- mIconNone = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_none.png",
+ mIconNone = loader->loadIcon("theme"+TQString::number(mOptions.mTheme)+"_none.png",
KIcon::Panel, ICONSIZE);
- mIconTx = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_tx.png",
+ mIconTx = loader->loadIcon("theme"+TQString::number(mOptions.mTheme)+"_tx.png",
KIcon::Panel, ICONSIZE);
- mIconRx =loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_rx.png",
+ mIconRx =loader->loadIcon("theme"+TQString::number(mOptions.mTheme)+"_rx.png",
KIcon::Panel, ICONSIZE);
- mIconBoth = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_both.png",
+ mIconBoth = loader->loadIcon("theme"+TQString::number(mOptions.mTheme)+"_both.png",
KIcon::Panel, ICONSIZE);
mCurrentIcon = &mIconNone;
}
mTimer->start(mOptions.mUpdateInterval);
updateStats();
- QWidget::update();
+ TQWidget::update();
mFirstUpdate = false;
}
-void KNetStatsView::say(const QString& message) {
+void KNetStatsView::say(const TQString& message) {
KPassivePopup::message(programName, message, kapp->miniIcon(), this);
}
@@ -135,24 +135,24 @@ void KNetStatsView::updateViewOptions() {
void KNetStatsView::updateStats() {
FILE* flags_fp = fopen((mSysDevPath+"flags").latin1(), "r");
- bool currentStatus;
+ bool currenttqStatus;
if (!flags_fp)
- currentStatus = false;
+ currenttqStatus = false;
else {
int flags;
fscanf(flags_fp, "%Xu", &flags);
fclose(flags_fp);
- currentStatus = IFF_UP & flags;
+ currenttqStatus = IFF_UP & flags;
}
- if (!currentStatus && mConnected) { // interface down...
+ if (!currenttqStatus && mConnected) { // interface down...
mConnected = false;
resetBuffers();
- QWidget::update();
- say(i18n("%1 is inactive").arg(mInterface));
- } else if (currentStatus && !mConnected) {
+ TQWidget::update();
+ say(i18n("%1 is inactive").tqarg(mInterface));
+ } else if (currenttqStatus && !mConnected) {
mConnected = true;
- say(i18n("%1 is active").arg(mInterface));
+ say(i18n("%1 is active").tqarg(mInterface));
}
// kernel < 2.6.9 (I think) does not have carrier info, considering carrier ever on.
@@ -168,13 +168,13 @@ void KNetStatsView::updateStats() {
if (carrierFlag == '0') { // carrier down
if (mCarrier) {
mCarrier = false;
- QWidget::update();
- say(i18n("%1 is disconnected").arg(mInterface));
+ TQWidget::update();
+ say(i18n("%1 is disconnected").tqarg(mInterface));
}
return;
} else if (!mCarrier) { // carrier up
mCarrier = true;
- say(i18n("%1 is connected").arg(mInterface));
+ say(i18n("%1 is connected").tqarg(mInterface));
}
unsigned int brx = readInterfaceNumValue("rx_bytes");
@@ -213,7 +213,7 @@ void KNetStatsView::updateStats() {
}
if (mOptions.mViewMode == Icon) {
- QPixmap* newIcon;
+ TQPixmap* newIcon;
if (brx == mBRx) {
if (btx == mBTx )
newIcon = &mIconNone;
@@ -228,10 +228,10 @@ void KNetStatsView::updateStats() {
if (newIcon != mCurrentIcon) {
mCurrentIcon = newIcon;
- QWidget::update();
+ TQWidget::update();
}
} else if (mOptions.mViewMode == Graphic || (btx != mBTx && brx != mBRx))
- QWidget::update();
+ TQWidget::update();
// Update stats
mTotalBytesRx += brx - mBRx;
@@ -246,7 +246,7 @@ void KNetStatsView::updateStats() {
}
unsigned long KNetStatsView::readInterfaceNumValue(const char* name) {
- // stdio functions appear to be more fast than QFile?
+ // stdio functions appear to be more fast than TQFile?
FILE* fp = fopen((mSysDevPath+"statistics/"+name).latin1(), "r");
long retval;
fscanf(fp, "%lu", &retval);
@@ -254,10 +254,10 @@ unsigned long KNetStatsView::readInterfaceNumValue(const char* name) {
return retval;
}
-QString KNetStatsView::readInterfaceStringValue(const char* name, int maxlength) {
- QFile macFile(mSysDevPath+name);
+TQString KNetStatsView::readInterfaceStringValue(const char* name, int maxlength) {
+ TQFile macFile(mSysDevPath+name);
macFile.open(IO_ReadOnly);
- QString value;
+ TQString value;
macFile.readLine(value, maxlength);
return value;
}
@@ -271,8 +271,8 @@ void KNetStatsView::resetBuffers() {
memset(mSpeedBufferPTx, 0, sizeof(double)*SPEED_BUFFER_SIZE);
}
-void KNetStatsView::paintEvent( QPaintEvent* ) {
- QPainter paint(this);
+void KNetStatsView::paintEvent( TQPaintEvent* ) {
+ TQPainter paint(this);
switch(mOptions.mViewMode) {
case Icon:
if (!mCarrier || !mConnected)
@@ -288,25 +288,25 @@ void KNetStatsView::paintEvent( QPaintEvent* ) {
}
}
-void KNetStatsView::drawText(QPainter& paint) {
+void KNetStatsView::drawText(TQPainter& paint) {
if (!mCarrier || !mConnected) {
- paint.drawText(rect(), Qt::AlignCenter, "?");
+ paint.drawText(rect(), TQt::AlignCenter, "?");
} else {
paint.setFont( mOptions.mTxtFont );
paint.setPen( mOptions.mTxtUplColor );
- paint.drawText( rect(), Qt::AlignTop, Statistics::byteFormat(byteSpeedTx(), "KB", "MB"));
+ paint.drawText( rect(), TQt::AlignTop, Statistics::byteFormat(byteSpeedTx(), "KB", "MB"));
paint.setPen( mOptions.mTxtDldColor );
- paint.drawText( rect(), Qt::AlignBottom, Statistics::byteFormat(byteSpeedRx(), "KB", "MB"));
+ paint.drawText( rect(), TQt::AlignBottom, Statistics::byteFormat(byteSpeedRx(), "KB", "MB"));
}
}
-void KNetStatsView::drawGraphic(QPainter& paint) {
+void KNetStatsView::drawGraphic(TQPainter& paint) {
if (!mCarrier || !mConnected) {
- paint.drawText(rect(), Qt::AlignCenter, "X");
+ paint.drawText(rect(), TQt::AlignCenter, "X");
return;
}
- QSize size = this->size();
+ TQSize size = this->size();
if (!mOptions.mChartTransparentBackground)
paint.fillRect(0, 0, size.width(), size.height(), mOptions.mChartBgColor);
@@ -339,9 +339,9 @@ void KNetStatsView::drawGraphic(QPainter& paint) {
}
}
-void KNetStatsView::mousePressEvent(QMouseEvent* ev) {
+void KNetStatsView::mousePressEvent(TQMouseEvent* ev) {
if (ev->button() == Qt::RightButton )
- mContextMenu->exec(QCursor::pos());
+ mContextMenu->exec(TQCursor::pos());
else if (ev->button() == Qt::LeftButton)
if (mStatistics->isShown())
mStatistics->accept();
@@ -357,7 +357,7 @@ bool KNetStatsView::openFdSocket() {
return false;
}
-QString KNetStatsView::getIp() {
+TQString KNetStatsView::getIp() {
if (mFdSock == -1 && !openFdSocket())
return "";
@@ -366,15 +366,15 @@ QString KNetStatsView::getIp() {
return inet_ntoa(sin.sin_addr);
}
-QString KNetStatsView::getNetmask() {
+TQString KNetStatsView::getNettqmask() {
if (mFdSock == -1 && !openFdSocket())
return "";
ioctl(mFdSock, SIOCGIFNETMASK, &mDevInfo);
- sockaddr_in mask = ((sockaddr_in&)mDevInfo.ifr_netmask);
- return inet_ntoa(mask.sin_addr);
+ sockaddr_in tqmask = ((sockaddr_in&)mDevInfo.ifr_netmask);
+ return inet_ntoa(tqmask.sin_addr);
}
-void KNetStatsView::readOptions( const QString& name, KNetStatsView::Options* opts, bool defaultVisibility ) {
+void KNetStatsView::readOptions( const TQString& name, KNetStatsView::Options* opts, bool defaultVisibility ) {
KConfig* cfg = kapp->config();
KConfigGroupSaver groupSaver(cfg, name);
@@ -384,17 +384,17 @@ void KNetStatsView::readOptions( const QString& name, KNetStatsView::Options* op
opts->mMonitoring = cfg->readBoolEntry("Monitoring", defaultVisibility);
// txt view
opts->mTxtFont = cfg->readFontEntry("TxtFont");
- opts->mTxtUplColor = cfg->readColorEntry("TxtUplColor", &Qt::red);
- opts->mTxtDldColor = cfg->readColorEntry("TxtDldColor", &Qt::green);
+ opts->mTxtUplColor = cfg->readColorEntry("TxtUplColor", &TQt::red);
+ opts->mTxtDldColor = cfg->readColorEntry("TxtDldColor", &TQt::green);
// IconView
int defaultTheme = 0;
if (name.startsWith("wlan"))
defaultTheme = 3; // three... is a magic number... a magic number....
opts->mTheme = cfg->readNumEntry("Theme", defaultTheme);
// Graphic
- opts->mChartUplColor = cfg->readColorEntry("ChartUplColor", &Qt::red);
- opts->mChartDldColor = cfg->readColorEntry("ChartDldColor", &Qt::blue);
- opts->mChartBgColor = cfg->readColorEntry("ChartBgColor", &Qt::white);
+ opts->mChartUplColor = cfg->readColorEntry("ChartUplColor", &TQt::red);
+ opts->mChartDldColor = cfg->readColorEntry("ChartDldColor", &TQt::blue);
+ opts->mChartBgColor = cfg->readColorEntry("ChartBgColor", &TQt::white);
opts->mChartTransparentBackground = cfg->readBoolEntry("ChartUseTransparentBackground", true);
}
diff --git a/src/src/knetstatsview.h b/src/src/knetstatsview.h
index 4e97392..c7caa2b 100644
--- a/src/src/knetstatsview.h
+++ b/src/src/knetstatsview.h
@@ -22,17 +22,17 @@
#define KNETSTATSVIEW_H
#include <ksystemtray.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
-#include <qcolor.h>
+#include <tqpixmap.h>
+#include <tqstringlist.h>
+#include <tqcolor.h>
#include <arpa/inet.h>
#include <linux/netdevice.h>
-class QTimer;
-class QMouseEvent;
-class QPainter;
-class QPaintEvent;
+class TQTimer;
+class TQMouseEvent;
+class TQPainter;
+class TQPaintEvent;
class Statistics;
class KNetStats;
@@ -42,6 +42,7 @@ class KNetStats;
class KNetStatsView : public KSystemTray
{
Q_OBJECT
+ TQ_OBJECT
enum {
HISTORY_SIZE = 50, // Speed history buffer size
@@ -65,29 +66,29 @@ public:
Mode mViewMode;
bool mMonitoring;
// txt view
- QFont mTxtFont;
- QColor mTxtUplColor;
- QColor mTxtDldColor;
+ TQFont mTxtFont;
+ TQColor mTxtUplColor;
+ TQColor mTxtDldColor;
// icon view
int mTheme;
// chart view
- QColor mChartUplColor;
- QColor mChartDldColor;
- QColor mChartBgColor;
+ TQColor mChartUplColor;
+ TQColor mChartDldColor;
+ TQColor mChartBgColor;
bool mChartTransparentBackground;
};
- KNetStatsView(KNetStats* parent, const QString& interface);
+ KNetStatsView(KNetStats* tqparent, const TQString& interface);
~KNetStatsView();
- void say(const QString& message);
+ void say(const TQString& message);
void updateViewOptions();
// read a value from /sys/class/net/interface/name
unsigned long readInterfaceNumValue(const char* name);
// read a value from /sys/class/net/interface/name
- QString readInterfaceStringValue(const char* name, int maxlength);
- QString getIp();
- QString getNetmask();
+ TQString readInterfaceStringValue(const char* name, int maxlength);
+ TQString getIp();
+ TQString getNettqmask();
const double* speedHistoryRx() const { return mSpeedHistoryRx; }
const double* speedHistoryTx() const { return mSpeedHistoryTx; }
@@ -98,10 +99,10 @@ public:
/// Return a copy of the current view options.
Options options() const { return mOptions; }
/// read the interface view options
- static void readOptions( const QString& name, Options* opts, bool defaultVisibility = false );
+ static void readOptions( const TQString& name, Options* opts, bool defaultVisibility = false );
/// The current monitored network interface
- inline const QString& interface() const;
+ inline const TQString& interface() const;
/// The current Update Interval in miliseconds
inline int updateInterval() const;
/// We are in textmode?
@@ -125,8 +126,8 @@ public:
inline double pktSpeedTx() const;
protected:
- void mousePressEvent( QMouseEvent* ev );
- void paintEvent( QPaintEvent* ev );
+ void mousePressEvent( TQMouseEvent* ev );
+ void paintEvent( TQPaintEvent* ev );
private:
@@ -134,19 +135,19 @@ private:
struct ifreq mDevInfo; // info struct about our interface
- QString mSysDevPath; // Path to the device.
+ TQString mSysDevPath; // Path to the device.
bool mCarrier; // Interface carrier is on?
bool mConnected; // Interface exists?
KPopupMenu* mContextMenu; // Global ContextMenu
Statistics* mStatistics; // Statistics window
- QString mInterface; // Current interface
+ TQString mInterface; // Current interface
Options mOptions; // View options
// Icons
- QPixmap mIconError, mIconNone, mIconTx, mIconRx, mIconBoth;
- QPixmap* mCurrentIcon; // Current state
- QTimer* mTimer; // Timer
+ TQPixmap mIconError, mIconNone, mIconTx, mIconRx, mIconBoth;
+ TQPixmap* mCurrentIcon; // Current state
+ TQTimer* mTimer; // Timer
// Rx e Tx to bytes and packets
unsigned long mBRx, mBTx, mPRx, mPTx;
@@ -170,8 +171,8 @@ private:
// setup the view.
void setup();
- void drawText(QPainter& paint);
- void drawGraphic(QPainter& paint);
+ void drawText(TQPainter& paint);
+ void drawGraphic(TQPainter& paint);
// Reset speed and history buffers
void resetBuffers();
// calc tha max. speed stored in the history buffer
@@ -211,7 +212,7 @@ double KNetStatsView::calcSpeed(const double* buffer) const {
return total/SPEED_BUFFER_SIZE;
}
-const QString& KNetStatsView::interface() const {
+const TQString& KNetStatsView::interface() const {
return mInterface;
}
diff --git a/src/src/statistics.cpp b/src/src/statistics.cpp
index efa571e..72deabc 100644
--- a/src/src/statistics.cpp
+++ b/src/src/statistics.cpp
@@ -24,27 +24,27 @@
#include <klocale.h>
#include <kapplication.h>
#include <kactivelabel.h>
-#include <qtimer.h>
-#include <qlayout.h>
+#include <tqtimer.h>
+#include <tqlayout.h>
-Statistics::Statistics( KNetStatsView* parent, const char *name )
-: StatisticsBase( parent, name ), mInterface(parent->interface()), mParent(parent) {
- setCaption( i18n( "Details of %1" ).arg( mInterface ) );
+Statistics::Statistics( KNetStatsView* tqparent, const char *name )
+: StatisticsBase( tqparent, name ), mInterface(tqparent->interface()), mParent(tqparent) {
+ setCaption( i18n( "Details of %1" ).tqarg( mInterface ) );
- QBoxLayout* l = new QHBoxLayout( mChart );
+ TQBoxLayout* l = new TQHBoxLayout( mChart );
l->setAutoAdd( true );
- Chart* chart = new Chart(mChart, parent->speedHistoryTx(), parent->speedHistoryRx(), parent->historyBufferSize(), parent->historyPointer(), parent->maxSpeed());
+ Chart* chart = new Chart(mChart, tqparent->speedHistoryTx(), tqparent->speedHistoryRx(), tqparent->historyBufferSize(), tqparent->historyPointer(), tqparent->maxSpeed());
mMAC->setText(mParent->readInterfaceStringValue("address", 18));
- mIP->setAlignment(Qt::AlignRight);
- mMAC->setAlignment(Qt::AlignRight);
- mNetmask->setAlignment(Qt::AlignRight);
+ mIP->tqsetAlignment(TQt::AlignRight);
+ mMAC->tqsetAlignment(TQt::AlignRight);
+ mNettqmask->tqsetAlignment(TQt::AlignRight);
update();
- mTimer = new QTimer( this );
- connect( mTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
- connect( mTimer, SIGNAL( timeout() ), chart, SLOT( update() ) );
+ mTimer = new TQTimer( this );
+ connect( mTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( update() ) );
+ connect( mTimer, TQT_SIGNAL( timeout() ), chart, TQT_SLOT( update() ) );
}
void Statistics::update() {
@@ -54,17 +54,17 @@ void Statistics::update() {
mByteSpeedRx->setText( byteFormat( mParent->byteSpeedRx() )+"/s" );
mByteSpeedTx->setText( byteFormat( mParent->byteSpeedTx() )+"/s" );
- mPRx->setText( QString::number( mParent->totalPktRx() ) );
- mPTx->setText( QString::number( mParent->totalPktTx() ) );
- mPktSpeedRx->setText( QString::number( mParent->pktSpeedRx(), 'f', 1 )+"pkts/s" );
- mPktSpeedTx->setText( QString::number( mParent->pktSpeedTx(), 'f', 1 )+"pkts/s" );
+ mPRx->setText( TQString::number( mParent->totalPktRx() ) );
+ mPTx->setText( TQString::number( mParent->totalPktTx() ) );
+ mPktSpeedRx->setText( TQString::number( mParent->pktSpeedRx(), 'f', 1 )+"pkts/s" );
+ mPktSpeedTx->setText( TQString::number( mParent->pktSpeedTx(), 'f', 1 )+"pkts/s" );
}
void Statistics::show() {
// Update details...
mMTU->setText(mParent->readInterfaceStringValue("mtu", 6));
mIP->setText( mParent->getIp() );
- mNetmask->setText( mParent->getNetmask() );
+ mNettqmask->setText( mParent->getNettqmask() );
mTimer->start( mParent->updateInterval() );
StatisticsBase::show();
diff --git a/src/src/statistics.h b/src/src/statistics.h
index 40ba1a0..359d40e 100644
--- a/src/src/statistics.h
+++ b/src/src/statistics.h
@@ -21,16 +21,17 @@
#define STATISTICS_H
#include "statisticsbase.h"
-#include <qstring.h>
+#include <tqstring.h>
class KNetStatsView;
class Statistics : public StatisticsBase
{
Q_OBJECT
+ TQ_OBJECT
public:
- Statistics( KNetStatsView* parent = 0, const char *name = 0 );
+ Statistics( KNetStatsView* tqparent = 0, const char *name = 0 );
/**
* Formats a numberic byte representation
@@ -40,12 +41,12 @@ public:
* \param ksufix Sufix for kilobytes
* \param msufix Sufix for megabytes
*/
- static inline QString byteFormat( double num, const char* ksufix = " KB", const char* msufix = " MB");
+ static inline TQString byteFormat( double num, const char* ksufix = " KB", const char* msufix = " MB");
void show();
private:
- QTimer* mTimer;
- const QString& mInterface;
+ TQTimer* mTimer;
+ const TQString& mInterface;
KNetStatsView* mParent;
public slots:
void accept();
@@ -54,13 +55,13 @@ private slots:
void update();
};
-QString Statistics::byteFormat( double num, const char* ksufix, const char* msufix ) {
+TQString Statistics::byteFormat( double num, const char* ksufix, const char* msufix ) {
const double ONE_KB = 1024.0;
const double ONE_MB = ONE_KB*ONE_KB;
if ( num >= ONE_MB ) // MB
- return QString::number( num/(ONE_MB), 'f', 1 ) + msufix;
+ return TQString::number( num/(ONE_MB), 'f', 1 ) + msufix;
else // Kb
- return QString::number( num/ONE_KB, 'f', 1 ) + ksufix;
+ return TQString::number( num/ONE_KB, 'f', 1 ) + ksufix;
}
#endif
diff --git a/src/src/statisticsbase.ui b/src/src/statisticsbase.ui
index d8f0662..f05db4d 100644
--- a/src/src/statisticsbase.ui
+++ b/src/src/statisticsbase.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>StatisticsBase</class>
-<widget class="QDialog">
+<widget class="TQDialog">
<property name="name">
<cstring>StatisticsBase</cstring>
</property>
@@ -30,15 +30,15 @@
<property name="resizeMode">
<enum>Minimum</enum>
</property>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout3</cstring>
+ <cstring>tqlayout3</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QFrame" row="0" column="1" rowspan="3" colspan="1">
+ <widget class="TQFrame" row="0" column="1" rowspan="3" colspan="1">
<property name="name">
<cstring>mChart</cstring>
</property>
@@ -67,14 +67,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>41</height>
</size>
</property>
</spacer>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>mMaxSpeed</cstring>
</property>
@@ -86,11 +86,11 @@
<property name="text">
<string>? KB/s</string>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel2_3</cstring>
</property>
@@ -102,13 +102,13 @@
<property name="text">
<string>0 KB/s</string>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
</grid>
</widget>
- <widget class="QTabWidget">
+ <widget class="TQTabWidget">
<property name="name">
<cstring>tabWidget2</cstring>
</property>
@@ -120,7 +120,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <widget class="QWidget">
+ <widget class="TQWidget">
<property name="name">
<cstring>tab</cstring>
</property>
@@ -131,7 +131,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel" row="3" column="0">
+ <widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>mLabel5</cstring>
</property>
@@ -139,7 +139,7 @@
<string>Upload speed:</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>mLabel1</cstring>
</property>
@@ -147,7 +147,7 @@
<string>Received:</string>
</property>
</widget>
- <widget class="QLabel" row="4" column="0">
+ <widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>mLabel6</cstring>
</property>
@@ -155,7 +155,7 @@
<string>Download speed:</string>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>mLabel2</cstring>
</property>
@@ -173,22 +173,22 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>71</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget class="QLabel" row="4" column="2">
+ <widget class="TQLabel" row="4" column="2">
<property name="name">
<cstring>mPktSpeedRx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="0" column="1">
+ <widget class="TQLabel" row="0" column="1">
<property name="name">
<cstring>textLabel1</cstring>
</property>
@@ -196,63 +196,63 @@
<string>Bytes</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="2">
+ <widget class="TQLabel" row="1" column="2">
<property name="name">
<cstring>mPRx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="3" column="1">
+ <widget class="TQLabel" row="3" column="1">
<property name="name">
<cstring>mByteSpeedTx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="2" column="1">
+ <widget class="TQLabel" row="2" column="1">
<property name="name">
<cstring>mBTx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="2" column="2">
+ <widget class="TQLabel" row="2" column="2">
<property name="name">
<cstring>mPTx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="3" column="2">
+ <widget class="TQLabel" row="3" column="2">
<property name="name">
<cstring>mPktSpeedTx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="1" column="1">
+ <widget class="TQLabel" row="1" column="1">
<property name="name">
<cstring>mBRx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="4" column="1">
+ <widget class="TQLabel" row="4" column="1">
<property name="name">
<cstring>mByteSpeedRx</cstring>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
- <widget class="QLabel" row="0" column="2">
+ <widget class="TQLabel" row="0" column="2">
<property name="name">
<cstring>textLabel2</cstring>
</property>
@@ -262,7 +262,7 @@
</widget>
</grid>
</widget>
- <widget class="QWidget">
+ <widget class="TQWidget">
<property name="name">
<cstring>tab</cstring>
</property>
@@ -273,7 +273,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
@@ -281,15 +281,15 @@
<string>IP:</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel2_2</cstring>
</property>
<property name="text">
- <string>Netmask:</string>
+ <string>Nettqmask:</string>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
@@ -297,7 +297,7 @@
<string>MAC:</string>
</property>
</widget>
- <widget class="QLabel" row="3" column="0">
+ <widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel7</cstring>
</property>
@@ -315,7 +315,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>200</width>
<height>21</height>
@@ -332,7 +332,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>51</width>
<height>80</height>
@@ -357,7 +357,7 @@
</widget>
<widget class="KActiveLabel" row="1" column="2">
<property name="name">
- <cstring>mNetmask</cstring>
+ <cstring>mNettqmask</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
@@ -393,7 +393,7 @@
<enum>NoWrap</enum>
</property>
</widget>
- <widget class="QLabel" row="3" column="2">
+ <widget class="TQLabel" row="3" column="2">
<property name="name">
<cstring>mMTU</cstring>
</property>
@@ -403,16 +403,16 @@
<property name="text">
<string></string>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter</set>
</property>
</widget>
</grid>
</widget>
</widget>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout2</cstring>
+ <cstring>tqlayout2</cstring>
</property>
<hbox>
<property name="name">
@@ -428,7 +428,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>91</width>
<height>20</height>
@@ -470,7 +470,7 @@
<tabstop>tabWidget2</tabstop>
<tabstop>mOk</tabstop>
</tabstops>
-<layoutdefaults spacing="6" margin="11"/>
+<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kactivelabel.h</includehint>
<includehint>kactivelabel.h</includehint>