swift
main.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include <cstdlib>
5 
6 #include <QApplication>
7 #include <QString>
8 #include <QSystemTrayIcon>
9 #include <Qt>
10 
11 #include "core/corefacadeconfig.h"
12 #include "gui/guiapplication.h"
13 #include "misc/crashhandler.h"
14 #include "misc/icons.h"
15 #include "swiftcore.h"
16 
17 using namespace swift::misc;
18 using namespace swift::core;
19 using namespace swift::gui;
20 
21 int main(int argc, char *argv[])
22 {
23  CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv));
24  QApplication qa(argc, argv);
25  Q_UNUSED(qa) // init of qa is required, but qa not used
26 
28  CGuiApplication a(CApplicationInfo::swiftCore(), CApplicationInfo::PilotClientCore, CIcons::swiftCore24());
29  a.addWindowStateOption();
30  a.addDBusAddressOption();
31  a.addNetworkOptions();
32  a.addAudioOptions();
33  if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; }
34 
35  const QString dBusAddress(a.getCmdDBusAddressValue());
36  a.initContextsAndStartCoreFacade(CCoreFacadeConfig(CCoreFacadeConfig::LocalInDBusServer, dBusAddress));
37  if (!a.start())
38  {
39  a.gracefulShutdown();
40  return EXIT_FAILURE;
41  }
42 
43  if (!QSystemTrayIcon::isSystemTrayAvailable())
44  {
45  a.cmdLineErrorMessage("System tray missing", "I could not detect any system tray on this system.");
46  a.gracefulShutdown();
47  return EXIT_FAILURE;
48  }
49 
50  CSwiftCore w;
51  if (a.getWindowState() != Qt::WindowMinimized) { w.show(); }
52  return a.exec();
53 }
swift core control GUI
Definition: swiftcore.h:39
Configuration object for the contexts.
GUI application, a specialized version of swift::core::CApplication for GUI applications.
static const QString & swiftCore()
Name of swift core.
void init()
Initialize and start crashpad handler process.
static CCrashHandler * instance()
Get singleton instance.
static const QPixmap & swiftCore24()
swift icon
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
GUI related classes.
Free functions in swift::misc.
int main(int argc, char *argv[])
main
Definition: main.cpp:20