Browse Source

- Fixed downloadFromUrl() (still have to do some checking with the thread)

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
524540e63d
  1. 10
      src/GUI.cpp
  2. 2
      src/GUI.h
  3. 1
      src/bittorrent.cpp
  4. 1
      src/bittorrent.h

10
src/GUI.cpp

@ -130,6 +130,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ @@ -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{ @@ -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){ @@ -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)));
}

2
src/GUI.h

@ -151,6 +151,8 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -151,6 +151,8 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void addUnauthenticatedTracker(QPair<torrent_handle,std::string> 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();

1
src/bittorrent.cpp

@ -672,6 +672,7 @@ QString bittorrent::getSavePath(const QString& hash){ @@ -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);
}

1
src/bittorrent.h

@ -135,6 +135,7 @@ class bittorrent : public QObject{ @@ -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

Loading…
Cancel
Save