swift
Loading...
Searching...
No Matches
swift::gui::CGuiApplication Class Reference

GUI application, a specialized version of swift::core::CApplication for GUI applications. More...

#include <guiapplication.h>

Inheritance diagram for swift::gui::CGuiApplication:
[legend]

Signals

void styleSheetsChanged ()
 Style sheet changed.
void uiObjectTreeReady ()
 Object tree ready (means ui->setupUi() completed).
void fontChanged ()
 Font has been changed.
void alwaysOnTop (bool onTop)
 always on top
Signals inherited from swift::core::CApplication
void updateInfoAvailable (bool success)
 Update info available (cache, web load).
void startUpCompleted (bool success)
 Startup has been completed Will be triggered shortly before starting the event loop.
void coreFacadeStarted ()
 Facade started.
void webDataServicesStarted (bool success)
 Web data services started.
void aboutToShutdown ()
 About to shutdown.

Public Member Functions

 CGuiApplication (const QString &applicationName=executable(), swift::misc::CApplicationInfo::Application application=swift::misc::CApplicationInfo::Unknown, const QPixmap &icon=swift::misc::CIcons::swift64())
 Constructor.
 ~CGuiApplication ()
 Destructor.
void addWindowStateOption ()
 CMD line arguments.
void addWindowModeOption ()
 CMD line arguments.
void addWindowResetSizeOption ()
 CMD line arguments (reset size store).
Qt::WindowState getWindowState () const
 Window state.
CEnableForFramelessWindow::WindowMode getWindowMode () const
 Window mode (window flags).
void processEventsToRefreshGui () const
 Allow the GUI to refresh by processing events, call the event loop.
void initMainApplicationWidget (QWidget *mainWidget)
 Init the main application window based on information in this application.
void addWindowFlags (Qt::WindowFlags flags)
 Set window flag on main application window.
QString setExtraWindowTitle (const QString &extraInfo, QWidget *mainWindowWidget=mainApplicationWidget()) const
 Set window title.
bool isCmdWindowSizeResetSet () const
 Window size reset mode set.
void splashScreen (const QPixmap &pixmap)
 Add a splash screen based on resource, empty means remove splash screen.
void addMenuForSettingsAndCache (QMenu &menu)
 Add menu items for settings and cache.
void addMenuForStyleSheets (QMenu &menu)
 Add menu for style sheets.
void addMenuFile (QMenu &menu)
 File menu.
void addMenuInternals (QMenu &menu)
 Internals menu.
void addMenuWindow (QMenu &menu)
 Window operations.
void openUrl (const swift::misc::network::CUrl &url)
 Open a given URL.
void addMenuHelp (QMenu &menu)
 Help operations.
void showHelp (const QString &subpath={}) const
 Show help page (online help).
void showChangelog () const
 Show changelog popup.
const CStyleSheetUtility & getStyleSheetUtility () const
 Style sheet handling.
QString getWidgetStyle () const
 Current widget style.
bool reloadStyleSheets ()
 Reload style sheets.
bool openStandardWidgetStyleSheet ()
 Opens the standard stylesheet.
bool openStandardLogDirectory ()
 Opens the standard log directory.
bool openStandardCrashDumpDirectory ()
 Opens the standard dumps directory.
bool updateFont (const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor)
 Update the fonts.
bool updateFont (const QString &qss)
 Update the fonts.
bool resetFont ()
 Reset the font to default.
void setMinimumSizeInCharacters (int widthChars, int heightChars)
 Set minimum width/height in characters.
void displaySetupLoadFailure (swift::misc::CStatusMessageList msgs)
 Display the failures caused by loading the setup file.
QDialog::DialogCode showCloseDialog (QMainWindow *mainWindow, QCloseEvent *closeEvent)
 Show close dialog.
void triggerNewVersionCheck (int delayedMs)
 Trigger new version check.
void gracefulShutdown ()
 Graceful shutdown.
bool toggleStayOnTop ()
 Toggle stay on top.
void windowMinimizeNormalToggle ()
 Window minimize/normalize.
void setSaveMainWidgetState (bool save)
 Save the main widget state?
bool saveWindowGeometryAndState (const QMainWindow *window=CGuiApplication::mainApplicationWindow()) const
 Save widget's geometry and state.
void resetWindowGeometryAndState ()
 Reset the saved values.
bool restoreWindowGeometryAndState (QMainWindow *window=CGuiApplication::mainApplicationWindow())
 Restore widget's geometry and state.
void registerMainApplicationWidget (QWidget *mainWidget)
 Register main application window widget if this is known.
bool hasMinimumMappingVersion () const
 Minimum mapping version check.
void cmdLineErrorMessage (const QString &text, const QString &informativeText) const
 print messages generated during parsing / cmd handling
void cmdLineErrorMessage (const swift::misc::CStatusMessageList &msgs) const
 print messages generated during parsing / cmd handling
bool displayInStatusBar (const swift::misc::CStatusMessage &message)
 direct access to main application window
