Skip to content

Commit 26af1ac

Browse files
committed
Merge pull request #7006
f71bfef add UI help for -resetguisettings (Jonas Schnelli) ae98388 [Qt] add startup option to reset Qt settings (Jonas Schnelli)
2 parents b19fe27 + f71bfef commit 26af1ac

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

Diff for: src/init.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ std::string HelpMessage(HelpMessageMode mode)
501501
strUsage += HelpMessageOpt("-min", _("Start minimized"));
502502
strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
503503
strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)"));
504+
strUsage += HelpMessageOpt("-resetguisettings", _("Reset all settings changes made over the GUI"));
504505
if (showDebug) {
505506
strUsage += HelpMessageOpt("-uiplatform", "Select platform to customize UI for (one of windows, macosx, other; default: platform compiled on)");
506507
}

Diff for: src/qt/bitcoin.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class BitcoinApplication: public QApplication
202202
void createPaymentServer();
203203
#endif
204204
/// Create options model
205-
void createOptionsModel();
205+
void createOptionsModel(bool resetSettings);
206206
/// Create main window
207207
void createWindow(const NetworkStyle *networkStyle);
208208
/// Create splash screen
@@ -352,9 +352,9 @@ void BitcoinApplication::createPaymentServer()
352352
}
353353
#endif
354354

355-
void BitcoinApplication::createOptionsModel()
355+
void BitcoinApplication::createOptionsModel(bool resetSettings)
356356
{
357-
optionsModel = new OptionsModel();
357+
optionsModel = new OptionsModel(NULL, resetSettings);
358358
}
359359

360360
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
@@ -645,7 +645,7 @@ int main(int argc, char *argv[])
645645
qInstallMessageHandler(DebugMessageHandler);
646646
#endif
647647
// Load GUI settings from QSettings
648-
app.createOptionsModel();
648+
app.createOptionsModel(mapArgs.count("-resetguisettings") != 0);
649649

650650
// Subscribe to global signals from core
651651
uiInterface.InitMessage.connect(InitMessage);

Diff for: src/qt/optionsmodel.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
#include <QSettings>
2727
#include <QStringList>
2828

29-
OptionsModel::OptionsModel(QObject *parent) :
29+
OptionsModel::OptionsModel(QObject *parent, bool resetSettings) :
3030
QAbstractListModel(parent)
3131
{
32-
Init();
32+
Init(resetSettings);
3333
}
3434

3535
void OptionsModel::addOverriddenOption(const std::string &option)
@@ -38,8 +38,11 @@ void OptionsModel::addOverriddenOption(const std::string &option)
3838
}
3939

4040
// Writes all missing QSettings with their default values
41-
void OptionsModel::Init()
41+
void OptionsModel::Init(bool resetSettings)
4242
{
43+
if (resetSettings)
44+
Reset();
45+
4346
QSettings settings;
4447

4548
// Ensure restart flag is unset on client startup

Diff for: src/qt/optionsmodel.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class OptionsModel : public QAbstractListModel
2424
Q_OBJECT
2525

2626
public:
27-
explicit OptionsModel(QObject *parent = 0);
27+
explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
2828

2929
enum OptionID {
3030
StartAtStartup, // bool
@@ -48,7 +48,7 @@ class OptionsModel : public QAbstractListModel
4848
OptionIDRowCount,
4949
};
5050

51-
void Init();
51+
void Init(bool resetSettings = false);
5252
void Reset();
5353

5454
int rowCount(const QModelIndex & parent = QModelIndex()) const;

0 commit comments

Comments
 (0)