swift
swiftlauncher.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFTLAUNCHER_H
7 #define SWIFTLAUNCHER_H
8 
9 #include "core/coremodeenums.h"
10 #include "core/data/globalsetup.h"
13 #include "gui/mainwindowaccess.h"
15 #include "misc/db/artifact.h"
16 #include "misc/identifiable.h"
17 #include "misc/loghistory.h"
19 
20 #ifdef Q_OS_MAC
22 #endif
23 
24 #include <QMainWindow>
25 #include <QNetworkReply>
26 #include <QScopedPointer>
27 #include <QTimer>
28 
29 namespace Ui
30 {
31  class CSwiftLauncher;
32 }
33 namespace swift::gui::components
34 {
35  class CConfigurationWizard;
36  class CTextEditDialog;
37 } // namespace swift::gui::components
38 
46  public QMainWindow,
51 {
52  Q_OBJECT
53  Q_INTERFACES(swift::gui::IMainWindowAccess)
54 
55 public:
57  enum Pages
58  {
59  PageNews = 0,
60  PageWindowType,
61  PageCoreMode,
62  PageUpdates
63  };
64 
66  CSwiftLauncher(bool installerMode, QWidget *parent = nullptr);
67 
69  virtual ~CSwiftLauncher() override;
70 
72  const QString &getExecutable() const { return m_executable; }
73 
75  const QStringList &getExecutableArgs() const { return m_executableArgs; }
76 
78  QString getCmdLine() const;
79 
82  bool startDetached();
83 
85  bool shouldStartAppDetached() const;
86 
87 protected:
90  virtual void mousePressEvent(QMouseEvent *event) override;
91  virtual void mouseMoveEvent(QMouseEvent *event) override;
92  virtual void mouseReleaseEvent(QMouseEvent *event) override;
94 
95 private slots:
97  void showLogPage();
98 
99 private:
100  QScopedPointer<Ui::CSwiftLauncher> ui;
101  QScopedPointer<swift::gui::components::CConfigurationWizard> m_wizard;
102  QScopedPointer<swift::gui::components::CTextEditDialog> m_textEditDialog;
104  swift::misc::CLogHistoryReplica m_logHistory { this };
105 #ifdef Q_OS_MAC
107 #endif
108 
109  QString m_executable;
110  QStringList m_executableArgs;
111  QTimer m_checkTimer { this };
112  int m_startCoreWaitCycles = 0;
113  int m_startMappingToolWaitCycles = 0;
114  int m_startGuiWaitCycles = 0;
115 
117  swift::core::CoreModes::CoreMode getCoreMode() const;
118 
121 
123  void init();
124 
126  void initStyleSheet();
127 
129  void initLogDisplay();
130 
132  void setHeaderInfo(const swift::misc::db::CArtifact &latestArtifact);
133 
135  bool setSwiftCoreExecutable();
136 
138  bool setSwiftDataExecutable();
139 
141  bool setSwiftGuiExecutable();
142 
144  bool canConnectSwiftOnDBusServer(const QString &dbusAddress, QString &msg) const;
145 
147  bool isStandaloneGuiSelected() const;
148 
150  void setDefaults();
151 
153  void saveSetup();
154 
156  bool warnAboutOtherSwiftApplications();
157 
159  void updateInfoAvailable();
160 
162  void startButtonPressed();
163 
165  void dbusServerModeSelected(bool selected);
166 
168  void showStatusMessage(const swift::misc::CStatusMessage &msg);
169 
171  void showStatusMessage(const QString &htmlMsg);
172 
174  void showMainPage();
175 
177  void tabChanged(int current);
178 
180  void checkRunningApplicationsAndCore();
181 
183  void startWizard();
184 
186  void onStyleSheetsChanged();
187 
189  void onDBusEditingFinished();
190 
192  void onCoreModeReleased();
193 
195  void popupExecutableArgs();
196 
198  void showSimulatorConfigDirs();
199 
201  void requestMacMicrophoneAccess();
202 
204  void installerMode();
205 
207  void clearWindowsRegistry();
208 
210  static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
211 };
212 
213 #endif // SWIFTLAUNCHER_H
swift launcher tool
Definition: swiftlauncher.h:51
virtual void mouseReleaseEvent(QMouseEvent *event)
Mouse events for frameless window.
virtual void mouseMoveEvent(QMouseEvent *event)
Mouse events for frameless window.
virtual ~CSwiftLauncher()
Destructor.
CSwiftLauncher(bool installerMode, QWidget *parent=nullptr)
Constructor.
bool shouldStartAppDetached() const
Check if an app is set that should be started detached.
bool startDetached()
Start currently set application detached.
const QString & getExecutable() const
Executable (to be started)
Definition: swiftlauncher.h:72
virtual void mousePressEvent(QMouseEvent *event)
Mouse events for frameless window.
QString getCmdLine() const
Current command line.
const QStringList & getExecutableArgs() const
Arguments.
Definition: swiftlauncher.h:75
Main window which can be frameless.
Direct acccess to main window`s status bar, info bar and such.
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
Definition: identifiable.h:24
Allows distributed access to the log messages of a central CLogHistory.
Definition: loghistory.h:50
Wrapper around MacOS 10.14 AVCaptureDevice AVCaptureDevice authorization.
Streamable status message, e.g.
Artifacts ("our software" products)
Definition: artifact.h:23
Basically a QObject free (delegate based) version of CCentralMultiSimulatorModelSetCachesProvider.
Definition: modelcaches.h:640
High level reusable GUI components.
Definition: aboutdialog.cpp:13
CoreMode
Core runs how and where?
Definition: coremodeenums.h:18