bool displayInOverlayWindow (const swift::misc::CStatusMessage &message, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
 direct access to main application window
bool displayInOverlayWindow (const swift::misc::CStatusMessageList &messages, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
 direct access to main application window
bool displayInOverlayWindow (const QString &html, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
 direct access to main application window
void windowToFront ()
 Window to front/back.
void windowToBack ()
 Window to front/back.
void windowToFrontBackToggle ()
 Window to front/back.
Public Member Functions inherited from swift::core::CApplication
 CApplication (swift::misc::CApplicationInfo::Application application, bool init=true)
 Constructor.
 CApplication (const QString &applicationName=executable(), swift::misc::CApplicationInfo::Application application=swift::misc::CApplicationInfo::Unknown, bool init=true)
 Constructor.
 ~CApplication ()
 Destructor.
bool isAlreadyRunning () const
 True if this swift application is already running (including different versions).
bool isShuttingDown () const
 Is application shutting down?
bool isIncognito () const
 Is incognito mode?
void setIncognito (bool incognito)
 Set incognito mode.
void toggleIncognito ()
 Toggle incognito mode.
const swift::misc::CApplicationInfo & getApplicationInfo () const
 swift application running
const QString & getApplicationName () const
 Application name and version.
const QString & getApplicationNameAndVersion () const
 Application name and version.
const QString & getApplicationNameVersionDetailed () const
 Version, name beta and dev info.
data::CGlobalSetup getGlobalSetup () const
 Global setup.
swift::misc::db::CUpdateInfo getUpdateInfo () const
 Update info.
void reloadUpdateInfo ()
 Reload update info.
swift::misc::db::CDistribution getOwnDistribution () const
 Own distribution.
const QString & versionStringDetailed () const
 String with beta, dev. and version.
const QString & swiftVersionString () const
 swift info string
const char * swiftVersionChar ()
 swift info string
bool isDeveloperFlagSet () const
 Running with dev.flag?
QString getInfoString (const QString &separator) const
 Comprehensive info.
void restartApplication (const QStringList &newArguments={}, const QStringList &removeArguments={})
 Stop and restart application.
int exec ()
 Finishes initialization and executes the event loop.
bool hasUnsavedSettings () const
 Unsaved settings.
void saveSettingsOnShutdown (bool saveSettings)
 Save settings on shutdown.
QStringList getUnsavedSettingsKeys () const
 All unsaved settings.
swift::misc::CStatusMessage saveSettingsByKey (const QStringList &keys)
 Save all settings.
QStringList argumentsJoined (const QStringList &newArguments={}, const QStringList &removeArguments={}) const
 Current parameters replaced by new arguments without the cmd line argument.
void enableCrashDumpUpload (bool enable)
 Enable crash upload.
bool isSupportingCrashpad () const
 Has crashpad support?
CInputManager * getInputManager () const
 The input manager, if available.
QPointer< ISimulator > getISimulator () const
 The simulator plugin, if available.
bool hasSimulator () const
 Simulator object available?
swift::misc::shared_state::CDataLinkDBus * getDataLinkDBus ()
 Transport mechanism for sharing state between applications.
bool hasSetupReader () const
 Setup reader?
CSetupReader * getSetupReader () const
 Access to setup reader.
bool isSetupAvailable () const
 Setup already synchronized.
swift::misc::network::CUrl getVatsimMetarUrl () const
 Consolidated version of METAR URLs, either from CGlobalSetup or CVatsimSetup.
swift::misc::network::CUrl getVatsimDataFileUrl () const
 Consolidated version of data file URL, either from CGlobalSetup or CVatsimSetup.
swift::misc::network::CUrl getVatsimServerFileUrl () const
 Get URL to file which contains the list of VATSIM servers.
swift::misc::network::CUrl getVatsimFsdHttpUrl () const
 Get VATSIM FSD HTTP URL.
virtual bool start ()
 Start services, if not yet parsed call CApplication::parse.
bool addParserOption (const QCommandLineOption &option)
bool addParserOptions (const QList< QCommandLineOption > &options)
void addDBusAddressOption ()
 CMD line argument for DBus address.
QString getCmdDBusAddressValue () const
 DBus address from CMD line, otherwise "".
void addAudioOptions ()
 Add the audio options.
bool skipSingleApplicationCheck () const
 Skip the single application check.
bool isParserOptionSet (const QString &option) const
 Delegates to QCommandLineParser::isSet.
bool isParserOptionSet (const QCommandLineOption &option) const
 Delegates to QCommandLineParser::isSet.
QString getParserValue (const QString &option) const
 Delegates to QCommandLineParser::value.
QString getParserValue (const QCommandLineOption &option) const
 Delegates to QCommandLineParser::value.
bool parseCommandLineArgsAndLoadSetup ()
 Combined function that does a startup check, parses the command line arguments and loads the setup.
bool supportsContexts (bool ignoreShutdownTest=false) const
 Supports contexts.
const CCoreFacadeConfig & getCoreFacadeConfig () const
 The core facade config.
swift::misc::CStatusMessageList initContextsAndStartCoreFacade (const CCoreFacadeConfig &coreConfig)
 Init the contexts part and start core facade.
swift::misc::CStatusMessageList startCoreFacadeWithoutContexts ()
 Starts the core facade without any contexts.
swift::misc::CStatusMessageList initAndStartWebDataServices (CWebReaderFlags::WebReader webReader, const db::CDatabaseReaderConfigList &dbReaderConfig)
 Init web data services and start them.
CCoreFacade * getCoreFacade ()
 Get the facade.
bool isLocalContext () const
 Local application? (not DBus).
bool isDBusContext () const
 DBus application? (not Local).
const CCoreFacade * getCoreFacade () const
 Get the facade.
const context::IContextNetwork * getIContextNetwork () const
 Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextAudio * getIContextAudio () const
 Direct access to contexts if a CCoreFacade has been initialized.
const context::CContextAudioBase * getCContextAudioBase () const
 Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextApplication * getIContextApplication () const
 Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextOwnAircraft * getIContextOwnAircraft () const
 Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextSimulator * getIContextSimulator () const
 Direct access to contexts if a CCoreFacade has been initialized.
context::IContextNetwork * getIContextNetwork ()
 Direct access to contexts if a CCoreFacade has been initialized.
context::IContextAudio * getIContextAudio ()
 Direct access to contexts if a CCoreFacade has been initialized.
context::CContextAudioBase * getCContextAudioBase ()
 Direct access to contexts if a CCoreFacade has been initialized.
context::IContextApplication * getIContextApplication ()
 Direct access to contexts if a CCoreFacade has been initialized.
context::IContextOwnAircraft * getIContextOwnAircraft ()
 Direct access to contexts if a CCoreFacade has been initialized.
context::IContextSimulator * getIContextSimulator ()
 Direct access to contexts if a CCoreFacade has been initialized.
void deleteAllCookies ()
 Delete all cookies from cookie manager.
const QNetworkAccessManager * getNetworkAccessManager () const
 Access to access manager.
QNetworkAccessManager * getNetworkAccessManager ()
 Access to access manager.
bool hasWebDataServices () const
 Web data services available?
CWebDataServices * getWebDataServices () const
 Get the web data services.
QNetworkReply * getFromNetwork (const swift::misc::network::CUrl &url, const CallbackSlot &callback, int maxRedirects=DefaultMaxRedirects)
 Request to get network reply.
QNetworkReply * getFromNetwork (const swift::misc::network::CUrl &url, const CallbackSlot &callback, const ProgressSlot &progress, int maxRedirects=DefaultMaxRedirects)
 Request to get network reply.
QNetworkReply * getFromNetwork (const swift::misc::network::CUrl &url, int logId, const CallbackSlot &callback, const ProgressSlot &progress, int maxRedirects=DefaultMaxRedirects)
 Request to get network reply, supporting swift::misc::network::CUrlLog.
QNetworkReply * getFromNetwork (const QNetworkRequest &request, const CallbackSlot &callback, int maxRedirects=DefaultMaxRedirects)
 Request to get network reply.
QNetworkReply * getFromNetwork (const QNetworkRequest &request, const CallbackSlot &callback, const ProgressSlot &progress, int maxRedirects=DefaultMaxRedirects)
 Request to get network reply.
QNetworkReply * getFromNetwork (const QNetworkRequest &request, int logId, const CallbackSlot &callback, const ProgressSlot &progress, int maxRedirects=DefaultMaxRedirects)
 Request to get network reply, supporting swift::misc::network::CUrlLog.
QNetworkReply * deleteResourceFromNetwork (const QNetworkRequest &request, int logId, const CallbackSlot &callback, int maxRedirects=DefaultMaxRedirects)
 Request to delete a network resource from network, supporting swift::misc::network::CUrlLog.
QNetworkReply * postToNetwork (const QNetworkRequest &request, int logId, const QByteArray &data, const CallbackSlot &callback)
 Post to network.
QNetworkReply * postToNetwork (const QNetworkRequest &request, int logId, QHttpMultiPart *multiPart, const CallbackSlot &callback)
 Post to network.
QNetworkReply * headerFromNetwork (const swift::misc::network::CUrl &url, const CallbackSlot &callback, int maxRedirects=NoRedirects)
 Request to get network repy using HTTP's HEADER method.
QNetworkReply * headerFromNetwork (const QNetworkRequest &request, const CallbackSlot &callback, int maxRedirects=NoRedirects)
 Request to get network repy using HTTP's HEADER method.
QNetworkReply * downloadFromNetwork (const swift::misc::network::CUrl &url, const QString &saveAsFileName, const swift::misc::CSlot< void(const swift::misc::CStatusMessage &)> &callback, int maxRedirects=DefaultMaxRedirects)
 Download file from network and store it as passed.
Public Member Functions inherited from QObject
QBindable< QString > bindableObjectName ()
 QObject (QObject *parent)
 QT_NO_CONTEXTLESS_CONNECT QT_NO_CONTEXTLESS_CONNECT
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 Q_CLASSINFO (Name, Value)
 Q_EMIT Q_EMIT
 Q_ENUM (...)
 Q_ENUMS (...)
 Q_ENUM_NS (...)
 Q_FLAG (...)
 Q_FLAGS (...)
 Q_FLAG_NS (...)
 Q_GADGET Q_GADGET
 Q_GADGET_EXPORT (EXPORT_MACRO)
 Q_INTERFACES (...)
 Q_INVOKABLE Q_INVOKABLE
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 Q_NAMESPACE Q_NAMESPACE
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 Q_OBJECT Q_OBJECT
 Q_PROPERTY (...)
 Q_REVISION Q_REVISION
 Q_SET_OBJECT_NAME (Object)
 Q_SIGNAL Q_SIGNAL
 Q_SIGNALS Q_SIGNALS
 Q_SLOT Q_SLOT
 Q_SLOTS Q_SLOTS
T qobject_cast (QObject *object)
T qobject_cast (const QObject *object)
bool blockSignals (bool block)
virtual bool event (QEvent *e)
virtual bool eventFilter (QObject *watched, QEvent *event)
bool moveToThread (QThread *targetThread)
bool setProperty (const char *name, QVariant &&value)
bool setProperty (const char *name, const QVariant &value)
int startTimer (int interval, Qt::TimerType timerType)
int startTimer (std::chrono::nanoseconds interval, Qt::TimerType timerType)
void deleteLater ()
void destroyed (QObject *obj)
void installEventFilter (QObject *filterObj)
void killTimer (Qt::TimerId id)
void killTimer (int id)
void objectNameChanged (const QString &objectName)
void removeEventFilter (QObject *obj)
void setObjectName (QAnyStringView name)
void setObjectName (const QString &name)
void setParent (QObject *parent)
QList< QByteArray > dynamicPropertyNames () const const
QList< T > findChildren (QAnyStringView name, Qt::FindChildOptions options) const const
QList< T > findChildren (Qt::FindChildOptions options) const const
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
QObject * parent () const const
QString objectName () const const
QThread * thread () const const
QVariant property (const char *name) const const
T findChild (QAnyStringView name, Qt::FindChildOptions options) const const
T findChild (Qt::FindChildOptions options) const const
bool disconnect (const QObject *receiver, const char *method) const const
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
bool inherits (const char *className) const const
bool isQmlExposed () const const
bool isQuickItemType () const const
bool isWidgetType () const const
bool isWindowType () const const
bool signalsBlocked () const const
virtual const QMetaObject * metaObject () const const
const QObjectList & children () const const
void dumpObjectInfo () const const
void dumpObjectTree () const const
Public Member Functions inherited from swift::misc::CIdentifiable
const CIdentifier & identifier () const
 Get identifier.
void setIdentifier (const CIdentifier &identifier)
 Set identifier, allows to set an external identifier.
bool isMyIdentifier (const CIdentifier &otherIdentifier) const
 My identifier?

Static Public Member Functions

static CGuiApplication * instance ()
 Similar to.
static const QStringList & getLogCategories ()
 Own log categories.
static const QString & settingsOrganization ()
 Organization string used for settings, is the registry key under windows.
static bool removeAllWindowsSwiftRegistryEntries ()
 Remove all registry entries.
static void setWindowIcon (const QPixmap &icon)
 Set icon.
static QWidget * mainApplicationWidget ()
 Main application window widget.
static QMainWindow * mainApplicationWindow ()
 Main application window.
static swift::gui::IMainWindowAccess * mainWindowAccess ()
 Main window access interface.
static void exit (int retcode=0)
 Exit application, perform graceful shutdown and exit.
static QScreen * currentScreen ()
 Current screen.
static QRect currentScreenGeometry ()
 Current screen resolution.
static void modalWindowToFront ()
 Bring any modal dialog to front.
Static Public Member Functions inherited from swift::core::CApplication
static CApplication * instance ()
 Similar to.
static const QStringList & getLogCategories ()
 Own log categories.
static swift::misc::CApplicationInfoList getRunningApplications ()
 Information about all running apps (including this one only if exec() has already been called).
static bool isApplicationRunning (swift::misc::CApplicationInfo::Application application)
 Is application running?
static QString getTemporaryDirectory ()
 Directory for temporary files.
static bool registerAsRunning ()
 Register as running.
static bool unregisterAsRunning ()
 Unregister from running.
static void exit (int retcode=EXIT_SUCCESS)
 Exit application, perform graceful shutdown and exit.
static void processEventsFor (int milliseconds)
 Process all events for some time.
static QStringList clearCaches ()
 Clear the caches.
static QStringList arguments ()
 Similar to QCoreApplication::arguments.
Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString tr (const char *sourceText, const char *disambiguation, int n)
bool disconnect (const QMetaObject::Connection &connection)
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)

Protected Member Functions

bool parsingHookIn ()
 Handle parsing of special GUI cmd arguments.
void onCoreFacadeStarted ()
 Called when facade/contexts have been started.
void onStartUpCompleted ()
 Startup completed.
void checkNewVersion (bool onlyIfNew)
 Check for a new version (update).
QString getFontInfo () const
 Info about font.
Protected Member Functions inherited from swift::core::CApplication
void init (bool withMetadata)
 Init class, allows to init from swift::gui::CGuiApplication as well (pseudo virtual).
virtual swift::misc::CStatusMessageList startHookIn ()
 Can be used to start special services.
bool isSet (const QCommandLineOption &option) const
 Flag set or explicitly set to true.
swift::misc::CStatusMessageList startCoreFacade ()
 Start the core facade.
swift::misc::CStatusMessageList startWebDataServices (CWebReaderFlags::WebReader webReader, const db::CDatabaseReaderConfigList &dbReaderConfig)
 Start the web data services.
Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const QMetaMethod &signal)
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const QMetaMethod &signal)
virtual void timerEvent (QTimerEvent *event)
QObject * sender () const const
bool isSignalConnected (const QMetaMethod &signal) const const
int receivers (const char *signal) const const
int senderSignalIndex () const const
Protected Member Functions inherited from swift::misc::CIdentifiable
 CIdentifiable (const QString &objectName)
 Use literal based object name.
 CIdentifiable (QObject *nameProvider)
 Connect with QObject providing the name.
 CIdentifiable ()
 Construct without a name.
 ~CIdentifiable ()
 Destructor.
 CIdentifiable (const CIdentifiable &)=default
 Copy constructor.
