mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +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
@@ -81,7 +81,15 @@ CSwiftLauncher::~CSwiftLauncher()
|
||||
|
||||
QString CSwiftLauncher::getCmdLine() const
|
||||
{
|
||||
return toCmdLine(m_executable, m_executableArgs);
|
||||
return this->toCmdLine(m_executable, m_executableArgs);
|
||||
}
|
||||
|
||||
bool CSwiftLauncher::startDetached()
|
||||
{
|
||||
if (m_executable.isEmpty()) { return false; }
|
||||
const QString cmd = this->getCmdLine();
|
||||
CLogMessage(this).info(cmd);
|
||||
return QProcess::startDetached(m_executable, m_executableArgs);
|
||||
}
|
||||
|
||||
CEnableForFramelessWindow::WindowMode CSwiftLauncher::getWindowMode() const
|
||||
@@ -267,26 +275,20 @@ void CSwiftLauncher::startSwiftCore()
|
||||
args.append("--coreaudio");
|
||||
}
|
||||
|
||||
// I set this for debug purpose only
|
||||
args.append(sGui->inheritedArguments(true));
|
||||
m_executableArgs = args;
|
||||
m_executable.clear();
|
||||
m_executable = CDirectoryUtils::executableFilePath(CBuildConfig::swiftCoreExecutableName());
|
||||
CLogMessage(this).info(this->getCmdLine());
|
||||
|
||||
// start
|
||||
QProcess::startDetached(m_executable, m_executableArgs);
|
||||
this->startDetached();
|
||||
}
|
||||
|
||||
void CSwiftLauncher::setSwiftDataExecutable()
|
||||
{
|
||||
m_executable.clear();
|
||||
m_executable = CDirectoryUtils::executableFilePath(CBuildConfig::swiftDataExecutableName());
|
||||
m_executableArgs.clear();
|
||||
m_executableArgs = sGui->inheritedArguments(false);
|
||||
}
|
||||
|
||||
bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||
{
|
||||
m_executable.clear();
|
||||
m_executable = CDirectoryUtils::executableFilePath(CBuildConfig::swiftGuiExecutableName());
|
||||
|
||||
QStringList args
|
||||
@@ -315,6 +317,7 @@ bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
args.append(sGui->inheritedArguments(true));
|
||||
m_executableArgs = args;
|
||||
return true;
|
||||
}
|
||||
@@ -399,11 +402,8 @@ bool CSwiftLauncher::warnAboutOtherSwiftApplications()
|
||||
QString CSwiftLauncher::toCmdLine(const QString &exe, const QStringList &exeArgs)
|
||||
{
|
||||
if (exeArgs.isEmpty()) { return exe; }
|
||||
QString cmd(exe);
|
||||
for (const QString &a : exeArgs)
|
||||
{
|
||||
cmd = cmd.append(" ").append(a);
|
||||
}
|
||||
const QString exeArgsString = exeArgs.join(' ');
|
||||
const QString cmd(exe + " " + exeArgsString);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user