Add max data rate option for when idle.

This commit is contained in:
Phenom 2022-01-15 19:03:06 +01:00
parent 91dd22d8d3
commit 9178bc53ef
4 changed files with 115 additions and 15 deletions

View File

@ -1483,6 +1483,9 @@ void MainWindow::setStatus(QObject *pObject, int nStatus)
setStatusObject(*it, nStatus);
}
}
rsConfig->setIsIdle(isIdle);
rsConfig->setOperatingMode(rsConfig->getOperatingMode());
}
/* new status from context menu */

View File

@ -159,10 +159,10 @@ void QuickStartWizard::on_pushButtonConnectionNext_clicked()
{
rsPeers->setVisState(rsPeers->getOwnId(), vs_disc, vs_dht);
}
rsConfig->SetMaxDataRates( ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value() );
ui.pagesWizard->setCurrentIndex(2);
rsConfig->setMaxDataRates( ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value(), ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value() );
ui.pagesWizard->setCurrentIndex(2);
}
void QuickStartWizard::on_pushButtonConnectionExit_clicked()
@ -488,10 +488,12 @@ void QuickStartWizard::loadNetwork()
ui.discoveryComboBox->setCurrentIndex(netIndex);
int dlrate = 0;
int ulrate = 0;
rsConfig->GetMaxDataRates(dlrate, ulrate);
ui.doubleSpinBoxDownloadSpeed->setValue(dlrate);
ui.doubleSpinBoxUploadSpeed->setValue(ulrate);
int ulrate = 0;
int dlratewi = 0;
int ulratewi = 0;
rsConfig->getMaxDataRates(dlrate, ulrate, dlratewi, ulratewi);
ui.doubleSpinBoxDownloadSpeed->setValue(dlrate);
ui.doubleSpinBoxUploadSpeed->setValue(ulrate);
}
@ -575,7 +577,7 @@ void QuickStartWizard::saveChanges()
rsPeers->setExtAddress(rsPeers->getOwnId(), ui.extAddress->text().toStdString(), ui.extPort->value());
}*/
rsConfig->SetMaxDataRates( ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value() );
rsConfig->setMaxDataRates( ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value(), ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value() );
loadNetwork();
}

View File

@ -231,6 +231,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.totalDownloadRate,SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
connect(ui.totalUploadRate, SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
connect(ui.totalDownloadRateWhenIdle,SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
connect(ui.totalUploadRateWhenIdle, SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
//Relay Tab
QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions()));
@ -455,9 +457,13 @@ void ServerPage::load()
int dlrate = 0;
int ulrate = 0;
rsConfig->GetMaxDataRates(dlrate, ulrate);
int dlratewi = 0;
int ulratewi = 0;
rsConfig->getMaxDataRates(dlrate, ulrate, dlratewi, ulratewi);
whileBlocking(ui.totalDownloadRate)->setValue(dlrate);
whileBlocking(ui.totalUploadRate)->setValue(ulrate);
whileBlocking(ui.totalDownloadRateWhenIdle)->setValue(dlratewi);
whileBlocking(ui.totalUploadRateWhenIdle)->setValue(ulratewi);
toggleUPnP();
@ -1083,7 +1089,10 @@ void ServerPage::saveAddresses()
void ServerPage::saveRates()
{
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
rsConfig->setMaxDataRates( ui.totalDownloadRate->value()
, ui.totalUploadRate->value()
, ui.totalDownloadRateWhenIdle->value()
, ui.totalUploadRateWhenIdle->value());
}
void ServerPage::tabChanged(int page)
@ -1169,9 +1178,13 @@ void ServerPage::loadHiddenNode()
// Download Rates - Stay the same as before.
int dlrate = 0;
int ulrate = 0;
rsConfig->GetMaxDataRates(dlrate, ulrate);
int dlratewi = 0;
int ulratewi = 0;
rsConfig->getMaxDataRates(dlrate, ulrate, dlratewi, ulratewi);
whileBlocking(ui.totalDownloadRate)->setValue(dlrate);
whileBlocking(ui.totalUploadRate)->setValue(ulrate);
whileBlocking(ui.totalDownloadRateWhenIdle)->setValue(dlratewi);
whileBlocking(ui.totalUploadRateWhenIdle)->setValue(ulratewi);
// Addresses.
ui.localAddress->setEnabled(false);
@ -1363,7 +1376,10 @@ void ServerPage::saveAddressesHiddenNode()
rsPeers->setHiddenNode(ownId, hiddenAddr, hiddenPort);
}
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
rsConfig->setMaxDataRates( ui.totalDownloadRate->value()
, ui.totalUploadRate->value()
, ui.totalDownloadRateWhenIdle->value()
, ui.totalUploadRateWhenIdle->value() );
load();
}

View File

@ -90,7 +90,7 @@
</font>
</property>
<property name="text">
<string>Download limit (KB/s) </string>
<string>Download limit when active (KB/s) </string>
</property>
</widget>
</item>
@ -103,7 +103,33 @@
</font>
</property>
<property name="text">
<string>Upload limit (KB/s) </string>
<string>Upload limit when active (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_totalDownloadRateWhenIdle">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Download limit when idle (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_totalUploadRateWhenIdle">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Upload limit when idle (KB/s) </string>
</property>
</widget>
</item>
@ -139,6 +165,31 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QSpinBox" name="totalDownloadRateWhenIdle">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This download limit covers the whole application. However, in some situations, such as when transfering many small files at once, the estimated bandwidth becomes unreliable and the total value reported by Retroshare might exceed that limit. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="suffix">
<string>kB/s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="localAddress"/>
</item>
@ -361,6 +412,34 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QSpinBox" name="totalUploadRateWhenIdle">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The upload limit covers the entire software. Too small an upload limit might eventually block low priority services (forums, channels). A minimum recommended value is 50KB/s. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="suffix">
<string>kB/s</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="3">
<layout class="QGridLayout" name="gLayout_upnp">
<property name="leftMargin">
@ -451,7 +530,7 @@
</item>
</layout>
</item>
<item row="5" column="1" rowspan="2" colspan="3">
<item row="5" column="1" rowspan="4" colspan="3">
<widget class="QLabel" name="info_warningBandwidth">
<property name="palette">
<palette>