CIdentifiable & operator= (const CIdentifiable &)=default
 Copy assignment operator.

Static Protected Member Functions

static void registerMetadata ()
 Register metadata.
Static Protected Member Functions inherited from swift::core::CApplication
static int indexOfCommandLineOption (const QCommandLineOption &option, const QStringList &args=CApplication::arguments())
 Is the command line option represented in the given arguments?
static void argumentsWithoutOption (const QCommandLineOption &option, QStringList &args)
 Arguments without that given option.
static const QString & executable ()
 executable name
static void registerMetadata ()
 Register metadata.

Additional Inherited Members

using CallbackSlot = swift::misc::CSlot<void(QNetworkReply *)>
 The network reply callback when request is completed.
using ProgressSlot = swift::misc::CSlot<void(int, qint64, qint64, const QUrl &)>
 The progress slot.
Public Types inherited from QObject
enum  TimerId
Public Attributes inherited from QObject
typedef QObjectList
 Invalid
static constexpr int NoRedirects = -1
 network request not allowing redirects
static constexpr int NoLogRequestId = -1
 network request without logging
static constexpr int DefaultMaxRedirects = 2
 network request, default for max.redirects
Protected Attributes inherited from swift::core::CApplication
QList< QCommandLineOption > m_allOptions
 All registered options.
