summaryrefslogtreecommitdiffstats
path: root/dnssd/servicebrowser.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:46:43 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:46:43 +0000
commitffe8a83e053396df448e9413828527613ca3bd46 (patch)
treea73d4169e02df4a50f9a12cb165fcd0ab5bac7c6 /dnssd/servicebrowser.cpp
parent682bf3bfdcbcbb1fca85e8a36ed03e062e0555d5 (diff)
downloadtdelibs-ffe8a83e053396df448e9413828527613ca3bd46.tar.gz
tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dnssd/servicebrowser.cpp')
-rw-r--r--dnssd/servicebrowser.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/dnssd/servicebrowser.cpp b/dnssd/servicebrowser.cpp
index 20e1b11e0..3c64ffe66 100644
--- a/dnssd/servicebrowser.cpp
+++ b/dnssd/servicebrowser.cpp
@@ -20,8 +20,8 @@
#include <signal.h>
#include <errno.h>
-#include <qstringlist.h>
-#include <qfile.h>
+#include <tqstringlist.h>
+#include <tqfile.h>
#include "domainbrowser.h"
#include "responder.h"
#include "query.h"
@@ -34,50 +34,50 @@
namespace DNSSD
{
-const QString ServiceBrowser::AllServices = "_services._dns-sd._udp";
+const TQString ServiceBrowser::AllServices = "_services._dns-sd._udp";
class ServiceBrowserPrivate
{
public:
ServiceBrowserPrivate() : m_running(false)
{}
- QValueList<RemoteService::Ptr> m_services;
- QValueList<RemoteService::Ptr> m_duringResolve;
- QStringList m_types;
+ TQValueList<RemoteService::Ptr> m_services;
+ TQValueList<RemoteService::Ptr> m_duringResolve;
+ TQStringList m_types;
DomainBrowser* m_domains;
int m_flags;
bool m_running;
bool m_finished;
- QDict<Query> resolvers;
+ TQDict<Query> resolvers;
};
-ServiceBrowser::ServiceBrowser(const QString& type,DomainBrowser* domains,bool autoResolve)
+ServiceBrowser::ServiceBrowser(const TQString& type,DomainBrowser* domains,bool autoResolve)
{
if (domains) init(type,domains,autoResolve ? AutoResolve : 0);
else init(type,new DomainBrowser(this),autoResolve ? AutoResolve|AutoDelete : AutoDelete);
}
-ServiceBrowser::ServiceBrowser(const QStringList& types,DomainBrowser* domains,int flags)
+ServiceBrowser::ServiceBrowser(const TQStringList& types,DomainBrowser* domains,int flags)
{
if (domains) init(types,domains,flags);
else init(types,new DomainBrowser(this),flags|AutoDelete);
}
-void ServiceBrowser::init(const QStringList& type,DomainBrowser* domains,int flags)
+void ServiceBrowser::init(const TQStringList& type,DomainBrowser* domains,int flags)
{
d = new ServiceBrowserPrivate();
d->resolvers.setAutoDelete(true);
d->m_types=type;
d->m_flags=flags;
d->m_domains = domains;
- connect(d->m_domains,SIGNAL(domainAdded(const QString& )),this,SLOT(addDomain(const QString& )));
- connect(d->m_domains,SIGNAL(domainRemoved(const QString& )),this,
- SLOT(removeDomain(const QString& )));
+ connect(d->m_domains,TQT_SIGNAL(domainAdded(const TQString& )),this,TQT_SLOT(addDomain(const TQString& )));
+ connect(d->m_domains,TQT_SIGNAL(domainRemoved(const TQString& )),this,
+ TQT_SLOT(removeDomain(const TQString& )));
}
-ServiceBrowser::ServiceBrowser(const QString& type,const QString& domain,bool autoResolve)
+ServiceBrowser::ServiceBrowser(const TQString& type,const TQString& domain,bool autoResolve)
{
init(type,new DomainBrowser(domain,false,this),autoResolve ? AutoResolve|AutoDelete : AutoDelete);
}
-ServiceBrowser::ServiceBrowser(const QString& type,const QString& domain,int flags)
+ServiceBrowser::ServiceBrowser(const TQString& type,const TQString& domain,int flags)
{
init(type,new DomainBrowser(domain,false,this),flags | AutoDelete);
}
@@ -108,11 +108,11 @@ const DomainBrowser* ServiceBrowser::browsedDomains() const
void ServiceBrowser::serviceResolved(bool success)
{
- QObject* sender_obj = const_cast<QObject*>(sender());
+ TQObject* sender_obj = const_cast<TQObject*>(sender());
RemoteService* svr = static_cast<RemoteService*>(sender_obj);
- disconnect(svr,SIGNAL(resolved(bool)),this,SLOT(serviceResolved(bool)));
- QValueList<RemoteService::Ptr>::Iterator it = d->m_duringResolve.begin();
- QValueList<RemoteService::Ptr>::Iterator itEnd = d->m_duringResolve.end();
+ disconnect(svr,TQT_SIGNAL(resolved(bool)),this,TQT_SLOT(serviceResolved(bool)));
+ TQValueList<RemoteService::Ptr>::Iterator it = d->m_duringResolve.begin();
+ TQValueList<RemoteService::Ptr>::Iterator itEnd = d->m_duringResolve.end();
while ( it!= itEnd && svr!= (*it)) ++it;
if (it != itEnd) {
if (success) {
@@ -130,8 +130,8 @@ void ServiceBrowser::startBrowse()
d->m_running=true;
if (isAvailable()!=Working) return;
if (d->m_domains->isRunning()) {
- QStringList::const_iterator itEnd = d->m_domains->domains().end();
- for ( QStringList::const_iterator it = d->m_domains->domains().begin(); it != itEnd; ++it )
+ TQStringList::const_iterator itEnd = d->m_domains->domains().end();
+ for ( TQStringList::const_iterator it = d->m_domains->domains().begin(); it != itEnd; ++it )
addDomain(*it);
} else d->m_domains->startBrowse();
}
@@ -140,7 +140,7 @@ void ServiceBrowser::gotNewService(RemoteService::Ptr svr)
{
if (findDuplicate(svr)==(d->m_services.end())) {
if (d->m_flags & AutoResolve) {
- connect(svr,SIGNAL(resolved(bool )),this,SLOT(serviceResolved(bool )));
+ connect(svr,TQT_SIGNAL(resolved(bool )),this,TQT_SLOT(serviceResolved(bool )));
d->m_duringResolve+=svr;
svr->resolveAsync();
} else {
@@ -152,7 +152,7 @@ void ServiceBrowser::gotNewService(RemoteService::Ptr svr)
void ServiceBrowser::gotRemoveService(RemoteService::Ptr svr)
{
- QValueList<RemoteService::Ptr>::Iterator it = findDuplicate(svr);
+ TQValueList<RemoteService::Ptr>::Iterator it = findDuplicate(svr);
if (it!=(d->m_services.end())) {
emit serviceRemoved(*it);
d->m_services.remove(it);
@@ -160,10 +160,10 @@ void ServiceBrowser::gotRemoveService(RemoteService::Ptr svr)
}
-void ServiceBrowser::removeDomain(const QString& domain)
+void ServiceBrowser::removeDomain(const TQString& domain)
{
while (d->resolvers[domain]) d->resolvers.remove(domain);
- QValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin();
+ TQValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin();
while (it!=d->m_services.end())
// use section to skip possible trailing dot
if ((*it)->domain().section('.',0) == domain.section('.',0)) {
@@ -172,18 +172,18 @@ void ServiceBrowser::removeDomain(const QString& domain)
} else ++it;
}
-void ServiceBrowser::addDomain(const QString& domain)
+void ServiceBrowser::addDomain(const TQString& domain)
{
if (!d->m_running) return;
if (!(d->resolvers[domain])) {
- QStringList::ConstIterator itEnd = d->m_types.end();
- for (QStringList::ConstIterator it=d->m_types.begin(); it!=itEnd; ++it) {
+ TQStringList::ConstIterator itEnd = d->m_types.end();
+ for (TQStringList::ConstIterator it=d->m_types.begin(); it!=itEnd; ++it) {
Query* b = new Query((*it),domain);
- connect(b,SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)),this,
- SLOT(gotNewService(DNSSD::RemoteService::Ptr)));
- connect(b,SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr )),this,
- SLOT(gotRemoveService(DNSSD::RemoteService::Ptr)));
- connect(b,SIGNAL(finished()),this,SLOT(queryFinished()));
+ connect(b,TQT_SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)),this,
+ TQT_SLOT(gotNewService(DNSSD::RemoteService::Ptr)));
+ connect(b,TQT_SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr )),this,
+ TQT_SLOT(gotRemoveService(DNSSD::RemoteService::Ptr)));
+ connect(b,TQT_SIGNAL(finished()),this,TQT_SLOT(queryFinished()));
b->startQuery();
d->resolvers.insert(domain,b);
}
@@ -199,12 +199,12 @@ bool ServiceBrowser::allFinished()
{
if (d->m_duringResolve.count()) return false;
bool all = true;
- QDictIterator<Query> it(d->resolvers);
+ TQDictIterator<Query> it(d->resolvers);
for ( ; it.current(); ++it) all&=(*it)->isFinished();
return all;
}
-const QValueList<RemoteService::Ptr>& ServiceBrowser::services() const
+const TQValueList<RemoteService::Ptr>& ServiceBrowser::services() const
{
return d->m_services;
}
@@ -212,10 +212,10 @@ const QValueList<RemoteService::Ptr>& ServiceBrowser::services() const
void ServiceBrowser::virtual_hook(int, void*)
{}
-QValueList<RemoteService::Ptr>::Iterator ServiceBrowser::findDuplicate(RemoteService::Ptr src)
+TQValueList<RemoteService::Ptr>::Iterator ServiceBrowser::findDuplicate(RemoteService::Ptr src)
{
- QValueList<RemoteService::Ptr>::Iterator itEnd = d->m_services.end();
- for (QValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin(); it!=itEnd; ++it)
+ TQValueList<RemoteService::Ptr>::Iterator itEnd = d->m_services.end();
+ for (TQValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin(); it!=itEnd; ++it)
if ((src->type()==(*it)->type()) && (src->serviceName()==(*it)->serviceName()) &&
(src->domain() == (*it)->domain())) return it;
return itEnd;