diff --git a/src/GUI.cpp b/src/GUI.cpp index 76dd65d4c..f63a78223 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -130,6 +130,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ connect(&BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&))); connect(&BTSession, SIGNAL(scanDirFoundTorrents(const QStringList&)), this, SLOT(processScannedFiles(const QStringList&))); connect(&BTSession, SIGNAL(newDownloadedTorrent(const QString&, const QString&)), this, SLOT(processDownloadedFiles(const QString&, const QString&))); + connect(&BTSession, SIGNAL(aboutToDownloadFromUrl(const QString&)), this, SLOT(displayDownloadingUrlInfos(const QString&))); // creating options options = new options_imp(this); connect(options, SIGNAL(status_changed(const QString&)), this, SLOT(OptionsSaved(const QString&))); @@ -1812,6 +1813,14 @@ int GUI::getRowFromHash(const QString& hash) const{ return -1; } +void GUI::downloadFromURLList(const QStringList& urls){ + BTSession.downloadFromURLList(urls); +} + +void GUI::displayDownloadingUrlInfos(const QString& url){ + setInfoBar(tr("Downloading", "Example: Downloading www.example.com/test.torrent")+" '"+url+"', "+tr("Please wait..."), "black"); +} + /***************************************************** * * * Options * @@ -1848,4 +1857,5 @@ void GUI::OptionsSaved(const QString& info){ // an url void GUI::askForTorrentUrl(){ downloadFromURLDialog = new downloadFromURL(this); + connect(downloadFromURLDialog, SIGNAL(downloadFinished(QString, QString, int, QString)), &BTSession, SLOT(processDownloadedFile(QString, QString, int, QString))); } diff --git a/src/GUI.h b/src/GUI.h index 066de5520..7a873b81f 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -151,6 +151,8 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void addUnauthenticatedTracker(QPair tracker); void processScannedFiles(const QStringList& params); void processDownloadedFiles(const QString& path, const QString& url); + void downloadFromURLList(const QStringList& urls); + void displayDownloadingUrlInfos(const QString& url); // Search slots void on_search_button_clicked(); void on_stop_search_button_clicked(); diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 31f7f5428..304ea8112 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -672,6 +672,7 @@ QString bittorrent::getSavePath(const QString& hash){ // download the torrent file to a tmp location, then // add it to download list void bittorrent::downloadFromUrl(const QString& url){ + emit aboutToDownloadFromUrl(url); // Launch downloader thread downloader->downloadUrl(url); } diff --git a/src/bittorrent.h b/src/bittorrent.h index 48d0e12d9..fd12030a7 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -135,6 +135,7 @@ class bittorrent : public QObject{ void downloadFromUrlFailure(const QString& url, const QString& error); void scanDirFoundTorrents(const QStringList& pathList); void newDownloadedTorrent(const QString& path, const QString& url); + void aboutToDownloadFromUrl(const QString& url); }; #endif