QCommandLineParser m_parser
 cmd parser
QCommandLineOption m_cmdHelp { "help" }
 help option
QCommandLineOption m_cmdVersion { "version" }
 version option
QCommandLineOption m_cmdDBusAddress { "emptyDBus" }
 DBus address.
QCommandLineOption m_cmdDevelopment { "dev" }
 Development flag.
QCommandLineOption m_cmdClearCache { "clearcache" }
 Clear cache.
QCommandLineOption m_cmdTestCrashpad { "testcrashpad" }
 Test a crasphpad upload.
QCommandLineOption m_cmdSkipSingleApp { "skipsa" }
 Skip test for single application.
bool m_parsed = false
 Parsing accomplished?
bool m_started = false
 Started with success?
bool m_alreadyRunning = false
 Application already running.
std::atomic_bool m_shutdown { false }
 Is being shutdown?
std::atomic_bool m_incognito { false }
 Incognito mode?
std::atomic_bool m_shutdownInProgress { false }
 shutdown in progress?
Properties inherited from QObject
 objectName

Detailed Description

GUI application, a specialized version of swift::core::CApplication for GUI applications.

Analog to QCoreApplication and QApplication this class provides more details for swift GUI applications. It is normally used via the global sGui pointer. As an example of how to extend this class see CSwiftGuiStdApplication.

  • style sheet handling
  • standard menus
  • splash screen support

