summaryrefslogtreecommitdiffstats
path: root/libktorrent/util
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-28 20:34:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-28 20:34:15 +0000
commit1c1403293485f35fd53db45aaa77a01cdd9627e7 (patch)
tree38559cd68cd4f63023fb5f6375def9db3b8b491e /libktorrent/util
parent894f94545727610df22c4f73911d62d58266f695 (diff)
downloadktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.tar.gz
ktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.zip
TQt4 port ktorrent
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1238733 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libktorrent/util')
-rw-r--r--libktorrent/util/autorotatelogjob.cpp12
-rw-r--r--libktorrent/util/autorotatelogjob.h5
-rw-r--r--libktorrent/util/constants.h18
-rw-r--r--libktorrent/util/error.cpp2
-rw-r--r--libktorrent/util/error.h8
-rw-r--r--libktorrent/util/file.cpp16
-rw-r--r--libktorrent/util/file.h8
-rw-r--r--libktorrent/util/fileops.cpp148
-rw-r--r--libktorrent/util/fileops.h28
-rw-r--r--libktorrent/util/functions.cpp22
-rw-r--r--libktorrent/util/functions.h10
-rw-r--r--libktorrent/util/httprequest.cpp30
-rw-r--r--libktorrent/util/httprequest.h11
-rw-r--r--libktorrent/util/log.cpp62
-rw-r--r--libktorrent/util/log.h18
-rw-r--r--libktorrent/util/mmapfile.cpp20
-rw-r--r--libktorrent/util/mmapfile.h10
-rw-r--r--libktorrent/util/profiler.cpp34
-rw-r--r--libktorrent/util/profiler.h24
-rw-r--r--libktorrent/util/ptrmap.h6
-rw-r--r--libktorrent/util/sha1hash.cpp14
-rw-r--r--libktorrent/util/sha1hash.h10
-rw-r--r--libktorrent/util/timer.cpp6
-rw-r--r--libktorrent/util/timer.h4
-rw-r--r--libktorrent/util/urlencoder.cpp6
-rw-r--r--libktorrent/util/urlencoder.h4
-rw-r--r--libktorrent/util/waitjob.cpp6
-rw-r--r--libktorrent/util/waitjob.h9
28 files changed, 277 insertions, 274 deletions
diff --git a/libktorrent/util/autorotatelogjob.cpp b/libktorrent/util/autorotatelogjob.cpp
index c43e304..d3a2d8a 100644
--- a/libktorrent/util/autorotatelogjob.cpp
+++ b/libktorrent/util/autorotatelogjob.cpp
@@ -26,7 +26,7 @@
namespace bt
{
- AutoRotateLogJob::AutoRotateLogJob(const QString & file,Log* lg)
+ AutoRotateLogJob::AutoRotateLogJob(const TQString & file,Log* lg)
: KIO::Job(false),file(file),cnt(10),lg(lg)
{
update();
@@ -46,12 +46,12 @@ namespace bt
{
while (cnt > 1)
{
- QString prev = QString("%1-%2.gz").arg(file).arg(cnt - 1);
- QString curr = QString("%1-%2.gz").arg(file).arg(cnt);
+ TQString prev = TQString("%1-%2.gz").tqarg(file).tqarg(cnt - 1);
+ TQString curr = TQString("%1-%2.gz").tqarg(file).tqarg(cnt);
if (bt::Exists(prev)) // if file exists start the move job
{
KIO::Job* sj = KIO::file_move(KURL::fromPathOrURL(prev),KURL::fromPathOrURL(curr),-1,true,false,false);
- connect(sj,SIGNAL(result(KIO::Job*)),this,SLOT(moveJobDone(KIO::Job* )));
+ connect(sj,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(moveJobDone(KIO::Job* )));
return;
}
else
@@ -65,12 +65,12 @@ namespace bt
// move current log to 1 and zip it
bt::Move(file,file + "-1",true);
KIO::Job* sj = KIO::file_move(KURL::fromPathOrURL(file),KURL::fromPathOrURL(file + "-1"),-1,true,false,false);
- connect(sj,SIGNAL(result(KIO::Job*)),this,SLOT(moveJobDone(KIO::Job* )));
+ connect(sj,TQT_SIGNAL(result(KIO::Job*)),this,TQT_SLOT(moveJobDone(KIO::Job* )));
}
else
{
// final log file is moved, now zip it and end the job
- std::system(QString("gzip " + KProcess::quote(file + "-1")).local8Bit());
+ std::system(TQString("gzip " + KProcess::quote(file + "-1")).local8Bit());
m_error = 0;
lg->logRotateDone();
emitResult();
diff --git a/libktorrent/util/autorotatelogjob.h b/libktorrent/util/autorotatelogjob.h
index 11cf06a..ae850b3 100644
--- a/libktorrent/util/autorotatelogjob.h
+++ b/libktorrent/util/autorotatelogjob.h
@@ -36,8 +36,9 @@ namespace bt
class AutoRotateLogJob : public KIO::Job
{
Q_OBJECT
+ TQ_OBJECT
public:
- AutoRotateLogJob(const QString & file,Log* lg);
+ AutoRotateLogJob(const TQString & file,Log* lg);
virtual ~AutoRotateLogJob();
virtual void kill(bool quietly=true);
@@ -49,7 +50,7 @@ namespace bt
void update();
private:
- QString file;
+ TQString file;
int cnt;
Log* lg;
};
diff --git a/libktorrent/util/constants.h b/libktorrent/util/constants.h
index e663978..0551f60 100644
--- a/libktorrent/util/constants.h
+++ b/libktorrent/util/constants.h
@@ -20,19 +20,19 @@
#ifndef BTCONSTANTS_H
#define BTCONSTANTS_H
-#include <qglobal.h>
+#include <tqglobal.h>
namespace bt
{
- typedef Q_UINT64 Uint64;
- typedef Q_UINT32 Uint32;
- typedef Q_UINT16 Uint16;
- typedef Q_UINT8 Uint8;
+ typedef TQ_UINT64 Uint64;
+ typedef TQ_UINT32 Uint32;
+ typedef TQ_UINT16 Uint16;
+ typedef TQ_UINT8 Uint8;
- typedef Q_INT64 Int64;
- typedef Q_INT32 Int32;
- typedef Q_INT16 Int16;
- typedef Q_INT8 Int8;
+ typedef TQ_INT64 Int64;
+ typedef TQ_INT32 Int32;
+ typedef TQ_INT16 Int16;
+ typedef TQ_INT8 Int8;
typedef Uint64 TimeStamp;
diff --git a/libktorrent/util/error.cpp b/libktorrent/util/error.cpp
index bb981db..dd3e15d 100644
--- a/libktorrent/util/error.cpp
+++ b/libktorrent/util/error.cpp
@@ -22,7 +22,7 @@
namespace bt
{
- Error::Error(const QString & msg) : msg(msg)
+ Error::Error(const TQString & msg) : msg(msg)
{}
diff --git a/libktorrent/util/error.h b/libktorrent/util/error.h
index 8b089e4..49aa95d 100644
--- a/libktorrent/util/error.h
+++ b/libktorrent/util/error.h
@@ -20,7 +20,7 @@
#ifndef BTERROR_H
#define BTERROR_H
-#include <qstring.h>
+#include <tqstring.h>
namespace bt
{
@@ -30,12 +30,12 @@ namespace bt
*/
class Error
{
- QString msg;
+ TQString msg;
public:
- Error(const QString & msg);
+ Error(const TQString & msg);
virtual ~Error();
- QString toString() const {return msg;}
+ TQString toString() const {return msg;}
};
diff --git a/libktorrent/util/file.cpp b/libktorrent/util/file.cpp
index b898e07..f757142 100644
--- a/libktorrent/util/file.cpp
+++ b/libktorrent/util/file.cpp
@@ -22,7 +22,7 @@
#include <config.h>
#endif
-#include <qfile.h>
+#include <tqfile.h>
#include "config.h"
#include <klocale.h>
#include <string.h>
@@ -45,15 +45,15 @@ namespace bt
close();
}
- bool File::open(const QString & file,const QString & mode)
+ bool File::open(const TQString & file,const TQString & mode)
{
this->file = file;
if (fptr)
close();
#if HAVE_FOPEN64
- fptr = fopen64(QFile::encodeName(file),mode.ascii());
+ fptr = fopen64(TQFile::encodeName(file),mode.ascii());
#else
- fptr = fopen(QFile::encodeName(file),mode.ascii());
+ fptr = fopen(TQFile::encodeName(file),mode.ascii());
#endif
return fptr != 0;
}
@@ -84,7 +84,7 @@ namespace bt
if (errno == ENOSPC)
Out() << "Disk full !" << endl;
- throw Error(i18n("Cannot write to %1 : %2").arg(file).arg(strerror(errno)));
+ throw Error(i18n("Cannot write to %1 : %2").tqarg(file).tqarg(strerror(errno)));
}
return ret;
}
@@ -98,7 +98,7 @@ namespace bt
if (ferror(fptr))
{
clearerr(fptr);
- throw Error(i18n("Cannot read from %1").arg(file));
+ throw Error(i18n("Cannot read from %1").tqarg(file));
}
return ret;
}
@@ -143,8 +143,8 @@ namespace bt
return ftello(fptr);
}
- QString File::errorString() const
+ TQString File::errorString() const
{
- return QString(strerror(errno));
+ return TQString(strerror(errno));
}
}
diff --git a/libktorrent/util/file.h b/libktorrent/util/file.h
index 323a3a7..c6567f8 100644
--- a/libktorrent/util/file.h
+++ b/libktorrent/util/file.h
@@ -21,7 +21,7 @@
#define BTFILE_H
#include <stdio.h>
-#include <qstring.h>
+#include <tqstring.h>
#include "constants.h"
namespace bt
@@ -36,7 +36,7 @@ namespace bt
class File
{
FILE* fptr;
- QString file;
+ TQString file;
public:
/**
* Constructor.
@@ -54,7 +54,7 @@ namespace bt
* @param mode Mode
* @return true upon succes
*/
- bool open(const QString & file,const QString & mode);
+ bool open(const TQString & file,const TQString & mode);
/**
* Close the file.
@@ -106,7 +106,7 @@ namespace bt
Uint64 tell() const;
/// Get the error string.
- QString errorString() const;
+ TQString errorString() const;
};
}
diff --git a/libktorrent/util/fileops.cpp b/libktorrent/util/fileops.cpp
index 3fcf03d..a83134a 100644
--- a/libktorrent/util/fileops.cpp
+++ b/libktorrent/util/fileops.cpp
@@ -30,9 +30,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
-#include <qdir.h>
-#include <qfile.h>
-#include <qstringlist.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqstringlist.h>
#include "fileops.h"
#include "error.h"
#include "log.h"
@@ -70,88 +70,88 @@ typedef int64_t __s64;
namespace bt
{
- void MakeDir(const QString & dir,bool nothrow)
+ void MakeDir(const TQString & dir,bool nothrow)
{
- if (mkdir(QFile::encodeName(dir),0777) < -1)
+ if (mkdir(TQFile::encodeName(dir),0777) < -1)
{
if (!nothrow)
throw Error(i18n("Cannot create directory %1: %2")
- .arg(dir).arg(strerror(errno)));
+ .tqarg(dir).tqarg(strerror(errno)));
else
{
- Out() << QString("Error : Cannot create directory %1 : %2").arg(dir).arg(strerror(errno))<< endl;
+ Out() << TQString("Error : Cannot create directory %1 : %2").tqarg(dir).tqarg(strerror(errno))<< endl;
}
}
}
- void SymLink(const QString & link_to,const QString & link_url,bool nothrow)
+ void SymLink(const TQString & link_to,const TQString & link_url,bool nothrow)
{
- if (symlink(QFile::encodeName(link_to),QFile::encodeName(link_url)) != 0)
+ if (symlink(TQFile::encodeName(link_to),TQFile::encodeName(link_url)) != 0)
{
if (!nothrow)
throw Error(i18n("Cannot symlink %1 to %2: %3")
- .arg(link_url.utf8()).arg(link_to.utf8())
- .arg(strerror(errno)));
+ .tqarg(link_url.utf8().data()).tqarg(link_to.utf8().data())
+ .tqarg(strerror(errno)));
else
- Out() << QString("Error : Cannot symlink %1 to %2: %3")
- .arg(link_url.utf8()).arg(link_to.utf8())
- .arg(strerror(errno)) << endl;
+ Out() << TQString("Error : Cannot symlink %1 to %2: %3")
+ .tqarg(link_url.utf8().data()).tqarg(link_to.utf8().data())
+ .tqarg(strerror(errno)) << endl;
}
}
- void Move(const QString & src,const QString & dst,bool nothrow)
+ void Move(const TQString & src,const TQString & dst,bool nothrow)
{
// Out() << "Moving " << src << " -> " << dst << endl;
if (!KIO::NetAccess::move(KURL::fromPathOrURL(src),KURL::fromPathOrURL(dst),0))
{
if (!nothrow)
throw Error(i18n("Cannot move %1 to %2: %3")
- .arg(src).arg(dst)
- .arg(KIO::NetAccess::lastErrorString()));
+ .tqarg(src).tqarg(dst)
+ .tqarg(KIO::NetAccess::lastErrorString()));
else
- Out() << QString("Error : Cannot move %1 to %2: %3")
- .arg(src).arg(dst)
- .arg(KIO::NetAccess::lastErrorString()) << endl;
+ Out() << TQString("Error : Cannot move %1 to %2: %3")
+ .tqarg(src).tqarg(dst)
+ .tqarg(KIO::NetAccess::lastErrorString()) << endl;
}
}
- void CopyFile(const QString & src,const QString & dst,bool nothrow)
+ void CopyFile(const TQString & src,const TQString & dst,bool nothrow)
{
if (!KIO::NetAccess::file_copy(KURL::fromPathOrURL(src),KURL::fromPathOrURL(dst)))
{
if (!nothrow)
throw Error(i18n("Cannot copy %1 to %2: %3")
- .arg(src).arg(dst)
- .arg(KIO::NetAccess::lastErrorString()));
+ .tqarg(src).tqarg(dst)
+ .tqarg(KIO::NetAccess::lastErrorString()));
else
- Out() << QString("Error : Cannot copy %1 to %2: %3")
- .arg(src).arg(dst)
- .arg(KIO::NetAccess::lastErrorString()) << endl;
+ Out() << TQString("Error : Cannot copy %1 to %2: %3")
+ .tqarg(src).tqarg(dst)
+ .tqarg(KIO::NetAccess::lastErrorString()) << endl;
}
}
- void CopyDir(const QString & src,const QString & dst,bool nothrow)
+ void CopyDir(const TQString & src,const TQString & dst,bool nothrow)
{
if (!KIO::NetAccess::dircopy(KURL::fromPathOrURL(src),KURL::fromPathOrURL(dst),0))
{
if (!nothrow)
throw Error(i18n("Cannot copy %1 to %2: %3")
- .arg(src).arg(dst)
- .arg(KIO::NetAccess::lastErrorString()));
+ .tqarg(src).tqarg(dst)
+ .tqarg(KIO::NetAccess::lastErrorString()));
else
- Out() << QString("Error : Cannot copy %1 to %2: %3")
- .arg(src).arg(dst)
- .arg(KIO::NetAccess::lastErrorString()) << endl;
+ Out() << TQString("Error : Cannot copy %1 to %2: %3")
+ .tqarg(src).tqarg(dst)
+ .tqarg(KIO::NetAccess::lastErrorString()) << endl;
}
}
- bool Exists(const QString & url)
+ bool Exists(const TQString & url)
{
// Out() << "Testing if " << url << " exists " << endl;
- if (access(QFile::encodeName(url),F_OK) < 0)
+ if (access(TQFile::encodeName(url),F_OK) < 0)
{
// Out() << "No " << endl;
return false;
@@ -163,14 +163,14 @@ namespace bt
}
}
- static bool DelDir(const QString & fn)
+ static bool DelDir(const TQString & fn)
{
- QDir d(fn);
- QStringList subdirs = d.entryList(QDir::Dirs);
+ TQDir d(fn);
+ TQStringList subdirs = d.entryList(TQDir::Dirs);
- for (QStringList::iterator i = subdirs.begin(); i != subdirs.end();i++)
+ for (TQStringList::iterator i = subdirs.begin(); i != subdirs.end();i++)
{
- QString entry = *i;
+ TQString entry = *i;
if (entry == ".." || entry == ".")
continue;
@@ -182,12 +182,12 @@ namespace bt
}
}
- QStringList files = d.entryList(QDir::Files | QDir::System | QDir::Hidden);
- for (QStringList::iterator i = files.begin(); i != files.end();i++)
+ TQStringList files = d.entryList(TQDir::Files | TQDir::System | TQDir::Hidden);
+ for (TQStringList::iterator i = files.begin(); i != files.end();i++)
{
- QString entry = *i;
+ TQString entry = *i;
- if (remove(QFile::encodeName(d.absFilePath(entry))) < 0)
+ if (remove(TQFile::encodeName(d.absFilePath(entry))) < 0)
{
Out(SYS_GEN|LOG_DEBUG) << "Delete of " << fn << "/" << entry << " failed !" << endl;
return false;
@@ -203,9 +203,9 @@ namespace bt
return true;
}
- void Delete(const QString & url,bool nothrow)
+ void Delete(const TQString & url,bool nothrow)
{
- QCString fn = QFile::encodeName(url);
+ TQCString fn = TQFile::encodeName(url);
#if HAVE_STAT64
struct stat64 statbuf;
if (lstat64(fn, &statbuf) < 0)
@@ -229,9 +229,9 @@ namespace bt
if (!ok)
{
- QString err = i18n("Cannot delete %1: %2")
- .arg(url)
- .arg(strerror(errno));
+ TQString err = i18n("Cannot delete %1: %2")
+ .tqarg(url)
+ .tqarg(strerror(errno));
if (!nothrow)
throw Error(err);
else
@@ -239,7 +239,7 @@ namespace bt
}
}
- void Touch(const QString & url,bool nothrow)
+ void Touch(const TQString & url,bool nothrow)
{
if (Exists(url))
return;
@@ -249,8 +249,8 @@ namespace bt
{
if (!nothrow)
throw Error(i18n("Cannot create %1: %2")
- .arg(url)
- .arg(fptr.errorString()));
+ .tqarg(url)
+ .tqarg(fptr.errorString()));
else
Out() << "Error : Cannot create " << url << " : "
<< fptr.errorString() << endl;
@@ -258,19 +258,19 @@ namespace bt
}
}
- Uint64 FileSize(const QString & url)
+ Uint64 FileSize(const TQString & url)
{
int ret = 0;
#if HAVE_STAT64
struct stat64 sb;
- ret = stat64(QFile::encodeName(url),&sb);
+ ret = stat64(TQFile::encodeName(url),&sb);
#else
struct stat sb;
- ret = stat(QFile::encodeName(url),&sb);
+ ret = stat(TQFile::encodeName(url),&sb);
#endif
if (ret < 0)
throw Error(i18n("Cannot calculate the filesize of %1: %2")
- .arg(url).arg(strerror(errno)));
+ .tqarg(url).tqarg(strerror(errno)));
return (Uint64)sb.st_size;
}
@@ -286,7 +286,7 @@ namespace bt
ret = fstat(fd,&sb);
#endif
if (ret < 0)
- throw Error(i18n("Cannot calculate the filesize : %2").arg(strerror(errno)));
+ throw Error(i18n("Cannot calculate the filesize : %2").tqarg(strerror(errno)));
return (Uint64)sb.st_size;
}
@@ -310,11 +310,11 @@ namespace bt
return true;
}
- bool FatPreallocate(const QString & path,Uint64 size)
+ bool FatPreallocate(const TQString & path,Uint64 size)
{
- int fd = ::open(QFile::encodeName(path),O_RDWR | O_LARGEFILE);
+ int fd = ::open(TQFile::encodeName(path),O_RDWR | O_LARGEFILE);
if (fd < 0)
- throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno)));
+ throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno)));
bool ret = FatPreallocate(fd,size);
close(fd);
@@ -339,11 +339,11 @@ namespace bt
}
- bool XfsPreallocate(const QString & path, Uint64 size)
+ bool XfsPreallocate(const TQString & path, Uint64 size)
{
- int fd = ::open(QFile::encodeName(path), O_RDWR | O_LARGEFILE);
+ int fd = ::open(TQFile::encodeName(path), O_RDWR | O_LARGEFILE);
if (fd < 0)
- throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno)));
+ throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno)));
bool ret = XfsPreallocate(fd,size);
close(fd);
@@ -364,16 +364,16 @@ namespace bt
#else
if (ftruncate(fd,size) == -1)
#endif
- throw Error(i18n("Cannot expand file : %1").arg(strerror(errno)));
+ throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno)));
}
else
{
#if HAVE_POSIX_FALLOCATE64
if (posix_fallocate64(fd,0,size) != 0)
- throw Error(i18n("Cannot expand file : %1").arg(strerror(errno)));
+ throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno)));
#elif HAVE_POSIX_FALLOCATE
if (posix_fallocate(fd,0,size) != 0)
- throw Error(i18n("Cannot expand file : %1").arg(strerror(errno)));
+ throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno)));
#else
SeekFile(fd,0,SEEK_SET);
bt::Array<Uint8> buf(4096);
@@ -388,9 +388,9 @@ namespace bt
int ret = write(fd,buf,to_write);
if (ret < 0)
- throw Error(i18n("Cannot expand file : %1").arg(strerror(errno)));
+ throw Error(i18n("Cannot expand file : %1").tqarg(strerror(errno)));
else if (ret == 0 || ret != (int)to_write)
- throw Error(i18n("Cannot expand file").arg(strerror(errno)));
+ throw Error(i18n("Cannot expand file").tqarg(strerror(errno)));
else
written += to_write;
}
@@ -398,11 +398,11 @@ namespace bt
}
}
- void TruncateFile(const QString & path,Uint64 size)
+ void TruncateFile(const TQString & path,Uint64 size)
{
- int fd = ::open(QFile::encodeName(path),O_RDWR | O_LARGEFILE);
+ int fd = ::open(TQFile::encodeName(path),O_RDWR | O_LARGEFILE);
if (fd < 0)
- throw Error(i18n("Cannot open %1 : %2").arg(path).arg(strerror(errno)));
+ throw Error(i18n("Cannot open %1 : %2").tqarg(path).tqarg(strerror(errno)));
try
{
@@ -423,10 +423,10 @@ namespace bt
#else
if (lseek(fd,off,whence) == -1)
#endif
- throw Error(i18n("Cannot seek in file : %1").arg(strerror(errno)));
+ throw Error(i18n("Cannot seek in file : %1").tqarg(strerror(errno)));
}
- bool FreeDiskSpace(const QString & path,Uint64 & bytes_free)
+ bool FreeDiskSpace(const TQString & path,Uint64 & bytes_free)
{
#if HAVE_STATVFS
#if HAVE_STATVFS64
@@ -443,7 +443,7 @@ namespace bt
else
{
Out(SYS_GEN|LOG_DEBUG) << "Error : statvfs for " << path << " failed : "
- << QString(strerror(errno)) << endl;
+ << TQString(strerror(errno)) << endl;
return false;
}
@@ -457,7 +457,7 @@ namespace bt
else
{
Out(SYS_GEN|LOG_DEBUG) << "Error : statfs for " << path << " failed : "
- << QString(strerror(errno)) << endl;
+ << TQString(strerror(errno)) << endl;
return false;
}
diff --git a/libktorrent/util/fileops.h b/libktorrent/util/fileops.h
index 253ee96..067bd03 100644
--- a/libktorrent/util/fileops.h
+++ b/libktorrent/util/fileops.h
@@ -25,7 +25,7 @@
#endif
#include <util/constants.h>
-class QString;
+class TQString;
namespace bt
{
@@ -37,7 +37,7 @@ namespace bt
* @param nothrow wether or not we shouldn't throw an Error upon failure
* @throw Error upon error
*/
- void MakeDir(const QString & dir,bool nothrow = false);
+ void MakeDir(const TQString & dir,bool nothrow = false);
/**
* Create a symbolic link @a link_url which links to @a link_to
@@ -45,7 +45,7 @@ namespace bt
* @param link_url The link url
* @param nothrow wether or not we shouldn't throw an Error upon failure
*/
- void SymLink(const QString & link_to,const QString & link_url,bool nothrow = false);
+ void SymLink(const TQString & link_to,const TQString & link_url,bool nothrow = false);
/**
* Move a file/dir from one location to another
@@ -53,7 +53,7 @@ namespace bt
* @param dst The destination file / directory
* @param nothrow wether or not we shouldn't throw an Error upon failure
*/
- void Move(const QString & src,const QString & dst,bool nothrow = false);
+ void Move(const TQString & src,const TQString & dst,bool nothrow = false);
/**
* Copy a file.
@@ -61,7 +61,7 @@ namespace bt
* @param dst The destination dir/file
* @param nothrow wether or not we shouldn't throw an Error upon failure
*/
- void CopyFile(const QString & src,const QString & dst,bool nothrow = false);
+ void CopyFile(const TQString & src,const TQString & dst,bool nothrow = false);
/**
* Copy a file or directory
@@ -69,21 +69,21 @@ namespace bt
* @param dst The destination dir/file
* @param nothrow wether or not we shouldn't throw an Error upon failure
*/
- void CopyDir(const QString & src,const QString & dst,bool nothrow = false);
+ void CopyDir(const TQString & src,const TQString & dst,bool nothrow = false);
/**
* Check wether a file/dir exists
* @param url The file/dir
* @return true if it exits
*/
- bool Exists(const QString & url);
+ bool Exists(const TQString & url);
/**
* Delete a file or directory.
* @param url The url of the file/dir
* @param nothrow wether or not we shouldn't throw an Error upon failure
*/
- void Delete(const QString & url,bool nothrow = false);
+ void Delete(const TQString & url,bool nothrow = false);
/**
* Try to create a file. Doesn't do anything if the file
@@ -91,7 +91,7 @@ namespace bt
* @param url The url of the file
* @param nothrow wether or not we shouldn't throw an Error upon failure
*/
- void Touch(const QString & url,bool nothrow = false);
+ void Touch(const TQString & url,bool nothrow = false);
/**
* Calculates the size of a file
@@ -99,7 +99,7 @@ namespace bt
* @return The size of the file
* @throw Error if the file doesn't exist, or something else goes wrong
*/
- Uint64 FileSize(const QString & url);
+ Uint64 FileSize(const TQString & url);
/**
* Get the size of a file.
@@ -124,7 +124,7 @@ namespace bt
* @param quick Use the quick way (doesn't prevent fragmentationt)
* @throw Error if the file doesn't exist, or something else goes wrong
*/
- void TruncateFile(const QString & path,Uint64 size);
+ void TruncateFile(const TQString & path,Uint64 size);
/**
* Special truncate for FAT file systems.
@@ -134,7 +134,7 @@ namespace bt
/**
* Special truncate for FAT file systems.
*/
- bool FatPreallocate(const QString & path,Uint64 size);
+ bool FatPreallocate(const TQString & path,Uint64 size);
#ifdef HAVE_XFS_XFS_H
/**
@@ -145,7 +145,7 @@ namespace bt
/**
* Special truncate for XFS file systems.
*/
- bool XfsPreallocate(const QString & path,Uint64 size);
+ bool XfsPreallocate(const TQString & path,Uint64 size);
#endif
@@ -159,7 +159,7 @@ namespace bt
void SeekFile(int fd,Int64 off,int whence);
/// Calculate the number of bytes free on the filesystem path is located
- bool FreeDiskSpace(const QString & path,Uint64 & bytes_free);
+ bool FreeDiskSpace(const TQString & path,Uint64 & bytes_free);
}
#endif
diff --git a/libktorrent/util/functions.cpp b/libktorrent/util/functions.cpp
index 744bf43..3c73f36 100644
--- a/libktorrent/util/functions.cpp
+++ b/libktorrent/util/functions.cpp
@@ -17,8 +17,8 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qdir.h>
-#include <qhostaddress.h>
+#include <tqdir.h>
+#include <tqhostaddress.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -39,17 +39,17 @@
namespace bt
{
- bool IsMultimediaFile(const QString & filename)
+ bool IsMultimediaFile(const TQString & filename)
{
KMimeType::Ptr ptr = KMimeType::findByPath(filename);
- QString name = ptr->name();
+ TQString name = ptr->name();
return name.startsWith("audio") || name.startsWith("video") || name == "application/ogg";
}
- QHostAddress LookUpHost(const QString & host)
+ TQHostAddress LookUpHost(const TQString & host)
{
struct hostent * he = gethostbyname(host.ascii());
- QHostAddress addr;
+ TQHostAddress addr;
if (he)
{
addr.setAddress(inet_ntoa(*((struct in_addr *)he->h_addr)));
@@ -57,10 +57,10 @@ namespace bt
return addr;
}
- QString DirSeparator()
+ TQString DirSeparator()
{
- QString tmp;
- tmp.append(QDir::separator());
+ TQString tmp;
+ tmp.append(TQDir::separator());
return tmp;
}
@@ -203,7 +203,7 @@ namespace bt
if (setrlimit(RLIMIT_NOFILE,&lim) < 0)
{
Out(SYS_GEN|LOG_DEBUG) << "Failed to maximize file limit : "
- << QString(strerror(errno)) << endl;
+ << TQString(strerror(errno)) << endl;
return false;
}
}
@@ -221,7 +221,7 @@ namespace bt
if (setrlimit(RLIMIT_DATA,&lim) < 0)
{
Out(SYS_GEN|LOG_DEBUG) << "Failed to maximize data limit : "
- << QString(strerror(errno)) << endl;
+ << TQString(strerror(errno)) << endl;
return false;
}
}
diff --git a/libktorrent/util/functions.h b/libktorrent/util/functions.h
index 4ace51b..9295b83 100644
--- a/libktorrent/util/functions.h
+++ b/libktorrent/util/functions.h
@@ -22,8 +22,8 @@
#include "constants.h"
-class QString;
-class QHostAddress;
+class TQString;
+class TQHostAddress;
class KURL;
namespace bt
@@ -56,9 +56,9 @@ namespace bt
TimeStamp Now();
- QHostAddress LookUpHost(const QString & host);
- QString DirSeparator();
- bool IsMultimediaFile(const QString & filename);
+ TQHostAddress LookUpHost(const TQString & host);
+ TQString DirSeparator();
+ bool IsMultimediaFile(const TQString & filename);
/**
* Maximize the file and memory limits using setrlimit.
diff --git a/libktorrent/util/httprequest.cpp b/libktorrent/util/httprequest.cpp
index d0652bc..ed7d980 100644
--- a/libktorrent/util/httprequest.cpp
+++ b/libktorrent/util/httprequest.cpp
@@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qstringlist.h>
+#include <tqstringlist.h>
#include <torrent/globals.h>
#include "httprequest.h"
#include "array.h"
@@ -27,18 +27,18 @@
namespace bt
{
- HTTPRequest::HTTPRequest(const QString & hdr,const QString & payload,const QString & host,Uint16 port,bool verbose) : hdr(hdr),payload(payload),verbose(verbose)
+ HTTPRequest::HTTPRequest(const TQString & hdr,const TQString & payload,const TQString & host,Uint16 port,bool verbose) : hdr(hdr),payload(payload),verbose(verbose)
{
- sock = new KNetwork::KStreamSocket(host,QString::number(port),this,0);
+ sock = new KNetwork::KStreamSocket(host,TQString::number(port),this,0);
sock->enableRead(true);
sock->enableWrite(true);
sock->setTimeout(30000);
sock->setBlocking(false);
- connect(sock,SIGNAL(readyRead()),this,SLOT(onReadyRead()));
- connect(sock,SIGNAL(gotError(int)),this,SLOT(onError(int )));
- connect(sock,SIGNAL(timedOut()),this,SLOT(onTimeout()));
- connect(sock,SIGNAL(connected(const KResolverEntry&)),
- this, SLOT(onConnect( const KResolverEntry& )));
+ connect(sock,TQT_SIGNAL(readyRead()),this,TQT_SLOT(onReadyRead()));
+ connect(sock,TQT_SIGNAL(gotError(int)),this,TQT_SLOT(onError(int )));
+ connect(sock,TQT_SIGNAL(timedOut()),this,TQT_SLOT(onTimeout()));
+ connect(sock,TQT_SIGNAL(connected(const KResolverEntry&)),
+ this, TQT_SLOT(onConnect( const KResolverEntry& )));
}
@@ -55,10 +55,10 @@ namespace bt
void HTTPRequest::onConnect(const KResolverEntry&)
{
- payload = payload.replace("$LOCAL_IP",sock->localAddress().nodeName());
- hdr = hdr.replace("$CONTENT_LENGTH",QString::number(payload.length()));
+ payload = payload.tqreplace("$LOCAL_IP",sock->localAddress().nodeName());
+ hdr = hdr.tqreplace("$CONTENT_LENGTH",TQString::number(payload.length()));
- QString req = hdr + payload;
+ TQString req = hdr + payload;
if (verbose)
{
Out(SYS_PNP|LOG_DEBUG) << "Sending " << endl;
@@ -79,8 +79,8 @@ namespace bt
Array<char> data(ba);
ba = sock->readBlock(data,ba);
- QString strdata((const char*)data);
- QStringList sl = QStringList::split("\r\n",strdata,false);
+ TQString strdata((const char*)data);
+ TQStringList sl = TQStringList::split("\r\n",strdata,false);
if (verbose)
{
@@ -88,7 +88,7 @@ namespace bt
Out(SYS_PNP|LOG_DEBUG) << strdata << endl;
}
- if (sl.first().contains("HTTP") && sl.first().contains("200"))
+ if (sl.first().tqcontains("HTTP") && sl.first().tqcontains("200"))
{
// emit reply OK
replyOK(this,sl.last());
@@ -103,7 +103,7 @@ namespace bt
void HTTPRequest::onError(int)
{
- Out() << "HTTPRequest error : " << sock->errorString() << endl;
+ Out() << "HTTPRequest error : " << sock->KSocketBase::errorString() << endl;
error(this,false);
sock->close();
operationFinished(this);
diff --git a/libktorrent/util/httprequest.h b/libktorrent/util/httprequest.h
index 348a84e..524b3b2 100644
--- a/libktorrent/util/httprequest.h
+++ b/libktorrent/util/httprequest.h
@@ -20,7 +20,7 @@
#ifndef BTHTTPREQUEST_H
#define BTHTTPREQUEST_H
-#include <qobject.h>
+#include <tqobject.h>
#include <kurl.h>
#include <kstreamsocket.h>
#include <interfaces/exitoperation.h>
@@ -41,6 +41,7 @@ namespace bt
class HTTPRequest : public kt::ExitOperation
{
Q_OBJECT
+ TQ_OBJECT
public:
/**
* Constructor, set the url and the request header.
@@ -50,7 +51,7 @@ namespace bt
* @param port THe port
* @param verbose Print traffic to the log
*/
- HTTPRequest(const QString & hdr,const QString & payload,const QString & host,
+ HTTPRequest(const TQString & hdr,const TQString & payload,const TQString & host,
Uint16 port,bool verbose);
virtual ~HTTPRequest();
@@ -65,14 +66,14 @@ namespace bt
* @param r The sender of the request
* @param data The data of the reply
*/
- void replyOK(bt::HTTPRequest* r,const QString & data);
+ void replyOK(bt::HTTPRequest* r,const TQString & data);
/**
* Anything else but an 200 OK was sent.
* @param r The sender of the request
* @param data The data of the reply
*/
- void replyError(bt::HTTPRequest* r,const QString & data);
+ void replyError(bt::HTTPRequest* r,const TQString & data);
/**
* No reply was sent and an error or timeout occurred.
@@ -89,7 +90,7 @@ namespace bt
private:
KNetwork::KStreamSocket* sock;
- QString hdr,payload;
+ TQString hdr,payload;
bool verbose;
};
diff --git a/libktorrent/util/log.cpp b/libktorrent/util/log.cpp
index 05682a8..6935a45 100644
--- a/libktorrent/util/log.cpp
+++ b/libktorrent/util/log.cpp
@@ -21,15 +21,15 @@
#include <kurl.h>
#include <kprocess.h>
#include <klocale.h>
-#include <qdatetime.h>
-#include <qtextstream.h>
-#include <qfile.h>
-#include <qptrlist.h>
+#include <tqdatetime.h>
+#include <tqtextstream.h>
+#include <tqfile.h>
+#include <tqptrlist.h>
#include <iostream>
#include <stdlib.h>
#include <torrent/globals.h>
#include <interfaces/logmonitorinterface.h>
-#include <qmutex.h>
+#include <tqmutex.h>
#include <util/fileops.h>
#include <stdlib.h>
#include "log.h"
@@ -45,19 +45,19 @@ namespace bt
class Log::Private
{
public:
- Log* parent;
- QTextStream* out;
- QFile fptr;
+ Log* tqparent;
+ TQTextStream* out;
+ TQFile fptr;
bool to_cout;
- QPtrList<LogMonitorInterface> monitors;
- QString tmp;
- QMutex mutex;
+ TQPtrList<LogMonitorInterface> monitors;
+ TQString tmp;
+ TQMutex mutex;
unsigned int m_filter;
AutoRotateLogJob* rotate_job;
public:
- Private(Log* parent) : parent(parent),out(0),to_cout(false),rotate_job(0)
+ Private(Log* tqparent) : tqparent(tqparent),out(0),to_cout(false),rotate_job(0)
{
- out = new QTextStream();
+ out = new TQTextStream();
}
~Private()
@@ -71,7 +71,7 @@ namespace bt
m_filter = filter;
}
- void rotateLogs(const QString & file)
+ void rotateLogs(const TQString & file)
{
if (bt::Exists(file + "-10.gz"))
bt::Delete(file + "-10.gz",true);
@@ -79,18 +79,18 @@ namespace bt
// move all log files one up
for (Uint32 i = 10;i > 1;i--)
{
- QString prev = QString("%1-%2.gz").arg(file).arg(i - 1);
- QString curr = QString("%1-%2.gz").arg(file).arg(i);
+ TQString prev = TQString("%1-%2.gz").tqarg(file).tqarg(i - 1);
+ TQString curr = TQString("%1-%2.gz").tqarg(file).tqarg(i);
if (bt::Exists(prev))
bt::Move(prev,curr,true);
}
// move current log to 1 and zip it
bt::Move(file,file + "-1",true);
- system(QString("gzip " + KProcess::quote(file + "-1")).local8Bit());
+ system(TQString("gzip " + KProcess::quote(file + "-1")).local8Bit());
}
- void setOutputFile(const QString & file)
+ void setOutputFile(const TQString & file)
{
if (fptr.isOpen())
fptr.close();
@@ -100,12 +100,12 @@ namespace bt
fptr.setName(file);
if (!fptr.open(IO_WriteOnly))
- throw Error(i18n("Cannot open log file %1 : %2").arg(file).arg(fptr.errorString()));
+ throw Error(i18n("Cannot open log file %1 : %2").tqarg(file).tqarg(fptr.errorString()));
- out->setDevice(&fptr);
+ out->setDevice(TQT_TQIODEVICE(&fptr));
}
- void write(const QString & line)
+ void write(const TQString & line)
{
tmp += line;
}
@@ -116,14 +116,14 @@ namespace bt
// this could result in the loss of some messages
if (!rotate_job)
{
- *out << QDateTime::currentDateTime().toString() << ": " << tmp << ::endl;
+ *out << TQDateTime::tqcurrentDateTime().toString() << ": " << tmp << ::endl;
fptr.flush();
if (to_cout)
- std::cout << tmp.local8Bit() << std::endl;
+ std::cout << TQString(tmp.local8Bit()) << std::endl;
if (monitors.count() > 0)
{
- QPtrList<LogMonitorInterface>::iterator i = monitors.begin();
+ TQPtrList<LogMonitorInterface>::iterator i = monitors.begin();
while (i != monitors.end())
{
kt::LogMonitorInterface* lmi = *i;
@@ -142,18 +142,18 @@ namespace bt
{
tmp = "Log larger then 10 MB, rotating";
finishLine();
- QString file = fptr.name();
+ TQString file = fptr.name();
fptr.close(); // close the log file
out->setDevice(0);
// start the rotate job
- rotate_job = new AutoRotateLogJob(file,parent);
+ rotate_job = new AutoRotateLogJob(file,tqparent);
}
}
void logRotateDone()
{
fptr.open(IO_WriteOnly);
- out->setDevice(&fptr);
+ out->setDevice(TQT_TQIODEVICE(&fptr));
rotate_job = 0;
}
};
@@ -170,7 +170,7 @@ namespace bt
}
- void Log::setOutputFile(const QString & file)
+ void Log::setOutputFile(const TQString & file)
{
priv->setOutputFile(file);
}
@@ -203,7 +203,7 @@ namespace bt
return *this;
}
- Log & Log::operator << (const QString & s)
+ Log & Log::operator << (const TQString & s)
{
priv->write(s);
return *this;
@@ -217,12 +217,12 @@ namespace bt
Log & Log::operator << (Uint64 v)
{
- return operator << (QString::number(v));
+ return operator << (TQString::number(v));
}
Log & Log::operator << (Int64 v)
{
- return operator << (QString::number(v));
+ return operator << (TQString::number(v));
}
void Log::setFilter(unsigned int filter)
diff --git a/libktorrent/util/log.h b/libktorrent/util/log.h
index 2fe0ba6..742b753 100644
--- a/libktorrent/util/log.h
+++ b/libktorrent/util/log.h
@@ -23,7 +23,7 @@
#include "constants.h"
-#include <qstring.h>
+#include <tqstring.h>
// LOG MESSAGES CONSTANTS
#define LOG_NONE 0x00
@@ -115,18 +115,18 @@ namespace bt
* @param file The name of the file
* @throw Exception if the file can't be opened
*/
- void setOutputFile(const QString & file);
+ void setOutputFile(const TQString & file);
/**
* Write a number to the log file.
- * Anything which can be passed to QString::number will do.
+ * Anything which can be passed to TQString::number will do.
* @param val The value
* @return This Log
*/
template <class T>
Log & operator << (T val)
{
- return operator << (QString::number(val));
+ return operator << (TQString::number(val));
}
/**
@@ -141,18 +141,18 @@ namespace bt
/**
- * Output a QString to the log.
- * @param s The QString
+ * Output a TQString to the log.
+ * @param s The TQString
* @return This Log
*/
Log & operator << (const char* s);
/**
- * Output a QString to the log.
- * @param s The QString
+ * Output a TQString to the log.
+ * @param s The TQString
* @return This Log
*/
- Log & operator << (const QString & s);
+ Log & operator << (const TQString & s);
/**
* Output a 64 bit integer to the log.
diff --git a/libktorrent/util/mmapfile.cpp b/libktorrent/util/mmapfile.cpp
index 579c67a..811acd7 100644
--- a/libktorrent/util/mmapfile.cpp
+++ b/libktorrent/util/mmapfile.cpp
@@ -29,7 +29,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
-#include <qfile.h>
+#include <tqfile.h>
#include <kfileitem.h>
#include <kio/netaccess.h>
#include <klocale.h>
@@ -51,20 +51,20 @@ namespace bt
close();
}
- bool MMapFile::open(const QString & file,Mode mode)
+ bool MMapFile::open(const TQString & file,Mode mode)
{
#if HAVE_STAT64
struct stat64 sb;
- stat64(QFile::encodeName(file),&sb);
+ stat64(TQFile::encodeName(file),&sb);
#else
struct stat sb;
- stat(QFile::encodeName(file),&sb);
+ stat(TQFile::encodeName(file),&sb);
#endif
return open(file,mode,(Uint64)sb.st_size);
}
- bool MMapFile::open(const QString & file,Mode mode,Uint64 size)
+ bool MMapFile::open(const TQString & file,Mode mode,Uint64 size)
{
// close already open file
if (fd > 0)
@@ -97,7 +97,7 @@ namespace bt
#endif
// open the file
- fd = ::open(QFile::encodeName(file) , flag);//(int)flag);
+ fd = ::open(TQFile::encodeName(file) , flag);//(int)flag);
if (fd == -1)
return false;
@@ -107,10 +107,10 @@ namespace bt
#if HAVE_STAT64
struct stat64 sb;
- stat64(QFile::encodeName(file),&sb);
+ stat64(TQFile::encodeName(file),&sb);
#else
struct stat sb;
- stat(QFile::encodeName(file),&sb);
+ stat(TQFile::encodeName(file),&sb);
#endif
file_size = (Uint64)sb.st_size;
filename = file;
@@ -146,7 +146,7 @@ namespace bt
ptr = size = 0;
data = 0;
fd = -1;
- filename = QString::null;
+ filename = TQString();
}
}
@@ -274,7 +274,7 @@ namespace bt
return ptr;
}
- QString MMapFile::errorString() const
+ TQString MMapFile::errorString() const
{
return strerror(errno);
}
diff --git a/libktorrent/util/mmapfile.h b/libktorrent/util/mmapfile.h
index ca0d782..4d68fd2 100644
--- a/libktorrent/util/mmapfile.h
+++ b/libktorrent/util/mmapfile.h
@@ -21,7 +21,7 @@
#define BTMMAPFILE_H
-#include <qstring.h>
+#include <tqstring.h>
#include <util/constants.h>
namespace bt
@@ -52,7 +52,7 @@ namespace bt
* @param mode Mode (READ, WRITE or RW)
* @return true upon succes
*/
- bool open(const QString & file,Mode mode);
+ bool open(const TQString & file,Mode mode);
/**
* Open the file. If mode is write and the file doesn't exist, it will
@@ -62,7 +62,7 @@ namespace bt
* @param size Size of the memory mapping (the file will be enlarged to this value)
* @return true upon succes
*/
- bool open(const QString & file,Mode mode,Uint64 size);
+ bool open(const TQString & file,Mode mode,Uint64 size);
/**
* Close the file. Undoes the memory mapping.
@@ -112,7 +112,7 @@ namespace bt
Uint64 tell() const;
/// Get the error string.
- QString errorString() const;
+ TQString errorString() const;
/// Get the file size
Uint64 getSize() const;
@@ -136,7 +136,7 @@ namespace bt
Uint64 size; // size of mmapping
Uint64 file_size; // size of file
Uint64 ptr;
- QString filename;
+ TQString filename;
Mode mode;
};
diff --git a/libktorrent/util/profiler.cpp b/libktorrent/util/profiler.cpp
index 05c53bd..766012d 100644
--- a/libktorrent/util/profiler.cpp
+++ b/libktorrent/util/profiler.cpp
@@ -18,19 +18,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifdef KT_PROFILE
-#include <qfile.h>
-#include <qtextstream.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
#include <sys/time.h>
#include "profiler.h"
namespace bt
{
- Profile::Profile(Profile* parent,const QString & name) : parent(parent),name(name)
+ Profile::Profile(Profile* tqparent,const TQString & name) : tqparent(tqparent),name(name)
{
min = max = avg = 0.0;
count = 0;
start_time = 0.0;
- children.setAutoDelete(true);
+ tqchildren.setAutoDelete(true);
}
Profile::~Profile()
@@ -61,10 +61,10 @@ namespace bt
count++;
}
- Profile* Profile::child(const QString & name)
+ Profile* Profile::child(const TQString & name)
{
- QPtrList<Profile>::iterator i = children.begin();
- while (i != children.end())
+ TQPtrList<Profile>::iterator i = tqchildren.begin();
+ while (i != tqchildren.end())
{
Profile* p = *i;
if (p->name == name)
@@ -73,19 +73,19 @@ namespace bt
}
Profile* p = new Profile(this,name);
- children.append(p);
+ tqchildren.append(p);
return p;
}
- void Profile::save(QTextStream & out,const QString & base)
+ void Profile::save(TQTextStream & out,const TQString & base)
{
- QString nb = base + "/" + name;
+ TQString nb = base + "/" + name;
out.precision(5);
out << qSetW(60) << nb << qSetW(10) << min << qSetW(10) << max << qSetW(10) << avg << qSetW(10) << count << endl;
- QPtrList<Profile>::iterator i = children.begin();
- while (i != children.end())
+ TQPtrList<Profile>::iterator i = tqchildren.begin();
+ while (i != tqchildren.end())
{
Profile* p = *i;
p->save(out,nb);
@@ -109,7 +109,7 @@ namespace bt
delete root;
}
- void Profiler::start(const QString & s)
+ void Profiler::start(const TQString & s)
{
curr = curr->child(s);
curr->start();
@@ -121,18 +121,18 @@ namespace bt
curr = curr->getParent();
}
- void Profiler::saveToFile(const QString & fn)
+ void Profiler::saveToFile(const TQString & fn)
{
- QFile fptr(fn);
+ TQFile fptr(fn);
if (!fptr.open(IO_WriteOnly))
return;
- QTextStream out(&fptr);
+ TQTextStream out(&fptr);
out << qSetW(60) << "code" << qSetW(10) << "min" << qSetW(10) << "max" << qSetW(10) << "avg" << qSetW(10) << "count" << endl;
out << endl;
- root->save(out,QString::null);
+ root->save(out,TQString());
}
}
#endif
diff --git a/libktorrent/util/profiler.h b/libktorrent/util/profiler.h
index 6ab06e7..836f4ba 100644
--- a/libktorrent/util/profiler.h
+++ b/libktorrent/util/profiler.h
@@ -21,10 +21,10 @@
#define BTPROFILER_H
#ifdef KT_PROFILE
-#include <qptrlist.h>
+#include <tqptrlist.h>
#include <util/constants.h>
-class QTextStream;
+class TQTextStream;
namespace bt
@@ -34,15 +34,15 @@ namespace bt
*/
class Profile
{
- Profile* parent;
- QPtrList<Profile> children;
+ Profile* tqparent;
+ TQPtrList<Profile> tqchildren;
- QString name;
+ TQString name;
double min,max,avg;
Uint32 count;
double start_time;
public:
- Profile(Profile* parent,const QString & name);
+ Profile(Profile* tqparent,const TQString & name);
virtual ~Profile();
/**
@@ -60,19 +60,19 @@ namespace bt
* @param name The name of the child
* @return The child
*/
- Profile* child(const QString & name);
+ Profile* child(const TQString & name);
/**
- * Get the parent of the current profile.
+ * Get the tqparent of the current profile.
*/
- Profile* getParent() const {return parent;}
+ Profile* getParent() const {return tqparent;}
/**
* Save profile information to a file.
* @param out Text stream to write to
* @param base Base path of the profiles
*/
- void save(QTextStream & out,const QString & base);
+ void save(TQTextStream & out,const TQString & base);
};
/**
@@ -91,9 +91,9 @@ namespace bt
public:
virtual ~Profiler();
- void start(const QString & s);
+ void start(const TQString & s);
void end();
- void saveToFile(const QString & fn);
+ void saveToFile(const TQString & fn);
static Profiler & instance() {return inst;}
};
diff --git a/libktorrent/util/ptrmap.h b/libktorrent/util/ptrmap.h
index 36e1c20..9474db1 100644
--- a/libktorrent/util/ptrmap.h
+++ b/libktorrent/util/ptrmap.h
@@ -129,7 +129,7 @@ namespace bt
* @param k The key
* @return The data of the key, 0 if the key isn't in the map
*/
- Data* find(const Key & k)
+ Data* tqfind(const Key & k)
{
iterator i = pmap.find(k);
return (i == pmap.end()) ? 0 : i->second;
@@ -140,7 +140,7 @@ namespace bt
* @param k The key
* @return The data of the key, 0 if the key isn't in the map
*/
- const Data* find(const Key & k) const
+ const Data* tqfind(const Key & k) const
{
const_iterator i = pmap.find(k);
return (i == pmap.end()) ? 0 : i->second;
@@ -151,7 +151,7 @@ namespace bt
* @param k The key
* @return true if it is part of the map
*/
- bool contains(const Key & k) const
+ bool tqcontains(const Key & k) const
{
const_iterator i = pmap.find(k);
return i != pmap.end();
diff --git a/libktorrent/util/sha1hash.cpp b/libktorrent/util/sha1hash.cpp
index c7b151c..6cdbbc4 100644
--- a/libktorrent/util/sha1hash.cpp
+++ b/libktorrent/util/sha1hash.cpp
@@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qurl.h>
+#include <tqurl.h>
#include <string.h>
#include <algorithm>
#include "log.h"
@@ -72,10 +72,10 @@ namespace bt
return hg.generate(data,len);
}
- QString SHA1Hash::toString() const
+ TQString SHA1Hash::toString() const
{
char tmp[41];
- QString fmt;
+ TQString fmt;
for (int i = 0;i < 20;i++)
fmt += "%02x";
tmp[40] = '\0';
@@ -84,17 +84,17 @@ namespace bt
hash[5],hash[6],hash[7],hash[8],hash[9],
hash[10],hash[11],hash[12],hash[13],hash[14],
hash[15],hash[16],hash[17],hash[18],hash[19]);
- return QString(tmp);
+ return TQString(tmp);
}
- QByteArray SHA1Hash::toByteArray() const
+ TQByteArray SHA1Hash::toByteArray() const
{
- QByteArray arr(20);
+ TQByteArray arr(20);
arr.duplicate((const char*)hash,20);
return arr;
}
- QString SHA1Hash::toURLString() const
+ TQString SHA1Hash::toURLString() const
{
return URLEncoder::encode((const char*)hash,20);
}
diff --git a/libktorrent/util/sha1hash.h b/libktorrent/util/sha1hash.h
index a831d2d..dba66c9 100644
--- a/libktorrent/util/sha1hash.h
+++ b/libktorrent/util/sha1hash.h
@@ -20,10 +20,10 @@
#ifndef BTSHA1HASH_H
#define BTSHA1HASH_H
-#include <qcstring.h>
+#include <tqcstring.h>
#include "constants.h"
-class QString;
+class TQString;
namespace bt
{
@@ -98,13 +98,13 @@ namespace bt
* Convert the hash to a printable string.
* @return The string
*/
- QString toString() const;
+ TQString toString() const;
/**
* Convert the hash to a string, usable in http get requests.
* @return The string
*/
- QString toURLString() const;
+ TQString toURLString() const;
/**
* Directly get pointer to the data.
@@ -140,7 +140,7 @@ namespace bt
/**
* Convert the hash to a byte array.
*/
- QByteArray toByteArray() const;
+ TQByteArray toByteArray() const;
};
}
diff --git a/libktorrent/util/timer.cpp b/libktorrent/util/timer.cpp
index c06b728..a35ffc0 100644
--- a/libktorrent/util/timer.cpp
+++ b/libktorrent/util/timer.cpp
@@ -25,7 +25,7 @@ namespace bt
Timer::Timer() : elapsed(0)
{
- last = QTime::currentTime();
+ last = TQTime::currentTime();
}
Timer::Timer(const Timer & t) : last(t.last),elapsed(t.elapsed)
@@ -37,7 +37,7 @@ namespace bt
void Timer::update()
{
- QTime now = QTime::currentTime();
+ TQTime now = TQTime::currentTime();
int d = last.msecsTo(now);
if (d < 0)
@@ -48,7 +48,7 @@ namespace bt
Uint32 Timer::getElapsedSinceUpdate() const
{
- QTime now = QTime::currentTime();
+ TQTime now = TQTime::currentTime();
int d = last.msecsTo(now);
if (d < 0)
d = 0;
diff --git a/libktorrent/util/timer.h b/libktorrent/util/timer.h
index 3277185..edef755 100644
--- a/libktorrent/util/timer.h
+++ b/libktorrent/util/timer.h
@@ -20,7 +20,7 @@
#ifndef BTTIMER_H
#define BTTIMER_H
-#include <qdatetime.h>
+#include <tqdatetime.h>
#include "constants.h"
namespace bt
@@ -31,7 +31,7 @@ namespace bt
*/
class Timer
{
- QTime last;
+ TQTime last;
Uint32 elapsed;
public:
Timer();
diff --git a/libktorrent/util/urlencoder.cpp b/libktorrent/util/urlencoder.cpp
index c1776de..9d2b92b 100644
--- a/libktorrent/util/urlencoder.cpp
+++ b/libktorrent/util/urlencoder.cpp
@@ -22,7 +22,7 @@
namespace bt
{
- QString hex[] = {
+ TQString hex[] = {
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
"%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f",
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -58,9 +58,9 @@ namespace bt
};
- QString URLEncoder::encode(const char* buf,Uint32 size)
+ TQString URLEncoder::encode(const char* buf,Uint32 size)
{
- QString res = "";
+ TQString res = "";
for (Uint32 i = 0; i < size; i++)
{
diff --git a/libktorrent/util/urlencoder.h b/libktorrent/util/urlencoder.h
index edac33a..c6fd3ec 100644
--- a/libktorrent/util/urlencoder.h
+++ b/libktorrent/util/urlencoder.h
@@ -20,7 +20,7 @@
#ifndef BTURLENCODER_H
#define BTURLENCODER_H
-#include <qstring.h>
+#include <tqstring.h>
#include "constants.h"
namespace bt
@@ -32,7 +32,7 @@ namespace bt
class URLEncoder
{
public:
- static QString encode(const char* buf,Uint32 size);
+ static TQString encode(const char* buf,Uint32 size);
};
}
diff --git a/libktorrent/util/waitjob.cpp b/libktorrent/util/waitjob.cpp
index d11fa14..9fec771 100644
--- a/libktorrent/util/waitjob.cpp
+++ b/libktorrent/util/waitjob.cpp
@@ -27,7 +27,7 @@ namespace bt
WaitJob::WaitJob(Uint32 millis) : KIO::Job(false)
{
- connect(&timer,SIGNAL(timeout()),this,SLOT(timerDone()));
+ connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(timerDone()));
timer.start(millis,true);
}
@@ -51,8 +51,8 @@ namespace bt
void WaitJob::addExitOperation(kt::ExitOperation* op)
{
exit_ops.append(op);
- connect(op,SIGNAL(operationFinished( kt::ExitOperation* )),
- this,SLOT(operationFinished( kt::ExitOperation* )));
+ connect(op,TQT_SIGNAL(operationFinished( kt::ExitOperation* )),
+ this,TQT_SLOT(operationFinished( kt::ExitOperation* )));
}
void WaitJob::operationFinished(kt::ExitOperation* op)
diff --git a/libktorrent/util/waitjob.h b/libktorrent/util/waitjob.h
index a85ba63..33b73f5 100644
--- a/libktorrent/util/waitjob.h
+++ b/libktorrent/util/waitjob.h
@@ -20,9 +20,9 @@
#ifndef BTWAITJOB_H
#define BTWAITJOB_H
-#include <qtimer.h>
+#include <tqtimer.h>
#include <kio/job.h>
-#include <qvaluelist.h>
+#include <tqvaluelist.h>
#include <interfaces/exitoperation.h>
#include "constants.h"
@@ -38,6 +38,7 @@ namespace bt
class WaitJob : public KIO::Job
{
Q_OBJECT
+ TQ_OBJECT
public:
WaitJob(Uint32 millis);
virtual ~WaitJob();
@@ -65,8 +66,8 @@ namespace bt
void operationFinished(kt::ExitOperation* op);
private:
- QTimer timer;
- QValueList<kt::ExitOperation*> exit_ops;
+ TQTimer timer;
+ TQValueList<kt::ExitOperation*> exit_ops;
};
void SynchronousWait(Uint32 millis);