Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6c9f1ae
merge bitcoin-core/gui#600: Add OptionsModel getOption/setOption methods
kwvg Dec 26, 2025
4fc25af
merge bitcoin-core/gui#601: Pass interfaces::Node references to Optio…
kwvg Apr 29, 2019
bb2efec
qt: remove PrivateSend -> CoinJoin migration logic, remove old values
kwvg Jan 3, 2026
d7cc771
qt: move Prune{,Size} handling outside `ENABLE_WALLET` gate
kwvg Aug 30, 2025
dd21992
merge bitcoin-core/gui#602: Unify bitcoin-qt and bitcoind persistent …
kwvg Jan 1, 2026
eed631a
refactor: spin-off list of option IDs that require string workaround
kwvg Aug 25, 2025
44833d9
qt: migrate `-coinjoinsessions` setting from QSettings to settings.json
kwvg Aug 26, 2025
2174fc6
qt: migrate `-coinjoinrounds` setting from QSettings to settings.json
kwvg Aug 26, 2025
fb97375
qt: migrate `-coinjoinamount` setting from QSettings to settings.json
kwvg Aug 26, 2025
ea60d79
qt: migrate `-coinjoinmultisession` setting from QSettings to setting…
kwvg Aug 25, 2025
4f744c2
qt: migrate `-coinjoindenomsgoal` setting from QSettings to settings.…
kwvg Aug 26, 2025
da15040
qt: migrate `-coinjoindenomshardcap` setting from QSettings to settin…
kwvg Aug 26, 2025
2bb8106
qt: migrate `-enablecoinjoin` setting from QSettings to settings.json
kwvg Aug 29, 2025
a5b5ede
qt: migrate `-font-family` setting from QSettings to settings.json
kwvg Aug 26, 2025
c3a5ba1
qt: migrate `-font-scale` setting from QSettings to settings.json
kwvg Dec 26, 2025
70ff8ef
qt: migrate `-font-weight-normal` from QSettings to settings.json
kwvg Dec 27, 2025
e429437
qt: migrate `-font-weight-bold` from QSettings to settings.json
kwvg Aug 30, 2025
45976c7
merge bitcoin-core/gui#701: Persist Mask Values option
kwvg Jan 24, 2023
0c3b224
merge bitcoin-core/gui#603: Add settings.json prune-prev, proxy-prev,…
kwvg Apr 22, 2022
076ce3d
fix: only reset GUI-managed settings in -resetguisettings
kwvg Jan 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/release-notes-6833.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
GUI changes
-----------

Configuration changes made in the Dash GUI (such as the pruning setting,
proxy settings, UPNP preferences) are now saved to `<datadir>/settings.json`
file rather than to the Qt settings backend (windows registry or unix desktop
config files), so these settings will now apply to dashd, instead of being
ignored.

Also, the interaction between GUI settings and `dash.conf` settings is
simplified. Settings from `dash.conf` are now displayed normally in the GUI
settings dialog, instead of in a separate warning message ("Options set in this
dialog are overridden by the configuration file: -setting=value"). And these
settings can now be edited because `settings.json` values take precedence over
`dash.conf` values.
40 changes: 30 additions & 10 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,26 @@ void BitcoinApplication::createPaymentServer()
}
#endif

void BitcoinApplication::createOptionsModel(bool resetSettings)
bool BitcoinApplication::createOptionsModel(bool resetSettings)
{
optionsModel = new OptionsModel(this, resetSettings);
optionsModel = new OptionsModel(node(), this);
if (resetSettings) {
optionsModel->Reset();
}
bilingual_str error;
if (!optionsModel->Init(error)) {
fs::path settings_path;
if (gArgs.GetSettingsPath(&settings_path)) {
error += Untranslated("\n");
std::string quoted_path = strprintf("%s", fs::quoted(fs::PathToString(settings_path)));
error.original += strprintf("Settings file %s might be corrupt or invalid.", quoted_path);
error.translated += tr("Settings file %1 might be corrupt or invalid.").arg(QString::fromStdString(quoted_path)).toStdString();
}
InitError(error);
QMessageBox::critical(nullptr, PACKAGE_NAME, QString::fromStdString(error.translated));
return false;
}
return true;
}
Comment thread
kwvg marked this conversation as resolved.
Outdated

