mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
- Allow to set global upload/download bandwidth limit from tray icon menu
- Fixed a bug in bandwidth limitation per torrent (confused bytes with kbytes) - Fixed a bug with paused torrents still displayed as checking
This commit is contained in:
parent
eed49c10ce
commit
8c5d38400a
8 changed files with 196 additions and 63 deletions
|
@ -19,6 +19,8 @@
|
||||||
- FEATURE: Filtered files are not allocated on the hard-drive anymore (sparse file support)
|
- FEATURE: Filtered files are not allocated on the hard-drive anymore (sparse file support)
|
||||||
- FEATURE: IPs blocked by filter are now logged in GUI
|
- FEATURE: IPs blocked by filter are now logged in GUI
|
||||||
- FEATURE: Added a way to link against static libtorrent (useful for deb packages)
|
- FEATURE: Added a way to link against static libtorrent (useful for deb packages)
|
||||||
|
- FEATURE: Allow to set global upload/download limits from tray icon menu
|
||||||
|
- FEATURE: IPv6 is now fully supported
|
||||||
- I18N: Added Hungarian translation
|
- I18N: Added Hungarian translation
|
||||||
- BUGFIX: Progress of paused torrents is now correct on restart
|
- BUGFIX: Progress of paused torrents is now correct on restart
|
||||||
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
||||||
|
|
3
TODO
3
TODO
|
@ -43,4 +43,5 @@
|
||||||
- Fix all (or almost all) opened bugs in bug tracker
|
- Fix all (or almost all) opened bugs in bug tracker
|
||||||
- Fix sorting with Qt 4.3 - Reported to Trolltech, waiting for fix
|
- Fix sorting with Qt 4.3 - Reported to Trolltech, waiting for fix
|
||||||
- update sorting when a new torrent is added?
|
- update sorting when a new torrent is added?
|
||||||
- Allow to adjust UP/DL speed limit from tray icon menu
|
- Open -> cancel on tray icon closes qBT...
|
||||||
|
- Save bandwidth limits per torrent on hard disk
|
19
src/GUI.cpp
19
src/GUI.cpp
|
@ -101,6 +101,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
||||||
actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png")));
|
actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png")));
|
||||||
actionSet_upload_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
actionSet_upload_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
||||||
actionSet_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
|
actionSet_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
|
||||||
|
actionSet_global_upload_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
||||||
|
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
|
||||||
actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qb_question.png")));
|
actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qb_question.png")));
|
||||||
connecStatusLblIcon = new QLabel();
|
connecStatusLblIcon = new QLabel();
|
||||||
connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
|
connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
|
||||||
|
@ -340,6 +342,16 @@ void GUI::on_actionSet_upload_limit_triggered(){
|
||||||
new BandwidthAllocationDialog(this, true, &BTSession, hashes);
|
new BandwidthAllocationDialog(this, true, &BTSession, hashes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::on_actionSet_global_upload_limit_triggered(){
|
||||||
|
qDebug("actionSet_global_upload_limit_triggered");
|
||||||
|
new BandwidthAllocationDialog(this, true, &BTSession, QStringList());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::on_actionSet_global_download_limit_triggered(){
|
||||||
|
qDebug("actionSet_global_download_limit_triggered");
|
||||||
|
new BandwidthAllocationDialog(this, false, &BTSession, QStringList());
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::on_actionPreview_file_triggered(){
|
void GUI::on_actionPreview_file_triggered(){
|
||||||
if(tabs->currentIndex() > 1) return;
|
if(tabs->currentIndex() > 1) return;
|
||||||
bool inDownloadList = true;
|
bool inDownloadList = true;
|
||||||
|
@ -506,6 +518,9 @@ void GUI::updateDlList(bool force){
|
||||||
if(torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking){
|
if(torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking){
|
||||||
qDebug("Paused torrent finished checking with state: %d", torrentStatus.state);
|
qDebug("Paused torrent finished checking with state: %d", torrentStatus.state);
|
||||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
|
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
|
||||||
|
DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Paused")));
|
||||||
|
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/paused.png")), Qt::DecorationRole);
|
||||||
|
setRowColor(row, "red");
|
||||||
BTSession.pauseTorrent(fileHash);
|
BTSession.pauseTorrent(fileHash);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -816,6 +831,7 @@ void GUI::closeEvent(QCloseEvent *e){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hide();
|
||||||
// Save DHT entry
|
// Save DHT entry
|
||||||
BTSession.saveDHTEntry();
|
BTSession.saveDHTEntry();
|
||||||
// Save window size, columns size
|
// Save window size, columns size
|
||||||
|
@ -1572,6 +1588,9 @@ void GUI::createTrayIcon(){
|
||||||
myTrayIconMenu->addAction(actionOpen);
|
myTrayIconMenu->addAction(actionOpen);
|
||||||
myTrayIconMenu->addAction(actionDownload_from_URL);
|
myTrayIconMenu->addAction(actionDownload_from_URL);
|
||||||
myTrayIconMenu->addSeparator();
|
myTrayIconMenu->addSeparator();
|
||||||
|
myTrayIconMenu->addAction(actionSet_global_download_limit);
|
||||||
|
myTrayIconMenu->addAction(actionSet_global_upload_limit);
|
||||||
|
myTrayIconMenu->addSeparator();
|
||||||
myTrayIconMenu->addAction(actionStart_All);
|
myTrayIconMenu->addAction(actionStart_All);
|
||||||
myTrayIconMenu->addAction(actionPause_All);
|
myTrayIconMenu->addAction(actionPause_All);
|
||||||
myTrayIconMenu->addSeparator();
|
myTrayIconMenu->addSeparator();
|
||||||
|
|
|
@ -140,6 +140,8 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
void on_actionDelete_triggered();
|
void on_actionDelete_triggered();
|
||||||
void on_actionSet_download_limit_triggered();
|
void on_actionSet_download_limit_triggered();
|
||||||
void on_actionSet_upload_limit_triggered();
|
void on_actionSet_upload_limit_triggered();
|
||||||
|
void on_actionSet_global_upload_limit_triggered();
|
||||||
|
void on_actionSet_global_download_limit_triggered();
|
||||||
void on_actionDocumentation_triggered();
|
void on_actionDocumentation_triggered();
|
||||||
void checkConnectionStatus();
|
void checkConnectionStatus();
|
||||||
void configureSession(bool deleteOptions);
|
void configureSession(bool deleteOptions);
|
||||||
|
|
|
@ -15,14 +15,26 @@
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="unifiedTitleAndToolBarOnMac" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget" >
|
<widget class="QWidget" name="centralwidget" >
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabs" >
|
<widget class="QTabWidget" name="tabs" >
|
||||||
<property name="tabPosition" >
|
<property name="tabPosition" >
|
||||||
|
@ -36,28 +48,55 @@
|
||||||
<string>Downloads</string>
|
<string>Downloads</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="margin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<property name="margin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
|
@ -275,18 +314,25 @@
|
||||||
<string>Log</string>
|
<string>Log</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextBrowser" name="infoBar" >
|
<widget class="QTextBrowser" name="infoBar" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy>
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
<hsizetype>7</hsizetype>
|
|
||||||
<vsizetype>7</vsizetype>
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -309,12 +355,21 @@
|
||||||
<string>IP filter</string>
|
<string>IP filter</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextBrowser" name="textBlockedUsers" >
|
<widget class="QTextBrowser" name="textBlockedUsers" >
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
|
@ -408,7 +463,10 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="toolBarArea" >
|
<attribute name="toolBarArea" >
|
||||||
<number>4</number>
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak" >
|
||||||
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="actionOpen" />
|
<addaction name="actionOpen" />
|
||||||
<addaction name="actionDownload_from_URL" />
|
<addaction name="actionDownload_from_URL" />
|
||||||
|
@ -528,6 +586,16 @@
|
||||||
<string>Documentation</string>
|
<string>Documentation</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSet_global_download_limit" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Set global download limit</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionSet_global_upload_limit" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Set global upload limit</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QSettings>
|
||||||
#include "ui_bandwidth_limit.h"
|
#include "ui_bandwidth_limit.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
|
@ -34,49 +35,71 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
BandwidthAllocationDialog(QWidget *parent, bool uploadMode, bittorrent *BTSession, QStringList hashes): QDialog(parent), uploadMode(uploadMode){
|
BandwidthAllocationDialog(QWidget *parent, bool uploadMode, bittorrent *BTSession, QStringList hashes): QDialog(parent), uploadMode(uploadMode){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
qDebug("Bandwidth allocation dialog creation");
|
||||||
this->BTSession = BTSession;
|
this->BTSession = BTSession;
|
||||||
|
if(hashes.size() == 0)
|
||||||
|
global = true;
|
||||||
|
else
|
||||||
|
global = false;
|
||||||
if(uploadMode)
|
if(uploadMode)
|
||||||
lblTitle->setText(tr("Upload limit:"));
|
lblTitle->setText(tr("Upload limit:"));
|
||||||
else
|
else
|
||||||
lblTitle->setText(tr("Download limit:"));
|
lblTitle->setText(tr("Download limit:"));
|
||||||
connect(bandwidthSlider, SIGNAL(valueChanged(int)), this, SLOT(updateBandwidthLabel(int)));
|
connect(bandwidthSlider, SIGNAL(valueChanged(int)), this, SLOT(updateBandwidthLabel(int)));
|
||||||
QString hash;
|
if(!global){
|
||||||
foreach(hash, hashes){
|
QString hash;
|
||||||
torrent_handle h = BTSession->getTorrentHandle(hash);
|
foreach(hash, hashes){
|
||||||
if(!h.is_valid()){
|
torrent_handle h = BTSession->getTorrentHandle(hash);
|
||||||
qDebug("Error: Invalid Handle!");
|
if(!h.is_valid()){
|
||||||
continue;
|
qDebug("Error: Invalid Handle!");
|
||||||
}else{
|
continue;
|
||||||
handles << h;
|
}else{
|
||||||
|
handles << h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
unsigned int nbTorrents = handles.size();
|
||||||
unsigned int nbTorrents = handles.size();
|
if(!nbTorrents) close();
|
||||||
if(!nbTorrents) close();
|
int val;
|
||||||
int val;
|
if(nbTorrents == 1){
|
||||||
if(nbTorrents == 1){
|
torrent_handle h = handles.at(0);
|
||||||
torrent_handle h = handles.at(0);
|
if(uploadMode)
|
||||||
if(uploadMode)
|
val = h.upload_limit();
|
||||||
val = h.upload_limit();
|
else
|
||||||
else
|
val = h.download_limit();
|
||||||
val = h.download_limit();
|
qDebug("Bandwidth limit: %d", val);
|
||||||
qDebug("Bandwidth limit: %d", val);
|
if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum())
|
||||||
if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum())
|
val = -1;
|
||||||
val = -1;
|
bandwidthSlider->setValue(val);
|
||||||
bandwidthSlider->setValue(val);
|
if(val == -1) {
|
||||||
if(val == -1) {
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
|
kb_lbl->setText("");
|
||||||
|
} else {
|
||||||
|
limit_lbl->setText(QString(misc::toString(val).c_str()));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
qDebug("More than one torrent selected, no initilization");
|
||||||
|
bandwidthSlider->setValue(-1);
|
||||||
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
kb_lbl->setText("");
|
kb_lbl->setText("");
|
||||||
} else {
|
|
||||||
limit_lbl->setText(QString(misc::toString(val).c_str()));
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
qDebug("More than one torrent selected, no initilization");
|
// Global limit
|
||||||
bandwidthSlider->setValue(-1);
|
int val;
|
||||||
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
session *s = BTSession->getSession();
|
||||||
kb_lbl->setText("");
|
if(uploadMode)
|
||||||
|
val = (int)(s->upload_rate_limit()/1024.);
|
||||||
|
else
|
||||||
|
val = (int)(s->download_rate_limit()/1024.);
|
||||||
|
if(val == -1){
|
||||||
|
bandwidthSlider->setValue(-1);
|
||||||
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
|
kb_lbl->setText("");
|
||||||
|
}else{
|
||||||
|
bandwidthSlider->setValue(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth()));
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
~BandwidthAllocationDialog(){
|
~BandwidthAllocationDialog(){
|
||||||
|
@ -96,16 +119,28 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
|
|
||||||
void setBandwidth(){
|
void setBandwidth(){
|
||||||
int val = bandwidthSlider->value();
|
int val = bandwidthSlider->value();
|
||||||
torrent_handle h;
|
if(!global){
|
||||||
if(uploadMode) {
|
torrent_handle h;
|
||||||
foreach(h, handles) {
|
if(uploadMode) {
|
||||||
h.set_upload_limit(val);
|
foreach(h, handles) {
|
||||||
qDebug("Setting upload limit");
|
h.set_upload_limit(val*1024);
|
||||||
|
qDebug("Setting upload limit");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach(h, handles) {
|
||||||
|
h.set_download_limit(val*1024);
|
||||||
|
qDebug("Setting download limit");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
foreach(h, handles) {
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
h.set_download_limit(val);
|
session *s = BTSession->getSession();
|
||||||
qDebug("Setting download limit");
|
if(uploadMode){
|
||||||
|
s->set_upload_rate_limit(val*1024);
|
||||||
|
settings.setValue("Options/Main/UPLimit", val);
|
||||||
|
}else{
|
||||||
|
s->set_download_rate_limit(val*1024);
|
||||||
|
settings.setValue("Options/Main/DLLimit", val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
|
@ -113,6 +148,7 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool uploadMode;
|
bool uploadMode;
|
||||||
|
bool global;
|
||||||
bittorrent *BTSession;
|
bittorrent *BTSession;
|
||||||
QList<torrent_handle> handles;
|
QList<torrent_handle> handles;
|
||||||
};
|
};
|
||||||
|
|
|
@ -594,6 +594,10 @@ void bittorrent::setDownloadRateLimit(int rate){
|
||||||
s->set_download_rate_limit(rate);
|
s->set_download_rate_limit(rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session* bittorrent::getSession() const{
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
// Set upload rate limit
|
// Set upload rate limit
|
||||||
// -1 to disable
|
// -1 to disable
|
||||||
void bittorrent::setUploadRateLimit(int rate){
|
void bittorrent::setUploadRateLimit(int rate){
|
||||||
|
|
|
@ -85,6 +85,7 @@ class bittorrent : public QObject{
|
||||||
long getETA(QString hash) const;
|
long getETA(QString hash) const;
|
||||||
size_type torrentEffectiveSize(QString hash) const;
|
size_type torrentEffectiveSize(QString hash) const;
|
||||||
bool inFullAllocationMode(const QString& hash) const;
|
bool inFullAllocationMode(const QString& hash) const;
|
||||||
|
session* getSession() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addTorrent(const QString& path, bool fromScanDir = false, bool onStartup = false, const QString& from_url = QString());
|
void addTorrent(const QString& path, bool fromScanDir = false, bool onStartup = false, const QString& from_url = QString());
|
||||||
|
|
Loading…
Reference in a new issue