From c580285fe83177b3e196c5b6272727080e4cacf8 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 16 Nov 2007 18:53:21 +0000 Subject: [PATCH] - Allow to open destination folder on right click on a torrent --- TODO | 8 ----- src/FinishedTorrents.cpp | 2 ++ src/GUI.cpp | 24 +++++++++++++++ src/GUI.h | 1 + src/download.ui | 60 ++++++++++++++++++++++++++++++++----- src/downloadingTorrents.cpp | 2 ++ src/seeding.ui | 27 ++++++++++++++--- 7 files changed, 104 insertions(+), 20 deletions(-) diff --git a/TODO b/TODO index 8ba067692..6ada0e75b 100644 --- a/TODO +++ b/TODO @@ -46,13 +46,5 @@ - Display in torrent addition dialog: * free disk space on selected drive * free disk space after torrent download (and/or torrent size) -- Add "Open destination dir" on right click - Use ShareMonkey Web service (http://www.sharemonkey.com/) -// in v1.0.0 - FEATURE FREEZE -- Fix all (or almost all) opened bugs in bug tracker -- Recheck doc -- Translations update (IN PROGRESS) -// RC8 -- BUGFIX: Fix destination save dir in addition dialog - diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index 2bdd72e77..a47154198 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -69,6 +69,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par connect(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_triggered())); connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_triggered())); connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); + connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); } @@ -352,6 +353,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ myFinishedListMenu.addSeparator(); myFinishedListMenu.addAction(actionSet_upload_limit); myFinishedListMenu.addSeparator(); + myFinishedListMenu.addAction(actionOpen_destination_folder); myFinishedListMenu.addAction(actionTorrent_Properties); // Call menu // XXX: why mapToGlobal() is not enough? diff --git a/src/GUI.cpp b/src/GUI.cpp index dcafb2ee1..753f419cd 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -386,6 +386,30 @@ void GUI::on_actionPreview_file_triggered() { new previewSelect(this, h); } +void GUI::openDestinationFolder() const { + QStringList hashes; + switch(tabs->currentIndex()){ + case 0: + hashes = downloadingTorrentTab->getSelectedTorrents(true); + break; + case 1: + hashes = finishedTorrentTab->getSelectedTorrents(true); + break; + default: + return; + } + QString hash; + QStringList pathsList; + foreach(hash, hashes) { + QTorrentHandle h = BTSession->getTorrentHandle(hash); + QString savePath = h.save_path(); + if(!pathsList.contains(savePath)) { + pathsList.append(savePath); + QDesktopServices::openUrl(QUrl(savePath)); + } + } +} + // Necessary if we want to close the window // in one time if "close to systray" is enabled void GUI::on_actionExit_triggered() { diff --git a/src/GUI.h b/src/GUI.h index e6da7752d..4bff4216d 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -146,6 +146,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ public slots: void trackerAuthenticationRequired(QTorrentHandle& h); void setTabText(int index, QString text) const; + void openDestinationFolder() const; protected: void closeEvent(QCloseEvent *); diff --git a/src/download.ui b/src/download.ui index f38874957..27167d847 100644 --- a/src/download.ui +++ b/src/download.ui @@ -18,7 +18,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -26,7 +35,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -249,15 +267,22 @@ 6 - + + 9 + + + 9 + + + 9 + + 9 - - 7 - 7 + 0 0 @@ -283,7 +308,16 @@ 6 - + + 9 + + + 9 + + + 9 + + 9 @@ -346,7 +380,17 @@ Torrent Properties + + + :/Icons/folder.png + + + Open destination folder + + - + + + diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index 24480602b..e98051ed9 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -93,6 +93,7 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) connect(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_triggered())); connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_triggered())); connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); + connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); // Set info Bar infos setInfoBar(tr("qBittorrent %1 started.", "e.g: qBittorrent v0.x started.").arg(QString::fromUtf8(""VERSION))); @@ -286,6 +287,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { myDLLlistMenu.addAction(actionSet_download_limit); myDLLlistMenu.addAction(actionSet_upload_limit); myDLLlistMenu.addSeparator(); + myDLLlistMenu.addAction(actionOpen_destination_folder); myDLLlistMenu.addAction(actionTorrent_Properties); // Call menu // XXX: why mapToGlobal() is not enough? diff --git a/src/seeding.ui b/src/seeding.ui index 73229ee6a..255c0009f 100644 --- a/src/seeding.ui +++ b/src/seeding.ui @@ -13,12 +13,21 @@ Search - - 9 - 6 + + 9 + + + 9 + + + 9 + + + 9 + @@ -84,7 +93,17 @@ Set upload limit + + + :/Icons/folder.png + + + Open destination folder + + - + + +