* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+
+#include <QDebug>
+
+#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();
}
}
+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);
+}
+
+