diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/torrent | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/torrent')
-rw-r--r-- | src/modules/torrent/libkvitorrent.cpp | 22 | ||||
-rw-r--r-- | src/modules/torrent/tc_interface.h | 40 | ||||
-rw-r--r-- | src/modules/torrent/tc_ktorrentdcopinterface.cpp | 48 | ||||
-rw-r--r-- | src/modules/torrent/tc_ktorrentdcopinterface.h | 17 | ||||
-rw-r--r-- | src/modules/torrent/tc_statusbarapplet.cpp | 30 | ||||
-rw-r--r-- | src/modules/torrent/tc_statusbarapplet.h | 3 |
6 files changed, 81 insertions, 79 deletions
diff --git a/src/modules/torrent/libkvitorrent.cpp b/src/modules/torrent/libkvitorrent.cpp index 9a929483..8ab218ab 100644 --- a/src/modules/torrent/libkvitorrent.cpp +++ b/src/modules/torrent/libkvitorrent.cpp @@ -86,9 +86,9 @@ static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) } if(pOut) { - QString szOut; - QString szNam = d->name(); - KviQString::sprintf(szOut,__tr2qs_ctx("Trying media player interface \"%Q\": score %d","mediaplayer"),&(szNam),iScore); + TQString szOut; + TQString szNam = d->name(); + KviTQString::sprintf(szOut,__tr2qs_ctx("Trying media player interface \"%Q\": score %d","mediaplayer"),&(szNam),iScore); pOut->output(KVI_OUT_MULTIMEDIA,szOut); } } @@ -127,7 +127,7 @@ static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) if (!c->hasSwitch('q',"quiet")) \ { \ c->warning(__tr2qs_ctx("The selected torrent client interface failed to execute the requested function", "torrent")); \ - QString tmp = __tr2qs_ctx("Last interface error: ", "torrent"); \ + TQString tmp = __tr2qs_ctx("Last interface error: ", "torrent"); \ tmp += KviTorrentInterface::selected()->lastError(); \ c->warning(tmp); \ } \ @@ -169,7 +169,7 @@ static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) { \ kvs_int_t arg1; \ kvs_int_t arg2; \ - QString arg3; \ + TQString arg3; \ KVSM_PARAMETERS_BEGIN(c) \ KVSM_PARAMETER(__argname1, KVS_PT_INT, 0, arg1) \ KVSM_PARAMETER(__argname2, KVS_PT_INT, 0, arg2) \ @@ -191,7 +191,7 @@ static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) TC_KVS_FUNCTION(__name) \ { \ TC_KVS_FAIL_ON_NO_INTERFACE \ - QString szRet = KviTorrentInterface::selected()->__ifacecommand(); \ + TQString szRet = KviTorrentInterface::selected()->__ifacecommand(); \ c->returnValue()->setString(szRet); \ return true; \ } @@ -235,7 +235,7 @@ static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \ KVSM_PARAMETERS_END(c) \ TC_KVS_FAIL_ON_NO_INTERFACE \ - QString szRet = KviTorrentInterface::selected()->__ifacecommand(arg); \ + TQString szRet = KviTorrentInterface::selected()->__ifacecommand(arg); \ c->returnValue()->setString(szRet); \ return true; \ } @@ -250,7 +250,7 @@ static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) KVSM_PARAMETER(__argname2, KVS_PT_INT, 0, arg2) \ KVSM_PARAMETERS_END(c) \ TC_KVS_FAIL_ON_NO_INTERFACE \ - QString szRet = KviTorrentInterface::selected()->__ifacecommand(arg1, arg2); \ + TQString szRet = KviTorrentInterface::selected()->__ifacecommand(arg1, arg2); \ c->returnValue()->setString(szRet); \ return true; \ } @@ -694,7 +694,7 @@ TC_KVS_SIMPLE_COMMAND(stopAll, stopAll) TC_KVS_COMMAND(setClient) { - QString client; + TQString client; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("client", KVS_PT_STRING, 0, client) @@ -873,8 +873,8 @@ static bool torrent_module_ctrl(KviModule * m,const char * operation,void * para debug("torrent module ctrl"); /* if(kvi_strEqualCI(operation,"getAvailableMediaPlayers")) { - // we expect param to be a pointer to QStringList - QStringList * l = (QStringList *)param; + // we expect param to be a pointer to TQStringList + TQStringList * l = (TQStringList *)param; for(KviMediaPlayerInterfaceDescriptor * d = g_pDescriptorList->first();d;d = g_pDescriptorList->next()) { l->append(d->name()); diff --git a/src/modules/torrent/tc_interface.h b/src/modules/torrent/tc_interface.h index 797ea428..c7de40b1 100644 --- a/src/modules/torrent/tc_interface.h +++ b/src/modules/torrent/tc_interface.h @@ -30,9 +30,9 @@ #include "kvi_settings.h" #include "kvi_qstring.h" -#include <qobject.h> +#include <tqobject.h> -class KviTorrentInterface : public QObject +class KviTorrentInterface : public TQObject { public: @@ -47,19 +47,19 @@ public: /* // path of torrent file - virtual QCString getTorrentFile(int i)=0; + virtual TQCString getTorrentFile(int i)=0; // directory where data is downloaded to - virtual QCString getTorrentDataDir(int i)=0; + virtual TQCString getTorrentDataDir(int i)=0; */ // number of files in torrent virtual int fileCount(int i)=0; // name of file in torrent - virtual QString fileName(int i, int file)=0; + virtual TQString fileName(int i, int file)=0; // returns file priority (low, normal, high) - virtual QString filePriority(int i, int file)=0; + virtual TQString filePriority(int i, int file)=0; // sets file priority - virtual bool setFilePriority(int i, int file, const QString &prio)=0; + virtual bool setFilePriority(int i, int file, const TQString &prio)=0; virtual bool start(int i)=0; virtual bool stop(int i)=0; @@ -72,16 +72,16 @@ public: // remove torrent from client virtual bool removeTorrent(int i)=0; - virtual bool addTorrent(const QCString &mrl); + virtual bool addTorrent(const TQCString &mrl); */ // returns state of torrent number i (Stopped, Stalled, Seeding, Downloading) // this uses getTorrentInfo() to obtain the state and then // returns it as string - virtual QString state(int i)=0; + virtual TQString state(int i)=0; // name of torrent as displayed in client // uses getTorrentInfo() - virtual QString name(int i)=0; + virtual TQString name(int i)=0; virtual float speedUp()=0; virtual float speedDown()=0; @@ -95,14 +95,14 @@ public: virtual bool setMaxUploadSpeed(int kbytes_per_sec)=0; virtual bool setMaxDownloadSpeed(int kbytes_per_sec)=0; - QString lastError() { return m_lastError; } + TQString lastError() { return m_lastError; } static void select(KviTorrentInterface *i) { m_selected = i; } static KviTorrentInterface *selected() { return m_selected; } protected: - QString m_lastError; + TQString m_lastError; static KviTorrentInterface *m_selected; }; @@ -113,8 +113,8 @@ public: KviTorrentInterfaceDescriptor() {}; virtual ~KviTorrentInterfaceDescriptor() {}; public: - virtual const QString & name() = 0; - virtual const QString & description() = 0; + virtual const TQString & name() = 0; + virtual const TQString & description() = 0; virtual KviTorrentInterface * instance() = 0; }; @@ -126,11 +126,11 @@ public: virtual ~_interfaceclass ## Descriptor(); \ protected: \ _interfaceclass * m_pInstance; \ - QString m_szName; \ - QString m_szDescription; \ + TQString m_szName; \ + TQString m_szDescription; \ public: \ - virtual const QString & name(); \ - virtual const QString & description(); \ + virtual const TQString & name(); \ + virtual const TQString & description(); \ virtual KviTorrentInterface * instance(); \ }; @@ -146,11 +146,11 @@ public: { \ delete m_pInstance; \ } \ - const QString & _interfaceclass ## Descriptor::name() \ + const TQString & _interfaceclass ## Descriptor::name() \ { \ return m_szName; \ } \ - const QString & _interfaceclass ## Descriptor::description() \ + const TQString & _interfaceclass ## Descriptor::description() \ { \ return m_szDescription; \ } \ diff --git a/src/modules/torrent/tc_ktorrentdcopinterface.cpp b/src/modules/torrent/tc_ktorrentdcopinterface.cpp index 8e770bfc..d6047194 100644 --- a/src/modules/torrent/tc_ktorrentdcopinterface.cpp +++ b/src/modules/torrent/tc_ktorrentdcopinterface.cpp @@ -36,7 +36,7 @@ #include "kvi_locale.h" -#include <qtimer.h> +#include <tqtimer.h> TORR_IMPLEMENT_DESCRIPTOR( KviKTorrentDCOPInterface, @@ -49,16 +49,16 @@ TORR_IMPLEMENT_DESCRIPTOR( ) #define ERROR_MSG \ - QCString msg; \ + TQCString msg; \ if (!findRunningApp(m_szAppId)) \ msg = "KTorrent's isn't running!"; \ else \ msg = "Something's wrong here! KTorrent's DCOP interface has probably changed."; \ - m_lastError = __tr2qs_ctx(QString(msg), "torrent"); \ + m_lastError = __tr2qs_ctx(TQString(msg), "torrent"); \ debug("%s (%s:%d): %s", __PRETTY_FUNCTION__, __FILE__, __LINE__, (const char*)msg); \ #define ERROR_MSG_RANGE(I, SIZE) \ - KviQString::sprintf(m_lastError, __tr2qs_ctx("Index out of range: %d [0-%d]!", "torrent"), I, (SIZE>0)?(SIZE-1):0); \ + KviTQString::sprintf(m_lastError, __tr2qs_ctx("Index out of range: %d [0-%d]!", "torrent"), I, (SIZE>0)?(SIZE-1):0); \ debug("%s (%s:%d): Index out of range: %d [0-%d]!", __PRETTY_FUNCTION__ , __FILE__, __LINE__, I, (SIZE>0)?(SIZE-1):0); #define ERROR_RET_BOOL \ @@ -112,8 +112,8 @@ KviKTorrentDCOPInterface::KviKTorrentDCOPInterface() { printf("KviKTorrentDCOPInterface\n"); - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(slotTimer())); + TQTimer *timer = new TQTimer(this); + connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimer())); timer->start(250, FALSE); // make sure we have a list of files, @@ -166,7 +166,7 @@ int KviKTorrentDCOPInterface::detect() return 100; } -bool makeSize(float &sz, const QString &s, const QString &u) +bool makeSize(float &sz, const TQString &s, const TQString &u) { bool ok; sz = s.toFloat(&ok); @@ -222,14 +222,14 @@ bool KviKTorrentDCOPInterface::announce(int i) return true; } -QString KviKTorrentDCOPInterface::state(int i) +TQString KviKTorrentDCOPInterface::state(int i) { CHECK_RANGE_STRING(i, m_ti.size()) return m_ti[i].state; } -QString KviKTorrentDCOPInterface::name(int i) +TQString KviKTorrentDCOPInterface::name(int i) { CHECK_RANGE_STRING(i, m_ti.size()) @@ -247,7 +247,7 @@ int KviKTorrentDCOPInterface::fileCount(int i) return ret; } -QString KviKTorrentDCOPInterface::fileName(int i, int file) +TQString KviKTorrentDCOPInterface::fileName(int i, int file) { CHECK_RANGE_STRING(i, m_ti.size()) @@ -260,11 +260,11 @@ QString KviKTorrentDCOPInterface::fileName(int i, int file) return ret[file]; } -QString KviKTorrentDCOPInterface::filePriority(int i, int file) +TQString KviKTorrentDCOPInterface::filePriority(int i, int file) { CHECK_RANGE_STRING(i, m_ti.size()) - QValueList<int> ret; + TQValueList<int> ret; if (!qvalueListIntRetIntDCOPCall("KTorrent", "getFilePriorities(int)",ret, m_ti[i].num)) ERROR_RET_STRING @@ -281,7 +281,7 @@ QString KviKTorrentDCOPInterface::filePriority(int i, int file) ERROR_RET_STRING } -bool KviKTorrentDCOPInterface::setFilePriority(int i, int file, const QString &prio) +bool KviKTorrentDCOPInterface::setFilePriority(int i, int file, const TQString &prio) { CHECK_RANGE_BOOL(i, m_ti.size()) @@ -330,7 +330,7 @@ float KviKTorrentDCOPInterface::speedUp() if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) ERROR_RET_NUM - QStringList tmp = QStringList::split(" ", ret[2]); + TQStringList tmp = TQStringList::split(" ", ret[2]); if (tmp.size() != 8) ERROR_RET_NUM @@ -348,7 +348,7 @@ float KviKTorrentDCOPInterface::speedDown() if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) ERROR_RET_NUM - QStringList tmp = QStringList::split(" ", ret[2]); + TQStringList tmp = TQStringList::split(" ", ret[2]); if (tmp.size() != 8) ERROR_RET_NUM @@ -366,7 +366,7 @@ float KviKTorrentDCOPInterface::trafficUp() if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) ERROR_RET_NUM - QStringList tmp = QStringList::split(" ", ret[1]); + TQStringList tmp = TQStringList::split(" ", ret[1]); if (tmp.size() != 8) ERROR_RET_NUM @@ -383,7 +383,7 @@ float KviKTorrentDCOPInterface::trafficDown() if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) ERROR_RET_NUM - QStringList tmp = QStringList::split(" ", ret[1]); + TQStringList tmp = TQStringList::split(" ", ret[1]); if (tmp.size() != 8) ERROR_RET_NUM @@ -412,29 +412,29 @@ bool KviKTorrentDCOPInterface::makeTorrentInfo(TorrentInfo &ti, const KviQCStrin ti.state = "Stopped"; - QStringList tmp; - tmp = QStringList::split(" ", ret[2]); + TQStringList tmp; + tmp = TQStringList::split(" ", ret[2]); if (tmp.size()!=2 || !makeSize(ti.trafficDown, tmp[0], tmp[1])) ERROR_RET_BOOL - tmp = QStringList::split(" ", ret[3]); + tmp = TQStringList::split(" ", ret[3]); if (tmp.size()!=2 || !makeSize(ti.size, tmp[0], tmp[1])) ERROR_RET_BOOL - tmp = QStringList::split(" ", ret[4]); + tmp = TQStringList::split(" ", ret[4]); if (tmp.size()!=2 || !makeSize(ti.trafficUp, tmp[0], tmp[1])) ERROR_RET_BOOL bool ok; - tmp = QStringList::split(" ", ret[5]); + tmp = TQStringList::split(" ", ret[5]); if (tmp.size()!=2) ERROR_RET_BOOL ti.speedDown = tmp[0].toFloat(&ok); if (!ok) ERROR_RET_BOOL - tmp = QStringList::split(" ", ret[6]); + tmp = TQStringList::split(" ", ret[6]); if (tmp.size()!=2) ERROR_RET_BOOL ti.speedUp = tmp[0].toFloat(&ok); @@ -447,7 +447,7 @@ bool KviKTorrentDCOPInterface::makeTorrentInfo(TorrentInfo &ti, const KviQCStrin if (!ok) ERROR_RET_BOOL - tmp = QStringList::split(" ", ret[9]); + tmp = TQStringList::split(" ", ret[9]); if (tmp.size()!=2) ERROR_RET_BOOL ti.percent = tmp[0].toFloat(&ok); diff --git a/src/modules/torrent/tc_ktorrentdcopinterface.h b/src/modules/torrent/tc_ktorrentdcopinterface.h index 8f39810f..529fb37e 100644 --- a/src/modules/torrent/tc_ktorrentdcopinterface.h +++ b/src/modules/torrent/tc_ktorrentdcopinterface.h @@ -41,6 +41,7 @@ class KviKTorrentDCOPInterface : public KviTorrentInterface, private KviDCOPHelper { Q_OBJECT + TQ_OBJECT public: @@ -54,13 +55,13 @@ public: virtual bool start(int i); virtual bool stop(int i); virtual bool announce(int i); - virtual QString state(int i); - virtual QString name(int i); + virtual TQString state(int i); + virtual TQString name(int i); virtual int fileCount(int i); - virtual QString fileName(int i, int file); - virtual QString filePriority(int i, int file); - virtual bool setFilePriority(int i, int file, const QString &prio); + virtual TQString fileName(int i, int file); + virtual TQString filePriority(int i, int file); + virtual bool setFilePriority(int i, int file, const TQString &prio); virtual bool startAll(); virtual bool stopAll(); @@ -96,9 +97,9 @@ private: // internal number int num; // name displayed in ktorrent - QString name; + TQString name; // state of torrent - QString state; + TQString state; // bytes float size; // bytes @@ -117,7 +118,7 @@ private: bool operator<(const TorrentInfo &ti) { return name < ti.name; } }; - QValueList<TorrentInfo> m_ti; + TQValueList<TorrentInfo> m_ti; private: diff --git a/src/modules/torrent/tc_statusbarapplet.cpp b/src/modules/torrent/tc_statusbarapplet.cpp index 5d23a299..b609e8d4 100644 --- a/src/modules/torrent/tc_statusbarapplet.cpp +++ b/src/modules/torrent/tc_statusbarapplet.cpp @@ -1,14 +1,14 @@ -#include "qtimer.h" +#include "tqtimer.h" #include "kvi_locale.h" #include "kvi_iconmanager.h" #include "tc_interface.h" #include "tc_statusbarapplet.h" -KviTorrentStatusBarApplet::KviTorrentStatusBarApplet(KviStatusBar *parent, KviStatusBarAppletDescriptor *desc) - : KviStatusBarApplet(parent, desc) +KviTorrentStatusBarApplet::KviTorrentStatusBarApplet(KviStatusBar *tqparent, KviStatusBarAppletDescriptor *desc) + : KviStatusBarApplet(tqparent, desc) { - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(update())); + TQTimer *timer = new TQTimer(this); + connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(update())); timer->start(250, FALSE); // updateDisplay(); // @@ -36,26 +36,26 @@ void KviTorrentStatusBarApplet::selfRegister(KviStatusBar *bar) bar->registerAppletDescriptor(d); } -QString formatSize(float sz) +TQString formatSize(float sz) { if (sz >= 1024.0f*1024.0f*1024.0f) - return QString("%1 GB").arg(sz / (1024.0f*1024.0f*1024.0f), 2, 'f', 2); + return TQString("%1 GB").tqarg(sz / (1024.0f*1024.0f*1024.0f), 2, 'f', 2); if (sz >= 1024.0f*1024.0f) - return QString("%1 MB").arg(sz / (1024.0f*1024.0f), 2, 'f', 2); + return TQString("%1 MB").tqarg(sz / (1024.0f*1024.0f), 2, 'f', 2); if (sz >= 1024.0f) - return QString("%1 KB").arg(sz / 1024.0f, 2, 'f', 2); - return QString("%1 B").arg(sz, 2, 'f', 2); + return TQString("%1 KB").tqarg(sz / 1024.0f, 2, 'f', 2); + return TQString("%1 B").tqarg(sz, 2, 'f', 2); } void KviTorrentStatusBarApplet::update() { if (KviTorrentInterface::selected()) { - QString msg = QString("up: %1 K/s (%2), dn: %3 K/s (%4)") - .arg(KviTorrentInterface::selected()->speedUp(), 2) - .arg(formatSize(KviTorrentInterface::selected()->trafficUp())) - .arg(KviTorrentInterface::selected()->speedDown(), 2) - .arg(formatSize(KviTorrentInterface::selected()->trafficDown())); + TQString msg = TQString("up: %1 K/s (%2), dn: %3 K/s (%4)") + .tqarg(KviTorrentInterface::selected()->speedUp(), 2) + .tqarg(formatSize(KviTorrentInterface::selected()->trafficUp())) + .tqarg(KviTorrentInterface::selected()->speedDown(), 2) + .tqarg(formatSize(KviTorrentInterface::selected()->trafficDown())); setText(msg); diff --git a/src/modules/torrent/tc_statusbarapplet.h b/src/modules/torrent/tc_statusbarapplet.h index 03dd6d0d..63ab3054 100644 --- a/src/modules/torrent/tc_statusbarapplet.h +++ b/src/modules/torrent/tc_statusbarapplet.h @@ -9,10 +9,11 @@ class KviTorrentStatusBarApplet : public KviStatusBarApplet { Q_OBJECT + TQ_OBJECT public: - KviTorrentStatusBarApplet(KviStatusBar *parent, KviStatusBarAppletDescriptor *desc); + KviTorrentStatusBarApplet(KviStatusBar *tqparent, KviStatusBarAppletDescriptor *desc); virtual ~KviTorrentStatusBarApplet(); static void selfRegister(KviStatusBar *bar); |