diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 20:34:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 20:34:15 +0000 |
commit | 1c1403293485f35fd53db45aaa77a01cdd9627e7 (patch) | |
tree | 38559cd68cd4f63023fb5f6375def9db3b8b491e /libktorrent | |
parent | 894f94545727610df22c4f73911d62d58266f695 (diff) | |
download | ktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.tar.gz ktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.zip |
TQt4 port ktorrent
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1238733 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libktorrent')
228 files changed, 2221 insertions, 2174 deletions
diff --git a/libktorrent/datachecker/datachecker.h b/libktorrent/datachecker/datachecker.h index e181925..e038152 100644 --- a/libktorrent/datachecker/datachecker.h +++ b/libktorrent/datachecker/datachecker.h @@ -23,7 +23,7 @@ #include <util/bitset.h> #include "datacheckerlistener.h" -class QString; +class TQString; namespace bt @@ -54,7 +54,7 @@ namespace bt * @param tor The torrent * @param dnddir DND dir, optional argument if we know this */ - virtual void check(const QString & path,const Torrent & tor,const QString & dnddir) = 0; + virtual void check(const TQString & path,const Torrent & tor,const TQString & dnddir) = 0; /** * Get the BitSet representing all the downloaded chunks. diff --git a/libktorrent/datachecker/datacheckerthread.cpp b/libktorrent/datachecker/datacheckerthread.cpp index 12a58d7..fcbdf3d 100644 --- a/libktorrent/datachecker/datacheckerthread.cpp +++ b/libktorrent/datachecker/datacheckerthread.cpp @@ -27,9 +27,9 @@ namespace bt { DataCheckerThread::DataCheckerThread(DataChecker* dc, - const QString & path, + const TQString & path, const Torrent & tor, - const QString & dnddir) + const TQString & dnddir) : dc(dc),path(path),tor(tor),dnddir(dnddir) { running = true; diff --git a/libktorrent/datachecker/datacheckerthread.h b/libktorrent/datachecker/datacheckerthread.h index 749e3e8..207b245 100644 --- a/libktorrent/datachecker/datacheckerthread.h +++ b/libktorrent/datachecker/datacheckerthread.h @@ -20,7 +20,7 @@ #ifndef BTDATACHECKERTHREAD_H #define BTDATACHECKERTHREAD_H -#include <qthread.h> +#include <tqthread.h> namespace bt { @@ -32,16 +32,16 @@ namespace bt Thread which runs the data check. */ - class DataCheckerThread : public QThread + class DataCheckerThread : public TQThread { DataChecker* dc; - QString path; + TQString path; const Torrent & tor; - QString dnddir; + TQString dnddir; bool running; - QString error; + TQString error; public: - DataCheckerThread(DataChecker* dc,const QString & path,const Torrent & tor,const QString & dnddir); + DataCheckerThread(DataChecker* dc,const TQString & path,const Torrent & tor,const TQString & dnddir); virtual ~DataCheckerThread(); virtual void run(); @@ -53,7 +53,7 @@ namespace bt bool isRunning() const {return running;} /// Get the error (if any occured) - QString getError() const {return error;} + TQString getError() const {return error;} }; } diff --git a/libktorrent/datachecker/multidatachecker.cpp b/libktorrent/datachecker/multidatachecker.cpp index 3c26721..526fd08 100644 --- a/libktorrent/datachecker/multidatachecker.cpp +++ b/libktorrent/datachecker/multidatachecker.cpp @@ -45,7 +45,7 @@ namespace bt delete [] buf; } - void MultiDataChecker::check(const QString& path, const Torrent& tor,const QString & dnddir) + void MultiDataChecker::check(const TQString& path, const Torrent& tor,const TQString & dnddir) { Uint32 num_chunks = tor.getNumChunks(); // initialize the bitsets @@ -104,13 +104,13 @@ namespace bt const TorrentFile & tf, const Torrent & tor, Uint8* buf, - const QString & cache) + const TQString & cache) { File fptr; if (!fptr.open(cache + tf.getPath(), "rb")) { - Out() << QString("Warning : Cannot open %1 : %2").arg(cache + - tf.getPath()).arg(fptr.errorString()) << endl; + Out() << TQString("Warning : Cannot open %1 : %2").tqarg(cache + + tf.getPath()).tqarg(fptr.errorString()) << endl; return 0; } @@ -121,7 +121,7 @@ namespace bt bool MultiDataChecker::loadChunk(Uint32 ci,Uint32 cs,const Torrent & tor) { - QValueList<Uint32> tflist; + TQValueList<Uint32> tflist; tor.calcChunkPos(ci,tflist); // one file is simple @@ -183,8 +183,8 @@ namespace bt File fptr; if (!fptr.open(cache + f.getPath(), "rb")) { - Out() << QString("Warning : Cannot open %1 : %2").arg(cache + - f.getPath()).arg(fptr.errorString()) << endl; + Out() << TQString("Warning : Cannot open %1 : %2").tqarg(cache + + f.getPath()).tqarg(fptr.errorString()) << endl; return false; } else diff --git a/libktorrent/datachecker/multidatachecker.h b/libktorrent/datachecker/multidatachecker.h index d095e99..bb68a06 100644 --- a/libktorrent/datachecker/multidatachecker.h +++ b/libktorrent/datachecker/multidatachecker.h @@ -34,13 +34,13 @@ namespace bt MultiDataChecker(); virtual ~MultiDataChecker(); - virtual void check(const QString& path, const Torrent& tor,const QString & dnddir); + virtual void check(const TQString& path, const Torrent& tor,const TQString & dnddir); private: bool loadChunk(Uint32 ci,Uint32 cs,const Torrent & to); private: - QString cache; - QString dnd_dir; + TQString cache; + TQString dnd_dir; Uint8* buf; }; diff --git a/libktorrent/datachecker/singledatachecker.cpp b/libktorrent/datachecker/singledatachecker.cpp index 0579338..e086e90 100644 --- a/libktorrent/datachecker/singledatachecker.cpp +++ b/libktorrent/datachecker/singledatachecker.cpp @@ -39,7 +39,7 @@ namespace bt {} - void SingleDataChecker::check(const QString& path, const Torrent& tor,const QString &) + void SingleDataChecker::check(const TQString& path, const Torrent& tor,const TQString &) { // open the file Uint32 num_chunks = tor.getNumChunks(); @@ -48,7 +48,7 @@ namespace bt if (!fptr.open(path,"rb")) { throw Error(i18n("Cannot open file : %1 : %2") - .arg(path).arg( fptr.errorString())); + .tqarg(path).tqarg( fptr.errorString())); } // initialize the bitsets diff --git a/libktorrent/datachecker/singledatachecker.h b/libktorrent/datachecker/singledatachecker.h index 20107b3..3b86829 100644 --- a/libktorrent/datachecker/singledatachecker.h +++ b/libktorrent/datachecker/singledatachecker.h @@ -36,7 +36,7 @@ namespace bt SingleDataChecker(); virtual ~SingleDataChecker(); - virtual void check(const QString& path, const Torrent& tor,const QString & dnddir); + virtual void check(const TQString& path, const Torrent& tor,const TQString & dnddir); }; } diff --git a/libktorrent/expandablewidget.cpp b/libktorrent/expandablewidget.cpp index cdac376..8c06357 100644 --- a/libktorrent/expandablewidget.cpp +++ b/libktorrent/expandablewidget.cpp @@ -17,18 +17,18 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qlayout.h> -#include <qsplitter.h> +#include <tqlayout.h> +#include <tqsplitter.h> #include "expandablewidget.h" namespace kt { - ExpandableWidget::ExpandableWidget(QWidget* child,QWidget *parent, const char *name) - : QWidget(parent, name) + ExpandableWidget::ExpandableWidget(TQWidget* child,TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name) { - top_layout = new QHBoxLayout(this); - child->reparent(this,QPoint(),true); + top_layout = new TQHBoxLayout(this); + child->reparent(this,TQPoint(),true); // make top of stack begin = new StackElement; begin->w = child; @@ -45,7 +45,7 @@ namespace kt } } - void ExpandableWidget::expand(QWidget* w,Position pos) + void ExpandableWidget::expand(TQWidget* w,Position pos) { // create new element StackElement* se = new StackElement; @@ -53,45 +53,45 @@ namespace kt se->pos = pos; se->next = begin; - // remove old top from layout + // remove old top from tqlayout top_layout->remove(begin->w); // create new toplevel splitter Qt::Orientation orientation = (pos == RIGHT || pos == LEFT) ? Qt::Horizontal : Qt::Vertical; - QSplitter* s = new QSplitter(orientation,this);; + TQSplitter* s = new TQSplitter(orientation,this);; se->s = s; // reparent w and the bottom widget to s - w->reparent(s,QPoint(),false); + w->reparent(s,TQPoint(),false); if (begin->s) - begin->s->reparent(s,QPoint(),false); + begin->s->reparent(s,TQPoint(),false); else - begin->w->reparent(s,QPoint(),false); + begin->w->reparent(s,TQPoint(),false); // add w and the bottom widget to s if (pos == RIGHT || pos == ABOVE) { s->moveToFirst(w); - s->setResizeMode(w,QSplitter::KeepSize); + s->setResizeMode(w,TQSplitter::KeepSize); s->moveToLast(begin->s ? begin->s : begin->w); } else { s->moveToFirst(begin->s ? begin->s : begin->w); s->moveToLast(w); - s->setResizeMode(w,QSplitter::KeepSize); + s->setResizeMode(w,TQSplitter::KeepSize); } // make se new top of stack begin = se; - // add toplevel splitter to layout + // add toplevel splitter to tqlayout top_layout->add(s); // show s s->show(); } - void ExpandableWidget::remove(QWidget* w) + void ExpandableWidget::remove(TQWidget* w) { // find the correct stackelement StackElement* se = begin; @@ -111,21 +111,21 @@ namespace kt // we need to remove the first top_layout->remove(se->s); // reparent current top to 0 - se->w->reparent(0,QPoint(),false); - se->s->reparent(0,QPoint(),false); + se->w->reparent(0,TQPoint(),false); + se->s->reparent(0,TQPoint(),false); // set new top begin = se->next; if (begin->s) { - begin->s->reparent(this,QPoint(),false); + begin->s->reparent(this,TQPoint(),false); top_layout->add(begin->s); begin->s->show(); } else { - begin->w->reparent(this,QPoint(),false); + begin->w->reparent(this,TQPoint(),false); top_layout->add(begin->w); begin->w->show(); } @@ -143,29 +143,29 @@ namespace kt prev->next = next; // reparent se to 0 - se->s->reparent(0,QPoint(),false); - se->w->reparent(0,QPoint(),false); + se->s->reparent(0,TQPoint(),false); + se->w->reparent(0,TQPoint(),false); // reparent se->next to prev if (next->s) - next->s->reparent(prev->s,QPoint(),false); + next->s->reparent(prev->s,TQPoint(),false); else - next->w->reparent(prev->s,QPoint(),false); + next->w->reparent(prev->s,TQPoint(),false); // update prev's splitter if (prev->pos == RIGHT || prev->pos == ABOVE) { prev->s->moveToFirst(prev->w); - prev->s->setResizeMode(prev->w,QSplitter::KeepSize); + prev->s->setResizeMode(prev->w,TQSplitter::KeepSize); prev->s->moveToLast(next->s ? next->s : next->w); - prev->s->setResizeMode(next->s ? next->s : next->w,QSplitter::KeepSize); + prev->s->setResizeMode(next->s ? next->s : next->w,TQSplitter::KeepSize); } else { prev->s->moveToFirst(next->s ? next->s : next->w); - prev->s->setResizeMode(next->s ? next->s : next->w,QSplitter::KeepSize); + prev->s->setResizeMode(next->s ? next->s : next->w,TQSplitter::KeepSize); prev->s->moveToLast(prev->w); - prev->s->setResizeMode(prev->w,QSplitter::KeepSize); + prev->s->setResizeMode(prev->w,TQSplitter::KeepSize); } // delete se and splitter diff --git a/libktorrent/expandablewidget.h b/libktorrent/expandablewidget.h index 823ce5f..070f24f 100644 --- a/libktorrent/expandablewidget.h +++ b/libktorrent/expandablewidget.h @@ -20,12 +20,12 @@ #ifndef KTEXPANDABLEWIDGET_H #define KTEXPANDABLEWIDGET_H -#include <qwidget.h> -#include <qptrlist.h> +#include <tqwidget.h> +#include <tqptrlist.h> #include <interfaces/guiinterface.h> -class QSplitter; -class QHBoxLayout; +class TQSplitter; +class TQHBoxLayout; namespace kt { @@ -40,39 +40,40 @@ namespace kt * one child widget. It allows to add more widgets separating the new widget * and everything which was previously in the container by a separator. */ - class ExpandableWidget : public QWidget + class ExpandableWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: /** * Constructor, the first child must be provided. * @param child The first child - * @param parent The parent + * @param tqparent The tqparent * @param name The name */ - ExpandableWidget(QWidget* child,QWidget *parent = 0, const char *name = 0); + ExpandableWidget(TQWidget* child,TQWidget *tqparent = 0, const char *name = 0); virtual ~ExpandableWidget(); /** - * Expand the widget. This will ensure the proper parent child relations. + * Expand the widget. This will ensure the proper tqparent child relations. * @param w The widget * @param pos It's position relative to the current widget */ - void expand(QWidget* w,Position pos); + void expand(TQWidget* w,Position pos); /** - * Remove a widget. This will ensure the proper parent child relations. - * The widget w will become parentless. Note the first child will never be removed. + * Remove a widget. This will ensure the proper tqparent child relations. + * The widget w will become tqparentless. Note the first child will never be removed. * @param w The widget */ - void remove(QWidget* w); + void remove(TQWidget* w); private: struct StackElement { - QWidget* w; - QSplitter* s; + TQWidget* w; + TQSplitter* s; Position pos; StackElement* next; @@ -81,7 +82,7 @@ namespace kt }; StackElement* begin; - QHBoxLayout* top_layout; + TQHBoxLayout* top_layout; }; } diff --git a/libktorrent/functions.cpp b/libktorrent/functions.cpp index 3bc4f88..2bc76eb 100644 --- a/libktorrent/functions.cpp +++ b/libktorrent/functions.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdatetime.h> +#include <tqdatetime.h> #include <klocale.h> #include <kglobal.h> #include <kstandarddirs.h> @@ -28,9 +28,9 @@ using namespace bt; namespace kt { - QString DataDir() + TQString DataDir() { - QString str = KGlobal::dirs()->saveLocation("data","ktorrent"); + TQString str = KGlobal::dirs()->saveLocation("data","ktorrent"); if (!str.endsWith(bt::DirSeparator())) return str + bt::DirSeparator(); else diff --git a/libktorrent/functions.h b/libktorrent/functions.h index 02f7870..f6bd8dd 100644 --- a/libktorrent/functions.h +++ b/libktorrent/functions.h @@ -20,7 +20,7 @@ #ifndef FUNCTIONS_H #define FUNCTIONS_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace kt @@ -29,7 +29,7 @@ namespace kt * Will return the data directory * @return ~/.kde/share/apps/ktorrent/ */ - QString DataDir(); + TQString DataDir(); } #endif diff --git a/libktorrent/interfaces/chunkdownloadinterface.h b/libktorrent/interfaces/chunkdownloadinterface.h index 161a534..0945006 100644 --- a/libktorrent/interfaces/chunkdownloadinterface.h +++ b/libktorrent/interfaces/chunkdownloadinterface.h @@ -20,7 +20,7 @@ #ifndef KTCHUNKDOWNLOADINTERFACE_H #define KTCHUNKDOWNLOADINTERFACE_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace kt @@ -41,7 +41,7 @@ namespace kt struct Stats { /// The PeerID of the current downloader - QString current_peer_id; + TQString current_peer_id; /// The current download speed bt::Uint32 download_speed; /// The index of the chunk diff --git a/libktorrent/interfaces/coreinterface.h b/libktorrent/interfaces/coreinterface.h index 613ba8e..9ca2ae1 100644 --- a/libktorrent/interfaces/coreinterface.h +++ b/libktorrent/interfaces/coreinterface.h @@ -21,7 +21,7 @@ #define KTCOREINTERFACE_H #include <kurl.h> -#include <qobject.h> +#include <tqobject.h> #include <util/constants.h> #include <torrent/queuemanager.h> @@ -50,9 +50,10 @@ namespace kt * the applications core, the core is responsible for managing all * TorrentControl objects. */ - class CoreInterface : public QObject + class CoreInterface : public TQObject { Q_OBJECT + TQ_OBJECT public: CoreInterface(); virtual ~CoreInterface(); @@ -83,7 +84,7 @@ namespace kt * and leaves everything where it supposed to be. * @param new_dir The new directory */ - virtual bool changeDataDir(const QString & new_dir) = 0; + virtual bool changeDataDir(const TQString & new_dir) = 0; /** * Start all, takes into account the maximum number of downloads. @@ -141,7 +142,7 @@ namespace kt * @param savedir Dir to save the data * @param silently Wether or not to do this silently */ - virtual bool load(const QString & file,const QString & savedir,bool silently) = 0; + virtual bool load(const TQString & file,const TQString & savedir,bool silently) = 0; /** * Load a torrent file. Pops up an error dialog @@ -171,31 +172,31 @@ namespace kt /** * Inserts IP range to be blocked into IPBlocklist - * @param ip QString reference to single IP or IP range. For example: + * @param ip TQString reference to single IP or IP range. For example: * single - 127.0.0.5 * range - 127.0.*.* **/ - virtual void addBlockedIP(QString& ip) = 0; + virtual void addBlockedIP(TQString& ip) = 0; /** * Removes IP range from IPBlocklist - * @param ip QString reference to single IP or IP range. For example: + * @param ip TQString reference to single IP or IP range. For example: * single - 127.0.0.5 * range - 127.0.*.* **/ - virtual void removeBlockedIP(QString& ip) = 0; + virtual void removeBlockedIP(TQString& ip) = 0; /** * Find the next free torX dir. * @return Path to the dir (including the torX part) */ - virtual QString findNewTorrentDir() const = 0; + virtual TQString findNewTorrentDir() const = 0; /** * Load an existing torrent, which has already a properly set up torX dir. * @param tor_dir The torX dir */ - virtual void loadExistingTorrent(const QString & tor_dir) = 0; + virtual void loadExistingTorrent(const TQString & tor_dir) = 0; /** * Returns maximum allowed download speed. @@ -250,7 +251,7 @@ namespace kt * @param tc TorrentInterface * @param msg Error message */ - void torrentStoppedByError(kt::TorrentInterface* tc, QString msg); + void torrentStoppedByError(kt::TorrentInterface* tc, TQString msg); }; } diff --git a/libktorrent/interfaces/exitoperation.cpp b/libktorrent/interfaces/exitoperation.cpp index 8eedb7a..08a39df 100644 --- a/libktorrent/interfaces/exitoperation.cpp +++ b/libktorrent/interfaces/exitoperation.cpp @@ -31,7 +31,7 @@ namespace kt ExitJobOperation::ExitJobOperation(KIO::Job* j) { - connect(j,SIGNAL(result(KIO::Job*)),this,SLOT(onResult( KIO::Job* ))); + connect(j,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(onResult( KIO::Job* ))); } ExitJobOperation::~ExitJobOperation() diff --git a/libktorrent/interfaces/exitoperation.h b/libktorrent/interfaces/exitoperation.h index edaa2fa..4cad283 100644 --- a/libktorrent/interfaces/exitoperation.h +++ b/libktorrent/interfaces/exitoperation.h @@ -20,7 +20,7 @@ #ifndef KTEXITOPERATION_H #define KTEXITOPERATION_H -#include <qobject.h> +#include <tqobject.h> #include <kio/job.h> namespace kt @@ -35,9 +35,10 @@ namespace kt * ExitOperation's can be used in combination with a WaitJob, to wait for a certain amount of time * to give serveral ExitOperation's the time time to finish up. */ - class ExitOperation : public QObject + class ExitOperation : public TQObject { Q_OBJECT + TQ_OBJECT public: ExitOperation(); virtual ~ExitOperation(); @@ -54,6 +55,7 @@ namespace kt class ExitJobOperation : public ExitOperation { Q_OBJECT + TQ_OBJECT public: ExitJobOperation(KIO::Job* j); virtual ~ExitJobOperation(); diff --git a/libktorrent/interfaces/filetreediritem.cpp b/libktorrent/interfaces/filetreediritem.cpp index b294015..54c1953 100644 --- a/libktorrent/interfaces/filetreediritem.cpp +++ b/libktorrent/interfaces/filetreediritem.cpp @@ -34,10 +34,10 @@ using namespace bt; namespace kt { - FileTreeDirItem::FileTreeDirItem(KListView* klv,const QString & name,FileTreeRootListener* rl) - : QCheckListItem(klv,QString::null,QCheckListItem::CheckBox),name(name),root_listener(rl) + FileTreeDirItem::FileTreeDirItem(KListView* klv,const TQString & name,FileTreeRootListener* rl) + : TQCheckListItem(klv,TQString(),TQCheckListItem::CheckBox),name(name),root_listener(rl) { - parent = 0; + tqparent = 0; size = 0; setPixmap(0,KGlobal::iconLoader()->loadIcon("folder",KIcon::Small)); setText(0,name); @@ -48,9 +48,9 @@ namespace kt manual_change = false; } - FileTreeDirItem::FileTreeDirItem(FileTreeDirItem* parent,const QString & name) - : QCheckListItem(parent,QString::null,QCheckListItem::CheckBox), - name(name),parent(parent) + FileTreeDirItem::FileTreeDirItem(FileTreeDirItem* tqparent,const TQString & name) + : TQCheckListItem(tqparent,TQString(),TQCheckListItem::CheckBox), + name(name),tqparent(tqparent) { size = 0; setPixmap(0,KGlobal::iconLoader()->loadIcon("folder",KIcon::Small)); @@ -66,19 +66,19 @@ namespace kt { } - void FileTreeDirItem::insert(const QString & path,kt::TorrentFileInterface & file) + void FileTreeDirItem::insert(const TQString & path,kt::TorrentFileInterface & file) { size += file.getSize(); setText(1,BytesToString(size)); - int p = path.find(bt::DirSeparator()); + int p = path.tqfind(bt::DirSeparator()); if (p == -1) { - children.insert(path,newFileTreeItem(path,file)); + tqchildren.insert(path,newFileTreeItem(path,file)); } else { - QString subdir = path.left(p); - FileTreeDirItem* sd = subdirs.find(subdir); + TQString subdir = path.left(p); + FileTreeDirItem* sd = subdirs.tqfind(subdir); if (!sd) { sd = newFileTreeDirItem(subdir); @@ -98,15 +98,15 @@ namespace kt manual_change = false; } // first set all the child items - bt::PtrMap<QString,FileTreeItem>::iterator i = children.begin(); - while (i != children.end()) + bt::PtrMap<TQString,FileTreeItem>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { i->second->setChecked(on,keep_data); i++; } // then recursivly move on to subdirs - bt::PtrMap<QString,FileTreeDirItem>::iterator j = subdirs.begin(); + bt::PtrMap<TQString,FileTreeDirItem>::iterator j = subdirs.begin(); while (j != subdirs.end()) { j->second->setAllChecked(on,keep_data); @@ -118,8 +118,8 @@ namespace kt void FileTreeDirItem::invertChecked() { // first set all the child items - bt::PtrMap<QString,FileTreeItem>::iterator i = children.begin(); - while (i != children.end()) + bt::PtrMap<TQString,FileTreeItem>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { FileTreeItem* item = i->second; item->setChecked(!item->isOn()); @@ -127,7 +127,7 @@ namespace kt } // then recursivly move on to subdirs - bt::PtrMap<QString,FileTreeDirItem>::iterator j = subdirs.begin(); + bt::PtrMap<TQString,FileTreeDirItem>::iterator j = subdirs.begin(); while (j != subdirs.end()) { j->second->invertChecked(); @@ -161,8 +161,8 @@ namespace kt return; } } - if (parent) - parent->childStateChange(); + if (tqparent) + tqparent->childStateChange(); } setText(2,on ? i18n("Yes") : i18n("No")); } @@ -171,8 +171,8 @@ namespace kt { Uint64 tot = 0; // first check all the child items - bt::PtrMap<QString,FileTreeItem>::const_iterator i = children.begin(); - while (i != children.end()) + bt::PtrMap<TQString,FileTreeItem>::const_iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { const FileTreeItem* item = i->second; tot += item->bytesToDownload(); @@ -180,7 +180,7 @@ namespace kt } // then recursivly move on to subdirs - bt::PtrMap<QString,FileTreeDirItem>::const_iterator j = subdirs.begin(); + bt::PtrMap<TQString,FileTreeDirItem>::const_iterator j = subdirs.begin(); while (j != subdirs.end()) { tot += j->second->bytesToDownload(); @@ -192,8 +192,8 @@ namespace kt bool FileTreeDirItem::allChildrenOn() { // first check all the child items - bt::PtrMap<QString,FileTreeItem>::iterator i = children.begin(); - while (i != children.end()) + bt::PtrMap<TQString,FileTreeItem>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { FileTreeItem* item = i->second; if (!item->isOn()) @@ -202,7 +202,7 @@ namespace kt } // then recursivly move on to subdirs - bt::PtrMap<QString,FileTreeDirItem>::iterator j = subdirs.begin(); + bt::PtrMap<TQString,FileTreeDirItem>::iterator j = subdirs.begin(); while (j != subdirs.end()) { if (!j->second->allChildrenOn()) @@ -214,19 +214,19 @@ namespace kt void FileTreeDirItem::childStateChange() { - // only set this dir on if all children are on + // only set this dir on if all tqchildren are on manual_change = true; setOn(allChildrenOn()); manual_change = false; - if (parent) - parent->childStateChange(); + if (tqparent) + tqparent->childStateChange(); else if (root_listener) root_listener->treeItemChanged(); } - int FileTreeDirItem::compare(QListViewItem* i, int col, bool ascending) const + int FileTreeDirItem::compare(TQListViewItem* i, int col, bool ascending) const { if (col == 1) { @@ -238,18 +238,18 @@ namespace kt } else { - //return QCheckListItem::compare(i, col, ascending); + //return TQCheckListItem::compare(i, col, ascending); // case insensitive comparison - return QString::compare(text(col).lower(),i->text(col).lower()); + return TQString::compare(text(col).lower(),i->text(col).lower()); } } - TorrentFileInterface & FileTreeDirItem::findTorrentFile(QListViewItem* item) + TorrentFileInterface & FileTreeDirItem::findTorrentFile(TQListViewItem* item) { // first check all the child items TorrentFileInterface & nullfile = (TorrentFileInterface &)TorrentFile::null; - bt::PtrMap<QString,FileTreeItem>::iterator i = children.begin(); - while (i != children.end()) + bt::PtrMap<TQString,FileTreeItem>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { FileTreeItem* file = i->second; if (file == (FileTreeItem*)item) @@ -258,7 +258,7 @@ namespace kt } // then recursivly move on to subdirs - bt::PtrMap<QString,FileTreeDirItem>::iterator j = subdirs.begin(); + bt::PtrMap<TQString,FileTreeDirItem>::iterator j = subdirs.begin(); while (j != subdirs.end()) { TorrentFileInterface & thefile = j->second->findTorrentFile(item); @@ -269,12 +269,12 @@ namespace kt return nullfile; } - FileTreeItem* FileTreeDirItem::newFileTreeItem(const QString & name,TorrentFileInterface & file) + FileTreeItem* FileTreeDirItem::newFileTreeItem(const TQString & name,TorrentFileInterface & file) { return new FileTreeItem(this,name,file); } - FileTreeDirItem* FileTreeDirItem::newFileTreeDirItem(const QString & subdir) + FileTreeDirItem* FileTreeDirItem::newFileTreeDirItem(const TQString & subdir) { return new FileTreeDirItem(this,subdir); } @@ -284,12 +284,12 @@ namespace kt return bt::THROW_AWAY_DATA; } - QString FileTreeDirItem::getPath() const + TQString FileTreeDirItem::getPath() const { - if (!parent) + if (!tqparent) return bt::DirSeparator(); else - return parent->getPath() + name + bt::DirSeparator(); + return tqparent->getPath() + name + bt::DirSeparator(); } } diff --git a/libktorrent/interfaces/filetreediritem.h b/libktorrent/interfaces/filetreediritem.h index 00650f2..9afdbd1 100644 --- a/libktorrent/interfaces/filetreediritem.h +++ b/libktorrent/interfaces/filetreediritem.h @@ -44,41 +44,41 @@ namespace kt * * Directory item the file tree showing the files in a multifile torrent */ - class FileTreeDirItem : public QCheckListItem + class FileTreeDirItem : public TQCheckListItem { protected: - QString name; + TQString name; Uint64 size; - bt::PtrMap<QString,FileTreeItem> children; - bt::PtrMap<QString,FileTreeDirItem> subdirs; - FileTreeDirItem* parent; + bt::PtrMap<TQString,FileTreeItem> tqchildren; + bt::PtrMap<TQString,FileTreeDirItem> subdirs; + FileTreeDirItem* tqparent; bool manual_change; FileTreeRootListener* root_listener; public: - FileTreeDirItem(KListView* klv,const QString & name,FileTreeRootListener* rl = 0); - FileTreeDirItem(FileTreeDirItem* parent,const QString & name); + FileTreeDirItem(KListView* klv,const TQString & name,FileTreeRootListener* rl = 0); + FileTreeDirItem(FileTreeDirItem* tqparent,const TQString & name); virtual ~FileTreeDirItem(); /// Get the path of the directory (if this is the root directory / will be returned) - QString getPath() const; + TQString getPath() const; /** * Recursively insert a TorrentFileInterface. * @param path Path of file * @param file File itself */ - void insert(const QString & path,kt::TorrentFileInterface & file); + void insert(const TQString & path,kt::TorrentFileInterface & file); /** * Recursivly walk the tree to find the TorrentFile which - * is shown by a QListViewItem (which should be an FileTreeItem). + * is shown by a TQListViewItem (which should be an FileTreeItem). * If item can't be found or item is an FileTreeDirItem, a reference to * TorrentFile::null will be returned. In which case the isNull() function * of TorrentFile will return true - * @param item Pointer to the QListViewItem + * @param item Pointer to the TQListViewItem * @return A reference to the TorrentFile */ - kt::TorrentFileInterface & findTorrentFile(QListViewItem* item); + kt::TorrentFileInterface & findTorrentFile(TQListViewItem* item); /** * Set all items checked or not. @@ -93,11 +93,11 @@ namespace kt void invertChecked(); /** - * Called by the child to notify the parent it's state has changed. + * Called by the child to notify the tqparent it's state has changed. */ void childStateChange(); - FileTreeDirItem* getParent() {return parent;} + FileTreeDirItem* getParent() {return tqparent;} /// Recusively get the total number of bytes to download Uint64 bytesToDownload() const; @@ -110,7 +110,7 @@ namespace kt * @param file The TorrentFileInterface * @return A newly created FileTreeItem */ - virtual FileTreeItem* newFileTreeItem(const QString & name, + virtual FileTreeItem* newFileTreeItem(const TQString & name, TorrentFileInterface & file); @@ -120,7 +120,7 @@ namespace kt * @param subdir The name of the subdir * @return A newly created FileTreeDirItem */ - virtual FileTreeDirItem* newFileTreeDirItem(const QString & subdir); + virtual FileTreeDirItem* newFileTreeDirItem(const TQString & subdir); /** @@ -131,7 +131,7 @@ namespace kt private: virtual void stateChange(bool on); - virtual int compare(QListViewItem* i, int col, bool ascending) const; + virtual int compare(TQListViewItem* i, int col, bool ascending) const; bool allChildrenOn(); }; diff --git a/libktorrent/interfaces/filetreeitem.cpp b/libktorrent/interfaces/filetreeitem.cpp index 32f265c..666c1a0 100644 --- a/libktorrent/interfaces/filetreeitem.cpp +++ b/libktorrent/interfaces/filetreeitem.cpp @@ -32,10 +32,10 @@ using namespace bt; namespace kt { - FileTreeItem::FileTreeItem(FileTreeDirItem* item,const QString & name,kt::TorrentFileInterface & file) - : QCheckListItem(item,QString::null,QCheckListItem::CheckBox),name(name),file(file) + FileTreeItem::FileTreeItem(FileTreeDirItem* item,const TQString & name,kt::TorrentFileInterface & file) + : TQCheckListItem(item,TQString(),TQCheckListItem::CheckBox),name(name),file(file) { - parent = item; + tqparent = item; manual_change = false; init(); } @@ -66,7 +66,7 @@ namespace kt } updatePriorityText(); - parent->childStateChange(); + tqparent->childStateChange(); } void FileTreeItem::updatePriorityText() @@ -141,10 +141,10 @@ namespace kt } updatePriorityText(); - parent->childStateChange(); + tqparent->childStateChange(); } - int FileTreeItem::compare(QListViewItem* i, int col, bool ascending) const + int FileTreeItem::compare(TQListViewItem* i, int col, bool ascending) const { if (col == 1) { @@ -157,8 +157,8 @@ namespace kt else { // lets sort case insensitive - return QString::compare(text(col).lower(),i->text(col).lower()); - // QCheckListItem::compare(i, col, ascending); + return TQString::compare(text(col).lower(),i->text(col).lower()); + // TQCheckListItem::compare(i, col, ascending); } } diff --git a/libktorrent/interfaces/filetreeitem.h b/libktorrent/interfaces/filetreeitem.h index 6f9f1b1..6d6ed79 100644 --- a/libktorrent/interfaces/filetreeitem.h +++ b/libktorrent/interfaces/filetreeitem.h @@ -37,25 +37,25 @@ namespace kt * @author Joris Guisson * * File item part of a tree which shows the files in a multifile torrent. - * This is derived from QCheckListItem, if the user checks or unchecks the box, + * This is derived from TQCheckListItem, if the user checks or unchecks the box, * wether or not to download a file will be changed. */ - class FileTreeItem : public QCheckListItem + class FileTreeItem : public TQCheckListItem { protected: - QString name; + TQString name; TorrentFileInterface & file; - FileTreeDirItem* parent; + FileTreeDirItem* tqparent; bool manual_change; public: /** - * Constructor, set the parent, name and file + * Constructor, set the tqparent, name and file * @param item Parent item * @param name Name of file * @param file THe TorrentFileInterface * @return */ - FileTreeItem(FileTreeDirItem* item,const QString & name,TorrentFileInterface & file); + FileTreeItem(FileTreeDirItem* item,const TQString & name,TorrentFileInterface & file); virtual ~FileTreeItem(); /// Get a reference to the TorrentFileInterface @@ -78,7 +78,7 @@ namespace kt void updatePriorityText(); protected: - virtual int compare(QListViewItem* i, int col, bool ascending) const; + virtual int compare(TQListViewItem* i, int col, bool ascending) const; /** * Subclasses should override this if they want to show a confirmation dialog. diff --git a/libktorrent/interfaces/functions.cpp b/libktorrent/interfaces/functions.cpp index 2c6286f..cade53a 100644 --- a/libktorrent/interfaces/functions.cpp +++ b/libktorrent/interfaces/functions.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdatetime.h> +#include <tqdatetime.h> #include <klocale.h> #include <kglobal.h> #include "functions.h" @@ -28,32 +28,32 @@ namespace kt { - QString BytesToString(Uint64 bytes,int precision) + TQString BytesToString(Uint64 bytes,int precision) { KLocale* loc = KGlobal::locale(); if (bytes >= 1024 * 1024 * 1024) - return i18n("%1 GB").arg(loc->formatNumber(bytes / TO_GIG,precision < 0 ? 2 : precision)); + return i18n("%1 GB").tqarg(loc->formatNumber(bytes / TO_GIG,precision < 0 ? 2 : precision)); else if (bytes >= 1024*1024) - return i18n("%1 MB").arg(loc->formatNumber(bytes / TO_MEG,precision < 0 ? 1 : precision)); + return i18n("%1 MB").tqarg(loc->formatNumber(bytes / TO_MEG,precision < 0 ? 1 : precision)); else if (bytes >= 1024) - return i18n("%1 KB").arg(loc->formatNumber(bytes / TO_KB,precision < 0 ? 1 : precision)); + return i18n("%1 KB").tqarg(loc->formatNumber(bytes / TO_KB,precision < 0 ? 1 : precision)); else - return i18n("%1 B").arg(bytes); + return i18n("%1 B").tqarg(bytes); } - QString KBytesPerSecToString(double speed,int precision) + TQString KBytesPerSecToString(double speed,int precision) { KLocale* loc = KGlobal::locale(); - return i18n("%1 KB/s").arg(loc->formatNumber(speed,precision)); + return i18n("%1 KB/s").tqarg(loc->formatNumber(speed,precision)); } - QString DurationToString(Uint32 nsecs) + TQString DurationToString(Uint32 nsecs) { KLocale* loc = KGlobal::locale(); - QTime t; + TQTime t; int ndays = nsecs / 86400; t = t.addSecs(nsecs % 86400); - QString s = loc->formatTime(t,true,true); + TQString s = loc->formatTime(t,true,true); if (ndays > 0) s = i18n("1 day ","%n days ",ndays) + s; diff --git a/libktorrent/interfaces/functions.h b/libktorrent/interfaces/functions.h index 1bf7178..4ffe9a9 100644 --- a/libktorrent/interfaces/functions.h +++ b/libktorrent/interfaces/functions.h @@ -20,7 +20,7 @@ #ifndef FUNCTIONS_H #define FUNCTIONS_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace kt @@ -29,9 +29,9 @@ namespace kt const double TO_MEG = (1024.0 * 1024.0); const double TO_GIG = (1024.0 * 1024.0 * 1024.0); - QString BytesToString(bt::Uint64 bytes,int precision = -1); - QString KBytesPerSecToString(double speed,int precision = 1); - QString DurationToString(bt::Uint32 nsecs); + TQString BytesToString(bt::Uint64 bytes,int precision = -1); + TQString KBytesPerSecToString(double speed,int precision = 1); + TQString DurationToString(bt::Uint32 nsecs); template<class T> int CompareVal(T a,T b) { diff --git a/libktorrent/interfaces/guiinterface.cpp b/libktorrent/interfaces/guiinterface.cpp index 8a87d90..635415e 100644 --- a/libktorrent/interfaces/guiinterface.cpp +++ b/libktorrent/interfaces/guiinterface.cpp @@ -33,7 +33,7 @@ namespace kt void GUIInterface::notifyViewListeners(TorrentInterface* tc) { - QPtrList<ViewListener>::iterator i = listeners.begin(); + TQPtrList<ViewListener>::iterator i = listeners.begin(); while (i != listeners.end()) { ViewListener* vl = *i; diff --git a/libktorrent/interfaces/guiinterface.h b/libktorrent/interfaces/guiinterface.h index a263bb6..6fbab7e 100644 --- a/libktorrent/interfaces/guiinterface.h +++ b/libktorrent/interfaces/guiinterface.h @@ -20,11 +20,11 @@ #ifndef KTGUIINTERFACE_H #define KTGUIINTERFACE_H -#include <qptrlist.h> +#include <tqptrlist.h> -class QWidget; -class QIconSet; -class QString; +class TQWidget; +class TQIconSet; +class TQString; class KToolBar; class KProgress; @@ -65,10 +65,10 @@ namespace kt { public: /// By default all tabs can be closed, but this can be overridden - virtual bool closeAllowed(QWidget* ) {return true;} + virtual bool closeAllowed(TQWidget* ) {return true;} /// THe close button was pressed for this tab, please remove it from the GUI - virtual void tabCloseRequest(kt::GUIInterface* gui,QWidget* tab) = 0; + virtual void tabCloseRequest(kt::GUIInterface* gui,TQWidget* tab) = 0; }; /** @@ -79,7 +79,7 @@ namespace kt */ class GUIInterface { - QPtrList<ViewListener> listeners; + TQPtrList<ViewListener> listeners; public: GUIInterface(); virtual ~GUIInterface(); @@ -104,15 +104,15 @@ namespace kt * @param caption Text on the tab * @param ctl For closeable tabs this pointer should be set */ - virtual void addTabPage(QWidget* page,const QIconSet & icon, - const QString & caption,CloseTabListener* ctl = 0) = 0; + virtual void addTabPage(TQWidget* page,const TQIconSet & icon, + const TQString & caption,CloseTabListener* ctl = 0) = 0; /** * Remove a tab page, does nothing if the page * isn't added. Does not delete the widget. * @param page The page */ - virtual void removeTabPage(QWidget* page) = 0; + virtual void removeTabPage(TQWidget* page) = 0; /** * Add a page to the preference dialog. @@ -131,7 +131,7 @@ namespace kt * Change the statusbar message. * @param msg The new message */ - virtual void changeStatusbar(const QString& msg) = 0; + virtual void changeStatusbar(const TQString& msg) = 0; /** * Merge the GUI of a plugin. @@ -151,14 +151,14 @@ namespace kt * @param w The widget * @param pos How the widget will be positioned against the already present widgets */ - virtual void addWidgetInView(QWidget* w,Position pos) = 0; + virtual void addWidgetInView(TQWidget* w,Position pos) = 0; /** * Remove a widget added with addWidgetInView. * The widget will be reparented to 0. * @param w The widget */ - virtual void removeWidgetFromView(QWidget* w) = 0; + virtual void removeWidgetFromView(TQWidget* w) = 0; /** * Add a widget below the view. @@ -166,13 +166,13 @@ namespace kt * @param icon Name of icon to use * @param caption The caption to use */ - virtual void addWidgetBelowView(QWidget* w,const QString & icon,const QString & caption) = 0; + virtual void addWidgetBelowView(TQWidget* w,const TQString & icon,const TQString & caption) = 0; /** * Remove a widget, which was added below the view. * @param w The widget */ - virtual void removeWidgetBelowView(QWidget* w) = 0; + virtual void removeWidgetBelowView(TQWidget* w) = 0; enum ToolDock { @@ -188,13 +188,13 @@ namespace kt * @param caption The caption to use * @param dock Where to dock the widget */ - virtual void addToolWidget(QWidget* w,const QString & icon,const QString & caption,ToolDock dock) = 0; + virtual void addToolWidget(TQWidget* w,const TQString & icon,const TQString & caption,ToolDock dock) = 0; /** * Remove a tool widget. * @param w The widget */ - virtual void removeToolWidget(QWidget* w) = 0; + virtual void removeToolWidget(TQWidget* w) = 0; /// Get the current torrent. virtual const TorrentInterface* getCurrentTorrent() const = 0; diff --git a/libktorrent/interfaces/ipblockinginterface.h b/libktorrent/interfaces/ipblockinginterface.h index 4054af9..236a549 100644 --- a/libktorrent/interfaces/ipblockinginterface.h +++ b/libktorrent/interfaces/ipblockinginterface.h @@ -22,7 +22,7 @@ #ifndef IPBLOCKINGINTERFACE_H #define IPBLOCKINGINTERFACE_H -class QString; +class TQString; namespace kt { @@ -41,7 +41,7 @@ namespace kt * @return TRUE if IP should be blocked. FALSE otherwise * @arg ip String representation of IP address. */ - virtual bool isBlockedIP(const QString& ip) = 0; + virtual bool isBlockedIP(const TQString& ip) = 0; }; } diff --git a/libktorrent/interfaces/logmonitorinterface.h b/libktorrent/interfaces/logmonitorinterface.h index 4fccb0e..54e1a21 100644 --- a/libktorrent/interfaces/logmonitorinterface.h +++ b/libktorrent/interfaces/logmonitorinterface.h @@ -20,7 +20,7 @@ #ifndef KTLOGMONITORINTERFACE_H #define KTLOGMONITORINTERFACE_H -class QString; +class TQString; namespace kt { @@ -42,7 +42,7 @@ namespace kt * A line was written to the log file. * @param line The line */ - virtual void message(const QString & line, unsigned int arg) = 0; + virtual void message(const TQString & line, unsigned int arg) = 0; }; } diff --git a/libktorrent/interfaces/peerinterface.h b/libktorrent/interfaces/peerinterface.h index f77d0f8..d5424ac 100644 --- a/libktorrent/interfaces/peerinterface.h +++ b/libktorrent/interfaces/peerinterface.h @@ -20,7 +20,7 @@ #ifndef KTPEERINTERFACE_H #define KTPEERINTERFACE_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace kt { @@ -41,9 +41,9 @@ namespace kt struct Stats { /// IP address of peer (dotted notation) - QString ip_address; + TQString ip_address; /// The client (Azureus, BitComet, ...) - QString client; + TQString client; /// Download rate (bytes/s) bt::Uint32 download_rate; /// Upload rate (bytes/s) diff --git a/libktorrent/interfaces/peersource.cpp b/libktorrent/interfaces/peersource.cpp index 18368b1..6a1eb87 100644 --- a/libktorrent/interfaces/peersource.cpp +++ b/libktorrent/interfaces/peersource.cpp @@ -38,7 +38,7 @@ namespace kt void PeerSource::aboutToBeDestroyed() {} - void PeerSource::addPeer(const QString & ip,bt::Uint16 port,bool local) + void PeerSource::addPeer(const TQString & ip,bt::Uint16 port,bool local) { PotentialPeer pp; pp.ip = ip; diff --git a/libktorrent/interfaces/peersource.h b/libktorrent/interfaces/peersource.h index 9c2b589..c7aa73d 100644 --- a/libktorrent/interfaces/peersource.h +++ b/libktorrent/interfaces/peersource.h @@ -20,8 +20,8 @@ #ifndef KTPEERSOURCE_H #define KTPEERSOURCE_H -#include <qobject.h> -#include <qvaluelist.h> +#include <tqobject.h> +#include <tqvaluelist.h> #include <util/constants.h> namespace bt @@ -33,7 +33,7 @@ namespace kt { struct PotentialPeer { - QString ip; + TQString ip; bt::Uint16 port; bool local; @@ -47,9 +47,10 @@ namespace kt * for torrents. PeerSources should work independently and should emit a signal when they * have peers ready. */ - class PeerSource : public QObject + class PeerSource : public TQObject { Q_OBJECT + TQ_OBJECT public: PeerSource(); virtual ~PeerSource(); @@ -70,7 +71,7 @@ namespace kt * @param port The port * @param local Wether or not the peer is on the local network */ - void addPeer(const QString & ip,bt::Uint16 port,bool local = false); + void addPeer(const TQString & ip,bt::Uint16 port,bool local = false); public slots: /** @@ -110,7 +111,7 @@ namespace kt private: /// List to keep the potential peers in. - QValueList<PotentialPeer> peers; + TQValueList<PotentialPeer> peers; }; } diff --git a/libktorrent/interfaces/plugin.cpp b/libktorrent/interfaces/plugin.cpp index 6354985..50903d7 100644 --- a/libktorrent/interfaces/plugin.cpp +++ b/libktorrent/interfaces/plugin.cpp @@ -22,11 +22,11 @@ namespace kt { - Plugin::Plugin(QObject *parent, const char* qt_name,const QStringList & /*args*/, - const QString & name,const QString & gui_name,const QString & author, - const QString & email,const QString & description, - const QString & icon) - : KParts::Plugin(parent,qt_name), + Plugin::Plugin(TQObject *tqparent, const char* qt_name,const TQStringList & /*args*/, + const TQString & name,const TQString & gui_name,const TQString & author, + const TQString & email,const TQString & description, + const TQString & icon) + : KParts::Plugin(tqparent,qt_name), name(name),author(author),email(email),description(description),icon(icon),gui_name(gui_name) { core = 0; diff --git a/libktorrent/interfaces/plugin.h b/libktorrent/interfaces/plugin.h index ac43fbc..d147d46 100644 --- a/libktorrent/interfaces/plugin.h +++ b/libktorrent/interfaces/plugin.h @@ -48,6 +48,7 @@ namespace kt class Plugin : public KParts::Plugin { Q_OBJECT + TQ_OBJECT public: /** * Constructor, set the name of the plugin, the name and e-mail of the author and @@ -59,10 +60,10 @@ namespace kt * @param description What does the plugin do * @param icon Name of the plugin's icon */ - Plugin(QObject *parent,const char* qt_name,const QStringList & args, - const QString & name,const QString & gui_name,const QString & author, - const QString & email,const QString & description, - const QString & icon); + Plugin(TQObject *tqparent,const char* qt_name,const TQStringList & args, + const TQString & name,const TQString & gui_name,const TQString & author, + const TQString & email,const TQString & description, + const TQString & icon); virtual ~Plugin(); /** @@ -94,12 +95,12 @@ namespace kt */ virtual void shutdown(bt::WaitJob* job); - const QString & getName() const {return name;} - const QString & getAuthor() const {return author;} - const QString & getEMailAddress() const {return email;} - const QString & getDescription() const {return description;} - const QString & getIcon() const {return icon;} - const QString & getGuiName() const {return gui_name;} + const TQString & getName() const {return name;} + const TQString & getAuthor() const {return author;} + const TQString & getEMailAddress() const {return email;} + const TQString & getDescription() const {return description;} + const TQString & getIcon() const {return icon;} + const TQString & getGuiName() const {return gui_name;} /// Get a pointer to the CoreInterface CoreInterface* getCore() {return core;} @@ -131,15 +132,15 @@ namespace kt bool isLoaded() const {return loaded;} /// Check wether the plugin matches the version of KT - virtual bool versionCheck(const QString & version) const = 0; + virtual bool versionCheck(const TQString & version) const = 0; private: - QString name; - QString author; - QString email; - QString description; - QString icon; - QString gui_name; + TQString name; + TQString author; + TQString email; + TQString description; + TQString icon; + TQString gui_name; CoreInterface* core; GUIInterface* gui; bool loaded; diff --git a/libktorrent/interfaces/prefpageinterface.cpp b/libktorrent/interfaces/prefpageinterface.cpp index b905f07..ae6414f 100644 --- a/libktorrent/interfaces/prefpageinterface.cpp +++ b/libktorrent/interfaces/prefpageinterface.cpp @@ -20,8 +20,8 @@ #include "prefpageinterface.h" namespace kt { - PrefPageInterface::PrefPageInterface(const QString & name,const QString & header, - const QPixmap & pix) + PrefPageInterface::PrefPageInterface(const TQString & name,const TQString & header, + const TQPixmap & pix) : pixmap(pix),itemName(name),header(header) {} diff --git a/libktorrent/interfaces/prefpageinterface.h b/libktorrent/interfaces/prefpageinterface.h index 7d4d6dc..b27390e 100644 --- a/libktorrent/interfaces/prefpageinterface.h +++ b/libktorrent/interfaces/prefpageinterface.h @@ -20,9 +20,9 @@ #ifndef PREFPAGEINTERFACE_H #define PREFPAGEINTERFACE_H -#include <qpixmap.h> +#include <tqpixmap.h> -class QWidget; +class TQWidget; namespace kt { @@ -41,12 +41,12 @@ namespace kt * @param header * @param pix */ - PrefPageInterface(const QString & name,const QString & header,const QPixmap & pix); + PrefPageInterface(const TQString & name,const TQString & header,const TQPixmap & pix); virtual ~PrefPageInterface(); - const QString& getItemName() { return itemName; } - const QString& getHeader() { return header; } - const QPixmap& getPixmap() { return pixmap; } + const TQString& getItemName() { return itemName; } + const TQString& getHeader() { return header; } + const TQPixmap& getPixmap() { return pixmap; } /** * Apply the changes that have been made in the @@ -58,9 +58,9 @@ namespace kt /** * Create the actual widget. - * @param parent The parent of the widget + * @param tqparent The tqparent of the widget */ - virtual void createWidget(QWidget* parent)=0; + virtual void createWidget(TQWidget* tqparent)=0; /** * Update all data on the widget, gets called before @@ -73,11 +73,11 @@ namespace kt private: ///Used in IconList mode. You should prefer a pixmap with size 32x32 pixels - QPixmap pixmap; + TQPixmap pixmap; ///String used in the list or as tab item name. - QString itemName; + TQString itemName; ///Header text use in the list modes. Ignored in Tabbed mode. If empty, the item text is used instead. - QString header; + TQString header; }; } #endif diff --git a/libktorrent/interfaces/torrentfileinterface.cpp b/libktorrent/interfaces/torrentfileinterface.cpp index 4cca138..d49414e 100644 --- a/libktorrent/interfaces/torrentfileinterface.cpp +++ b/libktorrent/interfaces/torrentfileinterface.cpp @@ -22,7 +22,7 @@ namespace kt { - TorrentFileInterface::TorrentFileInterface(const QString & path,Uint64 size) + TorrentFileInterface::TorrentFileInterface(const TQString & path,Uint64 size) : path(path),size(size),first_chunk(0),last_chunk(0),num_chunks_downloaded(0), priority(NORMAL_PRIORITY),m_emitDlStatusChanged(true),preview(false) { diff --git a/libktorrent/interfaces/torrentfileinterface.h b/libktorrent/interfaces/torrentfileinterface.h index 430534c..bf30f1e 100644 --- a/libktorrent/interfaces/torrentfileinterface.h +++ b/libktorrent/interfaces/torrentfileinterface.h @@ -20,8 +20,8 @@ #ifndef KTTORRENTFILEINTERFACE_H #define KTTORRENTFILEINTERFACE_H -#include <qobject.h> -#include <qstring.h> +#include <tqobject.h> +#include <tqstring.h> #include <util/constants.h> namespace kt @@ -41,20 +41,21 @@ namespace kt * * This class is the interface for a file in a multifile torrent. */ - class TorrentFileInterface : public QObject + class TorrentFileInterface : public TQObject { Q_OBJECT + TQ_OBJECT public: /** * Constructor, set the path and size. * @param path The path * @param size The size */ - TorrentFileInterface(const QString & path,Uint64 size); + TorrentFileInterface(const TQString & path,Uint64 size); virtual ~TorrentFileInterface(); /// Get the path of the file - QString getPath() const {return path;} + TQString getPath() const {return path;} /// Get the size of the file Uint64 getSize() const {return size;} @@ -115,7 +116,7 @@ namespace kt void previewAvailable(bool available); protected: - QString path; + TQString path; Uint64 size; Uint32 first_chunk; Uint32 last_chunk; diff --git a/libktorrent/interfaces/torrentinterface.h b/libktorrent/interfaces/torrentinterface.h index 95d5766..14ad532 100644 --- a/libktorrent/interfaces/torrentinterface.h +++ b/libktorrent/interfaces/torrentinterface.h @@ -20,7 +20,7 @@ #ifndef KTTORRENTINTERFACE_H #define KTTORRENTINTERFACE_H -#include <qobject.h> +#include <tqobject.h> #include <util/constants.h> #include <interfaces/trackerslist.h> @@ -44,7 +44,7 @@ namespace kt class TorrentFileInterface; class PeerSource; - enum TorrentStatus + enum TorrenttqStatus { NOT_STARTED, SEEDING_COMPLETE, @@ -55,7 +55,7 @@ namespace kt STOPPED, ALLOCATING_DISKSPACE, ERROR, - QUEUED, + TQUEUED, CHECKING_DATA, NO_SPACE_LEFT }; @@ -67,7 +67,7 @@ namespace kt NOT_ENOUGH_DISKSPACE, MAX_SHARE_RATIO_REACHED, BUSY_WITH_DATA_CHECK, - QM_LIMITS_REACHED // Max seeds or downloads reached + TQM_LIMITS_REACHED // Max seeds or downloads reached }; enum AutoStopReason @@ -118,10 +118,10 @@ namespace kt Uint32 leechers_total; /// Num leechers connected to Uint32 leechers_connected_to; - /// Status of the download - TorrentStatus status; + /// tqStatus of the download + TorrenttqStatus status; /// The status of the tracker - QString trackerstatus; + TQString trackerstatus; /// The number of bytes downloaded in this session Uint64 session_bytes_downloaded; /// The number of bytes uploaded in this session @@ -131,9 +131,9 @@ namespace kt /// The number of bytes upload since the last started event, this gets sent to the tracker Uint64 trk_bytes_uploaded; /// Name of the torrent - QString torrent_name; + TQString torrent_name; /// Path of the dir or file where the data will get saved - QString output_path; + TQString output_path; /// See if we are running bool running; /// See if the torrent has been started @@ -161,7 +161,7 @@ namespace kt struct DHTNode { - QString ip; + TQString ip; bt::Uint16 port; }; @@ -179,9 +179,10 @@ namespace kt * This class is the interface for an object which controls the * up- and download of one torrent. */ - class TorrentInterface : public QObject + class TorrentInterface : public TQObject { Q_OBJECT + TQ_OBJECT public: TorrentInterface(); virtual ~TorrentInterface(); @@ -226,13 +227,13 @@ namespace kt * Get the torX directory of this torrent. Temporary stuff like the index * file get stored there. */ - virtual QString getTorDir() const = 0; + virtual TQString getTorDir() const = 0; /// Get the data directory of this torrent - virtual QString getDataDir() const = 0; + virtual TQString getDataDir() const = 0; /// Get a short error message - virtual QString getShortErrorMessage() const = 0; + virtual TQString getShortErrorMessage() const = 0; /** * Get the download running time of this torrent in seconds @@ -252,7 +253,7 @@ namespace kt * @param new_dir The new directory * @return true upon succes */ - virtual bool changeDataDir(const QString & new_dir) = 0; + virtual bool changeDataDir(const TQString & new_dir) = 0; /** * Change torrents output directory. If this fails we will fall back on the old directory. @@ -260,7 +261,7 @@ namespace kt * @param moveFiles Wheather to actually move the files or just change the directory without moving them. * @return true upon success. */ - virtual bool changeOutputDir(const QString& new_dir, bool moveFiles = true) = 0; + virtual bool changeOutputDir(const TQString& new_dir, bool moveFiles = true) = 0; /** * Roll back the previous changeDataDir call. @@ -329,7 +330,7 @@ namespace kt virtual float getMaxSeedTime() const = 0; /// Make a string of the current status - virtual QString statusToString() const = 0; + virtual TQString statusToString() const = 0; ///Is manual announce allowed? virtual bool announceAllowed() = 0; @@ -363,7 +364,7 @@ namespace kt * Test all files and see if they are not missing. * If so put them in a list */ - virtual bool hasMissingFiles(QStringList & sl) = 0; + virtual bool hasMissingFiles(TQStringList & sl) = 0; /** * Recreate missing files. @@ -394,7 +395,7 @@ namespace kt virtual bool overMaxSeedTime() = 0; /// Handle an error - virtual void handleError(const QString & err) = 0; + virtual void handleError(const TQString & err) = 0; /// Get the info_hash. virtual const bt::SHA1Hash & getInfoHash() const = 0; @@ -443,7 +444,7 @@ namespace kt * @param me The object who emitted the signal * @param msg Error message */ - void stoppedByError(kt::TorrentInterface* me, QString msg); + void stoppedByError(kt::TorrentInterface* me, TQString msg); /** * Emited when maximum share ratio for this torrent is changed diff --git a/libktorrent/kademlia/announcetask.cpp b/libktorrent/kademlia/announcetask.cpp index b7350a2..5e5b925 100644 --- a/libktorrent/kademlia/announcetask.cpp +++ b/libktorrent/kademlia/announcetask.cpp @@ -52,13 +52,13 @@ namespace dht if (gpr->containsNodes()) { - const QByteArray & n = gpr->getData(); + const TQByteArray & n = gpr->getData(); Uint32 nval = n.size() / 26; for (Uint32 i = 0;i < nval;i++) { // add node to todo list KBucketEntry e = UnpackBucketEntry(n,i*26); - if (!todo.contains(e) && !visited.contains(e) && + if (!todo.tqcontains(e) && !visited.tqcontains(e) && todo.count() < 100) { todo.append(e); @@ -78,7 +78,7 @@ namespace dht // add the peer who responded to the answered list, so we can do an announce KBucketEntry e(rsp->getOrigin(),rsp->getID()); - if (!answered.contains(KBucketEntryAndToken(e,gpr->getToken())) && !answered_visited.contains(e)) + if (!answered.tqcontains(KBucketEntryAndToken(e,gpr->getToken())) && !answered_visited.tqcontains(e)) { answered.append(KBucketEntryAndToken(e,gpr->getToken())); } @@ -101,7 +101,7 @@ namespace dht while (!answered.empty() && canDoRequest()) { KBucketEntryAndToken & e = answered.first(); - if (!answered_visited.contains(e)) + if (!answered_visited.tqcontains(e)) { AnnounceReq* anr = new AnnounceReq(node->getOurID(),info_hash,port,e.getToken()); anr->setOrigin(e.getAddress()); @@ -117,7 +117,7 @@ namespace dht { KBucketEntry e = todo.first(); // onLy send a findNode if we haven't allrready visited the node - if (!visited.contains(e)) + if (!visited.tqcontains(e)) { // send a findNode to the node GetPeersReq* gpr = new GetPeersReq(node->getOurID(),info_hash); diff --git a/libktorrent/kademlia/announcetask.h b/libktorrent/kademlia/announcetask.h index d6bfa7c..02dec19 100644 --- a/libktorrent/kademlia/announcetask.h +++ b/libktorrent/kademlia/announcetask.h @@ -62,8 +62,8 @@ namespace dht private: dht::Key info_hash; bt::Uint16 port; - QValueList<KBucketEntryAndToken> answered; // nodes which have answered with values - QValueList<KBucketEntry> answered_visited; // nodes which have answered with values which have been visited + TQValueList<KBucketEntryAndToken> answered; // nodes which have answered with values + TQValueList<KBucketEntry> answered_visited; // nodes which have answered with values which have been visited Database* db; DBItemList returned_items; diff --git a/libktorrent/kademlia/database.cpp b/libktorrent/kademlia/database.cpp index 447975f..c4b34fd 100644 --- a/libktorrent/kademlia/database.cpp +++ b/libktorrent/kademlia/database.cpp @@ -72,7 +72,7 @@ namespace dht void Database::store(const dht::Key & key,const DBItem & dbi) { - DBItemList* dbl = items.find(key); + DBItemList* dbl = items.tqfind(key); if (!dbl) { dbl = new DBItemList(); @@ -83,7 +83,7 @@ namespace dht void Database::sample(const dht::Key & key,DBItemList & tdbl,bt::Uint32 max_entries) { - DBItemList* dbl = items.find(key); + DBItemList* dbl = items.tqfind(key); if (!dbl) return; @@ -144,7 +144,7 @@ namespace dht bool Database::checkToken(const dht::Key & token,Uint32 ip,Uint16 port) { // the token must be in the map - if (!tokens.contains(token)) + if (!tokens.tqcontains(token)) { Out(SYS_DHT|LOG_DEBUG) << "Unknown token" << endl; return false; @@ -169,14 +169,14 @@ namespace dht return true; } - bool Database::contains(const dht::Key & key) const + bool Database::tqcontains(const dht::Key & key) const { - return items.find(key) != 0; + return items.tqfind(key) != 0; } void Database::insert(const dht::Key & key) { - DBItemList* dbl = items.find(key); + DBItemList* dbl = items.tqfind(key); if (!dbl) { dbl = new DBItemList(); diff --git a/libktorrent/kademlia/database.h b/libktorrent/kademlia/database.h index 94e6b3f..12e8373 100644 --- a/libktorrent/kademlia/database.h +++ b/libktorrent/kademlia/database.h @@ -20,8 +20,8 @@ #ifndef DHTDATABASE_H #define DHTDATABASE_H -#include <qmap.h> -#include <qvaluelist.h> +#include <tqmap.h> +#include <tqvaluelist.h> #include <util/ptrmap.h> #include <util/constants.h> #include <util/array.h> @@ -58,7 +58,7 @@ namespace dht DBItem & operator = (const DBItem & item); }; - typedef QValueList<DBItem> DBItemList; + typedef TQValueList<DBItem> DBItemList; /** * @author Joris Guisson @@ -68,7 +68,7 @@ namespace dht class Database { bt::PtrMap<dht::Key,DBItemList> items; - QMap<dht::Key,bt::TimeStamp> tokens; + TQMap<dht::Key,bt::TimeStamp> tokens; public: Database(); virtual ~Database(); @@ -118,7 +118,7 @@ namespace dht bool checkToken(const dht::Key & token,bt::Uint32 ip,bt::Uint16 port); /// Test wether or not the DB contains a key - bool contains(const dht::Key & key) const; + bool tqcontains(const dht::Key & key) const; /// Insert an empty item (only if it isn't already in the DB) void insert(const dht::Key & key); diff --git a/libktorrent/kademlia/dht.cpp b/libktorrent/kademlia/dht.cpp index 1d00ab8..3eecd7c 100644 --- a/libktorrent/kademlia/dht.cpp +++ b/libktorrent/kademlia/dht.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qmap.h> +#include <tqmap.h> #include <kresolver.h> #include <util/log.h> #include <util/array.h> @@ -46,7 +46,7 @@ namespace dht DHT::DHT() : node(0),srv(0),db(0),tman(0) { - connect(&update_timer,SIGNAL(timeout()),this,SLOT(update())); + connect(&update_timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(update())); } @@ -56,7 +56,7 @@ namespace dht stop(); } - void DHT::start(const QString & table,const QString & key_file,bt::Uint16 port) + void DHT::start(const TQString & table,const TQString & key_file,bt::Uint16 port) { if (running) return; @@ -133,7 +133,7 @@ namespace dht Uint32 rs = kns.requiredSpace(); // create the data - QByteArray nodes(rs); + TQByteArray nodes(rs); // pack the found nodes in a byte array if (rs > 0) kns.pack(nodes); @@ -198,7 +198,7 @@ namespace dht node->findKClosestNodes(kns); Uint32 rs = kns.requiredSpace(); // create the data - QByteArray nodes(rs); + TQByteArray nodes(rs); // pack the found nodes in a byte array if (rs > 0) kns.pack(nodes); @@ -228,7 +228,7 @@ namespace dht {} - void DHT::portRecieved(const QString & ip,bt::Uint16 port) + void DHT::portRecieved(const TQString & ip,bt::Uint16 port) { if (!running) return; @@ -264,7 +264,7 @@ namespace dht AnnounceTask* at = new AnnounceTask(db,srv,node,info_hash,port); at->start(kns,!canStartTask()); tman->addTask(at); - if (!db->contains(info_hash)) + if (!db->tqcontains(info_hash)) db->insert(info_hash); return at; } @@ -333,21 +333,21 @@ namespace dht node->onTimeout(r); } - void DHT::addDHTNode(const QString & host,Uint16 hport) + void DHT::addDHTNode(const TQString & host,Uint16 hport) { if (!running) return; - KResolverResults res = KResolver::resolve(host,QString::number(hport)); + KResolverResults res = KResolver::resolve(host,TQString::number(hport)); if (res.count() > 0) { srv->ping(node->getOurID(),res.front().address()); } } - QMap<QString, int> DHT::getClosestGoodNodes(int maxNodes) + TQMap<TQString, int> DHT::getClosestGoodNodes(int maxNodes) { - QMap<QString, int> map; + TQMap<TQString, int> map; if(!node) return map; diff --git a/libktorrent/kademlia/dht.h b/libktorrent/kademlia/dht.h index 8642836..11daf82 100644 --- a/libktorrent/kademlia/dht.h +++ b/libktorrent/kademlia/dht.h @@ -20,9 +20,9 @@ #ifndef DHTDHT_H #define DHTDHT_H -#include <qtimer.h> -#include <qstring.h> -#include <qmap.h> +#include <tqtimer.h> +#include <tqstring.h> +#include <tqmap.h> #include <util/constants.h> #include <util/timer.h> #include "key.h" @@ -64,6 +64,7 @@ namespace dht class DHT : public DHTBase { Q_OBJECT + TQ_OBJECT public: DHT(); virtual ~DHT(); @@ -81,7 +82,7 @@ namespace dht * @param ip The IP of the peer * @param port The port in the PORT message */ - void portRecieved(const QString & ip,bt::Uint16 port); + void portRecieved(const TQString & ip,bt::Uint16 port); /** * Do an announce on the DHT network @@ -107,16 +108,16 @@ namespace dht /// See if it is possible to start a task bool canStartTask() const; - void start(const QString & table,const QString & key_file,bt::Uint16 port); + void start(const TQString & table,const TQString & key_file,bt::Uint16 port); void stop(); - void addDHTNode(const QString & host,bt::Uint16 hport); + void addDHTNode(const TQString & host,bt::Uint16 hport); /** * Returns maxNodes number of <IP address, port> nodes * that are closest to ourselves and are good. - * @param maxNodes maximum nr of nodes in QMap to return. + * @param maxNodes maximum nr of nodes in TQMap to return. */ - QMap<QString, int> getClosestGoodNodes(int maxNodes); + TQMap<TQString, int> getClosestGoodNodes(int maxNodes); private slots: void update(); @@ -127,8 +128,8 @@ namespace dht Database* db; TaskManager* tman; bt::Timer expire_timer; - QString table_file; - QTimer update_timer; + TQString table_file; + TQTimer update_timer; }; } diff --git a/libktorrent/kademlia/dhtbase.h b/libktorrent/kademlia/dhtbase.h index dfa880a..05699c8 100644 --- a/libktorrent/kademlia/dhtbase.h +++ b/libktorrent/kademlia/dhtbase.h @@ -20,10 +20,10 @@ #ifndef DHTDHTBASE_H #define DHTDHTBASE_H -#include <qobject.h> +#include <tqobject.h> #include <util/constants.h> -class QString; +class TQString; namespace bt { @@ -48,9 +48,10 @@ namespace dht * Interface for DHT class, this is to keep other things separate from the inner workings * of the DHT. */ - class DHTBase : public QObject + class DHTBase : public TQObject { Q_OBJECT + TQ_OBJECT public: DHTBase(); virtual ~DHTBase(); @@ -62,7 +63,7 @@ namespace dht * @param key_file The file where the key is stored * @param port The port to use */ - virtual void start(const QString & table,const QString & key_file,bt::Uint16 port) = 0; + virtual void start(const TQString & table,const TQString & key_file,bt::Uint16 port) = 0; /** * Stop the DHT @@ -79,7 +80,7 @@ namespace dht * @param ip The IP of the peer * @param port The port in the PORT message */ - virtual void portRecieved(const QString & ip,bt::Uint16 port) = 0; + virtual void portRecieved(const TQString & ip,bt::Uint16 port) = 0; /** * Do an announce on the DHT network @@ -105,14 +106,14 @@ namespace dht * @param host The hostname or ip * @param hport The port of the host */ - virtual void addDHTNode(const QString & host,bt::Uint16 hport) = 0; + virtual void addDHTNode(const TQString & host,bt::Uint16 hport) = 0; /** * Returns maxNodes number of <IP address, port> nodes * that are closest to ourselves and are good. - * @param maxNodes maximum nr of nodes in QMap to return. + * @param maxNodes maximum nr of nodes in TQMap to return. */ - virtual QMap<QString, int> getClosestGoodNodes(int maxNodes) = 0; + virtual TQMap<TQString, int> getClosestGoodNodes(int maxNodes) = 0; signals: void started(); diff --git a/libktorrent/kademlia/dhttrackerbackend.cpp b/libktorrent/kademlia/dhttrackerbackend.cpp index c90e6f7..96277a3 100644 --- a/libktorrent/kademlia/dhttrackerbackend.cpp +++ b/libktorrent/kademlia/dhttrackerbackend.cpp @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include <kurl.h> -#include <qhostaddress.h> +#include <tqhostaddress.h> #include <util/log.h> #include <util/functions.h> #include <torrent/globals.h> @@ -37,9 +37,9 @@ namespace dht DHTTrackerBackend::DHTTrackerBackend(DHTBase & dh_table,kt::TorrentInterface* tor) : dh_table(dh_table),curr_task(0),tor(tor) { - connect(&timer,SIGNAL(timeout()),this,SLOT(onTimeout())); - connect(&dh_table,SIGNAL(started()),this,SLOT(manualUpdate())); - connect(&dh_table,SIGNAL(stopped()),this,SLOT(dhtStopped())); + connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onTimeout())); + connect(&dh_table,TQT_SIGNAL(started()),this,TQT_SLOT(manualUpdate())); + connect(&dh_table,TQT_SIGNAL(stopped()),this,TQT_SLOT(dhtStopped())); started = false; } @@ -98,8 +98,8 @@ namespace dht const kt::DHTNode & n = tor->getDHTNode(i); curr_task->addDHTNode(n.ip,n.port); } - connect(curr_task,SIGNAL(dataReady( Task* )),this,SLOT(onDataReady( Task* ))); - connect(curr_task,SIGNAL(finished( Task* )),this,SLOT(onFinished( Task* ))); + connect(curr_task,TQT_SIGNAL(dataReady( Task* )),this,TQT_SLOT(onDataReady( Task* ))); + connect(curr_task,TQT_SIGNAL(finished( Task* )),this,TQT_SLOT(onFinished( Task* ))); return true; } @@ -127,7 +127,7 @@ namespace dht while (curr_task->takeItem(item)) { Uint16 port = bt::ReadUint16(item.getData(),4); - QString ip = QHostAddress(ReadUint32(item.getData(),0)).toString(); + TQString ip = TQHostAddress(ReadUint32(item.getData(),0)).toString(); addPeer(ip,port); cnt++; @@ -136,8 +136,8 @@ namespace dht if (cnt) { Out(SYS_DHT|LOG_NOTICE) << - QString("DHT: Got %1 potential peers for torrent %2") - .arg(cnt).arg(tor->getStats().torrent_name) << endl; + TQString("DHT: Got %1 potential peers for torrent %2") + .tqarg(cnt).tqarg(tor->getStats().torrent_name) << endl; peersReady(this); } } diff --git a/libktorrent/kademlia/dhttrackerbackend.h b/libktorrent/kademlia/dhttrackerbackend.h index 355aab9..91141c8 100644 --- a/libktorrent/kademlia/dhttrackerbackend.h +++ b/libktorrent/kademlia/dhttrackerbackend.h @@ -20,7 +20,7 @@ #ifndef DHTDHTTRACKERBACKEND_H #define DHTDHTTRACKERBACKEND_H -#include <qtimer.h> +#include <tqtimer.h> #include <interfaces/peersource.h> #include "task.h" @@ -47,6 +47,7 @@ namespace dht class DHTTrackerBackend : public kt::PeerSource { Q_OBJECT + TQ_OBJECT public: DHTTrackerBackend(DHTBase & dh_table,kt::TorrentInterface* tor); virtual ~DHTTrackerBackend(); @@ -66,7 +67,7 @@ namespace dht DHTBase & dh_table; AnnounceTask* curr_task; kt::TorrentInterface* tor; - QTimer timer; + TQTimer timer; bool started; }; diff --git a/libktorrent/kademlia/kbucket.cpp b/libktorrent/kademlia/kbucket.cpp index fb60d1b..76986b9 100644 --- a/libktorrent/kademlia/kbucket.cpp +++ b/libktorrent/kademlia/kbucket.cpp @@ -119,7 +119,7 @@ namespace dht void KBucket::insert(const KBucketEntry & entry) { - QValueList<KBucketEntry>::iterator i = entries.find(entry); + TQValueList<KBucketEntry>::iterator i = entries.tqfind(entry); // If in the list, move it to the end if (i != entries.end()) @@ -149,7 +149,7 @@ namespace dht { last_modified = bt::GetCurrentTime(); - if (!pending_entries_busy_pinging.contains(c)) + if (!pending_entries_busy_pinging.tqcontains(c)) return; KBucketEntry entry = pending_entries_busy_pinging[c]; @@ -166,13 +166,13 @@ namespace dht void KBucket::onTimeout(RPCCall* c) { - if (!pending_entries_busy_pinging.contains(c)) + if (!pending_entries_busy_pinging.tqcontains(c)) return; KBucketEntry entry = pending_entries_busy_pinging[c]; // replace the entry which timed out - QValueList<KBucketEntry>::iterator i; + TQValueList<KBucketEntry>::iterator i; for (i = entries.begin();i != entries.end();i++) { KBucketEntry & e = *i; @@ -203,7 +203,7 @@ namespace dht return; } - QValueList<KBucketEntry>::iterator i; + TQValueList<KBucketEntry>::iterator i; // we haven't found any bad ones so try the questionable ones for (i = entries.begin();i != entries.end();i++) { @@ -228,7 +228,7 @@ namespace dht bool KBucket::replaceBadEntry(const KBucketEntry & entry) { - QValueList<KBucketEntry>::iterator i; + TQValueList<KBucketEntry>::iterator i; for (i = entries.begin();i != entries.end();i++) { KBucketEntry & e = *i; @@ -244,14 +244,14 @@ namespace dht return false; } - bool KBucket::contains(const KBucketEntry & entry) const + bool KBucket::tqcontains(const KBucketEntry & entry) const { - return entries.contains(entry); + return entries.tqcontains(entry); } void KBucket::findKClosestNodes(KClosestNodesSearch & kns) { - QValueList<KBucketEntry>::iterator i = entries.begin(); + TQValueList<KBucketEntry>::iterator i = entries.begin(); while (i != entries.end()) { kns.tryInsert(*i); @@ -261,7 +261,7 @@ namespace dht bool KBucket::onTimeout(const KInetSocketAddress & addr) { - QValueList<KBucketEntry>::iterator i; + TQValueList<KBucketEntry>::iterator i; for (i = entries.begin();i != entries.end();i++) { @@ -302,7 +302,7 @@ namespace dht hdr.num_entries = entries.count(); fptr.write(&hdr,sizeof(BucketHeader)); - QValueList<KBucketEntry>::iterator i; + TQValueList<KBucketEntry>::iterator i; for (i = entries.begin();i != entries.end();i++) { KBucketEntry & e = *i; @@ -345,8 +345,8 @@ namespace dht refresh_task = t; if (refresh_task) { - connect(refresh_task,SIGNAL(finished( Task* )), - this,SLOT(onFinished( Task* ))); + connect(refresh_task,TQT_SIGNAL(finished( Task* )), + this,TQT_SLOT(onFinished( Task* ))); } } diff --git a/libktorrent/kademlia/kbucket.h b/libktorrent/kademlia/kbucket.h index 139ce10..cfd932d 100644 --- a/libktorrent/kademlia/kbucket.h +++ b/libktorrent/kademlia/kbucket.h @@ -20,7 +20,7 @@ #ifndef DHTKBUCKET_H #define DHTKBUCKET_H -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <util/constants.h> #include <ksocketaddress.h> #include "key.h" @@ -143,12 +143,13 @@ namespace dht class KBucket : public RPCCallListener { Q_OBJECT + TQ_OBJECT Uint32 idx; - QValueList<KBucketEntry> entries,pending_entries; + TQValueList<KBucketEntry> entries,pending_entries; RPCServer* srv; Node* node; - QMap<RPCCall*,KBucketEntry> pending_entries_busy_pinging; + TQMap<RPCCall*,KBucketEntry> pending_entries_busy_pinging; mutable bt::TimeStamp last_modified; Task* refresh_task; public: @@ -168,7 +169,7 @@ namespace dht Uint32 getNumEntries() const {return entries.count();} /// See if this bucket contains an entry - bool contains(const KBucketEntry & entry) const; + bool tqcontains(const KBucketEntry & entry) const; /** * Find the K closest entries to a key and store them in the KClosestNodesSearch diff --git a/libktorrent/kademlia/kclosestnodessearch.cpp b/libktorrent/kademlia/kclosestnodessearch.cpp index 4a97c7f..5421b6c 100644 --- a/libktorrent/kademlia/kclosestnodessearch.cpp +++ b/libktorrent/kademlia/kclosestnodessearch.cpp @@ -65,7 +65,7 @@ namespace dht } - void KClosestNodesSearch::pack(QByteArray & ba) + void KClosestNodesSearch::pack(TQByteArray & ba) { // make sure we do not writ to much Uint32 max_items = ba.size() / 26; diff --git a/libktorrent/kademlia/kclosestnodessearch.h b/libktorrent/kademlia/kclosestnodessearch.h index e006a25..f4b460d 100644 --- a/libktorrent/kademlia/kclosestnodessearch.h +++ b/libktorrent/kademlia/kclosestnodessearch.h @@ -31,7 +31,7 @@ namespace dht * @author Joris Guisson <[email protected]> * * Class used to store the search results during a K closests nodes search - * Note: we use a std::map because of lack of functionality in QMap + * Note: we use a std::map because of lack of functionality in TQMap */ class KClosestNodesSearch { @@ -82,7 +82,7 @@ namespace dht * enough space to store requiredSpace() bytes. * @param ba The buffer */ - void pack(QByteArray & ba); + void pack(TQByteArray & ba); }; } diff --git a/libktorrent/kademlia/key.cpp b/libktorrent/kademlia/key.cpp index 6e62ff6..35ecfff 100644 --- a/libktorrent/kademlia/key.cpp +++ b/libktorrent/kademlia/key.cpp @@ -19,7 +19,7 @@ ***************************************************************************/ #include <time.h> #include <stdlib.h> -#include <qcstring.h> +#include <tqcstring.h> #include <util/constants.h> #include "key.h" @@ -39,7 +39,7 @@ namespace dht { } - Key::Key(const QByteArray & ba) + Key::Key(const TQByteArray & ba) { for (Uint32 i = 0;i < 20 && i < ba.size();i++) hash[i] = ba[i]; diff --git a/libktorrent/kademlia/key.h b/libktorrent/kademlia/key.h index e818dc1..e383a5e 100644 --- a/libktorrent/kademlia/key.h +++ b/libktorrent/kademlia/key.h @@ -20,7 +20,7 @@ #ifndef DHTKEY_H #define DHTKEY_H -#include <qcstring.h> +#include <tqcstring.h> #include <util/sha1hash.h> @@ -52,9 +52,9 @@ namespace dht /** * Make a key out of a bytearray - * @param ba The QByteArray + * @param ba The TQByteArray */ - Key(const QByteArray & ba); + Key(const TQByteArray & ba); /** * Make a key out of a 20 byte array. diff --git a/libktorrent/kademlia/node.cpp b/libktorrent/kademlia/node.cpp index 96c39a4..bd450e4 100644 --- a/libktorrent/kademlia/node.cpp +++ b/libktorrent/kademlia/node.cpp @@ -37,7 +37,7 @@ using namespace KNetwork; namespace dht { - static void SaveKey(const dht::Key & key,const QString & key_file) + static void SaveKey(const dht::Key & key,const TQString & key_file) { bt::File fptr; if (!fptr.open(key_file,"wb")) @@ -50,7 +50,7 @@ namespace dht fptr.close(); } - static dht::Key LoadKey(const QString & key_file,bool & new_key) + static dht::Key LoadKey(const TQString & key_file,bool & new_key) { bt::File fptr; if (!fptr.open(key_file,"rb")) @@ -75,7 +75,7 @@ namespace dht return dht::Key(data); } - Node::Node(RPCServer* srv,const QString & key_file) : srv(srv) + Node::Node(RPCServer* srv,const TQString & key_file) : srv(srv) { num_receives = 0; num_entries = 0; @@ -224,7 +224,7 @@ namespace dht } - void Node::saveTable(const QString & file) + void Node::saveTable(const TQString & file) { bt::File fptr; if (!fptr.open(file,"wb")) @@ -243,7 +243,7 @@ namespace dht } } - void Node::loadTable(const QString & file) + void Node::loadTable(const TQString & file) { if (delete_table) { diff --git a/libktorrent/kademlia/node.h b/libktorrent/kademlia/node.h index 56f41f1..7d871e0 100644 --- a/libktorrent/kademlia/node.h +++ b/libktorrent/kademlia/node.h @@ -20,7 +20,7 @@ #ifndef DHTNODE_H #define DHTNODE_H -#include <qobject.h> +#include <tqobject.h> #include "key.h" #include "kbucket.h" @@ -37,16 +37,17 @@ namespace dht /** * @author Joris Guisson * - * A Node represents us in the kademlia network. It contains + * A Node represents us in the kademlia network. It tqcontains * our id and 160 KBucket's. * A KBucketEntry is in node i, when the difference between our id and * the KBucketEntry's id is between 2 to the power i and 2 to the power i+1. */ - class Node : public QObject + class Node : public TQObject { Q_OBJECT + TQ_OBJECT public: - Node(RPCServer* srv,const QString & key_file); + Node(RPCServer* srv,const TQString & key_file); virtual ~Node(); /** @@ -77,10 +78,10 @@ namespace dht void refreshBuckets(DHT* dh_table); /// Save the routing table to a file - void saveTable(const QString & file); + void saveTable(const TQString & file); /// Load the routing table from a file - void loadTable(const QString & file); + void loadTable(const TQString & file); /// Get the number of entries in the routing table Uint32 getNumEntriesInRoutingTable() const {return num_entries;} diff --git a/libktorrent/kademlia/nodelookup.cpp b/libktorrent/kademlia/nodelookup.cpp index 9fa616c..9175f7d 100644 --- a/libktorrent/kademlia/nodelookup.cpp +++ b/libktorrent/kademlia/nodelookup.cpp @@ -49,14 +49,14 @@ namespace dht if (rsp->getMethod() == dht::FIND_NODE && rsp->getType() == dht::RSP_MSG) { FindNodeRsp* fnr = (FindNodeRsp*)rsp; - const QByteArray & nodes = fnr->getNodes(); + const TQByteArray & nodes = fnr->getNodes(); Uint32 nnodes = nodes.size() / 26; for (Uint32 j = 0;j < nnodes;j++) { // unpack an entry and add it to the todo list KBucketEntry e = UnpackBucketEntry(nodes,j*26); // lets not talk to ourself - if (e.getID() != node->getOurID() && !todo.contains(e) && !visited.contains(e)) + if (e.getID() != node->getOurID() && !todo.tqcontains(e) && !visited.tqcontains(e)) todo.append(e); } num_nodes_rsp++; @@ -78,7 +78,7 @@ namespace dht { KBucketEntry e = todo.first(); // only send a findNode if we haven't allrready visited the node - if (!visited.contains(e)) + if (!visited.tqcontains(e)) { // send a findNode to the node FindNodeReq* fnr = new FindNodeReq(node->getOurID(),node_id); diff --git a/libktorrent/kademlia/pack.cpp b/libktorrent/kademlia/pack.cpp index a5acafb..200c686 100644 --- a/libktorrent/kademlia/pack.cpp +++ b/libktorrent/kademlia/pack.cpp @@ -27,7 +27,7 @@ using namespace KNetwork; namespace dht { - void PackBucketEntry(const KBucketEntry & e,QByteArray & ba,Uint32 off) + void PackBucketEntry(const KBucketEntry & e,TQByteArray & ba,Uint32 off) { // first check size if (off + 26 > ba.size()) @@ -43,7 +43,7 @@ namespace dht bt::WriteUint16(ptr,24,addr.port()); } - KBucketEntry UnpackBucketEntry(const QByteArray & ba,Uint32 off) + KBucketEntry UnpackBucketEntry(const TQByteArray & ba,Uint32 off) { if (off + 26 > ba.size()) throw bt::Error("Not enough room in buffer"); diff --git a/libktorrent/kademlia/pack.h b/libktorrent/kademlia/pack.h index dab1523..46c2405 100644 --- a/libktorrent/kademlia/pack.h +++ b/libktorrent/kademlia/pack.h @@ -32,7 +32,7 @@ namespace dht * @param ba The byte array * @param off The offset into the array */ - void PackBucketEntry(const KBucketEntry & e,QByteArray & ba,Uint32 off); + void PackBucketEntry(const KBucketEntry & e,TQByteArray & ba,Uint32 off); /** * Unpack a KBucketEntry from a byte array. @@ -41,7 +41,7 @@ namespace dht * @param off The offset * @return The entry */ - KBucketEntry UnpackBucketEntry(const QByteArray & ba,Uint32 off); + KBucketEntry UnpackBucketEntry(const TQByteArray & ba,Uint32 off); } diff --git a/libktorrent/kademlia/rpccall.cpp b/libktorrent/kademlia/rpccall.cpp index b86e8f7..9ed926a 100644 --- a/libktorrent/kademlia/rpccall.cpp +++ b/libktorrent/kademlia/rpccall.cpp @@ -33,7 +33,7 @@ namespace dht RPCCall::RPCCall(RPCServer* rpc,MsgBase* msg,bool queued) : msg(msg),rpc(rpc),queued(queued) { - connect(&timer,SIGNAL(timeout()),this,SLOT(onTimeout())); + connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onTimeout())); if (!queued) timer.start(30*1000,true); } @@ -71,8 +71,8 @@ namespace dht void RPCCall::addListener(RPCCallListener* cl) { - connect(this,SIGNAL(onCallResponse( RPCCall*, MsgBase* )),cl,SLOT(onResponse( RPCCall*, MsgBase* ))); - connect(this,SIGNAL(onCallTimeout( RPCCall* )),cl,SLOT(onTimeout( RPCCall* ))); + connect(this,TQT_SIGNAL(onCallResponse( RPCCall*, MsgBase* )),cl,TQT_SLOT(onResponse( RPCCall*, MsgBase* ))); + connect(this,TQT_SIGNAL(onCallTimeout( RPCCall* )),cl,TQT_SLOT(onTimeout( RPCCall* ))); } } diff --git a/libktorrent/kademlia/rpccall.h b/libktorrent/kademlia/rpccall.h index 6e54933..2a9682e 100644 --- a/libktorrent/kademlia/rpccall.h +++ b/libktorrent/kademlia/rpccall.h @@ -20,7 +20,7 @@ #ifndef DHTRPCCALL_H #define DHTRPCCALL_H -#include <qtimer.h> +#include <tqtimer.h> #include "key.h" #include "rpcmsg.h" @@ -32,9 +32,10 @@ namespace dht /** * Class which objects should derive from, if they want to know the result of a call. */ - class RPCCallListener : public QObject + class RPCCallListener : public TQObject { Q_OBJECT + TQ_OBJECT public: RPCCallListener(); virtual ~RPCCallListener(); @@ -58,9 +59,10 @@ namespace dht /** * @author Joris Guisson */ - class RPCCall : public QObject + class RPCCall : public TQObject { Q_OBJECT + TQ_OBJECT public: RPCCall(RPCServer* rpc,MsgBase* msg,bool queued); virtual ~RPCCall(); @@ -100,7 +102,7 @@ namespace dht private: MsgBase* msg; - QTimer timer; + TQTimer timer; RPCServer* rpc; bool queued; }; diff --git a/libktorrent/kademlia/rpcmsg.cpp b/libktorrent/kademlia/rpcmsg.cpp index 97364e1..53cb4f1 100644 --- a/libktorrent/kademlia/rpcmsg.cpp +++ b/libktorrent/kademlia/rpcmsg.cpp @@ -30,14 +30,14 @@ using namespace bt; namespace dht { - const QString TID = "t"; - const QString REQ = "q"; - const QString RSP = "r"; - const QString TYP = "y"; - const QString ARG = "a"; - // ERR apparently is defined as a macro on solaris in some header file, + const TQString TID = "t"; + const TQString REQ = "q"; + const TQString RSP = "r"; + const TQString TYP = "y"; + const TQString ARG = "a"; + // ERR aptqparently is defined as a macro on solaris in some header file, // which causes things not to compile on it, so we have changed it to ERR_DHT - const QString ERR_DHT = "e"; + const TQString ERR_DHT = "e"; MsgBase* MakeMsg(bt::BDictNode* dict); @@ -57,13 +57,13 @@ namespace dht return 0; Key id = Key(args->getValue("id")->data().toByteArray()); - QByteArray mtid_d = dict->getValue(TID)->data().toByteArray(); + TQByteArray mtid_d = dict->getValue(TID)->data().toByteArray(); if (mtid_d.size() == 0) return 0; Uint8 mtid = (Uint8)mtid_d.at(0); MsgBase* msg = 0; - QString str = vn->data().toString(); + TQString str = vn->data().toString(); if (str == "ping") { msg = new PingReq(id); @@ -116,7 +116,7 @@ namespace dht if (args->getValue("token")) { Key token = args->getValue("token")->data().toByteArray(); - QByteArray data; + TQByteArray data; BListNode* vals = args->getList("values"); DBItemList dbl; if (vals) @@ -163,7 +163,7 @@ namespace dht } - QByteArray ba = dict->getValue(TID)->data().toByteArray(); + TQByteArray ba = dict->getValue(TID)->data().toByteArray(); // check for empty byte arrays should prevent 144416 if (ba.size() == 0) return 0; @@ -188,12 +188,12 @@ namespace dht return 0; Key id = Key(args->getValue("id")->data().toByteArray()); - QString mt_id = dict->getValue(TID)->data().toString(); + TQString mt_id = dict->getValue(TID)->data().toString(); if (mt_id.length() == 0) return 0; - Uint8 mtid = (char)mt_id.at(0).latin1(); - QString str = vn->data().toString(); + Uint8 mtid = (char)mt_id.tqat(0).latin1(); + TQString str = vn->data().toString(); return new ErrMsg(mtid,id,str); } @@ -252,7 +252,7 @@ namespace dht //////////////////////////////// - PingReq::PingReq(const Key & id) : MsgBase(0xFF,PING,REQ_MSG,id) + PingReq::PingReq(const Key & id) : MsgBase(0xFF,PING,RETQ_MSG,id) { } @@ -266,20 +266,20 @@ namespace dht void PingReq::print() { - Out(SYS_DHT|LOG_DEBUG) << QString("REQ: %1 %2 : ping").arg(mtid).arg(id.toString()) << endl; + Out(SYS_DHT|LOG_DEBUG) << TQString("REQ: %1 %2 : ping").tqarg(mtid).tqarg(id.toString()) << endl; } - void PingReq::encode(QByteArray & arr) + void PingReq::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(ARG); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); } enc.end(); - enc.write(REQ); enc.write("ping"); + enc.write(REQ); enc.write(TQString("ping")); enc.write(TID); enc.write(&mtid,1); enc.write(TYP); enc.write(REQ); } @@ -289,7 +289,7 @@ namespace dht //////////////////////////////// FindNodeReq::FindNodeReq(const Key & id,const Key & target) - : MsgBase(0xFF,FIND_NODE,REQ_MSG,id),target(target) + : MsgBase(0xFF,FIND_NODE,RETQ_MSG,id),target(target) {} FindNodeReq::~FindNodeReq() @@ -302,22 +302,22 @@ namespace dht void FindNodeReq::print() { - Out(SYS_DHT|LOG_NOTICE) << QString("REQ: %1 %2 : find_node %3") - .arg(mtid).arg(id.toString()).arg(target.toString()) << endl; + Out(SYS_DHT|LOG_NOTICE) << TQString("REQ: %1 %2 : find_node %3") + .tqarg(mtid).tqarg(id.toString()).tqarg(target.toString()) << endl; } - void FindNodeReq::encode(QByteArray & arr) + void FindNodeReq::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(ARG); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); - enc.write("target"); enc.write(target.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); + enc.write(TQString("target")); enc.write(target.getData(),20); } enc.end(); - enc.write(REQ); enc.write("find_node"); + enc.write(REQ); enc.write(TQString("find_node")); enc.write(TID); enc.write(&mtid,1); enc.write(TYP); enc.write(REQ); } @@ -328,7 +328,7 @@ namespace dht //////////////////////////////// GetPeersReq::GetPeersReq(const Key & id,const Key & info_hash) - : MsgBase(0xFF,GET_PEERS,REQ_MSG,id),info_hash(info_hash) + : MsgBase(0xFF,GET_PEERS,RETQ_MSG,id),info_hash(info_hash) {} GetPeersReq::~GetPeersReq() @@ -341,22 +341,22 @@ namespace dht void GetPeersReq::print() { - Out(SYS_DHT|LOG_DEBUG) << QString("REQ: %1 %2 : get_peers %3") - .arg(mtid).arg(id.toString()).arg(info_hash.toString()) << endl; + Out(SYS_DHT|LOG_DEBUG) << TQString("REQ: %1 %2 : get_peers %3") + .tqarg(mtid).tqarg(id.toString()).tqarg(info_hash.toString()) << endl; } - void GetPeersReq::encode(QByteArray & arr) + void GetPeersReq::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(ARG); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); - enc.write("info_hash"); enc.write(info_hash.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); + enc.write(TQString("info_hash")); enc.write(info_hash.getData(),20); } enc.end(); - enc.write(REQ); enc.write("get_peers"); + enc.write(REQ); enc.write(TQString("get_peers")); enc.write(TID); enc.write(&mtid,1); enc.write(TYP); enc.write(REQ); } @@ -380,25 +380,25 @@ namespace dht void AnnounceReq::print() { - Out(SYS_DHT|LOG_DEBUG) << QString("REQ: %1 %2 : announce_peer %3 %4 %5") - .arg(mtid).arg(id.toString()).arg(info_hash.toString()) - .arg(port).arg(token.toString()) << endl; + Out(SYS_DHT|LOG_DEBUG) << TQString("REQ: %1 %2 : announce_peer %3 %4 %5") + .tqarg(mtid).tqarg(id.toString()).tqarg(info_hash.toString()) + .tqarg(port).tqarg(token.toString()) << endl; } - void AnnounceReq::encode(QByteArray & arr) + void AnnounceReq::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(ARG); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); - enc.write("info_hash"); enc.write(info_hash.getData(),20); - enc.write("port"); enc.write((Uint32)port); - enc.write("token"); enc.write(token.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); + enc.write(TQString("info_hash")); enc.write(info_hash.getData(),20); + enc.write(TQString("port")); enc.write((Uint32)port); + enc.write(TQString("token")); enc.write(token.getData(),20); } enc.end(); - enc.write(REQ); enc.write("announce_peer"); + enc.write(REQ); enc.write(TQString("announce_peer")); enc.write(TID); enc.write(&mtid,1); enc.write(TYP); enc.write(REQ); } @@ -420,18 +420,18 @@ namespace dht void PingRsp::print() { - Out(SYS_DHT|LOG_DEBUG) << QString("RSP: %1 %2 : ping") - .arg(mtid).arg(id.toString()) << endl; + Out(SYS_DHT|LOG_DEBUG) << TQString("RSP: %1 %2 : ping") + .tqarg(mtid).tqarg(id.toString()) << endl; } - void PingRsp::encode(QByteArray & arr) + void PingRsp::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(RSP); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); } enc.end(); enc.write(TID); enc.write(&mtid,1); @@ -442,7 +442,7 @@ namespace dht //////////////////////////////// - FindNodeRsp::FindNodeRsp(Uint8 mtid,const Key & id,const QByteArray & nodes) + FindNodeRsp::FindNodeRsp(Uint8 mtid,const Key & id,const TQByteArray & nodes) : MsgBase(mtid,FIND_NODE,RSP_MSG,id),nodes(nodes) {} @@ -455,19 +455,19 @@ namespace dht void FindNodeRsp::print() { - Out(SYS_DHT|LOG_DEBUG) << QString("RSP: %1 %2 : find_node") - .arg(mtid).arg(id.toString()) << endl; + Out(SYS_DHT|LOG_DEBUG) << TQString("RSP: %1 %2 : find_node") + .tqarg(mtid).tqarg(id.toString()) << endl; } - void FindNodeRsp::encode(QByteArray & arr) + void FindNodeRsp::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(RSP); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); - enc.write("nodes"); enc.write(nodes); + enc.write(TQString("id")); enc.write(id.getData(),20); + enc.write(TQString("nodes")); enc.write(nodes); } enc.end(); enc.write(TID); enc.write(&mtid,1); @@ -478,7 +478,7 @@ namespace dht //////////////////////////////// - GetPeersRsp::GetPeersRsp(Uint8 mtid,const Key & id,const QByteArray & data,const Key & token) + GetPeersRsp::GetPeersRsp(Uint8 mtid,const Key & id,const TQByteArray & data,const Key & token) : MsgBase(mtid,dht::GET_PEERS,dht::RSP_MSG,id),token(token),data(data) { this->data.detach(); @@ -497,27 +497,27 @@ namespace dht } void GetPeersRsp::print() { - Out() << QString("RSP: %1 %2 : get_peers(%3)") - .arg(mtid).arg(id.toString()).arg(data.size() > 0 ? "nodes" : "values") << endl; + Out() << TQString("RSP: %1 %2 : get_peers(%3)") + .tqarg(mtid).tqarg(id.toString()).tqarg(data.size() > 0 ? "nodes" : "values") << endl; } - void GetPeersRsp::encode(QByteArray & arr) + void GetPeersRsp::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(RSP); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); if (data.size() > 0) { - enc.write("nodes"); enc.write(data); - enc.write("token"); enc.write(token.getData(),20); + enc.write(TQString("nodes")); enc.write(data); + enc.write(TQString("token")); enc.write(token.getData(),20); } else { - enc.write("token"); enc.write(token.getData(),20); - enc.write("values"); enc.beginList(); + enc.write(TQString("token")); enc.write(token.getData(),20); + enc.write(TQString("values")); enc.beginList(); DBItemList::iterator i = items.begin(); while (i != items.end()) { @@ -551,18 +551,18 @@ namespace dht void AnnounceRsp::print() { - Out() << QString("RSP: %1 %2 : announce_peer") - .arg(mtid).arg(id.toString()) << endl; + Out() << TQString("RSP: %1 %2 : announce_peer") + .tqarg(mtid).tqarg(id.toString()) << endl; } - void AnnounceRsp::encode(QByteArray & arr) + void AnnounceRsp::encode(TQByteArray & arr) { BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); { enc.write(RSP); enc.beginDict(); { - enc.write("id"); enc.write(id.getData(),20); + enc.write(TQString("id")); enc.write(id.getData(),20); } enc.end(); enc.write(TID); enc.write(&mtid,1); @@ -574,7 +574,7 @@ namespace dht //////////////////////////////// - ErrMsg::ErrMsg(Uint8 mtid,const Key & id,const QString & msg) + ErrMsg::ErrMsg(Uint8 mtid,const Key & id,const TQString & msg) : MsgBase(mtid,NONE,ERR_MSG,id),msg(msg) {} @@ -591,6 +591,6 @@ namespace dht Out(SYS_DHT|LOG_NOTICE) << "ERR: " << mtid << " " << msg << endl; } - void ErrMsg::encode(QByteArray & ) + void ErrMsg::encode(TQByteArray & ) {} } diff --git a/libktorrent/kademlia/rpcmsg.h b/libktorrent/kademlia/rpcmsg.h index 4863ae2..7e04d7a 100644 --- a/libktorrent/kademlia/rpcmsg.h +++ b/libktorrent/kademlia/rpcmsg.h @@ -40,7 +40,7 @@ namespace dht enum Type { - REQ_MSG, + RETQ_MSG, RSP_MSG, ERR_MSG, INVALID @@ -83,7 +83,7 @@ namespace dht * BEncode the message. * @param arr Data array */ - virtual void encode(QByteArray & arr) = 0; + virtual void encode(TQByteArray & arr) = 0; /// Set the origin (i.e. where the message came from) void setOrigin(const KNetwork::KSocketAddress & o) {origin = o;} @@ -133,14 +133,14 @@ namespace dht class ErrMsg : public MsgBase { public: - ErrMsg(Uint8 mtid,const Key & id,const QString & msg); + ErrMsg(Uint8 mtid,const Key & id,const TQString & msg); virtual ~ErrMsg(); virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); private: - QString msg; + TQString msg; }; class PingReq : public MsgBase @@ -151,7 +151,7 @@ namespace dht virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); }; class FindNodeReq : public MsgBase @@ -162,7 +162,7 @@ namespace dht virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); const Key & getTarget() const {return target;} @@ -179,7 +179,7 @@ namespace dht const Key & getInfoHash() const {return info_hash;} virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); protected: Key info_hash; }; @@ -192,7 +192,7 @@ namespace dht virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); const Key & getToken() const {return token;} bt::Uint16 getPort() const {return port;} @@ -209,7 +209,7 @@ namespace dht virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); }; @@ -217,37 +217,37 @@ namespace dht class FindNodeRsp : public MsgBase { public: - FindNodeRsp(Uint8 mtid,const Key & id,const QByteArray & nodes); + FindNodeRsp(Uint8 mtid,const Key & id,const TQByteArray & nodes); virtual ~FindNodeRsp(); virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); - const QByteArray & getNodes() const {return nodes;} + const TQByteArray & getNodes() const {return nodes;} protected: - QByteArray nodes; + TQByteArray nodes; }; class GetPeersRsp : public MsgBase { public: - GetPeersRsp(Uint8 mtid,const Key & id,const QByteArray & data,const Key & token); + GetPeersRsp(Uint8 mtid,const Key & id,const TQByteArray & data,const Key & token); GetPeersRsp(Uint8 mtid,const Key & id,const DBItemList & values,const Key & token); virtual ~GetPeersRsp(); virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); - const QByteArray & getData() const {return data;} + const TQByteArray & getData() const {return data;} const DBItemList & getItemList() const {return items;} const Key & getToken() const {return token;} bool containsNodes() const {return data.size() > 0;} bool containsValues() const {return data.size() == 0;} private: Key token; - QByteArray data; + TQByteArray data; DBItemList items; }; @@ -260,7 +260,7 @@ namespace dht virtual void apply(DHT* dh_table); virtual void print(); - virtual void encode(QByteArray & arr); + virtual void encode(TQByteArray & arr); }; diff --git a/libktorrent/kademlia/rpcserver.cpp b/libktorrent/kademlia/rpcserver.cpp index 1242dae..9f65b95 100644 --- a/libktorrent/kademlia/rpcserver.cpp +++ b/libktorrent/kademlia/rpcserver.cpp @@ -42,7 +42,7 @@ namespace dht - RPCServer::RPCServer(DHT* dh_table,Uint16 port,QObject *parent) : QObject(parent),dh_table(dh_table),next_mtid(0),port(port) + RPCServer::RPCServer(DHT* dh_table,Uint16 port,TQObject *tqparent) : TQObject(tqparent),dh_table(dh_table),next_mtid(0),port(port) { sock = new KDatagramSocket(this); sock->setBlocking(false); @@ -63,7 +63,7 @@ namespace dht void RPCServer::start() { sock->setBlocking(true); - if (!sock->bind(QString::null,QString::number(port))) + if (!sock->bind(TQString(),TQString::number(port))) { Out(SYS_DHT|LOG_IMPORTANT) << "DHT: Failed to bind to UDP port " << port << " for DHT" << endl; } @@ -72,7 +72,7 @@ namespace dht bt::Globals::instance().getPortList().addNewPort(port,net::UDP,true); } sock->setBlocking(false); - connect(sock,SIGNAL(readyRead()),this,SLOT(readPacket())); + connect(sock,TQT_SIGNAL(readyRead()),this,TQT_SLOT(readPacket())); } void RPCServer::stop() @@ -81,13 +81,13 @@ namespace dht sock->close(); } - static void PrintRawData(const QByteArray & data) + static void PrintRawData(const TQByteArray & data) { - QString tmp; + TQString tmp; for (Uint32 i = 0;i < data.size();i++) { - char c = QChar(data[i]).latin1(); - if (!QChar(data[i]).isPrint() || c == 0) + char c = TQChar(data[i]).latin1(); + if (!TQChar(data[i]).isPrint() || c == 0) tmp += '#'; else tmp += c; @@ -134,10 +134,10 @@ namespace dht msg->setOrigin(pck.address()); msg->apply(dh_table); // erase an existing call - if (msg->getType() == RSP_MSG && calls.contains(msg->getMTID())) + if (msg->getType() == RSP_MSG && calls.tqcontains(msg->getMTID())) { // delete the call, but first notify it off the response - RPCCall* c = calls.find(msg->getMTID()); + RPCCall* c = calls.tqfind(msg->getMTID()); c->response(msg); calls.erase(msg->getMTID()); c->deleteLater(); @@ -157,7 +157,7 @@ namespace dht } - void RPCServer::send(const KNetwork::KSocketAddress & addr,const QByteArray & msg) + void RPCServer::send(const KNetwork::KSocketAddress & addr,const TQByteArray & msg) { sock->send(KNetwork::KDatagramPacket(msg,addr)); } @@ -165,7 +165,7 @@ namespace dht RPCCall* RPCServer::doCall(MsgBase* msg) { Uint8 start = next_mtid; - while (calls.contains(next_mtid)) + while (calls.tqcontains(next_mtid)) { next_mtid++; if (next_mtid == start) // if this happens we cannot do any calls @@ -187,7 +187,7 @@ namespace dht void RPCServer::sendMsg(MsgBase* msg) { - QByteArray data; + TQByteArray data; msg->encode(data); send(msg->getDestination(),data); @@ -197,7 +197,7 @@ namespace dht void RPCServer::timedOut(Uint8 mtid) { // delete the call - RPCCall* c = calls.find(mtid); + RPCCall* c = calls.tqfind(mtid); if (c) { dh_table->timeout(c->getRequest()); @@ -214,7 +214,7 @@ namespace dht RPCCall* c = call_queue.first(); call_queue.removeFirst(); - while (calls.contains(next_mtid)) + while (calls.tqcontains(next_mtid)) next_mtid++; MsgBase* msg = c->getRequest(); @@ -227,7 +227,7 @@ namespace dht const RPCCall* RPCServer::findCall(Uint8 mtid) const { - return calls.find(mtid); + return calls.tqfind(mtid); } void RPCServer::ping(const dht::Key & our_id,const KNetwork::KSocketAddress & addr) diff --git a/libktorrent/kademlia/rpcserver.h b/libktorrent/kademlia/rpcserver.h index 4e54076..393db7a 100644 --- a/libktorrent/kademlia/rpcserver.h +++ b/libktorrent/kademlia/rpcserver.h @@ -20,7 +20,7 @@ #ifndef DHTRPCSERVER_H #define DHTRPCSERVER_H -#include <qptrlist.h> +#include <tqptrlist.h> #include <kdatagramsocket.h> #include <util/constants.h> #include <util/array.h> @@ -52,11 +52,12 @@ namespace dht * * Class to handle incoming and outgoing RPC messages. */ - class RPCServer : public QObject + class RPCServer : public TQObject { Q_OBJECT + TQ_OBJECT public: - RPCServer(DHT* dh_table,Uint16 port,QObject *parent = 0); + RPCServer(DHT* dh_table,Uint16 port,TQObject *tqparent = 0); virtual ~RPCServer(); /// Start the server @@ -105,14 +106,14 @@ namespace dht void readPacket(); private: - void send(const KNetwork::KSocketAddress & addr,const QByteArray & msg); + void send(const KNetwork::KSocketAddress & addr,const TQByteArray & msg); void doQueuedCalls(); private: KDatagramSocket* sock; DHT* dh_table; bt::PtrMap<bt::Uint8,RPCCall> calls; - QPtrList<RPCCall> call_queue; + TQPtrList<RPCCall> call_queue; bt::Uint8 next_mtid; bt::Uint16 port; }; diff --git a/libktorrent/kademlia/task.cpp b/libktorrent/kademlia/task.cpp index 877a698..96e37b4 100644 --- a/libktorrent/kademlia/task.cpp +++ b/libktorrent/kademlia/task.cpp @@ -115,10 +115,10 @@ namespace dht finished(this); } - void Task::addDHTNode(const QString & ip,bt::Uint16 port) + void Task::addDHTNode(const TQString & ip,bt::Uint16 port) { - KResolver::resolveAsync(this,SLOT(onResolverResults(KResolverResults )), - ip,QString::number(port)); + KResolver::resolveAsync(this,TQT_SLOT(onResolverResults(KResolverResults )), + ip,TQString::number(port)); } void Task::onResolverResults(KResolverResults res) diff --git a/libktorrent/kademlia/task.h b/libktorrent/kademlia/task.h index 5a33ac0..3d7189f 100644 --- a/libktorrent/kademlia/task.h +++ b/libktorrent/kademlia/task.h @@ -20,7 +20,7 @@ #ifndef DHTTASK_H #define DHTTASK_H -#include <qvaluelist.h> +#include <tqvaluelist.h> #include "rpccall.h" //#include "kbucket.h" @@ -49,6 +49,7 @@ namespace dht class Task : public RPCCallListener { Q_OBJECT + TQ_OBJECT public: /** * Create a task. @@ -134,7 +135,7 @@ namespace dht * @param ip The ip or hostname of the node * @param port The port */ - void addDHTNode(const QString & ip,bt::Uint16 port); + void addDHTNode(const TQString & ip,bt::Uint16 port); signals: /** @@ -157,8 +158,8 @@ namespace dht void onResolverResults(KResolverResults res); protected: - QValueList<KBucketEntry> visited; // nodes visited - QValueList<KBucketEntry> todo; // nodes todo + TQValueList<KBucketEntry> visited; // nodes visited + TQValueList<KBucketEntry> todo; // nodes todo Node* node; private: diff --git a/libktorrent/kademlia/taskmanager.cpp b/libktorrent/kademlia/taskmanager.cpp index f71fc0d..4e1e21a 100644 --- a/libktorrent/kademlia/taskmanager.cpp +++ b/libktorrent/kademlia/taskmanager.cpp @@ -54,14 +54,14 @@ namespace dht void TaskManager::removeFinishedTasks(const DHT* dh_table) { - QValueList<Uint32> rm; + TQValueList<Uint32> rm; for (TaskItr i = tasks.begin();i != tasks.end();i++) { if (i->second->isFinished()) rm.append(i->first); } - for (QValueList<Uint32>::iterator i = rm.begin();i != rm.end();i++) + for (TQValueList<Uint32>::iterator i = rm.begin();i != rm.end();i++) { tasks.erase(*i); } diff --git a/libktorrent/kademlia/taskmanager.h b/libktorrent/kademlia/taskmanager.h index 3df52b6..5349d8c 100644 --- a/libktorrent/kademlia/taskmanager.h +++ b/libktorrent/kademlia/taskmanager.h @@ -20,7 +20,7 @@ #ifndef DHTTASKMANAGER_H #define DHTTASKMANAGER_H -#include <qptrlist.h> +#include <tqptrlist.h> #include <util/ptrmap.h> #include <util/constants.h> #include "task.h" @@ -60,7 +60,7 @@ namespace dht private: bt::PtrMap<Uint32,Task> tasks; - QPtrList<Task> queued; + TQPtrList<Task> queued; bt::Uint32 next_id; }; diff --git a/libktorrent/ktorrent.kcfg b/libktorrent/ktorrent.kcfg index 7d451b3..2d1e9b2 100644 --- a/libktorrent/ktorrent.kcfg +++ b/libktorrent/ktorrent.kcfg @@ -92,7 +92,7 @@ </entry> <entry name="tempDir" type="String"> <label>Folder to store temporary files</label> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="useSaveDir" type="Bool"> <label>Whether to automatically save downloads to saveDir</label> @@ -100,7 +100,7 @@ </entry> <entry name="saveDir" type="String"> <label>Folder to store downloaded files</label> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="useCompletedDir" type="Bool"> <label>Whether to automatically move completed downloads to completedDir</label> @@ -108,7 +108,7 @@ </entry> <entry name="completedDir" type="String"> <label>Folder to move completed downloaded files to</label> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="useTorrentCopyDir" type="Bool"> <label>Whether to automatically copy .torrent files to torrentCopyDir</label> @@ -116,7 +116,7 @@ </entry> <entry name="torrentCopyDir" type="String"> <label>Folder to copy .torrent files to</label> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="useExternalIP" type="Bool"> <label>Whether to use a custom IP to pass to the tracker</label> @@ -124,11 +124,11 @@ </entry> <entry name="lastSaveDir" type="String"> <label>Directory which was used as the last save directory</label> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="externalIP" type="String"> <label>IP to pass to the tracker</label> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="memoryUsage" type="Int"> <label>Memory usage</label> @@ -199,7 +199,7 @@ <default>false</default> </entry> <entry name="httpTrackerProxy" type="String"> - <default code="true">QString::null</default> + <default code="true">TQString::null</default> </entry> <entry name="eta" type="Int"> <label>ET algorithm</label> diff --git a/libktorrent/labelview.cpp b/libktorrent/labelview.cpp index 10c46d5..e33d448 100644 --- a/libktorrent/labelview.cpp +++ b/libktorrent/labelview.cpp @@ -18,8 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include <algorithm> -#include <qlayout.h> -#include <qlabel.h> +#include <tqlayout.h> +#include <tqlabel.h> #include <kiconloader.h> #include <kglobalsettings.h> #include <util/log.h> @@ -29,7 +29,7 @@ using namespace bt; namespace kt { - LabelViewItem::LabelViewItem(const QString & icon,const QString & title,const QString & description,LabelView* view) + LabelViewItem::LabelViewItem(const TQString & icon,const TQString & title,const TQString & description,LabelView* view) : LabelViewItemBase(view),odd(false),selected(false) { icon_lbl->setPixmap(DesktopIcon(icon)); @@ -42,17 +42,17 @@ namespace kt { } - void LabelViewItem::setTitle(const QString & title) + void LabelViewItem::setTitle(const TQString & title) { title_lbl->setText(title); } - void LabelViewItem::setDescription(const QString & d) + void LabelViewItem::setDescription(const TQString & d) { description_lbl->setText(d); } - void LabelViewItem::setIcon(const QString & icon) + void LabelViewItem::setIcon(const TQString & icon) { icon_lbl->setPixmap(DesktopIcon(icon)); } @@ -89,29 +89,29 @@ namespace kt return title_lbl->text() < item.title_lbl->text(); } - void LabelViewItem::mousePressEvent(QMouseEvent *e) + void LabelViewItem::mousePressEvent(TQMouseEvent *e) { - if (e->button() == QMouseEvent::LeftButton) + if (e->button() == Qt::LeftButton) { clicked(this); } setFocus(); - QWidget::mousePressEvent(e); + TQWidget::mousePressEvent(e); } typedef std::list<LabelViewItem*>::iterator LabelViewItr; typedef std::list<LabelViewItem*>::const_iterator LabelViewCItr; - class LabelViewBox : public QWidget + class LabelViewBox : public TQWidget { - QVBoxLayout* layout; + TQVBoxLayout* tqlayout; public: - LabelViewBox(QWidget* parent) : QWidget(parent) + LabelViewBox(TQWidget* tqparent) : TQWidget(tqparent) { setPaletteBackgroundColor(KGlobalSettings::baseColor()); - layout = new QVBoxLayout(this); - layout->setMargin(0); + tqlayout = new TQVBoxLayout(this); + tqlayout->setMargin(0); } virtual ~LabelViewBox() @@ -119,25 +119,25 @@ namespace kt void add(LabelViewItem* item) { - item->reparent(this,QPoint(0,0)); - layout->add(item); + item->reparent(this,TQPoint(0,0)); + tqlayout->add(item); item->show(); } void remove(LabelViewItem* item) { item->hide(); - layout->remove(item); - item->reparent(0,QPoint(0,0)); + tqlayout->remove(item); + item->reparent(0,TQPoint(0,0)); } void sorted(const std::list<LabelViewItem*> items) { for (LabelViewCItr i = items.begin();i != items.end();i++) - layout->remove(*i); + tqlayout->remove(*i); for (LabelViewCItr i = items.begin();i != items.end();i++) - layout->add(*i); + tqlayout->add(*i); } }; @@ -145,11 +145,11 @@ namespace kt /////////////////////////////////////// - LabelView::LabelView ( QWidget *parent, const char *name ) - : QScrollView ( parent, name ),selected(0) + LabelView::LabelView ( TQWidget *tqparent, const char *name ) + : TQScrollView ( tqparent, name ),selected(0) { item_box = new LabelViewBox(this->viewport()); - setResizePolicy(QScrollView::AutoOneFit); + setResizePolicy(TQScrollView::AutoOneFit); addChild(item_box, 0, 0); item_box->show(); @@ -165,8 +165,8 @@ namespace kt items.push_back(item); item->setOdd(items.size() % 2 == 1); - connect(item, SIGNAL(clicked(LabelViewItem*)), - this, SLOT(onItemClicked(LabelViewItem*))); + connect(item, TQT_SIGNAL(clicked(LabelViewItem*)), + this, TQT_SLOT(onItemClicked(LabelViewItem*))); } void LabelView::removeItem(LabelViewItem* item) @@ -176,19 +176,19 @@ namespace kt { item_box->remove(item); items.erase(i); - disconnect(item, SIGNAL(clicked(LabelViewItem*)), - this, SLOT(onItemClicked(LabelViewItem*))); + disconnect(item, TQT_SIGNAL(clicked(LabelViewItem*)), + this, TQT_SLOT(onItemClicked(LabelViewItem*))); // check for selected being equal to item if (item == selected) selected = 0; // update odd status of each item - updateOddStatus(); + updateOddtqStatus(); } } - void LabelView::updateOddStatus() + void LabelView::updateOddtqStatus() { bool odd = true; LabelViewItr i = items.begin(); @@ -250,7 +250,7 @@ namespace kt { items.sort(LabelViewItemCmp()); item_box->sorted(items); - updateOddStatus(); + updateOddtqStatus(); } } diff --git a/libktorrent/labelview.h b/libktorrent/labelview.h index 5e83213..04ddf92 100644 --- a/libktorrent/labelview.h +++ b/libktorrent/labelview.h @@ -21,12 +21,12 @@ #define KTLABELVIEW_H #include <list> -#include <qscrollview.h> +#include <tqscrollview.h> #include "labelviewitembase.h" -class QLabel; -class QHBoxLayout; -class QVBoxLayout; +class TQLabel; +class TQHBoxLayout; +class TQVBoxLayout; namespace kt { @@ -38,18 +38,19 @@ namespace kt class LabelViewItem : public LabelViewItemBase { Q_OBJECT + TQ_OBJECT public: - LabelViewItem(const QString & icon,const QString & title,const QString & description,LabelView* view); + LabelViewItem(const TQString & icon,const TQString & title,const TQString & description,LabelView* view); virtual ~LabelViewItem(); /// Set the title of the item - void setTitle(const QString & title); + void setTitle(const TQString & title); /// Set the description - void setDescription(const QString & d); + void setDescription(const TQString & d); /// Set the name of the icon - void setIcon(const QString & icon); + void setIcon(const TQString & icon); /// Set if this is an odd item (they have a different background color) void setOdd(bool odd); @@ -64,7 +65,7 @@ namespace kt virtual bool operator < (const LabelViewItem & item); private: - virtual void mousePressEvent(QMouseEvent *e); + virtual void mousePressEvent(TQMouseEvent *e); signals: void clicked(LabelViewItem* item); @@ -79,11 +80,12 @@ namespace kt /** @author Joris Guisson <[email protected]> */ - class LabelView : public QScrollView + class LabelView : public TQScrollView { Q_OBJECT + TQ_OBJECT public: - LabelView(QWidget *parent = 0, const char *name = 0); + LabelView(TQWidget *tqparent = 0, const char *name = 0); virtual ~LabelView(); /// Add an item to the label view @@ -108,7 +110,7 @@ namespace kt void onItemClicked(LabelViewItem* it); private: - void updateOddStatus(); + void updateOddtqStatus(); signals: /// The current item has changed diff --git a/libktorrent/labelviewitembase.ui b/libktorrent/labelviewitembase.ui index 174803f..5937dc8 100644 --- a/libktorrent/labelviewitembase.ui +++ b/libktorrent/labelviewitembase.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>LabelViewItemBase</class> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>LabelViewItemBase</cstring> </property> @@ -19,11 +19,11 @@ <property name="margin"> <number>2</number> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>icon_lbl</cstring> </property> - <property name="minimumSize"> + <property name="tqminimumSize"> <size> <width>64</width> <height>64</height> @@ -33,15 +33,15 @@ <string></string> </property> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout3</cstring> + <cstring>tqlayout3</cstring> </property> <vbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>title_lbl</cstring> </property> @@ -49,7 +49,7 @@ <string>textLabel2</string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>description_lbl</cstring> </property> @@ -69,5 +69,5 @@ </widget> </hbox> </widget> -<layoutdefaults spacing="6" margin="11"/> +<tqlayoutdefaults spacing="6" margin="11"/> </UI> diff --git a/libktorrent/migrate/cachemigrate.cpp b/libktorrent/migrate/cachemigrate.cpp index f9b203c..9006e2a 100644 --- a/libktorrent/migrate/cachemigrate.cpp +++ b/libktorrent/migrate/cachemigrate.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qstringlist.h> -#include <qfileinfo.h> +#include <tqstringlist.h> +#include <tqfileinfo.h> #include <util/log.h> #include <util/fileops.h> #include <util/functions.h> @@ -30,21 +30,21 @@ namespace bt { - bool IsCacheMigrateNeeded(const Torrent & tor,const QString & cache) + bool IsCacheMigrateNeeded(const Torrent & tor,const TQString & cache) { // mutli files always need to be migrated if (tor.isMultiFile()) return true; // a single file and a symlink do not need to be migrated - QFileInfo finfo(cache); + TQFileInfo finfo(cache); if (finfo.isSymLink()) return false; return true; } - static void MigrateSingleCache(const Torrent & tor,const QString & cache,const QString & output_dir) + static void MigrateSingleCache(const Torrent & tor,const TQString & cache,const TQString & output_dir) { Out() << "Migrating single cache " << cache << " to " << output_dir << endl; @@ -52,12 +52,12 @@ namespace bt bt::SymLink(output_dir + tor.getNameSuggestion(),cache); } - static void MakePath(const QString & startdir,const QString & path) + static void MakePath(const TQString & startdir,const TQString & path) { - QStringList sl = QStringList::split(bt::DirSeparator(),path); + TQStringList sl = TQStringList::split(bt::DirSeparator(),path); // create all necessary subdirs - QString ctmp = startdir; + TQString ctmp = startdir; for (Uint32 i = 0;i < sl.count() - 1;i++) { @@ -71,22 +71,22 @@ namespace bt } } - static void MigrateMultiCache(const Torrent & tor,const QString & cache,const QString & output_dir) + static void MigrateMultiCache(const Torrent & tor,const TQString & cache,const TQString & output_dir) { Out() << "Migrating multi cache " << cache << " to " << output_dir << endl; // if the cache dir is a symlink, everything is OK - if (QFileInfo(cache).isSymLink()) + if (TQFileInfo(cache).isSymLink()) return; - QString cache_dir = cache; + TQString cache_dir = cache; // make the output dir if it does not exists if (!bt::Exists(output_dir + tor.getNameSuggestion())) bt::MakeDir(output_dir + tor.getNameSuggestion()); - QString odir = output_dir + tor.getNameSuggestion() + bt::DirSeparator(); - QString cdir = cache; + TQString odir = output_dir + tor.getNameSuggestion() + bt::DirSeparator(); + TQString cdir = cache; if (!cdir.endsWith(bt::DirSeparator())) cdir += bt::DirSeparator(); @@ -94,7 +94,7 @@ namespace bt for (Uint32 i = 0;i < tor.getNumFiles();i++) { const TorrentFile & tf = tor.getFile(i); - QFileInfo fi(cdir + tf.getPath()); + TQFileInfo fi(cdir + tf.getPath()); // symlinks are OK if (fi.isSymLink()) continue; @@ -106,9 +106,9 @@ namespace bt } } - void MigrateCache(const Torrent & tor,const QString & cache,const QString & output_dir) + void MigrateCache(const Torrent & tor,const TQString & cache,const TQString & output_dir) { - QString odir = output_dir; + TQString odir = output_dir; if (!odir.endsWith(bt::DirSeparator())) odir += bt::DirSeparator(); diff --git a/libktorrent/migrate/cachemigrate.h b/libktorrent/migrate/cachemigrate.h index 3eea231..fc618f1 100644 --- a/libktorrent/migrate/cachemigrate.h +++ b/libktorrent/migrate/cachemigrate.h @@ -25,10 +25,10 @@ namespace bt class Torrent; /// See if a cache migrate is needed - bool IsCacheMigrateNeeded(const Torrent & tor,const QString & cache); + bool IsCacheMigrateNeeded(const Torrent & tor,const TQString & cache); /// Migrate the cache - void MigrateCache(const Torrent & tor,const QString & cache,const QString & output_dir); + void MigrateCache(const Torrent & tor,const TQString & cache,const TQString & output_dir); } #endif diff --git a/libktorrent/migrate/ccmigrate.cpp b/libktorrent/migrate/ccmigrate.cpp index 80153bf..3975de4 100644 --- a/libktorrent/migrate/ccmigrate.cpp +++ b/libktorrent/migrate/ccmigrate.cpp @@ -33,7 +33,7 @@ namespace bt { - bool IsPreMMap(const QString & current_chunks) + bool IsPreMMap(const TQString & current_chunks) { File fptr; if (!fptr.open(current_chunks,"rb")) @@ -110,19 +110,19 @@ namespace bt return true; } - static void MigrateCC(const Torrent & tor,const QString & current_chunks) + static void MigrateCC(const Torrent & tor,const TQString & current_chunks) { Out() << "Migrating current_chunks file " << current_chunks << endl; // open the old current_chunks file File old_cc; if (!old_cc.open(current_chunks,"rb")) - throw Error(i18n("Cannot open file %1 : %2").arg(current_chunks).arg(old_cc.errorString())); + throw Error(i18n("Cannot open file %1 : %2").tqarg(current_chunks).tqarg(old_cc.errorString())); // open a new file in the /tmp dir File new_cc; - QString tmp = current_chunks + ".tmp"; + TQString tmp = current_chunks + ".tmp"; if (!new_cc.open(tmp,"wb")) - throw Error(i18n("Cannot open file %1 : %2").arg(tmp).arg(old_cc.errorString())); + throw Error(i18n("Cannot open file %1 : %2").tqarg(tmp).tqarg(old_cc.errorString())); // read the number of chunks Uint32 num = 0; @@ -150,7 +150,7 @@ namespace bt bt::Move(tmp,current_chunks); } - void MigrateCurrentChunks(const Torrent & tor,const QString & current_chunks) + void MigrateCurrentChunks(const Torrent & tor,const TQString & current_chunks) { try { diff --git a/libktorrent/migrate/ccmigrate.h b/libktorrent/migrate/ccmigrate.h index 890bdfa..5272bf5 100644 --- a/libktorrent/migrate/ccmigrate.h +++ b/libktorrent/migrate/ccmigrate.h @@ -25,11 +25,11 @@ namespace bt class Torrent; /// Migrates the current_chunks file to the post-mmap era. - void MigrateCurrentChunks(const Torrent & tor,const QString & current_chunks); + void MigrateCurrentChunks(const Torrent & tor,const TQString & current_chunks); /// Test if a current_chunks file is from the pre-mmap period - bool IsPreMMap(const QString & current_chunks); + bool IsPreMMap(const TQString & current_chunks); } diff --git a/libktorrent/migrate/migrate.cpp b/libktorrent/migrate/migrate.cpp index eddde83..a59f83c 100644 --- a/libktorrent/migrate/migrate.cpp +++ b/libktorrent/migrate/migrate.cpp @@ -38,14 +38,14 @@ namespace bt Migrate::~Migrate() {} - void Migrate::migrate(const Torrent & tor,const QString & tor_dir,const QString & sdir) + void Migrate::migrate(const Torrent & tor,const TQString & tor_dir,const TQString & sdir) { // check if directory exists if (!bt::Exists(tor_dir)) - throw Error(i18n("The directory %1 does not exist").arg(tor_dir)); + throw Error(i18n("The directory %1 does not exist").tqarg(tor_dir)); // make sure it ends with a / - QString tdir = tor_dir; + TQString tdir = tor_dir; if (!tdir.endsWith(bt::DirSeparator())) tdir += bt::DirSeparator(); diff --git a/libktorrent/migrate/migrate.h b/libktorrent/migrate/migrate.h index ef862ec..8a943b4 100644 --- a/libktorrent/migrate/migrate.h +++ b/libktorrent/migrate/migrate.h @@ -42,10 +42,10 @@ namespace bt * @param sdir The save directory * @throw Error if something goes wrong */ - void migrate(const Torrent & tor,const QString & tor_dir,const QString & sdir); + void migrate(const Torrent & tor,const TQString & tor_dir,const TQString & sdir); private: - bool preMMap(const QString & current_chunks); - void migrateCurrentChunks(const QString & current_chunks); + bool preMMap(const TQString & current_chunks); + void migrateCurrentChunks(const TQString & current_chunks); }; } diff --git a/libktorrent/mse/bigint.cpp b/libktorrent/mse/bigint.cpp index 90c6d9e..e2746f6 100644 --- a/libktorrent/mse/bigint.cpp +++ b/libktorrent/mse/bigint.cpp @@ -36,7 +36,7 @@ namespace mse mpz_init2(val,num_bits); } - BigInt::BigInt(const QString & value) + BigInt::BigInt(const TQString & value) { mpz_init2(val,(value.length() - 2)*4); mpz_set_str(val,value.ascii(),0); diff --git a/libktorrent/mse/bigint.h b/libktorrent/mse/bigint.h index ad94d20..39bb865 100644 --- a/libktorrent/mse/bigint.h +++ b/libktorrent/mse/bigint.h @@ -20,7 +20,7 @@ #ifndef MSEBIGINT_H #define MSEBIGINT_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> #include <stdio.h> #include <gmp.h> @@ -57,7 +57,7 @@ namespace mse * Letters can be upper or lower case. Invalid chars will create an invalid number. * @param value The hexadecimal representation of the number */ - BigInt(const QString & value); + BigInt(const TQString & value); /** * Copy constructor. diff --git a/libktorrent/mse/encryptedauthenticate.cpp b/libktorrent/mse/encryptedauthenticate.cpp index 644ba7b..e60aa22 100644 --- a/libktorrent/mse/encryptedauthenticate.cpp +++ b/libktorrent/mse/encryptedauthenticate.cpp @@ -36,7 +36,7 @@ namespace mse EncryptedAuthenticate::EncryptedAuthenticate( - const QString& ip, + const TQString& ip, Uint16 port, const SHA1Hash& info_hash, const PeerID& peer_id, diff --git a/libktorrent/mse/encryptedauthenticate.h b/libktorrent/mse/encryptedauthenticate.h index 74ccc1b..1ab8192 100644 --- a/libktorrent/mse/encryptedauthenticate.h +++ b/libktorrent/mse/encryptedauthenticate.h @@ -39,8 +39,9 @@ namespace mse class EncryptedAuthenticate : public bt::Authenticate { Q_OBJECT + TQ_OBJECT public: - EncryptedAuthenticate(const QString& ip, Uint16 port, const bt::SHA1Hash& info_hash, const bt::PeerID& peer_id, bt::PeerManager* pman); + EncryptedAuthenticate(const TQString& ip, Uint16 port, const bt::SHA1Hash& info_hash, const bt::PeerID& peer_id, bt::PeerManager* pman); virtual ~EncryptedAuthenticate(); private slots: diff --git a/libktorrent/mse/encryptedserverauthenticate.h b/libktorrent/mse/encryptedserverauthenticate.h index 3c358cd..b5df3ff 100644 --- a/libktorrent/mse/encryptedserverauthenticate.h +++ b/libktorrent/mse/encryptedserverauthenticate.h @@ -36,6 +36,7 @@ namespace mse class EncryptedServerAuthenticate : public bt::ServerAuthenticate { Q_OBJECT + TQ_OBJECT public: EncryptedServerAuthenticate(mse::StreamSocket* sock, bt::Server* server); virtual ~EncryptedServerAuthenticate(); diff --git a/libktorrent/mse/functions.cpp b/libktorrent/mse/functions.cpp index bb19b93..d9ed5cf 100644 --- a/libktorrent/mse/functions.cpp +++ b/libktorrent/mse/functions.cpp @@ -58,7 +58,7 @@ namespace mse return bt::SHA1Hash::generate(buf,120); } - void DumpBigInt(const QString & name,const BigInt & bi) + void DumpBigInt(const TQString & name,const BigInt & bi) { static Uint8 buf[512]; Uint32 nb = bi.toBuffer(buf,512); @@ -66,7 +66,7 @@ namespace mse lg << name << " (" << nb << ") = "; for (Uint32 i = 0;i < nb;i++) { - lg << QString("0x%1 ").arg(buf[i],0,16); + lg << TQString("0x%1 ").tqarg(buf[i],0,16); } lg << endl; } diff --git a/libktorrent/mse/functions.h b/libktorrent/mse/functions.h index 4be1667..95e8e5d 100644 --- a/libktorrent/mse/functions.h +++ b/libktorrent/mse/functions.h @@ -33,7 +33,7 @@ namespace mse BigInt DHSecret(const BigInt & our_priv,const BigInt & peer_pub); bt::SHA1Hash EncryptionKey(bool a,const BigInt & s,const bt::SHA1Hash & skey); - void DumpBigInt(const QString & name,const BigInt & bi); + void DumpBigInt(const TQString & name,const BigInt & bi); } #endif diff --git a/libktorrent/mse/streamsocket.cpp b/libktorrent/mse/streamsocket.cpp index 19a0a2e..08f2d7b 100644 --- a/libktorrent/mse/streamsocket.cpp +++ b/libktorrent/mse/streamsocket.cpp @@ -18,8 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include <errno.h> -#include <qsocket.h> -#include <qsocketdevice.h> +#include <tqsocket.h> +#include <tqsocketdevice.h> #include <util/sha1hash.h> #include <util/log.h> #include <torrent/peer.h> @@ -181,7 +181,7 @@ namespace mse sock->close(); } - bool StreamSocket::connectTo(const QString & ip,Uint16 port) + bool StreamSocket::connectTo(const TQString & ip,Uint16 port) { // do a safety check if (ip.isNull() || ip.length() == 0) @@ -221,7 +221,7 @@ namespace mse return sock->ok(); } - QString StreamSocket::getRemoteIPAddress() const + TQString StreamSocket::getRemoteIPAddress() const { return sock->getPeerName().toString(); } diff --git a/libktorrent/mse/streamsocket.h b/libktorrent/mse/streamsocket.h index 5006a7b..6cfa6d8 100644 --- a/libktorrent/mse/streamsocket.h +++ b/libktorrent/mse/streamsocket.h @@ -20,11 +20,11 @@ #ifndef MSESTREAMSOCKET_H #define MSESTREAMSOCKET_H -#include <qobject.h> +#include <tqobject.h> #include <util/constants.h> #include <net/bufferedsocket.h> -class QString; +class TQString; using bt::Uint8; using bt::Uint16; @@ -52,9 +52,10 @@ namespace mse * not be used anymore, a SocketReader and SocketWriter should be provided, * so that reading and writing is controlled from the monitor thread. */ - class StreamSocket : public QObject,public net::SocketReader,public net::SocketWriter + class StreamSocket : public TQObject,public net::SocketReader,public net::SocketWriter { Q_OBJECT + TQ_OBJECT public: StreamSocket(); StreamSocket(int fd); @@ -99,10 +100,10 @@ namespace mse void close(); /// Connect the socket to a remote host - bool connectTo(const QString & ip,Uint16 port); + bool connectTo(const TQString & ip,Uint16 port); /// Get the IP address of the remote peer - QString getRemoteIPAddress() const; + TQString getRemoteIPAddress() const; /// Get the port of the remote peer bt::Uint16 getRemotePort() const; diff --git a/libktorrent/net/address.cpp b/libktorrent/net/address.cpp index 4a4da3c..e1de8d0 100644 --- a/libktorrent/net/address.cpp +++ b/libktorrent/net/address.cpp @@ -27,7 +27,7 @@ namespace net Address::Address() : m_ip(0),m_port(0) {} - Address::Address(const QString & host,Uint16 port) : m_ip(0),m_port(port) + Address::Address(const TQString & host,Uint16 port) : m_ip(0),m_port(port) { struct in_addr a; if (inet_aton(host.ascii(),&a)) @@ -55,13 +55,13 @@ namespace net return m_ip == a.ip() && m_port == a.port(); } - QString Address::toString() const + TQString Address::toString() const { - return QString("%1.%2.%3.%4") - .arg((m_ip & 0xFF000000) >> 24) - .arg((m_ip & 0x00FF0000) >> 16) - .arg((m_ip & 0x0000FF00) >> 8) - .arg(m_ip & 0x000000FF); + return TQString("%1.%2.%3.%4") + .tqarg((m_ip & 0xFF000000) >> 24) + .tqarg((m_ip & 0x00FF0000) >> 16) + .tqarg((m_ip & 0x0000FF00) >> 8) + .tqarg(m_ip & 0x000000FF); } } diff --git a/libktorrent/net/address.h b/libktorrent/net/address.h index 28c4e2c..af39380 100644 --- a/libktorrent/net/address.h +++ b/libktorrent/net/address.h @@ -20,7 +20,7 @@ #ifndef NETADDRESS_H #define NETADDRESS_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace net @@ -37,7 +37,7 @@ namespace net Uint16 m_port; public: Address(); - Address(const QString & host,Uint16 port); + Address(const TQString & host,Uint16 port); Address(const Address & addr); virtual ~Address(); @@ -51,7 +51,7 @@ namespace net Uint16 port() const {return m_port;} void setPort(Uint16 p) {m_port = p;} - QString toString() const; + TQString toString() const; }; diff --git a/libktorrent/net/bufferedsocket.h b/libktorrent/net/bufferedsocket.h index 2c0c3ec..2e594df 100644 --- a/libktorrent/net/bufferedsocket.h +++ b/libktorrent/net/bufferedsocket.h @@ -20,7 +20,7 @@ #ifndef NETBUFFEREDSOCKET_H #define NETBUFFEREDSOCKET_H -#include <qmutex.h> +#include <tqmutex.h> #include <net/socket.h> namespace net @@ -72,7 +72,7 @@ namespace net */ class BufferedSocket : public Socket { - mutable QMutex mutex; + mutable TQMutex mutex; SocketReader* rdr; SocketWriter* wrt; Uint8* output_buffer; diff --git a/libktorrent/net/circularbuffer.h b/libktorrent/net/circularbuffer.h index 63e271e..6d45723 100644 --- a/libktorrent/net/circularbuffer.h +++ b/libktorrent/net/circularbuffer.h @@ -20,7 +20,7 @@ #ifndef NETCIRCULARBUFFER_H #define NETCIRCULARBUFFER_H -#include <qmutex.h> +#include <tqmutex.h> #include <util/constants.h> namespace net @@ -43,7 +43,7 @@ namespace net Uint32 max_size; Uint32 first; // index of first byte in the buffer Uint32 size; // number of bytes in use - mutable QMutex mutex; + mutable TQMutex mutex; public: /** * Create the buffer. diff --git a/libktorrent/net/downloadthread.cpp b/libktorrent/net/downloadthread.cpp index ae0f0b9..2adf1a8 100644 --- a/libktorrent/net/downloadthread.cpp +++ b/libktorrent/net/downloadthread.cpp @@ -61,9 +61,9 @@ namespace net { // add to the correct group Uint32 gid = s->downloadGroupID(); - SocketGroup* g = groups.find(gid); + SocketGroup* g = groups.tqfind(gid); if (!g) - g = groups.find(0); + g = groups.tqfind(0); g->add(s); num_ready++; diff --git a/libktorrent/net/networkthread.cpp b/libktorrent/net/networkthread.cpp index 40791c9..0a48af9 100644 --- a/libktorrent/net/networkthread.cpp +++ b/libktorrent/net/networkthread.cpp @@ -51,7 +51,7 @@ namespace net void NetworkThread::addGroup(Uint32 gid,Uint32 limit) { // if group already exists, just change the limit - SocketGroup* g = groups.find(gid); + SocketGroup* g = groups.tqfind(gid); if (g) { g->setLimit(limit); @@ -72,7 +72,7 @@ namespace net void NetworkThread::setGroupLimit(Uint32 gid,Uint32 limit) { - SocketGroup* g = groups.find(gid); + SocketGroup* g = groups.tqfind(gid); if (g) { g->setLimit(limit); diff --git a/libktorrent/net/networkthread.h b/libktorrent/net/networkthread.h index 7472c15..d31ae3e 100644 --- a/libktorrent/net/networkthread.h +++ b/libktorrent/net/networkthread.h @@ -20,7 +20,7 @@ #ifndef NETNETWORKTHREAD_H #define NETNETWORKTHREAD_H -#include <qthread.h> +#include <tqthread.h> #include <util/constants.h> #include <util/ptrmap.h> @@ -37,7 +37,7 @@ namespace net Base class for the 2 networking threads. Handles the socket groups. */ - class NetworkThread : public QThread + class NetworkThread : public TQThread { protected: SocketMonitor* sm; diff --git a/libktorrent/net/portlist.cpp b/libktorrent/net/portlist.cpp index 56076ed..6fa4f6a 100644 --- a/libktorrent/net/portlist.cpp +++ b/libktorrent/net/portlist.cpp @@ -58,7 +58,7 @@ namespace net void PortList::removePort(bt::Uint16 number,Protocol proto) { - PortList::iterator itr = find(Port(number,proto,false)); + PortList::iterator itr = tqfind(Port(number,proto,false)); if (itr == end()) return; diff --git a/libktorrent/net/portlist.h b/libktorrent/net/portlist.h index af60c1c..c1a6e99 100644 --- a/libktorrent/net/portlist.h +++ b/libktorrent/net/portlist.h @@ -20,7 +20,7 @@ #ifndef NETPORTLIST_H #define NETPORTLIST_H -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <util/constants.h> namespace net @@ -69,7 +69,7 @@ namespace net * List of ports which are currently being used. * */ - class PortList : public QValueList<Port> + class PortList : public TQValueList<Port> { PortListener* lst; public: diff --git a/libktorrent/net/socket.cpp b/libktorrent/net/socket.cpp index b9a53f3..ff09a34 100644 --- a/libktorrent/net/socket.cpp +++ b/libktorrent/net/socket.cpp @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qglobal.h> +#include <tqglobal.h> #include <unistd.h> #include <string.h> @@ -39,7 +39,7 @@ #endif #ifndef MSG_NOSIGNAL -#define MSG_NOSIGNAL 0 +#define MSG_NOTQT_SIGNAL 0 #endif #include <unistd.h> @@ -60,7 +60,7 @@ namespace net int val = 1; if (setsockopt(m_fd,SOL_SOCKET,SO_NOSIGPIPE,&val,sizeof(int)) < 0) { - Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the NOSIGPIPE option : %1").arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set the NOSIGPIPE option : %1").tqarg(strerror(errno)) << endl; } #endif cacheAddress(); @@ -71,14 +71,14 @@ namespace net int fd = socket(PF_INET,tcp ? SOCK_STREAM : SOCK_DGRAM,0); if (fd < 0) { - Out(SYS_GEN|LOG_IMPORTANT) << QString("Cannot create socket : %1").arg(strerror(errno)) << endl; + Out(SYS_GEN|LOG_IMPORTANT) << TQString("Cannot create socket : %1").tqarg(strerror(errno)) << endl; } m_fd = fd; #if defined(Q_OS_MACX) || defined(Q_OS_DARWIN) || (defined(Q_OS_FREEBSD) && !defined(__DragonFly__) && __FreeBSD_version < 600020) int val = 1; if (setsockopt(m_fd,SOL_SOCKET,SO_NOSIGPIPE,&val,sizeof(int)) < 0) { - Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the NOSIGPIPE option : %1").arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set the NOSIGPIPE option : %1").tqarg(strerror(errno)) << endl; } #endif } @@ -126,8 +126,8 @@ namespace net } else { - Out(SYS_CON|LOG_NOTICE) << QString("Cannot connect to host %1:%2 : %3") - .arg(a.toString()).arg(a.port()).arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_NOTICE) << TQString("Cannot connect to host %1:%2 : %3") + .tqarg(a.toString()).tqarg(a.port()).tqarg(strerror(errno)) << endl; return false; } } @@ -145,20 +145,20 @@ namespace net if (::bind(m_fd,(struct sockaddr*)&addr,sizeof(struct sockaddr)) < 0) { - Out(SYS_CON|LOG_IMPORTANT) << QString("Cannot bind to port %1 : %2").arg(port).arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_IMPORTANT) << TQString("Cannot bind to port %1 : %2").tqarg(port).tqarg(strerror(errno)) << endl; return false; } if (also_listen && listen(m_fd,5) < 0) { - Out(SYS_CON|LOG_IMPORTANT) << QString("Cannot listen to port %1 : %2").arg(port).arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_IMPORTANT) << TQString("Cannot listen to port %1 : %2").tqarg(port).tqarg(strerror(errno)) << endl; return false; } int val = 1; if (setsockopt(m_fd,SOL_SOCKET,SO_REUSEADDR,&val,sizeof(int)) < 0) { - Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the reuseaddr option : %1").arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set the reuseaddr option : %1").tqarg(strerror(errno)) << endl; } m_state = BOUND; return true; @@ -171,7 +171,7 @@ namespace net { if (errno != EAGAIN && errno != EWOULDBLOCK) { - // Out(SYS_CON|LOG_DEBUG) << "Send error : " << QString(strerror(errno)) << endl; + // Out(SYS_CON|LOG_DEBUG) << "Send error : " << TQString(strerror(errno)) << endl; close(); } return 0; @@ -186,7 +186,7 @@ namespace net { if (errno != EAGAIN && errno != EWOULDBLOCK) { - // Out(SYS_CON|LOG_DEBUG) << "Receive error : " << QString(strerror(errno)) << endl; + // Out(SYS_CON|LOG_DEBUG) << "Receive error : " << TQString(strerror(errno)) << endl; close(); } return 0; @@ -215,7 +215,7 @@ namespace net int ret = ::sendto(m_fd,(char*)buf + ns,left,0,(struct sockaddr*)&addr,sizeof(struct sockaddr)); if (ret < 0) { - Out(SYS_CON|LOG_DEBUG) << "Send error : " << QString(strerror(errno)) << endl; + Out(SYS_CON|LOG_DEBUG) << "Send error : " << TQString(strerror(errno)) << endl; return 0; } @@ -233,7 +233,7 @@ namespace net int ret = ::recvfrom(m_fd,buf,max_len,0,(struct sockaddr*)&addr,&sl); if (ret < 0) { - Out(SYS_CON|LOG_DEBUG) << "Receive error : " << QString(strerror(errno)) << endl; + Out(SYS_CON|LOG_DEBUG) << "Receive error : " << TQString(strerror(errno)) << endl; return 0; } @@ -251,14 +251,14 @@ namespace net int sfd = ::accept(m_fd,(struct sockaddr*)&addr,&slen); if (sfd < 0) { - Out(SYS_CON|LOG_DEBUG) << "Accept error : " << QString(strerror(errno)) << endl; + Out(SYS_CON|LOG_DEBUG) << "Accept error : " << TQString(strerror(errno)) << endl; return -1; } a.setPort(ntohs(addr.sin_port)); a.setIP(ntohl(addr.sin_addr.s_addr)); - Out(SYS_CON|LOG_DEBUG) << "Accepted connection from " << QString(inet_ntoa(addr.sin_addr)) << endl; + Out(SYS_CON|LOG_DEBUG) << "Accepted connection from " << TQString(inet_ntoa(addr.sin_addr)) << endl; return sfd; } @@ -271,8 +271,8 @@ namespace net #endif if (setsockopt(m_fd,IPPROTO_IP,IP_TOS,&c,sizeof(c)) < 0) { - Out(SYS_CON|LOG_NOTICE) << QString("Failed to set TOS to %1 : %2") - .arg(type_of_service).arg(strerror(errno)) << endl; + Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set TOS to %1 : %2") + .tqarg(type_of_service).tqarg(strerror(errno)) << endl; return false; } return true; diff --git a/libktorrent/net/socketmonitor.cpp b/libktorrent/net/socketmonitor.cpp index 38225ab..123536a 100644 --- a/libktorrent/net/socketmonitor.cpp +++ b/libktorrent/net/socketmonitor.cpp @@ -96,7 +96,7 @@ namespace net void SocketMonitor::add(BufferedSocket* sock) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); bool start_threads = smap.count() == 0; smap.append(sock); @@ -106,15 +106,15 @@ namespace net Out(SYS_CON|LOG_DEBUG) << "Starting socketmonitor threads" << endl; if (!dt->isRunning()) - dt->start(QThread::IdlePriority); + dt->start(TQThread::IdlePriority); if (!ut->isRunning()) - ut->start(QThread::IdlePriority); + ut->start(TQThread::IdlePriority); } } void SocketMonitor::remove(BufferedSocket* sock) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); if (smap.count() == 0) return; diff --git a/libktorrent/net/socketmonitor.h b/libktorrent/net/socketmonitor.h index 79e4a2e..6fc63c1 100644 --- a/libktorrent/net/socketmonitor.h +++ b/libktorrent/net/socketmonitor.h @@ -21,8 +21,8 @@ #define NETSOCKETMONITOR_H -#include <qmutex.h> -#include <qptrlist.h> +#include <tqmutex.h> +#include <tqptrlist.h> #include <util/constants.h> @@ -44,10 +44,10 @@ namespace net { static SocketMonitor self; - QMutex mutex; + TQMutex mutex; UploadThread* ut; DownloadThread* dt; - QPtrList<BufferedSocket> smap; + TQPtrList<BufferedSocket> smap; Uint32 next_group_id; SocketMonitor(); @@ -90,7 +90,7 @@ namespace net */ void removeGroup(GroupType type,Uint32 gid); - typedef QPtrList<BufferedSocket>::iterator Itr; + typedef TQPtrList<BufferedSocket>::iterator Itr; /// Get the begin of the list of sockets Itr begin() {return smap.begin();} diff --git a/libktorrent/net/speed.cpp b/libktorrent/net/speed.cpp index aa57513..35fde9d 100644 --- a/libktorrent/net/speed.cpp +++ b/libktorrent/net/speed.cpp @@ -37,16 +37,16 @@ namespace net void Speed::onData(Uint32 b,bt::TimeStamp ts) { - dlrate.append(qMakePair(b,ts)); + dlrate.append(tqMakePair(b,ts)); bytes += b; } void Speed::update(bt::TimeStamp now) { - QValueList<QPair<Uint32,TimeStamp> >::iterator i = dlrate.begin(); + TQValueList<TQPair<Uint32,TimeStamp> >::iterator i = dlrate.begin(); while (i != dlrate.end()) { - QPair<Uint32,TimeStamp> & p = *i; + TQPair<Uint32,TimeStamp> & p = *i; if (now - p.second > SPEED_INTERVAL || now < p.second) { if (bytes >= p.first) // make sure we don't wrap around diff --git a/libktorrent/net/speed.h b/libktorrent/net/speed.h index d5825e9..a9ea561 100644 --- a/libktorrent/net/speed.h +++ b/libktorrent/net/speed.h @@ -20,8 +20,8 @@ #ifndef NETSPEED_H #define NETSPEED_H -#include <qpair.h> -#include <qvaluelist.h> +#include <tqpair.h> +#include <tqvaluelist.h> #include <util/constants.h> namespace net @@ -36,7 +36,7 @@ namespace net { float rate; bt::Uint32 bytes; - QValueList<QPair<bt::Uint32,bt::TimeStamp> > dlrate; + TQValueList<TQPair<bt::Uint32,bt::TimeStamp> > dlrate; public: Speed(); virtual ~Speed(); diff --git a/libktorrent/net/uploadthread.cpp b/libktorrent/net/uploadthread.cpp index 0023cf6..3d2fa0a 100644 --- a/libktorrent/net/uploadthread.cpp +++ b/libktorrent/net/uploadthread.cpp @@ -52,9 +52,9 @@ namespace net BufferedSocket* s = *itr; if (s && s->ok() && s->bytesReadyToWrite()) { - SocketGroup* g = groups.find(s->uploadGroupID()); + SocketGroup* g = groups.tqfind(s->uploadGroupID()); if (!g) - g = groups.find(0); + g = groups.tqfind(0); g->add(s); num_ready++; diff --git a/libktorrent/net/uploadthread.h b/libktorrent/net/uploadthread.h index 265abac..b273846 100644 --- a/libktorrent/net/uploadthread.h +++ b/libktorrent/net/uploadthread.h @@ -22,7 +22,7 @@ -#include <qwaitcondition.h> +#include <tqwaitcondition.h> #include "networkthread.h" namespace net @@ -38,7 +38,7 @@ namespace net static bt::Uint32 ucap; static bt::Uint32 sleep_time; - QWaitCondition data_ready; + TQWaitCondition data_ready; public: UploadThread(SocketMonitor* sm); virtual ~UploadThread(); diff --git a/libktorrent/pluginmanager.cpp b/libktorrent/pluginmanager.cpp index db9e0a3..2389162 100644 --- a/libktorrent/pluginmanager.cpp +++ b/libktorrent/pluginmanager.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qfile.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqtextstream.h> #include <kparts/componentfactory.h> #include <util/log.h> #include <util/error.h> @@ -61,7 +61,7 @@ namespace kt int errCode = 0; Plugin* plugin = KParts::ComponentFactory::createInstanceFromService<kt::Plugin> - (service, 0, 0, QStringList(),&errCode); + (service, 0, 0, TQStringList(),&errCode); if (!plugin) continue; @@ -70,8 +70,8 @@ namespace kt if (!plugin->versionCheck(kt::VERSION_STRING)) { Out(SYS_GEN|LOG_NOTICE) << - QString("Plugin %1 version does not match KTorrent version, unloading it.") - .arg(service->library()) << endl; + TQString("Plugin %1 version does not match KTorrent version, unloading it.") + .tqarg(service->library()) << endl; delete plugin; // unload the library again, no need to have it loaded @@ -80,7 +80,7 @@ namespace kt } unloaded.insert(plugin->getName(),plugin); - if (pltoload.contains(plugin->getName())) + if (pltoload.tqcontains(plugin->getName())) load(plugin->getName()); } @@ -93,9 +93,9 @@ namespace kt } - void PluginManager::load(const QString & name) + void PluginManager::load(const TQString & name) { - Plugin* p = unloaded.find(name); + Plugin* p = unloaded.tqfind(name); if (!p) return; @@ -112,9 +112,9 @@ namespace kt saveConfigFile(cfg_file); } - void PluginManager::unload(const QString & name) + void PluginManager::unload(const TQString & name) { - Plugin* p = plugins.find(name); + Plugin* p = plugins.tqfind(name); if (!p) return; @@ -146,7 +146,7 @@ namespace kt void PluginManager::loadAll() { - bt::PtrMap<QString,Plugin>::iterator i = unloaded.begin(); + bt::PtrMap<TQString,Plugin>::iterator i = unloaded.begin(); while (i != unloaded.end()) { Plugin* p = i->second; @@ -169,7 +169,7 @@ namespace kt bt::WaitJob* wjob = new WaitJob(2000); try { - bt::PtrMap<QString,Plugin>::iterator i = plugins.begin(); + bt::PtrMap<TQString,Plugin>::iterator i = plugins.begin(); while (i != plugins.end()) { Plugin* p = i->second; @@ -188,7 +188,7 @@ namespace kt } // then unload them - bt::PtrMap<QString,Plugin>::iterator i = plugins.begin(); + bt::PtrMap<TQString,Plugin>::iterator i = plugins.begin(); while (i != plugins.end()) { Plugin* p = i->second; @@ -205,7 +205,7 @@ namespace kt void PluginManager::updateGuiPlugins() { - bt::PtrMap<QString,Plugin>::iterator i = plugins.begin(); + bt::PtrMap<TQString,Plugin>::iterator i = plugins.begin(); while (i != plugins.end()) { Plugin* p = i->second; @@ -214,9 +214,9 @@ namespace kt } } - void PluginManager::fillPluginList(QPtrList<Plugin> & plist) + void PluginManager::fillPluginList(TQPtrList<Plugin> & plist) { - bt::PtrMap<QString,Plugin>::iterator i = plugins.begin(); + bt::PtrMap<TQString,Plugin>::iterator i = plugins.begin(); while (i != plugins.end()) { Plugin* p = i->second; @@ -234,13 +234,13 @@ namespace kt } } - bool PluginManager::isLoaded(const QString & name) const + bool PluginManager::isLoaded(const TQString & name) const { - const Plugin* p = plugins.find(name); + const Plugin* p = plugins.tqfind(name); return p != 0; } - void PluginManager::loadConfigFile(const QString & file) + void PluginManager::loadConfigFile(const TQString & file) { cfg_file = file; // make a default config file if doesn't exist @@ -250,19 +250,19 @@ namespace kt return; } - QFile f(file); + TQFile f(file); if (!f.open(IO_ReadOnly)) { - Out(SYS_GEN|LOG_DEBUG) << "Cannot open file " << file << " : " << f.errorString() << endl; + Out(SYS_GEN|LOG_DEBUG) << "Cannot open file " << file << " : " << TQString(f.errorString()) << endl; return; } pltoload.clear(); - QTextStream in(&f); + TQTextStream in(&f); while (!in.atEnd()) { - QString l = in.readLine(); + TQString l = in.readLine(); if (l.isNull()) break; @@ -270,18 +270,18 @@ namespace kt } } - void PluginManager::saveConfigFile(const QString & file) + void PluginManager::saveConfigFile(const TQString & file) { cfg_file = file; - QFile f(file); + TQFile f(file); if (!f.open(IO_WriteOnly)) { - Out(SYS_GEN|LOG_DEBUG) << "Cannot open file " << file << " : " << f.errorString() << endl; + Out(SYS_GEN|LOG_DEBUG) << "Cannot open file " << file << " : " << TQString(f.errorString()) << endl; return; } - QTextStream out(&f); - bt::PtrMap<QString,Plugin>::iterator i = plugins.begin(); + TQTextStream out(&f); + bt::PtrMap<TQString,Plugin>::iterator i = plugins.begin(); while (i != plugins.end()) { Plugin* p = i->second; @@ -291,17 +291,17 @@ namespace kt } - void PluginManager::writeDefaultConfigFile(const QString & file) + void PluginManager::writeDefaultConfigFile(const TQString & file) { // by default we will load the infowidget and searchplugin - QFile f(file); + TQFile f(file); if (!f.open(IO_WriteOnly)) { - Out(SYS_GEN|LOG_DEBUG) << "Cannot open file " << file << " : " << f.errorString() << endl; + Out(SYS_GEN|LOG_DEBUG) << "Cannot open file " << file << " : " << TQString(f.errorString()) << endl; return; } - QTextStream out(&f); + TQTextStream out(&f); out << "Info Widget" << endl << "Search" << endl; diff --git a/libktorrent/pluginmanager.h b/libktorrent/pluginmanager.h index 611ec66..af5f46c 100644 --- a/libktorrent/pluginmanager.h +++ b/libktorrent/pluginmanager.h @@ -20,10 +20,10 @@ #ifndef KTPLUGINMANAGER_H #define KTPLUGINMANAGER_H -#include <qptrlist.h> +#include <tqptrlist.h> #include <util/ptrmap.h> #include <interfaces/plugin.h> -#include <qstringlist.h> +#include <tqstringlist.h> namespace kt @@ -40,12 +40,12 @@ namespace kt */ class PluginManager { - bt::PtrMap<QString,Plugin> plugins,unloaded; + bt::PtrMap<TQString,Plugin> plugins,unloaded; CoreInterface* core; GUIInterface* gui; PluginManagerPrefPage* prefpage; - QStringList pltoload; - QString cfg_file; + TQStringList pltoload; + TQString cfg_file; public: PluginManager(CoreInterface* core,GUIInterface* gui); virtual ~PluginManager(); @@ -62,38 +62,38 @@ namespace kt * Loads which plugins need to be loaded from a file. * @param file The file */ - void loadConfigFile(const QString & file); + void loadConfigFile(const TQString & file); /** * Saves which plugins are loaded to a file. * @param file The file */ - void saveConfigFile(const QString & file); + void saveConfigFile(const TQString & file); /** * Fill a list with all available plugins. * @param pllist The plugin list */ - void fillPluginList(QPtrList<Plugin> & plist); + void fillPluginList(TQPtrList<Plugin> & plist); /** * Is a plugin loaded * @param name Naame of plugin. * @return True if it is, false if it isn't */ - bool isLoaded(const QString & name) const; + bool isLoaded(const TQString & name) const; /** * Load a plugin. * @param name Name of the plugin */ - void load(const QString & name); + void load(const TQString & name); /** * Unload a plugin. * @param name Name of the plugin */ - void unload(const QString & name); + void unload(const TQString & name); /** * Load all unloaded plugins. @@ -110,7 +110,7 @@ namespace kt */ void updateGuiPlugins(); private: - void writeDefaultConfigFile(const QString & file); + void writeDefaultConfigFile(const TQString & file); }; } diff --git a/libktorrent/pluginmanagerprefpage.cpp b/libktorrent/pluginmanagerprefpage.cpp index 8151be4..0dfc9cc 100644 --- a/libktorrent/pluginmanagerprefpage.cpp +++ b/libktorrent/pluginmanagerprefpage.cpp @@ -20,7 +20,7 @@ #include <klocale.h> #include <kpushbutton.h> #include <klistview.h> -#include <qheader.h> +#include <tqheader.h> #include <kglobal.h> #include <kiconloader.h> #include <util/constants.h> @@ -38,8 +38,8 @@ namespace kt { Plugin* p; public: - PluginViewItem(Plugin* p,LabelView* parent) - : LabelViewItem(p->getIcon(),p->getGuiName(),p->getDescription(),parent),p(p) + PluginViewItem(Plugin* p,LabelView* tqparent) + : LabelViewItem(p->getIcon(),p->getGuiName(),p->getDescription(),tqparent),p(p) { update(); } @@ -51,12 +51,12 @@ namespace kt { setTitle("<h3>" + p->getGuiName() + "</h3>"); setDescription( - i18n("%1<br>Status: <b>%2</b><br>Author: %3").arg(p->getDescription()) - .arg(p->isLoaded() ? i18n("Loaded") : i18n("Not loaded")) - .arg(p->getAuthor())); + i18n("%1<br>tqStatus: <b>%2</b><br>Author: %3").tqarg(p->getDescription()) + .tqarg(p->isLoaded() ? i18n("Loaded") : i18n("Not loaded")) + .tqarg(p->getAuthor())); } - QString pluginName() {return p->getName();} + TQString pluginName() {return p->getName();} }; PluginManagerPrefPage::PluginManagerPrefPage(PluginManager* pman) @@ -74,16 +74,16 @@ namespace kt return true; } - void PluginManagerPrefPage::createWidget(QWidget* parent) + void PluginManagerPrefPage::createWidget(TQWidget* tqparent) { - pmw = new PluginManagerWidget(parent); + pmw = new PluginManagerWidget(tqparent); - connect(pmw->load_btn,SIGNAL(clicked()),this,SLOT(onLoad())); - connect(pmw->unload_btn,SIGNAL(clicked()),this,SLOT(onUnload())); - connect(pmw->load_all_btn,SIGNAL(clicked()),this,SLOT(onLoadAll())); - connect(pmw->unload_all_btn,SIGNAL(clicked()),this,SLOT(onUnloadAll())); + connect(pmw->load_btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(onLoad())); + connect(pmw->unload_btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(onUnload())); + connect(pmw->load_all_btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(onLoadAll())); + connect(pmw->unload_all_btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(onUnloadAll())); LabelView* lv = pmw->plugin_view; - connect(lv,SIGNAL(currentChanged(LabelViewItem * )),this,SLOT(onCurrentChanged( LabelViewItem* ))); + connect(lv,TQT_SIGNAL(currentChanged(LabelViewItem * )),this,TQT_SLOT(onCurrentChanged( LabelViewItem* ))); } void PluginManagerPrefPage::updatePluginList() @@ -91,11 +91,11 @@ namespace kt LabelView* lv = pmw->plugin_view; lv->clear(); // get list of plugins - QPtrList<Plugin> pl; + TQPtrList<Plugin> pl; pman->fillPluginList(pl); // Add them all - QPtrList<Plugin>::iterator i = pl.begin(); + TQPtrList<Plugin>::iterator i = pl.begin(); while (i != pl.end()) { Plugin* p = *i; @@ -139,10 +139,10 @@ namespace kt Uint32 tot = 0; Uint32 loaded = 0; // get list of plugins - QPtrList<Plugin> pl; + TQPtrList<Plugin> pl; pman->fillPluginList(pl); - QPtrList<Plugin>::iterator i = pl.begin(); + TQPtrList<Plugin>::iterator i = pl.begin(); while (i != pl.end()) { Plugin* p = *i; diff --git a/libktorrent/pluginmanagerprefpage.h b/libktorrent/pluginmanagerprefpage.h index 47df97f..9b78394 100644 --- a/libktorrent/pluginmanagerprefpage.h +++ b/libktorrent/pluginmanagerprefpage.h @@ -20,10 +20,10 @@ #ifndef KTPLUGINMANAGERPREFPAGE_H #define KTPLUGINMANAGERPREFPAGE_H -#include <qobject.h> +#include <tqobject.h> #include <interfaces/prefpageinterface.h> -class QListViewItem; +class TQListViewItem; class PluginManagerWidget; namespace kt @@ -36,15 +36,16 @@ namespace kt * * Pref page which allows to load and unload plugins. */ - class PluginManagerPrefPage : public QObject,public PrefPageInterface + class PluginManagerPrefPage : public TQObject,public PrefPageInterface { Q_OBJECT + TQ_OBJECT public: PluginManagerPrefPage(PluginManager* pman); virtual ~PluginManagerPrefPage(); virtual bool apply(); - virtual void createWidget(QWidget* parent); + virtual void createWidget(TQWidget* tqparent); virtual void updateData(); virtual void deleteWidget(); diff --git a/libktorrent/pluginmanagerwidget.ui b/libktorrent/pluginmanagerwidget.ui index f83efe0..47617ba 100644 --- a/libktorrent/pluginmanagerwidget.ui +++ b/libktorrent/pluginmanagerwidget.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>PluginManagerWidget</class> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>PluginManagerWidget</cstring> </property> @@ -32,9 +32,9 @@ </sizepolicy> </property> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout1</cstring> + <cstring>tqlayout1</cstring> </property> <vbox> <property name="name"> @@ -82,7 +82,7 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>20</width> <height>31</height> @@ -116,7 +116,7 @@ <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154388db5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c6a2573410000000049454e44ae426082</data> </image> </images> -<layoutdefaults spacing="6" margin="11"/> +<tqlayoutdefaults spacing="6" margin="11"/> <includehints> <includehint>labelview.h</includehint> <includehint>kpushbutton.h</includehint> diff --git a/libktorrent/torrent/advancedchokealgorithm.cpp b/libktorrent/torrent/advancedchokealgorithm.cpp index 7ca0578..f6c807f 100644 --- a/libktorrent/torrent/advancedchokealgorithm.cpp +++ b/libktorrent/torrent/advancedchokealgorithm.cpp @@ -234,7 +234,7 @@ namespace bt while (i != start) { Peer* p = pman.getPeer(i); - if (p && p->isChoked() && p->isInterested() && !p->isSeeder() && ppl.contains(p)) + if (p && p->isChoked() && p->isInterested() && !p->isSeeder() && ppl.tqcontains(p)) return p->getID(); i = (i + 1) % num_peers; } diff --git a/libktorrent/torrent/announcelist.cpp b/libktorrent/torrent/announcelist.cpp index 74b3397..7eebf19 100644 --- a/libktorrent/torrent/announcelist.cpp +++ b/libktorrent/torrent/announcelist.cpp @@ -25,15 +25,15 @@ #include <util/log.h> #include <klocale.h> -#include <qstringlist.h> -#include <qfile.h> -#include <qtextstream.h> +#include <tqstringlist.h> +#include <tqfile.h> +#include <tqtextstream.h> namespace bt { AnnounceList::AnnounceList() - :m_datadir(QString::null) + :m_datadir(TQString()) { curr = 0; } @@ -87,7 +87,7 @@ namespace bt bool AnnounceList::removeTracker(KURL url) { - KURL::List::iterator i = custom_trackers.find(url); + KURL::List::iterator i = custom_trackers.tqfind(url); if(i != custom_trackers.end()) { custom_trackers.remove(i); @@ -122,11 +122,11 @@ namespace bt void AnnounceList::saveTrackers() { - QFile file(m_datadir + "trackers"); + TQFile file(m_datadir + "trackers"); if(!file.open(IO_WriteOnly)) return; - QTextStream stream(&file); + TQTextStream stream(&file); for (KURL::List::iterator i = custom_trackers.begin();i != custom_trackers.end();i++) stream << (*i).prettyURL() << ::endl; file.close(); @@ -134,11 +134,11 @@ namespace bt void AnnounceList::loadTrackers() { - QFile file(m_datadir + "trackers"); + TQFile file(m_datadir + "trackers"); if(!file.open(IO_ReadOnly)) return; - QTextStream stream(&file); + TQTextStream stream(&file); while (!stream.atEnd()) { KURL url(stream.readLine().stripWhiteSpace()); @@ -148,7 +148,7 @@ namespace bt file.close(); } - void AnnounceList::setDatadir(const QString& theValue) + void AnnounceList::setDatadir(const TQString& theValue) { m_datadir = theValue; loadTrackers(); @@ -187,7 +187,7 @@ namespace bt for (Uint32 i = 0;i < al->getNumTrackerURLs();i++) { KURL url = *al->trackers.at(i); - if (!trackers.contains(url) && !custom_trackers.contains(url)) + if (!trackers.tqcontains(url) && !custom_trackers.tqcontains(url)) custom_trackers.append(url); } } diff --git a/libktorrent/torrent/announcelist.h b/libktorrent/torrent/announcelist.h index 38f9e72..3cb9edd 100644 --- a/libktorrent/torrent/announcelist.h +++ b/libktorrent/torrent/announcelist.h @@ -22,7 +22,7 @@ #if 0 #include <kurl.h> -#include <qstring.h> +#include <tqstring.h> #include <interfaces/trackerslist.h> namespace bt @@ -88,7 +88,7 @@ namespace bt ///Loads custom trackers from a file void loadTrackers(); - void setDatadir(const QString& theValue); + void setDatadir(const TQString& theValue); /** * Merge an other announce list to this one. @@ -97,7 +97,7 @@ namespace bt void merge(const AnnounceList* al); private: - QString m_datadir; + TQString m_datadir; }; diff --git a/libktorrent/torrent/authenticate.cpp b/libktorrent/torrent/authenticate.cpp index 14e34ea..bb7fe3a 100644 --- a/libktorrent/torrent/authenticate.cpp +++ b/libktorrent/torrent/authenticate.cpp @@ -26,7 +26,7 @@ namespace bt { - Authenticate::Authenticate(const QString & ip,Uint16 port, + Authenticate::Authenticate(const TQString & ip,Uint16 port, const SHA1Hash & info_hash,const PeerID & peer_id,PeerManager* pman) : info_hash(info_hash),our_peer_id(peer_id),pman(pman) { diff --git a/libktorrent/torrent/authenticate.h b/libktorrent/torrent/authenticate.h index 03c8d75..36e6d05 100644 --- a/libktorrent/torrent/authenticate.h +++ b/libktorrent/torrent/authenticate.h @@ -44,6 +44,7 @@ namespace bt class Authenticate : public AuthenticateBase { Q_OBJECT + TQ_OBJECT public: /** @@ -54,7 +55,7 @@ namespace bt * @param peer_id Peer ID * @param pman PeerManager */ - Authenticate(const QString & ip,Uint16 port, + Authenticate(const TQString & ip,Uint16 port, const SHA1Hash & info_hash,const PeerID & peer_id, PeerManager* pman); @@ -73,7 +74,7 @@ namespace bt /// See if the authentication is succesfull bool isSuccesfull() const {return succes;} - const QString & getIP() const {return host;} + const TQString & getIP() const {return host;} Uint16 getPort() const {return port;} protected slots: @@ -88,7 +89,7 @@ namespace bt protected: SHA1Hash info_hash; PeerID our_peer_id,peer_id; - QString host; + TQString host; Uint16 port; bool succes; PeerManager* pman; diff --git a/libktorrent/torrent/authenticatebase.cpp b/libktorrent/torrent/authenticatebase.cpp index 9ee2ad7..c00e87f 100644 --- a/libktorrent/torrent/authenticatebase.cpp +++ b/libktorrent/torrent/authenticatebase.cpp @@ -32,7 +32,7 @@ namespace bt AuthenticateBase::AuthenticateBase(mse::StreamSocket* s) : sock(s),finished(false),local(false) { - connect(&timer,SIGNAL(timeout()),this,SLOT(onTimeout())); + connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onTimeout())); timer.start(20000,true); memset(handshake,0x00,68); bytes_of_handshake_recieved = 0; diff --git a/libktorrent/torrent/authenticatebase.h b/libktorrent/torrent/authenticatebase.h index fdab158..87c851b 100644 --- a/libktorrent/torrent/authenticatebase.h +++ b/libktorrent/torrent/authenticatebase.h @@ -20,9 +20,9 @@ #ifndef BTAUTHENTICATEBASE_H #define BTAUTHENTICATEBASE_H -#include <qobject.h> -#include <qsocket.h> -#include <qtimer.h> +#include <tqobject.h> +#include <tqsocket.h> +#include <tqtimer.h> #include <util/constants.h> @@ -45,9 +45,10 @@ namespace bt * It has a socket, handles the timing out, provides a function to send * the handshake. */ - class AuthenticateBase : public QObject + class AuthenticateBase : public TQObject { Q_OBJECT + TQ_OBJECT public: AuthenticateBase(mse::StreamSocket* s = 0); virtual ~AuthenticateBase(); @@ -111,7 +112,7 @@ namespace bt protected: mse::StreamSocket* sock; - QTimer timer; + TQTimer timer; bool finished; Uint8 handshake[68]; Uint32 bytes_of_handshake_recieved; diff --git a/libktorrent/torrent/bdecoder.cpp b/libktorrent/torrent/bdecoder.cpp index 6c5a179..778cf8a 100644 --- a/libktorrent/torrent/bdecoder.cpp +++ b/libktorrent/torrent/bdecoder.cpp @@ -27,7 +27,7 @@ namespace bt { - BDecoder::BDecoder(const QByteArray & data,bool verbose,Uint32 off) + BDecoder::BDecoder(const TQByteArray & data,bool verbose,Uint32 off) : data(data),pos(off),verbose(verbose) { } @@ -59,7 +59,7 @@ namespace bt } else { - throw Error(i18n("Illegal token: %1").arg(data[pos])); + throw Error(i18n("Illegal token: %1").tqarg(data[pos])); } } @@ -83,7 +83,7 @@ namespace bt throw Error(i18n("Decode error")); } - QByteArray key = k->data().toByteArray(); + TQByteArray key = k->data().toByteArray(); delete kn; BNode* data = decode(); @@ -130,7 +130,7 @@ namespace bt { Uint32 off = pos; pos++; - QString n; + TQString n; // look for e and add everything between i and e to n while (pos < data.size() && data[pos] != 'e') { @@ -161,7 +161,7 @@ namespace bt Int64 bi = 0LL; bi = n.toLongLong(&ok); if (!ok) - throw Error(i18n("Cannot convert %1 to an int").arg(n)); + throw Error(i18n("Cannot convert %1 to an int").tqarg(n)); pos++; if (verbose) Out() << "INT64 = " << n << endl; @@ -177,7 +177,7 @@ namespace bt // string are encoded 4:spam (length:string) // first get length by looking for the : - QString n; + TQString n; while (pos < data.size() && data[pos] != ':') { n += data[pos]; @@ -195,16 +195,16 @@ namespace bt len = n.toInt(&ok); if (!ok) { - throw Error(i18n("Cannot convert %1 to an int").arg(n)); + throw Error(i18n("Cannot convert %1 to an int").tqarg(n)); } // move pos to the first part of the string pos++; if (pos + len > data.size()) throw Error(i18n("Torrent is incomplete!")); - QByteArray arr(len); + TQByteArray arr(len); for (unsigned int i = pos;i < pos + len;i++) - arr.at(i-pos) = data[i]; + arr.tqat(i-pos) = data[i]; pos += len; // read the string into n @@ -214,7 +214,7 @@ namespace bt if (verbose) { if (arr.size() < 200) - Out() << "STRING " << QString(arr) << endl; + Out() << "STRING " << TQString(arr) << endl; else Out() << "STRING " << "really long string" << endl; } diff --git a/libktorrent/torrent/bdecoder.h b/libktorrent/torrent/bdecoder.h index dfffce5..438a656 100644 --- a/libktorrent/torrent/bdecoder.h +++ b/libktorrent/torrent/bdecoder.h @@ -20,7 +20,7 @@ #ifndef BTBDECODER_H #define BTBDECODER_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace bt @@ -39,7 +39,7 @@ namespace bt */ class BDecoder { - const QByteArray & data; + const TQByteArray & data; Uint32 pos; bool verbose; public: @@ -49,7 +49,7 @@ namespace bt * @param verbose Verbose output to the log * @param off Offset to start parsing */ - BDecoder(const QByteArray & data,bool verbose,Uint32 off = 0); + BDecoder(const TQByteArray & data,bool verbose,Uint32 off = 0); virtual ~BDecoder(); /** diff --git a/libktorrent/torrent/bencoder.cpp b/libktorrent/torrent/bencoder.cpp index e4a80a0..ef01123 100644 --- a/libktorrent/torrent/bencoder.cpp +++ b/libktorrent/torrent/bencoder.cpp @@ -38,7 +38,7 @@ namespace bt //////////////////////////////////// - BEncoderBufferOutput::BEncoderBufferOutput(QByteArray & data) : data(data),ptr(0) + BEncoderBufferOutput::BEncoderBufferOutput(TQByteArray & data) : data(data),ptr(0) { } @@ -87,7 +87,7 @@ namespace bt { if (!out) return; - QCString s = QString("i%1e").arg(val).utf8(); + TQCString s = TQString("i%1e").tqarg(val).utf8(); out->write(s,s.length()); } @@ -95,25 +95,25 @@ namespace bt { if (!out) return; - QCString s = QString("i%1e").arg(val).utf8(); + TQCString s = TQString("i%1e").tqarg(val).utf8(); out->write(s,s.length()); } - void BEncoder::write(const QString & str) + void BEncoder::write(const TQString & str) { if (!out) return; - QCString u = str.utf8(); - QCString s = QString("%1:").arg(u.length()).utf8(); + TQCString u = str.utf8(); + TQCString s = TQString("%1:").tqarg(u.length()).utf8(); out->write(s,s.length()); out->write(u,u.length()); } - void BEncoder::write(const QByteArray & data) + void BEncoder::write(const TQByteArray & data) { if (!out) return; - QCString s = QString::number(data.size()).utf8(); + TQCString s = TQString::number(data.size()).utf8(); out->write(s,s.length()); out->write(":",1); out->write(data.data(),data.size()); @@ -123,7 +123,7 @@ namespace bt { if (!out) return; - QCString s = QString("%1:").arg(size).utf8(); + TQCString s = TQString("%1:").tqarg(size).utf8(); out->write(s,s.length()); out->write((const char*)data,size); } diff --git a/libktorrent/torrent/bencoder.h b/libktorrent/torrent/bencoder.h index 8760d14..eb84c39 100644 --- a/libktorrent/torrent/bencoder.h +++ b/libktorrent/torrent/bencoder.h @@ -58,14 +58,14 @@ namespace bt }; /** - * Write the output of a BEncoder to a QByteArray + * Write the output of a BEncoder to a TQByteArray */ class BEncoderBufferOutput : public BEncoderOutput { - QByteArray & data; + TQByteArray & data; Uint32 ptr; public: - BEncoderBufferOutput(QByteArray & data); + BEncoderBufferOutput(TQByteArray & data); void write(const char* str,Uint32 len); }; @@ -124,13 +124,13 @@ namespace bt * Write a string * @param str */ - void write(const QString & str); + void write(const TQString & str); /** - * Write a QByteArray + * Write a TQByteArray * @param data */ - void write(const QByteArray & data); + void write(const TQByteArray & data); /** * Write a data array diff --git a/libktorrent/torrent/bnode.cpp b/libktorrent/torrent/bnode.cpp index e76dcf3..07b7ba0 100644 --- a/libktorrent/torrent/bnode.cpp +++ b/libktorrent/torrent/bnode.cpp @@ -56,8 +56,8 @@ namespace bt BDictNode::~BDictNode() { - QValueList<DictEntry>::iterator i = children.begin(); - while (i != children.end()) + TQValueList<DictEntry>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { DictEntry & e = *i; delete e.node; @@ -65,31 +65,31 @@ namespace bt } } - void BDictNode::insert(const QByteArray & key,BNode* node) + void BDictNode::insert(const TQByteArray & key,BNode* node) { DictEntry entry; entry.key = key; entry.node = node; - children.append(entry); + tqchildren.append(entry); } - BNode* BDictNode::getData(const QString & key) + BNode* BDictNode::getData(const TQString & key) { - QValueList<DictEntry>::iterator i = children.begin(); - while (i != children.end()) + TQValueList<DictEntry>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { DictEntry & e = *i; - if (QString(e.key) == key) + if (TQString(e.key) == key) return e.node; i++; } return 0; } - BDictNode* BDictNode::getDict(const QByteArray & key) + BDictNode* BDictNode::getDict(const TQByteArray & key) { - QValueList<DictEntry>::iterator i = children.begin(); - while (i != children.end()) + TQValueList<DictEntry>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { DictEntry & e = *i; if (e.key == key) @@ -99,19 +99,19 @@ namespace bt return 0; } - BListNode* BDictNode::getList(const QString & key) + BListNode* BDictNode::getList(const TQString & key) { BNode* n = getData(key); return dynamic_cast<BListNode*>(n); } - BDictNode* BDictNode::getDict(const QString & key) + BDictNode* BDictNode::getDict(const TQString & key) { BNode* n = getData(key); return dynamic_cast<BDictNode*>(n); } - BValueNode* BDictNode::getValue(const QString & key) + BValueNode* BDictNode::getValue(const TQString & key) { BNode* n = getData(key); return dynamic_cast<BValueNode*>(n); @@ -120,11 +120,11 @@ namespace bt void BDictNode::printDebugInfo() { Out() << "DICT" << endl; - QValueList<DictEntry>::iterator i = children.begin(); - while (i != children.end()) + TQValueList<DictEntry>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { DictEntry & e = *i; - Out() << QString(e.key) << ": " << endl; + Out() << TQString(e.key) << ": " << endl; e.node->printDebugInfo(); i++; } @@ -135,7 +135,7 @@ namespace bt BListNode::BListNode(Uint32 off) : BNode(LIST,off) { - children.setAutoDelete(true); + tqchildren.setAutoDelete(true); } @@ -145,7 +145,7 @@ namespace bt void BListNode::append(BNode* node) { - children.append(node); + tqchildren.append(node); } BListNode* BListNode::getList(Uint32 idx) @@ -165,10 +165,10 @@ namespace bt void BListNode::printDebugInfo() { - Out() << "LIST " << children.count() << endl; - for (Uint32 i = 0;i < children.count();i++) + Out() << "LIST " << tqchildren.count() << endl; + for (Uint32 i = 0;i < tqchildren.count();i++) { - BNode* n = children.at(i); + BNode* n = tqchildren.at(i); n->printDebugInfo(); } Out() << "END" << endl; diff --git a/libktorrent/torrent/bnode.h b/libktorrent/torrent/bnode.h index 685291c..ccd2c94 100644 --- a/libktorrent/torrent/bnode.h +++ b/libktorrent/torrent/bnode.h @@ -20,8 +20,8 @@ #ifndef BTBNODE_H #define BTBNODE_H -#include <qptrlist.h> -#include <qvaluelist.h> +#include <tqptrlist.h> +#include <tqvaluelist.h> #include <util/constants.h> #include "value.h" @@ -77,7 +77,7 @@ namespace bt * @author Joris Guisson * @brief Represents a value (string,bytearray or int) in bencoded data * - * @todo Use QVariant + * @todo Use TQVariant */ class BValueNode : public BNode { @@ -99,10 +99,10 @@ namespace bt { struct DictEntry { - QByteArray key; + TQByteArray key; BNode* node; }; - QValueList<DictEntry> children; + TQValueList<DictEntry> tqchildren; public: BDictNode(Uint32 off); virtual ~BDictNode(); @@ -112,42 +112,42 @@ namespace bt * @param key The key * @param node The node */ - void insert(const QByteArray & key,BNode* node); + void insert(const TQByteArray & key,BNode* node); /** * Get a BNode. * @param key The key * @return The node or 0 if there is no node with has key @a key */ - BNode* getData(const QString & key); + BNode* getData(const TQString & key); /** * Get a BListNode. * @param key The key * @return The node or 0 if there is no list node with has key @a key */ - BListNode* getList(const QString & key); + BListNode* getList(const TQString & key); /** * Get a BDictNode. * @param key The key * @return The node or 0 if there is no dict node with has key @a key */ - BDictNode* getDict(const QString & key); + BDictNode* getDict(const TQString & key); /** * Get a BDictNode. * @param key The key * @return The node or 0 if there is no dict node with has key @a key */ - BDictNode* getDict(const QByteArray & key); + BDictNode* getDict(const TQByteArray & key); /** * Get a BValueNode. * @param key The key * @return The node or 0 if there is no value node with has key @a key */ - BValueNode* getValue(const QString & key); + BValueNode* getValue(const TQString & key); void printDebugInfo(); }; @@ -159,7 +159,7 @@ namespace bt */ class BListNode : public BNode { - QPtrList<BNode> children; + TQPtrList<BNode> tqchildren; public: BListNode(Uint32 off); virtual ~BListNode(); @@ -172,14 +172,14 @@ namespace bt void printDebugInfo(); /// Get the number of nodes in the list. - Uint32 getNumChildren() const {return children.count();} + Uint32 getNumChildren() const {return tqchildren.count();} /** * Get a node from the list * @param idx The index * @return The node or 0 if idx is out of bounds */ - BNode* getChild(Uint32 idx) {return children.at(idx);} + BNode* getChild(Uint32 idx) {return tqchildren.at(idx);} /** * Get a BListNode. diff --git a/libktorrent/torrent/cache.cpp b/libktorrent/torrent/cache.cpp index dcf9a77..927e631 100644 --- a/libktorrent/torrent/cache.cpp +++ b/libktorrent/torrent/cache.cpp @@ -26,7 +26,7 @@ namespace bt { - Cache::Cache(Torrent & tor,const QString & tmpdir,const QString & datadir) + Cache::Cache(Torrent & tor,const TQString & tmpdir,const TQString & datadir) : tor(tor),tmpdir(tmpdir),datadir(datadir),mmap_failures(0) { if (!datadir.endsWith(bt::DirSeparator())) @@ -43,7 +43,7 @@ namespace bt {} - void Cache::changeTmpDir(const QString & ndir) + void Cache::changeTmpDir(const TQString & ndir) { tmpdir = ndir; } diff --git a/libktorrent/torrent/cache.h b/libktorrent/torrent/cache.h index 4c373ee..8630bc7 100644 --- a/libktorrent/torrent/cache.h +++ b/libktorrent/torrent/cache.h @@ -22,7 +22,7 @@ #include <kio/job.h> -class QStringList; +class TQStringList; namespace bt { @@ -43,36 +43,36 @@ namespace bt { protected: Torrent & tor; - QString tmpdir; - QString datadir; + TQString tmpdir; + TQString datadir; bool preexisting_files; Uint32 mmap_failures; public: - Cache(Torrent & tor,const QString & tmpdir,const QString & datadir); + Cache(Torrent & tor,const TQString & tmpdir,const TQString & datadir); virtual ~Cache(); /// Get the datadir - QString getDataDir() const {return datadir;} + TQString getDataDir() const {return datadir;} /** * Get the actual output path. * @return The output path */ - virtual QString getOutputPath() const = 0; + virtual TQString getOutputPath() const = 0; /** * Changes the tmp dir. All data files should already been moved. * This just modifies the tmpdir variable. * @param ndir The new tmpdir */ - virtual void changeTmpDir(const QString & ndir); + virtual void changeTmpDir(const TQString & ndir); /** * Move the data files to a new directory. * @param ndir The directory * @return The KIO::Job doing the move */ - virtual KIO::Job* moveDataFiles(const QString & ndir) = 0; + virtual KIO::Job* moveDataFiles(const TQString & ndir) = 0; /** * The move data files job is done. @@ -85,7 +85,7 @@ namespace bt * This just modifies the datadir variable. * @param outputpath New output path */ - virtual void changeOutputPath(const QString & outputpath) = 0; + virtual void changeOutputPath(const TQString & outputpath) = 0; /** * Load a chunk into memory. If something goes wrong, @@ -140,7 +140,7 @@ namespace bt * Test all files and see if they are not missing. * If so put them in a list */ - virtual bool hasMissingFiles(QStringList & sl) = 0; + virtual bool hasMissingFiles(TQStringList & sl) = 0; /** * Delete all data files, in case of multi file torrents diff --git a/libktorrent/torrent/cachefile.cpp b/libktorrent/torrent/cachefile.cpp index 6367b7f..4196016 100644 --- a/libktorrent/torrent/cachefile.cpp +++ b/libktorrent/torrent/cachefile.cpp @@ -28,7 +28,7 @@ #include <sys/mman.h> #include <unistd.h> #include <errno.h> -#include <qfile.h> +#include <tqfile.h> #include <kio/netaccess.h> #include <klocale.h> #include <kfileitem.h> @@ -46,7 +46,7 @@ // Not all systems have an O_LARGEFILE - Solaris depending // on command-line defines, FreeBSD never - so in those cases, -// make it a zero bitmask. As long as it's only OR'ed into +// make it a zero bittqmask. As long as it's only OR'ed into // open(2) flags, that's fine. // #ifndef O_LARGEFILE @@ -71,7 +71,7 @@ namespace bt close(); } - void CacheFile::changePath(const QString & npath) + void CacheFile::changePath(const TQString & npath) { path = npath; } @@ -81,26 +81,26 @@ namespace bt int flags = O_LARGEFILE; // by default allways try read write - fd = ::open(QFile::encodeName(path),flags | O_RDWR); + fd = ::open(TQFile::encodeName(path),flags | O_RDWR); if (fd < 0 && mode == READ) { // in case RDWR fails, try readonly if possible - fd = ::open(QFile::encodeName(path),flags | O_RDONLY); + fd = ::open(TQFile::encodeName(path),flags | O_RDONLY); if (fd >= 0) read_only = true; } if (fd < 0) { - throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno))); + throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno))); } file_size = FileSize(fd); } - void CacheFile::open(const QString & path,Uint64 size) + void CacheFile::open(const TQString & path,Uint64 size) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); // only set the path and the max size, we only open the file when it is needed this->path = path; max_size = size; @@ -108,7 +108,7 @@ namespace bt void* CacheFile::map(MMappeable* thing,Uint64 off,Uint32 size,Mode mode) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); // reopen the file if necessary if (fd == -1) { @@ -118,7 +118,7 @@ namespace bt if (read_only && mode != READ) { - throw Error(i18n("Cannot open %1 for writing : readonly filesystem").arg(path)); + throw Error(i18n("Cannot open %1 for writing : readonly filesystem").tqarg(path)); } if (off + size > max_size) @@ -164,7 +164,7 @@ namespace bt #endif if (ptr == MAP_FAILED) { - Out() << "mmap failed : " << QString(strerror(errno)) << endl; + Out() << "mmap failed : " << TQString(strerror(errno)) << endl; return 0; } else @@ -189,7 +189,7 @@ namespace bt #endif if (ptr == MAP_FAILED) { - Out() << "mmap failed : " << QString(strerror(errno)) << endl; + Out() << "mmap failed : " << TQString(strerror(errno)) << endl; return 0; } else @@ -217,7 +217,7 @@ namespace bt } if (read_only) - throw Error(i18n("Cannot open %1 for writing : readonly filesystem").arg(path)); + throw Error(i18n("Cannot open %1 for writing : readonly filesystem").tqarg(path)); // jump to the end of the file SeekFile(fd,0,SEEK_END); @@ -237,22 +237,22 @@ namespace bt int nb = to_write > 1024 ? 1024 : to_write; int ret = ::write(fd,buf,nb); if (ret < 0) - throw Error(i18n("Cannot expand file %1 : %2").arg(path).arg(strerror(errno))); + throw Error(i18n("Cannot expand file %1 : %2").tqarg(path).tqarg(strerror(errno))); else if (ret != nb) - throw Error(i18n("Cannot expand file %1 : incomplete write").arg(path)); + throw Error(i18n("Cannot expand file %1 : incomplete write").tqarg(path)); to_write -= nb; } file_size += num; // - // Out() << QString("growing %1 = %2").arg(path).arg(kt::BytesToString(file_size)) << endl; + // Out() << TQString("growing %1 = %2").tqarg(path).tqarg(kt::BytesToString(file_size)) << endl; if (file_size != FileSize(fd)) { -// Out() << QString("Homer Simpson %1 %2").arg(file_size).arg(sb.st_size) << endl; +// Out() << TQString("Homer Simpson %1 %2").tqarg(file_size).tqarg(sb.st_size) << endl; fsync(fd); if (file_size != FileSize(fd)) { - throw Error(i18n("Cannot expand file %1").arg(path)); + throw Error(i18n("Cannot expand file %1").tqarg(path)); } } } @@ -260,9 +260,9 @@ namespace bt void CacheFile::unmap(void* ptr,Uint32 size) { int ret = 0; - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); // see if it wasn't an offsetted mapping - if (mappings.contains(ptr)) + if (mappings.tqcontains(ptr)) { CacheFile::Entry & e = mappings[ptr]; #if HAVE_MUNMAP64 @@ -292,18 +292,18 @@ namespace bt if (ret < 0) { - Out(SYS_DIO|LOG_IMPORTANT) << QString("Munmap failed with error %1 : %2").arg(errno).arg(strerror(errno)) << endl; + Out(SYS_DIO|LOG_IMPORTANT) << TQString("Munmap failed with error %1 : %2").tqarg(errno).tqarg(strerror(errno)) << endl; } } void CacheFile::close() { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); if (fd == -1) return; - QMap<void*,Entry>::iterator i = mappings.begin(); + TQMap<void*,Entry>::iterator i = mappings.begin(); while (i != mappings.end()) { int ret = 0; @@ -326,7 +326,7 @@ namespace bt if (ret < 0) { - Out(SYS_DIO|LOG_IMPORTANT) << QString("Munmap failed with error %1 : %2").arg(errno).arg(strerror(errno)) << endl; + Out(SYS_DIO|LOG_IMPORTANT) << TQString("Munmap failed with error %1 : %2").tqarg(errno).tqarg(strerror(errno)) << endl; } } ::close(fd); @@ -335,7 +335,7 @@ namespace bt void CacheFile::read(Uint8* buf,Uint32 size,Uint64 off) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); bool close_again = false; // reopen the file if necessary @@ -348,7 +348,7 @@ namespace bt if (off >= file_size || off >= max_size) { - throw Error(i18n("Error : Reading past the end of the file %1").arg(path)); + throw Error(i18n("Error : Reading past the end of the file %1").tqarg(path)); } // jump to right position @@ -358,7 +358,7 @@ namespace bt if (close_again) closeTemporary(); - throw Error(i18n("Error reading from %1").arg(path)); + throw Error(i18n("Error reading from %1").tqarg(path)); } if (close_again) @@ -367,7 +367,7 @@ namespace bt void CacheFile::write(const Uint8* buf,Uint32 size,Uint64 off) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); bool close_again = false; // reopen the file if necessary @@ -379,7 +379,7 @@ namespace bt } if (read_only) - throw Error(i18n("Cannot open %1 for writing : readonly filesystem").arg(path)); + throw Error(i18n("Cannot open %1 for writing : readonly filesystem").tqarg(path)); if (off + size > max_size) { @@ -389,7 +389,7 @@ namespace bt if (file_size < off) { - //Out() << QString("Writing %1 bytes at %2").arg(size).arg(off) << endl; + //Out() << TQString("Writing %1 bytes at %2").tqarg(size).tqarg(off) << endl; growFile(off - file_size); } @@ -400,11 +400,11 @@ namespace bt closeTemporary(); if (ret == -1) - throw Error(i18n("Error writing to %1 : %2").arg(path).arg(strerror(errno))); + throw Error(i18n("Error writing to %1 : %2").tqarg(path).tqarg(strerror(errno))); else if ((Uint32)ret != size) { - Out() << QString("Incomplete write of %1 bytes, should be %2").arg(ret).arg(size) << endl; - throw Error(i18n("Error writing to %1").arg(path)); + Out() << TQString("Incomplete write of %1 bytes, should be %2").tqarg(ret).tqarg(size) << endl; + throw Error(i18n("Error writing to %1").tqarg(path)); } if (off + size > file_size) @@ -424,7 +424,7 @@ namespace bt void CacheFile::preallocate(PreallocationThread* prealloc) { - QMutexLocker lock(&mutex); + TQMutexLocker lock(&mutex); if (FileSize(path) == max_size) { @@ -445,7 +445,7 @@ namespace bt if (close_again) closeTemporary(); - throw Error(i18n("Cannot open %1 for writing : readonly filesystem").arg(path)); + throw Error(i18n("Cannot open %1 for writing : readonly filesystem").tqarg(path)); } try @@ -472,7 +472,7 @@ namespace bt if (close_again) closeTemporary(); - throw Error(i18n("Cannot preallocate diskspace : %1").arg(strerror(errno))); + throw Error(i18n("Cannot preallocate diskspace : %1").tqarg(strerror(errno))); } } diff --git a/libktorrent/torrent/cachefile.h b/libktorrent/torrent/cachefile.h index 9c4ebc6..749f46a 100644 --- a/libktorrent/torrent/cachefile.h +++ b/libktorrent/torrent/cachefile.h @@ -20,9 +20,9 @@ #ifndef BTCACHEFILE_H #define BTCACHEFILE_H -#include <qmap.h> -#include <qmutex.h> -#include <qstring.h> +#include <tqmap.h> +#include <tqmutex.h> +#include <tqstring.h> #include <util/constants.h> namespace bt @@ -68,10 +68,10 @@ namespace bt * @param size Max size of the file * @throw Error when something goes wrong */ - void open(const QString & path,Uint64 size); + void open(const TQString & path,Uint64 size); /// Change the path of the file - void changePath(const QString & npath); + void changePath(const TQString & npath); /** * Map a part of the file into memory, will expand the file @@ -130,7 +130,7 @@ namespace bt int fd; bool read_only; Uint64 max_size,file_size; - QString path; + TQString path; struct Entry { MMappeable* thing; @@ -140,8 +140,8 @@ namespace bt Uint32 diff; Mode mode; }; - QMap<void*,Entry> mappings; // mappings where offset wasn't a multiple of 4K - mutable QMutex mutex; + TQMap<void*,Entry> mappings; // mappings where offset wasn't a multiple of 4K + mutable TQMutex mutex; }; } diff --git a/libktorrent/torrent/cap.cpp b/libktorrent/torrent/cap.cpp index a785520..9338444 100644 --- a/libktorrent/torrent/cap.cpp +++ b/libktorrent/torrent/cap.cpp @@ -23,7 +23,7 @@ namespace bt { - typedef QValueList<Cap::Entry>::iterator CapItr; + typedef TQValueList<Cap::Entry>::iterator CapItr; Cap::Cap(bool percentage_check) : max_bytes_per_sec(0),leftover(0),current_speed(0),percentage_check(percentage_check) { diff --git a/libktorrent/torrent/cap.h b/libktorrent/torrent/cap.h index a3a365e..712f5fa 100644 --- a/libktorrent/torrent/cap.h +++ b/libktorrent/torrent/cap.h @@ -21,7 +21,7 @@ #define BTCAP_H #if 0 -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <util/timer.h> #include <util/constants.h> @@ -100,7 +100,7 @@ namespace bt void update(); private: - QValueList<Entry> entries; + TQValueList<Entry> entries; Uint32 max_bytes_per_sec; Timer timer; Uint32 leftover; diff --git a/libktorrent/torrent/choker.cpp b/libktorrent/torrent/choker.cpp index 0cb08e9..6162644 100644 --- a/libktorrent/torrent/choker.cpp +++ b/libktorrent/torrent/choker.cpp @@ -19,7 +19,7 @@ ***************************************************************************/ -#include <qptrlist.h> +#include <tqptrlist.h> #include <interfaces/functions.h> #include "choker.h" #include "peermanager.h" @@ -37,7 +37,7 @@ namespace bt PeerPtrList::~PeerPtrList() {} - int PeerPtrList::compareItems(QPtrCollection::Item a, QPtrCollection::Item b) + int PeerPtrList::compareItems(TQPtrCollection::Item a, TQPtrCollection::Item b) { if (pcmp) return pcmp((Peer*)a,(Peer*)b); diff --git a/libktorrent/torrent/choker.h b/libktorrent/torrent/choker.h index ba78f3c..b44fc48 100644 --- a/libktorrent/torrent/choker.h +++ b/libktorrent/torrent/choker.h @@ -20,7 +20,7 @@ #ifndef BTCHOKER_H #define BTCHOKER_H -#include <qptrlist.h> +#include <tqptrlist.h> #include <util/constants.h> #include "peer.h" @@ -39,7 +39,7 @@ namespace bt typedef int (*PeerCompareFunc)(Peer* a,Peer* b); - class PeerPtrList : public QPtrList<Peer> + class PeerPtrList : public TQPtrList<Peer> { PeerCompareFunc pcmp; public: @@ -48,7 +48,7 @@ namespace bt void setCompareFunc(PeerCompareFunc p) {pcmp = p;} - virtual int compareItems(QPtrCollection::Item a, QPtrCollection::Item b); + virtual int compareItems(TQPtrCollection::Item a, TQPtrCollection::Item b); }; /** diff --git a/libktorrent/torrent/chunk.cpp b/libktorrent/torrent/chunk.cpp index 6873713..aaee35e 100644 --- a/libktorrent/torrent/chunk.cpp +++ b/libktorrent/torrent/chunk.cpp @@ -37,7 +37,7 @@ namespace bt clear(); } - void Chunk::setData(Uint8* d,Status nstatus) + void Chunk::setData(Uint8* d,tqStatus nstatus) { clear(); status = nstatus; diff --git a/libktorrent/torrent/chunk.h b/libktorrent/torrent/chunk.h index 0896e96..08d63c3 100644 --- a/libktorrent/torrent/chunk.h +++ b/libktorrent/torrent/chunk.h @@ -45,7 +45,7 @@ namespace bt Chunk(unsigned int index,Uint32 size); ~Chunk(); - enum Status + enum tqStatus { MMAPPED, BUFFERED, @@ -54,13 +54,13 @@ namespace bt }; /// Get the chunks status. - Status getStatus() const; + tqStatus gettqStatus() const; /** * Set the chunks status * @param s */ - void setStatus(Status s); + void settqStatus(tqStatus s); /// Get the data const Uint8* getData() const; @@ -69,7 +69,7 @@ namespace bt Uint8* getData(); /// Set the data and the new status - void setData(Uint8* d,Status nstatus); + void setData(Uint8* d,tqStatus nstatus); /// Clear the chunk (delete data depending on the mode) void clear(); @@ -118,7 +118,7 @@ namespace bt virtual void unmapped(); private: - Status status; + tqStatus status; Uint32 index; Uint8* data; Uint32 size; @@ -126,12 +126,12 @@ namespace bt Priority priority; }; - inline Chunk::Status Chunk::getStatus() const + inline Chunk::tqStatus Chunk::gettqStatus() const { return status; } - inline void Chunk::setStatus(Chunk::Status s) + inline void Chunk::settqStatus(Chunk::tqStatus s) { status = s; } diff --git a/libktorrent/torrent/chunkdownload.cpp b/libktorrent/torrent/chunkdownload.cpp index 51e9db9..fe095a7 100644 --- a/libktorrent/torrent/chunkdownload.cpp +++ b/libktorrent/torrent/chunkdownload.cpp @@ -35,17 +35,17 @@ namespace bt { - class DownloadStatus : public std::set<Uint32> + class DownloadtqStatus : public std::set<Uint32> { public: // typedef std::set<Uint32>::iterator iterator; - DownloadStatus() + DownloadtqStatus() { } - ~DownloadStatus() + ~DownloadtqStatus() { } @@ -59,7 +59,7 @@ namespace bt erase(p); } - bool contains(Uint32 p) + bool tqcontains(Uint32 p) { return count(p) > 0; } @@ -111,7 +111,7 @@ namespace bt return false; - DownloadStatus* ds = dstatus.find(p.getPeer()); + DownloadtqStatus* ds = dstatus.tqfind(p.getPeer()); if (ds) ds->remove(pp); @@ -143,7 +143,7 @@ namespace bt } } - for (QPtrList<PeerDownloader>::iterator i = pdown.begin();i != pdown.end();++i) + for (TQPtrList<PeerDownloader>::iterator i = pdown.begin();i != pdown.end();++i) sendRequests(*i); return false; @@ -155,8 +155,8 @@ namespace bt { PeerDownloader* pd = pdown.at(i); pd->release(); - disconnect(pd,SIGNAL(timedout(const Request& )),this,SLOT(onTimeout(const Request& ))); - disconnect(pd,SIGNAL(rejected( const Request& )),this,SLOT(onRejected( const Request& ))); + disconnect(pd,TQT_SIGNAL(timedout(const Request& )),this,TQT_SLOT(onTimeout(const Request& ))); + disconnect(pd,TQT_SIGNAL(rejected( const Request& )),this,TQT_SLOT(onRejected( const Request& ))); } dstatus.clear(); pdown.clear(); @@ -164,22 +164,22 @@ namespace bt bool ChunkDownload::assignPeer(PeerDownloader* pd) { - if (!pd || pdown.contains(pd)) + if (!pd || pdown.tqcontains(pd)) return false; pd->grab(); pdown.append(pd); - dstatus.insert(pd->getPeer()->getID(),new DownloadStatus()); + dstatus.insert(pd->getPeer()->getID(),new DownloadtqStatus()); sendRequests(pd); - connect(pd,SIGNAL(timedout(const Request& )),this,SLOT(onTimeout(const Request& ))); - connect(pd,SIGNAL(rejected( const Request& )),this,SLOT(onRejected( const Request& ))); + connect(pd,TQT_SIGNAL(timedout(const Request& )),this,TQT_SLOT(onTimeout(const Request& ))); + connect(pd,TQT_SIGNAL(rejected( const Request& )),this,TQT_SLOT(onRejected( const Request& ))); return true; } void ChunkDownload::notDownloaded(const Request & r,bool reject) { // find the peer - DownloadStatus* ds = dstatus.find(r.getPeer()); + DownloadtqStatus* ds = dstatus.tqfind(r.getPeer()); if (ds) { // Out() << "ds != 0" << endl; @@ -188,7 +188,7 @@ namespace bt } // go over all PD's and do requets again - for (QPtrList<PeerDownloader>::iterator i = pdown.begin();i != pdown.end();++i) + for (TQPtrList<PeerDownloader>::iterator i = pdown.begin();i != pdown.end();++i) sendRequests(*i); } @@ -196,7 +196,7 @@ namespace bt { if (chunk->getIndex() == r.getIndex()) { -// Out(SYS_CON|LOG_DEBUG) << QString("Request rejected %1 %2 %3 %4").arg(r.getIndex()).arg(r.getOffset()).arg(r.getLength()).arg(r.getPeer()) << endl; +// Out(SYS_CON|LOG_DEBUG) << TQString("Request rejected %1 %2 %3 %4").tqarg(r.getIndex()).tqarg(r.getOffset()).tqarg(r.getLength()).tqarg(r.getPeer()) << endl; notDownloaded(r,true); } @@ -207,7 +207,7 @@ namespace bt // see if we are dealing with a piece of ours if (chunk->getIndex() == r.getIndex()) { - Out(SYS_CON|LOG_DEBUG) << QString("Request timed out %1 %2 %3 %4").arg(r.getIndex()).arg(r.getOffset()).arg(r.getLength()).arg(r.getPeer()) << endl; + Out(SYS_CON|LOG_DEBUG) << TQString("Request timed out %1 %2 %3 %4").tqarg(r.getIndex()).tqarg(r.getOffset()).tqarg(r.getLength()).tqarg(r.getPeer()) << endl; notDownloaded(r,false); } @@ -216,7 +216,7 @@ namespace bt void ChunkDownload::sendRequests(PeerDownloader* pd) { timer.update(); - DownloadStatus* ds = dstatus.find(pd->getPeer()->getID()); + DownloadtqStatus* ds = dstatus.tqfind(pd->getPeer()->getID()); if (!ds) return; @@ -229,7 +229,7 @@ namespace bt { // get the first one in the queue Uint32 i = piece_queue.first(); - if (!ds->contains(i)) + if (!ds->tqcontains(i)) { // send request pd->download( @@ -255,18 +255,18 @@ namespace bt void ChunkDownload::update() { // go over all PD's and do requets again - for (QPtrList<PeerDownloader>::iterator i = pdown.begin();i != pdown.end();++i) + for (TQPtrList<PeerDownloader>::iterator i = pdown.begin();i != pdown.end();++i) sendRequests(*i); } void ChunkDownload::sendCancels(PeerDownloader* pd) { - DownloadStatus* ds = dstatus.find(pd->getPeer()->getID()); + DownloadtqStatus* ds = dstatus.tqfind(pd->getPeer()->getID()); if (!ds) return; - DownloadStatus::iterator itr = ds->begin(); + DownloadtqStatus::iterator itr = ds->begin(); while (itr != ds->end()) { Uint32 i = *itr; @@ -283,13 +283,13 @@ namespace bt void ChunkDownload::endgameCancel(const Piece & p) { - QPtrList<PeerDownloader>::iterator i = pdown.begin(); + TQPtrList<PeerDownloader>::iterator i = pdown.begin(); while (i != pdown.end()) { PeerDownloader* pd = *i; - DownloadStatus* ds = dstatus.find(pd->getPeer()->getID()); + DownloadtqStatus* ds = dstatus.tqfind(pd->getPeer()->getID()); Uint32 pp = p.getOffset() / MAX_PIECE_LEN; - if (ds && ds->contains(pp)) + if (ds && ds->tqcontains(pp)) { pd->cancel(Request(p)); ds->remove(pp); @@ -300,13 +300,13 @@ namespace bt void ChunkDownload::peerKilled(PeerDownloader* pd) { - if (!pdown.contains(pd)) + if (!pdown.tqcontains(pd)) return; dstatus.erase(pd->getPeer()->getID()); pdown.remove(pd); - disconnect(pd,SIGNAL(timedout(const Request& )),this,SLOT(onTimeout(const Request& ))); - disconnect(pd,SIGNAL(rejected( const Request& )),this,SLOT(onRejected( const Request& ))); + disconnect(pd,TQT_SIGNAL(timedout(const Request& )),this,TQT_SLOT(onTimeout(const Request& ))); + disconnect(pd,TQT_SIGNAL(rejected( const Request& )),this,TQT_SLOT(onRejected( const Request& ))); } @@ -323,11 +323,11 @@ namespace bt return chunk->getIndex(); } - QString ChunkDownload::getCurrentPeerID() const + TQString ChunkDownload::getCurrentPeerID() const { if (pdown.count() == 0) { - return QString::null; + return TQString(); } else if (pdown.count() == 1) { @@ -343,7 +343,7 @@ namespace bt Uint32 ChunkDownload::getDownloadSpeed() const { Uint32 r = 0; - QPtrList<PeerDownloader>::const_iterator i = pdown.begin(); + TQPtrList<PeerDownloader>::const_iterator i = pdown.begin(); while (i != pdown.end()) { const PeerDownloader* pd = *i; @@ -360,7 +360,7 @@ namespace bt ChunkDownloadHeader hdr; hdr.index = chunk->getIndex(); hdr.num_bits = pieces.getNumBits(); - hdr.buffered = chunk->getStatus() == Chunk::BUFFERED ? 1 : 0; + hdr.buffered = chunk->gettqStatus() == Chunk::BUFFERED ? 1 : 0; // save the chunk header file.write(&hdr,sizeof(ChunkDownloadHeader)); // save the bitset @@ -370,7 +370,7 @@ namespace bt // if it's a buffered chunk, save the contents to file.write(chunk->getData(),chunk->getSize()); chunk->clear(); - chunk->setStatus(Chunk::ON_DISK); + chunk->settqStatus(Chunk::ON_DISK); } } @@ -415,7 +415,7 @@ namespace bt void ChunkDownload::cancelAll() { - QPtrList<PeerDownloader>::iterator i = pdown.begin(); + TQPtrList<PeerDownloader>::iterator i = pdown.begin(); while (i != pdown.end()) { sendCancels(*i); @@ -448,7 +448,7 @@ namespace bt bool ChunkDownload::isChoked() const { - QPtrList<PeerDownloader>::const_iterator i = pdown.begin(); + TQPtrList<PeerDownloader>::const_iterator i = pdown.begin(); while (i != pdown.end()) { const PeerDownloader* pd = *i; diff --git a/libktorrent/torrent/chunkdownload.h b/libktorrent/torrent/chunkdownload.h index 4119a5b..c1960f0 100644 --- a/libktorrent/torrent/chunkdownload.h +++ b/libktorrent/torrent/chunkdownload.h @@ -21,8 +21,8 @@ #define BTCHUNKDOWNLOAD_H #include <set> -#include <qobject.h> -#include <qptrlist.h> +#include <tqobject.h> +#include <tqptrlist.h> #include <util/timer.h> #include <util/ptrmap.h> #include <util/sha1hashgen.h> @@ -41,7 +41,7 @@ namespace bt class Peer; class Request; class PeerDownloader; - class DownloadStatus; + class DownloadtqStatus; struct ChunkDownloadHeader { @@ -59,9 +59,10 @@ namespace bt * * This class handles the download of one Chunk. */ - class ChunkDownload : public QObject,public kt::ChunkDownloadInterface + class ChunkDownload : public TQObject,public kt::ChunkDownloadInterface { Q_OBJECT + TQ_OBJECT public: /** * Constructor, set the chunk and the PeerManager. @@ -90,7 +91,7 @@ namespace bt const Peer* getCurrentPeer() const; /// Get the PeerID of the current peer - QString getCurrentPeerID() const; + TQString getCurrentPeerID() const; /// Get the download speed Uint32 getDownloadSpeed() const; @@ -152,7 +153,7 @@ namespace bt bool getOnlyDownloader(Uint32 & pid); /// See if a PeerDownloader is assigned to this chunk - bool containsPeer(PeerDownloader *pd) {return pdown.contains(pd);} + bool containsPeer(PeerDownloader *pd) {return pdown.tqcontains(pd);} /// See if the download is choked (i.e. all downloaders are choked) bool isChoked() const; @@ -185,14 +186,14 @@ namespace bt private: BitSet pieces; - QValueList<Uint32> piece_queue; + TQValueList<Uint32> piece_queue; Chunk* chunk; Uint32 num; Uint32 num_downloaded; Uint32 last_size; Timer timer; - QPtrList<PeerDownloader> pdown; - PtrMap<Uint32,DownloadStatus> dstatus; + TQPtrList<PeerDownloader> pdown; + PtrMap<Uint32,DownloadtqStatus> dstatus; std::set<Uint32> piece_providers; diff --git a/libktorrent/torrent/chunkmanager.cpp b/libktorrent/torrent/chunkmanager.cpp index 08aac97..ac45be5 100644 --- a/libktorrent/torrent/chunkmanager.cpp +++ b/libktorrent/torrent/chunkmanager.cpp @@ -21,7 +21,7 @@ #include <algorithm> #include <util/file.h> #include <util/array.h> -#include <qstringlist.h> +#include <tqstringlist.h> #include "chunkmanager.h" #include "torrent.h" #include <util/error.h> @@ -43,8 +43,8 @@ namespace bt ChunkManager::ChunkManager( Torrent & tor, - const QString & tmpdir, - const QString & datadir, + const TQString & tmpdir, + const TQString & datadir, bool custom_output_name) : tor(tor),chunks(tor.getNumChunks()), bitset(tor.getNumChunks()),excluded_chunks(tor.getNumChunks()),only_seed_chunks(tor.getNumChunks()),todo(tor.getNumChunks()) @@ -79,8 +79,8 @@ namespace bt for (Uint32 i = 0;i < tor.getNumFiles();i++) { TorrentFile & tf = tor.getFile(i); - connect(&tf,SIGNAL(downloadPriorityChanged(TorrentFile*, Priority, Priority )), - this,SLOT(downloadPriorityChanged(TorrentFile*, Priority, Priority ))); + connect(&tf,TQT_SIGNAL(downloadPriorityChanged(TorrentFile*, Priority, Priority )), + this,TQT_SLOT(downloadPriorityChanged(TorrentFile*, Priority, Priority ))); if (tf.getPriority() != NORMAL_PRIORITY) { @@ -135,12 +135,12 @@ namespace bt delete cache; } - QString ChunkManager::getDataDir() const + TQString ChunkManager::getDataDir() const { return cache->getDataDir(); } - void ChunkManager::changeDataDir(const QString & data_dir) + void ChunkManager::changeDataDir(const TQString & data_dir) { cache->changeTmpDir(data_dir); index_file = data_dir + "index"; @@ -148,7 +148,7 @@ namespace bt file_priority_file = data_dir + "file_priority"; } - KIO::Job* ChunkManager::moveDataFiles(const QString & ndir) + KIO::Job* ChunkManager::moveDataFiles(const TQString & ndir) { return cache->moveDataFiles(ndir); } @@ -158,7 +158,7 @@ namespace bt cache->moveDataFilesCompleted(job); } - void ChunkManager::changeOutputPath(const QString & output_path) + void ChunkManager::changeOutputPath(const TQString & output_path) { cache->changeOutputPath(output_path); } @@ -189,7 +189,7 @@ namespace bt Chunk* c = getChunk(hdr.index); if (c) { - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); bitset.set(hdr.index,true); todo.set(hdr.index,false); recalc_chunks_left = true; @@ -204,12 +204,12 @@ namespace bt { File fptr; if (!fptr.open(index_file,"wb")) - throw Error(i18n("Cannot open index file %1 : %2").arg(index_file).arg(fptr.errorString())); + throw Error(i18n("Cannot open index file %1 : %2").tqarg(index_file).tqarg(fptr.errorString())); for (unsigned int i = 0;i < tor.getNumChunks();i++) { Chunk* c = getChunk(i); - if (c->getStatus() != Chunk::NOT_DOWNLOADED) + if (c->gettqStatus() != Chunk::NOT_DOWNLOADED) { NewChunkHeader hdr; hdr.index = i; @@ -232,8 +232,8 @@ namespace bt for (Uint32 i = 0;i < tor.getNumFiles();i++) { TorrentFile & tf = tor.getFile(i); - connect(&tf,SIGNAL(downloadPriorityChanged(TorrentFile*, Priority, Priority )), - this,SLOT(downloadPriorityChanged(TorrentFile*, Priority, Priority ))); + connect(&tf,TQT_SIGNAL(downloadPriorityChanged(TorrentFile*, Priority, Priority )), + this,TQT_SLOT(downloadPriorityChanged(TorrentFile*, Priority, Priority ))); if (tf.getPriority() != NORMAL_PRIORITY) { @@ -243,7 +243,7 @@ namespace bt } } - bool ChunkManager::hasMissingFiles(QStringList & sl) + bool ChunkManager::hasMissingFiles(TQStringList & sl) { return cache->hasMissingFiles(sl); } @@ -267,16 +267,16 @@ namespace bt for (Uint32 i = 0;i < bitset.getNumBits();i++) { Chunk* c = chunks[i]; - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) { cache->save(c); c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); } - else if (c->getStatus() == Chunk::BUFFERED) + else if (c->gettqStatus() == Chunk::BUFFERED) { c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); } } cache->close(); @@ -288,11 +288,11 @@ namespace bt return 0; Chunk* c = chunks[i]; - if (c->getStatus() == Chunk::NOT_DOWNLOADED || c->isExcluded()) + if (c->gettqStatus() == Chunk::NOT_DOWNLOADED || c->isExcluded()) { return 0; } - else if (c->getStatus() == Chunk::ON_DISK) + else if (c->gettqStatus() == Chunk::ON_DISK) { // load the chunk if it is on disk cache->load(c); @@ -338,10 +338,10 @@ namespace bt Chunk* c = chunks[i]; if (!c->taken()) { - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) cache->save(c); c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); loaded.remove(i); } } @@ -352,10 +352,10 @@ namespace bt return; Chunk* c = chunks[i]; - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) cache->save(c); c->clear(); - c->setStatus(Chunk::NOT_DOWNLOADED); + c->settqStatus(Chunk::NOT_DOWNLOADED); bitset.set(i,false); todo.set(i,!excluded_chunks.get(i) && !only_seed_chunks.get(i)); loaded.remove(i); @@ -365,18 +365,18 @@ namespace bt void ChunkManager::checkMemoryUsage() { Uint32 num_removed = 0; - QMap<Uint32,TimeStamp>::iterator i = loaded.begin(); + TQMap<Uint32,TimeStamp>::iterator i = loaded.begin(); while (i != loaded.end()) { Chunk* c = chunks[i.key()]; // get rid of chunk if nobody asked for it in the last 5 seconds if (!c->taken() && bt::GetCurrentTime() - i.data() > 5000) { - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) cache->save(c); c->clear(); - c->setStatus(Chunk::ON_DISK); - QMap<Uint32,TimeStamp>::iterator j = i; + c->settqStatus(Chunk::ON_DISK); + TQMap<Uint32,TimeStamp>::iterator j = i; i++; loaded.erase(j); num_removed++; @@ -387,7 +387,7 @@ namespace bt } } // Uint32 num_in_mem = loaded.count(); - // Out() << QString("Cleaned %1 chunks, %2 still in memory").arg(num_removed).arg(num_in_mem) << endl; + // Out() << TQString("Cleaned %1 chunks, %2 still in memory").tqarg(num_removed).tqarg(num_in_mem) << endl; } void ChunkManager::saveChunk(unsigned int i,bool update_index) @@ -413,7 +413,7 @@ namespace bt else { c->clear(); - c->setStatus(Chunk::NOT_DOWNLOADED); + c->settqStatus(Chunk::NOT_DOWNLOADED); Out(SYS_DIO|LOG_IMPORTANT) << "Warning: attempted to save a chunk which was excluded" << endl; } } @@ -429,7 +429,7 @@ namespace bt // try again if (!fptr.open(index_file,"r+b")) // panick if it failes - throw Error(i18n("Cannot open index file %1 : %2").arg(index_file).arg(fptr.errorString())); + throw Error(i18n("Cannot open index file %1 : %2").tqarg(index_file).tqarg(fptr.errorString())); } @@ -837,7 +837,7 @@ namespace bt // Out(SYS_DIO|LOG_DEBUG) << "Excluding chunks " << first << " to " << last << endl; // first and last chunk may be part of multiple files // so we can't just exclude them - QValueList<Uint32> files,last_files; + TQValueList<Uint32> files,last_files; // get list of files where first chunk lies in tor.calcChunkPos(first,files); @@ -874,7 +874,7 @@ namespace bt bool modified = false; // if one file in the list needs to be downloaded,increment first - for (QValueList<Uint32>::iterator i = files.begin();i != files.end();i++) + for (TQValueList<Uint32>::iterator i = files.begin();i != files.end();i++) { if (*i == tf->getIndex()) continue; @@ -903,7 +903,7 @@ namespace bt modified = false; // if one file in the list needs to be downloaded,decrement last - for (QValueList<Uint32>::iterator i = last_files.begin();i != last_files.end();i++) + for (TQValueList<Uint32>::iterator i = last_files.begin();i != last_files.end();i++) { if (*i == tf->getIndex()) continue; @@ -962,14 +962,14 @@ namespace bt // first and last chunk may be part of multiple files // so we can't just exclude them - QValueList<Uint32> files; + TQValueList<Uint32> files; // get list of files where first chunk lies in tor.calcChunkPos(first,files); Chunk* c = chunks[first]; // if one file in the list needs to be downloaded,increment first - for (QValueList<Uint32>::iterator i = files.begin();i != files.end();i++) + for (TQValueList<Uint32>::iterator i = files.begin();i != files.end();i++) { Priority np = tor.getFile(*i).getPriority(); if (np > newpriority && *i != tf->getIndex()) @@ -988,7 +988,7 @@ namespace bt tor.calcChunkPos(last,files); c = chunks[last]; // if one file in the list needs to be downloaded,decrement last - for (QValueList<Uint32>::iterator i = files.begin();i != files.end();i++) + for (TQValueList<Uint32>::iterator i = files.begin();i != files.end();i++) { Priority np = tor.getFile(*i).getPriority(); if (np > newpriority && *i != tf->getIndex()) @@ -1016,13 +1016,13 @@ namespace bt bool ChunkManager::prepareChunk(Chunk* c,bool allways) { - if (!allways && c->getStatus() != Chunk::NOT_DOWNLOADED) + if (!allways && c->gettqStatus() != Chunk::NOT_DOWNLOADED) return false; return cache->prep(c); } - QString ChunkManager::getOutputPath() const + TQString ChunkManager::getOutputPath() const { return cache->getOutputPath(); } @@ -1044,7 +1044,7 @@ namespace bt bitset.set(i,true); todo.set(i,false); // the chunk must be on disk - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); tor.updateFilePercentage(i,bitset); } else if (!ok_chunks.get(i) && bitset.get(i)) @@ -1053,12 +1053,12 @@ namespace bt // We think we have a chunk, but we don't bitset.set(i,false); todo.set(i,!only_seed_chunks.get(i) && !excluded_chunks.get(i)); - if (c->getStatus() == Chunk::ON_DISK) + if (c->gettqStatus() == Chunk::ON_DISK) { - c->setStatus(Chunk::NOT_DOWNLOADED); + c->settqStatus(Chunk::NOT_DOWNLOADED); tor.updateFilePercentage(i,bitset); } - else if (c->getStatus() == Chunk::MMAPPED || c->getStatus() == Chunk::BUFFERED) + else if (c->gettqStatus() == Chunk::MMAPPED || c->gettqStatus() == Chunk::BUFFERED) { resetChunk(i); } diff --git a/libktorrent/torrent/chunkmanager.h b/libktorrent/torrent/chunkmanager.h index daa2300..2ff2ca7 100644 --- a/libktorrent/torrent/chunkmanager.h +++ b/libktorrent/torrent/chunkmanager.h @@ -20,15 +20,15 @@ #ifndef BTCHUNKMANAGER_H #define BTCHUNKMANAGER_H -#include <qmap.h> -#include <qstring.h> -#include <qobject.h> -#include <qptrvector.h> +#include <tqmap.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqptrvector.h> #include <util/bitset.h> #include "chunk.h" #include "globals.h" -class QStringList; +class TQStringList; namespace KIO { @@ -58,15 +58,16 @@ namespace bt * The chunks are stored in the cache file in the correct order. Eliminating * the need for a file reconstruction algorithm for single files. */ - class ChunkManager : public QObject + class ChunkManager : public TQObject { Q_OBJECT + TQ_OBJECT Torrent & tor; - QString index_file,file_info_file,file_priority_file; - QPtrVector<Chunk> chunks; + TQString index_file,file_info_file,file_priority_file; + TQPtrVector<Chunk> chunks; Cache* cache; - QMap<Uint32,TimeStamp> loaded; // loaded chunks and when they were loaded + TQMap<Uint32,TimeStamp> loaded; // loaded chunks and when they were loaded BitSet bitset; BitSet excluded_chunks; BitSet only_seed_chunks; @@ -78,8 +79,8 @@ namespace bt bool during_load; public: ChunkManager(Torrent & tor, - const QString & tmpdir, - const QString & datadir, + const TQString & tmpdir, + const TQString & datadir, bool custom_output_name); virtual ~ChunkManager(); @@ -87,12 +88,12 @@ namespace bt const Torrent & getTorrent() const {return tor;} /// Get the data dir - QString getDataDir() const; + TQString getDataDir() const; /// Get the actual output path - QString getOutputPath() const; + TQString getOutputPath() const; - void changeOutputPath(const QString& output_path); + void changeOutputPath(const TQString& output_path); /// Remove obsolete chunks void checkMemoryUsage(); @@ -101,14 +102,14 @@ namespace bt * Change the data dir. * @param data_dir */ - void changeDataDir(const QString & data_dir); + void changeDataDir(const TQString & data_dir); /** * Move the data files of the torrent. * @param ndir The new directory * @return The job doing the move */ - KIO::Job* moveDataFiles(const QString & ndir); + KIO::Job* moveDataFiles(const TQString & ndir); /** * The move data files job has finished @@ -133,7 +134,7 @@ namespace bt * Test all files and see if they are not missing. * If so put them in a list */ - bool hasMissingFiles(QStringList & sl); + bool hasMissingFiles(TQStringList & sl); /** * Preallocate diskspace for all files @@ -357,7 +358,8 @@ namespace bt private slots: void downloadStatusChanged(TorrentFile* tf,bool download); void downloadPriorityChanged(TorrentFile* tf,Priority newpriority,Priority oldpriority); - + + private: static Uint32 max_chunk_size_for_data_check; }; diff --git a/libktorrent/torrent/chunkselector.cpp b/libktorrent/torrent/chunkselector.cpp index b1c42fa..9c05629 100644 --- a/libktorrent/torrent/chunkselector.cpp +++ b/libktorrent/torrent/chunkselector.cpp @@ -165,7 +165,7 @@ namespace bt for (Uint32 i = from;i <= to;i++) { bool in_chunks = std::find(chunks.begin(),chunks.end(),i) != chunks.end(); - if (!in_chunks && cman.getChunk(i)->getStatus() != Chunk::ON_DISK) + if (!in_chunks && cman.getChunk(i)->gettqStatus() != Chunk::ON_DISK) { // Out(SYS_DIO|LOG_DEBUG) << "ChunkSelector::reIncluded " << i << endl; chunks.push_back(i); diff --git a/libktorrent/torrent/dndfile.cpp b/libktorrent/torrent/dndfile.cpp index deace69..2ca669b 100644 --- a/libktorrent/torrent/dndfile.cpp +++ b/libktorrent/torrent/dndfile.cpp @@ -36,14 +36,14 @@ namespace bt Uint8 data_sha1[20]; }; - DNDFile::DNDFile(const QString & path) : path(path) + DNDFile::DNDFile(const TQString & path) : path(path) {} DNDFile::~DNDFile() {} - void DNDFile::changePath(const QString & npath) + void DNDFile::changePath(const TQString & npath) { path = npath; } @@ -105,7 +105,7 @@ namespace bt File fptr; if (!fptr.open(path,"wb")) - throw Error(i18n("Cannot create file %1 : %2").arg(path).arg(fptr.errorString())); + throw Error(i18n("Cannot create file %1 : %2").tqarg(path).tqarg(fptr.errorString())); fptr.write(&hdr,sizeof(DNDFileHeader)); fptr.close(); @@ -172,7 +172,7 @@ namespace bt create(); if (!fptr.open(path,"r+b")) { - throw Error(i18n("Failed to write first chunk to DND file : %1").arg(fptr.errorString())); + throw Error(i18n("Failed to write first chunk to DND file : %1").tqarg(fptr.errorString())); } } @@ -230,7 +230,7 @@ namespace bt create(); if (!fptr.open(path,"r+b")) { - throw Error(i18n("Failed to write last chunk to DND file : %1").arg(fptr.errorString())); + throw Error(i18n("Failed to write last chunk to DND file : %1").tqarg(fptr.errorString())); } } diff --git a/libktorrent/torrent/dndfile.h b/libktorrent/torrent/dndfile.h index a7a7e7b..09873d1 100644 --- a/libktorrent/torrent/dndfile.h +++ b/libktorrent/torrent/dndfile.h @@ -20,7 +20,7 @@ #ifndef BTDNDFILE_H #define BTDNDFILE_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace bt @@ -36,11 +36,11 @@ namespace bt class DNDFile { public: - DNDFile(const QString & path); + DNDFile(const TQString & path); virtual ~DNDFile(); /// Change the path of the file - void changePath(const QString & npath); + void changePath(const TQString & npath); /** * CHeck integrity of the file, create it if it doesn't exist. @@ -81,7 +81,7 @@ namespace bt void create(); private: - QString path; + TQString path; }; } diff --git a/libktorrent/torrent/downloadcap.h b/libktorrent/torrent/downloadcap.h index 2bda73c..e05be21 100644 --- a/libktorrent/torrent/downloadcap.h +++ b/libktorrent/torrent/downloadcap.h @@ -21,7 +21,7 @@ #define BTDOWNLOADCAP_H #if 0 -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <util/timer.h> #include "globals.h" #include "cap.h" diff --git a/libktorrent/torrent/downloader.cpp b/libktorrent/torrent/downloader.cpp index b8acdc7..b566ad7 100644 --- a/libktorrent/torrent/downloader.cpp +++ b/libktorrent/torrent/downloader.cpp @@ -52,8 +52,8 @@ namespace bt unnecessary_data = 0; current_chunks.setAutoDelete(true); - connect(&pman,SIGNAL(newPeer(Peer* )),this,SLOT(onNewPeer(Peer* ))); - connect(&pman,SIGNAL(peerKilled(Peer* )),this,SLOT(onPeerKilled(Peer*))); + connect(&pman,TQT_SIGNAL(newPeer(Peer* )),this,TQT_SLOT(onNewPeer(Peer* ))); + connect(&pman,TQT_SIGNAL(peerKilled(Peer* )),this,TQT_SLOT(onPeerKilled(Peer*))); } @@ -87,7 +87,7 @@ namespace bt } // if the chunk is not in memory, reload it - if (cd->getChunk()->getStatus() == Chunk::ON_DISK) + if (cd->getChunk()->gettqStatus() == Chunk::ON_DISK) { cman.prepareChunk(cd->getChunk(),true); } @@ -119,7 +119,7 @@ namespace bt downloaded += p.getLength(); // save to disk again, if it is idle - if (cd->isIdle() && cd->getChunk()->getStatus() == Chunk::MMAPPED) + if (cd->isIdle() && cd->getChunk()->gettqStatus() == Chunk::MMAPPED) { cman.saveChunk(cd->getChunk()->getIndex(),false); } @@ -160,7 +160,7 @@ namespace bt if (cd->isIdle()) // idle chunks do not need to be in memory { Chunk* c = cd->getChunk(); - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) { cman.saveChunk(cd->getChunk()->getIndex(),false); } @@ -169,7 +169,7 @@ namespace bt { cd->releaseAllPDs(); Chunk* c = cd->getChunk(); - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) { cman.saveChunk(cd->getChunk()->getIndex(),false); } @@ -277,7 +277,7 @@ namespace bt if (sel) { // if it is on disk, reload it - if (sel->getChunk()->getStatus() == Chunk::ON_DISK) + if (sel->getChunk()->gettqStatus() == Chunk::ON_DISK) cman.prepareChunk(sel->getChunk(),true); sel->assignPeer(pd); @@ -341,7 +341,7 @@ namespace bt if (cdmin) { // if it is on disk, reload it - if (cdmin->getChunk()->getStatus() == Chunk::ON_DISK) + if (cdmin->getChunk()->gettqStatus() == Chunk::ON_DISK) { cman.prepareChunk(cdmin->getChunk(),true); } @@ -354,14 +354,14 @@ namespace bt bool Downloader::areWeDownloading(Uint32 chunk) const { - return current_chunks.find(chunk) != 0; + return current_chunks.tqfind(chunk) != 0; } void Downloader::onNewPeer(Peer* peer) { PeerDownloader* pd = peer->getPeerDownloader(); - connect(pd,SIGNAL(downloaded(const Piece& )), - this,SLOT(pieceRecieved(const Piece& ))); + connect(pd,TQT_SIGNAL(downloaded(const Piece& )), + this,TQT_SLOT(pieceRecieved(const Piece& ))); } void Downloader::onPeerKilled(Peer* peer) @@ -421,7 +421,7 @@ namespace bt Peer* p = pman.findPeer(pid); if (!p) return false; - QString IP(p->getIPAddresss()); + TQString IP(p->getIPAddresss()); Out(SYS_GEN|LOG_NOTICE) << "Peer " << IP << " sent bad data" << endl; IPBlocklist & ipfilter = IPBlocklist::instance(); ipfilter.insert( IP ); @@ -438,10 +438,10 @@ namespace bt { Uint32 ch = i->first; Chunk* c = i->second->getChunk(); - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) cman.saveChunk(ch,false); - c->setStatus(Chunk::NOT_DOWNLOADED); + c->settqStatus(Chunk::NOT_DOWNLOADED); } current_chunks.clear(); } @@ -473,7 +473,7 @@ namespace bt - void Downloader::saveDownloads(const QString & file) + void Downloader::saveDownloads(const TQString & file) { File fptr; if (!fptr.open(file,"wb")) @@ -496,7 +496,7 @@ namespace bt } } - void Downloader::loadDownloads(const QString & file) + void Downloader::loadDownloads(const TQString & file) { // don't load stuff if download is finished if (cman.completed()) @@ -531,7 +531,7 @@ namespace bt return; } - if (!cman.getChunk(hdr.index) || current_chunks.contains(hdr.index)) + if (!cman.getChunk(hdr.index) || current_chunks.tqcontains(hdr.index)) { Out() << "Illegal chunk " << hdr.index << endl; return; @@ -569,7 +569,7 @@ namespace bt curr_chunks_downloaded = 0; } - Uint32 Downloader::getDownloadedBytesOfCurrentChunksFile(const QString & file) + Uint32 Downloader::getDownloadedBytesOfCurrentChunksFile(const TQString & file) { // Load all partial downloads File fptr; @@ -628,7 +628,7 @@ namespace bt { for (Uint32 i = from;i <= to;i++) { - ChunkDownload* cd = current_chunks.find(i); + ChunkDownload* cd = current_chunks.tqfind(i); // let only seed chunks finish if (!cd || cman.getChunk(i)->getPriority() == ONLY_SEED_PRIORITY) continue; @@ -664,7 +664,7 @@ namespace bt { for (Uint32 i = 0;i < ok_chunks.getNumBits();i++) { - ChunkDownload* cd = current_chunks.find(i); + ChunkDownload* cd = current_chunks.tqfind(i); if (ok_chunks.get(i) && cd) { // we have a chunk and we are downloading it so kill it diff --git a/libktorrent/torrent/downloader.h b/libktorrent/torrent/downloader.h index 5b39eeb..fece8a6 100644 --- a/libktorrent/torrent/downloader.h +++ b/libktorrent/torrent/downloader.h @@ -20,7 +20,7 @@ #ifndef BTDOWNLOADER_H #define BTDOWNLOADER_H -#include <qobject.h> +#include <tqobject.h> #include <util/ptrmap.h> #include "globals.h" @@ -64,9 +64,10 @@ namespace bt * This class manages the downloading of the file. It should * regurarly be updated. */ - class Downloader : public QObject + class Downloader : public TQObject { Q_OBJECT + TQ_OBJECT public: /** @@ -109,20 +110,20 @@ namespace bt * Save the current downloads. * @param file The file to save to */ - void saveDownloads(const QString & file); + void saveDownloads(const TQString & file); /** * Load the current downloads. * @param file The file to load from */ - void loadDownloads(const QString & file); + void loadDownloads(const TQString & file); /** * Get the number of bytes already downloaded in the current_chunks file. * @param file The path of the current_chunks file * @return The bytes already downloading */ - Uint32 getDownloadedBytesOfCurrentChunksFile(const QString & file); + Uint32 getDownloadedBytesOfCurrentChunksFile(const TQString & file); /** * A corrupted chunk has been detected, make sure we redownload it. @@ -189,7 +190,7 @@ namespace bt * An error occurred while we we're writing or reading from disk. * @param msg Message */ - void ioError(const QString & msg); + void ioError(const TQString & msg); private: void downloadFrom(PeerDownloader* pd); diff --git a/libktorrent/torrent/globals.cpp b/libktorrent/torrent/globals.cpp index 0221c17..51dd7a1 100644 --- a/libktorrent/torrent/globals.cpp +++ b/libktorrent/torrent/globals.cpp @@ -61,7 +61,7 @@ namespace bt inst = 0; } - void Globals::initLog(const QString & file) + void Globals::initLog(const TQString & file) { log->setOutputFile(file); log->setOutputToConsole(debug_mode); diff --git a/libktorrent/torrent/globals.h b/libktorrent/torrent/globals.h index 7cfe3f5..16de41e 100644 --- a/libktorrent/torrent/globals.h +++ b/libktorrent/torrent/globals.h @@ -22,7 +22,7 @@ #include <util/constants.h> -class QString; +class TQString; namespace net { @@ -46,7 +46,7 @@ namespace bt public: virtual ~Globals(); - void initLog(const QString & file); + void initLog(const TQString & file); void initServer(Uint16 port); void setDebugMode(bool on) {debug_mode = on;} bool isDebugModeSet() const {return debug_mode;} diff --git a/libktorrent/torrent/httptracker.cpp b/libktorrent/torrent/httptracker.cpp index b220bc0..ad4bd79 100644 --- a/libktorrent/torrent/httptracker.cpp +++ b/libktorrent/torrent/httptracker.cpp @@ -21,7 +21,7 @@ #include <kurl.h> #include <klocale.h> -#include <qhostaddress.h> +#include <tqhostaddress.h> #include <util/log.h> #include <util/functions.h> #include <util/error.h> @@ -80,7 +80,7 @@ namespace bt { event = "completed"; doRequest(); - event = QString::null; + event = TQString(); } void HTTPTracker::manualUpdate() @@ -105,9 +105,9 @@ namespace bt } KURL scrape_url = url; - scrape_url.setFileName(url.fileName(false).replace("announce","scrape")); + scrape_url.setFileName(url.fileName(false).tqreplace("announce","scrape")); - QString epq = scrape_url.encodedPathAndQuery(); + TQString epq = scrape_url.encodedPathAndQuery(); const SHA1Hash & info_hash = tor->getInfoHash(); if (scrape_url.queryItems().count() > 0) epq += "&info_hash=" + info_hash.toURLString(); @@ -124,7 +124,7 @@ namespace bt j->setMetaData(md); KIO::Scheduler::scheduleJob(j); - connect(j,SIGNAL(result(KIO::Job* )),this,SLOT(onScrapeResult( KIO::Job* ))); + connect(j,TQT_SIGNAL(result(KIO::Job* )),this,TQT_SLOT(onScrapeResult( KIO::Job* ))); } void HTTPTracker::onScrapeResult(KIO::Job* j) @@ -152,7 +152,7 @@ namespace bt if (n && n->getType() == BNode::DICT) { BDictNode* d = (BDictNode*)n; - d = d->getDict("files"); + d = d->getDict(TQString("files")); if (d) { d = d->getDict(tor->getInfoHash().toByteArray()); @@ -188,21 +188,21 @@ namespace bt if (!url.isValid()) { requestPending(); - QTimer::singleShot(500,this,SLOT(emitInvalidURLFailure())); + TQTimer::singleShot(500,this,TQT_SLOT(emitInvalidURLFailure())); return; } Uint16 port = Globals::instance().getServer().getPortInUse();; u.addQueryItem("peer_id",peer_id.toString()); - u.addQueryItem("port",QString::number(port)); - u.addQueryItem("uploaded",QString::number(s.trk_bytes_uploaded)); - u.addQueryItem("downloaded",QString::number(s.trk_bytes_downloaded)); + u.addQueryItem("port",TQString::number(port)); + u.addQueryItem("uploaded",TQString::number(s.trk_bytes_uploaded)); + u.addQueryItem("downloaded",TQString::number(s.trk_bytes_downloaded)); if (event == "completed") u.addQueryItem("left","0"); // need to send 0 when we are completed else - u.addQueryItem("left",QString::number(s.bytes_left)); + u.addQueryItem("left",TQString::number(s.bytes_left)); u.addQueryItem("compact","1"); if (event != "stopped") @@ -210,14 +210,14 @@ namespace bt else u.addQueryItem("numwant","0"); - u.addQueryItem("key",QString::number(key)); - QString cip = Tracker::getCustomIP(); + u.addQueryItem("key",TQString::number(key)); + TQString cip = Tracker::getCustomIP(); if (!cip.isNull()) u.addQueryItem("ip",cip); - if (event != QString::null) + if (event != TQString()) u.addQueryItem("event",event); - QString epq = u.encodedPathAndQuery(); + TQString epq = u.encodedPathAndQuery(); const SHA1Hash & info_hash = tor->getInfoHash(); epq += "&info_hash=" + info_hash.toURLString(); @@ -238,12 +238,12 @@ namespace bt } } - bool HTTPTracker::updateData(const QByteArray & data) + bool HTTPTracker::updateData(const TQByteArray & data) { //#define DEBUG_PRINT_RESPONSE #ifdef DEBUG_PRINT_RESPONSE Out() << "Data : " << endl; - Out() << QString(data) << endl; + Out() << TQString(data) << endl; #endif // search for dictionary, there might be random garbage infront of the data Uint32 i = 0; @@ -285,7 +285,7 @@ namespace bt if (dict->getData("failure reason")) { BValueNode* vn = dict->getValue("failure reason"); - QString msg = vn->data().toString(); + TQString msg = vn->data().toString(); delete n; failures++; requestFailed(msg); @@ -321,14 +321,14 @@ namespace bt return false; } - QByteArray arr = vn->data().toByteArray(); + TQByteArray arr = vn->data().toByteArray(); for (Uint32 i = 0;i < arr.size();i+=6) { Uint8 buf[6]; for (int j = 0;j < 6;j++) buf[j] = arr[i + j]; - addPeer(QHostAddress(ReadUint32(buf,0)).toString(),ReadUint16(buf,4)); + addPeer(TQHostAddress(ReadUint32(buf,0)).toString(),ReadUint16(buf,4)); } } else @@ -398,7 +398,7 @@ namespace bt failures++; requestFailed(i18n("Invalid response from tracker")); } - event = QString::null; + event = TQString(); } else { @@ -429,7 +429,7 @@ namespace bt if (url.isValid()) md["UseProxy"] = url.pathOrURL(); else - md["UseProxy"] = QString::null; + md["UseProxy"] = TQString(); } } @@ -453,7 +453,7 @@ namespace bt j->setMetaData(md); KIO::Scheduler::scheduleJob(j); - connect(j,SIGNAL(result(KIO::Job* )),this,SLOT(onAnnounceResult( KIO::Job* ))); + connect(j,TQT_SIGNAL(result(KIO::Job* )),this,TQT_SLOT(onAnnounceResult( KIO::Job* ))); active_job = j; requestPending(); diff --git a/libktorrent/torrent/httptracker.h b/libktorrent/torrent/httptracker.h index 8ac7e69..effb4b7 100644 --- a/libktorrent/torrent/httptracker.h +++ b/libktorrent/torrent/httptracker.h @@ -20,7 +20,7 @@ #ifndef BTHTTPTRACKER_H #define BTHTTPTRACKER_H -#include <qtimer.h> +#include <tqtimer.h> #include "tracker.h" namespace KIO @@ -42,6 +42,7 @@ namespace bt class HTTPTracker : public Tracker { Q_OBJECT + TQ_OBJECT public: HTTPTracker(const KURL & url,kt::TorrentInterface* tor,const PeerID & id,int tier); virtual ~HTTPTracker(); @@ -60,7 +61,7 @@ namespace bt private: void doRequest(WaitJob* wjob = 0); - bool updateData(const QByteArray & data); + bool updateData(const TQByteArray & data); void setupMetaData(KIO::MetaData & md); void doAnnounceQueue(); void doAnnounce(const KURL & u); @@ -68,7 +69,7 @@ namespace bt private: KIO::Job* active_job; KURL::List announce_queue; - QString event; + TQString event; Uint32 failures; }; diff --git a/libktorrent/torrent/ipblocklist.cpp b/libktorrent/torrent/ipblocklist.cpp index de30968..04afe26 100644 --- a/libktorrent/torrent/ipblocklist.cpp +++ b/libktorrent/torrent/ipblocklist.cpp @@ -20,9 +20,9 @@ ***************************************************************************/ #include "ipblocklist.h" -#include <qmap.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqstring.h> +#include <tqstringlist.h> #include <util/constants.h> #include <util/log.h> #include "globals.h" @@ -31,7 +31,7 @@ namespace bt { - Uint32 toUint32(const QString& ip, bool* ok) + Uint32 toUint32(const TQString& ip, bool* ok) { bool test; *ok = true; @@ -69,29 +69,29 @@ namespace bt IPBlocklist::IPBlocklist(const IPBlocklist & ) {} - void IPBlocklist::insert( QString ip, int state ) + void IPBlocklist::insert( TQString ip, int state ) { bool ok; Uint32 ipi = toUint32(ip, &ok); if(!ok) return; - IPKey key(ipi,0xFFFFFFFF); //-- you can test ranges here. Just specify your mask. + IPKey key(ipi,0xFFFFFFFF); //-- you can test ranges here. Just specify your tqmask. insertRangeIP(key, state); Out(SYS_IPF|LOG_NOTICE) << "IP " << ip << " banned." << endl; } - void IPBlocklist::addRange(QString ip) + void IPBlocklist::addRange(TQString ip) { bool ok; int tmp = 0; Uint32 addr = 0; - Uint32 mask = 0xFFFFFFFF; + Uint32 tqmask = 0xFFFFFFFF; tmp = ip.section('.',0,0).toInt(&ok); if(!ok) { if(ip.section('.',0,0) == "*") - mask &= 0x00FFFFFF; + tqmask &= 0x00FFFFFF; else return; //illegal character } else @@ -102,7 +102,7 @@ namespace bt { addr <<= 8; if(ip.section('.',1,1) == "*") - mask &= 0xFF00FFFF; + tqmask &= 0xFF00FFFF; else return; //illegal character } else @@ -116,7 +116,7 @@ namespace bt { addr <<= 8; if(ip.section('.',2,2) == "*") - mask &= 0xFFFF00FF; + tqmask &= 0xFFFF00FF; else return; //illegal character } else @@ -130,7 +130,7 @@ namespace bt { addr <<= 8; if(ip.section('.',3,3) == "*") - mask &=0xFFFFFF00; + tqmask &=0xFFFFFF00; else return; //illegal character } else @@ -139,21 +139,21 @@ namespace bt addr |= tmp; } - IPKey key(addr, mask); + IPKey key(addr, tqmask); this->insertRangeIP(key); } void IPBlocklist::insertRangeIP(IPKey& key, int state) { -// Out() << "Blocked range: " << key.m_ip << " - " << key.m_mask << endl; - QMap<IPKey, int>::iterator it; - if ((it = m_peers.find(key)) != m_peers.end()) +// Out() << "Blocked range: " << key.m_ip << " - " << key.m_tqmask << endl; + TQMap<IPKey, int>::iterator it; + if ((it = m_peers.tqfind(key)) != m_peers.end()) { - if(it.key().m_mask != key.m_mask) + if(it.key().m_tqmask != key.m_tqmask) { int st = it.data(); - IPKey key1(key.m_ip, it.key().m_mask | key.m_mask); + IPKey key1(key.m_ip, it.key().m_tqmask | key.m_tqmask); m_peers.insert(key1, state+st); return; } @@ -163,18 +163,18 @@ namespace bt m_peers.insert(key,state); } - void IPBlocklist::removeRange(QString ip) + void IPBlocklist::removeRange(TQString ip) { bool ok; int tmp = 0; Uint32 addr = 0; - Uint32 mask = 0xFFFFFFFF; + Uint32 tqmask = 0xFFFFFFFF; tmp = ip.section('.',0,0).toInt(&ok); if(!ok) { if(ip.section('.',0,0) == "*") - mask &= 0x00FFFFFF; + tqmask &= 0x00FFFFFF; else return; //illegal character } else @@ -185,7 +185,7 @@ namespace bt { addr <<= 8; if(ip.section('.',1,1) == "*") - mask &= 0xFF00FFFF; + tqmask &= 0xFF00FFFF; else return; //illegal character } else @@ -199,7 +199,7 @@ namespace bt { addr <<= 8; if(ip.section('.',2,2) == "*") - mask &= 0xFFFF00FF; + tqmask &= 0xFFFF00FF; else return; //illegal character } else @@ -213,7 +213,7 @@ namespace bt { addr <<= 8; if(ip.section('.',3,3) == "*") - mask &=0xFFFFFF00; + tqmask &=0xFFFFFF00; else return; //illegal character } else @@ -222,9 +222,9 @@ namespace bt addr |= tmp; } - IPKey key(addr, mask); + IPKey key(addr, tqmask); - QMap<IPKey, int>::iterator it = m_peers.find(key); + TQMap<IPKey, int>::iterator it = m_peers.tqfind(key); if (it == m_peers.end()) return; @@ -236,7 +236,7 @@ namespace bt this->pluginInterface = ptr; } - bool IPBlocklist::isBlocked(const QString& ip ) + bool IPBlocklist::isBlocked(const TQString& ip ) { //First check local filter list if(isBlockedLocal(ip)) @@ -255,7 +255,7 @@ namespace bt return false; } - bool IPBlocklist::isBlockedLocal(const QString& ip ) + bool IPBlocklist::isBlockedLocal(const TQString& ip ) { bool ok; Uint32 ipi = toUint32(ip,&ok); @@ -263,15 +263,15 @@ namespace bt return false; IPKey key(ipi); - QMap<IPKey, int>::iterator it; - it = m_peers.find(key); + TQMap<IPKey, int>::iterator it; + it = m_peers.tqfind(key); if (it==m_peers.end()) return false; return m_peers[key] >= 3; } - bool IPBlocklist::isBlockedPlugin(const QString& ip ) + bool IPBlocklist::isBlockedPlugin(const TQString& ip ) { if (pluginInterface == 0) //the plugin is not loaded return false; @@ -279,10 +279,10 @@ namespace bt return pluginInterface->isBlockedIP(ip); } - QStringList* IPBlocklist::getBlocklist() + TQStringList* IPBlocklist::getBlocklist() { - QStringList* ret = new QStringList(); - QMap<IPKey,int>::iterator it = m_peers.begin(); + TQStringList* ret = new TQStringList(); + TQMap<IPKey,int>::iterator it = m_peers.begin(); for( ;it!=m_peers.end();++it) { IPKey key = it.key(); @@ -292,10 +292,10 @@ namespace bt return ret; } - void IPBlocklist::setBlocklist(QStringList* list) + void IPBlocklist::setBlocklist(TQStringList* list) { m_peers.clear(); - for (QStringList::Iterator it = list->begin(); it != list->end(); ++it ) + for (TQStringList::Iterator it = list->begin(); it != list->end(); ++it ) addRange(*it); } @@ -304,11 +304,11 @@ namespace bt IPKey::IPKey() { m_ip = 0; - m_mask = 0xFFFFFFFF; + m_tqmask = 0xFFFFFFFF; } - IPKey::IPKey(QString& ip, Uint32 mask) - : m_mask(mask) + IPKey::IPKey(TQString& ip, Uint32 tqmask) + : m_tqmask(tqmask) { bool ok; this->m_ip = toUint32(ip, &ok); @@ -317,81 +317,81 @@ namespace bt IPKey::IPKey(const IPKey& ip) { m_ip = ip.m_ip; - m_mask = ip.m_mask; + m_tqmask = ip.m_tqmask; } - IPKey::IPKey(Uint32 ip, Uint32 mask) - : m_ip(ip), m_mask(mask) + IPKey::IPKey(Uint32 ip, Uint32 tqmask) + : m_ip(ip), m_tqmask(tqmask) {} - QString IPKey::toString() + TQString IPKey::toString() { - Uint32 tmp, tmpmask; + Uint32 tmp, tmptqmask; Uint32 ip = m_ip; - Uint32 mask = m_mask; - QString out; + Uint32 tqmask = m_tqmask; + TQString out; tmp = ip; - tmpmask = mask; + tmptqmask = tqmask; tmp &= 0x000000FF; - tmpmask &= 0x000000FF; - if(tmpmask == 0) + tmptqmask &= 0x000000FF; + if(tmptqmask == 0) out.prepend("*"); else - out.prepend(QString("%1").arg(tmp)); + out.prepend(TQString("%1").tqarg(tmp)); ip >>= 8; - mask >>= 8; + tqmask >>= 8; tmp = ip; - tmpmask = mask; + tmptqmask = tqmask; tmp &= 0x000000FF; - tmpmask &= 0x000000FF; - if(tmpmask == 0) + tmptqmask &= 0x000000FF; + if(tmptqmask == 0) out.prepend("*."); else - out.prepend(QString("%1.").arg(tmp)); + out.prepend(TQString("%1.").tqarg(tmp)); ip >>= 8; - mask >>= 8; + tqmask >>= 8; tmp = ip; - tmpmask = mask; + tmptqmask = tqmask; tmp &= 0x000000FF; - tmpmask &= 0x000000FF; - if(tmpmask == 0) + tmptqmask &= 0x000000FF; + if(tmptqmask == 0) out.prepend("*."); else - out.prepend(QString("%1.").arg(tmp)); + out.prepend(TQString("%1.").tqarg(tmp)); ip >>= 8; - mask >>= 8; + tqmask >>= 8; tmp = ip; - tmpmask = mask; + tmptqmask = tqmask; tmp &= 0x000000FF; - tmpmask &= 0x000000FF; - if(tmpmask == 0) + tmptqmask &= 0x000000FF; + if(tmptqmask == 0) out.prepend("*."); else - out.prepend(QString("%1.").arg(tmp)); + out.prepend(TQString("%1.").tqarg(tmp)); return out; } bool IPKey::operator ==(const IPKey& ip) const { - return (m_ip & m_mask) == m_mask & ip.m_ip; + return (m_ip & m_tqmask) == m_tqmask & ip.m_ip; } bool IPKey::operator !=(const IPKey& ip) const { - return (m_ip & m_mask) != m_mask & ip.m_ip; + return (m_ip & m_tqmask) != m_tqmask & ip.m_ip; } bool IPKey::operator < (const IPKey& ip) const { - return (m_ip & m_mask) < (m_mask & ip.m_ip); + return (m_ip & m_tqmask) < (m_tqmask & ip.m_ip); } IPKey& IPKey::operator =(const IPKey& ip) { m_ip = ip.m_ip; - m_mask = ip.m_mask; + m_tqmask = ip.m_tqmask; return *this; } diff --git a/libktorrent/torrent/ipblocklist.h b/libktorrent/torrent/ipblocklist.h index b30a856..51e5aa5 100644 --- a/libktorrent/torrent/ipblocklist.h +++ b/libktorrent/torrent/ipblocklist.h @@ -23,11 +23,11 @@ #include <interfaces/ipblockinginterface.h> -#include <qmap.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqstringlist.h> #include <util/constants.h> -class QString; +class TQString; namespace bt { @@ -35,8 +35,8 @@ namespace bt { public: IPKey(); - IPKey(QString& ip, Uint32 mask = 0xFFFFFFFF); - IPKey(Uint32 ip, Uint32 mask = 0xFFFFFFFF); + IPKey(TQString& ip, Uint32 tqmask = 0xFFFFFFFF); + IPKey(Uint32 ip, Uint32 tqmask = 0xFFFFFFFF); IPKey(const IPKey& ip); ~IPKey(); @@ -45,10 +45,10 @@ namespace bt bool operator < (const IPKey & ip) const; IPKey& operator= (const IPKey& ip); - QString toString(); + TQString toString(); Uint32 m_ip; - Uint32 m_mask; + Uint32 m_tqmask; }; /** @@ -77,33 +77,33 @@ namespace bt /** * @brief Adds ip address to the list. * It also increases the number of times this IP appeared in the list. - * @param ip QString containing the peer IP address + * @param ip TQString containing the peer IP address * @param state int number of bad chunks client from ip sent. Basically this parameter * is used only to permanently block some IP (by setting this param to 3) */ - void insert(QString ip, int state=1); + void insert(TQString ip, int state=1); /** * @brief Adds IP range to the list * It is used for blocking plugin. For single IP use insert() instead. - * @param ip QString peer IP address. Uses ''*" for ranges. + * @param ip TQString peer IP address. Uses ''*" for ranges. **/ - void addRange(QString ip); + void addRange(TQString ip); /** * @brief Removes IP range from list * It is used for blocking plugin. - * @param ip QString peer IP address. Uses ''*" for ranges. + * @param ip TQString peer IP address. Uses ''*" for ranges. **/ - void removeRange(QString ip); + void removeRange(TQString ip); /** * Checks if IP is in the blocking list * @param ip - IP address to check * @returns true if IP is blocked */ - bool isBlocked(const QString& ip); + bool isBlocked(const TQString& ip); /** * @brief Sets the pointer to the IPBlockingInterface (IPBlocking plugin) @@ -120,19 +120,19 @@ namespace bt /** - * @brief This function will fill QStringList with all banned peer IP addresses. - * @return QStringList filled with blacklisted peers. - * It will create a new QStringList object so don't forget to delete it after using. + * @brief This function will fill TQStringList with all banned peer IP addresses. + * @return TQStringList filled with blacklisted peers. + * It will create a new TQStringList object so don't forget to delete it after using. */ - QStringList* getBlocklist(); + TQStringList* getBlocklist(); /** * @brief This function will load blacklisted peers to IPFilter. - * @param list QStringList containing all banned peers. + * @param list TQStringList containing all banned peers. * @note This function will remove current peers from blocklist before setting new list!!! */ - void setBlocklist(QStringList* list); + void setBlocklist(TQStringList* list); private: @@ -143,10 +143,10 @@ namespace bt kt::IPBlockingInterface* pluginInterface; /** - * @param IPKey - Key: Peer IP address and bit mask if it is a range + * @param IPKey - Key: Peer IP address and bit tqmask if it is a range * @param int - Number of bad chunks sent. **/ - QMap<IPKey, int> m_peers; + TQMap<IPKey, int> m_peers; /** * @brief Adds IP range to the list. @@ -161,13 +161,13 @@ namespace bt * Checks if IP is listed in local database (IPBlocklist::m_peers) * @return TRUE if IP is to be blocked */ - bool isBlockedLocal(const QString& ip); + bool isBlockedLocal(const TQString& ip); /** * Checks if IP is listed in plugins antip2p file * @return TRUE if IP is to be blocked */ - bool isBlockedPlugin(const QString& ip); + bool isBlockedPlugin(const TQString& ip); }; } diff --git a/libktorrent/torrent/movedatafilesjob.cpp b/libktorrent/torrent/movedatafilesjob.cpp index c0c24e7..c3fc854 100644 --- a/libktorrent/torrent/movedatafilesjob.cpp +++ b/libktorrent/torrent/movedatafilesjob.cpp @@ -30,7 +30,7 @@ namespace bt MoveDataFilesJob::~MoveDataFilesJob() {} - void MoveDataFilesJob::addMove(const QString & src,const QString & dst) + void MoveDataFilesJob::addMove(const TQString & src,const TQString & dst) { todo.insert(src,dst); } @@ -53,7 +53,7 @@ namespace bt else { success.insert(active_src,active_dst); - active_src = active_dst = QString::null; + active_src = active_dst = TQString(); active_job = 0; startMoving(); } @@ -76,13 +76,13 @@ namespace bt return; } - QMap<QString,QString>::iterator i = todo.begin(); + TQMap<TQString,TQString>::iterator i = todo.begin(); active_job = KIO::move(KURL::fromPathOrURL(i.key()),KURL::fromPathOrURL(i.data()),false); active_src = i.key(); active_dst = i.data(); Out(SYS_GEN|LOG_DEBUG) << "Moving " << active_src << " -> " << active_dst << endl; - connect(active_job,SIGNAL(result(KIO::Job*)),this,SLOT(onJobDone(KIO::Job*))); - connect(active_job,SIGNAL(canceled(KIO::Job*)),this,SLOT(onCanceled(KIO::Job*))); + connect(active_job,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(onJobDone(KIO::Job*))); + connect(active_job,TQT_SIGNAL(canceled(KIO::Job*)),this,TQT_SLOT(onCanceled(KIO::Job*))); todo.erase(i); } @@ -93,10 +93,10 @@ namespace bt emitResult(); return; } - QMap<QString,QString>::iterator i = success.begin(); + TQMap<TQString,TQString>::iterator i = success.begin(); active_job = KIO::move(KURL::fromPathOrURL(i.data()),KURL::fromPathOrURL(i.key()),false); - connect(active_job,SIGNAL(result(KIO::Job*)),this,SLOT(onJobDone(KIO::Job*))); - connect(active_job,SIGNAL(canceled(KIO::Job*)),this,SLOT(onCanceled(KIO::Job*))); + connect(active_job,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(onJobDone(KIO::Job*))); + connect(active_job,TQT_SIGNAL(canceled(KIO::Job*)),this,TQT_SLOT(onCanceled(KIO::Job*))); success.erase(i); } } diff --git a/libktorrent/torrent/movedatafilesjob.h b/libktorrent/torrent/movedatafilesjob.h index b0002d9..272ac14 100644 --- a/libktorrent/torrent/movedatafilesjob.h +++ b/libktorrent/torrent/movedatafilesjob.h @@ -32,6 +32,7 @@ namespace bt class MoveDataFilesJob : public KIO::Job { Q_OBJECT + TQ_OBJECT public: MoveDataFilesJob(); virtual ~MoveDataFilesJob(); @@ -41,7 +42,7 @@ namespace bt * @param src File to move * @param dst Where to move it to */ - void addMove(const QString & src,const QString & dst); + void addMove(const TQString & src,const TQString & dst); /** * Start moving the files. @@ -58,9 +59,9 @@ namespace bt private: bool err; KIO::Job* active_job; - QString active_src,active_dst; - QMap<QString,QString> todo; - QMap<QString,QString> success; + TQString active_src,active_dst; + TQMap<TQString,TQString> todo; + TQMap<TQString,TQString> success; }; } diff --git a/libktorrent/torrent/multifilecache.cpp b/libktorrent/torrent/multifilecache.cpp index c6af92c..88f6d69 100644 --- a/libktorrent/torrent/multifilecache.cpp +++ b/libktorrent/torrent/multifilecache.cpp @@ -18,9 +18,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include <errno.h> -#include <qdir.h> -#include <qstringlist.h> -#include <qfileinfo.h> +#include <tqdir.h> +#include <tqstringlist.h> +#include <tqfileinfo.h> #include <klocale.h> #include <kio/netaccess.h> #include <util/file.h> @@ -44,10 +44,10 @@ namespace bt { static Uint64 FileOffset(Chunk* c,const TorrentFile & f,Uint64 chunk_size); static Uint64 FileOffset(Uint32 cindex,const TorrentFile & f,Uint64 chunk_size); - static void DeleteEmptyDirs(const QString & output_dir,const QString & fpath); + static void DeleteEmptyDirs(const TQString & output_dir,const TQString & fpath); - MultiFileCache::MultiFileCache(Torrent& tor,const QString & tmpdir,const QString & datadir,bool custom_output_name) : Cache(tor, tmpdir,datadir) + MultiFileCache::MultiFileCache(Torrent& tor,const TQString & tmpdir,const TQString & datadir,bool custom_output_name) : Cache(tor, tmpdir,datadir) { cache_dir = tmpdir + "cache" + bt::DirSeparator(); if (datadir.length() == 0) @@ -63,7 +63,7 @@ namespace bt MultiFileCache::~MultiFileCache() {} - QString MultiFileCache::guessDataDir() + TQString MultiFileCache::guessDataDir() { for (Uint32 i = 0;i < tor.getNumFiles();i++) { @@ -71,13 +71,13 @@ namespace bt if (tf.doNotDownload()) continue; - QString p = cache_dir + tf.getPath(); - QFileInfo fi(p); + TQString p = cache_dir + tf.getPath(); + TQFileInfo fi(p); if (!fi.isSymLink()) continue; - QString dst = fi.readLink(); - QString tmp = tor.getNameSuggestion() + bt::DirSeparator() + tf.getPath(); + TQString dst = fi.readLink(); + TQString tmp = tor.getNameSuggestion() + bt::DirSeparator() + tf.getPath(); dst = dst.left(dst.length() - tmp.length()); if (dst.length() == 0) continue; @@ -88,10 +88,10 @@ namespace bt return dst; } - return QString::null; + return TQString(); } - QString MultiFileCache::getOutputPath() const + TQString MultiFileCache::getOutputPath() const { return output_dir; } @@ -103,7 +103,7 @@ namespace bt void MultiFileCache::open() { - QString dnd_dir = tmpdir + "dnd" + bt::DirSeparator(); + TQString dnd_dir = tmpdir + "dnd" + bt::DirSeparator(); // open all files for (Uint32 i = 0;i < tor.getNumFiles();i++) { @@ -114,7 +114,7 @@ namespace bt { if (!tf.doNotDownload()) { - if (files.contains(i)) + if (files.tqcontains(i)) files.erase(i); fd = new CacheFile(); @@ -123,7 +123,7 @@ namespace bt } else { - if (dnd_files.contains(i)) + if (dnd_files.tqcontains(i)) dnd_files.erase(i); dfd = new DNDFile(dnd_dir + tf.getPath() + ".dnd"); @@ -142,11 +142,11 @@ namespace bt } } - void MultiFileCache::changeTmpDir(const QString& ndir) + void MultiFileCache::changeTmpDir(const TQString& ndir) { Cache::changeTmpDir(ndir); cache_dir = tmpdir + "cache/"; - QString dnd_dir = tmpdir + "dnd" + bt::DirSeparator(); + TQString dnd_dir = tmpdir + "dnd" + bt::DirSeparator(); // change paths for individual files, it should not // be a problem to move these files when they are open @@ -155,20 +155,20 @@ namespace bt TorrentFile & tf = tor.getFile(i); if (tf.doNotDownload()) { - DNDFile* dfd = dnd_files.find(i); + DNDFile* dfd = dnd_files.tqfind(i); if (dfd) dfd->changePath(dnd_dir + tf.getPath() + ".dnd"); } else { - CacheFile* fd = files.find(i); + CacheFile* fd = files.tqfind(i); if (fd) fd->changePath(cache_dir + tf.getPath()); } } } - void MultiFileCache::changeOutputPath(const QString & outputpath) + void MultiFileCache::changeOutputPath(const TQString & outputpath) { output_dir = outputpath; if (!output_dir.endsWith(bt::DirSeparator())) @@ -184,7 +184,7 @@ namespace bt TorrentFile & tf = tor.getFile(i); if (!tf.doNotDownload()) { - QString fpath = tf.getPath(); + TQString fpath = tf.getPath(); if (bt::Exists(output_dir + fpath)) { bt::Delete(cache_dir + fpath,true); // delete any existing symlinks @@ -195,12 +195,12 @@ namespace bt } } - KIO::Job* MultiFileCache::moveDataFiles(const QString & ndir) + KIO::Job* MultiFileCache::moveDataFiles(const TQString & ndir) { if (!bt::Exists(ndir)) bt::MakeDir(ndir); - QString nd = ndir; + TQString nd = ndir; if (!nd.endsWith(bt::DirSeparator())) nd += bt::DirSeparator(); @@ -215,8 +215,8 @@ namespace bt // check if every directory along the path exists, and if it doesn't // create it - QStringList sl = QStringList::split(bt::DirSeparator(),nd + tf.getPath()); - QString odir = bt::DirSeparator(); + TQStringList sl = TQStringList::split(bt::DirSeparator(),nd + tf.getPath()); + TQString odir = bt::DirSeparator(); for (Uint32 i = 0;i < sl.count() - 1;i++) { odir += sl[i] + bt::DirSeparator(); @@ -271,14 +271,14 @@ namespace bt void MultiFileCache::touch(TorrentFile & tf) { - QString fpath = tf.getPath(); + TQString fpath = tf.getPath(); bool dnd = tf.doNotDownload(); // first split fpath by / separator - QStringList sl = QStringList::split(bt::DirSeparator(),fpath); + TQStringList sl = TQStringList::split(bt::DirSeparator(),fpath); // create all necessary subdirs - QString ctmp = cache_dir; - QString otmp = output_dir; - QString dtmp = tmpdir + "dnd" + bt::DirSeparator(); + TQString ctmp = cache_dir; + TQString otmp = output_dir; + TQString dtmp = tmpdir + "dnd" + bt::DirSeparator(); for (Uint32 i = 0;i < sl.count() - 1;i++) { otmp += sl[i]; @@ -301,7 +301,7 @@ namespace bt bt::Delete(cache_dir + fpath,true); // delete any existing symlinks // then make the file - QString tmp = dnd ? tmpdir + "dnd" + bt::DirSeparator() : output_dir; + TQString tmp = dnd ? tmpdir + "dnd" + bt::DirSeparator() : output_dir; if (dnd) { // only symlink, when we open the files a default dnd file will be made if the file is corrupt or doesn't exist @@ -325,14 +325,14 @@ namespace bt void MultiFileCache::load(Chunk* c) { - QValueList<Uint32> tflist; + TQValueList<Uint32> tflist; tor.calcChunkPos(c->getIndex(),tflist); // one file is simple, just mmap it if (tflist.count() == 1) { const TorrentFile & f = tor.getFile(tflist.first()); - CacheFile* fd = files.find(tflist.first()); + CacheFile* fd = files.tqfind(tflist.first()); if (!fd) return; @@ -357,8 +357,8 @@ namespace bt for (Uint32 i = 0;i < tflist.count();i++) { const TorrentFile & f = tor.getFile(tflist[i]); - CacheFile* fd = files.find(tflist[i]); - DNDFile* dfd = dnd_files.find(tflist[i]); + CacheFile* fd = files.tqfind(tflist[i]); + DNDFile* dfd = dnd_files.tqfind(tflist[i]); // first calculate offset into file // only the first file can have an offset @@ -404,7 +404,7 @@ namespace bt bool MultiFileCache::prep(Chunk* c) { // find out in which files a chunk lies - QValueList<Uint32> tflist; + TQValueList<Uint32> tflist; tor.calcChunkPos(c->getIndex(),tflist); // Out() << "Prep " << c->getIndex() << endl; @@ -412,7 +412,7 @@ namespace bt { // in one so just mmap it Uint64 off = FileOffset(c,tor.getFile(tflist.first()),tor.getChunkSize()); - CacheFile* fd = files.find(tflist.first()); + CacheFile* fd = files.tqfind(tflist.first()); Uint8* buf = 0; if (fd && Cache::mappedModeAllowed() && mmap_failures < 3) { @@ -425,7 +425,7 @@ namespace bt { // if mmap fails or is not possible use buffered mode c->allocate(); - c->setStatus(Chunk::BUFFERED); + c->settqStatus(Chunk::BUFFERED); } else { @@ -436,26 +436,26 @@ namespace bt { // just allocate it c->allocate(); - c->setStatus(Chunk::BUFFERED); + c->settqStatus(Chunk::BUFFERED); } return true; } void MultiFileCache::save(Chunk* c) { - QValueList<Uint32> tflist; + TQValueList<Uint32> tflist; tor.calcChunkPos(c->getIndex(),tflist); - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) { // mapped chunks are easy - CacheFile* fd = files.find(tflist[0]); + CacheFile* fd = files.tqfind(tflist[0]); if (!fd) return; fd->unmap(c->getData(),c->getSize()); c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); return; } @@ -464,8 +464,8 @@ namespace bt for (Uint32 i = 0;i < tflist.count();i++) { const TorrentFile & f = tor.getFile(tflist[i]); - CacheFile* fd = files.find(tflist[i]); - DNDFile* dfd = dnd_files.find(tflist[i]); + CacheFile* fd = files.tqfind(tflist[i]); + DNDFile* dfd = dnd_files.tqfind(tflist[i]); // first calculate offset into file // only the first file can have an offset @@ -506,13 +506,13 @@ namespace bt // set the chunk to on disk and clear it c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); } void MultiFileCache::downloadStatusChanged(TorrentFile* tf, bool download) { bool dnd = !download; - QString dnd_dir = tmpdir + "dnd" + bt::DirSeparator(); + TQString dnd_dir = tmpdir + "dnd" + bt::DirSeparator(); // if it is dnd and it is already in the dnd tree do nothing if (dnd && bt::Exists(dnd_dir + tf->getPath() + ".dnd")) return; @@ -587,12 +587,12 @@ namespace bt - void MultiFileCache::saveFirstAndLastChunk(TorrentFile* tf,const QString & src_file,const QString & dst_file) + void MultiFileCache::saveFirstAndLastChunk(TorrentFile* tf,const TQString & src_file,const TQString & dst_file) { DNDFile out(dst_file); File fptr; if (!fptr.open(src_file,"rb")) - throw Error(i18n("Cannot open file %1 : %2").arg(src_file).arg(fptr.errorString())); + throw Error(i18n("Cannot open file %1 : %2").tqarg(src_file).tqarg(fptr.errorString())); Uint32 cs = 0; if (tf->getFirstChunk() == tor.getNumChunks() - 1) @@ -626,7 +626,7 @@ namespace bt } } - void MultiFileCache::recreateFile(TorrentFile* tf,const QString & dnd_file,const QString & output_file) + void MultiFileCache::recreateFile(TorrentFile* tf,const TQString & dnd_file,const TQString & output_file) { DNDFile dnd(dnd_file); @@ -654,7 +654,7 @@ namespace bt // first attempt failed, must be fat so try that if (!FatPreallocate(output_file,tf->getSize())) { - throw Error(i18n("Cannot preallocate diskspace : %1").arg(strerror(errno))); + throw Error(i18n("Cannot preallocate diskspace : %1").tqarg(strerror(errno))); } } @@ -670,7 +670,7 @@ namespace bt File fptr; if (!fptr.open(output_file,"r+b")) - throw Error(i18n("Cannot open file %1 : %2").arg(output_file).arg(fptr.errorString())); + throw Error(i18n("Cannot open file %1 : %2").tqarg(output_file).tqarg(fptr.errorString())); Uint32 ts = cs - tf->getFirstChunkOffset() > tf->getLastChunkSize() ? @@ -719,7 +719,7 @@ namespace bt } } - bool MultiFileCache::hasMissingFiles(QStringList & sl) + bool MultiFileCache::hasMissingFiles(TQStringList & sl) { bool ret = false; for (Uint32 i = 0;i < tor.getNumFiles();i++) @@ -728,8 +728,8 @@ namespace bt if (tf.doNotDownload()) continue; - QString p = cache_dir + tf.getPath(); - QFileInfo fi(p); + TQString p = cache_dir + tf.getPath(); + TQFileInfo fi(p); // always use symlink first, file might have been moved if (!fi.exists()) { @@ -755,21 +755,21 @@ namespace bt return ret; } - static void DeleteEmptyDirs(const QString & output_dir,const QString & fpath) + static void DeleteEmptyDirs(const TQString & output_dir,const TQString & fpath) { - QStringList sl = QStringList::split(bt::DirSeparator(),fpath); + TQStringList sl = TQStringList::split(bt::DirSeparator(),fpath); // remove the last, which is just the filename sl.pop_back(); while (sl.count() > 0) { - QString path = output_dir; + TQString path = output_dir; // reassemble the full directory path - for (QStringList::iterator itr = sl.begin(); itr != sl.end();itr++) + for (TQStringList::iterator itr = sl.begin(); itr != sl.end();itr++) path += *itr + bt::DirSeparator(); - QDir dir(path); - QStringList el = dir.entryList(QDir::All|QDir::System|QDir::Hidden); + TQDir dir(path); + TQStringList el = dir.entryList(TQDir::All|TQDir::System|TQDir::Hidden); el.remove("."); el.remove(".."); if (el.count() == 0) @@ -782,14 +782,14 @@ namespace bt else { - // children, so we cannot delete any more directories higher up + // tqchildren, so we cannot delete any more directories higher up return; } } // now the output_dir itself - QDir dir(output_dir); - QStringList el = dir.entryList(QDir::All|QDir::System|QDir::Hidden); + TQDir dir(output_dir); + TQStringList el = dir.entryList(TQDir::All|TQDir::System|TQDir::Hidden); el.remove("."); el.remove(".."); if (el.count() == 0) @@ -804,7 +804,7 @@ namespace bt for (Uint32 i = 0;i < tor.getNumFiles();i++) { TorrentFile & tf = tor.getFile(i); - QString fpath = tf.getPath(); + TQString fpath = tf.getPath(); if (!tf.doNotDownload()) { // first delete the file @@ -828,7 +828,7 @@ namespace bt try { - CacheFile* cf = files.find(i); + CacheFile* cf = files.tqfind(i); if (cf) { sum += cf->diskUsage(); diff --git a/libktorrent/torrent/multifilecache.h b/libktorrent/torrent/multifilecache.h index 9c1280e..ed09525 100644 --- a/libktorrent/torrent/multifilecache.h +++ b/libktorrent/torrent/multifilecache.h @@ -39,34 +39,34 @@ namespace bt */ class MultiFileCache : public Cache { - QString cache_dir,output_dir; + TQString cache_dir,output_dir; PtrMap<Uint32,CacheFile> files; PtrMap<Uint32,DNDFile> dnd_files; public: - MultiFileCache(Torrent& tor,const QString & tmpdir,const QString & datadir,bool custom_output_name); + MultiFileCache(Torrent& tor,const TQString & tmpdir,const TQString & datadir,bool custom_output_name); virtual ~MultiFileCache(); - virtual void changeTmpDir(const QString& ndir); + virtual void changeTmpDir(const TQString& ndir); virtual void create(); virtual void load(Chunk* c); virtual void save(Chunk* c); virtual bool prep(Chunk* c); virtual void close(); virtual void open(); - virtual QString getOutputPath() const; - virtual void changeOutputPath(const QString & outputpath); - virtual KIO::Job* moveDataFiles(const QString & ndir); + virtual TQString getOutputPath() const; + virtual void changeOutputPath(const TQString & outputpath); + virtual KIO::Job* moveDataFiles(const TQString & ndir); virtual void moveDataFilesCompleted(KIO::Job* job); virtual void preallocateDiskSpace(PreallocationThread* prealloc); - virtual bool hasMissingFiles(QStringList & sl); + virtual bool hasMissingFiles(TQStringList & sl); virtual void deleteDataFiles(); virtual Uint64 diskUsage(); private: void touch(TorrentFile & tf); virtual void downloadStatusChanged(TorrentFile*, bool); - QString guessDataDir(); - void saveFirstAndLastChunk(TorrentFile* tf,const QString & src_file,const QString & dst_file); - void recreateFile(TorrentFile* tf,const QString & dnd_file,const QString & output_file); + TQString guessDataDir(); + void saveFirstAndLastChunk(TorrentFile* tf,const TQString & src_file,const TQString & dst_file); + void recreateFile(TorrentFile* tf,const TQString & dnd_file,const TQString & output_file); }; } diff --git a/libktorrent/torrent/oldchokealgorithm.cpp b/libktorrent/torrent/oldchokealgorithm.cpp index e24d63a..6c529ce 100644 --- a/libktorrent/torrent/oldchokealgorithm.cpp +++ b/libktorrent/torrent/oldchokealgorithm.cpp @@ -109,7 +109,7 @@ namespace bt void OldChokeAlgorithm::updateDownloaders() { - QPtrList<Peer>::iterator itr = interested.begin(); + TQPtrList<Peer>::iterator itr = interested.begin(); int num = 0; // send all downloaders an unchoke for (;itr != interested.end();itr++) @@ -152,7 +152,7 @@ namespace bt if (downloaders.count() == 0) return; - QPtrList<Peer>::iterator itr = not_interested.begin(); + TQPtrList<Peer>::iterator itr = not_interested.begin(); // fd = fastest_downloader Peer* fd = downloaders.first(); // send all downloaders an unchoke @@ -188,8 +188,8 @@ namespace bt } // Get current time - QTime now = QTime::currentTime(); - QPtrList<Peer> peers; // list to store peers to select from + TQTime now = TQTime::currentTime(); + TQPtrList<Peer> peers; // list to store peers to select from // recently connected peers == peers connected in the last 5 minutes const int RECENTLY_CONNECT_THRESH = 5*60; diff --git a/libktorrent/torrent/packet.cpp b/libktorrent/torrent/packet.cpp index febede2..4e6cf01 100644 --- a/libktorrent/torrent/packet.cpp +++ b/libktorrent/torrent/packet.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qstring.h> +#include <tqstring.h> #include <string.h> #include <util/log.h> #include <util/bitset.h> @@ -86,7 +86,7 @@ namespace bt memcpy(data+13,ch->getData() + begin,len); } - Packet::Packet(Uint8 ext_id,const QByteArray & ext_data) : data(0),size(0),written(0) + Packet::Packet(Uint8 ext_id,const TQByteArray & ext_data) : data(0),size(0),written(0) { size = 6 + ext_data.size(); data = AllocPacket(size,EXTENDED); @@ -131,23 +131,23 @@ namespace bt } /* - QString Packet::debugString() const + TQString Packet::debugString() const { if (!data) - return QString::null; + return TQString(); switch (data[4]) { - case CHOKE : return QString("CHOKE %1 %2").arg(hdr_length).arg(data_length); - case UNCHOKE : return QString("UNCHOKE %1 %2").arg(hdr_length).arg(data_length); - case INTERESTED : return QString("INTERESTED %1 %2").arg(hdr_length).arg(data_length); - case NOT_INTERESTED : return QString("NOT_INTERESTED %1 %2").arg(hdr_length).arg(data_length); - case HAVE : return QString("HAVE %1 %2").arg(hdr_length).arg(data_length); - case BITFIELD : return QString("BITFIELD %1 %2").arg(hdr_length).arg(data_length); - case PIECE : return QString("PIECE %1 %2").arg(hdr_length).arg(data_length); - case REQUEST : return QString("REQUEST %1 %2").arg(hdr_length).arg(data_length); - case CANCEL : return QString("CANCEL %1 %2").arg(hdr_length).arg(data_length); - default: return QString("UNKNOWN %1 %2").arg(hdr_length).arg(data_length); + case CHOKE : return TQString("CHOKE %1 %2").tqarg(hdr_length).tqarg(data_length); + case UNCHOKE : return TQString("UNCHOKE %1 %2").tqarg(hdr_length).tqarg(data_length); + case INTERESTED : return TQString("INTERESTED %1 %2").tqarg(hdr_length).tqarg(data_length); + case NOT_INTERESTED : return TQString("NOT_INTERESTED %1 %2").tqarg(hdr_length).tqarg(data_length); + case HAVE : return TQString("HAVE %1 %2").tqarg(hdr_length).tqarg(data_length); + case BITFIELD : return TQString("BITFIELD %1 %2").tqarg(hdr_length).tqarg(data_length); + case PIECE : return TQString("PIECE %1 %2").tqarg(hdr_length).tqarg(data_length); + case REQUEST : return TQString("REQUEST %1 %2").tqarg(hdr_length).tqarg(data_length); + case CANCEL : return TQString("CANCEL %1 %2").tqarg(hdr_length).tqarg(data_length); + default: return TQString("UNKNOWN %1 %2").tqarg(hdr_length).tqarg(data_length); } } */ diff --git a/libktorrent/torrent/packet.h b/libktorrent/torrent/packet.h index 9259d31..d9eb550 100644 --- a/libktorrent/torrent/packet.h +++ b/libktorrent/torrent/packet.h @@ -22,7 +22,7 @@ #include "globals.h" -class QString; +class TQString; namespace bt { @@ -48,7 +48,7 @@ namespace bt Packet(const BitSet & bs); Packet(const Request & req,Uint8 type); Packet(Uint32 index,Uint32 begin,Uint32 len,Chunk* ch); - Packet(Uint8 ext_id,const QByteArray & ext_data); // extension protocol packet + Packet(Uint8 ext_id,const TQByteArray & ext_data); // extension protocol packet virtual ~Packet(); Uint8 getType() const {return data ? data[4] : 0;} diff --git a/libktorrent/torrent/packetreader.cpp b/libktorrent/torrent/packetreader.cpp index 8df348b..3d4910a 100644 --- a/libktorrent/torrent/packetreader.cpp +++ b/libktorrent/torrent/packetreader.cpp @@ -36,13 +36,13 @@ namespace bt #ifdef LOG_PACKET static void LogPacket(const Uint8* data,Uint32 size,Uint32 len) { - QString file = QString("/tmp/kt-packetreader-%1.log").arg(getpid()); + TQString file = TQString("/tmp/kt-packetreader-%1.log").tqarg(getpid()); File fptr; if (!fptr.open(file,"a")) return; - QString tmp = QString("PACKET len = %1, type = %2\nDATA: \n").arg(len).arg(data[0]); + TQString tmp = TQString("PACKET len = %1, type = %2\nDATA: \n").tqarg(len).tqarg(data[0]); fptr.write(tmp.ascii(),tmp.length()); @@ -51,7 +51,7 @@ namespace bt { for (Uint32 i = 0;i < size;i++) { - tmp = QString("0x%1 ").arg(data[i],0,16); + tmp = TQString("0x%1 ").tqarg(data[i],0,16); fptr.write(tmp.ascii(),tmp.length()); j++; if (j > 10) @@ -65,7 +65,7 @@ namespace bt { for (Uint32 i = 0;i < 20;i++) { - tmp = QString("0x%1 ").arg(data[i],0,16); + tmp = TQString("0x%1 ").tqarg(data[i],0,16); fptr.write(tmp.ascii(),tmp.length()); j++; if (j > 10) @@ -74,11 +74,11 @@ namespace bt j = 0; } } - tmp = QString("\n ... \n"); + tmp = TQString("\n ... \n"); fptr.write(tmp.ascii(),tmp.length()); for (Uint32 i = size - 20;i < size;i++) { - tmp = QString("0x%1 ").arg(data[i],0,16); + tmp = TQString("0x%1 ").tqarg(data[i],0,16); fptr.write(tmp.ascii(),tmp.length()); j++; if (j > 10) diff --git a/libktorrent/torrent/packetreader.h b/libktorrent/torrent/packetreader.h index da1e03e..782604d 100644 --- a/libktorrent/torrent/packetreader.h +++ b/libktorrent/torrent/packetreader.h @@ -20,8 +20,8 @@ #ifndef BTPACKETREADER_H #define BTPACKETREADER_H -#include <qmutex.h> -#include <qptrlist.h> +#include <tqmutex.h> +#include <tqptrlist.h> #include <net/bufferedsocket.h> #include "globals.h" @@ -46,8 +46,8 @@ namespace bt { Peer* peer; bool error; - QPtrList<IncomingPacket> packet_queue; - QMutex mutex; + TQPtrList<IncomingPacket> packet_queue; + TQMutex mutex; Uint8 len[4]; int len_received; public: diff --git a/libktorrent/torrent/packetwriter.cpp b/libktorrent/torrent/packetwriter.cpp index 888d23d..6c186dc 100644 --- a/libktorrent/torrent/packetwriter.cpp +++ b/libktorrent/torrent/packetwriter.cpp @@ -71,7 +71,7 @@ namespace bt void PacketWriter::queuePacket(Packet* p) { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); if (p->getType() == PIECE) data_packets.push_back(p); else @@ -194,8 +194,8 @@ namespace bt } else { - /* Out(SYS_CON|LOG_DEBUG) << QString("Uploading %1 %2 %3 %4 %5") - .arg(index).arg(begin).arg(len).arg((Q_ULLONG)ch,0,16).arg((Q_ULLONG)ch->getData(),0,16) + /* Out(SYS_CON|LOG_DEBUG) << TQString("Uploading %1 %2 %3 %4 %5") + .tqarg(index).tqarg(begin).tqarg(len).tqarg((TQ_ULLONG)ch,0,16).tqarg((TQ_ULLONG)ch->getData(),0,16) << endl;; */ queuePacket(new Packet(index,begin,len,ch)); @@ -205,25 +205,25 @@ namespace bt void PacketWriter::sendExtProtHandshake(Uint16 port,bool pex_on) { - QByteArray arr; + TQByteArray arr; BEncoder enc(new BEncoderBufferOutput(arr)); enc.beginDict(); - enc.write("m"); + enc.write(TQString("m")); // supported messages enc.beginDict(); - enc.write("ut_pex");enc.write((Uint32)(pex_on ? 1 : 0)); + enc.write(TQString("ut_pex"));enc.write((Uint32)(pex_on ? 1 : 0)); enc.end(); if (port > 0) { - enc.write("p"); + enc.write(TQString("p")); enc.write((Uint32)port); } - enc.write("v"); enc.write(QString("KTorrent %1").arg(kt::VERSION_STRING)); + enc.write(TQString("v")); enc.write(TQString("KTorrent %1").tqarg(kt::VERSION_STRING)); enc.end(); sendExtProtMsg(0,arr); } - void PacketWriter::sendExtProtMsg(Uint8 id,const QByteArray & data) + void PacketWriter::sendExtProtMsg(Uint8 id,const TQByteArray & data) { queuePacket(new Packet(id,data)); } @@ -259,7 +259,7 @@ namespace bt Uint32 PacketWriter::onReadyToWrite(Uint8* data,Uint32 max_to_write) { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); if (!curr_packet) curr_packet = selectPacket(); @@ -314,7 +314,7 @@ namespace bt Uint32 PacketWriter::getUploadedDataBytes() const { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); Uint32 ret = uploaded; uploaded = 0; return ret; @@ -322,7 +322,7 @@ namespace bt Uint32 PacketWriter::getUploadedNonDataBytes() const { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); Uint32 ret = uploaded_non_data; uploaded_non_data = 0; return ret; @@ -330,19 +330,19 @@ namespace bt Uint32 PacketWriter::getNumPacketsToWrite() const { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); return data_packets.size() + control_packets.size(); } Uint32 PacketWriter::getNumDataPacketsToWrite() const { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); return data_packets.size(); } void PacketWriter::doNotSendPiece(const Request & req,bool reject) { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); std::list<Packet*>::iterator i = data_packets.begin(); while (i != data_packets.end()) { @@ -370,7 +370,7 @@ namespace bt void PacketWriter::clearPieces(bool reject) { - QMutexLocker locker(&mutex); + TQMutexLocker locker(&mutex); std::list<Packet*>::iterator i = data_packets.begin(); while (i != data_packets.end()) diff --git a/libktorrent/torrent/packetwriter.h b/libktorrent/torrent/packetwriter.h index 9b77731..8330b65 100644 --- a/libktorrent/torrent/packetwriter.h +++ b/libktorrent/torrent/packetwriter.h @@ -21,7 +21,7 @@ #define BTPACKETWRITER_H #include <list> -#include <qmutex.h> +#include <tqmutex.h> #include <net/bufferedsocket.h> #include "globals.h" @@ -45,7 +45,7 @@ namespace bt Uint32 ctrl_packets_sent; mutable Uint32 uploaded; mutable Uint32 uploaded_non_data; - mutable QMutex mutex; + mutable TQMutex mutex; public: PacketWriter(Peer* peer); virtual ~PacketWriter(); @@ -145,7 +145,7 @@ namespace bt void sendExtProtHandshake(Uint16 port,bool pex_on = true); /// Send an extended protocol message - void sendExtProtMsg(Uint8 id,const QByteArray & data); + void sendExtProtMsg(Uint8 id,const TQByteArray & data); /// Get the number of packets which need to be written Uint32 getNumPacketsToWrite() const; diff --git a/libktorrent/torrent/peer.cpp b/libktorrent/torrent/peer.cpp index 7a5727b..6e5f519 100644 --- a/libktorrent/torrent/peer.cpp +++ b/libktorrent/torrent/peer.cpp @@ -66,7 +66,7 @@ namespace bt time_choked = GetCurrentTime(); time_unchoked = 0; - connect_time = QTime::currentTime(); + connect_time = TQTime::currentTime(); //sock->attachPeer(this); stats.client = peer_id.identifyClient(); stats.ip_address = getIPAddresss(); @@ -353,7 +353,7 @@ namespace bt return; } - QByteArray tmp; + TQByteArray tmp; tmp.setRawData((const char*)packet,size); BNode* node = 0; try @@ -365,7 +365,7 @@ namespace bt BDictNode* dict = (BDictNode*)node; // handshake packet, so just check if the peer supports ut_pex - dict = dict->getDict("m"); + dict = dict->getDict(TQString("m")); BValueNode* val = 0; if (dict && (val = dict->getValue("ut_pex"))) { @@ -490,12 +490,12 @@ namespace bt return pieces.allOn(); } - QString Peer::getIPAddresss() const + TQString Peer::getIPAddresss() const { if (sock) return sock->getRemoteIPAddress(); else - return QString::null; + return TQString(); } Uint16 Peer::getPort() const @@ -555,7 +555,7 @@ namespace bt gotPortPacket(sock->getRemoteIPAddress(),sock->getRemotePort()); } - void Peer::emitPex(const QByteArray & data) + void Peer::emitPex(const TQByteArray & data) { pex(data); } diff --git a/libktorrent/torrent/peer.h b/libktorrent/torrent/peer.h index 68dfecc..bb487aa 100644 --- a/libktorrent/torrent/peer.h +++ b/libktorrent/torrent/peer.h @@ -20,8 +20,8 @@ #ifndef BTPEER_H #define BTPEER_H -#include <qobject.h> -#include <qdatetime.h> +#include <tqobject.h> +#include <tqdatetime.h> #include <util/timer.h> #include <interfaces/peerinterface.h> #include <util/bitset.h> @@ -64,10 +64,11 @@ namespace bt * It provides functions for sending packets. Packets it receives * get relayed to the outside world using a bunch of signals. */ - class Peer : public QObject, public kt::PeerInterface + class Peer : public TQObject, public kt::PeerInterface //,public Object { Q_OBJECT + TQ_OBJECT public: /** * Constructor, set the socket. @@ -92,7 +93,7 @@ namespace bt Uint32 getID() const {return id;} /// Get the IP address of the Peer. - QString getIPAddresss() const; + TQString getIPAddresss() const; /// Get the port of the Peer Uint16 getPort() const; @@ -197,7 +198,7 @@ namespace bt Uint32 getTimeSinceLastPiece() const; /// Get the time the peer connection was established. - const QTime & getConnectTime() const {return connect_time;} + const TQTime & getConnectTime() const {return connect_time;} /** * Get the percentual amount of data available from peer. @@ -224,7 +225,7 @@ namespace bt /** * Emit the pex signal */ - void emitPex(const QByteArray & data); + void emitPex(const TQByteArray & data); /// Disable or enable pex void setPexEnabled(bool on); @@ -281,12 +282,12 @@ namespace bt * @param ip The IP * @param port The port */ - void gotPortPacket(const QString & ip,Uint16 port); + void gotPortPacket(const TQString & ip,Uint16 port); /** - * A Peer Exchange has been received, the QByteArray contains the data. + * A Peer Exchange has been received, the TQByteArray contains the data. */ - void pex(const QByteArray & data); + void pex(const TQByteArray & data); private: void packetReady(const Uint8* packet,Uint32 size); @@ -310,7 +311,7 @@ namespace bt PeerDownloader* downloader; PeerUploader* uploader; mutable kt::PeerInterface::Stats stats; - QTime connect_time; + TQTime connect_time; UTPex* ut_pex; bool pex_allowed; Uint32 utorrent_pex_id; diff --git a/libktorrent/torrent/peerdownloader.cpp b/libktorrent/torrent/peerdownloader.cpp index 0c6cdd8..00e0b7a 100644 --- a/libktorrent/torrent/peerdownloader.cpp +++ b/libktorrent/torrent/peerdownloader.cpp @@ -70,8 +70,8 @@ namespace bt PeerDownloader::PeerDownloader(Peer* peer,Uint32 chunk_size) : peer(peer),grabbed(0),chunk_size(chunk_size / MAX_PIECE_LEN) { - connect(peer,SIGNAL(piece(const Piece& )),this,SLOT(piece(const Piece& ))); - connect(peer,SIGNAL(destroyed()),this,SLOT(peerDestroyed())); + connect(peer,TQT_SIGNAL(piece(const Piece& )),this,TQT_SLOT(piece(const Piece& ))); + connect(peer,TQT_SIGNAL(destroyed()),this,TQT_SLOT(peerDestroyed())); nearly_done = false; max_wait_queue_size = 25; } @@ -83,7 +83,7 @@ namespace bt #if 0 void PeerDownloader::retransmitRequests() { - for (QValueList<Request>::iterator i = reqs.begin();i != reqs.end();i++) + for (TQValueList<Request>::iterator i = reqs.begin();i != reqs.end();i++) peer->getPacketWriter().sendRequest(*i); } @@ -126,11 +126,11 @@ namespace bt if (!peer) return; - if (wait_queue.contains(req)) + if (wait_queue.tqcontains(req)) { wait_queue.remove(req); } - else if (reqs.contains(req)) + else if (reqs.tqcontains(req)) { reqs.remove(req); peer->getPacketWriter().sendCancel(req); @@ -144,7 +144,7 @@ namespace bt // Out(SYS_CON|LOG_DEBUG) << "Rejected : " << req.getIndex() << " " // << req.getOffset() << " " << req.getLength() << endl; - if (reqs.contains(req)) + if (reqs.tqcontains(req)) { reqs.remove(req); rejected(req); @@ -155,7 +155,7 @@ namespace bt { if (peer) { - QValueList<TimeStampedRequest>::iterator i = reqs.begin(); + TQValueList<TimeStampedRequest>::iterator i = reqs.begin(); while (i != reqs.end()) { TimeStampedRequest & tr = *i; @@ -171,9 +171,9 @@ namespace bt void PeerDownloader::piece(const Piece & p) { Request r(p); - if (wait_queue.contains(r)) + if (wait_queue.tqcontains(r)) wait_queue.remove(r); - else if (reqs.contains(r)) + else if (reqs.tqcontains(r)) reqs.remove(r); downloaded(p); @@ -214,7 +214,7 @@ namespace bt TimeStamp now = bt::GetCurrentTime(); // we use a 60 second interval const Uint32 MAX_INTERVAL = 60 * 1000; - QValueList<TimeStampedRequest>::iterator i = reqs.begin(); + TQValueList<TimeStampedRequest>::iterator i = reqs.begin(); while (i != reqs.end()) { TimeStampedRequest & tr = *i; @@ -266,7 +266,7 @@ namespace bt if (peer->getStats().fast_extensions) return; - QValueList<TimeStampedRequest>::iterator i = reqs.begin(); + TQValueList<TimeStampedRequest>::iterator i = reqs.begin(); while (i != reqs.end()) { TimeStampedRequest & tr = *i; @@ -275,7 +275,7 @@ namespace bt } reqs.clear(); - QValueList<Request>::iterator j = wait_queue.begin(); + TQValueList<Request>::iterator j = wait_queue.begin(); while (j != wait_queue.end()) { Request & req = *j; diff --git a/libktorrent/torrent/peerdownloader.h b/libktorrent/torrent/peerdownloader.h index 4eb37d2..6173c97 100644 --- a/libktorrent/torrent/peerdownloader.h +++ b/libktorrent/torrent/peerdownloader.h @@ -21,8 +21,8 @@ #define BTPEERDOWNLOADER_H #include <set> -#include <qvaluelist.h> -#include <qobject.h> +#include <tqvaluelist.h> +#include <tqobject.h> #include "globals.h" #include "request.h" @@ -91,9 +91,10 @@ namespace bt * * This class downloads Piece's from a Peer. */ - class PeerDownloader : public QObject + class PeerDownloader : public TQObject { - Q_OBJECT + Q_OBJECT + TQ_OBJECT public: /** * Constructor, set the Peer @@ -218,8 +219,8 @@ namespace bt private: Peer* peer; - QValueList<TimeStampedRequest> reqs; - QValueList<Request> wait_queue; + TQValueList<TimeStampedRequest> reqs; + TQValueList<Request> wait_queue; Uint32 max_wait_queue_size; int grabbed; Uint32 chunk_size; diff --git a/libktorrent/torrent/peerid.cpp b/libktorrent/torrent/peerid.cpp index 5f314b3..b1741d2 100644 --- a/libktorrent/torrent/peerid.cpp +++ b/libktorrent/torrent/peerid.cpp @@ -19,7 +19,7 @@ ***************************************************************************/ #include <time.h> #include <stdlib.h> -#include <qmap.h> +#include <tqmap.h> #include <klocale.h> #include "peerid.h" #include "ktversion.h" @@ -97,23 +97,23 @@ namespace bt return false; } - QString PeerID::toString() const + TQString PeerID::toString() const { - QString r; + TQString r; for (int i = 0;i < 20;i++) r += id[i] == 0 ? ' ' : id[i]; return r; } - QString PeerID::identifyClient() const + TQString PeerID::identifyClient() const { if (!client_name.isNull()) return client_name; - QString peer_id = toString(); + TQString peer_id = toString(); // we only need to create this map once // so make it static - static QMap<QString, QString> Map; + static TQMap<TQString, TQString> Map; static bool first = true; if (first) @@ -159,8 +159,8 @@ namespace bt Map["MT"] = "MoonLight"; Map["PD"] = "Pando"; Map["qB"] = "qBittorrent"; - Map["QD"] = "QQDownload"; - Map["QT"] = "Qt 4 Torrent example"; + Map["QD"] = "TQQDownload"; + Map["QT"] = "TQt 4 Torrent example"; Map["RS"] = "Rufus"; Map["RT"] = "Retriever"; Map["S~"] = "Shareaza alpha/beta"; @@ -174,7 +174,7 @@ namespace bt Map["TS"] = "Torrent Storm"; Map["TT"] = "TuoTu"; Map["UL"] = "uLeecher!"; - Map["UT"] = QString("%1Torrent").arg(QChar(0x00B5)); // µTorrent, 0x00B5 is unicode for µ + Map["UT"] = TQString("%1Torrent").tqarg(TQChar(0x00B5)); // µTorrent, 0x00B5 is tqunicode for µ Map["WT"] = "BitLet"; Map["WY"] = "FireTorrent"; Map["XL"] = "Xunlei"; @@ -200,32 +200,32 @@ namespace bt first = false; } - QString name = i18n("Unknown client"); - if (peer_id.at(0) == '-' && - peer_id.at(1).isLetter() && - peer_id.at(2).isLetter() ) //AZ style + TQString name = i18n("Unknown client"); + if (peer_id.tqat(0) == '-' && + peer_id.tqat(1).isLetter() && + peer_id.tqat(2).isLetter() ) //AZ style { - QString ID(peer_id.mid(1,2)); - if (Map.contains(ID)) - name = Map[ID] + " " + peer_id.at(3) + "." + peer_id.at(4) + "." - + peer_id.at(5) + "." + peer_id.at(6); + TQString ID(peer_id.mid(1,2)); + if (Map.tqcontains(ID)) + name = Map[ID] + " " + peer_id.tqat(3) + "." + peer_id.tqat(4) + "." + + peer_id.tqat(5) + "." + peer_id.tqat(6); } - else if (peer_id.at(0).isLetter() && - peer_id.at(1).isDigit() && - peer_id.at(2).isDigit() ) //Shadow's style + else if (peer_id.tqat(0).isLetter() && + peer_id.tqat(1).isDigit() && + peer_id.tqat(2).isDigit() ) //Shadow's style { - QString ID = QString(peer_id.at(0)); - if (Map.contains(ID)) - name = Map[ID] + " " + peer_id.at(1) + "." + - peer_id.at(2) + "." + peer_id.at(3); + TQString ID = TQString(peer_id.tqat(0)); + if (Map.tqcontains(ID)) + name = Map[ID] + " " + peer_id.tqat(1) + "." + + peer_id.tqat(2) + "." + peer_id.tqat(3); } - else if (peer_id.at(0) == 'M' && peer_id.at(2) == '-' && (peer_id.at(4) == '-' || peer_id.at(5) == '-')) + else if (peer_id.tqat(0) == 'M' && peer_id.tqat(2) == '-' && (peer_id.tqat(4) == '-' || peer_id.tqat(5) == '-')) { - name = Map["M"] + " " + peer_id.at(1) + "." + peer_id.at(3); - if(peer_id.at(4) == '-') - name += "." + peer_id.at(5); + name = Map["M"] + " " + peer_id.tqat(1) + "." + peer_id.tqat(3); + if(peer_id.tqat(4) == '-') + name += "." + peer_id.tqat(5); else - name += peer_id.at(4) + "." + peer_id.at(6); + name += peer_id.tqat(4) + "." + peer_id.tqat(6); } else if (peer_id.startsWith("OP")) { @@ -245,7 +245,7 @@ namespace bt } else if ( peer_id.startsWith("Mbrst")) { - name = Map["Mbrst"] + " " + peer_id.at(5) + "." + peer_id.at(7); + name = Map["Mbrst"] + " " + peer_id.tqat(5) + "." + peer_id.tqat(7); } return name; diff --git a/libktorrent/torrent/peerid.h b/libktorrent/torrent/peerid.h index 90ba439..8ebea9a 100644 --- a/libktorrent/torrent/peerid.h +++ b/libktorrent/torrent/peerid.h @@ -20,7 +20,7 @@ #ifndef BTPEERID_H #define BTPEERID_H -#include <qstring.h> +#include <tqstring.h> namespace bt { @@ -31,7 +31,7 @@ namespace bt class PeerID { char id[20]; - QString client_name; + TQString client_name; public: PeerID(); PeerID(const char* pid); @@ -42,14 +42,14 @@ namespace bt const char* data() const {return id;} - QString toString() const; + TQString toString() const; /** * Interprets the PeerID to figure out which client it is. * @author Ivan + Joris * @return The name of the client */ - QString identifyClient() const; + TQString identifyClient() const; friend bool operator == (const PeerID & a,const PeerID & b); friend bool operator != (const PeerID & a,const PeerID & b); diff --git a/libktorrent/torrent/peermanager.cpp b/libktorrent/torrent/peermanager.cpp index d3744fc..c85ebd4 100644 --- a/libktorrent/torrent/peermanager.cpp +++ b/libktorrent/torrent/peermanager.cpp @@ -31,14 +31,14 @@ #include "uploader.h" #include "downloader.h" #include <util/functions.h> -#include <qhostaddress.h> +#include <tqhostaddress.h> #include <mse/streamsocket.h> #include <mse/encryptedauthenticate.h> #include <klocale.h> #include "ipblocklist.h" #include "chunkcounter.h" #include "authenticationmonitor.h" -#include <qdatetime.h> +#include <tqdatetime.h> using namespace kt; @@ -81,7 +81,7 @@ namespace bt // update the speed of each peer, // and get ridd of some killed peers - QPtrList<Peer>::iterator i = peer_list.begin(); + TQPtrList<Peer>::iterator i = peer_list.begin(); while (i != peer_list.end()) { Peer* p = *i; @@ -111,7 +111,7 @@ namespace bt { Out() << "Getting rid of peers which have been choked for a long time" << endl; TimeStamp now = bt::GetCurrentTime(); - QPtrList<Peer>::iterator i = peer_list.begin(); + TQPtrList<Peer>::iterator i = peer_list.begin(); Uint32 num_killed = 0; while (i != peer_list.end() && num_killed < 20) { @@ -157,7 +157,7 @@ namespace bt void PeerManager::killSeeders() { - QPtrList<Peer>::iterator i = peer_list.begin(); + TQPtrList<Peer>::iterator i = peer_list.begin(); while (i != peer_list.end()) { Peer* p = *i; @@ -169,11 +169,11 @@ namespace bt void PeerManager::killUninterested() { - QPtrList<Peer>::iterator i = peer_list.begin(); + TQPtrList<Peer>::iterator i = peer_list.begin(); while (i != peer_list.end()) { Peer* p = *i; - if ( !p->isInterested() && (p->getConnectTime().secsTo(QTime::currentTime()) > 30) ) + if ( !p->isInterested() && (p->getConnectTime().secsTo(TQTime::currentTime()) > 30) ) p->kill(); i++; } @@ -233,13 +233,13 @@ namespace bt if (a && Globals::instance().getServer().unencryptedConnectionsAllowed()) { // if possible try unencrypted - QString ip = a->getIP(); + TQString ip = a->getIP(); Uint16 port = a->getPort(); Authenticate* st = new Authenticate(ip,port,tor.getInfoHash(),tor.getPeerID(),this); if (auth->isLocal()) st->setLocal(true); - connect(this,SIGNAL(stopped()),st,SLOT(onPeerManagerDestroyed())); + connect(this,TQT_SIGNAL(stopped()),st,TQT_SLOT(onPeerManagerDestroyed())); AuthenticationMonitor::instance().add(st); num_pending++; total_connections++; @@ -259,11 +259,11 @@ namespace bt { Peer* peer = new Peer(sock,peer_id,tor.getNumChunks(),tor.getChunkSize(),support,local); - connect(peer,SIGNAL(haveChunk(Peer*, Uint32 )),this,SLOT(onHave(Peer*, Uint32 ))); - connect(peer,SIGNAL(bitSetRecieved(const BitSet& )), - this,SLOT(onBitSetRecieved(const BitSet& ))); - connect(peer,SIGNAL(rerunChoker()),this,SLOT(onRerunChoker())); - connect(peer,SIGNAL(pex( const QByteArray& )),this,SLOT(pex( const QByteArray& ))); + connect(peer,TQT_SIGNAL(haveChunk(Peer*, Uint32 )),this,TQT_SLOT(onHave(Peer*, Uint32 ))); + connect(peer,TQT_SIGNAL(bitSetRecieved(const BitSet& )), + this,TQT_SLOT(onBitSetRecieved(const BitSet& ))); + connect(peer,TQT_SIGNAL(rerunChoker()),this,TQT_SLOT(onRerunChoker())); + connect(peer,TQT_SIGNAL(pex( const TQByteArray& )),this,TQT_SLOT(pex( const TQByteArray& ))); peer_list.append(peer); peer_map.insert(peer->getID(),peer); @@ -288,7 +288,7 @@ namespace bt return false; } - bool PeerManager::connectedTo(const QString & ip,Uint16 port) const + bool PeerManager::connectedTo(const TQString & ip,Uint16 port) const { PtrMap<Uint32,Peer>::const_iterator i = peer_map.begin(); while (i != peer_map.end()) @@ -356,7 +356,7 @@ namespace bt if (pp.local) auth->setLocal(true); - connect(this,SIGNAL(stopped()),auth,SLOT(onPeerManagerDestroyed())); + connect(this,TQT_SIGNAL(stopped()),auth,TQT_SLOT(onPeerManagerDestroyed())); AuthenticationMonitor::instance().add(auth); num_pending++; @@ -406,7 +406,7 @@ namespace bt Uint16 port; }; - void PeerManager::savePeerList(const QString & file) + void PeerManager::savePeerList(const TQString & file) { bt::File fptr; if (!fptr.open(file,"wb")) @@ -424,7 +424,7 @@ namespace bt Out(SYS_GEN|LOG_DEBUG) << "Saving list of peers to " << file << endl; // first the active peers - for (QPtrList<Peer>::iterator itr = peer_list.begin(); itr != peer_list.end();itr++) + for (TQPtrList<Peer>::iterator itr = peer_list.begin(); itr != peer_list.end();itr++) { Peer* p = *itr; PeerListEntry e; @@ -452,7 +452,7 @@ namespace bt } } - void PeerManager::loadPeerList(const QString & file) + void PeerManager::loadPeerList(const TQString & file) { bt::File fptr; if (!fptr.open(file,"rb")) @@ -474,11 +474,11 @@ namespace bt PotentialPeer pp; // convert IP address to string - pp.ip = QString("%1.%2.%3.%4") - .arg((e.ip & 0xFF000000) >> 24) - .arg((e.ip & 0x00FF0000) >> 16) - .arg((e.ip & 0x0000FF00) >> 8) - .arg( e.ip & 0x000000FF); + pp.ip = TQString("%1.%2.%3.%4") + .tqarg((e.ip & 0xFF000000) >> 24) + .tqarg((e.ip & 0x00FF0000) >> 16) + .tqarg((e.ip & 0x0000FF00) >> 8) + .tqarg( e.ip & 0x000000FF); pp.port = e.port; addPotentialPeer(pp); } @@ -509,7 +509,7 @@ namespace bt Peer* PeerManager::findPeer(Uint32 peer_id) { - return peer_map.find(peer_id); + return peer_map.tqfind(peer_id); } void PeerManager::onRerunChoker() @@ -550,7 +550,7 @@ namespace bt return false; } - void PeerManager::pex(const QByteArray & arr) + void PeerManager::pex(const TQByteArray & arr) { if (!pex_on) return; @@ -563,11 +563,11 @@ namespace bt PotentialPeer pp; pp.port = ReadUint16(tmp,4); Uint32 ip = ReadUint32(tmp,0); - pp.ip = QString("%1.%2.%3.%4") - .arg((ip & 0xFF000000) >> 24) - .arg((ip & 0x00FF0000) >> 16) - .arg((ip & 0x0000FF00) >> 8) - .arg( ip & 0x000000FF); + pp.ip = TQString("%1.%2.%3.%4") + .tqarg((ip & 0xFF000000) >> 24) + .tqarg((ip & 0x00FF0000) >> 16) + .tqarg((ip & 0x0000FF00) >> 8) + .tqarg( ip & 0x000000FF); pp.local = false; addPotentialPeer(pp); @@ -583,7 +583,7 @@ namespace bt if (pex_on == on) return; - QPtrList<Peer>::iterator i = peer_list.begin(); + TQPtrList<Peer>::iterator i = peer_list.begin(); while (i != peer_list.end()) { Peer* p = *i; diff --git a/libktorrent/torrent/peermanager.h b/libktorrent/torrent/peermanager.h index d5fdb9f..df55beb 100644 --- a/libktorrent/torrent/peermanager.h +++ b/libktorrent/torrent/peermanager.h @@ -21,8 +21,8 @@ #define BTPEERMANAGER_H #include <map> -#include <qobject.h> -#include <qptrlist.h> +#include <tqobject.h> +#include <tqptrlist.h> #include <util/ptrmap.h> #include "globals.h" #include "peerid.h" @@ -53,9 +53,10 @@ namespace bt * This class manages all Peer objects. * It can also open connections to other peers. */ - class PeerManager : public QObject + class PeerManager : public TQObject { Q_OBJECT + TQ_OBJECT public: /** * Constructor. @@ -180,14 +181,14 @@ namespace bt /** * Save the IP's and port numbers of all peers. */ - void savePeerList(const QString & file); + void savePeerList(const TQString & file); /** * Load the peer list again and add them to the potential peers */ - void loadPeerList(const QString & file); + void loadPeerList(const TQString & file); - typedef QPtrList<Peer>::const_iterator CItr; + typedef TQPtrList<Peer>::const_iterator CItr; CItr beginPeerList() const {return peer_list.begin();} CItr endPeerList() const {return peer_list.end();} @@ -212,13 +213,13 @@ namespace bt void updateAvailableChunks(); bool killBadPeer(); void createPeer(mse::StreamSocket* sock,const PeerID & peer_id,Uint32 support,bool local); - bool connectedTo(const QString & ip,Uint16 port) const; + bool connectedTo(const TQString & ip,Uint16 port) const; private slots: void onHave(Peer* p,Uint32 index); void onBitSetRecieved(const BitSet & bs); void onRerunChoker(); - void pex(const QByteArray & arr); + void pex(const TQByteArray & arr); signals: @@ -228,8 +229,8 @@ namespace bt private: PtrMap<Uint32,Peer> peer_map; - QPtrList<Peer> peer_list; - QPtrList<Peer> killed; + TQPtrList<Peer> peer_list; + TQPtrList<Peer> killed; Torrent & tor; bool started; BitSet available_chunks; @@ -241,9 +242,9 @@ namespace bt static Uint32 max_total_connections; static Uint32 total_connections; - std::multimap<QString,kt::PotentialPeer> potential_peers; + std::multimap<TQString,kt::PotentialPeer> potential_peers; - typedef std::multimap<QString,kt::PotentialPeer>::iterator PPItr; + typedef std::multimap<TQString,kt::PotentialPeer>::iterator PPItr; }; } diff --git a/libktorrent/torrent/peersourcemanager.cpp b/libktorrent/torrent/peersourcemanager.cpp index fef55b5..80af240 100644 --- a/libktorrent/torrent/peersourcemanager.cpp +++ b/libktorrent/torrent/peersourcemanager.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qfile.h> +#include <tqfile.h> #include <klocale.h> #include <functions.h> #include <util/log.h> @@ -65,14 +65,14 @@ namespace bt //load custom trackers loadCustomURLs(); - connect(&timer,SIGNAL(timeout()),this,SLOT(updateCurrentManually())); + connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(updateCurrentManually())); } PeerSourceManager::~PeerSourceManager() { saveCustomURLs(); additional.setAutoDelete(true); - QPtrList<kt::PeerSource>::iterator itr = additional.begin(); + TQPtrList<kt::PeerSource>::iterator itr = additional.begin(); while (itr != additional.end()) { kt::PeerSource* ps = *itr; @@ -85,21 +85,21 @@ namespace bt void PeerSourceManager::addTracker(Tracker* trk) { trackers.insert(trk->trackerURL(),trk); - connect(trk,SIGNAL(peersReady( kt::PeerSource* )), - pman,SLOT(peerSourceReady( kt::PeerSource* ))); + connect(trk,TQT_SIGNAL(peersReady( kt::PeerSource* )), + pman,TQT_SLOT(peerSourceReady( kt::PeerSource* ))); } void PeerSourceManager::addPeerSource(kt::PeerSource* ps) { additional.append(ps); - connect(ps,SIGNAL(peersReady( kt::PeerSource* )), - pman,SLOT(peerSourceReady( kt::PeerSource* ))); + connect(ps,TQT_SIGNAL(peersReady( kt::PeerSource* )), + pman,TQT_SLOT(peerSourceReady( kt::PeerSource* ))); } void PeerSourceManager::removePeerSource(kt::PeerSource* ps) { - disconnect(ps,SIGNAL(peersReady( kt::PeerSource* )), - pman,SLOT(peerSourceReady( kt::PeerSource* ))); + disconnect(ps,TQT_SIGNAL(peersReady( kt::PeerSource* )), + pman,TQT_SLOT(peerSourceReady( kt::PeerSource* ))); additional.remove(ps); } @@ -109,7 +109,7 @@ namespace bt return; started = true; - QPtrList<kt::PeerSource>::iterator i = additional.begin(); + TQPtrList<kt::PeerSource>::iterator i = additional.begin(); while (i != additional.end()) { (*i)->start(); @@ -138,7 +138,7 @@ namespace bt return; started = false; - QPtrList<kt::PeerSource>::iterator i = additional.begin(); + TQPtrList<kt::PeerSource>::iterator i = additional.begin(); while (i != additional.end()) { (*i)->stop(); @@ -154,7 +154,7 @@ namespace bt void PeerSourceManager::completed() { - QPtrList<kt::PeerSource>::iterator i = additional.begin(); + TQPtrList<kt::PeerSource>::iterator i = additional.begin(); while (i != additional.end()) { (*i)->completed(); @@ -167,7 +167,7 @@ namespace bt void PeerSourceManager::manualUpdate() { - QPtrList<kt::PeerSource>::iterator i = additional.begin(); + TQPtrList<kt::PeerSource>::iterator i = additional.begin(); while (i != additional.end()) { (*i)->manualUpdate(); @@ -207,7 +207,7 @@ namespace bt void PeerSourceManager::addTracker(KURL url, bool custom,int tier) { - if (trackers.contains(url)) + if (trackers.tqcontains(url)) return; Tracker* trk = 0; @@ -227,11 +227,11 @@ namespace bt bool PeerSourceManager::removeTracker(KURL url) { - if (!custom_trackers.contains(url)) + if (!custom_trackers.tqcontains(url)) return false; custom_trackers.remove(url); - Tracker* trk = trackers.find(url); + Tracker* trk = trackers.tqfind(url); if (curr == trk) { // do a timed delete on the tracker, so the stop signal @@ -260,7 +260,7 @@ namespace bt void PeerSourceManager::setTracker(KURL url) { - Tracker* trk = trackers.find(url); + Tracker* trk = trackers.tqfind(url); if (!trk) return; @@ -279,7 +279,7 @@ namespace bt KURL::List::iterator i = custom_trackers.begin(); while (i != custom_trackers.end()) { - Tracker* t = trackers.find(*i); + Tracker* t = trackers.tqfind(*i); if (t) { if (curr == t) @@ -313,25 +313,25 @@ namespace bt void PeerSourceManager::saveCustomURLs() { - QString trackers_file = tor->getTorDir() + "trackers"; - QFile file(trackers_file); + TQString trackers_file = tor->getTorDir() + "trackers"; + TQFile file(trackers_file); if(!file.open(IO_WriteOnly)) return; - QTextStream stream(&file); + TQTextStream stream(&file); for (KURL::List::iterator i = custom_trackers.begin();i != custom_trackers.end();i++) stream << (*i).prettyURL() << ::endl; } void PeerSourceManager::loadCustomURLs() { - QString trackers_file = tor->getTorDir() + "trackers"; - QFile file(trackers_file); + TQString trackers_file = tor->getTorDir() + "trackers"; + TQFile file(trackers_file); if(!file.open(IO_ReadOnly)) return; no_save_custom_trackers = true; - QTextStream stream(&file); + TQTextStream stream(&file); while (!stream.atEnd()) { KURL url = stream.readLine(); @@ -365,7 +365,7 @@ namespace bt return n; } - void PeerSourceManager::onTrackerError(const QString & err) + void PeerSourceManager::onTrackerError(const TQString & err) { failures++; pending = false; @@ -386,7 +386,7 @@ namespace bt // 30 minutes curr->setInterval(FINAL_WAIT_TIME); timer.start(FINAL_WAIT_TIME * 1000,true); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } else if (curr->failureCount() > 2) { @@ -394,14 +394,14 @@ namespace bt // a minute or 5, no need for hammering every 30 seconds curr->setInterval(LONGER_WAIT_TIME); timer.start(LONGER_WAIT_TIME * 1000,true); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } else { // lets not hammer and wait 30 seconds curr->setInterval(INITIAL_WAIT_TIME); timer.start(INITIAL_WAIT_TIME * 1000,true); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } } else @@ -418,7 +418,7 @@ namespace bt { curr->setInterval(FINAL_WAIT_TIME); timer.start(FINAL_WAIT_TIME * 1000,true); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } else if (trk->failureCount() > 2) { @@ -426,14 +426,14 @@ namespace bt // wait 5 minutes and try again curr->setInterval(LONGER_WAIT_TIME); timer.start(LONGER_WAIT_TIME * 1000,true); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } else { // wait 30 seconds and try again curr->setInterval(INITIAL_WAIT_TIME); timer.start(INITIAL_WAIT_TIME * 1000,true); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } } } @@ -449,7 +449,7 @@ namespace bt pending = false; if (started) statusChanged(i18n("OK")); - request_time = QDateTime::currentDateTime(); + request_time = TQDateTime::tqcurrentDateTime(); } void PeerSourceManager::onTrackerRequestPending() @@ -477,10 +477,10 @@ namespace bt if (curr) { - disconnect(curr,SIGNAL(requestFailed( const QString& )), - this,SLOT(onTrackerError( const QString& ))); - disconnect(curr,SIGNAL(requestOK()),this,SLOT(onTrackerOK())); - disconnect(curr,SIGNAL(requestPending()),this,SLOT(onTrackerRequestPending())); + disconnect(curr,TQT_SIGNAL(requestFailed( const TQString& )), + this,TQT_SLOT(onTrackerError( const TQString& ))); + disconnect(curr,TQT_SIGNAL(requestOK()),this,TQT_SLOT(onTrackerOK())); + disconnect(curr,TQT_SIGNAL(requestPending()),this,TQT_SLOT(onTrackerRequestPending())); curr = 0; } @@ -488,14 +488,14 @@ namespace bt if (curr) { Out(SYS_TRK|LOG_NOTICE) << "Switching to tracker " << trk->trackerURL() << endl; - QObject::connect(curr,SIGNAL(requestFailed( const QString& )), - this,SLOT(onTrackerError( const QString& ))); + TQObject::connect(curr,TQT_SIGNAL(requestFailed( const TQString& )), + this,TQT_SLOT(onTrackerError( const TQString& ))); - QObject::connect(curr,SIGNAL(requestOK()), - this,SLOT(onTrackerOK())); + TQObject::connect(curr,TQT_SIGNAL(requestOK()), + this,TQT_SLOT(onTrackerOK())); - QObject::connect(curr,SIGNAL(requestPending()), - this,SLOT(onTrackerRequestPending())); + TQObject::connect(curr,TQT_SIGNAL(requestPending()), + this,TQT_SLOT(onTrackerRequestPending())); } } @@ -504,7 +504,7 @@ namespace bt if (pending || !started || !curr) return 0; - return curr->getInterval() - request_time.secsTo(QDateTime::currentDateTime()); + return curr->getInterval() - request_time.secsTo(TQDateTime::tqcurrentDateTime()); } Uint32 PeerSourceManager::getNumSeeders() const diff --git a/libktorrent/torrent/peersourcemanager.h b/libktorrent/torrent/peersourcemanager.h index cdace4e..c46bbb8 100644 --- a/libktorrent/torrent/peersourcemanager.h +++ b/libktorrent/torrent/peersourcemanager.h @@ -20,9 +20,9 @@ #ifndef BTPEERSOURCEMANAGER_H #define BTPEERSOURCEMANAGER_H -#include <qtimer.h> -#include <qdatetime.h> -#include <qptrlist.h> +#include <tqtimer.h> +#include <tqdatetime.h> +#include <tqptrlist.h> #include <util/ptrmap.h> #include <interfaces/trackerslist.h> @@ -48,21 +48,22 @@ namespace bt * * This class manages all PeerSources. */ - class PeerSourceManager : public QObject, public kt::TrackersList + class PeerSourceManager : public TQObject, public kt::TrackersList { Q_OBJECT + TQ_OBJECT TorrentControl* tor; PeerManager* pman; PtrMap<KURL,Tracker> trackers; - QPtrList<kt::PeerSource> additional; + TQPtrList<kt::PeerSource> additional; Tracker* curr; dht::DHTTrackerBackend* m_dht; bool started; bool pending; KURL::List custom_trackers; - QDateTime request_time; - QTimer timer; + TQDateTime request_time; + TQTimer timer; Uint32 failures; bool no_save_custom_trackers; public: @@ -144,7 +145,7 @@ namespace bt * The an error happened contacting the tracker. * @param err The error */ - void onTrackerError(const QString & err); + void onTrackerError(const TQString & err); /** * Tracker update was OK. @@ -164,10 +165,10 @@ namespace bt signals: /** - * Status has changed of the tracker. + * tqStatus has changed of the tracker. * @param ns The new status */ - void statusChanged(const QString & ns); + void statusChanged(const TQString & ns); private: void saveCustomURLs(); diff --git a/libktorrent/torrent/peeruploader.cpp b/libktorrent/torrent/peeruploader.cpp index 1e0dbca..4881dc8 100644 --- a/libktorrent/torrent/peeruploader.cpp +++ b/libktorrent/torrent/peeruploader.cpp @@ -45,7 +45,7 @@ namespace bt void PeerUploader::addRequest(const Request & r) { // Out(SYS_CON|LOG_DEBUG) << - // QString("PeerUploader::addRequest %1 %2 %3\n").arg(r.getIndex()).arg(r.getOffset()).arg(r.getLength()) << endl; + // TQString("PeerUploader::addRequest %1 %2 %3\n").tqarg(r.getIndex()).tqarg(r.getOffset()).tqarg(r.getLength()) << endl; // allowed fast chunks go to the front of the queue requests.append(r); @@ -54,7 +54,7 @@ namespace bt void PeerUploader::removeRequest(const Request & r) { // Out(SYS_CON|LOG_DEBUG) << - // QString("PeerUploader::removeRequest %1 %2 %3\n").arg(r.getIndex()).arg(r.getOffset()).arg(r.getLength()) << endl; + // TQString("PeerUploader::removeRequest %1 %2 %3\n").tqarg(r.getIndex()).tqarg(r.getOffset()).tqarg(r.getLength()) << endl; requests.remove(r); peer->getPacketWriter().doNotSendPiece(r,peer->getStats().fast_extensions); } @@ -113,7 +113,7 @@ namespace bt // reject all requests // if the peer supports fast extensions, // choke doesn't mean reject all - QValueList<Request>::iterator i = requests.begin(); + TQValueList<Request>::iterator i = requests.begin(); while (i != requests.end()) { pw.sendReject(*i); diff --git a/libktorrent/torrent/peeruploader.h b/libktorrent/torrent/peeruploader.h index 94aea74..596cdbb 100644 --- a/libktorrent/torrent/peeruploader.h +++ b/libktorrent/torrent/peeruploader.h @@ -21,7 +21,7 @@ #define BTPEERUPLOADER_H #include <set> -#include <qvaluelist.h> +#include <tqvaluelist.h> #include "request.h" @@ -45,7 +45,7 @@ namespace bt class PeerUploader { Peer* peer; - QValueList<Request> requests; + TQValueList<Request> requests; Uint32 uploaded; public: /** diff --git a/libktorrent/torrent/preallocationthread.cpp b/libktorrent/torrent/preallocationthread.cpp index 6fb2100..4b2e40d 100644 --- a/libktorrent/torrent/preallocationthread.cpp +++ b/libktorrent/torrent/preallocationthread.cpp @@ -25,7 +25,7 @@ #include <util/log.h> #include <util/error.h> -#include <qfile.h> +#include <tqfile.h> #include <klocale.h> #include "preallocationthread.h" #include "chunkmanager.h" @@ -71,7 +71,7 @@ namespace bt mutex.unlock(); } - void PreallocationThread::setErrorMsg(const QString & msg) + void PreallocationThread::setErrorMsg(const TQString & msg) { mutex.lock(); error_msg = msg; stopped = true; diff --git a/libktorrent/torrent/preallocationthread.h b/libktorrent/torrent/preallocationthread.h index 31bd668..581017d 100644 --- a/libktorrent/torrent/preallocationthread.h +++ b/libktorrent/torrent/preallocationthread.h @@ -20,10 +20,10 @@ #ifndef BTPREALLOCATIONTHREAD_H #define BTPREALLOCATIONTHREAD_H -#include <qstring.h> -#include <qthread.h> -#include <qmap.h> -#include <qmutex.h> +#include <tqstring.h> +#include <tqthread.h> +#include <tqmap.h> +#include <tqmutex.h> #include <util/constants.h> @@ -37,13 +37,13 @@ namespace bt * * Thread to preallocate diskspace */ - class PreallocationThread : public QThread + class PreallocationThread : public TQThread { ChunkManager* cman; bool stopped,not_finished,done; - QString error_msg; + TQString error_msg; Uint64 bytes_written; - mutable QMutex mutex; + mutable TQMutex mutex; public: PreallocationThread(ChunkManager* cman); virtual ~PreallocationThread(); @@ -60,7 +60,7 @@ namespace bt * Set an error message, also calls stop * @param msg The message */ - void setErrorMsg(const QString & msg); + void setErrorMsg(const TQString & msg); /// See if the thread has been stopped bool isStopped() const; @@ -69,7 +69,7 @@ namespace bt bool errorHappened() const; /// Get the error_msg - const QString & errorMessage() const {return error_msg;} + const TQString & errorMessage() const {return error_msg;} /// nb Number of bytes have been written void written(Uint64 nb); @@ -86,7 +86,7 @@ namespace bt /// See if the thread was done bool isDone() const; private: - bool expand(const QString & path,Uint64 max_size); + bool expand(const TQString & path,Uint64 max_size); }; } diff --git a/libktorrent/torrent/queuemanager.cpp b/libktorrent/torrent/queuemanager.cpp index 4135f8f..1199179 100644 --- a/libktorrent/torrent/queuemanager.cpp +++ b/libktorrent/torrent/queuemanager.cpp @@ -20,7 +20,7 @@ ***************************************************************************/ #include "queuemanager.h" -#include <qstring.h> +#include <tqstring.h> #include <kmessagebox.h> #include <klocale.h> #include <util/log.h> @@ -41,7 +41,7 @@ using namespace kt; namespace bt { - QueueManager::QueueManager() : QObject(),exiting(false) + QueueManager::QueueManager() : TQObject(),exiting(false) { downloads.setAutoDelete(true); max_downloads = 0; @@ -60,15 +60,15 @@ namespace bt downloads.append(tc); downloads.sort(); - connect(tc, SIGNAL(diskSpaceLow(kt::TorrentInterface*, bool)), this, SLOT(onLowDiskSpace(kt::TorrentInterface*, bool))); - connect(tc, SIGNAL(torrentStopped(kt::TorrentInterface*)), this, SLOT(torrentStopped(kt::TorrentInterface*))); + connect(tc, TQT_SIGNAL(diskSpaceLow(kt::TorrentInterface*, bool)), this, TQT_SLOT(onLowDiskSpace(kt::TorrentInterface*, bool))); + connect(tc, TQT_SIGNAL(torrentStopped(kt::TorrentInterface*)), this, TQT_SLOT(torrentStopped(kt::TorrentInterface*))); } void QueueManager::remove(kt::TorrentInterface* tc) { paused_torrents.erase(tc); - int index = downloads.findRef(tc); + int index = downloads.tqfindRef(tc); if (index != -1) downloads.remove(index); @@ -132,7 +132,7 @@ namespace bt return kt::NOT_ENOUGH_DISKSPACE; case 1: //ask user - if (KMessageBox::questionYesNo(0, i18n("You don't have enough disk space to download this torrent. Are you sure you want to continue?"), i18n("Insufficient disk space for %1").arg(s.torrent_name)) == KMessageBox::No) + if (KMessageBox::questionYesNo(0, i18n("You don't have enough disk space to download this torrent. Are you sure you want to continue?"), i18n("Insufficient disk space for %1").tqarg(s.torrent_name)) == KMessageBox::No) { tc->setPriority(0); return kt::USER_CANCELED; @@ -154,7 +154,7 @@ namespace bt if (s.completed && max_ratio > 0 && ratio >= max_ratio) { - if (KMessageBox::questionYesNo(0, i18n("Torrent \"%1\" has reached its maximum share ratio. Ignore the limit and start seeding anyway?").arg(s.torrent_name), i18n("Maximum share ratio limit reached.")) == KMessageBox::Yes) + if (KMessageBox::questionYesNo(0, i18n("Torrent \"%1\" has reached its maximum share ratio. Ignore the limit and start seeding anyway?").tqarg(s.torrent_name), i18n("Maximum share ratio limit reached.")) == KMessageBox::Yes) { tc->setMaxShareRatio(0.00f); startSafely(tc); @@ -167,7 +167,7 @@ namespace bt } else { - return kt::QM_LIMITS_REACHED; + return kt::TQM_LIMITS_REACHED; } return kt::START_OK; @@ -193,7 +193,7 @@ namespace bt void QueueManager::startall(int type) { - QPtrList<kt::TorrentInterface>::iterator i = downloads.begin(); + TQPtrList<kt::TorrentInterface>::iterator i = downloads.begin(); while (i != downloads.end()) { @@ -213,7 +213,7 @@ namespace bt void QueueManager::stopall(int type) { - QPtrList<kt::TorrentInterface>::iterator i = downloads.begin(); + TQPtrList<kt::TorrentInterface>::iterator i = downloads.begin(); while (i != downloads.end()) { @@ -232,9 +232,9 @@ namespace bt } catch (bt::Error & err) { - QString msg = + TQString msg = i18n("Error stopping torrent %1 : %2") - .arg(s.torrent_name).arg(err.toString()); + .tqarg(s.torrent_name).tqarg(err.toString()); KMessageBox::error(0, msg, i18n("Error")); } } @@ -249,7 +249,7 @@ namespace bt void QueueManager::onExit(WaitJob* wjob) { exiting = true; - QPtrList<kt::TorrentInterface>::iterator i = downloads.begin(); + TQPtrList<kt::TorrentInterface>::iterator i = downloads.begin(); while (i != downloads.end()) { @@ -272,7 +272,7 @@ namespace bt int QueueManager::countDownloads() { int nr = 0; - QPtrList<TorrentInterface>::const_iterator i = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator i = downloads.begin(); while (i != downloads.end()) { @@ -288,7 +288,7 @@ namespace bt int QueueManager::countSeeds() { int nr = 0; - QPtrList<TorrentInterface>::const_iterator i = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator i = downloads.begin(); while (i != downloads.end()) { @@ -305,7 +305,7 @@ namespace bt { int nr = 0; // int test = 1; - QPtrList<TorrentInterface>::const_iterator i = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator i = downloads.begin(); while (i != downloads.end()) { @@ -342,7 +342,7 @@ namespace bt { int nr = 0; // int test = 1; - QPtrList<TorrentInterface>::const_iterator i = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator i = downloads.begin(); while (i != downloads.end()) { @@ -375,12 +375,12 @@ namespace bt return nr; } - QPtrList<kt::TorrentInterface>::iterator QueueManager::begin() + TQPtrList<kt::TorrentInterface>::iterator QueueManager::begin() { return downloads.begin(); } - QPtrList<kt::TorrentInterface>::iterator QueueManager::end() + TQPtrList<kt::TorrentInterface>::iterator QueueManager::end() { return downloads.end(); } @@ -402,7 +402,7 @@ namespace bt bool QueueManager::allreadyLoaded(const SHA1Hash & ih) const { - QPtrList<kt::TorrentInterface>::const_iterator itr = downloads.begin(); + TQPtrList<kt::TorrentInterface>::const_iterator itr = downloads.begin(); while (itr != downloads.end()) { @@ -420,7 +420,7 @@ namespace bt void QueueManager::mergeAnnounceList(const SHA1Hash & ih, const TrackerTier* trk) { - QPtrList<kt::TorrentInterface>::iterator itr = downloads.begin(); + TQPtrList<kt::TorrentInterface>::iterator itr = downloads.begin(); while (itr != downloads.end()) { @@ -447,8 +447,8 @@ namespace bt downloads.sort(); - QPtrList<TorrentInterface>::const_iterator it = downloads.begin(); - QPtrList<TorrentInterface>::const_iterator its = downloads.end(); + TQPtrList<TorrentInterface>::const_iterator it = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator its = downloads.end(); if (max_downloads != 0 || max_seeds != 0) @@ -607,7 +607,7 @@ namespace bt { if (!user) { - QPtrList<TorrentInterface>::const_iterator it = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator it = downloads.begin(); while (it != downloads.end()) { @@ -659,7 +659,7 @@ namespace bt } else { - QPtrList<TorrentInterface>::const_iterator it = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator it = downloads.begin(); for (; it != downloads.end(); it++) { TorrentInterface* tc = *it; @@ -692,7 +692,7 @@ namespace bt { int tp = tc->getPriority(); bool completed = tc->getStats().completed; - QPtrList<TorrentInterface>::const_iterator it = downloads.begin(); + TQPtrList<TorrentInterface>::const_iterator it = downloads.begin(); while (it != downloads.end()) { @@ -738,9 +738,9 @@ namespace bt { const TorrentStats & s = tc->getStats(); - QString msg = + TQString msg = i18n("Error starting torrent %1 : %2") - .arg(s.torrent_name).arg(err.toString()); + .tqarg(s.torrent_name).tqarg(err.toString()); KMessageBox::error(0, msg, i18n("Error")); } @@ -756,9 +756,9 @@ namespace bt { const TorrentStats & s = tc->getStats(); - QString msg = + TQString msg = i18n("Error stopping torrent %1 : %2") - .arg(s.torrent_name).arg(err.toString()); + .tqarg(s.torrent_name).tqarg(err.toString()); KMessageBox::error(0, msg, i18n("Error")); } @@ -783,13 +783,13 @@ namespace bt ///////////////////////////////////////////////////////////////////////////////////////////// - QueuePtrList::QueuePtrList() : QPtrList<kt::TorrentInterface>() + QueuePtrList::QueuePtrList() : TQPtrList<kt::TorrentInterface>() {} QueuePtrList::~QueuePtrList() {} - int QueuePtrList::compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2) + int QueuePtrList::compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2) { kt::TorrentInterface* tc1 = (kt::TorrentInterface*) item1; kt::TorrentInterface* tc2 = (kt::TorrentInterface*) item2; diff --git a/libktorrent/torrent/queuemanager.h b/libktorrent/torrent/queuemanager.h index 658c252..9771f53 100644 --- a/libktorrent/torrent/queuemanager.h +++ b/libktorrent/torrent/queuemanager.h @@ -18,12 +18,12 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef QUEUEMANAGER_H -#define QUEUEMANAGER_H +#ifndef TQUEUEMANAGER_H +#define TQUEUEMANAGER_H #include <set> -#include <qobject.h> -#include <qptrlist.h> +#include <tqobject.h> +#include <tqptrlist.h> #include <interfaces/torrentinterface.h> @@ -39,23 +39,24 @@ namespace bt struct TrackerTier; class WaitJob; - class QueuePtrList : public QPtrList<kt::TorrentInterface> + class QueuePtrList : public TQPtrList<kt::TorrentInterface> { public: QueuePtrList(); virtual ~QueuePtrList(); protected: - int compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2); + int compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2); }; /** * @author Ivan Vasic * @brief This class contains list of all TorrentControls and is responsible for starting/stopping them */ - class QueueManager : public QObject + class QueueManager : public TQObject { Q_OBJECT + TQ_OBJECT public: QueueManager(); @@ -93,7 +94,7 @@ namespace bt void startNext(); - typedef QPtrList<kt::TorrentInterface>::iterator iterator; + typedef TQPtrList<kt::TorrentInterface>::iterator iterator; iterator begin(); iterator end(); diff --git a/libktorrent/torrent/server.cpp b/libktorrent/torrent/server.cpp index e3d00ae..758ebf5 100644 --- a/libktorrent/torrent/server.cpp +++ b/libktorrent/torrent/server.cpp @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qserversocket.h> +#include <tqserversocket.h> #include <mse/streamsocket.h> #include <util/sha1hash.h> #include <util/log.h> @@ -36,13 +36,13 @@ namespace bt { - class ServerSocket : public QServerSocket + class ServerSocket : public TQServerSocket { Server* srv; public: - ServerSocket(Server* srv,Uint16 port) : QServerSocket(port),srv(srv) + ServerSocket(Server* srv,Uint16 port) : TQServerSocket(port),srv(srv) { - QSocketDevice* sd = socketDevice(); + TQSocketDevice* sd = socketDevice(); if (sd) sd->setAddressReusable(true); } @@ -114,7 +114,7 @@ namespace bt else { IPBlocklist& ipfilter = IPBlocklist::instance(); - QString IP(s->getRemoteIPAddress()); + TQString IP(s->getRemoteIPAddress()); if (ipfilter.isBlocked( IP )) { delete s; @@ -145,7 +145,7 @@ namespace bt PeerManager* Server::findPeerManager(const SHA1Hash & hash) { - QPtrList<PeerManager>::iterator i = peer_managers.begin(); + TQPtrList<PeerManager>::iterator i = peer_managers.begin(); while (i != peer_managers.end()) { PeerManager* pm = *i; @@ -165,7 +165,7 @@ namespace bt { Uint8 buf[24]; memcpy(buf,"req2",4); - QPtrList<PeerManager>::iterator i = peer_managers.begin(); + TQPtrList<PeerManager>::iterator i = peer_managers.begin(); while (i != peer_managers.end()) { PeerManager* pm = *i; diff --git a/libktorrent/torrent/server.h b/libktorrent/torrent/server.h index 99c06eb..b53c2da 100644 --- a/libktorrent/torrent/server.h +++ b/libktorrent/torrent/server.h @@ -20,8 +20,8 @@ #ifndef BTSERVER_H #define BTSERVER_H -#include <qptrlist.h> -#include <qobject.h> +#include <tqptrlist.h> +#include <tqobject.h> #include "globals.h" namespace bt @@ -42,11 +42,12 @@ namespace bt * All PeerManager's should register with this class when they * are created and should unregister when they are destroyed. */ - class Server : public QObject + class Server : public TQObject { Q_OBJECT + TQ_OBJECT - QPtrList<PeerManager> peer_managers; + TQPtrList<PeerManager> peer_managers; ServerSocket* sock; Uint16 port; bool encryption; diff --git a/libktorrent/torrent/serverauthenticate.cpp b/libktorrent/torrent/serverauthenticate.cpp index 479f0ce..9f7c76f 100644 --- a/libktorrent/torrent/serverauthenticate.cpp +++ b/libktorrent/torrent/serverauthenticate.cpp @@ -67,7 +67,7 @@ namespace bt Uint8* hs = handshake; IPBlocklist& ipfilter = IPBlocklist::instance(); - QString IP = sock->getRemoteIPAddress(); + TQString IP = sock->getRemoteIPAddress(); if (ipfilter.isBlocked( IP )) { diff --git a/libktorrent/torrent/serverauthenticate.h b/libktorrent/torrent/serverauthenticate.h index 70d3739..3a1c320 100644 --- a/libktorrent/torrent/serverauthenticate.h +++ b/libktorrent/torrent/serverauthenticate.h @@ -38,6 +38,7 @@ namespace bt class ServerAuthenticate : public AuthenticateBase { Q_OBJECT + TQ_OBJECT public: ServerAuthenticate(mse::StreamSocket* sock,Server* server); virtual ~ServerAuthenticate(); diff --git a/libktorrent/torrent/singlefilecache.cpp b/libktorrent/torrent/singlefilecache.cpp index 7d31bef..7ad0fd6 100644 --- a/libktorrent/torrent/singlefilecache.cpp +++ b/libktorrent/torrent/singlefilecache.cpp @@ -18,8 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include <klocale.h> -#include <qfileinfo.h> -#include <qstringlist.h> +#include <tqfileinfo.h> +#include <tqstringlist.h> #include <util/fileops.h> #include <util/error.h> #include <util/functions.h> @@ -35,24 +35,24 @@ namespace bt { - SingleFileCache::SingleFileCache(Torrent& tor,const QString & tmpdir,const QString & datadir) + SingleFileCache::SingleFileCache(Torrent& tor,const TQString & tmpdir,const TQString & datadir) : Cache(tor,tmpdir,datadir),fd(0) { cache_file = tmpdir + "cache"; - output_file = QFileInfo(cache_file).readLink(); + output_file = TQFileInfo(cache_file).readLink(); } SingleFileCache::~SingleFileCache() {} - void SingleFileCache::changeTmpDir(const QString & ndir) + void SingleFileCache::changeTmpDir(const TQString & ndir) { Cache::changeTmpDir(ndir); cache_file = tmpdir + "cache"; } - KIO::Job* SingleFileCache::moveDataFiles(const QString & ndir) + KIO::Job* SingleFileCache::moveDataFiles(const TQString & ndir) { return KIO::move(KURL::fromPathOrURL(output_file),KURL::fromPathOrURL(ndir)); } @@ -61,11 +61,11 @@ namespace bt { } - void bt::SingleFileCache::changeOutputPath(const QString & outputpath) + void bt::SingleFileCache::changeOutputPath(const TQString & outputpath) { bt::Delete(cache_file); output_file = outputpath; - datadir = output_file.left(output_file.findRev(bt::DirSeparator())); + datadir = output_file.left(output_file.tqfindRev(bt::DirSeparator())); bt::SymLink(output_file, cache_file); } @@ -76,7 +76,7 @@ namespace bt { // mmap continuously fails, so stop using it c->allocate(); - c->setStatus(Chunk::BUFFERED); + c->settqStatus(Chunk::BUFFERED); } else { @@ -88,7 +88,7 @@ namespace bt // buffer it if mmapping fails Out(SYS_GEN|LOG_IMPORTANT) << "Warning : mmap failure, falling back to buffered mode" << endl; c->allocate(); - c->setStatus(Chunk::BUFFERED); + c->settqStatus(Chunk::BUFFERED); } else { @@ -105,7 +105,7 @@ namespace bt if (mmap_failures >= 3 || !(buf = (Uint8*)fd->map(c,off,c->getSize(),CacheFile::READ))) { c->allocate(); - c->setStatus(Chunk::BUFFERED); + c->settqStatus(Chunk::BUFFERED); fd->read(c->getData(),c->getSize(),off); if (mmap_failures < 3) mmap_failures++; @@ -119,27 +119,27 @@ namespace bt void SingleFileCache::save(Chunk* c) { // unmap the chunk if it is mapped - if (c->getStatus() == Chunk::MMAPPED) + if (c->gettqStatus() == Chunk::MMAPPED) { fd->unmap(c->getData(),c->getSize()); c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); } - else if (c->getStatus() == Chunk::BUFFERED) + else if (c->gettqStatus() == Chunk::BUFFERED) { Uint64 off = c->getIndex() * tor.getChunkSize(); fd->write(c->getData(),c->getSize(),off); c->clear(); - c->setStatus(Chunk::ON_DISK); + c->settqStatus(Chunk::ON_DISK); } } void SingleFileCache::create() { - QFileInfo fi(cache_file); + TQFileInfo fi(cache_file); if (!fi.exists()) { - QString out_file = fi.readLink(); + TQString out_file = fi.readLink(); if (out_file.isNull()) out_file = datadir + tor.getNameSuggestion(); @@ -157,7 +157,7 @@ namespace bt } else { - QString out_file = fi.readLink(); + TQString out_file = fi.readLink(); if (!bt::Exists(out_file)) bt::Touch(out_file); else @@ -205,12 +205,12 @@ namespace bt prealloc->setNotFinished(); } - bool SingleFileCache::hasMissingFiles(QStringList & sl) + bool SingleFileCache::hasMissingFiles(TQStringList & sl) { - QFileInfo fi(cache_file); + TQFileInfo fi(cache_file); if (!fi.exists()) { - QString out_file = fi.readLink(); + TQString out_file = fi.readLink(); sl.append(fi.readLink()); return true; } diff --git a/libktorrent/torrent/singlefilecache.h b/libktorrent/torrent/singlefilecache.h index faa71b6..fc96fe7 100644 --- a/libktorrent/torrent/singlefilecache.h +++ b/libktorrent/torrent/singlefilecache.h @@ -35,11 +35,11 @@ namespace bt */ class SingleFileCache : public Cache { - QString cache_file; - QString output_file; + TQString cache_file; + TQString output_file; CacheFile* fd; public: - SingleFileCache(Torrent& tor,const QString & tmpdir,const QString & datadir); + SingleFileCache(Torrent& tor,const TQString & tmpdir,const TQString & datadir); virtual ~SingleFileCache(); virtual bool prep(Chunk* c); @@ -48,13 +48,13 @@ namespace bt virtual void create(); virtual void close(); virtual void open(); - virtual void changeTmpDir(const QString & ndir); - virtual KIO::Job* moveDataFiles(const QString & ndir); + virtual void changeTmpDir(const TQString & ndir); + virtual KIO::Job* moveDataFiles(const TQString & ndir); virtual void moveDataFilesCompleted(KIO::Job* job); - virtual void changeOutputPath(const QString& outputpath); - virtual QString getOutputPath() const {return output_file;} + virtual void changeOutputPath(const TQString& outputpath); + virtual TQString getOutputPath() const {return output_file;} virtual void preallocateDiskSpace(PreallocationThread* prealloc); - virtual bool hasMissingFiles(QStringList & sl); + virtual bool hasMissingFiles(TQStringList & sl); virtual void deleteDataFiles(); virtual Uint64 diskUsage(); }; diff --git a/libktorrent/torrent/speedestimater.cpp b/libktorrent/torrent/speedestimater.cpp index f12b5ac..a0b67da 100644 --- a/libktorrent/torrent/speedestimater.cpp +++ b/libktorrent/torrent/speedestimater.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qpair.h> -#include <qvaluelist.h> +#include <tqpair.h> +#include <tqvaluelist.h> #include <util/log.h> #include <util/timer.h> #include "speedestimater.h" @@ -29,14 +29,14 @@ namespace bt class SpeedEstimater::SpeedEstimaterPriv { float rate; - QValueList<QPair<Uint32,TimeStamp> > dlrate; + TQValueList<TQPair<Uint32,TimeStamp> > dlrate; public: SpeedEstimaterPriv() : rate(0) {} ~SpeedEstimaterPriv() {} void data(Uint32 bytes) { - dlrate.append(qMakePair(bytes,GetCurrentTime())); + dlrate.append(tqMakePair(bytes,GetCurrentTime())); } void update() @@ -44,10 +44,10 @@ namespace bt TimeStamp now = GetCurrentTime(); Uint32 bytes = 0,oldest = now; - QValueList<QPair<Uint32,TimeStamp> >::iterator i = dlrate.begin(); + TQValueList<TQPair<Uint32,TimeStamp> >::iterator i = dlrate.begin(); while (i != dlrate.end()) { - QPair<Uint32,TimeStamp> & p = *i; + TQPair<Uint32,TimeStamp> & p = *i; if (now - p.second > 3000) { i = dlrate.erase(i); diff --git a/libktorrent/torrent/statsfile.cpp b/libktorrent/torrent/statsfile.cpp index 2ffd3ae..54033aa 100644 --- a/libktorrent/torrent/statsfile.cpp +++ b/libktorrent/torrent/statsfile.cpp @@ -23,14 +23,14 @@ #include <util/log.h> #include <util/functions.h> -#include <qstring.h> -#include <qfile.h> -#include <qtextstream.h> +#include <tqstring.h> +#include <tqfile.h> +#include <tqtextstream.h> namespace bt { - StatsFile::StatsFile(QString filename) + StatsFile::StatsFile(TQString filename) :m_filename(filename) { m_file.setName(filename); @@ -47,42 +47,42 @@ namespace bt m_file.close(); } - void StatsFile::write(QString key, QString value) + void StatsFile::write(TQString key, TQString value) { m_values.insert(key.stripWhiteSpace(), value.stripWhiteSpace()); } - QString StatsFile::readString(QString key) + TQString StatsFile::readString(TQString key) { return m_values[key].stripWhiteSpace(); } - Uint64 StatsFile::readUint64(QString key) + Uint64 StatsFile::readUint64(TQString key) { bool ok = true; Uint64 val = readString(key).toULongLong(&ok); return val; } - int StatsFile::readInt(QString key) + int StatsFile::readInt(TQString key) { bool ok = true; int val = readString(key).toInt(&ok); return val; } - bool StatsFile::readBoolean(QString key) + bool StatsFile::readBoolean(TQString key) { return (bool) readInt(key); } - unsigned long StatsFile::readULong(QString key) + unsigned long StatsFile::readULong(TQString key) { bool ok = true; return readString(key).toULong(&ok); } - float bt::StatsFile::readFloat( QString key ) + float bt::StatsFile::readFloat( TQString key ) { bool ok = true; return readString(key).toFloat(&ok); @@ -93,11 +93,11 @@ namespace bt if (!m_file.open(IO_ReadOnly)) return; - QTextStream in(&m_file); + TQTextStream in(&m_file); while (!in.atEnd()) { - QString line = in.readLine(); - QString tmp = line.left(line.find('=')); + TQString line = in.readLine(); + TQString tmp = line.left(line.tqfind('=')); m_values.insert(tmp, line.mid(tmp.length()+1)); } close(); @@ -107,8 +107,8 @@ namespace bt { if (!m_file.open(IO_WriteOnly)) return; - QTextStream out(&m_file); - QMap<QString, QString>::iterator it = m_values.begin(); + TQTextStream out(&m_file); + TQMap<TQString, TQString>::iterator it = m_values.begin(); while(it!=m_values.end()) { out << it.key() << "=" << it.data() << ::endl; diff --git a/libktorrent/torrent/statsfile.h b/libktorrent/torrent/statsfile.h index 9f7a145..c37018f 100644 --- a/libktorrent/torrent/statsfile.h +++ b/libktorrent/torrent/statsfile.h @@ -20,9 +20,9 @@ #ifndef BTSTATSFILE_H #define BTSTATSFILE_H -#include <qstring.h> -#include <qfile.h> -#include <qmap.h> +#include <tqstring.h> +#include <tqfile.h> +#include <tqmap.h> #include <util/constants.h> @@ -40,32 +40,32 @@ namespace bt * @brief A constructor. * Constructs StatsFile object and calls readSync(). */ - StatsFile(QString filename); + StatsFile(TQString filename); ~StatsFile(); - ///Closes QFile + ///Closes TQFile void close(); /** * @brief Main read function. - * @return QString value that correspodents to key. - * @param key - QString stats key. + * @return TQString value that correspodents to key. + * @param key - TQString stats key. */ - QString readString(QString key); + TQString readString(TQString key); - Uint64 readUint64(QString key); - bool readBoolean(QString key); - int readInt(QString key); - unsigned long readULong(QString key); - float readFloat(QString key); + Uint64 readUint64(TQString key); + bool readBoolean(TQString key); + int readInt(TQString key); + unsigned long readULong(TQString key); + float readFloat(TQString key); /** * @brief Writes key and value. * It only inserts pair of key/value to the m_values. To make changes to file call writeSync(). - * @param key - QString key - * @param value - QString value. + * @param key - TQString key + * @param value - TQString value. */ - void write(QString key, QString value); + void write(TQString key, TQString value); ///Reads data from stats file to m_values. void readSync(); @@ -78,13 +78,13 @@ namespace bt * @param key The key * @return true if key is in the stats file */ - bool hasKey(const QString & key) const {return m_values.contains(key);} + bool hasKey(const TQString & key) const {return m_values.tqcontains(key);} private: - QString m_filename; - QFile m_file; + TQString m_filename; + TQFile m_file; - QMap<QString, QString> m_values; + TQMap<TQString, TQString> m_values; }; } diff --git a/libktorrent/torrent/torrent.cpp b/libktorrent/torrent/torrent.cpp index 6b8739b..e02af51 100644 --- a/libktorrent/torrent/torrent.cpp +++ b/libktorrent/torrent/torrent.cpp @@ -18,9 +18,9 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qfile.h> -#include <qdatastream.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqdatastream.h> +#include <tqstringlist.h> #include <util/log.h> #include <util/functions.h> #include <util/error.h> @@ -50,7 +50,7 @@ namespace bt } - void Torrent::load(const QByteArray & data,bool verbose) + void Torrent::load(const TQByteArray & data,bool verbose) { BNode* node = 0; @@ -81,7 +81,7 @@ namespace bt if (nodes) // DHT torrrents have a node key loadNodes(nodes); - loadInfo(dict->getDict("info")); + loadInfo(dict->getDict(TQString("info"))); loadAnnounceList(dict->getData("announce-list")); BNode* n = dict->getData("info"); SHA1HashGen hg; @@ -96,14 +96,14 @@ namespace bt } } - void Torrent::load(const QString & file,bool verbose) + void Torrent::load(const TQString & file,bool verbose) { - QFile fptr(file); + TQFile fptr(file); if (!fptr.open(IO_ReadOnly)) throw Error(i18n(" Unable to open torrent file %1 : %2") - .arg(file).arg(fptr.errorString())); + .tqarg(file).tqarg(fptr.errorString())); - QByteArray data(fptr.size()); + TQByteArray data(fptr.size()); // Out() << "File size = " << fptr.size() << endl; fptr.readBlock(data.data(),fptr.size()); @@ -157,14 +157,14 @@ namespace bt if (!ln) throw Error(i18n("Corrupted torrent!")); - QString path; + TQString path; for (Uint32 j = 0;j < ln->getNumChildren();j++) { BValueNode* v = ln->getValue(j); if (!v || v->data().getType() != Value::STRING) throw Error(i18n("Corrupted torrent!")); - QString sd = v->data().toString(encoding); + TQString sd = v->data().toString(encoding); path += sd; if (j + 1 < ln->getNumChildren()) path += bt::DirSeparator(); @@ -242,7 +242,7 @@ namespace bt throw Error(i18n("Corrupted torrent!")); - QByteArray hash_string = node->data().toByteArray(); + TQByteArray hash_string = node->data().toByteArray(); for (unsigned int i = 0;i < hash_string.size();i+=20) { Uint8 h[20]; @@ -366,7 +366,7 @@ namespace bt const SHA1Hash & Torrent::getHash(Uint32 idx) const { if (idx >= hash_pieces.count()) - throw Error(QString("Torrent::getHash %1 is out of bounds").arg(idx)); + throw Error(TQString("Torrent::getHash %1 is out of bounds").tqarg(idx)); return hash_pieces[idx]; } @@ -399,7 +399,7 @@ namespace bt return count; } - void Torrent::calcChunkPos(Uint32 chunk,QValueList<Uint32> & file_list) const + void Torrent::calcChunkPos(Uint32 chunk,TQValueList<Uint32> & file_list) const { file_list.clear(); if (chunk >= hash_pieces.size() || files.empty()) @@ -429,10 +429,10 @@ namespace bt void Torrent::updateFilePercentage(Uint32 chunk,const BitSet & bs) { - QValueList<Uint32> cfiles; + TQValueList<Uint32> cfiles; calcChunkPos(chunk,cfiles); - QValueList<Uint32>::iterator i = cfiles.begin(); + TQValueList<Uint32>::iterator i = cfiles.begin(); while (i != cfiles.end()) { TorrentFile & f = getFile(*i); @@ -441,9 +441,9 @@ namespace bt } } - bool Torrent::checkPathForDirectoryTraversal(const QString & p) + bool Torrent::checkPathForDirectoryTraversal(const TQString & p) { - QStringList sl = QStringList::split(bt::DirSeparator(),p); - return !sl.contains(".."); + TQStringList sl = TQStringList::split(bt::DirSeparator(),p); + return !sl.tqcontains(".."); } } diff --git a/libktorrent/torrent/torrent.h b/libktorrent/torrent/torrent.h index 04c45cd..05c28cc 100644 --- a/libktorrent/torrent/torrent.h +++ b/libktorrent/torrent/torrent.h @@ -22,7 +22,7 @@ #define BTTORRENT_H #include <kurl.h> -#include <qvaluevector.h> +#include <tqvaluevector.h> #include <util/sha1hash.h> #include <util/constants.h> #include <interfaces/torrentinterface.h> @@ -74,7 +74,7 @@ namespace bt * @param verbose Wether to print information to the log * @throw Error if something goes wrong */ - void load(const QString & file,bool verbose); + void load(const TQString & file,bool verbose); /** * Load a .torrent file. @@ -82,7 +82,7 @@ namespace bt * @param verbose Wether to print information to the log * @throw Error if something goes wrong */ - void load(const QByteArray & data,bool verbose); + void load(const TQByteArray & data,bool verbose); void debugPrintInfo(); @@ -102,7 +102,7 @@ namespace bt Uint64 getFileLength() const {return file_length;} /// Get the suggested name. - QString getNameSuggestion() const {return name_suggestion;} + TQString getNameSuggestion() const {return name_suggestion;} /** * Verify wether a hash matches the hash @@ -155,7 +155,7 @@ namespace bt * @param chunk The index of the chunk * @param file_list This list will be filled with all the indices */ - void calcChunkPos(Uint32 chunk,QValueList<Uint32> & file_list) const; + void calcChunkPos(Uint32 chunk,TQValueList<Uint32> & file_list) const; /** * Checks if torrent file is audio or video. @@ -197,19 +197,19 @@ namespace bt void loadFiles(BListNode* node); void loadNodes(BListNode* node); void loadAnnounceList(BNode* node); - bool checkPathForDirectoryTraversal(const QString & p); + bool checkPathForDirectoryTraversal(const TQString & p); private: TrackerTier* trackers; - QString name_suggestion; + TQString name_suggestion; Uint64 piece_length; Uint64 file_length; SHA1Hash info_hash; PeerID peer_id; - QValueVector<SHA1Hash> hash_pieces; - QValueVector<TorrentFile> files; - QValueVector<kt::DHTNode> nodes; - QString encoding; + TQValueVector<SHA1Hash> hash_pieces; + TQValueVector<TorrentFile> files; + TQValueVector<kt::DHTNode> nodes; + TQString encoding; bool priv_torrent; }; diff --git a/libktorrent/torrent/torrentcontrol.cpp b/libktorrent/torrent/torrentcontrol.cpp index 71b4e64..ba51092 100644 --- a/libktorrent/torrent/torrentcontrol.cpp +++ b/libktorrent/torrent/torrentcontrol.cpp @@ -18,12 +18,12 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdir.h> -#include <qfile.h> +#include <tqdir.h> +#include <tqfile.h> #include <klocale.h> #include <kmessagebox.h> #include <kfiledialog.h> -#include <qtextstream.h> +#include <tqtextstream.h> #include <util/log.h> #include <util/error.h> #include <util/bitset.h> @@ -90,7 +90,7 @@ namespace bt stats.session_bytes_downloaded = 0; stats.session_bytes_uploaded = 0; istats.session_bytes_uploaded = 0; - old_datadir = QString::null; + old_datadir = TQString(); stats.status = NOT_STARTED; stats.autostart = true; stats.user_controlled = false; @@ -200,7 +200,7 @@ namespace bt if (stats.completed && !comp) { pman->killSeeders(); - QDateTime now = QDateTime::currentDateTime(); + TQDateTime now = TQDateTime::tqcurrentDateTime(); istats.running_time_dl += istats.time_started_dl.secsTo(now); updateStatusMsg(); updateStats(); @@ -228,7 +228,7 @@ namespace bt else psman->manualUpdate(); istats.last_announce = bt::GetCurrentTime(); - istats.time_started_dl = QDateTime::currentDateTime(); + istats.time_started_dl = TQDateTime::tqcurrentDateTime(); } updateStatusMsg(); @@ -296,7 +296,7 @@ namespace bt //Move completed files if needed: if (moveCompleted) { - QString outdir = Settings::completedDir(); + TQString outdir = Settings::completedDir(); if(!outdir.endsWith(bt::DirSeparator())) outdir += bt::DirSeparator(); @@ -309,7 +309,7 @@ namespace bt } } - void TorrentControl::onIOError(const QString & msg) + void TorrentControl::onIOError(const TQString & msg) { Out(SYS_DIO|LOG_IMPORTANT) << "Error : " << msg << endl; stats.stopped_by_error = true; @@ -351,7 +351,7 @@ namespace bt throw; } - istats.time_started_ul = istats.time_started_dl = QDateTime::currentDateTime(); + istats.time_started_ul = istats.time_started_dl = TQDateTime::tqcurrentDateTime(); resetTrackerStats(); if (prealloc) @@ -408,7 +408,7 @@ namespace bt void TorrentControl::stop(bool user,WaitJob* wjob) { - QDateTime now = QDateTime::currentDateTime(); + TQDateTime now = TQDateTime::tqcurrentDateTime(); if(!stats.completed) istats.running_time_dl += istats.time_started_dl.secsTo(now); istats.running_time_ul += istats.time_started_ul.secsTo(now); @@ -490,10 +490,10 @@ namespace bt void TorrentControl::init(QueueManager* qman, - const QString & torrent, - const QString & tmpdir, - const QString & ddir, - const QString & default_save_dir) + const TQString & torrent, + const TQString & tmpdir, + const TQString & ddir, + const TQString & default_save_dir) { // first load the torrent file tor = new Torrent(); @@ -506,13 +506,13 @@ namespace bt delete tor; tor = 0; throw Error(i18n("An error occurred while loading the torrent." - " The torrent is probably corrupt or is not a torrent file.\n%1").arg(torrent)); + " The torrent is probably corrupt or is not a torrent file.\n%1").tqarg(torrent)); } initInternal(qman,tmpdir,ddir,default_save_dir,torrent.startsWith(tmpdir)); // copy torrent in tor dir - QString tor_copy = datadir + "torrent"; + TQString tor_copy = datadir + "torrent"; if (tor_copy != torrent) { bt::CopyFile(torrent,tor_copy); @@ -521,8 +521,8 @@ namespace bt } - void TorrentControl::init(QueueManager* qman, const QByteArray & data,const QString & tmpdir, - const QString & ddir,const QString & default_save_dir) + void TorrentControl::init(QueueManager* qman, const TQByteArray & data,const TQString & tmpdir, + const TQString & ddir,const TQString & default_save_dir) { // first load the torrent file tor = new Torrent(); @@ -540,11 +540,11 @@ namespace bt initInternal(qman,tmpdir,ddir,default_save_dir,true); // copy data into torrent file - QString tor_copy = datadir + "torrent"; - QFile fptr(tor_copy); + TQString tor_copy = datadir + "torrent"; + TQFile fptr(tor_copy); if (!fptr.open(IO_WriteOnly)) throw Error(i18n("Unable to create %1 : %2") - .arg(tor_copy).arg(fptr.errorString())); + .tqarg(tor_copy).tqarg(fptr.errorString())); fptr.writeBlock(data.data(),data.size()); } @@ -559,17 +559,17 @@ namespace bt { qman->mergeAnnounceList(tor->getInfoHash(),tor->getTrackerList()); - throw Error(i18n("You are already downloading this torrent %1, the list of trackers of both torrents has been merged.").arg(tor->getNameSuggestion())); + throw Error(i18n("You are already downloading this torrent %1, the list of trackers of both torrents has been merged.").tqarg(tor->getNameSuggestion())); } else { throw Error(i18n("You are already downloading the torrent %1") - .arg(tor->getNameSuggestion())); + .tqarg(tor->getNameSuggestion())); } } } - void TorrentControl::setupDirs(const QString & tmpdir,const QString & ddir) + void TorrentControl::setupDirs(const TQString & tmpdir,const TQString & ddir) { datadir = tmpdir; @@ -607,14 +607,14 @@ namespace bt loadOutputDir(); } - void TorrentControl::setupData(const QString & ddir) + void TorrentControl::setupData(const TQString & ddir) { // create PeerManager and Tracker pman = new PeerManager(*tor); //Out() << "Tracker url " << url << " " << url.protocol() << " " << url.prettyURL() << endl; psman = new PeerSourceManager(this,pman); - connect(psman,SIGNAL(statusChanged( const QString& )), - this,SLOT(trackerStatusChanged( const QString& ))); + connect(psman,TQT_SIGNAL(statusChanged( const TQString& )), + this,TQT_SLOT(trackerStatusChanged( const TQString& ))); // Create chunkmanager, load the index file if it exists @@ -626,7 +626,7 @@ namespace bt // store the outputdir into the output_path variable, so others can access it - connect(cman,SIGNAL(updateStats()),this,SLOT(updateStats())); + connect(cman,TQT_SIGNAL(updateStats()),this,TQT_SLOT(updateStats())); if (bt::Exists(datadir + "index")) cman->loadIndexFile(); @@ -634,23 +634,23 @@ namespace bt // create downloader,uploader and choker down = new Downloader(*tor,*pman,*cman); - connect(down,SIGNAL(ioError(const QString& )), - this,SLOT(onIOError(const QString& ))); + connect(down,TQT_SIGNAL(ioError(const TQString& )), + this,TQT_SLOT(onIOError(const TQString& ))); up = new Uploader(*cman,*pman); choke = new Choker(*pman,*cman); - connect(pman,SIGNAL(newPeer(Peer* )),this,SLOT(onNewPeer(Peer* ))); - connect(pman,SIGNAL(peerKilled(Peer* )),this,SLOT(onPeerRemoved(Peer* ))); - connect(cman,SIGNAL(excluded(Uint32, Uint32 )),down,SLOT(onExcluded(Uint32, Uint32 ))); - connect(cman,SIGNAL(included( Uint32, Uint32 )),down,SLOT(onIncluded( Uint32, Uint32 ))); - connect(cman,SIGNAL(corrupted( Uint32 )),this,SLOT(corrupted( Uint32 ))); + connect(pman,TQT_SIGNAL(newPeer(Peer* )),this,TQT_SLOT(onNewPeer(Peer* ))); + connect(pman,TQT_SIGNAL(peerKilled(Peer* )),this,TQT_SLOT(onPeerRemoved(Peer* ))); + connect(cman,TQT_SIGNAL(excluded(Uint32, Uint32 )),down,TQT_SLOT(onExcluded(Uint32, Uint32 ))); + connect(cman,TQT_SIGNAL(included( Uint32, Uint32 )),down,TQT_SLOT(onIncluded( Uint32, Uint32 ))); + connect(cman,TQT_SIGNAL(corrupted( Uint32 )),this,TQT_SLOT(corrupted( Uint32 ))); } void TorrentControl::initInternal(QueueManager* qman, - const QString & tmpdir, - const QString & ddir, - const QString & default_save_dir, + const TQString & tmpdir, + const TQString & ddir, + const TQString & default_save_dir, bool first_time) { checkExisting(qman); @@ -670,7 +670,7 @@ namespace bt throw Error( i18n("Cannot migrate %1 : %2") - .arg(tor->getNameSuggestion()).arg(err.toString())); + .tqarg(tor->getNameSuggestion()).tqarg(err.toString())); } } setupData(ddir); @@ -731,8 +731,8 @@ namespace bt void TorrentControl::onNewPeer(Peer* p) { - connect(p,SIGNAL(gotPortPacket( const QString&, Uint16 )), - this,SLOT(onPortPacket( const QString&, Uint16 ))); + connect(p,TQT_SIGNAL(gotPortPacket( const TQString&, Uint16 )), + this,TQT_SLOT(onPortPacket( const TQString&, Uint16 ))); if (p->getStats().fast_extensions) { @@ -772,8 +772,8 @@ namespace bt void TorrentControl::onPeerRemoved(Peer* p) { - disconnect(p,SIGNAL(gotPortPacket( const QString&, Uint16 )), - this,SLOT(onPortPacket( const QString&, Uint16 ))); + disconnect(p,TQT_SIGNAL(gotPortPacket( const TQString&, Uint16 )), + this,TQT_SLOT(onPortPacket( const TQString&, Uint16 ))); if (tmon) tmon->peerRemoved(p); } @@ -783,16 +783,16 @@ namespace bt choke->update(stats.completed,stats); } - bool TorrentControl::changeDataDir(const QString & new_dir) + bool TorrentControl::changeDataDir(const TQString & new_dir) { - int pos = datadir.findRev(bt::DirSeparator(),-2); + int pos = datadir.tqfindRev(bt::DirSeparator(),-2); if (pos == -1) { Out(SYS_GEN|LOG_DEBUG) << "Could not find torX part in " << datadir << endl; return false; } - QString ndatadir = new_dir + datadir.mid(pos + 1); + TQString ndatadir = new_dir + datadir.mid(pos + 1); Out(SYS_GEN|LOG_DEBUG) << datadir << " -> " << ndatadir << endl; try @@ -811,7 +811,7 @@ namespace bt return true; } - bool TorrentControl::changeOutputDir(const QString & new_dir, bool moveFiles) + bool TorrentControl::changeOutputDir(const TQString & new_dir, bool moveFiles) { if (moving_files) return false; @@ -830,10 +830,10 @@ namespace bt moving_files = true; try { - QString nd; + TQString nd; if (istats.custom_output_name) { - int slash_pos = stats.output_path.findRev(bt::DirSeparator(),-2); + int slash_pos = stats.output_path.tqfindRev(bt::DirSeparator(),-2); nd = new_dir + stats.output_path.mid(slash_pos + 1); } else @@ -855,7 +855,7 @@ namespace bt move_data_files_destination_path = nd; if (j) { - connect(j,SIGNAL(result(KIO::Job*)),this,SLOT(moveDataFilesJobDone(KIO::Job*))); + connect(j,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(moveDataFilesJobDone(KIO::Job*))); return true; } else @@ -932,7 +932,7 @@ namespace bt else if (!stats.started) stats.status = kt::NOT_STARTED; else if(!stats.running && !stats.user_controlled) - stats.status = kt::QUEUED; + stats.status = kt::TQUEUED; else if (!stats.running && stats.completed && (overMaxRatio() || overMaxSeedTime())) stats.status = kt::SEEDING_COMPLETE; else if (!stats.running && stats.completed) @@ -988,26 +988,26 @@ namespace bt if (cman->getDataDir() != outputdir) outputdir = cman->getDataDir(); - st.write("UPLOADED", QString::number(up->bytesUploaded())); + st.write("UPLOADED", TQString::number(up->bytesUploaded())); if (stats.running) { - QDateTime now = QDateTime::currentDateTime(); - st.write("RUNNING_TIME_DL",QString("%1").arg(istats.running_time_dl + istats.time_started_dl.secsTo(now))); - st.write("RUNNING_TIME_UL",QString("%1").arg(istats.running_time_ul + istats.time_started_ul.secsTo(now))); + TQDateTime now = TQDateTime::tqcurrentDateTime(); + st.write("RUNNING_TIME_DL",TQString("%1").tqarg(istats.running_time_dl + istats.time_started_dl.secsTo(now))); + st.write("RUNNING_TIME_UL",TQString("%1").tqarg(istats.running_time_ul + istats.time_started_ul.secsTo(now))); } else { - st.write("RUNNING_TIME_DL", QString("%1").arg(istats.running_time_dl)); - st.write("RUNNING_TIME_UL", QString("%1").arg(istats.running_time_ul)); + st.write("RUNNING_TIME_DL", TQString("%1").tqarg(istats.running_time_dl)); + st.write("RUNNING_TIME_UL", TQString("%1").tqarg(istats.running_time_ul)); } - st.write("PRIORITY", QString("%1").arg(istats.priority)); - st.write("AUTOSTART", QString("%1").arg(stats.autostart)); - st.write("IMPORTED", QString("%1").arg(stats.imported_bytes)); + st.write("PRIORITY", TQString("%1").tqarg(istats.priority)); + st.write("AUTOSTART", TQString("%1").tqarg(stats.autostart)); + st.write("IMPORTED", TQString("%1").tqarg(stats.imported_bytes)); st.write("CUSTOM_OUTPUT_NAME",istats.custom_output_name ? "1" : "0"); - st.write("MAX_RATIO", QString("%1").arg(stats.max_share_ratio,0,'f',2)); - st.write("MAX_SEED_TIME",QString::number(stats.max_seed_time)); + st.write("MAX_RATIO", TQString("%1").tqarg(stats.max_share_ratio,0,'f',2)); + st.write("MAX_SEED_TIME",TQString::number(stats.max_seed_time)); st.write("RESTART_DISK_PREALLOCATION",prealloc ? "1" : "0"); if(!stats.priv_torrent) @@ -1017,8 +1017,8 @@ namespace bt st.write("UT_PEX", isFeatureEnabled(kt::UT_PEX_FEATURE) ? "1" : "0"); } - st.write("UPLOAD_LIMIT",QString::number(upload_limit)); - st.write("DOWNLOAD_LIMIT",QString::number(download_limit)); + st.write("UPLOAD_LIMIT",TQString::number(upload_limit)); + st.write("DOWNLOAD_LIMIT",TQString::number(download_limit)); st.writeSync(); } @@ -1222,7 +1222,7 @@ namespace bt if (!stats.running || stats.completed) return istats.running_time_dl; else - return istats.running_time_dl + istats.time_started_dl.secsTo(QDateTime::currentDateTime()); + return istats.running_time_dl + istats.time_started_dl.secsTo(TQDateTime::tqcurrentDateTime()); } Uint32 TorrentControl::getRunningTimeUL() const @@ -1230,7 +1230,7 @@ namespace bt if (!stats.running) return istats.running_time_ul; else - return istats.running_time_ul + istats.time_started_ul.secsTo(QDateTime::currentDateTime()); + return istats.running_time_ul + istats.time_started_ul.secsTo(TQDateTime::tqcurrentDateTime()); } Uint32 TorrentControl::getNumFiles() const @@ -1249,16 +1249,16 @@ namespace bt return TorrentFile::null; } - void TorrentControl::migrateTorrent(const QString & default_save_dir) + void TorrentControl::migrateTorrent(const TQString & default_save_dir) { if (bt::Exists(datadir + "current_chunks") && bt::IsPreMMap(datadir + "current_chunks")) { // in case of error copy torX dir to migrate-failed-tor - QString dd = datadir; - int pos = dd.findRev("tor"); + TQString dd = datadir; + int pos = dd.tqfindRev("tor"); if (pos != - 1) { - dd = dd.replace(pos,3,"migrate-failed-tor"); + dd = dd.tqreplace(pos,3,"migrate-failed-tor"); Out() << "Copying " << datadir << " to " << dd << endl; bt::CopyDir(datadir,dd,true); } @@ -1274,10 +1274,10 @@ namespace bt " To make sure this torrent still works with this version of KTorrent, " "we will migrate this torrent. You will be asked for a location to save " "the torrent to. If you press cancel, we will select your home directory.") - .arg(tor->getNameSuggestion())); - outputdir = KFileDialog::getExistingDirectory(QString::null, 0,i18n("Select Folder to Save To")); + .tqarg(tor->getNameSuggestion())); + outputdir = KFileDialog::getExistingDirectory(TQString(), 0,i18n("Select Folder to Save To")); if (outputdir.isNull()) - outputdir = QDir::homeDirPath(); + outputdir = TQDir::homeDirPath(); } else { @@ -1301,7 +1301,7 @@ namespace bt istats.priority = p; stats.user_controlled = p == 0 ? true : false; if(p) - stats.status = kt::QUEUED; + stats.status = kt::TQUEUED; else updateStatusMsg(); @@ -1356,7 +1356,7 @@ namespace bt } - QString TorrentControl::statusToString() const + TQString TorrentControl::statusToString() const { switch (stats.status) { @@ -1378,14 +1378,14 @@ namespace bt return i18n("Error: ") + getShortErrorMessage(); case kt::ALLOCATING_DISKSPACE: return i18n("Allocating diskspace"); - case kt::QUEUED: + case kt::TQUEUED: return i18n("Queued"); case kt::CHECKING_DATA: return i18n("Checking data"); case kt::NO_SPACE_LEFT: return i18n("Stopped. No space left on device."); } - return QString::null; + return TQString(); } TrackersList* TorrentControl::getTrackersList() @@ -1398,7 +1398,7 @@ namespace bt return psman; } - void TorrentControl::onPortPacket(const QString & ip,Uint16 port) + void TorrentControl::onPortPacket(const TQString & ip,Uint16 port) { if (Globals::instance().getDHT().isRunning() && !stats.priv_torrent) Globals::instance().getDHT().portRecieved(ip,port); @@ -1489,7 +1489,7 @@ namespace bt return cman->hasExistingFiles(); } - bool TorrentControl::hasMissingFiles(QStringList & sl) + bool TorrentControl::hasMissingFiles(TQStringList & sl) { return cman->hasMissingFiles(sl); } @@ -1525,7 +1525,7 @@ namespace bt } } - void TorrentControl::handleError(const QString & err) + void TorrentControl::handleError(const TQString & err) { onIOError(err); } @@ -1558,7 +1558,7 @@ namespace bt stats.trk_bytes_uploaded = 0; } - void TorrentControl::trackerStatusChanged(const QString & ns) + void TorrentControl::trackerStatusChanged(const TQString & ns) { stats.trackerstatus = ns; } diff --git a/libktorrent/torrent/torrentcontrol.h b/libktorrent/torrent/torrentcontrol.h index 33610de..c017728 100644 --- a/libktorrent/torrent/torrentcontrol.h +++ b/libktorrent/torrent/torrentcontrol.h @@ -21,9 +21,9 @@ #ifndef BTTORRENTCONTROL_H #define BTTORRENTCONTROL_H -#include <qobject.h> -#include <qcstring.h> -#include <qtimer.h> +#include <tqobject.h> +#include <tqcstring.h> +#include <tqtimer.h> #include <kurl.h> #include "globals.h" #include <util/timer.h> @@ -31,8 +31,8 @@ #include <interfaces/monitorinterface.h> #include <interfaces/trackerslist.h> -class QStringList; -class QString; +class TQStringList; +class TQString; namespace KIO { @@ -68,6 +68,7 @@ namespace bt class TorrentControl : public kt::TorrentInterface { Q_OBJECT + TQ_OBJECT public: TorrentControl(); virtual ~TorrentControl(); @@ -103,10 +104,10 @@ namespace bt * @throw Error when something goes wrong */ void init(QueueManager* qman, - const QString & torrent, - const QString & tmpdir, - const QString & datadir, - const QString & default_save_dir); + const TQString & torrent, + const TQString & tmpdir, + const TQString & datadir, + const TQString & default_save_dir); /** * Initialize the TorrentControl. @@ -119,10 +120,10 @@ namespace bt * @throw Error when something goes wrong */ void init(QueueManager* qman, - const QByteArray & data, - const QString & tmpdir, - const QString & datadir, - const QString & default_save_dir); + const TQByteArray & data, + const TQString & tmpdir, + const TQString & datadir, + const TQString & default_save_dir); /** * Change to a new data dir. If this fails @@ -130,7 +131,7 @@ namespace bt * @param new_dir The new directory * @return true upon succes */ - bool changeDataDir(const QString & new_dir); + bool changeDataDir(const TQString & new_dir); /** @@ -139,7 +140,7 @@ namespace bt * @param moveFiles Wheather to actually move the files or just change the directory without moving them. * @return true upon success. */ - bool changeOutputDir(const QString& new_dir, bool moveFiles = true); + bool changeOutputDir(const TQString& new_dir, bool moveFiles = true); /** * Roll back the previous changeDataDir call. @@ -154,10 +155,10 @@ namespace bt const kt::TrackersList* getTrackersList() const; /// Get the data directory of this torrent - QString getDataDir() const {return outputdir;} + TQString getDataDir() const {return outputdir;} /// Get the torX dir. - QString getTorDir() const {return datadir;} + TQString getTorDir() const {return datadir;} /// Set the monitor void setMonitor(kt::MonitorInterface* tmo); @@ -189,7 +190,7 @@ namespace bt Uint32 getTimeToNextTrackerUpdate() const; /// Get a short error message - QString getShortErrorMessage() const {return error_msg;} + TQString getShortErrorMessage() const {return error_msg;} virtual Uint32 getNumFiles() const; virtual kt::TorrentFileInterface & getTorrentFile(Uint32 index); @@ -213,7 +214,7 @@ namespace bt void setPreallocateDiskSpace(bool pa) {prealloc = pa;} /// Make a string out of the status message - virtual QString statusToString() const; + virtual TQString statusToString() const; /// Checks if tracker announce is allowed (minimum interval 60 seconds) bool announceAllowed(); @@ -227,7 +228,7 @@ namespace bt * Test all files and see if they are not missing. * If so put them in a list */ - bool hasMissingFiles(QStringList & sl); + bool hasMissingFiles(TQStringList & sl); virtual Uint32 getNumDHTNodes() const; @@ -296,38 +297,38 @@ namespace bt * The tracker status has changed. * @param ns New status */ - void trackerStatusChanged(const QString & ns); + void trackerStatusChanged(const TQString & ns); private slots: void onNewPeer(Peer* p); void onPeerRemoved(Peer* p); void doChoking(); - void onIOError(const QString & msg); - void onPortPacket(const QString & ip,Uint16 port); + void onIOError(const TQString & msg); + void onPortPacket(const TQString & ip,Uint16 port); /// Update the stats of the torrent. void updateStats(); void corrupted(Uint32 chunk); void moveDataFilesJobDone(KIO::Job* job); private: - void updateTracker(const QString & ev,bool last_succes = true); + void updateTracker(const TQString & ev,bool last_succes = true); void updateStatusMsg(); void saveStats(); void loadStats(); void loadOutputDir(); void getSeederInfo(Uint32 & total,Uint32 & connected_to) const; void getLeecherInfo(Uint32 & total,Uint32 & connected_to) const; - void migrateTorrent(const QString & default_save_dir); + void migrateTorrent(const TQString & default_save_dir); void continueStart(); - virtual void handleError(const QString & err); + virtual void handleError(const TQString & err); - void initInternal(QueueManager* qman,const QString & tmpdir, - const QString & ddir,const QString & default_save_dir,bool first_time); + void initInternal(QueueManager* qman,const TQString & tmpdir, + const TQString & ddir,const TQString & default_save_dir,bool first_time); void checkExisting(QueueManager* qman); - void setupDirs(const QString & tmpdir,const QString & ddir); + void setupDirs(const TQString & tmpdir,const TQString & ddir); void setupStats(); - void setupData(const QString & ddir); + void setupData(const TQString & ddir); virtual void afterDataCheck(); virtual bool isCheckingData(bool & finished) const; @@ -346,12 +347,12 @@ namespace bt Timer stats_save_timer; Timer stalled_timer; - QString datadir; - QString old_datadir; - QString outputdir; - QString error_msg; + TQString datadir; + TQString old_datadir; + TQString outputdir; + TQString error_msg; - QString move_data_files_destination_path; + TQString move_data_files_destination_path; bool restart_torrent_after_move_data_files; bool prealloc; @@ -362,8 +363,8 @@ namespace bt struct InternalStats { - QDateTime time_started_dl; - QDateTime time_started_ul; + TQDateTime time_started_dl; + TQDateTime time_started_ul; Uint32 running_time_dl; Uint32 running_time_ul; Uint64 prev_bytes_dl; diff --git a/libktorrent/torrent/torrentcreator.cpp b/libktorrent/torrent/torrentcreator.cpp index 7b132b8..6ccbd63 100644 --- a/libktorrent/torrent/torrentcreator.cpp +++ b/libktorrent/torrent/torrentcreator.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdir.h> -#include <qfileinfo.h> +#include <tqdir.h> +#include <tqfileinfo.h> #include <klocale.h> #include <time.h> #include <util/error.h> @@ -39,16 +39,16 @@ namespace bt { - TorrentCreator::TorrentCreator(const QString & tar, - const QStringList & track, + TorrentCreator::TorrentCreator(const TQString & tar, + const TQStringList & track, Uint32 cs, - const QString & name, - const QString & comments,bool priv, bool decentralized) + const TQString & name, + const TQString & comments,bool priv, bool decentralized) : target(tar),trackers(track),chunk_size(cs), name(name),comments(comments),cur_chunk(0),priv(priv),tot_size(0), decentralized(decentralized) { this->chunk_size *= 1024; - QFileInfo fi(target); + TQFileInfo fi(target); if (fi.isDir()) { if (!this->target.endsWith(bt::DirSeparator())) @@ -84,13 +84,13 @@ namespace bt TorrentCreator::~TorrentCreator() {} - void TorrentCreator::buildFileList(const QString & dir) + void TorrentCreator::buildFileList(const TQString & dir) { - QDir d(target + dir); + TQDir d(target + dir); // first get all files (we ignore symlinks) - QStringList dfiles = d.entryList(QDir::Files|QDir::NoSymLinks); + TQStringList dfiles = d.entryList(TQDir::Files|TQDir::NoSymLinks); Uint32 cnt = 0; // counter to keep track of file index - for (QStringList::iterator i = dfiles.begin();i != dfiles.end();++i) + for (TQStringList::iterator i = dfiles.begin();i != dfiles.end();++i) { // add a TorrentFile to the list Uint64 fs = bt::FileSize(target + dir + *i); @@ -102,13 +102,13 @@ namespace bt } // now for each subdir do a buildFileList - QStringList subdirs = d.entryList(QDir::Dirs|QDir::NoSymLinks); - for (QStringList::iterator i = subdirs.begin();i != subdirs.end();++i) + TQStringList subdirs = d.entryList(TQDir::Dirs|TQDir::NoSymLinks); + for (TQStringList::iterator i = subdirs.begin();i != subdirs.end();++i) { if (*i == "." || *i == "..") continue; - QString sd = dir + *i; + TQString sd = dir + *i; if (!sd.endsWith(bt::DirSeparator())) sd += bt::DirSeparator(); buildFileList(sd); @@ -116,21 +116,21 @@ namespace bt } - void TorrentCreator::saveTorrent(const QString & url) + void TorrentCreator::saveTorrent(const TQString & url) { File fptr; if (!fptr.open(url,"wb")) - throw Error(i18n("Cannot open file %1: %2").arg(url).arg(fptr.errorString())); + throw Error(i18n("Cannot open file %1: %2").tqarg(url).tqarg(fptr.errorString())); BEncoder enc(&fptr); enc.beginDict(); // top dict if(!decentralized) { - enc.write("announce"); enc.write(trackers[0]); + enc.write(TQString("announce")); enc.write(trackers[0]); if (trackers.count() > 1) { - enc.write("announce-list"); + enc.write(TQString("announce-list")); enc.beginList(); enc.beginList(); for (Uint32 i = 0;i < trackers.count();i++) @@ -144,23 +144,23 @@ namespace bt if (comments.length() > 0) { - enc.write("comments"); + enc.write(TQString("comments")); enc.write(comments); } - enc.write("created by");enc.write(QString("KTorrent %1").arg(kt::VERSION_STRING)); - enc.write("creation date");enc.write((Uint64)time(0)); - enc.write("info"); + enc.write(TQString("created by"));enc.write(TQString("KTorrent %1").tqarg(kt::VERSION_STRING)); + enc.write(TQString("creation date"));enc.write((Uint64)time(0)); + enc.write(TQString("info")); saveInfo(enc); // save the nodes list after the info hash, keys must be sorted ! if (decentralized) { //DHT torrent - enc.write("nodes"); + enc.write(TQString("nodes")); enc.beginList(); for(int i=0; i < trackers.count(); ++i) { - QString t = trackers[i]; + TQString t = trackers[i]; enc.beginList(); enc.write(t.section(',',0,0)); enc.write((Uint32)t.section(',',1,1).toInt()); @@ -176,12 +176,12 @@ namespace bt { enc.beginDict(); - QFileInfo fi(target); + TQFileInfo fi(target); if (fi.isDir()) { - enc.write("files"); + enc.write(TQString("files")); enc.beginList(); - QValueList<TorrentFile>::iterator i = files.begin(); + TQValueList<TorrentFile>::iterator i = files.begin(); while (i != files.end()) { saveFile(enc,*i); @@ -191,14 +191,14 @@ namespace bt } else { - enc.write("length"); enc.write(bt::FileSize(target)); + enc.write(TQString("length")); enc.write(bt::FileSize(target)); } - enc.write("name"); enc.write(name); - enc.write("piece length"); enc.write((Uint64)chunk_size); - enc.write("pieces"); savePieces(enc); + enc.write(TQString("name")); enc.write(name); + enc.write(TQString("piece length")); enc.write((Uint64)chunk_size); + enc.write(TQString("pieces")); savePieces(enc); if (priv) { - enc.write("private"); + enc.write(TQString("private")); enc.write((Uint64)1); } enc.end(); @@ -207,11 +207,11 @@ namespace bt void TorrentCreator::saveFile(BEncoder & enc,const TorrentFile & file) { enc.beginDict(); - enc.write("length");enc.write(file.getSize()); - enc.write("path"); + enc.write(TQString("length"));enc.write(file.getSize()); + enc.write(TQString("path")); enc.beginList(); - QStringList sl = QStringList::split(bt::DirSeparator(),file.getPath()); - for (QStringList::iterator i = sl.begin();i != sl.end();i++) + TQStringList sl = TQStringList::split(bt::DirSeparator(),file.getPath()); + for (TQStringList::iterator i = sl.begin();i != sl.end();i++) enc.write(*i); enc.end(); enc.end(); @@ -237,7 +237,7 @@ namespace bt File fptr; if (!fptr.open(target,"rb")) throw Error(i18n("Cannot open file %1: %2") - .arg(target).arg(fptr.errorString())); + .tqarg(target).tqarg(fptr.errorString())); Uint32 s = cur_chunk != num_chunks - 1 ? chunk_size : last_size; fptr.seek(File::BEGIN,(Int64)cur_chunk*chunk_size); @@ -254,7 +254,7 @@ namespace bt Uint32 s = cur_chunk != num_chunks - 1 ? chunk_size : last_size; // first find the file(s) the chunk lies in Array<Uint8> buf(s); - QValueList<TorrentFile> file_list; + TQValueList<TorrentFile> file_list; Uint32 i = 0; while (i < files.size()) { @@ -275,7 +275,7 @@ namespace bt if (!fptr.open(target + f.getPath(),"rb")) { throw Error(i18n("Cannot open file %1: %2") - .arg(f.getPath()).arg(fptr.errorString())); + .tqarg(f.getPath()).tqarg(fptr.errorString())); } // first calculate offset into file @@ -321,9 +321,9 @@ namespace bt return calcHashMulti(); } - TorrentControl* TorrentCreator::makeTC(const QString & data_dir) + TorrentControl* TorrentCreator::makeTC(const TQString & data_dir) { - QString dd = data_dir; + TQString dd = data_dir; if (!dd.endsWith(bt::DirSeparator())) dd += bt::DirSeparator(); @@ -336,7 +336,7 @@ namespace bt // write full index file File fptr; if (!fptr.open(dd + "index","wb")) - throw Error(i18n("Cannot create index file: %1").arg(fptr.errorString())); + throw Error(i18n("Cannot create index file: %1").tqarg(fptr.errorString())); for (Uint32 i = 0;i < num_chunks;i++) { @@ -350,10 +350,10 @@ namespace bt TorrentControl* tc = new TorrentControl(); try { - // get the parent dir of target - QFileInfo fi = QFileInfo(target); + // get the tqparent dir of target + TQFileInfo fi = TQFileInfo(target); - QString odir; + TQString odir; StatsFile st(dd + "stats"); if (fi.fileName() == name) { @@ -371,10 +371,10 @@ namespace bt st.write("RUNNING_TIME_UL","0"); st.write("PRIORITY", "0"); st.write("AUTOSTART", "1"); - st.write("IMPORTED", QString::number(tot_size)); + st.write("IMPORTED", TQString::number(tot_size)); st.writeSync(); - tc->init(0,dd + "torrent",dd,odir,QString::null); + tc->init(0,dd + "torrent",dd,odir,TQString()); tc->createFiles(); } catch (...) diff --git a/libktorrent/torrent/torrentcreator.h b/libktorrent/torrent/torrentcreator.h index c7057e2..e1e2545 100644 --- a/libktorrent/torrent/torrentcreator.h +++ b/libktorrent/torrent/torrentcreator.h @@ -20,7 +20,7 @@ #ifndef BTTORRENTCREATOR_H #define BTTORRENTCREATOR_H -#include <qstringlist.h> +#include <tqstringlist.h> #include "torrent.h" #include <util/sha1hash.h> @@ -40,15 +40,15 @@ namespace bt class TorrentCreator { // input values - QString target; - QStringList trackers; + TQString target; + TQStringList trackers; int chunk_size; - QString name,comments; + TQString name,comments; // calculated values Uint32 num_chunks; Uint64 last_size; - QValueList<TorrentFile> files; - QValueList<SHA1Hash> hashes; + TQValueList<TorrentFile> files; + TQValueList<SHA1Hash> hashes; // Uint32 cur_chunk; bool priv; @@ -64,9 +64,9 @@ namespace bt * @param comments The comments field of the torrent * @param priv Private torrent or not */ - TorrentCreator(const QString & target,const QStringList & trackers, - Uint32 chunk_size,const QString & name, - const QString & comments,bool priv,bool decentralized); + TorrentCreator(const TQString & target,const TQStringList & trackers, + Uint32 chunk_size,const TQString & name, + const TQString & comments,bool priv,bool decentralized); virtual ~TorrentCreator(); @@ -86,7 +86,7 @@ namespace bt * @param url Filename * @throw Error if something goes wrong */ - void saveTorrent(const QString & url); + void saveTorrent(const TQString & url); /** * Make a TorrentControl object for this torrent. @@ -98,13 +98,13 @@ namespace bt * @throw Error if something goes wrong * @return The newly created object */ - TorrentControl* makeTC(const QString & data_dir); + TorrentControl* makeTC(const TQString & data_dir); private: void saveInfo(BEncoder & enc); void saveFile(BEncoder & enc,const TorrentFile & file); void savePieces(BEncoder & enc); - void buildFileList(const QString & dir); + void buildFileList(const TQString & dir); bool calcHashSingle(); bool calcHashMulti(); }; diff --git a/libktorrent/torrent/torrentfile.cpp b/libktorrent/torrent/torrentfile.cpp index 9c21a4a..106e66f 100644 --- a/libktorrent/torrent/torrentfile.cpp +++ b/libktorrent/torrent/torrentfile.cpp @@ -28,10 +28,10 @@ namespace bt { - TorrentFile::TorrentFile() : TorrentFileInterface(QString::null,0),missing(false),filetype(UNKNOWN) + TorrentFile::TorrentFile() : TorrentFileInterface(TQString(),0),missing(false),filetype(UNKNOWN) {} - TorrentFile::TorrentFile(Uint32 index,const QString & path, + TorrentFile::TorrentFile(Uint32 index,const TQString & path, Uint64 off,Uint64 size,Uint64 chunk_size) : TorrentFileInterface(path,size),index(index),cache_offset(off),missing(false),filetype(UNKNOWN) { @@ -46,7 +46,7 @@ namespace bt } TorrentFile::TorrentFile(const TorrentFile & tf) - : TorrentFileInterface(QString::null,0) + : TorrentFileInterface(TQString(),0) { index = tf.getIndex(); path = tf.getPath(); diff --git a/libktorrent/torrent/torrentfile.h b/libktorrent/torrent/torrentfile.h index 9e0c397..9a1d494 100644 --- a/libktorrent/torrent/torrentfile.h +++ b/libktorrent/torrent/torrentfile.h @@ -21,7 +21,7 @@ #ifndef BTTORRENTFILE_H #define BTTORRENTFILE_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> #include <interfaces/torrentfileinterface.h> @@ -38,6 +38,7 @@ namespace bt class TorrentFile : public kt::TorrentFileInterface { Q_OBJECT + TQ_OBJECT Uint32 index; Uint64 cache_offset; @@ -68,7 +69,7 @@ namespace bt * @param size Size of the file * @param chunk_size Size of each chunk */ - TorrentFile(Uint32 index,const QString & path,Uint64 off,Uint64 size,Uint64 chunk_size); + TorrentFile(Uint32 index,const TQString & path,Uint64 off,Uint64 size,Uint64 chunk_size); /** * Copy constructor. diff --git a/libktorrent/torrent/tracker.cpp b/libktorrent/torrent/tracker.cpp index 261169c..4878a16 100644 --- a/libktorrent/torrent/tracker.cpp +++ b/libktorrent/torrent/tracker.cpp @@ -36,8 +36,8 @@ using namespace KNetwork; namespace bt { - static QString custom_ip; - static QString custom_ip_resolved; + static TQString custom_ip; + static TQString custom_ip_resolved; Tracker::Tracker(const KURL & url,kt::TorrentInterface* tor,const PeerID & id,int tier) : url(url),tier(tier),peer_id(id),tor(tor) @@ -54,21 +54,21 @@ namespace bt { } - void Tracker::setCustomIP(const QString & ip) + void Tracker::setCustomIP(const TQString & ip) { if (custom_ip == ip) return; Out(SYS_TRK|LOG_NOTICE) << "Setting custom ip to " << ip << endl; custom_ip = ip; - custom_ip_resolved = QString::null; + custom_ip_resolved = TQString(); if (ip.isNull()) return; - KResolverResults res = KResolver::resolve(ip,QString::null); + KResolverResults res = KResolver::resolve(ip,TQString()); if (res.error() || res.empty()) { - custom_ip = custom_ip_resolved = QString::null; + custom_ip = custom_ip_resolved = TQString(); } else { @@ -77,15 +77,15 @@ namespace bt } } - QString Tracker::getCustomIP() + TQString Tracker::getCustomIP() { return custom_ip_resolved; } void Tracker::timedDelete(int ms) { - QTimer::singleShot(ms,this,SLOT(deleteLater())); - connect(this,SIGNAL(stopDone()),this,SLOT(deleteLater())); + TQTimer::singleShot(ms,this,TQT_SLOT(deleteLater())); + connect(this,TQT_SIGNAL(stopDone()),this,TQT_SLOT(deleteLater())); } } diff --git a/libktorrent/torrent/tracker.h b/libktorrent/torrent/tracker.h index d254b63..a017f9e 100644 --- a/libktorrent/torrent/tracker.h +++ b/libktorrent/torrent/tracker.h @@ -44,6 +44,7 @@ namespace bt class Tracker : public kt::PeerSource { Q_OBJECT + TQ_OBJECT public: Tracker(const KURL & url,kt::TorrentInterface* tor,const PeerID & id,int tier); virtual ~Tracker(); @@ -55,7 +56,7 @@ namespace bt * Set the custom IP * @param str */ - static void setCustomIP(const QString & str); + static void setCustomIP(const TQString & str); /// get the tracker url KURL trackerURL() const {return url;} @@ -97,13 +98,13 @@ namespace bt Uint32 getNumLeechers() const {return leechers;} /// Get the custom ip to use, null if none is set - static QString getCustomIP(); + static TQString getCustomIP(); signals: /** * Emitted when an error happens. * @param failure_reason The reason why we couldn't reach the tracker */ - void requestFailed(const QString & failure_reason); + void requestFailed(const TQString & failure_reason); /** * Emitted when a stop is done. @@ -128,7 +129,7 @@ namespace bt Uint32 interval,seeders,leechers,key; bool started; private: - //static QString custom_ip,custom_ip_resolved; + //static TQString custom_ip,custom_ip_resolved; }; } diff --git a/libktorrent/torrent/udptracker.cpp b/libktorrent/torrent/udptracker.cpp index 2dd4a01..6597349 100644 --- a/libktorrent/torrent/udptracker.cpp +++ b/libktorrent/torrent/udptracker.cpp @@ -51,16 +51,16 @@ namespace bt transaction_id = 0; interval = 0; - connect(&conn_timer,SIGNAL(timeout()),this,SLOT(onConnTimeout())); - connect(socket,SIGNAL(announceRecieved(Int32, const QByteArray &)), - this,SLOT(announceRecieved(Int32, const QByteArray& ))); - connect(socket,SIGNAL(connectRecieved(Int32, Int64 )), - this,SLOT(connectRecieved(Int32, Int64 ))); - connect(socket,SIGNAL(error(Int32, const QString& )), - this,SLOT(onError(Int32, const QString& ))); + connect(&conn_timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onConnTimeout())); + connect(socket,TQT_SIGNAL(announceRecieved(Int32, const TQByteArray &)), + this,TQT_SLOT(announceRecieved(Int32, const TQByteArray& ))); + connect(socket,TQT_SIGNAL(connectRecieved(Int32, Int64 )), + this,TQT_SLOT(connectRecieved(Int32, Int64 ))); + connect(socket,TQT_SIGNAL(error(Int32, const TQString& )), + this,TQT_SLOT(onError(Int32, const TQString& ))); - KResolver::resolveAsync(this,SLOT(onResolverResults(KResolverResults )), - url.host(),QString::number(url.port())); + KResolver::resolveAsync(this,TQT_SLOT(onResolverResults(KResolverResults )), + url.host(),TQString::number(url.port())); } @@ -117,7 +117,7 @@ namespace bt sendAnnounce(); } - void UDPTracker::announceRecieved(Int32 tid,const QByteArray & data) + void UDPTracker::announceRecieved(Int32 tid,const TQByteArray & data) { if (tid != transaction_id) return; @@ -143,11 +143,11 @@ namespace bt for (Uint32 i = 20;i < data.size() && j < nip;i+=6,j++) { Uint32 ip = ReadUint32(buf,i); - addPeer(QString("%1.%2.%3.%4") - .arg((ip & (0xFF000000)) >> 24) - .arg((ip & (0x00FF0000)) >> 16) - .arg((ip & (0x0000FF00)) >> 8) - .arg(ip & 0x000000FF), + addPeer(TQString("%1.%2.%3.%4") + .tqarg((ip & (0xFF000000)) >> 24) + .tqarg((ip & (0x00FF0000)) >> 16) + .tqarg((ip & (0x0000FF00)) >> 8) + .tqarg(ip & 0x000000FF), ReadUint16(buf,i+4)); } @@ -168,7 +168,7 @@ namespace bt } } - void UDPTracker::onError(Int32 tid,const QString & error_string) + void UDPTracker::onError(Int32 tid,const TQString & error_string) { if (tid != transaction_id) return; @@ -245,7 +245,7 @@ namespace bt WriteInt64(buf,64,s.bytes_left); WriteInt64(buf,72,s.trk_bytes_uploaded); WriteInt32(buf,80,ev); - QString cip = Tracker::getCustomIP(); + TQString cip = Tracker::getCustomIP(); if (cip.isNull()) { WriteUint32(buf,84,0); diff --git a/libktorrent/torrent/udptracker.h b/libktorrent/torrent/udptracker.h index 5107fb9..24dab97 100644 --- a/libktorrent/torrent/udptracker.h +++ b/libktorrent/torrent/udptracker.h @@ -21,9 +21,9 @@ #define BTUDPTRACKER_H #include <kurl.h> -#include <qvaluelist.h> -#include <qcstring.h> -#include <qtimer.h> +#include <tqvaluelist.h> +#include <tqcstring.h> +#include <tqtimer.h> #include <ksocketaddress.h> #include "tracker.h" #include "globals.h" @@ -62,6 +62,7 @@ namespace bt class UDPTracker : public Tracker { Q_OBJECT + TQ_OBJECT public: UDPTracker(const KURL & url,kt::TorrentInterface* tor,const PeerID & id,int tier); virtual ~UDPTracker(); @@ -76,8 +77,8 @@ namespace bt private slots: void onConnTimeout(); void connectRecieved(Int32 tid,Int64 connection_id); - void announceRecieved(Int32 tid,const QByteArray & buf); - void onError(Int32 tid,const QString & error_string); + void announceRecieved(Int32 tid,const TQByteArray & buf); + void onError(Int32 tid,const TQString & error_string); void onResolverResults(KResolverResults res); private: @@ -93,7 +94,7 @@ namespace bt Uint32 data_read; int n; - QTimer conn_timer; + TQTimer conn_timer; Event event; static UDPTrackerSocket* socket; diff --git a/libktorrent/torrent/udptrackersocket.cpp b/libktorrent/torrent/udptrackersocket.cpp index 43ef2b6..79e9c5c 100644 --- a/libktorrent/torrent/udptrackersocket.cpp +++ b/libktorrent/torrent/udptrackersocket.cpp @@ -42,14 +42,14 @@ namespace bt { sock = new KNetwork::KDatagramSocket(this); sock->setAddressReuseable(true); - connect(sock,SIGNAL(readyRead()),this,SLOT(dataReceived())); + connect(sock,TQT_SIGNAL(readyRead()),this,TQT_SLOT(dataReceived())); int i = 0; if (port == 0) port = 4444; bool bound = false; - while (!(bound = sock->bind(QString::null,QString::number(port + i))) && i < 10) + while (!(bound = sock->bind(TQString(),TQString::number(port + i))) && i < 10) { Out() << "Failed to bind socket to port " << (port+i) << endl; i++; @@ -59,7 +59,7 @@ namespace bt if (!bound) { KMessageBox::error(0, - i18n("Cannot bind to udp port %1 or the 10 following ports.").arg(port)); + i18n("Cannot bind to udp port %1 or the 10 following ports.").tqarg(port)); } else { @@ -99,13 +99,13 @@ namespace bt transactions.remove(tid); } - void UDPTrackerSocket::handleConnect(const QByteArray & data) + void UDPTrackerSocket::handleConnect(const TQByteArray & data) { const Uint8* buf = (const Uint8*)data.data(); // Read the transaction_id and check it Int32 tid = ReadInt32(buf,4); - QMap<Int32,Action>::iterator i = transactions.find(tid); + TQMap<Int32,Action>::iterator i = transactions.tqfind(tid); // if we can't find the transaction, just return if (i == transactions.end()) { @@ -116,7 +116,7 @@ namespace bt if (i.data() != CONNECT) { transactions.erase(i); - error(tid,QString::null); + error(tid,TQString()); return; } @@ -125,13 +125,13 @@ namespace bt connectRecieved(tid,ReadInt64(buf,8)); } - void UDPTrackerSocket::handleAnnounce(const QByteArray & data) + void UDPTrackerSocket::handleAnnounce(const TQByteArray & data) { const Uint8* buf = (const Uint8*)data.data(); // Read the transaction_id and check it Int32 tid = ReadInt32(buf,4); - QMap<Int32,Action>::iterator i = transactions.find(tid); + TQMap<Int32,Action>::iterator i = transactions.tqfind(tid); // if we can't find the transaction, just return if (i == transactions.end()) return; @@ -140,7 +140,7 @@ namespace bt if (i.data() != ANNOUNCE) { transactions.erase(i); - error(tid,QString::null); + error(tid,TQString()); return; } @@ -149,19 +149,19 @@ namespace bt announceRecieved(tid,data); } - void UDPTrackerSocket::handleError(const QByteArray & data) + void UDPTrackerSocket::handleError(const TQByteArray & data) { const Uint8* buf = (const Uint8*)data.data(); // Read the transaction_id and check it Int32 tid = ReadInt32(buf,4); - QMap<Int32,Action>::iterator it = transactions.find(tid); + TQMap<Int32,Action>::iterator it = transactions.tqfind(tid); // if we can't find the transaction, just return if (it == transactions.end()) return; // extract error message transactions.erase(it); - QString msg; + TQString msg; for (Uint32 i = 8;i < data.size();i++) msg += (char)buf[i]; @@ -183,7 +183,7 @@ namespace bt } KDatagramPacket pck = sock->receive(); - const QByteArray & data = pck.data(); + const TQByteArray & data = pck.data(); const Uint8* buf = (const Uint8*)data.data(); Uint32 type = ReadUint32(buf,0); switch (type) @@ -203,7 +203,7 @@ namespace bt Int32 UDPTrackerSocket::newTransactionID() { Int32 transaction_id = rand() * time(0); - while (transactions.contains(transaction_id)) + while (transactions.tqcontains(transaction_id)) transaction_id++; return transaction_id; } diff --git a/libktorrent/torrent/udptrackersocket.h b/libktorrent/torrent/udptrackersocket.h index 1537598..7992cdd 100644 --- a/libktorrent/torrent/udptrackersocket.h +++ b/libktorrent/torrent/udptrackersocket.h @@ -20,9 +20,9 @@ #ifndef BTUDPTRACKERSOCKET_H #define BTUDPTRACKERSOCKET_H -#include <qobject.h> -#include <qmap.h> -#include <qcstring.h> +#include <tqobject.h> +#include <tqmap.h> +#include <tqcstring.h> #include <util/constants.h> @@ -51,9 +51,10 @@ namespace bt * * Class which handles communication with one or more UDP trackers. */ - class UDPTrackerSocket : public QObject + class UDPTrackerSocket : public TQObject { Q_OBJECT + TQ_OBJECT public: UDPTrackerSocket(); virtual ~UDPTrackerSocket(); @@ -114,24 +115,24 @@ namespace bt * @param tid The transaction_id * @param buf The data */ - void announceRecieved(Int32 tid,const QByteArray & buf); + void announceRecieved(Int32 tid,const TQByteArray & buf); /** * Signal emitted, when an error occurs during a transaction. * @param tid The transaction_id * @param error_string Potential error string */ - void error(Int32 tid,const QString & error_string); + void error(Int32 tid,const TQString & error_string); private: - void handleConnect(const QByteArray & buf); - void handleAnnounce(const QByteArray & buf); - void handleError(const QByteArray & buf); + void handleConnect(const TQByteArray & buf); + void handleAnnounce(const TQByteArray & buf); + void handleError(const TQByteArray & buf); private: Uint16 udp_port; KNetwork::KDatagramSocket* sock; - QMap<Int32,Action> transactions; + TQMap<Int32,Action> transactions; static Uint16 port; }; } diff --git a/libktorrent/torrent/uploader.h b/libktorrent/torrent/uploader.h index 4370d69..0950780 100644 --- a/libktorrent/torrent/uploader.h +++ b/libktorrent/torrent/uploader.h @@ -20,7 +20,7 @@ #ifndef BTUPLOADER_H #define BTUPLOADER_H -#include <qobject.h> +#include <tqobject.h> #include "globals.h" namespace bt @@ -38,9 +38,10 @@ namespace bt * Class which manages the uploading of data. It has a PeerUploader for * each Peer. */ - class Uploader : public QObject + class Uploader : public TQObject { Q_OBJECT + TQ_OBJECT public: /** * Constructor, sets the ChunkManager. diff --git a/libktorrent/torrent/upspeedestimater.cpp b/libktorrent/torrent/upspeedestimater.cpp index 0d6c544..08137f5 100644 --- a/libktorrent/torrent/upspeedestimater.cpp +++ b/libktorrent/torrent/upspeedestimater.cpp @@ -50,7 +50,7 @@ namespace bt void UpSpeedEstimater::bytesWritten(Uint32 bytes) { - QValueList<Entry>::iterator i = outstanding_bytes.begin(); + TQValueList<Entry>::iterator i = outstanding_bytes.begin(); TimeStamp now = GetCurrentTime(); while (bytes > 0 && i != outstanding_bytes.end()) { @@ -84,7 +84,7 @@ namespace bt } } - double UpSpeedEstimater::rate(QValueList<Entry> & el) + double UpSpeedEstimater::rate(TQValueList<Entry> & el) { TimeStamp now = GetCurrentTime(); const Uint32 INTERVAL = 3000; @@ -92,7 +92,7 @@ namespace bt Uint32 tot_bytes = 0; Uint32 oldest_time = now; - QValueList<Entry>::iterator i = el.begin(); + TQValueList<Entry>::iterator i = el.begin(); while (i != el.end()) { Entry & e = *i; diff --git a/libktorrent/torrent/upspeedestimater.h b/libktorrent/torrent/upspeedestimater.h index 6503499..27c0c06 100644 --- a/libktorrent/torrent/upspeedestimater.h +++ b/libktorrent/torrent/upspeedestimater.h @@ -20,7 +20,7 @@ #ifndef BTUPSPEEDESTIMATER_H #define BTUPSPEEDESTIMATER_H -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <util/constants.h> namespace bt @@ -68,16 +68,16 @@ namespace bt /// Get the protocol overhead double protocollOverhead() const {return proto_upload_rate;} private: - double rate(QValueList<Entry> & el); + double rate(TQValueList<Entry> & el); private: double upload_rate; double proto_upload_rate; Uint32 accumulated_bytes; - QValueList<Entry> outstanding_bytes; - QValueList<Entry> written_bytes; + TQValueList<Entry> outstanding_bytes; + TQValueList<Entry> written_bytes; #ifdef MEASURE_PROTO_OVERHEAD - QValueList<Entry> proto_bytes; + TQValueList<Entry> proto_bytes; #endif }; diff --git a/libktorrent/torrent/utpex.cpp b/libktorrent/torrent/utpex.cpp index 4933218..68361e0 100644 --- a/libktorrent/torrent/utpex.cpp +++ b/libktorrent/torrent/utpex.cpp @@ -46,7 +46,7 @@ namespace bt if (size <= 2 || packet[1] != 1) return; - QByteArray tmp; + TQByteArray tmp; tmp.setRawData((const char*)packet,size); BNode* node = 0; try @@ -61,7 +61,7 @@ namespace bt BValueNode* val = dict->getValue("added"); if (val) { - QByteArray data = val->data().toByteArray(); + TQByteArray data = val->data().toByteArray(); peer->emitPex(data); } } @@ -111,14 +111,14 @@ namespace bt if (!(peers.size() == 0 && added.size() == 0)) { // encode the whole lot - QByteArray data; + TQByteArray data; BEncoder enc(new BEncoderBufferOutput(data)); enc.beginDict(); - enc.write("added"); + enc.write(TQString("added")); encode(enc,added); - enc.write("added.f"); // no idea what this added.f thing means - enc.write(""); - enc.write("dropped"); + enc.write(TQString("added.f")); // no idea what this added.f thing means + enc.write(TQString("")); + enc.write(TQString("dropped")); encode(enc,peers); enc.end(); @@ -132,7 +132,7 @@ namespace bt { if (ps.size() == 0) { - enc.write(""); + enc.write(TQString("")); return; } diff --git a/libktorrent/torrent/value.cpp b/libktorrent/torrent/value.cpp index df063ab..4d8641c 100644 --- a/libktorrent/torrent/value.cpp +++ b/libktorrent/torrent/value.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qtextcodec.h> +#include <tqtextcodec.h> #include "value.h" namespace bt @@ -32,7 +32,7 @@ namespace bt Value::Value(Int64 val) : type(INT64),big_ival(val) {} - Value::Value(const QByteArray & val) : type(STRING),ival(0),strval(val),big_ival(0) + Value::Value(const TQByteArray & val) : type(STRING),ival(0),strval(val),big_ival(0) {} Value::Value(const Value & val) @@ -43,12 +43,12 @@ namespace bt {} - QString Value::toString(const QString & encoding) const + TQString Value::toString(const TQString & encoding) const { if (encoding.isNull() || encoding.isEmpty()) return toString(); - QTextCodec* tc = QTextCodec::codecForName(encoding.ascii()); + TQTextCodec* tc = TQTextCodec::codecForName(encoding.ascii()); if (!tc) return toString(); @@ -80,7 +80,7 @@ namespace bt return *this; } - Value & Value::operator = (const QByteArray & val) + Value & Value::operator = (const TQByteArray & val) { type = STRING; strval = val; diff --git a/libktorrent/torrent/value.h b/libktorrent/torrent/value.h index cd7c879..7926af4 100644 --- a/libktorrent/torrent/value.h +++ b/libktorrent/torrent/value.h @@ -20,7 +20,7 @@ #ifndef BTVALUE_H #define BTVALUE_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace bt @@ -41,25 +41,25 @@ namespace bt Value(); Value(int val); Value(Int64 val); - Value(const QByteArray & val); + Value(const TQByteArray & val); Value(const Value & val); ~Value(); Value & operator = (const Value & val); Value & operator = (Int32 val); Value & operator = (Int64 val); - Value & operator = (const QByteArray & val); + Value & operator = (const TQByteArray & val); Type getType() const {return type;} Int32 toInt() const {return ival;} Int64 toInt64() const {return big_ival;} - QString toString() const {return QString(strval);} - QString toString(const QString & encoding) const; - QByteArray toByteArray() const {return strval;} + TQString toString() const {return TQString(strval);} + TQString toString(const TQString & encoding) const; + TQByteArray toByteArray() const {return strval;} private: Type type; Int32 ival; - QByteArray strval; + TQByteArray strval; Int64 big_ival; }; } diff --git a/libktorrent/util/autorotatelogjob.cpp b/libktorrent/util/autorotatelogjob.cpp index c43e304..d3a2d8a 100644 --- a/libktorrent/util/autorotatelogjob.cpp +++ b/libktorrent/util/autorotatelogjob.cpp @@ -26,7 +26,7 @@ namespace bt { - AutoRotateLogJob::AutoRotateLogJob(const QString & file,Log* lg) + AutoRotateLogJob::AutoRotateLogJob(const TQString & file,Log* lg) : KIO::Job(false),file(file),cnt(10),lg(lg) { update(); @@ -46,12 +46,12 @@ namespace bt { while (cnt > 1) { - QString prev = QString("%1-%2.gz").arg(file).arg(cnt - 1); - QString curr = QString("%1-%2.gz").arg(file).arg(cnt); + TQString prev = TQString("%1-%2.gz").tqarg(file).tqarg(cnt - 1); + TQString curr = TQString("%1-%2.gz").tqarg(file).tqarg(cnt); if (bt::Exists(prev)) // if file exists start the move job { KIO::Job* sj = KIO::file_move(KURL::fromPathOrURL(prev),KURL::fromPathOrURL(curr),-1,true,false,false); - connect(sj,SIGNAL(result(KIO::Job*)),this,SLOT(moveJobDone(KIO::Job* ))); + connect(sj,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(moveJobDone(KIO::Job* ))); return; } else @@ -65,12 +65,12 @@ namespace bt // move current log to 1 and zip it bt::Move(file,file + "-1",true); KIO::Job* sj = KIO::file_move(KURL::fromPathOrURL(file),KURL::fromPathOrURL(file + "-1"),-1,true,false,false); - connect(sj,SIGNAL(result(KIO::Job*)),this,SLOT(moveJobDone(KIO::Job* ))); + connect(sj,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(moveJobDone(KIO::Job* ))); } else { // final log file is moved, now zip it and end the job - std::system(QString("gzip " + KProcess::quote(file + "-1")).local8Bit()); + std::system(TQString("gzip " + KProcess::quote(file + "-1")).local8Bit()); m_error = 0; lg->logRotateDone(); emitResult(); diff --git a/libktorrent/util/autorotatelogjob.h b/libktorrent/util/autorotatelogjob.h index 11cf06a..ae850b3 100644 --- a/libktorrent/util/autorotatelogjob.h +++ b/libktorrent/util/autorotatelogjob.h @@ -36,8 +36,9 @@ namespace bt class AutoRotateLogJob : public KIO::Job { Q_OBJECT + TQ_OBJECT public: - AutoRotateLogJob(const QString & file,Log* lg); + AutoRotateLogJob(const TQString & file,Log* lg); virtual ~AutoRotateLogJob(); virtual void kill(bool quietly=true); @@ -49,7 +50,7 @@ namespace bt void update(); private: - QString file; + TQString file; int cnt; Log* lg; }; diff --git a/libktorrent/util/constants.h b/libktorrent/util/constants.h index e663978..0551f60 100644 --- a/libktorrent/util/constants.h +++ b/libktorrent/util/constants.h @@ -20,19 +20,19 @@ #ifndef BTCONSTANTS_H #define BTCONSTANTS_H -#include <qglobal.h> +#include <tqglobal.h> namespace bt { - typedef Q_UINT64 Uint64; - typedef Q_UINT32 Uint32; - typedef Q_UINT16 Uint16; - typedef Q_UINT8 Uint8; + typedef TQ_UINT64 Uint64; + typedef TQ_UINT32 Uint32; + typedef TQ_UINT16 Uint16; + typedef TQ_UINT8 Uint8; - typedef Q_INT64 Int64; - typedef Q_INT32 Int32; - typedef Q_INT16 Int16; - typedef Q_INT8 Int8; + typedef TQ_INT64 Int64; + typedef TQ_INT32 Int32; + typedef TQ_INT16 Int16; + typedef TQ_INT8 Int8; typedef Uint64 TimeStamp; diff --git a/libktorrent/util/error.cpp b/libktorrent/util/error.cpp index bb981db..dd3e15d 100644 --- a/libktorrent/util/error.cpp +++ b/libktorrent/util/error.cpp @@ -22,7 +22,7 @@ namespace bt { - Error::Error(const QString & msg) : msg(msg) + Error::Error(const TQString & msg) : msg(msg) {} diff --git a/libktorrent/util/error.h b/libktorrent/util/error.h index 8b089e4..49aa95d 100644 --- a/libktorrent/util/error.h +++ b/libktorrent/util/error.h @@ -20,7 +20,7 @@ #ifndef BTERROR_H #define BTERROR_H -#include <qstring.h> +#include <tqstring.h> namespace bt { @@ -30,12 +30,12 @@ namespace bt */ class Error { - QString msg; + TQString msg; public: - Error(const QString & msg); + Error(const TQString & msg); virtual ~Error(); - QString toString() const {return msg;} + TQString toString() const {return msg;} }; diff --git a/libktorrent/util/file.cpp b/libktorrent/util/file.cpp index b898e07..f757142 100644 --- a/libktorrent/util/file.cpp +++ b/libktorrent/util/file.cpp @@ -22,7 +22,7 @@ #include <config.h> #endif -#include <qfile.h> +#include <tqfile.h> #include "config.h" #include <klocale.h> #include <string.h> @@ -45,15 +45,15 @@ namespace bt close(); } - bool File::open(const QString & file,const QString & mode) + bool File::open(const TQString & file,const TQString & mode) { this->file = file; if (fptr) close(); #if HAVE_FOPEN64 - fptr = fopen64(QFile::encodeName(file),mode.ascii()); + fptr = fopen64(TQFile::encodeName(file),mode.ascii()); #else - fptr = fopen(QFile::encodeName(file),mode.ascii()); + fptr = fopen(TQFile::encodeName(file),mode.ascii()); #endif return fptr != 0; } @@ -84,7 +84,7 @@ namespace bt if (errno == ENOSPC) Out() << "Disk full !" << endl; - throw Error(i18n("Cannot write to %1 : %2").arg(file).arg(strerror(errno))); + throw Error(i18n("Cannot write to %1 : %2").tqarg(file).tqarg(strerror(errno))); } return ret; } @@ -98,7 +98,7 @@ namespace bt if (ferror(fptr)) { clearerr(fptr); - throw Error(i18n("Cannot read from %1").arg(file)); + throw Error(i18n("Cannot read from %1").tqarg(file)); } return ret; } @@ -143,8 +143,8 @@ namespace bt return ftello(fptr); } - QString File::errorString() const + TQString File::errorString() const { - return QString(strerror(errno)); + return TQString(strerror(errno)); } } diff --git a/libktorrent/util/file.h b/libktorrent/util/file.h index 323a3a7..c6567f8 100644 --- a/libktorrent/util/file.h +++ b/libktorrent/util/file.h @@ -21,7 +21,7 @@ #define BTFILE_H #include <stdio.h> -#include <qstring.h> +#include <tqstring.h> #include "constants.h" namespace bt @@ -36,7 +36,7 @@ namespace bt class File { FILE* fptr; - QString file; + TQString file; public: /** * Constructor. @@ -54,7 +54,7 @@ namespace bt * @param mode Mode * @return true upon succes */ - bool open(const QString & file,const QString & mode); + bool open(const TQString & file,const TQString & mode); /** * Close the file. @@ -106,7 +106,7 @@ namespace bt Uint64 tell() const; /// Get the error string. - QString errorString() const; + TQString errorString() const; }; } diff --git a/libktorrent/util/fileops.cpp b/libktorrent/util/fileops.cpp index 3fcf03d..a83134a 100644 --- a/libktorrent/util/fileops.cpp +++ b/libktorrent/util/fileops.cpp @@ -30,9 +30,9 @@ #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> -#include <qdir.h> -#include <qfile.h> -#include <qstringlist.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqstringlist.h> #include "fileops.h" #include "error.h" #include "log.h" @@ -70,88 +70,88 @@ typedef int64_t __s64; namespace bt { - void MakeDir(const QString & dir,bool nothrow) + void MakeDir(const TQString & dir,bool nothrow) { - if (mkdir(QFile::encodeName(dir),0777) < -1) + if (mkdir(TQFile::encodeName(dir),0777) < -1) { if (!nothrow) throw Error(i18n("Cannot create directory %1: %2") - .arg(dir).arg(strerror(errno))); + .tqarg(dir).tqarg(strerror(errno))); else { - Out() << QString("Error : Cannot create directory %1 : %2").arg(dir).arg(strerror(errno))<< endl; + Out() << TQString("Error : Cannot create directory %1 : %2").tqarg(dir).tqarg(strerror(errno))<< endl; } } } - void SymLink(const QString & link_to,const QString & link_url,bool nothrow) + void SymLink(const TQString & link_to,const TQString & link_url,bool nothrow) { - if (symlink(QFile::encodeName(link_to),QFile::encodeName(link_url)) != 0) + if (symlink(TQFile::encodeName(link_to),TQFile::encodeName(link_url)) != 0) { if (!nothrow) throw Error(i18n("Cannot symlink %1 to %2: %3") - .arg(link_url.utf8()).arg(link_to.utf8()) - .arg(strerror(errno))); + .tqarg(link_url.utf8().data()).tqarg(link_to.utf8().data()) + .tqarg(strerror(errno))); else - Out() << QString("Error : Cannot symlink %1 to %2: %3") - .arg(link_url.utf8()).arg(link_to.utf8()) - .arg(strerror(errno)) << endl; + Out() << TQString("Error : Cannot symlink %1 to %2: %3") + .tqarg(link_url.utf8().data()).tqarg(link_to.utf8().data()) + .tqarg(strerror(errno)) << endl; } } - void Move(const QString & src,const QString & dst,bool nothrow) + void Move(const TQString & src,const TQString & dst,bool nothrow) { // Out() << "Moving " << src << " -> " << dst << endl; if (!KIO::NetAccess::move(KURL::fromPathOrURL(src),KURL::fromPathOrURL(dst),0)) { if (!nothrow) throw Error(i18n("Cannot move %1 to %2: %3") - .arg(src).arg(dst) - .arg(KIO::NetAccess::lastErrorString())); + .tqarg(src).tqarg(dst) + .tqarg(KIO::NetAccess::lastErrorString())); else - Out() << QString("Error : Cannot move %1 to %2: %3") - .arg(src).arg(dst) - .arg(KIO::NetAccess::lastErrorString()) << endl; + Out() << TQString("Error : Cannot move %1 to %2: %3") + .tqarg(src).tqarg(dst) + .tqarg(KIO::NetAccess::lastErrorString()) << endl; } } - void CopyFile(const QString & src,const QString & dst,bool nothrow) + void CopyFile(const TQString & src,const TQString & dst,bool nothrow) { if (!KIO::NetAccess::file_copy(KURL::fromPathOrURL(src),KURL::fromPathOrURL(dst))) { if (!nothrow) throw Error(i18n("Cannot copy %1 to %2: %3") - .arg(src).arg(dst) - .arg(KIO::NetAccess::lastErrorString())); + .tqarg(src).tqarg(dst) + .tqarg(KIO::NetAccess::lastErrorString())); else - Out() << QString("Error : Cannot copy %1 to %2: %3") - .arg(src).arg(dst) - .arg(KIO::NetAccess::lastErrorString()) << endl; + Out() << TQString("Error : Cannot copy %1 to %2: %3") + .tqarg(src).tqarg(dst) + .tqarg(KIO::NetAccess::lastErrorString()) << endl; } } - void CopyDir(const QString & src,const QString & dst,bool nothrow) + void CopyDir(const TQString & src,const TQString & dst,bool nothrow) { if (!KIO::NetAccess::dircopy(KURL::fromPathOrURL(src),KURL::fromPathOrURL(dst),0)) { if (!nothrow) throw Error(i18n("Cannot copy %1 to %2: %3") - .arg(src).arg(dst) - .arg(KIO::NetAccess::lastErrorString())); + .tqarg(src).tqarg(dst) + .tqarg(KIO::NetAccess::lastErrorString())); else - Out() << QString("Error : Cannot copy %1 to %2: %3") - .arg(src).arg(dst) - .arg(KIO::NetAccess::lastErrorString()) << endl; + Out() << TQString("Error : Cannot copy %1 to %2: %3") + .tqarg(src).tqarg(dst) + .tqarg(KIO::NetAccess::lastErrorString()) << endl; } } - bool Exists(const QString & url) + bool Exists(const TQString & url) { // Out() << "Testing if " << url << " exists " << endl; - if (access(QFile::encodeName(url),F_OK) < 0) + if (access(TQFile::encodeName(url),F_OK) < 0) { // Out() << "No " << endl; return false; @@ -163,14 +163,14 @@ namespace bt } } - static bool DelDir(const QString & fn) + static bool DelDir(const TQString & fn) { - QDir d(fn); - QStringList subdirs = d.entryList(QDir::Dirs); + TQDir d(fn); + TQStringList subdirs = d.entryList(TQDir::Dirs); - for (QStringList::iterator i = subdirs.begin(); i != subdirs.end();i++) + for (TQStringList::iterator i = subdirs.begin(); i != subdirs.end();i++) { - QString entry = *i; + TQString entry = *i; if (entry == ".." || entry == ".") continue; @@ -182,12 +182,12 @@ namespace bt } } - QStringList files = d.entryList(QDir::Files | QDir::System | QDir::Hidden); - for (QStringList::iterator i = files.begin(); i != files.end();i++) + TQStringList files = d.entryList(TQDir::Files | TQDir::System | TQDir::Hidden); + for (TQStringList::iterator i = files.begin(); i != files.end();i++) { - QString entry = *i; + TQString entry = *i; - if (remove(QFile::encodeName(d.absFilePath(entry))) < 0) + if (remove(TQFile::encodeName(d.absFilePath(entry))) < 0) { Out(SYS_GEN|LOG_DEBUG) << "Delete of " << fn << "/" << entry << " failed !" << endl; return false; @@ -203,9 +203,9 @@ namespace bt return true; } - void Delete(const QString & url,bool nothrow) + void Delete(const TQString & url,bool nothrow) { - QCString fn = QFile::encodeName(url); + TQCString fn = TQFile::encodeName(url); #if HAVE_STAT64 struct stat64 statbuf; if (lstat64(fn, &statbuf) < 0) @@ -229,9 +229,9 @@ namespace bt if (!ok) { - QString err = i18n("Cannot delete %1: %2") - .arg(url) - .arg(strerror(errno)); + TQString err = i18n("Cannot delete %1: %2") + .tqarg(url) + .tqarg(strerror(errno)); if (!nothrow) throw Error(err); else @@ -239,7 +239,7 @@ namespace bt } } - void Touch(const QString & url,bool nothrow) + void Touch(const TQString & url,bool nothrow) { if (Exists(url)) return; @@ -249,8 +249,8 @@ namespace bt { if (!nothrow) throw Error(i18n("Cannot create %1: %2") - .arg(url) - .arg(fptr.errorString())); + .tqarg(url) + .tqarg(fptr.errorString())); else Out() << "Error : Cannot create " << url << " : " << fptr.errorString() << endl; @@ -258,19 +258,19 @@ namespace bt } } - Uint64 FileSize(const QString & url) + Uint64 FileSize(const TQString & url) { int ret = 0; #if HAVE_STAT64 struct stat64 sb; - ret = stat64(QFile::encodeName(url),&sb); + ret = stat64(TQFile::encodeName(url),&sb); #else struct stat sb; - ret = stat(QFile::encodeName(url),&sb); + ret = stat(TQFile::encodeName(url),&sb); #endif if (ret < 0) throw Error(i18n("Cannot calculate the filesize of %1: %2") - .arg(url).arg(strerror(errno))); + .tqarg(url).tqarg(strerror(errno))); return (Uint64)sb.st_size; } @@ -286,7 +286,7 @@ namespace bt ret = fstat(fd,&sb); #endif if (ret < 0) - throw Error(i18n("Cannot calculate the filesize : %2").arg(strerror(errno))); + throw Error(i18n("Cannot calculate the filesize : %2").tqarg(strerror(errno))); return (Uint64)sb.st_size; } @@ -310,11 +310,11 @@ namespace bt return true; } - bool FatPreallocate(const QString & path,Uint64 size) + bool FatPreallocate(const TQString & path,Uint64 size) { - int fd = ::open(QFile::encodeName(path),O_RDWR | O_LARGEFILE); + int fd = ::open(TQFile::encodeName(path),O_RDWR | O_LARGEFILE); if (fd < 0) - throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno))); + throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno))); bool ret = FatPreallocate(fd,size); close(fd); @@ -339,11 +339,11 @@ namespace bt } - bool XfsPreallocate(const QString & path, Uint64 size) + bool XfsPreallocate(const TQString & path, Uint64 size) { - int fd = ::open(QFile::encodeName(path), O_RDWR | O_LARGEFILE); + int fd = ::open(TQFile::encodeName(path), O_RDWR | O_LARGEFILE); if (fd < 0) - throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno))); + throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno))); bool ret = XfsPreallocate(fd,size); close(fd); @@ -364,16 +364,16 @@ namespace bt #else if (ftruncate(fd,size) == -1) #endif - throw Error(i18n("Cannot expand file : %1").arg(strerror(errno))); + throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno))); } else { #if HAVE_POSIX_FALLOCATE64 if (posix_fallocate64(fd,0,size) != 0) - throw Error(i18n("Cannot expand file : %1").arg(strerror(errno))); + throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno))); #elif HAVE_POSIX_FALLOCATE if (posix_fallocate(fd,0,size) != 0) - throw Error(i18n("Cannot expand file : %1").arg(strerror(errno))); + throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno))); #else SeekFile(fd,0,SEEK_SET); bt::Array<Uint8> buf(4096); @@ -388,9 +388,9 @@ namespace bt int ret = write(fd,buf,to_write); if (ret < 0) - throw Error(i18n("Cannot expand file : %1").arg(strerror(errno))); + throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno))); else if (ret == 0 || ret != (int)to_write) - throw Error(i18n("Cannot expand file").arg(strerror(errno))); + throw Error(i18n("Cannot expand file").tqarg(strerror(errno))); else written += to_write; } @@ -398,11 +398,11 @@ namespace bt } } - void TruncateFile(const QString & path,Uint64 size) + void TruncateFile(const TQString & path,Uint64 size) { - int fd = ::open(QFile::encodeName(path),O_RDWR | O_LARGEFILE); + int fd = ::open(TQFile::encodeName(path),O_RDWR | O_LARGEFILE); if (fd < 0) - throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno))); + throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno))); try { @@ -423,10 +423,10 @@ namespace bt #else if (lseek(fd,off,whence) == -1) #endif - throw Error(i18n("Cannot seek in file : %1").arg(strerror(errno))); + throw Error(i18n("Cannot seek in file : %1").tqarg(strerror(errno))); } - bool FreeDiskSpace(const QString & path,Uint64 & bytes_free) + bool FreeDiskSpace(const TQString & path,Uint64 & bytes_free) { #if HAVE_STATVFS #if HAVE_STATVFS64 @@ -443,7 +443,7 @@ namespace bt else { Out(SYS_GEN|LOG_DEBUG) << "Error : statvfs for " << path << " failed : " - << QString(strerror(errno)) << endl; + << TQString(strerror(errno)) << endl; return false; } @@ -457,7 +457,7 @@ namespace bt else { Out(SYS_GEN|LOG_DEBUG) << "Error : statfs for " << path << " failed : " - << QString(strerror(errno)) << endl; + << TQString(strerror(errno)) << endl; return false; } diff --git a/libktorrent/util/fileops.h b/libktorrent/util/fileops.h index 253ee96..067bd03 100644 --- a/libktorrent/util/fileops.h +++ b/libktorrent/util/fileops.h @@ -25,7 +25,7 @@ #endif #include <util/constants.h> -class QString; +class TQString; namespace bt { @@ -37,7 +37,7 @@ namespace bt * @param nothrow wether or not we shouldn't throw an Error upon failure * @throw Error upon error */ - void MakeDir(const QString & dir,bool nothrow = false); + void MakeDir(const TQString & dir,bool nothrow = false); /** * Create a symbolic link @a link_url which links to @a link_to @@ -45,7 +45,7 @@ namespace bt * @param link_url The link url * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void SymLink(const QString & link_to,const QString & link_url,bool nothrow = false); + void SymLink(const TQString & link_to,const TQString & link_url,bool nothrow = false); /** * Move a file/dir from one location to another @@ -53,7 +53,7 @@ namespace bt * @param dst The destination file / directory * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void Move(const QString & src,const QString & dst,bool nothrow = false); + void Move(const TQString & src,const TQString & dst,bool nothrow = false); /** * Copy a file. @@ -61,7 +61,7 @@ namespace bt * @param dst The destination dir/file * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void CopyFile(const QString & src,const QString & dst,bool nothrow = false); + void CopyFile(const TQString & src,const TQString & dst,bool nothrow = false); /** * Copy a file or directory @@ -69,21 +69,21 @@ namespace bt * @param dst The destination dir/file * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void CopyDir(const QString & src,const QString & dst,bool nothrow = false); + void CopyDir(const TQString & src,const TQString & dst,bool nothrow = false); /** * Check wether a file/dir exists * @param url The file/dir * @return true if it exits */ - bool Exists(const QString & url); + bool Exists(const TQString & url); /** * Delete a file or directory. * @param url The url of the file/dir * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void Delete(const QString & url,bool nothrow = false); + void Delete(const TQString & url,bool nothrow = false); /** * Try to create a file. Doesn't do anything if the file @@ -91,7 +91,7 @@ namespace bt * @param url The url of the file * @param nothrow wether or not we shouldn't throw an Error upon failure */ - void Touch(const QString & url,bool nothrow = false); + void Touch(const TQString & url,bool nothrow = false); /** * Calculates the size of a file @@ -99,7 +99,7 @@ namespace bt * @return The size of the file * @throw Error if the file doesn't exist, or something else goes wrong */ - Uint64 FileSize(const QString & url); + Uint64 FileSize(const TQString & url); /** * Get the size of a file. @@ -124,7 +124,7 @@ namespace bt * @param quick Use the quick way (doesn't prevent fragmentationt) * @throw Error if the file doesn't exist, or something else goes wrong */ - void TruncateFile(const QString & path,Uint64 size); + void TruncateFile(const TQString & path,Uint64 size); /** * Special truncate for FAT file systems. @@ -134,7 +134,7 @@ namespace bt /** * Special truncate for FAT file systems. */ - bool FatPreallocate(const QString & path,Uint64 size); + bool FatPreallocate(const TQString & path,Uint64 size); #ifdef HAVE_XFS_XFS_H /** @@ -145,7 +145,7 @@ namespace bt /** * Special truncate for XFS file systems. */ - bool XfsPreallocate(const QString & path,Uint64 size); + bool XfsPreallocate(const TQString & path,Uint64 size); #endif @@ -159,7 +159,7 @@ namespace bt void SeekFile(int fd,Int64 off,int whence); /// Calculate the number of bytes free on the filesystem path is located - bool FreeDiskSpace(const QString & path,Uint64 & bytes_free); + bool FreeDiskSpace(const TQString & path,Uint64 & bytes_free); } #endif diff --git a/libktorrent/util/functions.cpp b/libktorrent/util/functions.cpp index 744bf43..3c73f36 100644 --- a/libktorrent/util/functions.cpp +++ b/libktorrent/util/functions.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdir.h> -#include <qhostaddress.h> +#include <tqdir.h> +#include <tqhostaddress.h> #include <errno.h> #include <sys/time.h> #include <sys/types.h> @@ -39,17 +39,17 @@ namespace bt { - bool IsMultimediaFile(const QString & filename) + bool IsMultimediaFile(const TQString & filename) { KMimeType::Ptr ptr = KMimeType::findByPath(filename); - QString name = ptr->name(); + TQString name = ptr->name(); return name.startsWith("audio") || name.startsWith("video") || name == "application/ogg"; } - QHostAddress LookUpHost(const QString & host) + TQHostAddress LookUpHost(const TQString & host) { struct hostent * he = gethostbyname(host.ascii()); - QHostAddress addr; + TQHostAddress addr; if (he) { addr.setAddress(inet_ntoa(*((struct in_addr *)he->h_addr))); @@ -57,10 +57,10 @@ namespace bt return addr; } - QString DirSeparator() + TQString DirSeparator() { - QString tmp; - tmp.append(QDir::separator()); + TQString tmp; + tmp.append(TQDir::separator()); return tmp; } @@ -203,7 +203,7 @@ namespace bt if (setrlimit(RLIMIT_NOFILE,&lim) < 0) { Out(SYS_GEN|LOG_DEBUG) << "Failed to maximize file limit : " - << QString(strerror(errno)) << endl; + << TQString(strerror(errno)) << endl; return false; } } @@ -221,7 +221,7 @@ namespace bt if (setrlimit(RLIMIT_DATA,&lim) < 0) { Out(SYS_GEN|LOG_DEBUG) << "Failed to maximize data limit : " - << QString(strerror(errno)) << endl; + << TQString(strerror(errno)) << endl; return false; } } diff --git a/libktorrent/util/functions.h b/libktorrent/util/functions.h index 4ace51b..9295b83 100644 --- a/libktorrent/util/functions.h +++ b/libktorrent/util/functions.h @@ -22,8 +22,8 @@ #include "constants.h" -class QString; -class QHostAddress; +class TQString; +class TQHostAddress; class KURL; namespace bt @@ -56,9 +56,9 @@ namespace bt TimeStamp Now(); - QHostAddress LookUpHost(const QString & host); - QString DirSeparator(); - bool IsMultimediaFile(const QString & filename); + TQHostAddress LookUpHost(const TQString & host); + TQString DirSeparator(); + bool IsMultimediaFile(const TQString & filename); /** * Maximize the file and memory limits using setrlimit. diff --git a/libktorrent/util/httprequest.cpp b/libktorrent/util/httprequest.cpp index d0652bc..ed7d980 100644 --- a/libktorrent/util/httprequest.cpp +++ b/libktorrent/util/httprequest.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qstringlist.h> +#include <tqstringlist.h> #include <torrent/globals.h> #include "httprequest.h" #include "array.h" @@ -27,18 +27,18 @@ namespace bt { - HTTPRequest::HTTPRequest(const QString & hdr,const QString & payload,const QString & host,Uint16 port,bool verbose) : hdr(hdr),payload(payload),verbose(verbose) + HTTPRequest::HTTPRequest(const TQString & hdr,const TQString & payload,const TQString & host,Uint16 port,bool verbose) : hdr(hdr),payload(payload),verbose(verbose) { - sock = new KNetwork::KStreamSocket(host,QString::number(port),this,0); + sock = new KNetwork::KStreamSocket(host,TQString::number(port),this,0); sock->enableRead(true); sock->enableWrite(true); sock->setTimeout(30000); sock->setBlocking(false); - connect(sock,SIGNAL(readyRead()),this,SLOT(onReadyRead())); - connect(sock,SIGNAL(gotError(int)),this,SLOT(onError(int ))); - connect(sock,SIGNAL(timedOut()),this,SLOT(onTimeout())); - connect(sock,SIGNAL(connected(const KResolverEntry&)), - this, SLOT(onConnect( const KResolverEntry& ))); + connect(sock,TQT_SIGNAL(readyRead()),this,TQT_SLOT(onReadyRead())); + connect(sock,TQT_SIGNAL(gotError(int)),this,TQT_SLOT(onError(int ))); + connect(sock,TQT_SIGNAL(timedOut()),this,TQT_SLOT(onTimeout())); + connect(sock,TQT_SIGNAL(connected(const KResolverEntry&)), + this, TQT_SLOT(onConnect( const KResolverEntry& ))); } @@ -55,10 +55,10 @@ namespace bt void HTTPRequest::onConnect(const KResolverEntry&) { - payload = payload.replace("$LOCAL_IP",sock->localAddress().nodeName()); - hdr = hdr.replace("$CONTENT_LENGTH",QString::number(payload.length())); + payload = payload.tqreplace("$LOCAL_IP",sock->localAddress().nodeName()); + hdr = hdr.tqreplace("$CONTENT_LENGTH",TQString::number(payload.length())); - QString req = hdr + payload; + TQString req = hdr + payload; if (verbose) { Out(SYS_PNP|LOG_DEBUG) << "Sending " << endl; @@ -79,8 +79,8 @@ namespace bt Array<char> data(ba); ba = sock->readBlock(data,ba); - QString strdata((const char*)data); - QStringList sl = QStringList::split("\r\n",strdata,false); + TQString strdata((const char*)data); + TQStringList sl = TQStringList::split("\r\n",strdata,false); if (verbose) { @@ -88,7 +88,7 @@ namespace bt Out(SYS_PNP|LOG_DEBUG) << strdata << endl; } - if (sl.first().contains("HTTP") && sl.first().contains("200")) + if (sl.first().tqcontains("HTTP") && sl.first().tqcontains("200")) { // emit reply OK replyOK(this,sl.last()); @@ -103,7 +103,7 @@ namespace bt void HTTPRequest::onError(int) { - Out() << "HTTPRequest error : " << sock->errorString() << endl; + Out() << "HTTPRequest error : " << sock->KSocketBase::errorString() << endl; error(this,false); sock->close(); operationFinished(this); diff --git a/libktorrent/util/httprequest.h b/libktorrent/util/httprequest.h index 348a84e..524b3b2 100644 --- a/libktorrent/util/httprequest.h +++ b/libktorrent/util/httprequest.h @@ -20,7 +20,7 @@ #ifndef BTHTTPREQUEST_H #define BTHTTPREQUEST_H -#include <qobject.h> +#include <tqobject.h> #include <kurl.h> #include <kstreamsocket.h> #include <interfaces/exitoperation.h> @@ -41,6 +41,7 @@ namespace bt class HTTPRequest : public kt::ExitOperation { Q_OBJECT + TQ_OBJECT public: /** * Constructor, set the url and the request header. @@ -50,7 +51,7 @@ namespace bt * @param port THe port * @param verbose Print traffic to the log */ - HTTPRequest(const QString & hdr,const QString & payload,const QString & host, + HTTPRequest(const TQString & hdr,const TQString & payload,const TQString & host, Uint16 port,bool verbose); virtual ~HTTPRequest(); @@ -65,14 +66,14 @@ namespace bt * @param r The sender of the request * @param data The data of the reply */ - void replyOK(bt::HTTPRequest* r,const QString & data); + void replyOK(bt::HTTPRequest* r,const TQString & data); /** * Anything else but an 200 OK was sent. * @param r The sender of the request * @param data The data of the reply */ - void replyError(bt::HTTPRequest* r,const QString & data); + void replyError(bt::HTTPRequest* r,const TQString & data); /** * No reply was sent and an error or timeout occurred. @@ -89,7 +90,7 @@ namespace bt private: KNetwork::KStreamSocket* sock; - QString hdr,payload; + TQString hdr,payload; bool verbose; }; diff --git a/libktorrent/util/log.cpp b/libktorrent/util/log.cpp index 05682a8..6935a45 100644 --- a/libktorrent/util/log.cpp +++ b/libktorrent/util/log.cpp @@ -21,15 +21,15 @@ #include <kurl.h> #include <kprocess.h> #include <klocale.h> -#include <qdatetime.h> -#include <qtextstream.h> -#include <qfile.h> -#include <qptrlist.h> +#include <tqdatetime.h> +#include <tqtextstream.h> +#include <tqfile.h> +#include <tqptrlist.h> #include <iostream> #include <stdlib.h> #include <torrent/globals.h> #include <interfaces/logmonitorinterface.h> -#include <qmutex.h> +#include <tqmutex.h> #include <util/fileops.h> #include <stdlib.h> #include "log.h" @@ -45,19 +45,19 @@ namespace bt class Log::Private { public: - Log* parent; - QTextStream* out; - QFile fptr; + Log* tqparent; + TQTextStream* out; + TQFile fptr; bool to_cout; - QPtrList<LogMonitorInterface> monitors; - QString tmp; - QMutex mutex; + TQPtrList<LogMonitorInterface> monitors; + TQString tmp; + TQMutex mutex; unsigned int m_filter; AutoRotateLogJob* rotate_job; public: - Private(Log* parent) : parent(parent),out(0),to_cout(false),rotate_job(0) + Private(Log* tqparent) : tqparent(tqparent),out(0),to_cout(false),rotate_job(0) { - out = new QTextStream(); + out = new TQTextStream(); } ~Private() @@ -71,7 +71,7 @@ namespace bt m_filter = filter; } - void rotateLogs(const QString & file) + void rotateLogs(const TQString & file) { if (bt::Exists(file + "-10.gz")) bt::Delete(file + "-10.gz",true); @@ -79,18 +79,18 @@ namespace bt // move all log files one up for (Uint32 i = 10;i > 1;i--) { - QString prev = QString("%1-%2.gz").arg(file).arg(i - 1); - QString curr = QString("%1-%2.gz").arg(file).arg(i); + TQString prev = TQString("%1-%2.gz").tqarg(file).tqarg(i - 1); + TQString curr = TQString("%1-%2.gz").tqarg(file).tqarg(i); if (bt::Exists(prev)) bt::Move(prev,curr,true); } // move current log to 1 and zip it bt::Move(file,file + "-1",true); - system(QString("gzip " + KProcess::quote(file + "-1")).local8Bit()); + system(TQString("gzip " + KProcess::quote(file + "-1")).local8Bit()); } - void setOutputFile(const QString & file) + void setOutputFile(const TQString & file) { if (fptr.isOpen()) fptr.close(); @@ -100,12 +100,12 @@ namespace bt fptr.setName(file); if (!fptr.open(IO_WriteOnly)) - throw Error(i18n("Cannot open log file %1 : %2").arg(file).arg(fptr.errorString())); + throw Error(i18n("Cannot open log file %1 : %2").tqarg(file).tqarg(fptr.errorString())); - out->setDevice(&fptr); + out->setDevice(TQT_TQIODEVICE(&fptr)); } - void write(const QString & line) + void write(const TQString & line) { tmp += line; } @@ -116,14 +116,14 @@ namespace bt // this could result in the loss of some messages if (!rotate_job) { - *out << QDateTime::currentDateTime().toString() << ": " << tmp << ::endl; + *out << TQDateTime::tqcurrentDateTime().toString() << ": " << tmp << ::endl; fptr.flush(); if (to_cout) - std::cout << tmp.local8Bit() << std::endl; + std::cout << TQString(tmp.local8Bit()) << std::endl; if (monitors.count() > 0) { - QPtrList<LogMonitorInterface>::iterator i = monitors.begin(); + TQPtrList<LogMonitorInterface>::iterator i = monitors.begin(); while (i != monitors.end()) { kt::LogMonitorInterface* lmi = *i; @@ -142,18 +142,18 @@ namespace bt { tmp = "Log larger then 10 MB, rotating"; finishLine(); - QString file = fptr.name(); + TQString file = fptr.name(); fptr.close(); // close the log file out->setDevice(0); // start the rotate job - rotate_job = new AutoRotateLogJob(file,parent); + rotate_job = new AutoRotateLogJob(file,tqparent); } } void logRotateDone() { fptr.open(IO_WriteOnly); - out->setDevice(&fptr); + out->setDevice(TQT_TQIODEVICE(&fptr)); rotate_job = 0; } }; @@ -170,7 +170,7 @@ namespace bt } - void Log::setOutputFile(const QString & file) + void Log::setOutputFile(const TQString & file) { priv->setOutputFile(file); } @@ -203,7 +203,7 @@ namespace bt return *this; } - Log & Log::operator << (const QString & s) + Log & Log::operator << (const TQString & s) { priv->write(s); return *this; @@ -217,12 +217,12 @@ namespace bt Log & Log::operator << (Uint64 v) { - return operator << (QString::number(v)); + return operator << (TQString::number(v)); } Log & Log::operator << (Int64 v) { - return operator << (QString::number(v)); + return operator << (TQString::number(v)); } void Log::setFilter(unsigned int filter) diff --git a/libktorrent/util/log.h b/libktorrent/util/log.h index 2fe0ba6..742b753 100644 --- a/libktorrent/util/log.h +++ b/libktorrent/util/log.h @@ -23,7 +23,7 @@ #include "constants.h" -#include <qstring.h> +#include <tqstring.h> // LOG MESSAGES CONSTANTS #define LOG_NONE 0x00 @@ -115,18 +115,18 @@ namespace bt * @param file The name of the file * @throw Exception if the file can't be opened */ - void setOutputFile(const QString & file); + void setOutputFile(const TQString & file); /** * Write a number to the log file. - * Anything which can be passed to QString::number will do. + * Anything which can be passed to TQString::number will do. * @param val The value * @return This Log */ template <class T> Log & operator << (T val) { - return operator << (QString::number(val)); + return operator << (TQString::number(val)); } /** @@ -141,18 +141,18 @@ namespace bt /** - * Output a QString to the log. - * @param s The QString + * Output a TQString to the log. + * @param s The TQString * @return This Log */ Log & operator << (const char* s); /** - * Output a QString to the log. - * @param s The QString + * Output a TQString to the log. + * @param s The TQString * @return This Log */ - Log & operator << (const QString & s); + Log & operator << (const TQString & s); /** * Output a 64 bit integer to the log. diff --git a/libktorrent/util/mmapfile.cpp b/libktorrent/util/mmapfile.cpp index 579c67a..811acd7 100644 --- a/libktorrent/util/mmapfile.cpp +++ b/libktorrent/util/mmapfile.cpp @@ -29,7 +29,7 @@ #include <sys/mman.h> #include <sys/stat.h> #include <errno.h> -#include <qfile.h> +#include <tqfile.h> #include <kfileitem.h> #include <kio/netaccess.h> #include <klocale.h> @@ -51,20 +51,20 @@ namespace bt close(); } - bool MMapFile::open(const QString & file,Mode mode) + bool MMapFile::open(const TQString & file,Mode mode) { #if HAVE_STAT64 struct stat64 sb; - stat64(QFile::encodeName(file),&sb); + stat64(TQFile::encodeName(file),&sb); #else struct stat sb; - stat(QFile::encodeName(file),&sb); + stat(TQFile::encodeName(file),&sb); #endif return open(file,mode,(Uint64)sb.st_size); } - bool MMapFile::open(const QString & file,Mode mode,Uint64 size) + bool MMapFile::open(const TQString & file,Mode mode,Uint64 size) { // close already open file if (fd > 0) @@ -97,7 +97,7 @@ namespace bt #endif // open the file - fd = ::open(QFile::encodeName(file) , flag);//(int)flag); + fd = ::open(TQFile::encodeName(file) , flag);//(int)flag); if (fd == -1) return false; @@ -107,10 +107,10 @@ namespace bt #if HAVE_STAT64 struct stat64 sb; - stat64(QFile::encodeName(file),&sb); + stat64(TQFile::encodeName(file),&sb); #else struct stat sb; - stat(QFile::encodeName(file),&sb); + stat(TQFile::encodeName(file),&sb); #endif file_size = (Uint64)sb.st_size; filename = file; @@ -146,7 +146,7 @@ namespace bt ptr = size = 0; data = 0; fd = -1; - filename = QString::null; + filename = TQString(); } } @@ -274,7 +274,7 @@ namespace bt return ptr; } - QString MMapFile::errorString() const + TQString MMapFile::errorString() const { return strerror(errno); } diff --git a/libktorrent/util/mmapfile.h b/libktorrent/util/mmapfile.h index ca0d782..4d68fd2 100644 --- a/libktorrent/util/mmapfile.h +++ b/libktorrent/util/mmapfile.h @@ -21,7 +21,7 @@ #define BTMMAPFILE_H -#include <qstring.h> +#include <tqstring.h> #include <util/constants.h> namespace bt @@ -52,7 +52,7 @@ namespace bt * @param mode Mode (READ, WRITE or RW) * @return true upon succes */ - bool open(const QString & file,Mode mode); + bool open(const TQString & file,Mode mode); /** * Open the file. If mode is write and the file doesn't exist, it will @@ -62,7 +62,7 @@ namespace bt * @param size Size of the memory mapping (the file will be enlarged to this value) * @return true upon succes */ - bool open(const QString & file,Mode mode,Uint64 size); + bool open(const TQString & file,Mode mode,Uint64 size); /** * Close the file. Undoes the memory mapping. @@ -112,7 +112,7 @@ namespace bt Uint64 tell() const; /// Get the error string. - QString errorString() const; + TQString errorString() const; /// Get the file size Uint64 getSize() const; @@ -136,7 +136,7 @@ namespace bt Uint64 size; // size of mmapping Uint64 file_size; // size of file Uint64 ptr; - QString filename; + TQString filename; Mode mode; }; diff --git a/libktorrent/util/profiler.cpp b/libktorrent/util/profiler.cpp index 05c53bd..766012d 100644 --- a/libktorrent/util/profiler.cpp +++ b/libktorrent/util/profiler.cpp @@ -18,19 +18,19 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifdef KT_PROFILE -#include <qfile.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqtextstream.h> #include <sys/time.h> #include "profiler.h" namespace bt { - Profile::Profile(Profile* parent,const QString & name) : parent(parent),name(name) + Profile::Profile(Profile* tqparent,const TQString & name) : tqparent(tqparent),name(name) { min = max = avg = 0.0; count = 0; start_time = 0.0; - children.setAutoDelete(true); + tqchildren.setAutoDelete(true); } Profile::~Profile() @@ -61,10 +61,10 @@ namespace bt count++; } - Profile* Profile::child(const QString & name) + Profile* Profile::child(const TQString & name) { - QPtrList<Profile>::iterator i = children.begin(); - while (i != children.end()) + TQPtrList<Profile>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { Profile* p = *i; if (p->name == name) @@ -73,19 +73,19 @@ namespace bt } Profile* p = new Profile(this,name); - children.append(p); + tqchildren.append(p); return p; } - void Profile::save(QTextStream & out,const QString & base) + void Profile::save(TQTextStream & out,const TQString & base) { - QString nb = base + "/" + name; + TQString nb = base + "/" + name; out.precision(5); out << qSetW(60) << nb << qSetW(10) << min << qSetW(10) << max << qSetW(10) << avg << qSetW(10) << count << endl; - QPtrList<Profile>::iterator i = children.begin(); - while (i != children.end()) + TQPtrList<Profile>::iterator i = tqchildren.begin(); + while (i != tqchildren.end()) { Profile* p = *i; p->save(out,nb); @@ -109,7 +109,7 @@ namespace bt delete root; } - void Profiler::start(const QString & s) + void Profiler::start(const TQString & s) { curr = curr->child(s); curr->start(); @@ -121,18 +121,18 @@ namespace bt curr = curr->getParent(); } - void Profiler::saveToFile(const QString & fn) + void Profiler::saveToFile(const TQString & fn) { - QFile fptr(fn); + TQFile fptr(fn); if (!fptr.open(IO_WriteOnly)) return; - QTextStream out(&fptr); + TQTextStream out(&fptr); out << qSetW(60) << "code" << qSetW(10) << "min" << qSetW(10) << "max" << qSetW(10) << "avg" << qSetW(10) << "count" << endl; out << endl; - root->save(out,QString::null); + root->save(out,TQString()); } } #endif diff --git a/libktorrent/util/profiler.h b/libktorrent/util/profiler.h index 6ab06e7..836f4ba 100644 --- a/libktorrent/util/profiler.h +++ b/libktorrent/util/profiler.h @@ -21,10 +21,10 @@ #define BTPROFILER_H #ifdef KT_PROFILE -#include <qptrlist.h> +#include <tqptrlist.h> #include <util/constants.h> -class QTextStream; +class TQTextStream; namespace bt @@ -34,15 +34,15 @@ namespace bt */ class Profile { - Profile* parent; - QPtrList<Profile> children; + Profile* tqparent; + TQPtrList<Profile> tqchildren; - QString name; + TQString name; double min,max,avg; Uint32 count; double start_time; public: - Profile(Profile* parent,const QString & name); + Profile(Profile* tqparent,const TQString & name); virtual ~Profile(); /** @@ -60,19 +60,19 @@ namespace bt * @param name The name of the child * @return The child */ - Profile* child(const QString & name); + Profile* child(const TQString & name); /** - * Get the parent of the current profile. + * Get the tqparent of the current profile. */ - Profile* getParent() const {return parent;} + Profile* getParent() const {return tqparent;} /** * Save profile information to a file. * @param out Text stream to write to * @param base Base path of the profiles */ - void save(QTextStream & out,const QString & base); + void save(TQTextStream & out,const TQString & base); }; /** @@ -91,9 +91,9 @@ namespace bt public: virtual ~Profiler(); - void start(const QString & s); + void start(const TQString & s); void end(); - void saveToFile(const QString & fn); + void saveToFile(const TQString & fn); static Profiler & instance() {return inst;} }; diff --git a/libktorrent/util/ptrmap.h b/libktorrent/util/ptrmap.h index 36e1c20..9474db1 100644 --- a/libktorrent/util/ptrmap.h +++ b/libktorrent/util/ptrmap.h @@ -129,7 +129,7 @@ namespace bt * @param k The key * @return The data of the key, 0 if the key isn't in the map */ - Data* find(const Key & k) + Data* tqfind(const Key & k) { iterator i = pmap.find(k); return (i == pmap.end()) ? 0 : i->second; @@ -140,7 +140,7 @@ namespace bt * @param k The key * @return The data of the key, 0 if the key isn't in the map */ - const Data* find(const Key & k) const + const Data* tqfind(const Key & k) const { const_iterator i = pmap.find(k); return (i == pmap.end()) ? 0 : i->second; @@ -151,7 +151,7 @@ namespace bt * @param k The key * @return true if it is part of the map */ - bool contains(const Key & k) const + bool tqcontains(const Key & k) const { const_iterator i = pmap.find(k); return i != pmap.end(); diff --git a/libktorrent/util/sha1hash.cpp b/libktorrent/util/sha1hash.cpp index c7b151c..6cdbbc4 100644 --- a/libktorrent/util/sha1hash.cpp +++ b/libktorrent/util/sha1hash.cpp @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qurl.h> +#include <tqurl.h> #include <string.h> #include <algorithm> #include "log.h" @@ -72,10 +72,10 @@ namespace bt return hg.generate(data,len); } - QString SHA1Hash::toString() const + TQString SHA1Hash::toString() const { char tmp[41]; - QString fmt; + TQString fmt; for (int i = 0;i < 20;i++) fmt += "%02x"; tmp[40] = '\0'; @@ -84,17 +84,17 @@ namespace bt hash[5],hash[6],hash[7],hash[8],hash[9], hash[10],hash[11],hash[12],hash[13],hash[14], hash[15],hash[16],hash[17],hash[18],hash[19]); - return QString(tmp); + return TQString(tmp); } - QByteArray SHA1Hash::toByteArray() const + TQByteArray SHA1Hash::toByteArray() const { - QByteArray arr(20); + TQByteArray arr(20); arr.duplicate((const char*)hash,20); return arr; } - QString SHA1Hash::toURLString() const + TQString SHA1Hash::toURLString() const { return URLEncoder::encode((const char*)hash,20); } diff --git a/libktorrent/util/sha1hash.h b/libktorrent/util/sha1hash.h index a831d2d..dba66c9 100644 --- a/libktorrent/util/sha1hash.h +++ b/libktorrent/util/sha1hash.h @@ -20,10 +20,10 @@ #ifndef BTSHA1HASH_H #define BTSHA1HASH_H -#include <qcstring.h> +#include <tqcstring.h> #include "constants.h" -class QString; +class TQString; namespace bt { @@ -98,13 +98,13 @@ namespace bt * Convert the hash to a printable string. * @return The string */ - QString toString() const; + TQString toString() const; /** * Convert the hash to a string, usable in http get requests. * @return The string */ - QString toURLString() const; + TQString toURLString() const; /** * Directly get pointer to the data. @@ -140,7 +140,7 @@ namespace bt /** * Convert the hash to a byte array. */ - QByteArray toByteArray() const; + TQByteArray toByteArray() const; }; } diff --git a/libktorrent/util/timer.cpp b/libktorrent/util/timer.cpp index c06b728..a35ffc0 100644 --- a/libktorrent/util/timer.cpp +++ b/libktorrent/util/timer.cpp @@ -25,7 +25,7 @@ namespace bt Timer::Timer() : elapsed(0) { - last = QTime::currentTime(); + last = TQTime::currentTime(); } Timer::Timer(const Timer & t) : last(t.last),elapsed(t.elapsed) @@ -37,7 +37,7 @@ namespace bt void Timer::update() { - QTime now = QTime::currentTime(); + TQTime now = TQTime::currentTime(); int d = last.msecsTo(now); if (d < 0) @@ -48,7 +48,7 @@ namespace bt Uint32 Timer::getElapsedSinceUpdate() const { - QTime now = QTime::currentTime(); + TQTime now = TQTime::currentTime(); int d = last.msecsTo(now); if (d < 0) d = 0; diff --git a/libktorrent/util/timer.h b/libktorrent/util/timer.h index 3277185..edef755 100644 --- a/libktorrent/util/timer.h +++ b/libktorrent/util/timer.h @@ -20,7 +20,7 @@ #ifndef BTTIMER_H #define BTTIMER_H -#include <qdatetime.h> +#include <tqdatetime.h> #include "constants.h" namespace bt @@ -31,7 +31,7 @@ namespace bt */ class Timer { - QTime last; + TQTime last; Uint32 elapsed; public: Timer(); diff --git a/libktorrent/util/urlencoder.cpp b/libktorrent/util/urlencoder.cpp index c1776de..9d2b92b 100644 --- a/libktorrent/util/urlencoder.cpp +++ b/libktorrent/util/urlencoder.cpp @@ -22,7 +22,7 @@ namespace bt { - QString hex[] = { + TQString hex[] = { "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", @@ -58,9 +58,9 @@ namespace bt }; - QString URLEncoder::encode(const char* buf,Uint32 size) + TQString URLEncoder::encode(const char* buf,Uint32 size) { - QString res = ""; + TQString res = ""; for (Uint32 i = 0; i < size; i++) { diff --git a/libktorrent/util/urlencoder.h b/libktorrent/util/urlencoder.h index edac33a..c6fd3ec 100644 --- a/libktorrent/util/urlencoder.h +++ b/libktorrent/util/urlencoder.h @@ -20,7 +20,7 @@ #ifndef BTURLENCODER_H #define BTURLENCODER_H -#include <qstring.h> +#include <tqstring.h> #include "constants.h" namespace bt @@ -32,7 +32,7 @@ namespace bt class URLEncoder { public: - static QString encode(const char* buf,Uint32 size); + static TQString encode(const char* buf,Uint32 size); }; } diff --git a/libktorrent/util/waitjob.cpp b/libktorrent/util/waitjob.cpp index d11fa14..9fec771 100644 --- a/libktorrent/util/waitjob.cpp +++ b/libktorrent/util/waitjob.cpp @@ -27,7 +27,7 @@ namespace bt WaitJob::WaitJob(Uint32 millis) : KIO::Job(false) { - connect(&timer,SIGNAL(timeout()),this,SLOT(timerDone())); + connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(timerDone())); timer.start(millis,true); } @@ -51,8 +51,8 @@ namespace bt void WaitJob::addExitOperation(kt::ExitOperation* op) { exit_ops.append(op); - connect(op,SIGNAL(operationFinished( kt::ExitOperation* )), - this,SLOT(operationFinished( kt::ExitOperation* ))); + connect(op,TQT_SIGNAL(operationFinished( kt::ExitOperation* )), + this,TQT_SLOT(operationFinished( kt::ExitOperation* ))); } void WaitJob::operationFinished(kt::ExitOperation* op) diff --git a/libktorrent/util/waitjob.h b/libktorrent/util/waitjob.h index a85ba63..33b73f5 100644 --- a/libktorrent/util/waitjob.h +++ b/libktorrent/util/waitjob.h @@ -20,9 +20,9 @@ #ifndef BTWAITJOB_H #define BTWAITJOB_H -#include <qtimer.h> +#include <tqtimer.h> #include <kio/job.h> -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <interfaces/exitoperation.h> #include "constants.h" @@ -38,6 +38,7 @@ namespace bt class WaitJob : public KIO::Job { Q_OBJECT + TQ_OBJECT public: WaitJob(Uint32 millis); virtual ~WaitJob(); @@ -65,8 +66,8 @@ namespace bt void operationFinished(kt::ExitOperation* op); private: - QTimer timer; - QValueList<kt::ExitOperation*> exit_ops; + TQTimer timer; + TQValueList<kt::ExitOperation*> exit_ops; }; void SynchronousWait(Uint32 millis); |