Skip to content

Commit 076ce3d

Browse files
kwvgUdjinM6claude
committed
fix: only reset GUI-managed settings in -resetguisettings
Co-authored-by: UdjinM6 <[email protected]> Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent 0c3b224 commit 076ce3d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/qt/optionsmodel.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,22 @@ static void BackupSettings(const fs::path& filename, const QSettings& src)
430430

431431
void OptionsModel::Reset()
432432
{
433-
// Backup and reset settings.json
434-
node().resetSettings();
433+
// Backup settings.json
434+
gArgs.WriteSettingsFile(/*errors=*/nullptr, /*backup=*/true);
435+
436+
// Clear GUI-managed settings from settings.json as node().resetSettings()
437+
// clears ALL settings including non-GUI settings
438+
for (int i{0}; i < OptionIDRowCount; i++) {
439+
const char* setting_name = nullptr;
440+
try {
441+
setting_name = SettingName(static_cast<OptionID>(i));
442+
} catch (const std::logic_error&) {
443+
// Option doesn't have a corresponding node setting, skip it
444+
continue;
445+
}
446+
node().updateRwSetting(setting_name, {});
447+
node().updateRwSetting(strprintf("%s-prev", setting_name), {});
448+
}
435449

436450
QSettings settings;
437451

0 commit comments

Comments
 (0)