Definition at line 57 of file guiapplication.h.

Constructor & Destructor Documentation

◆ CGuiApplication()

swift::gui::CGuiApplication::CGuiApplication ( const QString & applicationName = executable(),
swift::misc::CApplicationInfo::Application application = swift::misc::CApplicationInfo::Unknown,
const QPixmap & icon = swift::misc::CIcons::swift64() )
explicit

Constructor.

Definition at line 108 of file guiapplication.cpp.

◆ ~CGuiApplication()

swift::gui::CGuiApplication::~CGuiApplication ( )

Destructor.

Definition at line 135 of file guiapplication.cpp.

Member Function Documentation

◆ addMenuFile()

void swift::gui::CGuiApplication::addMenuFile ( QMenu & menu)

File menu.

Definition at line 698 of file guiapplication.cpp.

◆ addMenuForSettingsAndCache()

void swift::gui::CGuiApplication::addMenuForSettingsAndCache ( QMenu & menu)

Add menu items for settings and cache.

Definition at line 573 of file guiapplication.cpp.

◆ addMenuForStyleSheets()

void swift::gui::CGuiApplication::addMenuForStyleSheets ( QMenu & menu)

Add menu for style sheets.

Definition at line 673 of file guiapplication.cpp.

◆ addMenuHelp()

