X-Git-Url: http://git.maemo.org/git/?p=qtrapids;a=blobdiff_plain;f=src%2Fengine%2FQBittorrentSession.cpp;h=4cefcec522a78ba0e722956e406b3ed73e34b671;hp=34198c852fcc15d33fcc75f51d013dfdbe58e912;hb=b00c42d2b71e46b466d5796900f5bf5cb6017063;hpb=afa034e0adbbeaf337e34671efd44f5e487c17ba diff --git a/src/engine/QBittorrentSession.cpp b/src/engine/QBittorrentSession.cpp index 34198c8..4cefcec 100644 --- a/src/engine/QBittorrentSession.cpp +++ b/src/engine/QBittorrentSession.cpp @@ -17,10 +17,21 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + +#include + +#include "AlertWaiterThread.h" #include "QBittorrentSession.h" -QBittorrentSession::QBittorrentSession() + +QBittorrentSession::QBittorrentSession(QObject *parent): + QObject(parent), + btSession_(), + alertWaiter_(NULL) { + alertWaiter_ = new AlertWaiterThread(&btSession_, this); + connect(alertWaiter_, SIGNAL(alert(TorrentAlert const*)), this, SLOT(on_alert(TorrentAlert const*))); + alertWaiter_->start(); } @@ -29,3 +40,19 @@ QBittorrentSession::~QBittorrentSession() } +QTorrentHandle QBittorrentSession::addTorrent(AddTorrentParams const& params) +{ + // Delegate to Libtorrent and return QTorrentHandle. + QTorrentHandle handle(btSession_.add_torrent(params)); + return handle; +} + + +// ========================== SLOTS ============================== +void QBittorrentSession::on_alert(TorrentAlert const *al) +{ + qDebug() << "QBittorrentSession:on_alert(" << al << ")"; + emit alert(al); +} + +