Skip to content

Commit

Permalink
merge bitcoin-core/gui#416: Add RPC setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Oct 25, 2024
1 parent fa2f7ac commit 063ef3a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions doc/release-notes-6337.md
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 12 additions & 2 deletions src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down
2 changes: 2 additions & 0 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/qt/optionsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class OptionsModel : public QAbstractListModel
CoinJoinDenomsHardCap,// int
CoinJoinMultiSession, // bool
Listen, // bool
Server, // bool
OptionIDRowCount,
};

Expand Down

0 comments on commit 063ef3a

Please sign in to comment.