X-Git-Url: http://git.maemo.org/git/?p=qtrapids;a=blobdiff_plain;f=src%2Fengine%2FQBittorrentSession.cpp;h=57054c39317ff0a81a363c7101ca4d42ed5bdc4b;hp=dd94f95598681fa8181da7e03d4afe3f65def907;hb=3b087a27d415059adf505d398ffe0b9fbd5ed0ba;hpb=45e692ff47151854cc149c514d3a53285f0f195a diff --git a/src/engine/QBittorrentSession.cpp b/src/engine/QBittorrentSession.cpp index dd94f95..57054c3 100644 --- a/src/engine/QBittorrentSession.cpp +++ b/src/engine/QBittorrentSession.cpp @@ -31,7 +31,7 @@ QBittorrentSession::QBittorrentSession(QObject *parent): { alertWaiter_ = new AlertWaiterThread(&btSession_, this); alertWaiter_->allAlerts(); - connect(alertWaiter_, SIGNAL(alert(TorrentAlert const*)), this, SLOT(on_alert(TorrentAlert const*))); + connect(alertWaiter_, SIGNAL(alert(Alert const*)), this, SLOT(on_alert(Alert const*))); alertWaiter_->start(); } @@ -41,17 +41,24 @@ QBittorrentSession::~QBittorrentSession() } -std::auto_ptr +QTorrentHandle QBittorrentSession::addTorrent(AddTorrentParams const& params) { // Delegate to Libtorrent and return QTorrentHandle. - std::auto_ptr handlePtr(new QTorrentHandle(btSession_.add_torrent(params))); - return handlePtr; + //std::auto_ptr handlePtr(new QTorrentHandle(btSession_.add_torrent(params))); + QTorrentHandle handle = QTorrentHandle(btSession_.add_torrent(params)); + return handle; +} + + +void QBittorrentSession::removeTorrent(QTorrentHandle const& handle) +{ + btSession_.remove_torrent(handle.getHandle()); } // ========================== SLOTS ============================== -void QBittorrentSession::on_alert(TorrentAlert const *al) +void QBittorrentSession::on_alert(Alert const *al) //NOTE: al parameter not necessarily needed here, as we pop_alert() now! { @@ -59,8 +66,9 @@ void QBittorrentSession::on_alert(TorrentAlert const *al) // if (al) // qDebug() << "on_alert():" << QString::fromStdString(al->message()); - std::auto_ptr alertPtr = btSession_.pop_alert(); + std::auto_ptr alertPtr = btSession_.pop_alert(); emit alert(alertPtr); } +