Debian Codegraph @

src/app/systray.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/app/systray.cpp`/
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #include "systray.h"cxx . . $ `<file>/src/app/systray.h`/
5
6 #include "app.h"cxx . . $ `<file>/src/app/app.h`/
7 #include "core/iprofile.h"cxx . . $ `<file>/src/core/iprofile.h`/
8 #include "core/iprofilemanager.h"cxx . . $ `<file>/src/core/iprofilemanager.h`/
9 #include "core/isession.h"cxx . . $ `<file>/src/core/isession.h`/
10 #include <QIcon>
11 #include <QTimer>
12 #include <algorithm>
13
14 class SysTraycxx . . $ SysTray#::ProfileManagerObservercxx . . $ SysTray#ProfileManagerObserver# : public IProfileManagercxx . . $ IProfileManager#::Observercxx . . $ IProfileManager#Observer#
15 {
16 public:
17 ProfileManagerObservercxx . . $ SysTray#ProfileManagerObserver#ProfileManagerObserver(7ff487a75dfedcc).(SysTraycxx . . $ SysTray# &outer) noexcept
18 : outer_cxx . . $ SysTray#ProfileManagerObserver#outer_.(outer)
19 {
20 }
21
22 void profileAddedcxx . . $ SysTray#ProfileManagerObserver#profileAdded(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) override;
23 void profileRemovedcxx . . $ SysTray#ProfileManagerObserver#profileRemoved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) override;
24 void profileInfoChangedcxx . . $ SysTray#ProfileManagerObserver#profileInfoChanged(1acf29b044426ccc).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &oldInfo,
25 IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo) override;
26
27 void profileChangedcxx . . $ SysTray#ProfileManagerObserver#profileChanged(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &) override
28 {
29 }
30 void profileActiveChangedcxx . . $ SysTray#ProfileManagerObserver#profileActiveChanged(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &, bool) override
31 {
32 }
33 void profileSavedcxx . . $ SysTray#ProfileManagerObserver#profileSaved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &) override
34 {
35 }
36
37 private:
38 SysTraycxx . . $ SysTray# &outer_cxx . . $ SysTray#ProfileManagerObserver#outer_.;
39 };
40
41 void SysTraycxx . . $ SysTray#::ProfileManagerObservercxx . . $ SysTray#ProfileManagerObserver#::profileAddedcxx . . $ SysTray#ProfileManagerObserver#profileAdded(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
42 {
43 outer_cxx . . $ SysTray#ProfileManagerObserver#outer_..profileAddedcxx . . $ SysTray#profileAdded(9c546c94e5fcce4e).(profileName);
44 }
45
46 void SysTraycxx . . $ SysTray#::ProfileManagerObservercxx . . $ SysTray#ProfileManagerObserver#::profileRemovedcxx . . $ SysTray#ProfileManagerObserver#profileRemoved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
47 {
48 outer_cxx . . $ SysTray#ProfileManagerObserver#outer_..profileRemovedcxx . . $ SysTray#profileRemoved(9c546c94e5fcce4e).(profileName);
49 }
50
51 void SysTraycxx . . $ SysTray#::ProfileManagerObservercxx . . $ SysTray#ProfileManagerObserver#::profileInfoChangedcxx . . $ SysTray#ProfileManagerObserver#profileInfoChanged(1acf29b044426ccc).(
52 IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &oldInfo, IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo)
53 {
54 outer_cxx . . $ SysTray#ProfileManagerObserver#outer_..profileInfoChangedcxx . . $ SysTray#profileInfoChanged(1acf29b044426ccc).(oldInfo, newInfo);
55 }
56
57 class SysTraycxx . . $ SysTray#::ManualProfileObservercxx . . $ SysTray#ManualProfileObserver# : public ISessioncxx . . $ ISession#::ManualProfileObservercxx . . $ ISession#ManualProfileObserver#
58 {
59 public:
60 ManualProfileObservercxx . . $ SysTray#ManualProfileObserver#ManualProfileObserver(7ff487a75dfedcc).(SysTraycxx . . $ SysTray# &outer) noexcept
61 : outer_cxx . . $ SysTray#ManualProfileObserver#outer_.(outer)
62 {
63 }
64
65 void toggledcxx . . $ SysTray#ManualProfileObserver#toggled(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, bool active) override;
66
67 private:
68 SysTraycxx . . $ SysTray# &outer_cxx . . $ SysTray#ManualProfileObserver#outer_.;
69 };
70
71 void SysTraycxx . . $ SysTray#::ManualProfileObservercxx . . $ SysTray#ManualProfileObserver#::toggledcxx . . $ SysTray#ManualProfileObserver#toggled(a3b17e0268c60856).(const stdcxx . . $ std/::stringcxx . . $ std/string# &profileName,
72 bool active)
73 {
74 outer_cxx . . $ SysTray#ManualProfileObserver#outer_..manualProfileToggledcxx . . $ SysTray#manualProfileToggled(a3b17e0268c60856).(profileName, active);
75 }
76
77 SysTraycxx . . $ SysTray#::SysTraycxx . . $ SysTray#SysTray(89e3b8547c1c2b46).(ISessioncxx . . $ ISession# *session, QObjectcxx . . $ QObject# *parent)
78 : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent)
79 , session_cxx . . $ SysTray#session_.(session)
80 , profileManager_cxx . . $ SysTray#profileManager_.(&session->profileManagercxx . . $ ISession#profileManager(4cba1b6c4fb53c57).())
81 , menu_cxx . . $ SysTray#menu_.()
82 , profileManagerObserver_cxx . . $ SysTray#profileManagerObserver_.(
83 stdcxx . . $ std/::make_sharedcxx . . $ std/make_shared(25752750ef11e821).<SysTraycxx . . $ SysTray#::ProfileManagerObservercxx . . $ SysTray#ProfileManagerObserver#>(*this))
84 , manualProfileObserver_cxx . . $ SysTray#manualProfileObserver_.(stdcxx . . $ std/::make_sharedcxx . . $ std/make_shared(25752750ef11e821).<SysTraycxx . . $ SysTray#::ManualProfileObservercxx . . $ SysTray#ManualProfileObserver#>(*this))
85 {
86 session_cxx . . $ SysTray#session_.->addManualProfileObservercxx . . $ ISession#addManualProfileObserver(b6a8fcfa605ca162).(manualProfileObserver_cxx . . $ std/shared_ptr#shared_ptr(d70455e50ed85f60).);
87 profileManager_cxx . . $ SysTray#profileManager_.->addObservercxx . . $ IProfileManager#addObserver(bd1477ff1de9e2eb).(profileManagerObserver_cxx . . $ std/shared_ptr#shared_ptr(d70455e50ed85f60).);
88
89 sysTray_cxx . . $ SysTray#sysTray_. = createSystemTrayIconcxx . . $ SysTray#createSystemTrayIcon(ff24298194fb9bae).();
90 }
91
92 bool SysTraycxx . . $ SysTray#::isAvailablecxx . . $ SysTray#isAvailable(50ce9a9e25b4a850).() const
93 {
94 return QSystemTrayIconcxx . . $ QSystemTrayIcon#::isSystemTrayAvailablecxx . . $ QSystemTrayIcon#isSystemTrayAvailable(c9857a73d68e59ba).();
95 }
96
97 bool SysTraycxx . . $ SysTray#::isVisiblecxx . . $ SysTray#isVisible(50ce9a9e25b4a850).() const
98 {
99 return isAvailablecxx . . $ SysTray#isAvailable(50ce9a9e25b4a850).() && sysTray_cxx . . $ SysTray#sysTray_.->isVisiblecxx . . $ QSystemTrayIcon#isVisible(50ce9a9e25b4a850).();
100 }
101
102 void SysTraycxx . . $ SysTray#::showcxx . . $ SysTray#show(49f6e7a06ebc5aa8).()
103 {
104 sysTray_cxx . . $ SysTray#sysTray_.->showcxx . . $ QSystemTrayIcon#show(49f6e7a06ebc5aa8).();
105 }
106
107 void SysTraycxx . . $ SysTray#::hidecxx . . $ SysTray#hide(49f6e7a06ebc5aa8).()
108 {
109 sysTray_cxx . . $ SysTray#sysTray_.->hidecxx . . $ QSystemTrayIcon#hide(49f6e7a06ebc5aa8).();
110 }
111
112 void SysTraycxx . . $ SysTray#::settingChangedcxx . . $ SysTray#settingChanged(1c60a90c724e6bfb).(QStringcxx . . $ QString# const &key, QVariantcxx . . $ QVariant# const &value)
113 {
114 if (key ==cxx . . $ `operator==`(94dc9d443ef00688). "sysTray")
115 sysTray_cxx . . $ SysTray#sysTray_.->setVisiblecxx . . $ QSystemTrayIcon#setVisible(b45ddcbc8423892c).(value.toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).());
116 }
117
118 void SysTraycxx . . $ SysTray#::onMainWindowVisibleChangedcxx . . $ SysTray#onMainWindowVisibleChanged(b45ddcbc8423892c).(bool isVisible)
119 {
120 showMainWindow_cxx . . $ SysTray#showMainWindow_. = isVisible;
121 showMainWindowAction_cxx . . $ SysTray#showMainWindowAction_.->setTextcxx . . $ QAction#setText(3520e46b33348bf6).(isVisible ? trcxx . . $ SysTray#tr(75d9f1c324b4579d).("Hide") : trcxx . . $ SysTray#tr(75d9f1c324b4579d).("Show"));
122 }
123
124 void SysTraycxx . . $ SysTray#::onTrayIconActivatedcxx . . $ SysTray#onTrayIconActivated(dc7279b31293a212).(QSystemTrayIconcxx . . $ QSystemTrayIcon#::ActivationReasoncxx . . $ QSystemTrayIcon#ActivationReason# reason)
125 {
126 switch (reason) {
127 case QSystemTrayIconcxx . . $ QSystemTrayIcon#::Triggercxx . . $ QSystemTrayIcon#Trigger.:
128 emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! activatedcxx . . $ SysTray#activated(49f6e7a06ebc5aa8).();
129 break;
130
131 default:
132 break;
133 }
134 }
135
136 void SysTraycxx . . $ SysTray#::onShowMainWindowActionTriggeredcxx . . $ SysTray#onShowMainWindowActionTriggered(49f6e7a06ebc5aa8).()
137 {
138 emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! showMainWindowToggledcxx . . $ SysTray#showMainWindowToggled(b45ddcbc8423892c).(!showMainWindow_cxx . . $ SysTray#showMainWindow_.);
139 }
140
141 QSystemTrayIconcxx . . $ QSystemTrayIcon# *SysTraycxx . . $ SysTray#::createSystemTrayIconcxx . . $ SysTray#createSystemTrayIcon(ff24298194fb9bae).()
142 {
143 auto sysTray = new QSystemTrayIconcxx . . $ QSystemTrayIcon#(this);
144
145 sysTray->setIconcxx . . $ QSystemTrayIcon#setIcon(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).()));
146 sysTray->setContextMenucxx . . $ QSystemTrayIcon#setContextMenu(cb52c12b49e9b51b).(menucxx . . $ SysTray#menu(fe0a096c13a48705).());
147
148 connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(sysTray, &QSystemTrayIconcxx . . $ QSystemTrayIcon#::activatedcxx . . $ QSystemTrayIcon#activated(dc7279b31293a212)., this,
149 &SysTraycxx . . $ SysTray#::onTrayIconActivatedcxx . . $ SysTray#onTrayIconActivated(dc7279b31293a212).);
150
151 return sysTray;
152 }
153
154 QMenucxx . . $ QMenu# *SysTraycxx . . $ SysTray#::menucxx . . $ SysTray#menu(fe0a096c13a48705).()
155 {
156 if (menu_cxx . . $ SysTray#menu_..isEmptycxx . . $ QMenu#isEmpty(50ce9a9e25b4a850).()) {
157 showMainWindowAction_cxx . . $ SysTray#showMainWindowAction_. = new QActioncxx . . $ QAction#(&menu_cxx . . $ SysTray#menu_.);
158 onMainWindowVisibleChangedcxx . . $ SysTray#onMainWindowVisibleChanged(b45ddcbc8423892c).(false); // initialize label and state
159 connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(showMainWindowAction_cxx . . $ SysTray#showMainWindowAction_., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this,
160 &SysTraycxx . . $ SysTray#::onShowMainWindowActionTriggeredcxx . . $ SysTray#onShowMainWindowActionTriggered(49f6e7a06ebc5aa8).);
161 menu_cxx . . $ SysTray#menu_..addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(showMainWindowAction_cxx . . $ SysTray#showMainWindowAction_.);
162 menu_cxx . . $ SysTray#menu_..addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).();
163
164 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_. = menu_cxx . . $ SysTray#menu_..addMenucxx . . $ QMenu#addMenu(7bd5d996bbe37ddf).(trcxx . . $ SysTray#tr(75d9f1c324b4579d).("Manual profiles"));
165 addManualProfilesTocxx . . $ SysTray#addManualProfilesTo(cb52c12b49e9b51b).(manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.);
166 menu_cxx . . $ SysTray#menu_..addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).();
167
168 QActioncxx . . $ QAction# *quitAction = new QActioncxx . . $ QAction#(trcxx . . $ SysTray#tr(75d9f1c324b4579d).("Quit"), &menu_cxx . . $ SysTray#menu_.);
169 connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(quitAction, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &SysTraycxx . . $ SysTray#::quitcxx . . $ SysTray#quit(49f6e7a06ebc5aa8).);
170 menu_cxx . . $ SysTray#menu_..addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(quitAction);
171 }
172
173 return &menu_cxx . . $ SysTray#menu_.;
174 }
175
176 QActioncxx . . $ QAction# *SysTraycxx . . $ SysTray#::createManualProfileActioncxx . . $ SysTray#createManualProfileAction(fddc7be664403c97).(QMenucxx . . $ QMenu# *menu,
177 stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
178 {
179
180 QActioncxx . . $ QAction# *action = new QActioncxx . . $ QAction#(QStringcxx . . $ QString#::fromStdStringcxx . . $ QString#fromStdString(24a2e9bdf24626eb).(profileName), menu);
181 action->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true);
182
183 connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(action, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this,
184 [=, this]() { onManualProfileMenuTriggeredcxx . . $ SysTray#onManualProfileMenuTriggered(3520e46b33348bf6).(action->textcxx . . $ QAction#text(6ef7b6c27b00b43d).()); });
185
186 return action;
187 }
188
189 stdcxx . . $ std/::optionalcxx . . $ std/optional#<QActioncxx . . $ QAction# *>
190 SysTraycxx . . $ SysTray#::findManualProfileActioncxx . . $ SysTray#findManualProfileAction(8c55afb0602b2e45).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
191 {
192 auto name = QStringcxx . . $ QString#::fromStdStringcxx . . $ QString#fromStdString(24a2e9bdf24626eb).(profileName);
193 auto actions = manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->actionscxx . . $ QWidget#actions(6326ecb0baf05155).();
194
195 auto actionIt = stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(
196 actions.begincxx . . $ QList#begin(ca2520f641887418).(), actions.endcxx . . $ QList#end(ca2520f641887418).(),
197 [&](QActioncxx . . $ QAction# *action) { return action->textcxx . . $ QAction#text(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(5bc2975d2d751687). name; });
198
199 return actionIt != actions.endcxx . . $ QList#end(ca2520f641887418).() ? stdcxx . . $ std/::make_optionalcxx . . $ std/make_optional(e412eef0971c0904).(*cxx . . $ QList#iterator#`operator*`(c93303b41ac66b6d).actionIt)
200 : stdcxx . . $ std/optional#optional(eb2253fdec8870b5).::nulloptcxx . . $ std/nullopt.;
201 }
202
203 QActioncxx . . $ QAction# *
204 SysTraycxx . . $ SysTray#::findNextManualProfileActionPositioncxx . . $ SysTray#findNextManualProfileActionPosition(cb2f121c73164b5d).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
205 {
206 auto name = QStringcxx . . $ QString#::fromStdStringcxx . . $ QString#fromStdString(24a2e9bdf24626eb).(profileName);
207 auto actions = manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->actionscxx . . $ QWidget#actions(6326ecb0baf05155).();
208
209 auto actionIt = stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(
210 actions.begincxx . . $ QList#begin(ca2520f641887418).(), actions.endcxx . . $ QList#end(ca2520f641887418).(),
211 [&](QActioncxx . . $ QAction# *action) { return action->textcxx . . $ QAction#text(6ef7b6c27b00b43d).() > name; });
212
213 return actionIt != actions.endcxx . . $ QList#end(ca2520f641887418).() ? *cxx . . $ QList#iterator#`operator*`(c93303b41ac66b6d).actionIt : nullptr;
214 }
215
216 void SysTraycxx . . $ SysTray#::addManualProfilesTocxx . . $ SysTray#addManualProfilesTo(cb52c12b49e9b51b).(QMenucxx . . $ QMenu# *menu)
217 {
218 auto profiles = profileManager_cxx . . $ SysTray#profileManager_.->profilescxx . . $ IProfileManager#profiles(491c255a7e496038).();
219 stdcxx . . $ std/::sortcxx . . $ std/sort(249673c20e2b8d5).(profiles.begincxx . . $ std/vector#begin(55a6de06420d4903).(), profiles.endcxx . . $ std/vector#end(55a6de06420d4903).());
220
221 for (auto const &profileName : profiles) {
222
223 auto const &profile = profileManager_cxx . . $ SysTray#profileManager_.->profilecxx . . $ IProfileManager#profile(f84880c9a777ebac).(profileName);
224 if (profile->cxx . . $ std/optional#`operator->`(8e614c7de0b1573e).getcxx . . $ std/reference_wrapper#get(d426bc7b625886b7).().infocxx . . $ IProfile#info(ad075d653bfbbbea).().execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.) {
225
226 auto action = createManualProfileActioncxx . . $ SysTray#createManualProfileAction(fddc7be664403c97).(menu, profileName);
227 menu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(action);
228 }
229 }
230
231 menu->setDisabledcxx . . $ QWidget#setDisabled(b45ddcbc8423892c).(menu->isEmptycxx . . $ QMenu#isEmpty(50ce9a9e25b4a850).());
232 }
233
234 void SysTraycxx . . $ SysTray#::onManualProfileMenuTriggeredcxx . . $ SysTray#onManualProfileMenuTriggered(3520e46b33348bf6).(QStringcxx . . $ QString# const &profile)
235 {
236 session_cxx . . $ SysTray#session_.->toggleManualProfilecxx . . $ ISession#toggleManualProfile(7c222eea44a24d43).(profile.toStdStringcxx . . $ QString#toStdString(219584694fe2b248).());
237 }
238
239 void SysTraycxx . . $ SysTray#::profileAddedcxx . . $ SysTray#profileAdded(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
240 {
241 auto profile = profileManager_cxx . . $ SysTray#profileManager_.->profilecxx . . $ IProfileManager#profile(f84880c9a777ebac).(profileName);
242 if (profile.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).() &&
243 profile->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).getcxx . . $ std/reference_wrapper#get(d426bc7b625886b7).().infocxx . . $ IProfile#info(ad075d653bfbbbea).().execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.) {
244
245 auto action = createManualProfileActioncxx . . $ SysTray#createManualProfileAction(fddc7be664403c97).(manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_., profileName);
246 auto beforeAction = findNextManualProfileActionPositioncxx . . $ SysTray#findNextManualProfileActionPosition(cb2f121c73164b5d).(profileName);
247 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->insertActioncxx . . $ QWidget#insertAction(c5438a09579c6160).(beforeAction, action);
248 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->setDisabledcxx . . $ QWidget#setDisabled(b45ddcbc8423892c).(false);
249 }
250 }
251
252 void SysTraycxx . . $ SysTray#::profileRemovedcxx . . $ SysTray#profileRemoved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
253 {
254 auto action = findManualProfileActioncxx . . $ SysTray#findManualProfileAction(8c55afb0602b2e45).(profileName);
255 if (action.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).()) {
256 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->removeActioncxx . . $ QWidget#removeAction(92b1e80c0a7f1406).(*cxx . . $ std/optional#`operator*`(47e1a15210ec6306).action);
257 delete *cxx . . $ std/optional#`operator*`(47e1a15210ec6306).action;
258
259 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->setDisabledcxx . . $ QWidget#setDisabled(b45ddcbc8423892c).(manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->isEmptycxx . . $ QMenu#isEmpty(50ce9a9e25b4a850).());
260 }
261 }
262
263 void SysTraycxx . . $ SysTray#::profileInfoChangedcxx . . $ SysTray#profileInfoChanged(1acf29b044426ccc).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &oldInfo,
264 IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo)
265 {
266 if (oldInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. ||
267 newInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.) {
268
269 // automatic profile converted to manual profile
270 if (oldInfo.execxx . . $ IProfile#Info#exe. != IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. &&
271 newInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.) {
272 auto action = createManualProfileActioncxx . . $ SysTray#createManualProfileAction(fddc7be664403c97).(manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_., newInfo.namecxx . . $ IProfile#Info#name.);
273 auto beforeAction = findNextManualProfileActionPositioncxx . . $ SysTray#findNextManualProfileActionPosition(cb2f121c73164b5d).(newInfo.namecxx . . $ IProfile#Info#name.);
274 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->insertActioncxx . . $ QWidget#insertAction(c5438a09579c6160).(beforeAction, action);
275 }
276 // manual profile converted to automatic profile
277 else if (oldInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. &&
278 newInfo.execxx . . $ IProfile#Info#exe. != IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.) {
279 profileRemovedcxx . . $ SysTray#profileRemoved(9c546c94e5fcce4e).(oldInfo.namecxx . . $ IProfile#Info#name.);
280 }
281 // manual profile name has changed
282 else if (oldInfo.namecxx . . $ IProfile#Info#name. != newInfo.namecxx . . $ IProfile#Info#name.) {
283 auto action = findManualProfileActioncxx . . $ SysTray#findManualProfileAction(8c55afb0602b2e45).(oldInfo.namecxx . . $ IProfile#Info#name.);
284 if (action.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).()) {
285
286 // remove old action
287 auto isChecked = (*cxx . . $ std/optional#`operator*`(47e1a15210ec6306).action)->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).();
288 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->removeActioncxx . . $ QWidget#removeAction(92b1e80c0a7f1406).(*cxx . . $ std/optional#`operator*`(47e1a15210ec6306).action);
289 delete *cxx . . $ std/optional#`operator*`(47e1a15210ec6306).action;
290
291 // insert a new action
292 auto action = createManualProfileActioncxx . . $ SysTray#createManualProfileAction(fddc7be664403c97).(manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_., newInfo.namecxx . . $ IProfile#Info#name.);
293 action->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(isChecked);
294 auto beforeAction = findNextManualProfileActionPositioncxx . . $ SysTray#findNextManualProfileActionPosition(cb2f121c73164b5d).(newInfo.namecxx . . $ IProfile#Info#name.);
295 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->insertActioncxx . . $ QWidget#insertAction(c5438a09579c6160).(beforeAction, action);
296 }
297 }
298
299 manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->setDisabledcxx . . $ QWidget#setDisabled(b45ddcbc8423892c).(manualProfileMenu_cxx . . $ SysTray#manualProfileMenu_.->isEmptycxx . . $ QMenu#isEmpty(50ce9a9e25b4a850).());
300 }
301 }
302
303 void SysTraycxx . . $ SysTray#::manualProfileToggledcxx . . $ SysTray#manualProfileToggled(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, bool active)
304 {
305 auto action = findManualProfileActioncxx . . $ SysTray#findManualProfileAction(8c55afb0602b2e45).(profileName);
306 if (action.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).())
307 (*cxx . . $ std/optional#`operator*`(47e1a15210ec6306).action)->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(active);
308 }