- Added PreferencesDialog with settings saving and reading.
[qtrapids] / src / engine / QBittorrentSession.cpp
index 4cefcec..e0d6c5c 100644 (file)
@@ -30,6 +30,7 @@ QBittorrentSession::QBittorrentSession(QObject *parent):
                alertWaiter_(NULL)
 {
        alertWaiter_ = new AlertWaiterThread(&btSession_, this);
+       alertWaiter_->allAlerts();
        connect(alertWaiter_, SIGNAL(alert(TorrentAlert const*)), this, SLOT(on_alert(TorrentAlert const*)));
        alertWaiter_->start();
 }
@@ -44,15 +45,23 @@ QTorrentHandle QBittorrentSession::addTorrent(AddTorrentParams const& params)
 {
        // Delegate to Libtorrent and return QTorrentHandle.
        QTorrentHandle handle(btSession_.add_torrent(params));
+       qDebug() << "Is valid: " << handle.isValid();
        return handle;
 }
 
 
 // ========================== SLOTS ==============================
-void QBittorrentSession::on_alert(TorrentAlert const *al)
+void QBittorrentSession::on_alert(TorrentAlert const *al) 
+               //NOTE: al parameter not necessarily needed here, as we pop_alert() now!
 {
+       
        qDebug() << "QBittorrentSession:on_alert(" << al << ")";
-       emit alert(al);
+//     if (al)
+//             qDebug() << "on_alert():" << QString::fromStdString(al->message());
+       
+       
+       std::auto_ptr<TorrentAlert> alertPtr = btSession_.pop_alert();
+       emit alert(alertPtr);
 }