Add cmd line opt to disable settings reset popup

This commit is contained in:
Atlante45 2016-06-14 16:26:39 -07:00
parent cc16dc07df
commit 1403fad04e
3 changed files with 10 additions and 3 deletions

View file

@ -389,7 +389,10 @@ bool setupEssentials(int& argc, char** argv) {
Setting::preInit();
bool previousSessionCrashed = CrashHandler::checkForResetSettings();
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
bool previousSessionCrashed = CrashHandler::checkForResetSettings(suppressPrompt);
CrashHandler::writeRunningMarkerFiler();
qAddPostRoutine(CrashHandler::deleteRunningMarkerFile);

View file

@ -27,7 +27,7 @@
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
bool CrashHandler::checkForResetSettings() {
bool CrashHandler::checkForResetSettings(bool suppressPrompt) {
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings settings;
settings.beginGroup("Developer");
@ -42,6 +42,10 @@ bool CrashHandler::checkForResetSettings() {
QFile runningMarkerFile(runningMarkerFilePath());
bool wasLikelyCrash = runningMarkerFile.exists();
if (suppressPrompt) {
return wasLikelyCrash;
}
if (wasLikelyCrash || askToResetSettings) {
if (displaySettingsResetOnCrash || askToResetSettings) {
Action action = promptUserForAction(wasLikelyCrash);

View file

@ -17,7 +17,7 @@
class CrashHandler {
public:
static bool checkForResetSettings();
static bool checkForResetSettings(bool suppressPrompt = false);
static void writeRunningMarkerFiler();
static void deleteRunningMarkerFile();