mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Remove shortcuts to start launcher
This commit is contained in:
@@ -257,47 +257,6 @@ namespace swift::core
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CApplication::getExecutableForApplication(CApplicationInfo::Application application) const
|
|
||||||
{
|
|
||||||
QString searchFor;
|
|
||||||
switch (application)
|
|
||||||
{
|
|
||||||
case CApplicationInfo::PilotClientCore: searchFor = "core"; break;
|
|
||||||
case CApplicationInfo::Launcher: searchFor = "launcher"; break;
|
|
||||||
case CApplicationInfo::MappingTool: searchFor = "data"; break;
|
|
||||||
case CApplicationInfo::PilotClientGui: searchFor = "gui"; break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
if (searchFor.isEmpty()) { return {}; }
|
|
||||||
|
|
||||||
for (const QString &executable : CFileUtils::getSwiftExecutables())
|
|
||||||
{
|
|
||||||
if (!executable.contains("swift", Qt::CaseInsensitive)) { continue; }
|
|
||||||
if (executable.contains(searchFor, Qt::CaseInsensitive)) { return executable; }
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CApplication::startLauncher()
|
|
||||||
{
|
|
||||||
static const QString launcher =
|
|
||||||
CApplication::getExecutableForApplication(CApplicationInfo::Application::Launcher);
|
|
||||||
if (launcher.isEmpty() || CApplication::isApplicationRunning(CApplicationInfo::Launcher)) { return false; }
|
|
||||||
|
|
||||||
// const QStringList args = this->argumentsJoined({}, { "--dbus", "--core", "--coreaudio" });
|
|
||||||
const QStringList args = this->argumentsJoined({}, { "--dbus", "--core" });
|
|
||||||
return QProcess::startDetached(launcher, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CApplication::startLauncherAndQuit()
|
|
||||||
{
|
|
||||||
const bool started = CApplication::startLauncher();
|
|
||||||
if (!started) { return false; }
|
|
||||||
this->gracefulShutdown();
|
|
||||||
CApplication::exit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGlobalSetup CApplication::getGlobalSetup() const
|
CGlobalSetup CApplication::getGlobalSetup() const
|
||||||
{
|
{
|
||||||
if (m_shutdown) { return CGlobalSetup(); }
|
if (m_shutdown) { return CGlobalSetup(); }
|
||||||
|
|||||||
@@ -146,15 +146,6 @@ namespace swift::core
|
|||||||
//! Version, name beta and dev info
|
//! Version, name beta and dev info
|
||||||
const QString &getApplicationNameVersionDetailed() const;
|
const QString &getApplicationNameVersionDetailed() const;
|
||||||
|
|
||||||
//! Executable names for the given applications
|
|
||||||
QString getExecutableForApplication(swift::misc::CApplicationInfo::Application application) const;
|
|
||||||
|
|
||||||
//! Start the launcher
|
|
||||||
bool startLauncher();
|
|
||||||
|
|
||||||
//! Start the launcher and quit
|
|
||||||
bool startLauncherAndQuit();
|
|
||||||
|
|
||||||
//! Global setup
|
//! Global setup
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
data::CGlobalSetup getGlobalSetup() const;
|
data::CGlobalSetup getGlobalSetup() const;
|
||||||
|
|||||||
@@ -296,13 +296,6 @@ namespace swift::gui::components
|
|||||||
// add some space for frameless navigators where I can move the navigator
|
// add some space for frameless navigators where I can move the navigator
|
||||||
QAction *a = nullptr; // new QAction(CIcons::empty16(), "move navigator here", this);
|
QAction *a = nullptr; // new QAction(CIcons::empty16(), "move navigator here", this);
|
||||||
bool c = false;
|
bool c = false;
|
||||||
if (sGui)
|
|
||||||
{
|
|
||||||
a = new QAction(CIcons::swiftLauncher16(), "Start launcher", this);
|
|
||||||
c = connect(a, &QAction::triggered, sGui, &CGuiApplication::startLauncher);
|
|
||||||
Q_ASSERT(c);
|
|
||||||
this->addAction(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
// save
|
// save
|
||||||
a = new QAction(CIcons::save16(), "Save state", this);
|
a = new QAction(CIcons::save16(), "Save state", this);
|
||||||
|
|||||||
@@ -664,13 +664,6 @@ namespace swift::gui
|
|||||||
addMenuForStyleSheets(menu);
|
addMenuForStyleSheets(menu);
|
||||||
QAction *a = nullptr;
|
QAction *a = nullptr;
|
||||||
bool c = false;
|
bool c = false;
|
||||||
if (this->getApplicationInfo().getApplication() != CApplicationInfo::Launcher)
|
|
||||||
{
|
|
||||||
menu.addSeparator();
|
|
||||||
a = menu.addAction(CIcons::swiftLauncher24(), "Start swift launcher");
|
|
||||||
c = connect(a, &QAction::triggered, this, &CGuiApplication::startLauncher);
|
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
a = menu.addAction("E&xit");
|
a = menu.addAction("E&xit");
|
||||||
|
|||||||
Reference in New Issue
Block a user