summaryrefslogtreecommitdiffstats
path: root/libktorrent/net
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/net
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/net')
-rw-r--r--libktorrent/net/address.cpp14
-rw-r--r--libktorrent/net/address.h6
-rw-r--r--libktorrent/net/bufferedsocket.h4
-rw-r--r--libktorrent/net/circularbuffer.h4
-rw-r--r--libktorrent/net/downloadthread.cpp4
-rw-r--r--libktorrent/net/networkthread.cpp4
-rw-r--r--libktorrent/net/networkthread.h4
-rw-r--r--libktorrent/net/portlist.cpp2
-rw-r--r--libktorrent/net/portlist.h4
-rw-r--r--libktorrent/net/socket.cpp36
-rw-r--r--libktorrent/net/socketmonitor.cpp8
-rw-r--r--libktorrent/net/socketmonitor.h10
-rw-r--r--libktorrent/net/speed.cpp6
-rw-r--r--libktorrent/net/speed.h6
-rw-r--r--libktorrent/net/uploadthread.cpp4
-rw-r--r--libktorrent/net/uploadthread.h4
16 files changed, 60 insertions, 60 deletions
diff --git a/libktorrent/net/address.cpp b/libktorrent/net/address.cpp
index 4a4da3c..e1de8d0 100644
--- a/libktorrent/net/address.cpp
+++ b/libktorrent/net/address.cpp
@@ -27,7 +27,7 @@ namespace net
Address::Address() : m_ip(0),m_port(0) {}
- Address::Address(const QString & host,Uint16 port) : m_ip(0),m_port(port)
+ Address::Address(const TQString & host,Uint16 port) : m_ip(0),m_port(port)
{
struct in_addr a;
if (inet_aton(host.ascii(),&a))
@@ -55,13 +55,13 @@ namespace net
return m_ip == a.ip() && m_port == a.port();
}
- QString Address::toString() const
+ TQString Address::toString() const
{
- return QString("%1.%2.%3.%4")
- .arg((m_ip & 0xFF000000) >> 24)
- .arg((m_ip & 0x00FF0000) >> 16)
- .arg((m_ip & 0x0000FF00) >> 8)
- .arg(m_ip & 0x000000FF);
+ return TQString("%1.%2.%3.%4")
+ .tqarg((m_ip & 0xFF000000) >> 24)
+ .tqarg((m_ip & 0x00FF0000) >> 16)
+ .tqarg((m_ip & 0x0000FF00) >> 8)
+ .tqarg(m_ip & 0x000000FF);
}
}
diff --git a/libktorrent/net/address.h b/libktorrent/net/address.h
index 28c4e2c..af39380 100644
--- a/libktorrent/net/address.h
+++ b/libktorrent/net/address.h
@@ -20,7 +20,7 @@
#ifndef NETADDRESS_H
#define NETADDRESS_H
-#include <qstring.h>
+#include <tqstring.h>
#include <util/constants.h>
namespace net
@@ -37,7 +37,7 @@ namespace net
Uint16 m_port;
public:
Address();
- Address(const QString & host,Uint16 port);
+ Address(const TQString & host,Uint16 port);
Address(const Address & addr);
virtual ~Address();
@@ -51,7 +51,7 @@ namespace net
Uint16 port() const {return m_port;}
void setPort(Uint16 p) {m_port = p;}
- QString toString() const;
+ TQString toString() const;
};
diff --git a/libktorrent/net/bufferedsocket.h b/libktorrent/net/bufferedsocket.h
index 2c0c3ec..2e594df 100644
--- a/libktorrent/net/bufferedsocket.h
+++ b/libktorrent/net/bufferedsocket.h
@@ -20,7 +20,7 @@
#ifndef NETBUFFEREDSOCKET_H
#define NETBUFFEREDSOCKET_H
-#include <qmutex.h>
+#include <tqmutex.h>
#include <net/socket.h>
namespace net
@@ -72,7 +72,7 @@ namespace net
*/
class BufferedSocket : public Socket
{
- mutable QMutex mutex;
+ mutable TQMutex mutex;
SocketReader* rdr;
SocketWriter* wrt;
Uint8* output_buffer;
diff --git a/libktorrent/net/circularbuffer.h b/libktorrent/net/circularbuffer.h
index 63e271e..6d45723 100644
--- a/libktorrent/net/circularbuffer.h
+++ b/libktorrent/net/circularbuffer.h
@@ -20,7 +20,7 @@
#ifndef NETCIRCULARBUFFER_H
#define NETCIRCULARBUFFER_H
-#include <qmutex.h>
+#include <tqmutex.h>
#include <util/constants.h>
namespace net
@@ -43,7 +43,7 @@ namespace net
Uint32 max_size;
Uint32 first; // index of first byte in the buffer
Uint32 size; // number of bytes in use
- mutable QMutex mutex;
+ mutable TQMutex mutex;
public:
/**
* Create the buffer.
diff --git a/libktorrent/net/downloadthread.cpp b/libktorrent/net/downloadthread.cpp
index ae0f0b9..2adf1a8 100644
--- a/libktorrent/net/downloadthread.cpp
+++ b/libktorrent/net/downloadthread.cpp
@@ -61,9 +61,9 @@ namespace net
{
// add to the correct group
Uint32 gid = s->downloadGroupID();
- SocketGroup* g = groups.find(gid);
+ SocketGroup* g = groups.tqfind(gid);
if (!g)
- g = groups.find(0);
+ g = groups.tqfind(0);
g->add(s);
num_ready++;
diff --git a/libktorrent/net/networkthread.cpp b/libktorrent/net/networkthread.cpp
index 40791c9..0a48af9 100644
--- a/libktorrent/net/networkthread.cpp
+++ b/libktorrent/net/networkthread.cpp
@@ -51,7 +51,7 @@ namespace net
void NetworkThread::addGroup(Uint32 gid,Uint32 limit)
{
// if group already exists, just change the limit
- SocketGroup* g = groups.find(gid);
+ SocketGroup* g = groups.tqfind(gid);
if (g)
{
g->setLimit(limit);
@@ -72,7 +72,7 @@ namespace net
void NetworkThread::setGroupLimit(Uint32 gid,Uint32 limit)
{
- SocketGroup* g = groups.find(gid);
+ SocketGroup* g = groups.tqfind(gid);
if (g)
{
g->setLimit(limit);
diff --git a/libktorrent/net/networkthread.h b/libktorrent/net/networkthread.h
index 7472c15..d31ae3e 100644
--- a/libktorrent/net/networkthread.h
+++ b/libktorrent/net/networkthread.h
@@ -20,7 +20,7 @@
#ifndef NETNETWORKTHREAD_H
#define NETNETWORKTHREAD_H
-#include <qthread.h>
+#include <tqthread.h>
#include <util/constants.h>
#include <util/ptrmap.h>
@@ -37,7 +37,7 @@ namespace net
Base class for the 2 networking threads. Handles the socket groups.
*/
- class NetworkThread : public QThread
+ class NetworkThread : public TQThread
{
protected:
SocketMonitor* sm;
diff --git a/libktorrent/net/portlist.cpp b/libktorrent/net/portlist.cpp
index 56076ed..6fa4f6a 100644
--- a/libktorrent/net/portlist.cpp
+++ b/libktorrent/net/portlist.cpp
@@ -58,7 +58,7 @@ namespace net
void PortList::removePort(bt::Uint16 number,Protocol proto)
{
- PortList::iterator itr = find(Port(number,proto,false));
+ PortList::iterator itr = tqfind(Port(number,proto,false));
if (itr == end())
return;
diff --git a/libktorrent/net/portlist.h b/libktorrent/net/portlist.h
index af60c1c..c1a6e99 100644
--- a/libktorrent/net/portlist.h
+++ b/libktorrent/net/portlist.h
@@ -20,7 +20,7 @@
#ifndef NETPORTLIST_H
#define NETPORTLIST_H
-#include <qvaluelist.h>
+#include <tqvaluelist.h>
#include <util/constants.h>
namespace net
@@ -69,7 +69,7 @@ namespace net
* List of ports which are currently being used.
*
*/
- class PortList : public QValueList<Port>
+ class PortList : public TQValueList<Port>
{
PortListener* lst;
public:
diff --git a/libktorrent/net/socket.cpp b/libktorrent/net/socket.cpp
index b9a53f3..ff09a34 100644
--- a/libktorrent/net/socket.cpp
+++ b/libktorrent/net/socket.cpp
@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qglobal.h>
+#include <tqglobal.h>
#include <unistd.h>
#include <string.h>
@@ -39,7 +39,7 @@
#endif
#ifndef MSG_NOSIGNAL
-#define MSG_NOSIGNAL 0
+#define MSG_NOTQT_SIGNAL 0
#endif
#include <unistd.h>
@@ -60,7 +60,7 @@ namespace net
int val = 1;
if (setsockopt(m_fd,SOL_SOCKET,SO_NOSIGPIPE,&val,sizeof(int)) < 0)
{
- Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the NOSIGPIPE option : %1").arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set the NOSIGPIPE option : %1").tqarg(strerror(errno)) << endl;
}
#endif
cacheAddress();
@@ -71,14 +71,14 @@ namespace net
int fd = socket(PF_INET,tcp ? SOCK_STREAM : SOCK_DGRAM,0);
if (fd < 0)
{
- Out(SYS_GEN|LOG_IMPORTANT) << QString("Cannot create socket : %1").arg(strerror(errno)) << endl;
+ Out(SYS_GEN|LOG_IMPORTANT) << TQString("Cannot create socket : %1").tqarg(strerror(errno)) << endl;
}
m_fd = fd;
#if defined(Q_OS_MACX) || defined(Q_OS_DARWIN) || (defined(Q_OS_FREEBSD) && !defined(__DragonFly__) && __FreeBSD_version < 600020)
int val = 1;
if (setsockopt(m_fd,SOL_SOCKET,SO_NOSIGPIPE,&val,sizeof(int)) < 0)
{
- Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the NOSIGPIPE option : %1").arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set the NOSIGPIPE option : %1").tqarg(strerror(errno)) << endl;
}
#endif
}
@@ -126,8 +126,8 @@ namespace net
}
else
{
- Out(SYS_CON|LOG_NOTICE) << QString("Cannot connect to host %1:%2 : %3")
- .arg(a.toString()).arg(a.port()).arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_NOTICE) << TQString("Cannot connect to host %1:%2 : %3")
+ .tqarg(a.toString()).tqarg(a.port()).tqarg(strerror(errno)) << endl;
return false;
}
}
@@ -145,20 +145,20 @@ namespace net
if (::bind(m_fd,(struct sockaddr*)&addr,sizeof(struct sockaddr)) < 0)
{
- Out(SYS_CON|LOG_IMPORTANT) << QString("Cannot bind to port %1 : %2").arg(port).arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_IMPORTANT) << TQString("Cannot bind to port %1 : %2").tqarg(port).tqarg(strerror(errno)) << endl;
return false;
}
if (also_listen && listen(m_fd,5) < 0)
{
- Out(SYS_CON|LOG_IMPORTANT) << QString("Cannot listen to port %1 : %2").arg(port).arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_IMPORTANT) << TQString("Cannot listen to port %1 : %2").tqarg(port).tqarg(strerror(errno)) << endl;
return false;
}
int val = 1;
if (setsockopt(m_fd,SOL_SOCKET,SO_REUSEADDR,&val,sizeof(int)) < 0)
{
- Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the reuseaddr option : %1").arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set the reuseaddr option : %1").tqarg(strerror(errno)) << endl;
}
m_state = BOUND;
return true;
@@ -171,7 +171,7 @@ namespace net
{
if (errno != EAGAIN && errno != EWOULDBLOCK)
{
- // Out(SYS_CON|LOG_DEBUG) << "Send error : " << QString(strerror(errno)) << endl;
+ // Out(SYS_CON|LOG_DEBUG) << "Send error : " << TQString(strerror(errno)) << endl;
close();
}
return 0;
@@ -186,7 +186,7 @@ namespace net
{
if (errno != EAGAIN && errno != EWOULDBLOCK)
{
- // Out(SYS_CON|LOG_DEBUG) << "Receive error : " << QString(strerror(errno)) << endl;
+ // Out(SYS_CON|LOG_DEBUG) << "Receive error : " << TQString(strerror(errno)) << endl;
close();
}
return 0;
@@ -215,7 +215,7 @@ namespace net
int ret = ::sendto(m_fd,(char*)buf + ns,left,0,(struct sockaddr*)&addr,sizeof(struct sockaddr));
if (ret < 0)
{
- Out(SYS_CON|LOG_DEBUG) << "Send error : " << QString(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_DEBUG) << "Send error : " << TQString(strerror(errno)) << endl;
return 0;
}
@@ -233,7 +233,7 @@ namespace net
int ret = ::recvfrom(m_fd,buf,max_len,0,(struct sockaddr*)&addr,&sl);
if (ret < 0)
{
- Out(SYS_CON|LOG_DEBUG) << "Receive error : " << QString(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_DEBUG) << "Receive error : " << TQString(strerror(errno)) << endl;
return 0;
}
@@ -251,14 +251,14 @@ namespace net
int sfd = ::accept(m_fd,(struct sockaddr*)&addr,&slen);
if (sfd < 0)
{
- Out(SYS_CON|LOG_DEBUG) << "Accept error : " << QString(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_DEBUG) << "Accept error : " << TQString(strerror(errno)) << endl;
return -1;
}
a.setPort(ntohs(addr.sin_port));
a.setIP(ntohl(addr.sin_addr.s_addr));
- Out(SYS_CON|LOG_DEBUG) << "Accepted connection from " << QString(inet_ntoa(addr.sin_addr)) << endl;
+ Out(SYS_CON|LOG_DEBUG) << "Accepted connection from " << TQString(inet_ntoa(addr.sin_addr)) << endl;
return sfd;
}
@@ -271,8 +271,8 @@ namespace net
#endif
if (setsockopt(m_fd,IPPROTO_IP,IP_TOS,&c,sizeof(c)) < 0)
{
- Out(SYS_CON|LOG_NOTICE) << QString("Failed to set TOS to %1 : %2")
- .arg(type_of_service).arg(strerror(errno)) << endl;
+ Out(SYS_CON|LOG_NOTICE) << TQString("Failed to set TOS to %1 : %2")
+ .tqarg(type_of_service).tqarg(strerror(errno)) << endl;
return false;
}
return true;
diff --git a/libktorrent/net/socketmonitor.cpp b/libktorrent/net/socketmonitor.cpp
index 38225ab..123536a 100644
--- a/libktorrent/net/socketmonitor.cpp
+++ b/libktorrent/net/socketmonitor.cpp
@@ -96,7 +96,7 @@ namespace net
void SocketMonitor::add(BufferedSocket* sock)
{
- QMutexLocker lock(&mutex);
+ TQMutexLocker lock(&mutex);
bool start_threads = smap.count() == 0;
smap.append(sock);
@@ -106,15 +106,15 @@ namespace net
Out(SYS_CON|LOG_DEBUG) << "Starting socketmonitor threads" << endl;
if (!dt->isRunning())
- dt->start(QThread::IdlePriority);
+ dt->start(TQThread::IdlePriority);
if (!ut->isRunning())
- ut->start(QThread::IdlePriority);
+ ut->start(TQThread::IdlePriority);
}
}
void SocketMonitor::remove(BufferedSocket* sock)
{
- QMutexLocker lock(&mutex);
+ TQMutexLocker lock(&mutex);
if (smap.count() == 0)
return;
diff --git a/libktorrent/net/socketmonitor.h b/libktorrent/net/socketmonitor.h
index 79e4a2e..6fc63c1 100644
--- a/libktorrent/net/socketmonitor.h
+++ b/libktorrent/net/socketmonitor.h
@@ -21,8 +21,8 @@
#define NETSOCKETMONITOR_H
-#include <qmutex.h>
-#include <qptrlist.h>
+#include <tqmutex.h>
+#include <tqptrlist.h>
#include <util/constants.h>
@@ -44,10 +44,10 @@ namespace net
{
static SocketMonitor self;
- QMutex mutex;
+ TQMutex mutex;
UploadThread* ut;
DownloadThread* dt;
- QPtrList<BufferedSocket> smap;
+ TQPtrList<BufferedSocket> smap;
Uint32 next_group_id;
SocketMonitor();
@@ -90,7 +90,7 @@ namespace net
*/
void removeGroup(GroupType type,Uint32 gid);
- typedef QPtrList<BufferedSocket>::iterator Itr;
+ typedef TQPtrList<BufferedSocket>::iterator Itr;
/// Get the begin of the list of sockets
Itr begin() {return smap.begin();}
diff --git a/libktorrent/net/speed.cpp b/libktorrent/net/speed.cpp
index aa57513..35fde9d 100644
--- a/libktorrent/net/speed.cpp
+++ b/libktorrent/net/speed.cpp
@@ -37,16 +37,16 @@ namespace net
void Speed::onData(Uint32 b,bt::TimeStamp ts)
{
- dlrate.append(qMakePair(b,ts));
+ dlrate.append(tqMakePair(b,ts));
bytes += b;
}
void Speed::update(bt::TimeStamp now)
{
- QValueList<QPair<Uint32,TimeStamp> >::iterator i = dlrate.begin();
+ TQValueList<TQPair<Uint32,TimeStamp> >::iterator i = dlrate.begin();
while (i != dlrate.end())
{
- QPair<Uint32,TimeStamp> & p = *i;
+ TQPair<Uint32,TimeStamp> & p = *i;
if (now - p.second > SPEED_INTERVAL || now < p.second)
{
if (bytes >= p.first) // make sure we don't wrap around
diff --git a/libktorrent/net/speed.h b/libktorrent/net/speed.h
index d5825e9..a9ea561 100644
--- a/libktorrent/net/speed.h
+++ b/libktorrent/net/speed.h
@@ -20,8 +20,8 @@
#ifndef NETSPEED_H
#define NETSPEED_H
-#include <qpair.h>
-#include <qvaluelist.h>
+#include <tqpair.h>
+#include <tqvaluelist.h>
#include <util/constants.h>
namespace net
@@ -36,7 +36,7 @@ namespace net
{
float rate;
bt::Uint32 bytes;
- QValueList<QPair<bt::Uint32,bt::TimeStamp> > dlrate;
+ TQValueList<TQPair<bt::Uint32,bt::TimeStamp> > dlrate;
public:
Speed();
virtual ~Speed();
diff --git a/libktorrent/net/uploadthread.cpp b/libktorrent/net/uploadthread.cpp
index 0023cf6..3d2fa0a 100644
--- a/libktorrent/net/uploadthread.cpp
+++ b/libktorrent/net/uploadthread.cpp
@@ -52,9 +52,9 @@ namespace net
BufferedSocket* s = *itr;
if (s && s->ok() && s->bytesReadyToWrite())
{
- SocketGroup* g = groups.find(s->uploadGroupID());
+ SocketGroup* g = groups.tqfind(s->uploadGroupID());
if (!g)
- g = groups.find(0);
+ g = groups.tqfind(0);
g->add(s);
num_ready++;
diff --git a/libktorrent/net/uploadthread.h b/libktorrent/net/uploadthread.h
index 265abac..b273846 100644
--- a/libktorrent/net/uploadthread.h
+++ b/libktorrent/net/uploadthread.h
@@ -22,7 +22,7 @@
-#include <qwaitcondition.h>
+#include <tqwaitcondition.h>
#include "networkthread.h"
namespace net
@@ -38,7 +38,7 @@ namespace net
static bt::Uint32 ucap;
static bt::Uint32 sleep_time;
- QWaitCondition data_ready;
+ TQWaitCondition data_ready;
public:
UploadThread(SocketMonitor* sm);
virtual ~UploadThread();