refactor: Remove use of DESKFLOW_RESET_ALL and all users to pass --reset switch to deskflow-gui instead
This commit is contained in:
parent
97863bda7c
commit
903401796e
2 changed files with 6 additions and 6 deletions
|
|
@ -55,13 +55,13 @@ int main(int argc, char *argv[])
|
|||
// Add Command Line Options
|
||||
auto helpOption = QCommandLineOption("help", "Display Help on the command line");
|
||||
auto versionOption = QCommandLineOption("version", "Display version information");
|
||||
auto noResetOption = QCommandLineOption("no-reset", "Prevent settings reset if DESKFLOW_RESET_ALL is set");
|
||||
auto resetOption = QCommandLineOption("reset", "Reset all settings");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
|
||||
parser.addOption(helpOption);
|
||||
parser.addOption(versionOption);
|
||||
parser.addOption(noResetOption);
|
||||
parser.addOption(resetOption);
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
const auto header = QStringLiteral("%1: %2\n").arg(kAppName, kDisplayVersion);
|
||||
|
|
@ -132,8 +132,7 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
// --no-reset
|
||||
const auto resetEnvVar = QVariant(qEnvironmentVariable("DESKFLOW_RESET_ALL")).toBool();
|
||||
if (resetEnvVar && !parser.isSet(noResetOption)) {
|
||||
if (parser.isSet(resetOption)) {
|
||||
diagnostic::clearSettings(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ void restart()
|
|||
QString program = QCoreApplication::applicationFilePath();
|
||||
QStringList arguments = QCoreApplication::arguments();
|
||||
|
||||
// prevent infinite reset loop when env var set.
|
||||
arguments << "--no-reset";
|
||||
// look for and remove --reset option if found
|
||||
if (int resetIndex = arguments.indexOf("--reset"); resetIndex != -1)
|
||||
arguments.remove(resetIndex);
|
||||
|
||||
qInfo("launching new process: %s", qPrintable(program));
|
||||
QProcess::startDetached(program, arguments);
|
||||
|
|
|
|||
Loading…
Reference in a new issue