void swift::gui::CGuiApplication::addMenuHelp ( QMenu & menu)

Help operations.

Definition at line 915 of file guiapplication.cpp.

◆ addMenuInternals()

void swift::gui::CGuiApplication::addMenuInternals ( QMenu & menu)

Internals menu.

Definition at line 731 of file guiapplication.cpp.

◆ addMenuWindow()

void swift::gui::CGuiApplication::addMenuWindow ( QMenu & menu)

Window operations.

Definition at line 829 of file guiapplication.cpp.

◆ addWindowFlags()

void swift::gui::CGuiApplication::addWindowFlags ( Qt::WindowFlags flags)

Set window flag on main application window.

Definition at line 271 of file guiapplication.cpp.

◆ addWindowModeOption()

void swift::gui::CGuiApplication::addWindowModeOption ( )

CMD line arguments.

Definition at line 143 of file guiapplication.cpp.

◆ addWindowResetSizeOption()

void swift::gui::CGuiApplication::addWindowResetSizeOption ( )

CMD line arguments (reset size store).

Definition at line 151 of file guiapplication.cpp.

◆ addWindowStateOption()

void swift::gui::CGuiApplication::addWindowStateOption ( )

CMD line arguments.

Definition at line 158 of file guiapplication.cpp.

◆ checkNewVersion()

void swift::gui::CGuiApplication::checkNewVersion ( bool onlyIfNew)
protected

Check for a new version (update).

Definition at line 1122 of file guiapplication.cpp.

◆ cmdLineErrorMessage() [1/2]

void swift::gui::CGuiApplication::cmdLineErrorMessage ( const QString & text,
const QString & informativeText ) const
virtual

print messages generated during parsing / cmd handling

Reimplemented from swift::core::CApplication.

Definition at line 483 of file guiapplication.cpp.

◆ cmdLineErrorMessage() [2/2]

void swift::gui::CGuiApplication::cmdLineErrorMessage ( const swift::misc::CStatusMessageList & msgs) const
virtual

print messages generated during parsing / cmd handling

Reimplemented from swift::core::CApplication.

Definition at line 496 of file guiapplication.cpp.

◆ currentScreen()

QScreen * swift::gui::CGuiApplication::currentScreen ( )
static

Current screen.

Definition at line 316 of file guiapplication.cpp.

◆ currentScreenGeometry()

QRect swift::gui::CGuiApplication::currentScreenGeometry ( )
static

Current screen resolution.

Remarks
logical resolution, not physical resolution

Definition at line 330 of file guiapplication.cpp.

◆ displayInOverlayWindow() [1/3]

bool swift::gui::CGuiApplication::displayInOverlayWindow ( const QString & html,
std::chrono::milliseconds timeout = std::chrono::milliseconds(0) )

direct access to main application window

Definition at line 558 of file guiapplication.cpp.

◆ displayInOverlayWindow() [2/3]

bool swift::gui::CGuiApplication::displayInOverlayWindow ( const swift::misc::CStatusMessage & message,
std::chrono::milliseconds timeout = std::chrono::milliseconds(0) )

direct access to main application window

Definition at line 528 of file guiapplication.cpp.

◆ displayInOverlayWindow() [3/3]

bool swift::gui::CGuiApplication::displayInOverlayWindow ( const swift::misc::CStatusMessageList & messages,
std::chrono::milliseconds timeout = std::chrono::milliseconds(0) )

direct access to main application window

Definition at line 543 of file guiapplication.cpp.

◆ displayInStatusBar()

bool swift::gui::CGuiApplication::displayInStatusBar ( const swift::misc::CStatusMessage & message)

direct access to main application window

Definition at line 517 of file guiapplication.cpp.

◆ displaySetupLoadFailure()

void swift::gui::CGuiApplication::displaySetupLoadFailure ( swift::misc::CStatusMessageList msgs)
virtual

Display the failures caused by loading the setup file.

Reimplemented from swift::core::CApplication.

Definition at line 1064 of file guiapplication.cpp.

◆ exit()

void swift::gui::CGuiApplication::exit ( int retcode = 0)
static

Exit application, perform graceful shutdown and exit.

Definition at line 314 of file guiapplication.cpp.

◆ getFontInfo()

QString swift::gui::CGuiApplication::getFontInfo ( ) const
protected

Info about font.

Definition at line 1141 of file guiapplication.cpp.

◆ getLogCategories()

const QStringList & swift::gui::CGuiApplication::getLogCategories ( )
static

Own log categories.

Definition at line 74 of file guiapplication.cpp.

◆ getStyleSheetUtility()

const CStyleSheetUtility & swift::gui::CGuiApplication::getStyleSheetUtility ( ) const

Style sheet handling.

Definition at line 1008 of file guiapplication.cpp.

◆ getWidgetStyle()

QString swift::gui::CGuiApplication::getWidgetStyle ( ) const

Current widget style.

