mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-30 05:52:33 +02:00
Qt/Options: Expose maxuploadtarget in GUI using rwconf
This commit is contained in:
parent
ea9ad3d1ff
commit
8518a3e56e
@ -672,6 +672,46 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_maxuploadtarget">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="maxuploadtargetCheckbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Try to keep upload traffic under</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="maxuploadtarget"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="maxuploadtargetUnitLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>MB per day</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>maxuploadtargetCheckbox</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_maxuploadtarget">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_Network">
|
<spacer name="verticalSpacer_Network">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -132,6 +132,10 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
|||||||
connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyPortTor, &QWidget::setEnabled);
|
connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyPortTor, &QWidget::setEnabled);
|
||||||
connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState);
|
connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState);
|
||||||
|
|
||||||
|
ui->maxuploadtarget->setMinimum(144 /* MB/day */);
|
||||||
|
ui->maxuploadtarget->setMaximum(std::numeric_limits<int>::max());
|
||||||
|
connect(ui->maxuploadtargetCheckbox, SIGNAL(toggled(bool)), ui->maxuploadtarget, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
/* Window elements init */
|
/* Window elements init */
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
/* remove Window tab on Mac */
|
/* remove Window tab on Mac */
|
||||||
@ -324,6 +328,20 @@ void OptionsDialog::setMapper()
|
|||||||
mapper->addMapping(ui->proxyIpTor, OptionsModel::ProxyIPTor);
|
mapper->addMapping(ui->proxyIpTor, OptionsModel::ProxyIPTor);
|
||||||
mapper->addMapping(ui->proxyPortTor, OptionsModel::ProxyPortTor);
|
mapper->addMapping(ui->proxyPortTor, OptionsModel::ProxyPortTor);
|
||||||
|
|
||||||
|
int current_maxuploadtarget = model->data(model->index(OptionsModel::maxuploadtarget, 0), Qt::EditRole).toInt();
|
||||||
|
if (current_maxuploadtarget == 0) {
|
||||||
|
ui->maxuploadtargetCheckbox->setChecked(false);
|
||||||
|
ui->maxuploadtarget->setEnabled(false);
|
||||||
|
ui->maxuploadtarget->setValue(ui->maxuploadtarget->minimum());
|
||||||
|
} else {
|
||||||
|
if (current_maxuploadtarget < ui->maxuploadtarget->minimum()) {
|
||||||
|
ui->maxuploadtarget->setMinimum(current_maxuploadtarget);
|
||||||
|
}
|
||||||
|
ui->maxuploadtargetCheckbox->setChecked(true);
|
||||||
|
ui->maxuploadtarget->setEnabled(true);
|
||||||
|
ui->maxuploadtarget->setValue(current_maxuploadtarget);
|
||||||
|
}
|
||||||
|
|
||||||
/* Window */
|
/* Window */
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
@ -431,6 +449,12 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
model->setData(model->index(OptionsModel::FontForMoney, 0), ui->moneyFont->itemData(ui->moneyFont->currentIndex()));
|
model->setData(model->index(OptionsModel::FontForMoney, 0), ui->moneyFont->itemData(ui->moneyFont->currentIndex()));
|
||||||
model->setData(model->index(OptionsModel::FontForQRCodes, 0), ui->qrFont->itemData(ui->qrFont->currentIndex()));
|
model->setData(model->index(OptionsModel::FontForQRCodes, 0), ui->qrFont->itemData(ui->qrFont->currentIndex()));
|
||||||
|
|
||||||
|
if (ui->maxuploadtargetCheckbox->isChecked()) {
|
||||||
|
model->setData(model->index(OptionsModel::maxuploadtarget, 0), ui->maxuploadtarget->value());
|
||||||
|
} else {
|
||||||
|
model->setData(model->index(OptionsModel::maxuploadtarget, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
mapper->submit();
|
mapper->submit();
|
||||||
accept();
|
accept();
|
||||||
updateDefaultProxyNets();
|
updateDefaultProxyNets();
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <node/chainstatemanager_args.h>
|
#include <node/chainstatemanager_args.h>
|
||||||
|
#include <node/context.h>
|
||||||
#include <txdb.h> // for -dbcache defaults
|
#include <txdb.h> // for -dbcache defaults
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
|
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
|
||||||
@ -512,6 +513,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return SettingToBool(setting(), false);
|
return SettingToBool(setting(), false);
|
||||||
case MaskValues:
|
case MaskValues:
|
||||||
return m_mask_values;
|
return m_mask_values;
|
||||||
|
case maxuploadtarget:
|
||||||
|
return qlonglong(node().context()->connman->GetMaxOutboundTarget() / 1024 / 1024);
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -752,6 +755,14 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
m_mask_values = value.toBool();
|
m_mask_values = value.toBool();
|
||||||
settings.setValue("mask_values", m_mask_values);
|
settings.setValue("mask_values", m_mask_values);
|
||||||
break;
|
break;
|
||||||
|
case maxuploadtarget:
|
||||||
|
{
|
||||||
|
if (changed()) {
|
||||||
|
gArgs.ModifyRWConfigFile("maxuploadtarget", value.toString().toStdString());
|
||||||
|
node().context()->connman->SetMaxOutboundTarget(value.toLongLong() * 1024 * 1024);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
Server, // bool
|
Server, // bool
|
||||||
EnablePSBTControls, // bool
|
EnablePSBTControls, // bool
|
||||||
MaskValues, // bool
|
MaskValues, // bool
|
||||||
|
maxuploadtarget,
|
||||||
OptionIDRowCount,
|
OptionIDRowCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user