void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
Expand All @@ -293,7 +310,6 @@ void BitcoinApplication::createNode(interfaces::Init& init)
{
assert(!m_node);
m_node = init.makeNode();
if (optionsModel) optionsModel->setNode(*m_node);
if (m_splash) m_splash->setNode(*m_node);
}

Expand Down Expand Up @@ -330,7 +346,7 @@ void BitcoinApplication::parameterSetup()

void BitcoinApplication::InitPruneSetting(int64_t prune_MiB)
{
optionsModel->SetPruneTargetGB(PruneMiBtoGB(prune_MiB), true);
optionsModel->SetPruneTargetGB(PruneMiBtoGB(prune_MiB));
}

void BitcoinApplication::requestInitialize()
Expand Down Expand Up @@ -668,8 +684,17 @@ int GuiMain(int argc, char* argv[])
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: Failed to load application fonts."));
return EXIT_FAILURE;
}

if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false))
app.createSplashScreen(networkStyle.data());

app.createNode(*init);

// Load GUI settings from QSettings
app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false));
if (!app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false))) {
return EXIT_FAILURE;
}

// Validate/set font family
if (gArgs.IsArgSet("-font-family")) {
QString family = gArgs.GetArg("-font-family", GUIUtil::FontRegistry::DEFAULT_FONT.toUtf8().toStdString()).c_str();
Expand Down Expand Up @@ -758,11 +783,6 @@ int GuiMain(int argc, char* argv[])
app.InitPruneSetting(prune_MiB);
}

if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false))
app.createSplashScreen(networkStyle.data());

app.createNode(*init);

int rv = EXIT_SUCCESS;
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BitcoinApplication: public QApplication
/// parameter interaction/setup based on rules
void parameterSetup();
/// Create options model
void createOptionsModel(bool resetSettings);
[[nodiscard]] bool createOptionsModel(bool resetSettings);
/// Initialize prune setting
void InitPruneSetting(int64_t prune_MiB);
/// Create main window
Expand Down
2 changes: 2 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH

connect(optionsModel, &OptionsModel::coinJoinEnabledChanged, this, &BitcoinGUI::updateCoinJoinVisibility);
}

m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Null-deref risk if OptionsModel is null.

_setClientModel() unconditionally dereferences _clientModel->getOptionsModel() to set m_mask_values_action. This can crash when options model is not yet available. Guard it.

-        m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
+        if (OptionsModel* opt = _clientModel->getOptionsModel()) {
+            m_mask_values_action->setChecked(opt->getOption(OptionsModel::OptionID::MaskValues).toBool());
+        } else {
+            m_mask_values_action->setChecked(false);
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
} else {
if (OptionsModel* opt = _clientModel->getOptionsModel()) {
m_mask_values_action->setChecked(opt->getOption(OptionsModel::OptionID::MaskValues).toBool());
} else {
m_mask_values_action->setChecked(false);
}
} else {
🤖 Prompt for AI Agents
In src/qt/bitcoingui.cpp around lines 893-894, the code unconditionally calls
_clientModel->getOptionsModel()->getOption(...), risking a null-deref if
getOptionsModel() returns nullptr; change the logic to first check that
_clientModel and _clientModel->getOptionsModel() are non-null before calling
getOption, and only call m_mask_values_action->setChecked(...) when the options
model exists (otherwise set a safe default or leave the action unchecked);
ensure any subsequent logic that assumes the options model exists is similarly
guarded or deferred until the model is available.

if(trayIconMenu)
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ https://explore.transifex.com/dash/dash/</string>
<item>
<widget class="QLabel" name="overriddenByCommandLineInfoLabel">
<property name="text">
<string>Options set in this dialog are overridden by the command line or in the configuration file:</string>
<string>Options set in this dialog are overridden by the command line:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
Expand Down
5 changes: 0 additions & 5 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <QIntValidator>
#include <QLocale>
#include <QMessageBox>
#include <QSettings>
#include <QShowEvent>
#include <QSystemTrayIcon>
#include <QTimer>
Expand Down Expand Up @@ -84,10 +83,6 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
#ifndef USE_NATPMP
ui->mapPortNatpmp->setEnabled(false);
#endif
connect(this, &QDialog::accepted, [this](){
QSettings settings;
model->node().mapPort(settings.value("fUseUPnP").toBool(), settings.value("fUseNatpmp").toBool());
});

ui->proxyIp->setEnabled(false);
ui->proxyPort->setEnabled(false);
Expand Down
Loading
Loading