Definition at line 1010 of file guiapplication.cpp.

◆ getWindowMode()

CEnableForFramelessWindow::WindowMode swift::gui::CGuiApplication::getWindowMode ( ) const

Window mode (window flags).

Definition at line 178 of file guiapplication.cpp.

◆ getWindowState()

Qt::WindowState swift::gui::CGuiApplication::getWindowState ( ) const

Window state.

Definition at line 165 of file guiapplication.cpp.

◆ gracefulShutdown()

void swift::gui::CGuiApplication::gracefulShutdown ( )
virtual

Graceful shutdown.

Todo
KB 3-2020 remove as soon as the info status bar blocks shutdown bug is fixed ref: https://discordapp.com/channels/539048679160676382/539846348275449887/693848134811517029

Reimplemented from swift::core::CApplication.

Definition at line 1288 of file guiapplication.cpp.

◆ hasMinimumMappingVersion()

bool swift::gui::CGuiApplication::hasMinimumMappingVersion ( ) const
virtual

Minimum mapping version check.

Reimplemented from swift::core::CApplication.

Definition at line 225 of file guiapplication.cpp.

◆ initMainApplicationWidget()

void swift::gui::CGuiApplication::initMainApplicationWidget ( QWidget * mainWidget)

Init the main application window based on information in this application.

Remarks
can be QDialog, QMainWindow

Definition at line 250 of file guiapplication.cpp.

◆ instance()

CGuiApplication * swift::gui::CGuiApplication::instance ( )
static

Similar to.

See also
QCoreApplication::instance() returns the single instance

Definition at line 72 of file guiapplication.cpp.

◆ isCmdWindowSizeResetSet()

bool swift::gui::CGuiApplication::isCmdWindowSizeResetSet ( ) const

Window size reset mode set.

Definition at line 515 of file guiapplication.cpp.

◆ mainApplicationWidget()

QWidget * swift::gui::CGuiApplication::mainApplicationWidget ( )
static

Main application window widget.

Definition at line 218 of file guiapplication.cpp.

◆ mainApplicationWindow()

QMainWindow * swift::gui::CGuiApplication::mainApplicationWindow ( )
static

Main application window.

Definition at line 239 of file guiapplication.cpp.

◆ mainWindowAccess()

IMainWindowAccess * swift::gui::CGuiApplication::mainWindowAccess ( )
static

Main window access interface.

Definition at line 244 of file guiapplication.cpp.

◆ modalWindowToFront()

void swift::gui::CGuiApplication::modalWindowToFront ( )
static

Bring any modal dialog to front.

Definition at line 337 of file guiapplication.cpp.

◆ onCoreFacadeStarted()

void swift::gui::CGuiApplication::onCoreFacadeStarted ( )
protectedvirtual

Called when facade/contexts have been started.

Reimplemented from swift::core::CApplication.

Definition at line 1117 of file guiapplication.cpp.

◆ onStartUpCompleted()

void swift::gui::CGuiApplication::onStartUpCompleted ( )
protectedvirtual

Startup completed.

Reimplemented from swift::core::CApplication.

Definition at line 438 of file guiapplication.cpp.

◆ openStandardCrashDumpDirectory()

bool swift::gui::CGuiApplication::openStandardCrashDumpDirectory ( )

Opens the standard dumps directory.

Definition at line 1038 of file guiapplication.cpp.

◆ openStandardLogDirectory()

bool swift::gui::CGuiApplication::openStandardLogDirectory ( )

Opens the standard log directory.

Definition at line 1028 of file guiapplication.cpp.

◆ openStandardWidgetStyleSheet()

bool swift::gui::CGuiApplication::openStandardWidgetStyleSheet ( )

Opens the standard stylesheet.

Definition at line 1022 of file guiapplication.cpp.

◆ openUrl()

void swift::gui::CGuiApplication::openUrl ( const swift::misc::network::CUrl & url)

Open a given URL.

Definition at line 906 of file guiapplication.cpp.

◆ parsingHookIn()

bool swift::gui::CGuiApplication::parsingHookIn ( )
protectedvirtual

Handle parsing of special GUI cmd arguments.

Reimplemented from swift::core::CApplication.

Reimplemented in CSwiftDataApplication, and CSwiftGuiStdApplication.

Definition at line 1115 of file guiapplication.cpp.

◆ processEventsToRefreshGui()

void swift::gui::CGuiApplication::processEventsToRefreshGui ( ) const

Allow the GUI to refresh by processing events, call the event loop.

Definition at line 209 of file guiapplication.cpp.

◆ registerMainApplicationWidget()

void swift::gui::CGuiApplication::registerMainApplicationWidget ( QWidget * mainWidget)

Register main application window widget if this is known.

Remarks
if not set, is is searched from QApplication::topLevelWidgets()

Definition at line 220 of file guiapplication.cpp.

◆ registerMetadata()

void swift::gui::CGuiApplication::registerMetadata ( )
staticprotected

Register metadata.

Definition at line 137 of file guiapplication.cpp.

◆ reloadStyleSheets()

