#include "MainWindow.h"
-
const QString ABOUT_TEXT
= QString(QObject::trUtf8("QtRapids, a simple BitTorrent client based on"
"\nQt and Libtorrent."
// Tab widget as central widget.
setCentralWidget(tabWidget_);
-
// TOOLBAR
QToolBar *toolBar = new QToolBar();
toolBar->addAction(tr("Open"));
addToolBar(Qt::TopToolBarArea, toolBar);
connect(toolBar, SIGNAL(actionTriggered(QAction*)), this, SLOT(handleToolBarAction(QAction*)));
+
+ connect(&btSession_, SIGNAL(alert(std::auto_ptr<TorrentAlert>)),
+ this, SLOT(on_torrentAlert(std::auto_ptr<TorrentAlert>)));
}
boost::intrusive_ptr<libtorrent::torrent_info> tiTmp =
new libtorrent::torrent_info(boost::filesystem::path(file.toStdString()));
addParams.ti = tiTmp;
- addParams.save_path = boost::filesystem::path(settings_.value("download/directory").toString().toStdString()); // The only mandatory parameter, rest are optional.
+ // save_path is the only mandatory parameter, rest are optional.
+ addParams.save_path = boost::filesystem::path(settings_.value("download/directory").toString().toStdString());
//addParams.storage_mode = libtorrent::storage_mode_allocate;
- btSession_.addTorrent(addParams);
+ std::auto_ptr<QTorrentHandle> handlePtr = btSession_.addTorrent(addParams);
+ dlView_->newItem(handlePtr.get());
+ qDebug() << "Is valid: " << handlePtr->isValid();
}
+
+void MainWindow::on_torrentAlert(std::auto_ptr<TorrentAlert> al)
+{
+ if (al.get() != NULL)
+ qDebug() << "MainWindow::on_torrentAlert(): " << QString::fromStdString(al->message());
+}
\ No newline at end of file