diff --git a/src/GUI.cpp b/src/GUI.cpp index 80cd69e7e..75d06dff5 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -1227,6 +1227,45 @@ void GUI::on_actionPause_All_triggered() { } } +void GUI::on_actionIncreasePriority_triggered() { + bool inDownloadList = true; + if(tabs->currentIndex() > 1) return; + if(tabs->currentIndex() == 1) + inDownloadList = false; + if(!inDownloadList) + return; + QStringList hashes; + if(inDownloadList) { + hashes = downloadingTorrentTab->getSelectedTorrents(); + } else { + hashes = finishedTorrentTab->getSelectedTorrents(); + } + foreach(QString hash, hashes) { + BTSession->increaseDlTorrentPriority(hash); + downloadingTorrentTab->updateDlList(); + } +} + +void GUI::on_actionDecreasePriority_triggered() { + bool inDownloadList = true; + if(tabs->currentIndex() > 1) return; + if(tabs->currentIndex() == 1) + inDownloadList = false; + if(!inDownloadList) + return; + QStringList hashes; + if(inDownloadList) { + hashes = downloadingTorrentTab->getSelectedTorrents(); + } else { + hashes = finishedTorrentTab->getSelectedTorrents(); + } + QString hash; + foreach(QString hash, hashes) { + BTSession->decreaseDlTorrentPriority(hash); + downloadingTorrentTab->updateDlList(); + } +} + // pause selected items in the list void GUI::on_actionPause_triggered() { bool inDownloadList = true; diff --git a/src/GUI.h b/src/GUI.h index 21516ba7d..7b5c4fb82 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -162,6 +162,8 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void updateLists(); bool initWebUi(QString username, QString password, int port); void pauseTorrent(QString hash); + void on_actionIncreasePriority_triggered(); + void on_actionDecreasePriority_triggered(); // Options slots void on_actionOptions_triggered(); void OptionsSaved(QString info, bool deleteOptions); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index d548c031d..0a8cd882e 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -5,7 +5,7 @@ 0 0 - 849 + 914 563 @@ -16,22 +16,14 @@ - - - 0 - 58 - 849 - 482 - - - + 0 0 - 849 + 914 26 @@ -83,14 +75,6 @@ true - - - 0 - 26 - 849 - 32 - - Qt::NoContextMenu @@ -126,20 +110,14 @@ + + + - - - - 0 - 540 - 849 - 23 - - - + Open @@ -250,7 +228,25 @@ Set global upload limit + + + :/Icons/downarrow.png + + + Decrease priority + + + + + :/Icons/uparrow.png + + + Increase priority + + - + + + diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index abfb31952..19b0327c2 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -162,7 +162,7 @@ void bittorrent::setMaxActiveDlTorrents(int val) { maxActiveDlTorrents = val; } -void bittorrent::decreaseDlTorrentPriority(QString hash) { +void bittorrent::increaseDlTorrentPriority(QString hash) { int index = downloadQueue->indexOf(hash); Q_ASSERT(index != -1); if(index > 0) { @@ -173,7 +173,7 @@ void bittorrent::decreaseDlTorrentPriority(QString hash) { } } -void bittorrent::increaseDlTorrentPriority(QString hash) { +void bittorrent::decreaseDlTorrentPriority(QString hash) { int index = downloadQueue->indexOf(hash); Q_ASSERT(index != -1); if(index >= 0 && index < (downloadQueue->size()-1)) {