mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Based on slack discussion, pass arguments from launcher to started application
https://swift-project.slack.com/archives/C04J6J76N/p1504449711000040 * utility functions in CApplication and CNetworkVatlib for cmd args * a.addVatlibOptions() in launcher * function CSwiftLauncher::startDetached to unify startup and simplify debugging
This commit is contained in:
committed by
Mathew Sutcliffe
parent
1baf74ebf3
commit
eab22e86b0
@@ -34,6 +34,7 @@ int main(int argc, char *argv[])
|
||||
QApplication qa(argc, argv); // needed
|
||||
Q_UNUSED(qa);
|
||||
CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Laucher, CIcons::swiftLauncher1024());
|
||||
a.addVatlibOptions(); // so it can be passed to started applications
|
||||
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.") });
|
||||
if (!a.parseAndStartupCheck()) { return EXIT_FAILURE; }
|
||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
|
||||
@@ -49,12 +50,6 @@ int main(int argc, char *argv[])
|
||||
CGuiApplication::registerAsRunning(); // needed because own exec is called
|
||||
if (launcher.exec() == QDialog::Rejected) { return EXIT_SUCCESS; }
|
||||
launcher.close();
|
||||
|
||||
const QString exe(launcher.getExecutable());
|
||||
const QStringList exeArgs(launcher.getExecutableArgs());
|
||||
Q_ASSERT_X(!exe.isEmpty(), Q_FUNC_INFO, "Missing executable");
|
||||
CLogMessage(QCoreApplication::instance()).info(launcher.getCmdLine());
|
||||
QProcess::startDetached(exe, exeArgs);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
const bool s = launcher.startDetached();
|
||||
return s ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user