diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 18:16:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 18:16:06 +0000 |
commit | 02a6c8f36311eb6225066df35adf8d00f9cd942b (patch) | |
tree | ceb91c373877f7a69209e184c81b53dc6f9402d7 /src/knemod/interfacetooltip.cpp | |
parent | 09e6e27fe85b2efb28072f1c81f6581fa6837d92 (diff) | |
download | knemo-02a6c8f36311eb6225066df35adf8d00f9cd942b.tar.gz knemo-02a6c8f36311eb6225066df35adf8d00f9cd942b.zip |
TQt4 port knemo
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knemo@1238869 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knemod/interfacetooltip.cpp')
-rw-r--r-- | src/knemod/interfacetooltip.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/knemod/interfacetooltip.cpp b/src/knemod/interfacetooltip.cpp index 77d6505..29e098d 100644 --- a/src/knemod/interfacetooltip.cpp +++ b/src/knemod/interfacetooltip.cpp @@ -17,8 +17,8 @@ Boston, MA 02110-1301, USA. */ -#include <qrect.h> -#include <qstring.h> +#include <tqrect.h> +#include <tqstring.h> #include <kdebug.h> #include <klocale.h> @@ -29,8 +29,8 @@ #include "interfacetooltip.h" InterfaceToolTip::InterfaceToolTip( Interface* interface, - QWidget* parent ) - : QToolTip( parent ), + TQWidget* tqparent ) + : TQToolTip( tqparent ), mInterface( interface ) { setupToolTipArray(); @@ -40,25 +40,25 @@ InterfaceToolTip::~InterfaceToolTip() { } -void InterfaceToolTip::maybeTip( const QPoint& ) +void InterfaceToolTip::maybeTip( const TQPoint& ) { - QRect rect( parentWidget()->rect() ); + TQRect rect( tqparentWidget()->rect() ); if ( !rect.isValid() ) return; - QString tooltip; + TQString tooltip; setupText( tooltip ); tip( rect, tooltip ); } -void InterfaceToolTip::setupText( QString& text ) +void InterfaceToolTip::setupText( TQString& text ) { int toolTipContent = mInterface->getGeneralData().toolTipContent; InterfaceData& data = mInterface->getData(); text += "<table cellspacing=0 cellpadding=0 border=0>"; if ( ( toolTipContent & ALIAS ) && - mInterface->getSettings().alias != QString::null ) + mInterface->getSettings().alias != TQString() ) text += "<tr><th colspan=2 align=center>" + mInterface->getSettings().alias + "</th></tr>"; if ( toolTipContent & INTERFACE ) text += "<tr><td>" + mToolTips[0].first + "</td><td>" + mInterface->getName() + "</td></tr>"; @@ -68,21 +68,21 @@ void InterfaceToolTip::setupText( QString& text ) text += "<tr><td>" + mToolTips[2].first + "</td><td>" + i18n( "Connection established." ) + "</td></tr>"; if ( toolTipContent & UPTIME ) { - int upsecs = mInterface->getStartTime().secsTo( QDateTime::currentDateTime() ); - int updays = upsecs / 86400; // don't use QDateTime::daysTo() because + int upsecs = mInterface->getStartTime().secsTo( TQDateTime::tqcurrentDateTime() ); + int updays = upsecs / 86400; // don't use TQDateTime::daysTo() because // we only want complete days - QString uptime; + TQString uptime; if ( updays == 1 ) uptime = "1 day, "; else if ( updays > 1 ) - uptime = QString( "%1 days, " ).arg( updays ); + uptime = TQString( "%1 days, " ).tqarg( updays ); upsecs -= 86400 * updays; // we only want the seconds of today int hrs = upsecs / 3600; int mins = ( upsecs - hrs * 3600 ) / 60; int secs = upsecs - hrs * 3600 - mins * 60; - QString time; + TQString time; time.sprintf( "%02d:%02d:%02d", hrs, mins, secs ); uptime += time; text += "<tr><td>" + mToolTips[3].first + "</td><td>" + uptime + "</td></tr>"; @@ -120,9 +120,9 @@ void InterfaceToolTip::setupText( QString& text ) text += "<tr><td>" + mToolTips[7].first + "</td><td>" + data.ptpAddress + "</td></tr>"; } if ( toolTipContent & RX_PACKETS ) - text += "<tr><td>" + mToolTips[8].first + "</td><td>" + QString::number( data.rxPackets ) + "</td></tr>"; + text += "<tr><td>" + mToolTips[8].first + "</td><td>" + TQString::number( data.rxPackets ) + "</td></tr>"; if ( toolTipContent & TX_PACKETS ) - text += "<tr><td>" + mToolTips[9].first + "</td><td>" + QString::number( data.txPackets ) + "</td></tr>"; + text += "<tr><td>" + mToolTips[9].first + "</td><td>" + TQString::number( data.txPackets ) + "</td></tr>"; if ( toolTipContent & RX_BYTES ) text += "<tr><td>" + mToolTips[10].first + "</td><td>" + data.rxString + "</td></tr>"; if ( toolTipContent & TX_BYTES ) @@ -152,7 +152,7 @@ void InterfaceToolTip::setupText( QString& text ) text += "<tr><td>" + mToolTips[15].first + "</td><td>" + wdata.bitRate + "</td></tr>"; if ( toolTipContent & ACCESS_POINT ) text += "<tr><td>" + mToolTips[16].first + "</td><td>" + wdata.accessPoint + "</td></tr>"; - if ( toolTipContent & LINK_QUALITY ) + if ( toolTipContent & LINK_TQUALITY ) text += "<tr><td>" + mToolTips[17].first + "</td><td>" + wdata.linkQuality + "</td></tr>"; if ( toolTipContent & NICK_NAME ) text += "<tr><td>" + mToolTips[22].first + "</td><td>" + wdata.nickName + "</td></tr>"; @@ -175,30 +175,30 @@ void InterfaceToolTip::setupToolTipArray() { // Cannot make this data static as the i18n macro doesn't seem // to work when called to early i.e. before setting the catalogue. - mToolTips[0] = QPair<QString, int>( i18n( "Interface" ), INTERFACE ); - mToolTips[1] = QPair<QString, int>( i18n( "Alias" ), ALIAS ); - mToolTips[2] = QPair<QString, int>( i18n( "Status" ), STATUS ); - mToolTips[3] = QPair<QString, int>( i18n( "Uptime" ), UPTIME ); - mToolTips[4] = QPair<QString, int>( i18n( "IP-Address" ), IP_ADDRESS ); - mToolTips[5] = QPair<QString, int>( i18n( "Subnet Mask" ), SUBNET_MASK ); - mToolTips[6] = QPair<QString, int>( i18n( "HW-Address" ), HW_ADDRESS ); - mToolTips[7] = QPair<QString, int>( i18n( "PtP-Address" ), PTP_ADDRESS ); - mToolTips[8] = QPair<QString, int>( i18n( "Packets Received" ), RX_PACKETS ); - mToolTips[9] = QPair<QString, int>( i18n( "Packets Sent" ), TX_PACKETS ); - mToolTips[10] = QPair<QString, int>( i18n( "Bytes Received" ), RX_BYTES ); - mToolTips[11] = QPair<QString, int>( i18n( "Bytes Sent" ), TX_BYTES ); - mToolTips[12] = QPair<QString, int>( i18n( "ESSID" ), ESSID ); - mToolTips[13] = QPair<QString, int>( i18n( "Mode" ), MODE ); - mToolTips[14] = QPair<QString, int>( i18n( "Frequency" ), FREQUENCY ); - mToolTips[15] = QPair<QString, int>( i18n( "Bit Rate" ), BIT_RATE ); - mToolTips[16] = QPair<QString, int>( i18n( "Access Point" ), ACCESS_POINT ); - mToolTips[17] = QPair<QString, int>( i18n( "Link Quality" ), LINK_QUALITY ); - mToolTips[18] = QPair<QString, int>( i18n( "Broadcast Address" ), BCAST_ADDRESS ); - mToolTips[19] = QPair<QString, int>( i18n( "Default Gateway" ), LINK_QUALITY ); - mToolTips[20] = QPair<QString, int>( i18n( "Download Speed" ), DOWNLOAD_SPEED ); - mToolTips[21] = QPair<QString, int>( i18n( "Upload Speed" ), UPLOAD_SPEED ); - mToolTips[22] = QPair<QString, int>( i18n( "Nickname" ), NICK_NAME ); - mToolTips[23] = QPair<QString, int>( i18n( "Encryption" ), ENCRYPTION ); - mToolTips[24] = QPair<QString, int>(); + mToolTips[0] = TQPair<TQString, int>( i18n( "Interface" ), INTERFACE ); + mToolTips[1] = TQPair<TQString, int>( i18n( "Alias" ), ALIAS ); + mToolTips[2] = TQPair<TQString, int>( i18n( "tqStatus" ), STATUS ); + mToolTips[3] = TQPair<TQString, int>( i18n( "Uptime" ), UPTIME ); + mToolTips[4] = TQPair<TQString, int>( i18n( "IP-Address" ), IP_ADDRESS ); + mToolTips[5] = TQPair<TQString, int>( i18n( "Subnet Mask" ), SUBNET_MASK ); + mToolTips[6] = TQPair<TQString, int>( i18n( "HW-Address" ), HW_ADDRESS ); + mToolTips[7] = TQPair<TQString, int>( i18n( "PtP-Address" ), PTP_ADDRESS ); + mToolTips[8] = TQPair<TQString, int>( i18n( "Packets Received" ), RX_PACKETS ); + mToolTips[9] = TQPair<TQString, int>( i18n( "Packets Sent" ), TX_PACKETS ); + mToolTips[10] = TQPair<TQString, int>( i18n( "Bytes Received" ), RX_BYTES ); + mToolTips[11] = TQPair<TQString, int>( i18n( "Bytes Sent" ), TX_BYTES ); + mToolTips[12] = TQPair<TQString, int>( i18n( "ESSID" ), ESSID ); + mToolTips[13] = TQPair<TQString, int>( i18n( "Mode" ), MODE ); + mToolTips[14] = TQPair<TQString, int>( i18n( "Frequency" ), FREQUENCY ); + mToolTips[15] = TQPair<TQString, int>( i18n( "Bit Rate" ), BIT_RATE ); + mToolTips[16] = TQPair<TQString, int>( i18n( "Access Point" ), ACCESS_POINT ); + mToolTips[17] = TQPair<TQString, int>( i18n( "Link Quality" ), LINK_TQUALITY ); + mToolTips[18] = TQPair<TQString, int>( i18n( "Broadcast Address" ), BCAST_ADDRESS ); + mToolTips[19] = TQPair<TQString, int>( i18n( "Default Gateway" ), LINK_TQUALITY ); + mToolTips[20] = TQPair<TQString, int>( i18n( "Download Speed" ), DOWNLOAD_SPEED ); + mToolTips[21] = TQPair<TQString, int>( i18n( "Upload Speed" ), UPLOAD_SPEED ); + mToolTips[22] = TQPair<TQString, int>( i18n( "Nickname" ), NICK_NAME ); + mToolTips[23] = TQPair<TQString, int>( i18n( "Encryption" ), ENCRYPTION ); + mToolTips[24] = TQPair<TQString, int>(); } |