summaryrefslogtreecommitdiffstats
path: root/libktorrent/torrent
diff options
context:
space:
mode:
Diffstat (limited to 'libktorrent/torrent')
-rw-r--r--libktorrent/torrent/advancedchokealgorithm.cpp2
-rw-r--r--libktorrent/torrent/announcelist.cpp22
-rw-r--r--libktorrent/torrent/announcelist.h6
-rw-r--r--libktorrent/torrent/authenticate.cpp2
-rw-r--r--libktorrent/torrent/authenticate.h7
-rw-r--r--libktorrent/torrent/authenticatebase.cpp2
-rw-r--r--libktorrent/torrent/authenticatebase.h11
-rw-r--r--libktorrent/torrent/bdecoder.cpp20
-rw-r--r--libktorrent/torrent/bdecoder.h6
-rw-r--r--libktorrent/torrent/bencoder.cpp18
-rw-r--r--libktorrent/torrent/bencoder.h12
-rw-r--r--libktorrent/torrent/bnode.cpp44
-rw-r--r--libktorrent/torrent/bnode.h28
-rw-r--r--libktorrent/torrent/cache.cpp4
-rw-r--r--libktorrent/torrent/cache.h20
-rw-r--r--libktorrent/torrent/cachefile.cpp72
-rw-r--r--libktorrent/torrent/cachefile.h16
-rw-r--r--libktorrent/torrent/cap.cpp2
-rw-r--r--libktorrent/torrent/cap.h4
-rw-r--r--libktorrent/torrent/choker.cpp4
-rw-r--r--libktorrent/torrent/choker.h6
-rw-r--r--libktorrent/torrent/chunk.cpp2
-rw-r--r--libktorrent/torrent/chunk.h14
-rw-r--r--libktorrent/torrent/chunkdownload.cpp68
-rw-r--r--libktorrent/torrent/chunkdownload.h19
-rw-r--r--libktorrent/torrent/chunkmanager.cpp88
-rw-r--r--libktorrent/torrent/chunkmanager.h38
-rw-r--r--libktorrent/torrent/chunkselector.cpp2
-rw-r--r--libktorrent/torrent/dndfile.cpp10
-rw-r--r--libktorrent/torrent/dndfile.h8
-rw-r--r--libktorrent/torrent/downloadcap.h2
-rw-r--r--libktorrent/torrent/downloader.cpp40
-rw-r--r--libktorrent/torrent/downloader.h13
-rw-r--r--libktorrent/torrent/globals.cpp2
-rw-r--r--libktorrent/torrent/globals.h4
-rw-r--r--libktorrent/torrent/httptracker.cpp46
-rw-r--r--libktorrent/torrent/httptracker.h7
-rw-r--r--libktorrent/torrent/ipblocklist.cpp138
-rw-r--r--libktorrent/torrent/ipblocklist.h48
-rw-r--r--libktorrent/torrent/movedatafilesjob.cpp16
-rw-r--r--libktorrent/torrent/movedatafilesjob.h9
-rw-r--r--libktorrent/torrent/multifilecache.cpp132
-rw-r--r--libktorrent/torrent/multifilecache.h20
-rw-r--r--libktorrent/torrent/oldchokealgorithm.cpp8
-rw-r--r--libktorrent/torrent/packet.cpp28
-rw-r--r--libktorrent/torrent/packet.h4
-rw-r--r--libktorrent/torrent/packetreader.cpp12
-rw-r--r--libktorrent/torrent/packetreader.h8
-rw-r--r--libktorrent/torrent/packetwriter.cpp32
-rw-r--r--libktorrent/torrent/packetwriter.h6
-rw-r--r--libktorrent/torrent/peer.cpp12
-rw-r--r--libktorrent/torrent/peer.h21
-rw-r--r--libktorrent/torrent/peerdownloader.cpp24
-rw-r--r--libktorrent/torrent/peerdownloader.h13
-rw-r--r--libktorrent/torrent/peerid.cpp60
-rw-r--r--libktorrent/torrent/peerid.h8
-rw-r--r--libktorrent/torrent/peermanager.cpp64
-rw-r--r--libktorrent/torrent/peermanager.h25
-rw-r--r--libktorrent/torrent/peersourcemanager.cpp86
-rw-r--r--libktorrent/torrent/peersourcemanager.h21
-rw-r--r--libktorrent/torrent/peeruploader.cpp6
-rw-r--r--libktorrent/torrent/peeruploader.h4
-rw-r--r--libktorrent/torrent/preallocationthread.cpp4
-rw-r--r--libktorrent/torrent/preallocationthread.h20
-rw-r--r--libktorrent/torrent/queuemanager.cpp64
-rw-r--r--libktorrent/torrent/queuemanager.h17
-rw-r--r--libktorrent/torrent/server.cpp14
-rw-r--r--libktorrent/torrent/server.h9
-rw-r--r--libktorrent/torrent/serverauthenticate.cpp2
-rw-r--r--libktorrent/torrent/serverauthenticate.h1
-rw-r--r--libktorrent/torrent/singlefilecache.cpp42
-rw-r--r--libktorrent/torrent/singlefilecache.h16
-rw-r--r--libktorrent/torrent/speedestimater.cpp12
-rw-r--r--libktorrent/torrent/statsfile.cpp32
-rw-r--r--libktorrent/torrent/statsfile.h40
-rw-r--r--libktorrent/torrent/torrent.cpp38
-rw-r--r--libktorrent/torrent/torrent.h22
-rw-r--r--libktorrent/torrent/torrentcontrol.cpp162
-rw-r--r--libktorrent/torrent/torrentcontrol.h75
-rw-r--r--libktorrent/torrent/torrentcreator.cpp94
-rw-r--r--libktorrent/torrent/torrentcreator.h24
-rw-r--r--libktorrent/torrent/torrentfile.cpp6
-rw-r--r--libktorrent/torrent/torrentfile.h5
-rw-r--r--libktorrent/torrent/tracker.cpp18
-rw-r--r--libktorrent/torrent/tracker.h9
-rw-r--r--libktorrent/torrent/udptracker.cpp34
-rw-r--r--libktorrent/torrent/udptracker.h13
-rw-r--r--libktorrent/torrent/udptrackersocket.cpp28
-rw-r--r--libktorrent/torrent/udptrackersocket.h21
-rw-r--r--libktorrent/torrent/uploader.h5
-rw-r--r--libktorrent/torrent/upspeedestimater.cpp6
-rw-r--r--libktorrent/torrent/upspeedestimater.h10
-rw-r--r--libktorrent/torrent/utpex.cpp16
-rw-r--r--libktorrent/torrent/value.cpp10
-rw-r--r--libktorrent/torrent/value.h14
95 files changed, 1190 insertions, 1169 deletions
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;
};
}