| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/app/app.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "app.h"cxx . . $ `<file>/src/app/app.h`/ |
| 5 | |
| 6 | #include "common/stringutils.h"cxx . . $ `<file>/src/common/stringutils.h`/ |
| 7 | #include "core/isession.h"cxx . . $ `<file>/src/core/isession.h`/ |
| 8 | #include "core/isysmodelsyncer.h"cxx . . $ `<file>/src/core/isysmodelsyncer.h`/ |
| 9 | #include "core/iuifactory.h"cxx . . $ `<file>/src/core/iuifactory.h`/ |
| 10 | #include "corefactory.h"cxx . . $ `<file>/src/app/corefactory.h`/ |
| 11 | #include "helper/ihelpercontrol.h"cxx . . $ `<file>/src/helper/ihelpercontrol.h`/ |
| 12 | #include "settings.h"cxx . . $ `<file>/src/app/settings.h`/ |
| 13 | #include "systray.h"cxx . . $ `<file>/src/app/systray.h`/ |
| 14 | #include <QApplication> |
| 15 | #include <QCommandLineParser> |
| 16 | #include <QIcon> |
| 17 | #include <QLocale> |
| 18 | #include <QQmlApplicationEngine> |
| 19 | #include <QQmlContext> |
| 20 | #include <QQuickWindow> |
| 21 | #include <QTranslator> |
| 22 | #include <Qt> |
| 23 | #include <QtGlobal> |
| 24 | #include <algorithm> |
| 25 | #include <spdlog/spdlog.h> |
| 26 | #include <units.h> |
| 27 | #include <utility> |
| 28 | |
| 29 | #if defined(_DEBUG) |
| 30 | #include <QQmlDebuggingEnabler> |
| 31 | #endif |
| 32 | |
| 33 | Appcxx . . $ App#::Appcxx . . $ App#App(ced63f7c635d850d).() noexcept |
| 34 | : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).() |
| 35 | , appInfo_cxx . . $ App#appInfo_.(Appcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Namecxx . . $ App#Name., Appcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::VersionStrcxx . . $ App#VersionStr.) |
| 36 | , singleInstance_cxx . . $ App#singleInstance_.(Appcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Namecxx . . $ App#Name.) |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | Appcxx . . $ App#::~cxx . . $ App#`~App`(ced63f7c635d850d).Appcxx . . $ App#() = default; |
| 41 | |
| 42 | int Appcxx . . $ App#::execcxx . . $ App#exec(afcd3168fc1188a4).(int argc, char **argv) |
| 43 | { |
| 44 | auto defaultHelperTimeout = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).( |
| 45 | 180000, // default helper timeout in milliseconds |
| 46 | IHelperControlcxx . . $ IHelperControl#::MinExitTimeoutcxx . . $ IHelperControl#MinExitTimeout#::valuecxx . . $ units/unit_value_t#value(ca235afb30d3d25b).().tocxx . . $ units/unit_t#to(88b827abdede45d2).<int>()); |
| 47 | |
| 48 | auto app = createApplicationcxx . . $ App#createApplication(18e5855537ba6ac6).(argc, argv); |
| 49 | setupCmdParsercxx . . $ App#setupCmdParser(d3b3afeca10188ab).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).app, defaultHelperTimeout); |
| 50 | |
| 51 | noop_cxx . . $ App#noop_. = cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("help"cxx . . $ QString#QString(85c52e162fed56f9).) || cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("version"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 52 | if (noop_cxx . . $ App#noop_.) |
| 53 | return 0; |
| 54 | |
| 55 | // Exit if there is another instance running. |
| 56 | if (!singleInstance_cxx . . $ App#singleInstance_..mainInstancecxx . . $ SingleInstance#mainInstance(c63a3976d2485717).(app->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).argumentscxx . . $ QCoreApplication#arguments(346f0183abd8f69).())) |
| 57 | return 0; |
| 58 | |
| 59 | QTranslatorcxx . . $ QTranslator# translatorcxx . . $ QTranslator#QTranslator(749de1b6ae65bddd).; |
| 60 | loadTranslationcxx . . $ App#loadTranslation(708c03dc0e9d9c50).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).app, translator); |
| 61 | |
| 62 | QQmlApplicationEnginecxx . . $ QQmlApplicationEngine# qmlEnginecxx . . $ QQmlApplicationEngine#QQmlApplicationEngine(749de1b6ae65bddd).; |
| 63 | bool logCommands = cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("enable-log-commands"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 64 | bool logProfileStack = cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("enable-log-profile-stack"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 65 | if (!buildComponentscxx . . $ App#buildComponents(f2fa5d72e9dda83e).(qmlEngine, helperTimeoutcxx . . $ App#helperTimeout(7ccb52b1bfe01045).(defaultHelperTimeout), |
| 66 | logCommands, logProfileStack)) |
| 67 | return -1; |
| 68 | |
| 69 | // Load and apply stored settings. |
| 70 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).signalSettingscxx . . $ Settings#signalSettings(49f6e7a06ebc5aa8).(); |
| 71 | |
| 72 | setupSysTrayWindowStatecxx . . $ App#setupSysTrayWindowState(49f6e7a06ebc5aa8).(); |
| 73 | handleManualProfileCmdcxx . . $ App#handleManualProfileCmd(c9857a73d68e59ba).(); |
| 74 | |
| 75 | return app->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).execcxx . . $ QApplication#exec(b126dc7c1de90089).(); |
| 76 | } |
| 77 | |
| 78 | void Appcxx . . $ App#::exitcxx . . $ App#exit(49f6e7a06ebc5aa8).() |
| 79 | { |
| 80 | if (!noop_cxx . . $ App#noop_.) { |
| 81 | sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).stopcxx . . $ ISysModelSyncer#stop(49f6e7a06ebc5aa8).(); |
| 82 | helperControl_cxx . . $ App#helperControl_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).stopcxx . . $ IHelperControl#stop(49f6e7a06ebc5aa8).(); |
| 83 | |
| 84 | // Shutdown spdlog before QApplication quits to always flush the logs. |
| 85 | // See: https://github.com/gabime/spdlog/issues/2502 |
| 86 | spdlogcxx . . $ spdlog/::shutdowncxx . . $ spdlog/shutdown(49f6e7a06ebc5aa8).(); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void Appcxx . . $ App#::showMainWindowcxx . . $ App#showMainWindow(b45ddcbc8423892c).(bool show) |
| 91 | { |
| 92 | if (show) { |
| 93 | mainWindow_cxx . . $ App#mainWindow_.->showcxx . . $ QWindow#show(49f6e7a06ebc5aa8).(); |
| 94 | mainWindow_cxx . . $ App#mainWindow_.->raisecxx . . $ QWindow#raise(49f6e7a06ebc5aa8).(); |
| 95 | mainWindow_cxx . . $ App#mainWindow_.->requestActivatecxx . . $ QWindow#requestActivate(49f6e7a06ebc5aa8).(); |
| 96 | } |
| 97 | else { |
| 98 | if (sysTray_cxx . . $ App#sysTray_.->isVisiblecxx . . $ SysTray#isVisible(50ce9a9e25b4a850).()) |
| 99 | mainWindow_cxx . . $ App#mainWindow_.->hidecxx . . $ QWindow#hide(49f6e7a06ebc5aa8).(); |
| 100 | else |
| 101 | mainWindow_cxx . . $ App#mainWindow_.->showMinimizedcxx . . $ QWindow#showMinimized(49f6e7a06ebc5aa8).(); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | void Appcxx . . $ App#::onNewInstancecxx . . $ App#onNewInstance(3735af3af936f19).(QStringListcxx . . $ QStringList# args) |
| 106 | { |
| 107 | cmdParser_cxx . . $ App#cmdParser_..parsecxx . . $ QCommandLineParser#parse(c63a3976d2485717).(args); |
| 108 | |
| 109 | bool runtimeCmds{false}; |
| 110 | runtimeCmds |= handleLoggingCmdscxx . . $ App#handleLoggingCmds(c9857a73d68e59ba).(); |
| 111 | runtimeCmds |= handleManualProfileCmdcxx . . $ App#handleManualProfileCmd(c9857a73d68e59ba).(); |
| 112 | runtimeCmds |= handleWindowVisibilityCmdscxx . . $ App#handleWindowVisibilityCmds(c9857a73d68e59ba).(); |
| 113 | |
| 114 | // No runtime commands were used as arguments. |
| 115 | // Show the main window unconditionally. |
| 116 | if (!runtimeCmds) |
| 117 | showMainWindowcxx . . $ App#showMainWindow(b45ddcbc8423892c).(true); |
| 118 | } |
| 119 | |
| 120 | void Appcxx . . $ App#::onSysTrayActivatedcxx . . $ App#onSysTrayActivated(49f6e7a06ebc5aa8).() |
| 121 | { |
| 122 | showMainWindowcxx . . $ App#showMainWindow(b45ddcbc8423892c).(!mainWindow_cxx . . $ App#mainWindow_.->isVisiblecxx . . $ QWindow#isVisible(50ce9a9e25b4a850).()); |
| 123 | } |
| 124 | |
| 125 | void Appcxx . . $ App#::onSettingChangedcxx . . $ App#onSettingChanged(1c60a90c724e6bfb).(QStringcxx . . $ QString# const &key, QVariantcxx . . $ QVariant# const &value) |
| 126 | { |
| 127 | sysTray_cxx . . $ App#sysTray_.->settingChangedcxx . . $ SysTray#settingChanged(1c60a90c724e6bfb).(key, value); |
| 128 | sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).settingChangedcxx . . $ ISysModelSyncer#settingChanged(1c60a90c724e6bfb).(key, value); |
| 129 | } |
| 130 | |
| 131 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<QApplicationcxx . . $ QApplication#> Appcxx . . $ App#::createApplicationcxx . . $ App#createApplication(18e5855537ba6ac6).(int &argc, char **argv) |
| 132 | { |
| 133 | // Ignore QT_STYLE_OVERRIDE. It breaks the QML theme. |
| 134 | if (qEnvironmentVariableIsSetcxx . . $ qEnvironmentVariableIsSet(ab1b0059a8051c5c).("QT_STYLE_OVERRIDE")) { |
| 135 | SPDLOG_INFOcxx . . $ `<external>/13613935168682455490/spdlog.h:320:13`!("Ignoring QT_STYLE_OVERRIDE environment variable."); |
| 136 | qunsetenvcxx . . $ qunsetenv(c5f7da30cbc0f4e9).("QT_STYLE_OVERRIDE"); |
| 137 | } |
| 138 | |
| 139 | QCoreApplicationcxx . . $ QCoreApplication#::setApplicationNamecxx . . $ QCoreApplication#setApplicationName(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).(Appcxx . . $ App#::Namecxx . . $ App#Name..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()).toLowercxx . . $ QString#toLower(30b3b70527b1c61a).()); |
| 140 | QCoreApplicationcxx . . $ QCoreApplication#::setApplicationVersioncxx . . $ QCoreApplication#setApplicationVersion(3520e46b33348bf6).(Appcxx . . $ QString#QString(85c52e162fed56f9).::VersionStrcxx . . $ App#VersionStr..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()); |
| 141 | QGuiApplicationcxx . . $ QGuiApplication#::setDesktopFileNamecxx . . $ QGuiApplication#setDesktopFileName(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).(Appcxx . . $ App#::Fqdncxx . . $ App#Fqdn..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).())); |
| 142 | |
| 143 | auto app = stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<QApplicationcxx . . $ QApplication#>(argc, argv); |
| 144 | app->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).setWindowIconcxx . . $ QGuiApplication#setWindowIcon(71dcdac178620ed6).(QIconcxx . . $ QIcon#::fromThemecxx . . $ QIcon#fromTheme(ef5a0418eb2d5e9b).(QStringcxx . . $ QString#QString(85c52e162fed56f9).(Appcxx . . $ App#::Namecxx . . $ App#Name..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()).toLowercxx . . $ QString#toLower(30b3b70527b1c61a).())); |
| 145 | |
| 146 | // Ensure that the application do not implicitly call to quit after closing |
| 147 | // the last window, which is not the desired behaviour when minimize to |
| 148 | // system tray is being used. |
| 149 | app->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).setQuitOnLastWindowClosedcxx . . $ QGuiApplication#setQuitOnLastWindowClosed(b45ddcbc8423892c).(false); |
| 150 | |
| 151 | return appcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).; |
| 152 | } |
| 153 | |
| 154 | bool Appcxx . . $ App#::buildComponentscxx . . $ App#buildComponents(f2fa5d72e9dda83e).(QQmlApplicationEnginecxx . . $ QQmlApplicationEngine# &qmlEngine, int helperTimeout, |
| 155 | bool logCommands, bool logProfileStack) |
| 156 | { |
| 157 | try { |
| 158 | auto core = CoreFactorycxx . . $ CoreFactory#CoreFactory(ced63f7c635d850d).().buildcxx . . $ CoreFactory#build(46e3a3b3538ceca6).(stdcxx . . $ std/::stringcxx . . $ std/string#(Appcxx . . $ App#::Namecxx . . $ App#Name.), logCommands, |
| 159 | logProfileStack); |
| 160 | if (!core) |
| 161 | return false; |
| 162 | |
| 163 | stdcxx . . $ std/::swapcxx . . $ std/swap(6d240825346f475b).(helperControl_cxx . . $ App#helperControl_., core->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).helperControlcxx . . $ CoreFactory#Components#helperControl.); |
| 164 | stdcxx . . $ std/::swapcxx . . $ std/swap(3b794012d4e1c410).(sysSyncer_cxx . . $ App#sysSyncer_., core->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).sysSyncercxx . . $ CoreFactory#Components#sysSyncer.); |
| 165 | stdcxx . . $ std/::swapcxx . . $ std/swap(6d240825346f475b).(session_cxx . . $ App#session_., core->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).sessioncxx . . $ CoreFactory#Components#session.); |
| 166 | |
| 167 | settings_cxx . . $ App#settings_. =cxx . . $ std/unique_ptr#`operator=`(1b63e42eaa758a73). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<Settingscxx . . $ Settings#>(QStringcxx . . $ QString#QString(85c52e162fed56f9).(Appcxx . . $ App#::Namecxx . . $ App#Name..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()).toLowercxx . . $ QString#toLower(30b3b70527b1c61a).()); |
| 168 | |
| 169 | helperControl_cxx . . $ App#helperControl_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).initcxx . . $ IHelperControl#init(9920060bc6d69dd4).(unitscxx . . $ units/::timecxx . . $ units/time/::millisecond_tcxx . . $ units/time/millisecond_t#(helperTimeout)); |
| 170 | sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).initcxx . . $ ISysModelSyncer#init(49f6e7a06ebc5aa8).(); |
| 171 | session_cxx . . $ App#session_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).initcxx . . $ ISession#init(2ffe4369e6bd4764).(sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).sysModelcxx . . $ ISysModelSyncer#sysModel(aa35fd785725305d).()); |
| 172 | |
| 173 | buildUIcxx . . $ App#buildUI(f2395b2996da6f82).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(core->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).uiFactorycxx . . $ CoreFactory#Components#uiFactory.), qmlEngine); |
| 174 | } |
| 175 | catch (stdcxx . . $ std/::exception const &e) { |
| 176 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!(e.what()); |
| 177 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Initialization failed"); |
| 178 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Exiting..."); |
| 179 | return false; |
| 180 | } |
| 181 | |
| 182 | return true; |
| 183 | } |
| 184 | |
| 185 | void Appcxx . . $ App#::buildUIcxx . . $ App#buildUI(f2395b2996da6f82).(stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IUIFactorycxx . . $ IUIFactory#> &&uiFactory, |
| 186 | QQmlApplicationEnginecxx . . $ QQmlApplicationEngine# &qmlEngine) |
| 187 | { |
| 188 | qmlEngine.rootContextcxx . . $ QQmlEngine#rootContext(84d4a38f80cd3330).()->setContextPropertycxx . . $ QQmlContext#setContextProperty(6b24f83d17022bd9).("appInfo"cxx . . $ QString#QString(85c52e162fed56f9)., &appInfo_cxx . . $ App#appInfo_.); |
| 189 | qmlEngine.rootContextcxx . . $ QQmlEngine#rootContext(84d4a38f80cd3330).()->setContextPropertycxx . . $ QQmlContext#setContextProperty(6b24f83d17022bd9).("settings"cxx . . $ QString#QString(85c52e162fed56f9)., &*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).settings_cxx . . $ App#settings_.); |
| 190 | |
| 191 | uiFactory->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).buildcxx . . $ IUIFactory#build(a163a717a8fd9951).(qmlEngine, sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).sysModelcxx . . $ ISysModelSyncer#sysModel(aa35fd785725305d).(), *cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).session_cxx . . $ App#session_.); |
| 192 | |
| 193 | mainWindow_cxx . . $ App#mainWindow_. = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QQuickWindowcxx . . $ QQuickWindow# *>(qmlEngine.rootObjectscxx . . $ QQmlApplicationEngine#rootObjects(adb747650fc59aad).().valuecxx . . $ QList#value(be5542f01a25b32e).(0)); |
| 194 | setupMainWindowGeometrycxx . . $ App#setupMainWindowGeometry(49f6e7a06ebc5aa8).(); |
| 195 | |
| 196 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&qmlEngine, &QQmlApplicationEnginecxx . . $ QQmlApplicationEngine#::quitcxx . . $ QQmlEngine#quit(49f6e7a06ebc5aa8)., QApplicationcxx . . $ QApplication#::instancecxx . . $ QCoreApplication#instance(fc464b6fd63b8c1).(), |
| 197 | &QApplicationcxx . . $ QApplication#::quitcxx . . $ QCoreApplication#quit(49f6e7a06ebc5aa8).); |
| 198 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(QApplicationcxx . . $ QApplication#::instancecxx . . $ QCoreApplication#instance(fc464b6fd63b8c1).(), &QApplicationcxx . . $ QApplication#::aboutToQuitcxx . . $ QCoreApplication#aboutToQuit(10ef0bf3b6dd28bb)., this, &Appcxx . . $ App#::exitcxx . . $ App#exit(49f6e7a06ebc5aa8).); |
| 199 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).settings_cxx . . $ App#settings_., &Settingscxx . . $ Settings#::settingChangedcxx . . $ Settings#settingChanged(1c60a90c724e6bfb)., this, &Appcxx . . $ App#::onSettingChangedcxx . . $ App#onSettingChanged(1c60a90c724e6bfb).); |
| 200 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&singleInstance_cxx . . $ App#singleInstance_., &SingleInstancecxx . . $ SingleInstance#::newInstancecxx . . $ SingleInstance#newInstance(3735af3af936f19)., this, |
| 201 | &Appcxx . . $ App#::onNewInstancecxx . . $ App#onNewInstance(3735af3af936f19).); |
| 202 | |
| 203 | sysTray_cxx . . $ App#sysTray_. = new SysTraycxx . . $ SysTray#SysTray(89e3b8547c1c2b46).(&*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).session_cxx . . $ App#session_., mainWindow_cxx . . $ App#mainWindow_.); |
| 204 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(sysTray_cxx . . $ App#sysTray_., &SysTraycxx . . $ SysTray#::quitcxx . . $ SysTray#quit(49f6e7a06ebc5aa8)., this, &QApplicationcxx . . $ QApplication#::quitcxx . . $ QCoreApplication#quit(49f6e7a06ebc5aa8).); |
| 205 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(sysTray_cxx . . $ App#sysTray_., &SysTraycxx . . $ SysTray#::activatedcxx . . $ SysTray#activated(49f6e7a06ebc5aa8)., this, &Appcxx . . $ App#::onSysTrayActivatedcxx . . $ App#onSysTrayActivated(49f6e7a06ebc5aa8).); |
| 206 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(sysTray_cxx . . $ App#sysTray_., &SysTraycxx . . $ SysTray#::showMainWindowToggledcxx . . $ SysTray#showMainWindowToggled(b45ddcbc8423892c)., this, &Appcxx . . $ App#::showMainWindowcxx . . $ App#showMainWindow(b45ddcbc8423892c).); |
| 207 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(mainWindow_cxx . . $ App#mainWindow_., &QQuickWindowcxx . . $ QQuickWindow#::visibleChangedcxx . . $ QWindow#visibleChanged(b45ddcbc8423892c)., &*sysTray_cxx . . $ App#sysTray_., |
| 208 | &SysTraycxx . . $ SysTray#::onMainWindowVisibleChangedcxx . . $ SysTray#onMainWindowVisibleChanged(b45ddcbc8423892c).); |
| 209 | qmlEngine.rootContextcxx . . $ QQmlEngine#rootContext(84d4a38f80cd3330).()->setContextPropertycxx . . $ QQmlContext#setContextProperty(6b24f83d17022bd9).("systemTray"cxx . . $ QString#QString(85c52e162fed56f9)., sysTray_cxx . . $ App#sysTray_.); |
| 210 | } |
| 211 | |
| 212 | void Appcxx . . $ App#::loadTranslationcxx . . $ App#loadTranslation(708c03dc0e9d9c50).(QApplicationcxx . . $ QApplication# &app, QTranslatorcxx . . $ QTranslator# &translator) |
| 213 | { |
| 214 | QStringcxx . . $ QString# lang = cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("lang"cxx . . $ QString#QString(85c52e162fed56f9).) ? cmdParser_cxx . . $ App#cmdParser_..valuecxx . . $ QCommandLineParser#value(5555d9024dcf93fb).("lang"cxx . . $ QString#QString(85c52e162fed56f9).) |
| 215 | : QLocalecxx . . $ QLocale#QLocale(49f6e7a06ebc5aa8).().systemcxx . . $ QLocale#system(7171962d3a2fd395).().namecxx . . $ QLocale#name(ffadaf4bfd1b4184).(); |
| 216 | if (!translator.loadcxx . . $ QTranslator#load(142924642d8b819d).(QStringLiteralcxx . . $ `<external>/13954984326995544643/qstring.h:1789:9`!(":/translations/lang_") +cxx . . $ operator+(3e7d64bea38764c4). lang)) { |
| 217 | SPDLOG_INFOcxx . . $ `<external>/13613935168682455490/spdlog.h:320:13`!("No translation found for locale {}", lang.toStdString()); |
| 218 | SPDLOG_INFOcxx . . $ `<external>/13613935168682455490/spdlog.h:320:13`!("Using en_EN translation."); |
| 219 | if (!translator.loadcxx . . $ QTranslator#load(142924642d8b819d).(QStringLiteralcxx . . $ `<external>/13954984326995544643/qstring.h:1789:9`!(":/translations/lang_en_EN"))) |
| 220 | SPDLOG_ERRORcxx . . $ `<external>/13613935168682455490/spdlog.h:338:13`!("Cannot load en_EN translation."); |
| 221 | } |
| 222 | app.installTranslatorcxx . . $ QCoreApplication#installTranslator(d376406de50edad7).(&translator); |
| 223 | } |
| 224 | |
| 225 | int Appcxx . . $ App#::helperTimeoutcxx . . $ App#helperTimeout(7ccb52b1bfe01045).(int defaultTimeout) const |
| 226 | { |
| 227 | int value = defaultTimeout; |
| 228 | if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("helper-timeout"cxx . . $ QString#QString(85c52e162fed56f9).) && |
| 229 | Utilscxx . . $ Utils/::Stringcxx . . $ Utils/String/::toNumbercxx . . $ Utils/String/toNumber(c75d689ebd728b7b).<int>( |
| 230 | value, cmdParser_cxx . . $ App#cmdParser_..valuecxx . . $ QCommandLineParser#value(5555d9024dcf93fb).("helper-timeout"cxx . . $ QString#QString(85c52e162fed56f9).).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).())) { |
| 231 | value = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(IHelperControlcxx . . $ IHelperControl#::MinExitTimeoutcxx . . $ IHelperControl#MinExitTimeout#::valuecxx . . $ units/unit_value_t#value(ca235afb30d3d25b).().tocxx . . $ units/unit_t#to(88b827abdede45d2).<int>(), value); |
| 232 | } |
| 233 | return value; |
| 234 | } |
| 235 | |
| 236 | void Appcxx . . $ App#::setupCmdParsercxx . . $ App#setupCmdParser(d3b3afeca10188ab).(QApplicationcxx . . $ QApplication# &app, int defaultHelperTimeout) |
| 237 | { |
| 238 | cmdParser_cxx . . $ App#cmdParser_..addHelpOptioncxx . . $ QCommandLineParser#addHelpOption(cd8590dcf46f7865).(); |
| 239 | cmdParser_cxx . . $ App#cmdParser_..addVersionOptioncxx . . $ QCommandLineParser#addVersionOption(cd8590dcf46f7865).(); |
| 240 | cmdParser_cxx . . $ App#cmdParser_..addOptionscxx . . $ QCommandLineParser#addOptions(fc0406408cd735d8).({cxx . . $ QList#QList(b6da5b9a9f304025). |
| 241 | {{"l", "lang"}, |
| 242 | "Forces a specific <language>, given in locale format. Example: " |
| 243 | "en_EN.", |
| 244 | "language"}, |
| 245 | {{"m", "toggle-manual-profile"}, |
| 246 | "Activate the manual profile whose name is <\"profile name\">.\nWhen an " |
| 247 | "instance of the application is already running, it will toggle " |
| 248 | "the manual profile whose name is <\"profile name\">.", |
| 249 | "\"profile name\""}, |
| 250 | {"activate-manual-profile", |
| 251 | "Activate the manual profile whose name is <\"profile name\">.\nWhen an " |
| 252 | "instance of the application is already running, it will activate " |
| 253 | "the manual profile whose name is <\"profile name\">.", |
| 254 | "\"profile name\""}, |
| 255 | {"deactivate-manual-profile", |
| 256 | "Deactivate the manual profile whose name is <\"profile name\">.\nWhen " |
| 257 | "an instance of the application is already running, it will deactivate " |
| 258 | "the manual profile whose name is <\"profile name\">.", |
| 259 | "\"profile name\""}, |
| 260 | {"minimize-systray", |
| 261 | "Minimizes the main window either to the system tray (when " |
| 262 | "available) or to the taskbar.\nWhen an instance of the application is " |
| 263 | "already running, the action will be applied to its main window."}, |
| 264 | {{"t", "helper-timeout"}, |
| 265 | "Sets helper auto exit timeout. " |
| 266 | "The helper process kills himself when no signals are received from " |
| 267 | "the application before the timeout expires.\nValues lesser than " +cxx . . $ operator+(629bb3c2d02a6966). |
| 268 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(IHelperControlcxx . . $ IHelperControl#::MinExitTimeoutcxx . . $ IHelperControl#MinExitTimeout#::valuecxx . . $ units/unit_value_t#value(ca235afb30d3d25b).().tocxx . . $ units/unit_t#to(88b827abdede45d2).<int>()) +cxx . . $ operator+(5cf93062b24146ad). |
| 269 | +" milliseconds will be ignored.\nDefault value: " +cxx . . $ operator+(3e7d64bea38764c4). |
| 270 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(defaultHelperTimeout) +cxx . . $ operator+(5cf93062b24146ad). " milliseconds.", |
| 271 | "milliseconds"}, |
| 272 | {"toggle-window-visibility", |
| 273 | "When an instance of the application is already running, it will toggle " |
| 274 | "the main window visibility showing or minimizing it, either to the " |
| 275 | "taskbar or to system tray."}, |
| 276 | {"enable-log-commands", |
| 277 | "Enables logging of control commands. It takes precedence over " |
| 278 | "disable-log-commands.\nIt can be used to activate commands logging on " |
| 279 | "a running instance of the application or while starting it."}, |
| 280 | {"disable-log-commands", |
| 281 | "Disables logging of control commands.\nIt can be used to deactivate " |
| 282 | "commands logging on a running instance of the application or while " |
| 283 | "starting it (no-op)."}, |
| 284 | {"enable-log-profile-stack", |
| 285 | "Enables logging of the profile stack. It takes precedence over " |
| 286 | "disable-log-profile-stack.\nIt can be used to activate the profile " |
| 287 | "stack logging on a running instance of the application or while " |
| 288 | "starting it."}, |
| 289 | {"disable-log-profile-stack", |
| 290 | "Disables logging of the profile stack.\nIt can be used to deactivate " |
| 291 | "the profile stack logging on a running instance of the application or " |
| 292 | "while starting it (no-op)."}, |
| 293 | }); |
| 294 | cmdParser_cxx . . $ App#cmdParser_..processcxx . . $ QCommandLineParser#process(b8a59b8a0e185f8a).(app); |
| 295 | } |
| 296 | |
| 297 | void Appcxx . . $ App#::setupSysTrayWindowStatecxx . . $ App#setupSysTrayWindowState(49f6e7a06ebc5aa8).() |
| 298 | { |
| 299 | bool minimizeArgIsSet = cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("minimize-systray"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 300 | bool enableSysTray = settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("sysTray"cxx . . $ QString#QString(85c52e162fed56f9)., truecxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 301 | |
| 302 | if (minimizeArgIsSet || enableSysTray) |
| 303 | sysTray_cxx . . $ App#sysTray_.->showcxx . . $ SysTray#show(49f6e7a06ebc5aa8).(); |
| 304 | |
| 305 | bool startOnSysTray = settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("startOnSysTray"cxx . . $ QString#QString(85c52e162fed56f9)., falsecxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 306 | bool showWindow = !minimizeArgIsSet && !(sysTray_cxx . . $ App#sysTray_.->isAvailablecxx . . $ SysTray#isAvailable(50ce9a9e25b4a850).() && |
| 307 | enableSysTray && startOnSysTray); |
| 308 | |
| 309 | showMainWindowcxx . . $ App#showMainWindow(b45ddcbc8423892c).(showWindow); |
| 310 | } |
| 311 | |
| 312 | void Appcxx . . $ App#::setupMainWindowGeometrycxx . . $ App#setupMainWindowGeometry(49f6e7a06ebc5aa8).() |
| 313 | { |
| 314 | restoreMainWindowGeometrycxx . . $ App#restoreMainWindowGeometry(49f6e7a06ebc5aa8).(); |
| 315 | |
| 316 | // The geometry save timer is used to reduce the window geometry changed |
| 317 | // events fired within a time interval into a single event that will save the |
| 318 | // window geometry. |
| 319 | geometrySaveTimer_cxx . . $ App#geometrySaveTimer_..setIntervalcxx . . $ QTimer#setInterval(d4f767463ce0a6b3).(2000); |
| 320 | geometrySaveTimer_cxx . . $ App#geometrySaveTimer_..setSingleShotcxx . . $ QTimer#setSingleShot(b45ddcbc8423892c).(true); |
| 321 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&geometrySaveTimer_cxx . . $ App#geometrySaveTimer_., &QTimercxx . . $ QTimer#::timeoutcxx . . $ QTimer#timeout(32604d697c0ceadc)., this, |
| 322 | &Appcxx . . $ App#::saveMainWindowGeometrycxx . . $ App#saveMainWindowGeometry(49f6e7a06ebc5aa8).); |
| 323 | |
| 324 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(mainWindow_cxx . . $ App#mainWindow_., &QWindowcxx . . $ QWindow#::heightChangedcxx . . $ QWindow#heightChanged(d4f767463ce0a6b3)., this, |
| 325 | [&](int) { geometrySaveTimer_cxx . . $ App#geometrySaveTimer_..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); }); |
| 326 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(mainWindow_cxx . . $ App#mainWindow_., &QWindowcxx . . $ QWindow#::widthChangedcxx . . $ QWindow#widthChanged(d4f767463ce0a6b3)., this, |
| 327 | [&](int) { geometrySaveTimer_cxx . . $ App#geometrySaveTimer_..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); }); |
| 328 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(mainWindow_cxx . . $ App#mainWindow_., &QWindowcxx . . $ QWindow#::xChangedcxx . . $ QWindow#xChanged(d4f767463ce0a6b3)., this, |
| 329 | [&](int) { geometrySaveTimer_cxx . . $ App#geometrySaveTimer_..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); }); |
| 330 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(mainWindow_cxx . . $ App#mainWindow_., &QWindowcxx . . $ QWindow#::yChangedcxx . . $ QWindow#yChanged(d4f767463ce0a6b3)., this, |
| 331 | [&](int) { geometrySaveTimer_cxx . . $ App#geometrySaveTimer_..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); }); |
| 332 | } |
| 333 | |
| 334 | void Appcxx . . $ App#::saveMainWindowGeometrycxx . . $ App#saveMainWindowGeometry(49f6e7a06ebc5aa8).() |
| 335 | { |
| 336 | if (!settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("saveWindowGeometry"cxx . . $ QString#QString(85c52e162fed56f9)., truecxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()) |
| 337 | return; |
| 338 | |
| 339 | if (mainWindow_cxx . . $ App#mainWindow_. == nullptr) |
| 340 | return; |
| 341 | |
| 342 | auto windowGeometry = mainWindow_cxx . . $ App#mainWindow_.->geometrycxx . . $ QWindow#geometry(d857385bac04cbf7).(); |
| 343 | |
| 344 | auto savedXPos = |
| 345 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-x-pos"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..xcxx . . $ QRect#x(ea6fe5115c70a13f).()).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 346 | if (savedXPos != windowGeometry.xcxx . . $ QRect#x(ea6fe5115c70a13f).()) |
| 347 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).setValuecxx . . $ Settings#setValue(1c60a90c724e6bfb).("Window/main-x-pos"cxx . . $ QString#QString(85c52e162fed56f9)., windowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..xcxx . . $ QRect#x(ea6fe5115c70a13f).()); |
| 348 | |
| 349 | auto savedYPos = |
| 350 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-y-pos"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..ycxx . . $ QRect#y(ea6fe5115c70a13f).()).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 351 | if (savedYPos != windowGeometry.ycxx . . $ QRect#y(ea6fe5115c70a13f).()) |
| 352 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).setValuecxx . . $ Settings#setValue(1c60a90c724e6bfb).("Window/main-y-pos"cxx . . $ QString#QString(85c52e162fed56f9)., windowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..ycxx . . $ QRect#y(ea6fe5115c70a13f).()); |
| 353 | |
| 354 | auto savedWidth = |
| 355 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-width"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..widthcxx . . $ QRect#width(ea6fe5115c70a13f).()) |
| 356 | .toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 357 | if (savedWidth != windowGeometry.widthcxx . . $ QRect#width(ea6fe5115c70a13f).()) |
| 358 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).setValuecxx . . $ Settings#setValue(1c60a90c724e6bfb).("Window/main-width"cxx . . $ QString#QString(85c52e162fed56f9)., windowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..widthcxx . . $ QRect#width(ea6fe5115c70a13f).()); |
| 359 | |
| 360 | auto savedHeight = |
| 361 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-height"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..heightcxx . . $ QRect#height(ea6fe5115c70a13f).()) |
| 362 | .toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 363 | if (savedHeight != windowGeometry.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()) |
| 364 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).setValuecxx . . $ Settings#setValue(1c60a90c724e6bfb).("Window/main-height"cxx . . $ QString#QString(85c52e162fed56f9)., windowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..heightcxx . . $ QRect#height(ea6fe5115c70a13f).()); |
| 365 | } |
| 366 | |
| 367 | void Appcxx . . $ App#::restoreMainWindowGeometrycxx . . $ App#restoreMainWindowGeometry(49f6e7a06ebc5aa8).() |
| 368 | { |
| 369 | if (mainWindow_cxx . . $ App#mainWindow_. == nullptr) |
| 370 | return; |
| 371 | |
| 372 | auto x = |
| 373 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-x-pos"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..xcxx . . $ QRect#x(ea6fe5115c70a13f).()).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 374 | auto y = |
| 375 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-y-pos"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..ycxx . . $ QRect#y(ea6fe5115c70a13f).()).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 376 | auto width = |
| 377 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-width"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..widthcxx . . $ QRect#width(ea6fe5115c70a13f).()) |
| 378 | .toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 379 | auto height = |
| 380 | settings_cxx . . $ App#settings_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).getValuecxx . . $ Settings#getValue(12a1b1749da49362).("Window/main-height"cxx . . $ QString#QString(85c52e162fed56f9)., DefaultWindowGeometrycxx . . $ QVariant#QVariant(f349c77f591a7878)..heightcxx . . $ QRect#height(ea6fe5115c70a13f).()) |
| 381 | .toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 382 | |
| 383 | mainWindow_cxx . . $ App#mainWindow_.->setGeometrycxx . . $ QWindow#setGeometry(748afa4755bc9595).(x, y, width, height); |
| 384 | } |
| 385 | |
| 386 | bool Appcxx . . $ App#::handleLoggingCmdscxx . . $ App#handleLoggingCmds(c9857a73d68e59ba).() |
| 387 | { |
| 388 | auto cmdHandled{false}; |
| 389 | |
| 390 | if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("enable-log-commands"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 391 | sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).logCommandscxx . . $ ISysModelSyncer#logCommands(b45ddcbc8423892c).(true); |
| 392 | cmdHandled = true; |
| 393 | } |
| 394 | else if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("disable-log-commands"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 395 | sysSyncer_cxx . . $ App#sysSyncer_.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).logCommandscxx . . $ ISysModelSyncer#logCommands(b45ddcbc8423892c).(false); |
| 396 | cmdHandled = true; |
| 397 | } |
| 398 | |
| 399 | if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("enable-log-profile-stack"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 400 | session_cxx . . $ App#session_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).logProfileStackcxx . . $ ISession#logProfileStack(b45ddcbc8423892c).(true); |
| 401 | cmdHandled = true; |
| 402 | } |
| 403 | else if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("disable-log-profile-stack"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 404 | session_cxx . . $ App#session_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).logProfileStackcxx . . $ ISession#logProfileStack(b45ddcbc8423892c).(false); |
| 405 | cmdHandled = true; |
| 406 | } |
| 407 | |
| 408 | return cmdHandled; |
| 409 | } |
| 410 | |
| 411 | bool Appcxx . . $ App#::handleManualProfileCmdcxx . . $ App#handleManualProfileCmd(c9857a73d68e59ba).() |
| 412 | { |
| 413 | auto cmdHandled{false}; |
| 414 | if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("toggle-manual-profile"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 415 | |
| 416 | auto profile = cmdParser_cxx . . $ App#cmdParser_..valuecxx . . $ QCommandLineParser#value(5555d9024dcf93fb).("toggle-manual-profile"cxx . . $ QString#QString(85c52e162fed56f9).).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 417 | if (profile.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || profile.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() >= 512) |
| 418 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("'{}' is not a valid manual profile name.", profile); |
| 419 | else if (!session_cxx . . $ App#session_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).toggleManualProfilecxx . . $ ISession#toggleManualProfile(7c222eea44a24d43).(profile)) |
| 420 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Cannot toggle manual profile '{}': Missing profile or not a " |
| 421 | "manual profile.", |
| 422 | profile); |
| 423 | |
| 424 | cmdHandled = true; |
| 425 | } |
| 426 | else if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("activate-manual-profile"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 427 | |
| 428 | auto profile = cmdParser_cxx . . $ App#cmdParser_..valuecxx . . $ QCommandLineParser#value(5555d9024dcf93fb).("activate-manual-profile"cxx . . $ QString#QString(85c52e162fed56f9).).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 429 | if (profile.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || profile.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() >= 512) |
| 430 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("'{}' is not a valid manual profile name.", profile); |
| 431 | else if (!session_cxx . . $ App#session_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activateManualProfilecxx . . $ ISession#activateManualProfile(7c222eea44a24d43).(profile)) |
| 432 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!( |
| 433 | "Cannot activate manual profile '{}': Missing profile or not a " |
| 434 | "manual profile.", |
| 435 | profile); |
| 436 | |
| 437 | cmdHandled = true; |
| 438 | } |
| 439 | else if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("deactivate-manual-profile"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 440 | |
| 441 | auto profile = cmdParser_cxx . . $ App#cmdParser_..valuecxx . . $ QCommandLineParser#value(5555d9024dcf93fb).("deactivate-manual-profile"cxx . . $ QString#QString(85c52e162fed56f9).).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 442 | if (profile.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || profile.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() >= 512) |
| 443 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("'{}' is not a valid manual profile name.", profile); |
| 444 | else if (!session_cxx . . $ App#session_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).deactivateManualProfilecxx . . $ ISession#deactivateManualProfile(7c222eea44a24d43).(profile)) |
| 445 | SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!( |
| 446 | "Cannot deactivate manual profile '{}': Missing profile or not a " |
| 447 | "manual profile.", |
| 448 | profile); |
| 449 | |
| 450 | cmdHandled = true; |
| 451 | } |
| 452 | |
| 453 | return cmdHandled; |
| 454 | } |
| 455 | |
| 456 | bool Appcxx . . $ App#::handleWindowVisibilityCmdscxx . . $ App#handleWindowVisibilityCmds(c9857a73d68e59ba).() |
| 457 | { |
| 458 | auto cmdHandled{false}; |
| 459 | auto show{false}; |
| 460 | |
| 461 | // Minimize to system tray takes precedence over any other window visibility |
| 462 | // command. |
| 463 | if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("minimize-systray"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 464 | cmdHandled = true; |
| 465 | } |
| 466 | else if (cmdParser_cxx . . $ App#cmdParser_..isSetcxx . . $ QCommandLineParser#isSet(f3b39adf77d9c36c).("toggle-window-visibility"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 467 | |
| 468 | // When the window is minimized, calling show() will raise it. |
| 469 | auto minimized = |
| 470 | ((mainWindow_cxx . . $ App#mainWindow_.->windowStatecxx . . $ QWindow#windowState(4a9147df68716fdf).() &cxx . . $ Qt/`operator&`(2da1ac719124f61a). Qtcxx . . $ Qt/::WindowStatecxx . . $ Qt/WindowState#::WindowMinimizedcxx . . $ Qt/WindowMinimized.) ==cxx . . $ `operator==`(4faf09be404ee3f4). |
| 471 | Qtcxx . . $ Qt/::WindowStatecxx . . $ Qt/WindowState#::WindowMinimizedcxx . . $ Qt/WindowMinimized.); |
| 472 | |
| 473 | show = minimized ? true : !mainWindow_cxx . . $ App#mainWindow_.->isVisiblecxx . . $ QWindow#isVisible(50ce9a9e25b4a850).(); |
| 474 | cmdHandled = true; |
| 475 | } |
| 476 | |
| 477 | if (cmdHandled) |
| 478 | showMainWindowcxx . . $ App#showMainWindow(b45ddcbc8423892c).(show); |
| 479 | |
| 480 | return cmdHandled; |
| 481 | } |