merge bitcoin-core/gui#416: Add RPC setting

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-25 15:36:09 +00:00
parent fa2f7acc2a
commit 063ef3a2d0
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
5 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,5 @@
GUI changes
-----------
A new option has been added in to the "Main" tab in "Options" that allow
users to enable RPC server functionality.

View File

@ -112,7 +112,7 @@
<string>Automatically start %1 after logging in to the system.</string>
</property>
<property name="text">
<string>&amp;Start %1 on system login</string>
<string>Start %1 on system &amp;login</string>
</property>
</widget>
</item>
@ -291,13 +291,23 @@
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="enableServer">
<property name="toolTip">
<string extracomment="Tooltip text for Options window setting that enables the RPC server.">This allows you or a third party tool to communicate with the node through command-line and JSON-RPC commands.</string>
</property>
<property name="text">
<string extracomment="An Options window setting to enable the RPC server.">Enable RPC &amp;server</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_Main">
<property name="orientation">

View File

@ -267,6 +267,7 @@ void OptionsDialog::setModel(OptionsModel *_model)
connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning);
/* Network */
connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning);
connect(ui->enableServer, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning);
connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning);
connect(ui->connectSocksTor, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning);
/* Display */
@ -343,6 +344,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
mapper->addMapping(ui->mapPortNatpmp, OptionsModel::MapPortNatpmp);
mapper->addMapping(ui->allowIncoming, OptionsModel::Listen);
mapper->addMapping(ui->enableServer, OptionsModel::Server);
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);

View File

@ -275,6 +275,13 @@ void OptionsModel::Init(bool resetSettings)
gArgs.SoftSetBoolArg("-listenonion", false);
}
if (!settings.contains("server")) {
settings.setValue("server", false);
}
if (!gArgs.SoftSetBoolArg("-server", settings.value("server").toBool())) {
addOverriddenOption("-server");
}
if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false);
if (!settings.contains("addrProxy"))
@ -529,6 +536,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return settings.value("nThreadsScriptVerif");
case Listen:
return settings.value("fListen");
case Server:
return settings.value("server");
default:
return QVariant();
}
@ -795,6 +804,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
setRestartRequired(true);
}
break;
case Server:
if (settings.value("server") != value) {
settings.setValue("server", value);
setRestartRequired(true);
}
break;
default:
break;
}

View File

@ -86,6 +86,7 @@ public:
CoinJoinDenomsHardCap,// int
CoinJoinMultiSession, // bool
Listen, // bool
Server, // bool
OptionIDRowCount,
};