Skip to content

Commit

Permalink
Merge pull request #7006
Browse files Browse the repository at this point in the history
f71bfef add UI help for -resetguisettings (Jonas Schnelli)
ae98388 [Qt] add startup option to reset Qt settings (Jonas Schnelli)
  • Loading branch information
jonasschnelli committed Nov 25, 2015
2 parents b19fe27 + f71bfef commit 26af1ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/init.cpp
Expand Up @@ -501,6 +501,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-min", _("Start minimized")); strUsage += HelpMessageOpt("-min", _("Start minimized"));
strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)")); strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)")); strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)"));
strUsage += HelpMessageOpt("-resetguisettings", _("Reset all settings changes made over the GUI"));
if (showDebug) { if (showDebug) {
strUsage += HelpMessageOpt("-uiplatform", "Select platform to customize UI for (one of windows, macosx, other; default: platform compiled on)"); strUsage += HelpMessageOpt("-uiplatform", "Select platform to customize UI for (one of windows, macosx, other; default: platform compiled on)");
} }
Expand Down
8 changes: 4 additions & 4 deletions src/qt/bitcoin.cpp
Expand Up @@ -202,7 +202,7 @@ class BitcoinApplication: public QApplication
void createPaymentServer(); void createPaymentServer();
#endif #endif
/// Create options model /// Create options model
void createOptionsModel(); void createOptionsModel(bool resetSettings);
/// Create main window /// Create main window
void createWindow(const NetworkStyle *networkStyle); void createWindow(const NetworkStyle *networkStyle);
/// Create splash screen /// Create splash screen
Expand Down Expand Up @@ -352,9 +352,9 @@ void BitcoinApplication::createPaymentServer()
} }
#endif #endif


void BitcoinApplication::createOptionsModel() void BitcoinApplication::createOptionsModel(bool resetSettings)
{ {
optionsModel = new OptionsModel(); optionsModel = new OptionsModel(NULL, resetSettings);
} }


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


// Subscribe to global signals from core // Subscribe to global signals from core
uiInterface.InitMessage.connect(InitMessage); uiInterface.InitMessage.connect(InitMessage);
Expand Down
9 changes: 6 additions & 3 deletions src/qt/optionsmodel.cpp
Expand Up @@ -26,10 +26,10 @@
#include <QSettings> #include <QSettings>
#include <QStringList> #include <QStringList>


OptionsModel::OptionsModel(QObject *parent) : OptionsModel::OptionsModel(QObject *parent, bool resetSettings) :
QAbstractListModel(parent) QAbstractListModel(parent)
{ {
Init(); Init(resetSettings);
} }


void OptionsModel::addOverriddenOption(const std::string &option) void OptionsModel::addOverriddenOption(const std::string &option)
Expand All @@ -38,8 +38,11 @@ void OptionsModel::addOverriddenOption(const std::string &option)
} }


// Writes all missing QSettings with their default values // Writes all missing QSettings with their default values
void OptionsModel::Init() void OptionsModel::Init(bool resetSettings)
{ {
if (resetSettings)
Reset();

QSettings settings; QSettings settings;


// Ensure restart flag is unset on client startup // Ensure restart flag is unset on client startup
Expand Down
4 changes: 2 additions & 2 deletions src/qt/optionsmodel.h
Expand Up @@ -24,7 +24,7 @@ class OptionsModel : public QAbstractListModel
Q_OBJECT Q_OBJECT


public: public:
explicit OptionsModel(QObject *parent = 0); explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);


enum OptionID { enum OptionID {
StartAtStartup, // bool StartAtStartup, // bool
Expand All @@ -48,7 +48,7 @@ class OptionsModel : public QAbstractListModel
OptionIDRowCount, OptionIDRowCount,
}; };


void Init(); void Init(bool resetSettings = false);
void Reset(); void Reset();


int rowCount(const QModelIndex & parent = QModelIndex()) const; int rowCount(const QModelIndex & parent = QModelIndex()) const;
Expand Down

0 comments on commit 26af1ac

Please sign in to comment.