bool swift::gui::CGuiApplication::reloadStyleSheets ( )

Reload style sheets.

Definition at line 1020 of file guiapplication.cpp.

◆ removeAllWindowsSwiftRegistryEntries()

bool swift::gui::CGuiApplication::removeAllWindowsSwiftRegistryEntries ( )
static

Remove all registry entries.

Definition at line 86 of file guiapplication.cpp.

◆ resetFont()

bool swift::gui::CGuiApplication::resetFont ( )

Reset the font to default.

Definition at line 1056 of file guiapplication.cpp.

◆ resetWindowGeometryAndState()

void swift::gui::CGuiApplication::resetWindowGeometryAndState ( )

Reset the saved values.

Definition at line 383 of file guiapplication.cpp.

◆ restoreWindowGeometryAndState()

bool swift::gui::CGuiApplication::restoreWindowGeometryAndState ( QMainWindow * window = CGuiApplication::mainApplicationWindow())

Restore widget's geometry and state.

Definition at line 391 of file guiapplication.cpp.

◆ saveWindowGeometryAndState()

bool swift::gui::CGuiApplication::saveWindowGeometryAndState ( const QMainWindow * window = CGuiApplication::mainApplicationWindow()) const

Save widget's geometry and state.

Definition at line 371 of file guiapplication.cpp.

◆ setExtraWindowTitle()

QString swift::gui::CGuiApplication::setExtraWindowTitle ( const QString & extraInfo,
QWidget * mainWindowWidget = mainApplicationWidget() ) const

Set window title.

Definition at line 293 of file guiapplication.cpp.

◆ setMinimumSizeInCharacters()

void swift::gui::CGuiApplication::setMinimumSizeInCharacters ( int widthChars,
int heightChars )

Set minimum width/height in characters.

Deprecated
kept for experimental tests

Definition at line 1058 of file guiapplication.cpp.

◆ setSaveMainWidgetState()

void swift::gui::CGuiApplication::setSaveMainWidgetState ( bool save)
inline

Save the main widget state?

Definition at line 225 of file guiapplication.h.

◆ settingsOrganization()

const QString & swift::gui::CGuiApplication::settingsOrganization ( )
static

Organization string used for settings, is the registry key under windows.

Definition at line 80 of file guiapplication.cpp.

◆ setWindowIcon()

void swift::gui::CGuiApplication::setWindowIcon ( const QPixmap & icon)
static

Set icon.

Note
Pixmap requires a valid QApplication, so it cannot be passed as constructor parameter

Definition at line 308 of file guiapplication.cpp.

◆ showChangelog()

void swift::gui::CGuiApplication::showChangelog ( ) const

Show changelog popup.

Definition at line 968 of file guiapplication.cpp.

◆ showCloseDialog()

QDialog::DialogCode swift::gui::CGuiApplication::showCloseDialog ( QMainWindow * mainWindow,
QCloseEvent * closeEvent )

Show close dialog.

Remarks
will modify CApplication::saveSettingsOnShutdown

Definition at line 1080 of file guiapplication.cpp.

◆ showHelp()

void swift::gui::CGuiApplication::showHelp ( const QString & subpath = {}) const

Show help page (online help).

Definition at line 957 of file guiapplication.cpp.

◆ splashScreen()

void swift::gui::CGuiApplication::splashScreen ( const QPixmap & pixmap)

Add a splash screen based on resource, empty means remove splash screen.

Definition at line 191 of file guiapplication.cpp.

◆ toggleStayOnTop()

bool swift::gui::CGuiApplication::toggleStayOnTop ( )

Toggle stay on top.

Definition at line 1153 of file guiapplication.cpp.

◆ triggerNewVersionCheck()

void swift::gui::CGuiApplication::triggerNewVersionCheck ( int delayedMs)

Trigger new version check.

Definition at line 1269 of file guiapplication.cpp.

◆ updateFont() [1/2]

bool swift::gui::CGuiApplication::updateFont ( const QString & fontFamily,
const QString & fontSize,
const QString & fontStyle,
const QString & fontWeight,
const QString & fontColor )

Update the fonts.

Definition at line 1048 of file guiapplication.cpp.

◆ updateFont() [2/2]

bool swift::gui::CGuiApplication::updateFont ( const QString & qss)

Update the fonts.

Definition at line 1054 of file guiapplication.cpp.

◆ windowMinimizeNormalToggle()

void swift::gui::CGuiApplication::windowMinimizeNormalToggle ( )

Window minimize/normalize.

Definition at line 1245 of file guiapplication.cpp.

◆ windowToBack()

void swift::gui::CGuiApplication::windowToBack ( )

Window to front/back.

Definition at line 1187 of file guiapplication.cpp.

◆ windowToFront()

void swift::gui::CGuiApplication::windowToFront ( )

Window to front/back.

Definition at line 1167 of file guiapplication.cpp.

◆ windowToFrontBackToggle()

void swift::gui::CGuiApplication::windowToFrontBackToggle ( )

Window to front/back.

Definition at line 1208 of file guiapplication.cpp.


The documentation for this class was generated from the following files: