From 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 22 Jun 2011 00:30:31 +0000 Subject: TQt4 port kdenetwork This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- wifi/kwireless/kwireless.cpp | 8 ++--- wifi/kwireless/kwireless.h | 3 +- wifi/kwireless/kwirelesswidget.cpp | 62 +++++++++++++++++----------------- wifi/kwireless/kwirelesswidget.h | 11 +++--- wifi/kwireless/linuxwirelesswidget.cpp | 12 +++---- wifi/kwireless/linuxwirelesswidget.h | 3 +- wifi/kwireless/propertytable.cpp | 8 ++--- wifi/kwireless/propertytable.h | 6 ++-- wifi/kwireless/propertytablebase.ui | 10 +++--- 9 files changed, 64 insertions(+), 59 deletions(-) (limited to 'wifi/kwireless') diff --git a/wifi/kwireless/kwireless.cpp b/wifi/kwireless/kwireless.cpp index 39b66a76..6fe1df9b 100644 --- a/wifi/kwireless/kwireless.cpp +++ b/wifi/kwireless/kwireless.cpp @@ -18,8 +18,8 @@ KWireLess::KWireLess(const TQString& configFile, Type type, - int actions, TQWidget *parent, const char *name) - : KPanelApplet(configFile, type, actions, parent, name) + int actions, TQWidget *tqparent, const char *name) + : KPanelApplet(configFile, type, actions, tqparent, name) { ksConfig = config(); @@ -76,13 +76,13 @@ void KWireLess::resizeEvent(TQResizeEvent *) extern "C" { - KDE_EXPORT KPanelApplet* init( TQWidget *parent, const TQString configFile) + KDE_EXPORT KPanelApplet* init( TQWidget *tqparent, const TQString configFile) { KGlobal::locale()->insertCatalogue("kwireless"); return new KWireLess(configFile, KPanelApplet::Normal, KPanelApplet::About, // | KPanelApplet::Help | KPanelApplet::Preferences, - parent, "kwireless"); + tqparent, "kwireless"); } } diff --git a/wifi/kwireless/kwireless.h b/wifi/kwireless/kwireless.h index 828ad184..3d4b7545 100644 --- a/wifi/kwireless/kwireless.h +++ b/wifi/kwireless/kwireless.h @@ -23,10 +23,11 @@ class KWireLessWidget; class KWireLess : public KPanelApplet { Q_OBJECT + TQ_OBJECT public: KWireLess(const TQString& configFile, Type t = Normal, int actions = 0, - TQWidget *parent = 0, const char *name = 0); + TQWidget *tqparent = 0, const char *name = 0); ~KWireLess(); virtual int widthForHeight(int height) const; diff --git a/wifi/kwireless/kwirelesswidget.cpp b/wifi/kwireless/kwirelesswidget.cpp index 08f4336b..b43e0a02 100644 --- a/wifi/kwireless/kwirelesswidget.cpp +++ b/wifi/kwireless/kwirelesswidget.cpp @@ -50,7 +50,7 @@ float DeviceInfo::quality() TQString DeviceInfo::qualityString() { - return i18n("%1%").arg(TQString::number(m_quality*100, 'f', 0)); + return i18n("%1%").tqarg(TQString::number(m_quality*100, 'f', 0)); } float DeviceInfo::signal() @@ -60,7 +60,7 @@ float DeviceInfo::signal() TQString DeviceInfo::signalString() { - return i18n("%1%").arg(TQString::number(m_signal*100, 'f', 0)); + return i18n("%1%").tqarg(TQString::number(m_signal*100, 'f', 0)); } float DeviceInfo::noise() @@ -70,7 +70,7 @@ float DeviceInfo::noise() TQString DeviceInfo::noiseString() { - return i18n("%1%").arg(TQString::number(m_noise*100, 'f', 0)); + return i18n("%1%").tqarg(TQString::number(m_noise*100, 'f', 0)); } const TQString& DeviceInfo::device() @@ -135,8 +135,8 @@ TQString DeviceInfo::encrString() } } -KWireLessWidget::KWireLessWidget(TQWidget *parent, const char* name) - : TQWidget(parent, name), +KWireLessWidget::KWireLessWidget(TQWidget *tqparent, const char* name) + : TQWidget(tqparent, name), mode(Horizontal), frameWidth(1), qualityBarWidth(6), @@ -183,7 +183,7 @@ void KWireLessWidget::setMode(KWireLessWidget::Mode _mode) void KWireLessWidget::mousePressEvent(TQMouseEvent *e) { - if( e->button() == TQMouseEvent::LeftButton) + if( e->button() == Qt::LeftButton) { PropertiesDialog dialog(this); connect(this, TQT_SIGNAL(updateDeviceInfo(TQPtrList *)), @@ -195,7 +195,7 @@ void KWireLessWidget::mousePressEvent(TQMouseEvent *e) void KWireLessWidget::paintEvent(TQPaintEvent*) { // WORK_TO_DO: paint other devices, too: - // for quick repaints, we need a buffered painter! + // for quick tqrepaints, we need a buffered painter! int w, h, space; const int bevel = qualityBarWidth/2; TQPainter painter(this); @@ -206,26 +206,26 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) // non-nil): space = 3 * frameWidth + qualityBarWidth + signalBarWidth + noiseBarWidth+1; - if(mode == Horizontal) + if(mode ==Qt::Horizontal) { h = space; w = width(); } else { - // Vertical + //Qt::Vertical h = height(); w = space; } - painter.setPen(TQPen(Qt::black, frameWidth)); + painter.setPen(TQPen(TQt::black, frameWidth)); painter.setBrush(KGlobalSettings::baseColor()); painter.drawRect(0, 0, w, h); int x = qualityBarWidth + frameWidth; - mode == Vertical + mode ==Qt::Vertical ? painter.drawLine(x, frameWidth, x, h-frameWidth) : painter.drawLine(frameWidth, x, w-frameWidth, x); x += signalBarWidth + frameWidth; - mode == Vertical + mode ==Qt::Vertical ? painter.drawLine(x, frameWidth, x, h-frameWidth) : painter.drawLine(frameWidth, x, w-frameWidth, x); @@ -236,18 +236,18 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) switch((int)(device->quality()*3)) { case 0: - color = Qt::darkRed; - brush = Qt::red; + color = TQt::darkRed; + brush = TQt::red; break; case 1: - color = Qt::darkYellow; - brush = Qt::yellow; + color = TQt::darkYellow; + brush = TQt::yellow; break; default: - color = Qt::darkGreen; - brush = Qt::green; + color = TQt::darkGreen; + brush = TQt::green; }; - if(mode == Vertical) + if(mode ==Qt::Vertical) { int position = (int)(((float)(h-2*frameWidth))*(1-device->quality())+0.5); @@ -255,7 +255,7 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) (0, 4, frameWidth, h - 2*frameWidth, frameWidth, position + bevel/2, - qualityBarWidth, QMAX(position - bevel/2, frameWidth), + qualityBarWidth, TQMAX(position - bevel/2, frameWidth), qualityBarWidth, h - 2*frameWidth); } else { int position = (int)(((float)(w-2*frameWidth))*device->quality()+0.5); @@ -263,8 +263,8 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) points.putPoints (0, 4, frameWidth, frameWidth, - QMIN(position - bevel/2, w-frameWidth), frameWidth, - QMIN(position + bevel/2, w-frameWidth), frameWidth+qualityBarWidth-1, + TQMIN(position - bevel/2, w-frameWidth), frameWidth, + TQMIN(position + bevel/2, w-frameWidth), frameWidth+qualityBarWidth-1, frameWidth, frameWidth+qualityBarWidth-1); } painter.setPen(TQPen(color)); @@ -272,10 +272,10 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) painter.drawPolygon(points); // draw the signal bar: - painter.setPen(TQPen(Qt::darkRed)); - painter.setBrush(Qt::red); + painter.setPen(TQPen(TQt::darkRed)); + painter.setBrush(TQt::red); - if(mode == Vertical) + if(mode ==Qt::Vertical) { int x = 2 * frameWidth + qualityBarWidth; int h1 = (int)(((float)(h-2*frameWidth))*(1-device->signal())+0.5); @@ -289,10 +289,10 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) painter.drawRect(x, y, w1, signalBarWidth); } // draw the noise bar: - painter.setPen(TQPen(Qt::gray)); - painter.setBrush(Qt::lightGray); + painter.setPen(TQPen(TQt::gray)); + painter.setBrush(TQt::lightGray); - if(mode == Vertical) + if(mode ==Qt::Vertical) { int x = 3 * frameWidth + qualityBarWidth + signalBarWidth; int h1 = (int)(((float)(h-2*frameWidth))*(1-device->noise())+0.5); @@ -308,17 +308,17 @@ void KWireLessWidget::paintEvent(TQPaintEvent*) } } -KWireLessWidget* KWireLessWidget::makeWireLessWidget(TQWidget *parent, +KWireLessWidget* KWireLessWidget::makeWireLessWidget(TQWidget *tqparent, const char *name) { #if 1 // defined linuxwirelesswidget - return new LinuxWireLessWidget(parent, name); + return new LinuxWireLessWidget(tqparent, name); #else #error KWireLess is not available for your OS #endif // just to shut the compiler up: - parent = parent; name = name; return 0; + tqparent = tqparent; name = name; return 0; } #include "kwirelesswidget.moc" diff --git a/wifi/kwireless/kwirelesswidget.h b/wifi/kwireless/kwirelesswidget.h index 3321b583..534c16c4 100644 --- a/wifi/kwireless/kwirelesswidget.h +++ b/wifi/kwireless/kwirelesswidget.h @@ -18,8 +18,8 @@ class DeviceInfo { public: - DeviceInfo(TQString _device=TQString::null, TQString _essid=TQString::null, - TQString _encr=TQString::null, + DeviceInfo(TQString _device=TQString(), TQString _essid=TQString(), + TQString _encr=TQString(), float _quality=0, float _signal=0, float _noise=0, int _bitrate=0); TQString bitrateString(); @@ -50,18 +50,19 @@ protected: It is supposed to "look good" at about any resolution (to enable it to be used in the panel). */ -class KWireLessWidget : public QWidget +class KWireLessWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: enum Mode { Horizontal, Vertical }; - static KWireLessWidget* makeWireLessWidget(TQWidget *parent = 0, + static KWireLessWidget* makeWireLessWidget(TQWidget *tqparent = 0, const char *name = 0); protected: - KWireLessWidget(TQWidget *parent=0, const char* name=0); + KWireLessWidget(TQWidget *tqparent=0, const char* name=0); public: ~KWireLessWidget(); void setMode(Mode); diff --git a/wifi/kwireless/linuxwirelesswidget.cpp b/wifi/kwireless/linuxwirelesswidget.cpp index 3efdbf98..b7aa31b4 100644 --- a/wifi/kwireless/linuxwirelesswidget.cpp +++ b/wifi/kwireless/linuxwirelesswidget.cpp @@ -23,8 +23,8 @@ extern "C" { int LinuxWireLessWidget::socketFD; TQStringList LinuxWireLessWidget::deviceNames; -LinuxWireLessWidget::LinuxWireLessWidget(TQWidget *parent, const char* name) - : KWireLessWidget(parent, name), +LinuxWireLessWidget::LinuxWireLessWidget(TQWidget *tqparent, const char* name) + : KWireLessWidget(tqparent, name), m_number (-1) { } @@ -187,7 +187,7 @@ void LinuxWireLessWidget::poll() if(updateNeeded) { emit(updateDeviceInfo(&deviceInfo)); - repaint(false); + tqrepaint(false); } if(updateToolTip) { @@ -199,9 +199,9 @@ void LinuxWireLessWidget::poll() if (!text.isEmpty()) text.append('\n'); text += i18n("%1: Link Quality %2, Bitrate: %3") - .arg(info->device()) - .arg(info->qualityString()) - .arg(info->bitrateString()); + .tqarg(info->device()) + .tqarg(info->qualityString()) + .tqarg(info->bitrateString()); } TQToolTip::add(this, text); diff --git a/wifi/kwireless/linuxwirelesswidget.h b/wifi/kwireless/linuxwirelesswidget.h index fe695d68..0d4513ca 100644 --- a/wifi/kwireless/linuxwirelesswidget.h +++ b/wifi/kwireless/linuxwirelesswidget.h @@ -15,8 +15,9 @@ class LinuxWireLessWidget : public KWireLessWidget { Q_OBJECT + TQ_OBJECT public: - LinuxWireLessWidget(TQWidget *parent=0, const char* name=0); + LinuxWireLessWidget(TQWidget *tqparent=0, const char* name=0); ~LinuxWireLessWidget(); protected: /** poll() is supposed to read the information from diff --git a/wifi/kwireless/propertytable.cpp b/wifi/kwireless/propertytable.cpp index 7c73b1c2..4b0bea14 100644 --- a/wifi/kwireless/propertytable.cpp +++ b/wifi/kwireless/propertytable.cpp @@ -21,8 +21,8 @@ extern "C" { #include } -PropertyTable::PropertyTable(TQWidget *parent, const char* name) - : PropertyTableBase(parent, name) +PropertyTable::PropertyTable(TQWidget *tqparent, const char* name) + : PropertyTableBase(tqparent, name) { } @@ -30,8 +30,8 @@ PropertyTable::~PropertyTable() { } -PropertiesDialog::PropertiesDialog(TQWidget *parent, const char *name) - : KDialogBase(parent, name, true, +PropertiesDialog::PropertiesDialog(TQWidget *tqparent, const char *name) + : KDialogBase(tqparent, name, true, i18n("Wireless Network Device Properties"), KDialogBase::Ok, KDialogBase::Ok, true), wait(false) diff --git a/wifi/kwireless/propertytable.h b/wifi/kwireless/propertytable.h index 3b95dacf..f71f9f6b 100644 --- a/wifi/kwireless/propertytable.h +++ b/wifi/kwireless/propertytable.h @@ -20,8 +20,9 @@ class TQTimer; class PropertyTable : public PropertyTableBase { Q_OBJECT + TQ_OBJECT public: - PropertyTable(TQWidget *parent = 0, const char* name = 0); + PropertyTable(TQWidget *tqparent = 0, const char* name = 0); ~PropertyTable(); }; @@ -29,8 +30,9 @@ public: class PropertiesDialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: - PropertiesDialog(TQWidget *parent = 0, const char *name = 0); + PropertiesDialog(TQWidget *tqparent = 0, const char *name = 0); protected: PropertyTable *table; TQPtrList *info; diff --git a/wifi/kwireless/propertytablebase.ui b/wifi/kwireless/propertytablebase.ui index 8f52c58b..19e97b2a 100644 --- a/wifi/kwireless/propertytablebase.ui +++ b/wifi/kwireless/propertytablebase.ui @@ -1,6 +1,6 @@ PropertyTableBase - + PropertyTableBase @@ -22,7 +22,7 @@ 0 - + Property @@ -49,12 +49,12 @@ true - + cbDeviceSelector - + tlDevice @@ -64,5 +64,5 @@ - + -- cgit v1.2.1