+ on_openAction_clicked();
+ } else if (action->text() == "Remove") {
+ on_removeAction_clicked();
+ }
+}
+
+void MainWindow::on_torrentFileSelected(const QString& file)
+{
+#ifdef QTRAPIDS_DEBUG
+ qDebug() << " MainWindow::on_torrentFileSelected(): " << file;
+#endif
+ // Torrent filename empty, do nothing.
+ if (file == "") {
+ return;
+ }
+
+ // Otherwise add torrent
+ // For params, see: http://www.rasterbar.com/products/libtorrent/manual.html#add-torrent
+ AddTorrentParams addParams;
+ boost::intrusive_ptr<libtorrent::torrent_info> tiTmp =
+ new libtorrent::torrent_info(boost::filesystem::path(file.toStdString()));
+ addParams.ti = tiTmp;
+ // 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;
+ qtrapids::QTorrentHandle handle = btSession_.addTorrent(addParams);
+ dlView_->newItem(handle);
+// torrentHandles_.push_back(handlePtr);
+#ifdef QTRAPIDS_DEBUG
+ qDebug() << "Is valid: " << handle.isValid();
+#endif
+}
+
+
+void MainWindow::on_alert(std::auto_ptr<Alert> al)
+{
+
+
+ if (al.get() != NULL) {
+// qDebug()
+// << "MainWindow::on_torrentAlert(): "
+// << QString::fromStdString(al->message());
+
+ TorrentAlert *torrentAlert
+ = dynamic_cast<TorrentAlert*> (al.get());
+
+ if (torrentAlert) {
+ qtrapids::QTorrentHandle torrentHandle = qtrapids::QTorrentHandle(torrentAlert->handle);
+ dlView_->updateItem(qtrapids::QTorrentHandle(torrentAlert->handle));
+ }
+