Browse Source

- Added priority buttons

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
ca118697e9
  1. 39
      src/GUI.cpp
  2. 2
      src/GUI.h
  3. 56
      src/MainWindow.ui
  4. 4
      src/bittorrent.cpp

39
src/GUI.cpp

@ -1227,6 +1227,45 @@ void GUI::on_actionPause_All_triggered() { @@ -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;

2
src/GUI.h

@ -162,6 +162,8 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -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);

56
src/MainWindow.ui

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>849</width>
<width>914</width>
<height>563</height>
</rect>
</property>
@ -16,22 +16,14 @@ @@ -16,22 +16,14 @@
<string/>
</property>
<widget class="QWidget" name="centralwidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>58</y>
<width>849</width>
<height>482</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vboxLayout" />
<layout class="QVBoxLayout" />
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>849</width>
<width>914</width>
<height>26</height>
</rect>
</property>
@ -83,14 +75,6 @@ @@ -83,14 +75,6 @@
<property name="enabled" >
<bool>true</bool>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>26</y>
<width>849</width>
<height>32</height>
</rect>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
@ -126,20 +110,14 @@ @@ -126,20 +110,14 @@
<addaction name="actionStart_All" />
<addaction name="actionPause_All" />
<addaction name="separator" />
<addaction name="actionDecreasePriority" />
<addaction name="actionIncreasePriority" />
<addaction name="separator" />
<addaction name="actionOptions" />
<addaction name="actionExit" />
<addaction name="separator" />
</widget>
<widget class="QStatusBar" name="statusBar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>540</y>
<width>849</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusBar" />
<action name="actionOpen" >
<property name="text" >
<string>Open</string>
@ -250,7 +228,25 @@ @@ -250,7 +228,25 @@
<string>Set global upload limit</string>
</property>
</action>
<action name="actionDecreasePriority" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/downarrow.png</iconset>
</property>
<property name="text" >
<string>Decrease priority</string>
</property>
</action>
<action name="actionIncreasePriority" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/uparrow.png</iconset>
</property>
<property name="text" >
<string>Increase priority</string>
</property>
</action>
</widget>
<resources/>
<resources>
<include location="icons.qrc" />
</resources>
<connections/>
</ui>

4
src/bittorrent.cpp

@ -162,7 +162,7 @@ void bittorrent::setMaxActiveDlTorrents(int val) { @@ -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) { @@ -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)) {

Loading…
Cancel
Save