diff options
Diffstat (limited to 'plugins/zeroconf')
-rw-r--r-- | plugins/zeroconf/avahiservice.cpp | 18 | ||||
-rw-r--r-- | plugins/zeroconf/avahiservice.h | 7 | ||||
-rw-r--r-- | plugins/zeroconf/zeroconfplugin.cpp | 32 | ||||
-rw-r--r-- | plugins/zeroconf/zeroconfplugin.h | 5 |
4 files changed, 32 insertions, 30 deletions
diff --git a/plugins/zeroconf/avahiservice.cpp b/plugins/zeroconf/avahiservice.cpp index a190d8e..714d92a 100644 --- a/plugins/zeroconf/avahiservice.cpp +++ b/plugins/zeroconf/avahiservice.cpp @@ -19,7 +19,7 @@ #include <util/log.h> #include <torrent/peerid.h> #include <avahi-common/watch.h> -#include <avahi-qt3/qt-watch.h> +#include <avahi-qt3/tqt-watch.h> #include "localbrowser.h" #include "avahiservice.h" @@ -66,16 +66,16 @@ namespace kt } } - const char* name = avahi_strdup(QString("%1__%2%3").arg(service->id).arg((rand() % 26) + 65).arg((rand() % 26) + 65).ascii()); + const char* name = avahi_strdup(TQString("%1__%2%3").tqarg(service->id).tqarg((rand() % 26) + 65).tqarg((rand() % 26) + 65).ascii()); const char* type = avahi_strdup("_bittorrent._tcp"); - const char* subtype = avahi_strdup(QString("_" + service->infoHash + "._sub._bittorrent._tcp").ascii()); + const char* subtype = avahi_strdup(TQString("_" + service->infoHash + "._sub._bittorrent._tcp").ascii()); if (avahi_entry_group_add_service( service->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, (AvahiPublishFlags)0, name, type, NULL, NULL, service->port, NULL)) { if (avahi_client_errno(c) != -8) - Out(SYS_ZCO|LOG_DEBUG) << QString("ZC: Failed to add the service (%i).").arg(avahi_client_errno(c)) << endl; + Out(SYS_ZCO|LOG_DEBUG) << TQString("ZC: Failed to add the service (%i).").tqarg(avahi_client_errno(c)) << endl; else publish_service(service, c); return; @@ -85,7 +85,7 @@ namespace kt service->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, (AvahiPublishFlags)0, name, type, NULL, subtype)) { - Out(SYS_ZCO|LOG_DEBUG) << QString("ZC: Failed to add the service subtype (%i).").arg( avahi_client_errno(c)) << endl; + Out(SYS_ZCO|LOG_DEBUG) << TQString("ZC: Failed to add the service subtype (%i).").tqarg( avahi_client_errno(c)) << endl; return; } @@ -166,10 +166,10 @@ namespace kt { AvahiService* service = reinterpret_cast<AvahiService*>(userdata); - QString realname = QString(name); + TQString realname = TQString(name); realname.truncate(realname.length() - 5); - if (service->id != QString(realname)) + if (service->id != TQString(realname)) { char a[AVAHI_ADDRESS_STR_MAX]; avahi_address_snprint(a, sizeof(a), address); @@ -214,7 +214,7 @@ namespace kt } case AVAHI_BROWSER_REMOVE: { - QString realname = QString(name); + TQString realname = TQString(name); realname.truncate(realname.length() - 5); LocalBrowser::remove(bt::PeerID(realname.ascii())); @@ -317,7 +317,7 @@ namespace kt return false; } - if (!(browser = avahi_service_browser_new(listener, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, avahi_strdup(QString("_" + infoHash + "._sub._bittorrent._tcp").ascii()), NULL, (AvahiLookupFlags)0, browser_callback, this))) + if (!(browser = avahi_service_browser_new(listener, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, avahi_strdup(TQString("_" + infoHash + "._sub._bittorrent._tcp").ascii()), NULL, (AvahiLookupFlags)0, browser_callback, this))) { Out(SYS_ZCO|LOG_DEBUG) << "ZC: Failed to create a service browser." << endl; stop(); diff --git a/plugins/zeroconf/avahiservice.h b/plugins/zeroconf/avahiservice.h index 10938d8..fd9e144 100644 --- a/plugins/zeroconf/avahiservice.h +++ b/plugins/zeroconf/avahiservice.h @@ -27,7 +27,7 @@ */ #include <cstdlib> -#include <qstring.h> +#include <tqstring.h> #include <avahi-client/client.h> @@ -45,6 +45,7 @@ namespace kt class AvahiService : public kt::PeerSource { Q_OBJECT + TQ_OBJECT public: AvahiService(const bt::PeerID&, bt::Uint16, const bt::SHA1Hash&); virtual ~AvahiService(); @@ -95,9 +96,9 @@ namespace kt void* ); - QString id; + TQString id; int port; - QString infoHash; + TQString infoHash; bool started; diff --git a/plugins/zeroconf/zeroconfplugin.cpp b/plugins/zeroconf/zeroconfplugin.cpp index b906843..462b6a0 100644 --- a/plugins/zeroconf/zeroconfplugin.cpp +++ b/plugins/zeroconf/zeroconfplugin.cpp @@ -37,8 +37,8 @@ using namespace bt; namespace kt { - ZeroConfPlugin::ZeroConfPlugin(QObject* parent, const char* name, const QStringList& args) - : Plugin(parent, name,args,NAME,i18n("Zeroconf"),AUTHOR,QString::null,i18n("Finds peers running ktorrent on the local network to share torrents with"),"ktplugins") + ZeroConfPlugin::ZeroConfPlugin(TQObject* tqparent, const char* name, const TQStringList& args) + : Plugin(tqparent, name,args,NAME,i18n("Zeroconf"),AUTHOR,TQString(),i18n("Finds peers running ktorrent on the local network to share torrents with"),"ktplugins") { services.setAutoDelete(true); } @@ -50,14 +50,14 @@ namespace kt void ZeroConfPlugin::load() { CoreInterface* core = getCore(); - connect(core,SIGNAL(torrentAdded( kt::TorrentInterface* )), - this,SLOT(torrentAdded( kt::TorrentInterface* ))); - connect(core,SIGNAL(torrentRemoved( kt::TorrentInterface* )), - this,SLOT(torrentRemoved( kt::TorrentInterface* ))); + connect(core,TQT_SIGNAL(torrentAdded( kt::TorrentInterface* )), + this,TQT_SLOT(torrentAdded( kt::TorrentInterface* ))); + connect(core,TQT_SIGNAL(torrentRemoved( kt::TorrentInterface* )), + this,TQT_SLOT(torrentRemoved( kt::TorrentInterface* ))); // go over existing torrents and add them bt::QueueManager* qman = core->getQueueManager(); - for (QPtrList<kt::TorrentInterface>::iterator i = qman->begin();i != qman->end();i++) + for (TQPtrList<kt::TorrentInterface>::iterator i = qman->begin();i != qman->end();i++) { torrentAdded(*i); } @@ -66,10 +66,10 @@ namespace kt void ZeroConfPlugin::unload() { CoreInterface* core = getCore(); - disconnect(core,SIGNAL(torrentAdded( kt::TorrentInterface* )), - this,SLOT(torrentAdded( kt::TorrentInterface* ))); - disconnect(core,SIGNAL(torrentRemoved( kt::TorrentInterface* )), - this,SLOT(torrentRemoved( kt::TorrentInterface*))); + disconnect(core,TQT_SIGNAL(torrentAdded( kt::TorrentInterface* )), + this,TQT_SLOT(torrentAdded( kt::TorrentInterface* ))); + disconnect(core,TQT_SIGNAL(torrentRemoved( kt::TorrentInterface* )), + this,TQT_SLOT(torrentRemoved( kt::TorrentInterface*))); bt::PtrMap<kt::TorrentInterface*,AvahiService>::iterator i = services.begin(); while (i != services.end()) @@ -84,7 +84,7 @@ namespace kt void ZeroConfPlugin::torrentAdded(kt::TorrentInterface* tc) { - if (services.contains(tc)) + if (services.tqcontains(tc)) return; bt::Uint16 port = bt::Globals::instance().getServer().getPortInUse(); @@ -93,14 +93,14 @@ namespace kt tc->addPeerSource(av); Out(SYS_ZCO|LOG_NOTICE) << "ZeroConf service added for " << tc->getStats().torrent_name << endl; - connect(av,SIGNAL(serviceDestroyed( AvahiService* )), - this,SLOT(avahiServiceDestroyed( AvahiService* ))); + connect(av,TQT_SIGNAL(serviceDestroyed( AvahiService* )), + this,TQT_SLOT(avahiServiceDestroyed( AvahiService* ))); } void ZeroConfPlugin::torrentRemoved(kt::TorrentInterface* tc) { - AvahiService* av = services.find(tc); + AvahiService* av = services.tqfind(tc); if (!av) return; Out(SYS_ZCO|LOG_NOTICE) << "ZeroConf service removed for " @@ -127,7 +127,7 @@ namespace kt services.setAutoDelete(true); } - bool ZeroConfPlugin::versionCheck(const QString & version) const + bool ZeroConfPlugin::versionCheck(const TQString & version) const { return version == KT_VERSION_MACRO; } diff --git a/plugins/zeroconf/zeroconfplugin.h b/plugins/zeroconf/zeroconfplugin.h index b34e851..f658f3e 100644 --- a/plugins/zeroconf/zeroconfplugin.h +++ b/plugins/zeroconf/zeroconfplugin.h @@ -36,13 +36,14 @@ namespace kt class ZeroConfPlugin : public Plugin { Q_OBJECT + TQ_OBJECT public: - ZeroConfPlugin(QObject* parent, const char* name, const QStringList& args); + ZeroConfPlugin(TQObject* tqparent, const char* name, const TQStringList& args); virtual ~ZeroConfPlugin(); virtual void load(); virtual void unload(); - virtual bool versionCheck(const QString& version) const; + virtual bool versionCheck(const TQString& version) const; private slots: /** |