[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/ioslaves/kio_torrent
From: Christian Weilbach <christian () whiletaker ! homeip ! net>
Date: 2010-06-14 21:50:22
Message-ID: 20100614215022.4EC93AC8D3 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1137998 by weilbach:
Some fixes. Event loop now used as expected, still signal not fetched :-(
M +13 -8 dbusthread.cpp
M +1 -0 dbusthread.h
M +3 -1 kio_torrent.cpp
U kio_torrent.h
--- trunk/playground/ioslaves/kio_torrent/dbusthread.cpp #1137997:1137998
@@ -35,9 +35,16 @@
void DBusThread::run()
{
kDebug();
+ kDebug() << " starting event loop.";
+ exec();
+ kDebug() << " event loop finished.";
+}
+
+void DBusThread::initializeDBus()
+{
m_mutex.lock();
QDBusConnection bus = QDBusConnection::sessionBus();
- m_coreKtInterface = new QDBusInterface("org.ktorrent.ktorrent", "/core", \
"org.ktorrent.core", bus ); + m_coreKtInterface = new \
QDBusInterface("org.ktorrent.ktorrent", "/core", "org.ktorrent.core", bus, this ); \
QDBusReply<QStringList>groupList = m_coreKtInterface->call("groups"); if \
(!groupList.isValid()) {
kError() << "Could not get the group list, do you have a compatible KTorrent \
version running?"; @@ -52,18 +59,17 @@
}
kDebug() << 2;
- if (!connect(m_coreKtInterface, SIGNAL(finished(const QString&)),
+/* if (!connect(m_coreKtInterface, SIGNAL(finished(const QString&)),
this, SLOT(slotFinished(const QString&)))) {
kDebug() << "Could not connect to finished().";
}
if (!connect(m_coreKtInterface, SIGNAL(torrentAdded(const QString&)),
this, SLOT(slotTorrentAdded(const QString&)))) {
kDebug() << "Could not connect to torrentAdded().:";
- }
- kDebug() << " starting event loop.";
+ }*/
+ bus.connect("org.ktorrent.ktorrent","/core","org.ktorrent.core","torrentAdded",this,SLOT(slotTorrentAdded(const \
QString &))); +// \
bus.connect("org.ktorrent.ktorrent","/core","org.ktorrent.core","torrentRemoved",this,SLOT(torrentRemoved(const \
QString &))); m_mutex.unlock();
- exec();
- kDebug() << " event loop finished.";
}
void DBusThread::get( const KUrl& url )
@@ -75,13 +81,12 @@
httpUrl.replace("torrent:","http:");
QStringList splitUrl = httpUrl.split(QRegExp(".torrent(/)"));
m_coreKtInterface->call("loadSilently", splitUrl[0]+".torrent","kio_torrent");
-// m_mutex.unlock();
+ m_mutex.unlock();
}
void DBusThread::slotFinished(const QString& tor)
{
kDebug()<< tor;
- m_mutex.unlock();
}
void DBusThread::slotTorrentAdded(const QString& tor)
--- trunk/playground/ioslaves/kio_torrent/dbusthread.h #1137997:1137998
@@ -31,6 +31,7 @@
Q_OBJECT
public:
void run();
+ void initializeDBus();
void get(const KUrl&);
private slots:
--- trunk/playground/ioslaves/kio_torrent/kio_torrent.cpp #1137997:1137998
@@ -57,10 +57,12 @@
kDebug();
m_dbusThread = new DBusThread();
m_dbusThread->start();
+ m_dbusThread->initializeDBus();
}
TorrentProtocol::~TorrentProtocol()
{
+ m_dbusThread->quit();
delete m_dbusThread;
kDebug();
}
@@ -81,5 +83,5 @@
{
kDebug() << url.url();
m_dbusThread->get( url );
- finished();
+ while( true ) sleep (1000);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic