Cmd.line arg --skipsa to skip "single application check". Allows to run multiple clients on one machine.

This commit is contained in:
Klaus Basan
2019-03-05 22:02:17 +01:00
committed by Mat Sutcliffe
parent 4e20c20274
commit f080f0bb86
2 changed files with 36 additions and 22 deletions

View File

@@ -983,6 +983,11 @@ namespace BlackCore
"shared");
this->addParserOption(m_cmdSharedDir);
// Skip single application check
m_cmdSkipSingleApp = QCommandLineOption({ "skipsa", "skipsingleapp" },
QCoreApplication::translate("application", "Skip the single app.test."));
this->addParserOption(m_cmdSkipSingleApp);
// reset caches upfront
m_cmdClearCache = QCommandLineOption({ "ccache", "clearcache" },
QCoreApplication::translate("application", "Clear (reset) the caches."));
@@ -990,7 +995,7 @@ namespace BlackCore
// test crashpad upload
m_cmdTestCrashpad = QCommandLineOption({ "testcp", "testcrashpad" },
QCoreApplication::translate("application", "Simulate crashpad situation."));
QCoreApplication::translate("application", "Trigger crashpad situation."));
this->addParserOption(m_cmdTestCrashpad);
}
@@ -1321,6 +1326,11 @@ namespace BlackCore
return this->isParserOptionSet("installer");
}
bool CApplication::skipSingleApplicationCheck() const
{
return this->isParserOptionSet(m_cmdSkipSingleApp);
}
bool CApplication::isParserOptionSet(const QCommandLineOption &option) const
{
return m_parser.isSet(option);
@@ -1354,12 +1364,6 @@ namespace BlackCore
return false;
}
if (m_singleApplication && m_alreadyRunning)
{
this->cmdLineErrorMessage("Program must only run once");
return false;
}
// we call parse because we also want to display a GUI error message when applicable
const QStringList args(QCoreApplication::instance()->arguments());
if (!m_parser.parse(args))
@@ -1368,6 +1372,12 @@ namespace BlackCore
return false;
}
if (m_singleApplication && m_alreadyRunning && !this->skipSingleApplicationCheck())
{
this->cmdLineErrorMessage("Program must only run once");
return false;
}
// help/version
if (m_parser.isSet(m_cmdHelp))
{