mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
- Some fixes in bandwidth allocation per torrent dialog
This commit is contained in:
parent
8e6b1be322
commit
ff756a2b1f
3 changed files with 46 additions and 23 deletions
2
TODO
2
TODO
|
@ -48,6 +48,7 @@
|
||||||
- Clean up delayed progress column sorting code
|
- Clean up delayed progress column sorting code
|
||||||
- Clean up pause after checking code
|
- Clean up pause after checking code
|
||||||
- Test rss now that it has been rewritten
|
- Test rss now that it has been rewritten
|
||||||
|
- Review speed allocation dialog : BTSession->getSession()->download_rate_limit() value is wrong
|
||||||
- Wait for some bug fixes in libtorrent :
|
- Wait for some bug fixes in libtorrent :
|
||||||
- upload/download limit per torrent (Ticket #83)
|
- upload/download limit per torrent (Ticket #83)
|
||||||
- double free or corruption on exit (Ticket #84)
|
- double free or corruption on exit (Ticket #84)
|
||||||
|
@ -71,5 +72,6 @@ beta3->beta4 changelog:
|
||||||
- BUGFIX: Fixed columns width problems in transfers lists due to hidden columns with non null size
|
- BUGFIX: Fixed columns width problems in transfers lists due to hidden columns with non null size
|
||||||
- BUGFIX: The deleteThread now check if the path exists before trying to delete it
|
- BUGFIX: The deleteThread now check if the path exists before trying to delete it
|
||||||
- BUGFIX: Finished list was refreshed even when main window was hidden (Hitted an assert)
|
- BUGFIX: Finished list was refreshed even when main window was hidden (Hitted an assert)
|
||||||
|
- BUGFIX: Some fixes in bandwidth limiting per torrent
|
||||||
- I18N: Updated Chinese, Hungarian and Italian translations
|
- I18N: Updated Chinese, Hungarian and Italian translations
|
||||||
- COSMETIC: Added our new baby mascot ("Draqoo") to About dialog
|
- COSMETIC: Added our new baby mascot ("Draqoo") to About dialog
|
|
@ -52,26 +52,32 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
if(!global){
|
if(!global){
|
||||||
unsigned int nbTorrents = hashes.size();
|
unsigned int nbTorrents = hashes.size();
|
||||||
if(!nbTorrents) close();
|
if(!nbTorrents) close();
|
||||||
int val;
|
int val = 0;
|
||||||
int max;
|
int max = -1;
|
||||||
if(nbTorrents == 1){
|
if(nbTorrents == 1){
|
||||||
torrent_handle h = BTSession->getTorrentHandle(hashes.at(0));
|
torrent_handle h = BTSession->getTorrentHandle(hashes.at(0));
|
||||||
if(uploadMode){
|
if(uploadMode){
|
||||||
|
if(h.upload_limit() > 0)
|
||||||
val = (int)(h.upload_limit() / 1024.);
|
val = (int)(h.upload_limit() / 1024.);
|
||||||
|
if(BTSession->getSession()->upload_rate_limit() > 0)
|
||||||
max = (int)(BTSession->getSession()->upload_rate_limit() / 1024.);
|
max = (int)(BTSession->getSession()->upload_rate_limit() / 1024.);
|
||||||
}else{
|
}else{
|
||||||
|
if(h.download_limit() > 0)
|
||||||
val = (int)(h.download_limit() / 1024.);
|
val = (int)(h.download_limit() / 1024.);
|
||||||
|
if(BTSession->getSession()->download_rate_limit() > 0){
|
||||||
|
qDebug("there is a global download rate limit at: %d kb/s", (int)(BTSession->getSession()->download_rate_limit() / 1024.));
|
||||||
max = (int)(BTSession->getSession()->download_rate_limit() / 1024.);
|
max = (int)(BTSession->getSession()->download_rate_limit() / 1024.);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(max != -1)
|
if(max != -1)
|
||||||
bandwidthSlider->setMaximum(max);
|
bandwidthSlider->setMaximum(max);
|
||||||
qDebug("Bandwidth limit: %d", val);
|
qDebug("Bandwidth limit: %d", val);
|
||||||
if(val > bandwidthSlider->maximum())
|
if(val > bandwidthSlider->maximum())
|
||||||
val = bandwidthSlider->maximum();
|
val = bandwidthSlider->maximum();
|
||||||
else if(val < bandwidthSlider->minimum())
|
else if(val < bandwidthSlider->minimum())
|
||||||
val = -1;
|
val = 0;
|
||||||
bandwidthSlider->setValue(val);
|
bandwidthSlider->setValue(val);
|
||||||
if(val == -1) {
|
if(val == 0) {
|
||||||
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
kb_lbl->setText("");
|
kb_lbl->setText("");
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,20 +85,23 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
qDebug("More than one torrent selected, no initilization");
|
qDebug("More than one torrent selected, no initilization");
|
||||||
bandwidthSlider->setValue(-1);
|
bandwidthSlider->setValue(0);
|
||||||
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
kb_lbl->setText("");
|
kb_lbl->setText("");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// Global limit
|
// Global limit
|
||||||
int val;
|
int val = 0;
|
||||||
session *s = BTSession->getSession();
|
session *s = BTSession->getSession();
|
||||||
if(uploadMode)
|
if(uploadMode){
|
||||||
|
if(s->upload_rate_limit() > 0)
|
||||||
val = (int)(s->upload_rate_limit()/1024.);
|
val = (int)(s->upload_rate_limit()/1024.);
|
||||||
else
|
}else{
|
||||||
|
if(s->download_rate_limit() > 0)
|
||||||
val = (int)(s->download_rate_limit()/1024.);
|
val = (int)(s->download_rate_limit()/1024.);
|
||||||
if(val == -1){
|
}
|
||||||
bandwidthSlider->setValue(-1);
|
if(val == 0){
|
||||||
|
bandwidthSlider->setValue(0);
|
||||||
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
kb_lbl->setText("");
|
kb_lbl->setText("");
|
||||||
}else{
|
}else{
|
||||||
|
@ -109,7 +118,7 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateBandwidthLabel(int val){
|
void updateBandwidthLabel(int val){
|
||||||
if(val == -1){
|
if(val == 0){
|
||||||
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
|
||||||
kb_lbl->setText("");
|
kb_lbl->setText("");
|
||||||
}else{
|
}else{
|
||||||
|
@ -125,11 +134,17 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
QString hash;
|
QString hash;
|
||||||
if(uploadMode) {
|
if(uploadMode) {
|
||||||
foreach(hash, hashes) {
|
foreach(hash, hashes) {
|
||||||
|
if(!val)
|
||||||
|
BTSession->setUploadLimit(hash, -1);
|
||||||
|
else
|
||||||
BTSession->setUploadLimit(hash, val*1024);
|
BTSession->setUploadLimit(hash, val*1024);
|
||||||
qDebug("Setting upload limit");
|
qDebug("Setting upload limit");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach(hash, hashes) {
|
foreach(hash, hashes) {
|
||||||
|
if(!val)
|
||||||
|
BTSession->setDownloadLimit(hash, -1);
|
||||||
|
else
|
||||||
BTSession->setDownloadLimit(hash, val*1024);
|
BTSession->setDownloadLimit(hash, val*1024);
|
||||||
qDebug("Setting download limit");
|
qDebug("Setting download limit");
|
||||||
}
|
}
|
||||||
|
@ -138,9 +153,15 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
session *s = BTSession->getSession();
|
session *s = BTSession->getSession();
|
||||||
if(uploadMode){
|
if(uploadMode){
|
||||||
|
if(!val)
|
||||||
|
s->set_upload_rate_limit(-1);
|
||||||
|
else
|
||||||
s->set_upload_rate_limit(val*1024);
|
s->set_upload_rate_limit(val*1024);
|
||||||
settings.setValue("Options/Main/UPLimit", val);
|
settings.setValue("Options/Main/UPLimit", val);
|
||||||
}else{
|
}else{
|
||||||
|
if(!val)
|
||||||
|
s->set_download_rate_limit(-1);
|
||||||
|
else
|
||||||
s->set_download_rate_limit(val*1024);
|
s->set_download_rate_limit(val*1024);
|
||||||
settings.setValue("Options/Main/DLLimit", val);
|
settings.setValue("Options/Main/DLLimit", val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,13 +66,13 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="bandwidthSlider" >
|
<widget class="QSlider" name="bandwidthSlider" >
|
||||||
<property name="minimum" >
|
<property name="minimum" >
|
||||||
<number>-1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum" >
|
<property name="maximum" >
|
||||||
<number>1000</number>
|
<number>1000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="sliderPosition" >
|
<property name="sliderPosition" >
|
||||||
<number>-1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue