@@ -110,23 +110,20 @@ void MainWindow::UpdateUI_Status() {
110110 if (QSystemTrayIcon::isSystemTrayAvailable ()) {
111111 // Device
112112 {
113- if (this ->_tray_icon_menu != nullptr ) {
114- delete this ->_tray_icon_menu ;
115- }
116- this ->_tray_icon_menu = new QMenu (this );
113+ QMenu *menu = new QMenu (this );
117114
118- QSignalMapper *mapper_device = new QSignalMapper (this );
119- QSignalMapper *mapper_layers = new QSignalMapper (this );
115+ QSignalMapper *mapper_device = new QSignalMapper (menu );
116+ QSignalMapper *mapper_layers = new QSignalMapper (menu );
120117
121118 QAction *tray_restore_action = new QAction (" &Show Vulkan Configurator UI" , this );
122119 tray_restore_action->setIcon (QIcon (" :/resourcefiles/vkconfig-on.png" ));
123120 QFont font = tray_restore_action->font ();
124121 font.setBold (true );
125122 tray_restore_action->setFont (font);
126123 this ->connect (tray_restore_action, &QAction::triggered, this , &MainWindow::OnTrayActionShow);
127- this -> _tray_icon_menu ->addAction (tray_restore_action);
124+ menu ->addAction (tray_restore_action);
128125
129- this -> _tray_icon_menu ->addSeparator ();
126+ menu ->addSeparator ();
130127 const bool enabled_device = configurator.driver_override_enabled ;
131128
132129 QAction *tray_override = new QAction (" Override System Vulkan &Device with:" , this );
@@ -135,7 +132,7 @@ void MainWindow::UpdateUI_Status() {
135132 tray_override->setChecked (enabled_device);
136133
137134 this ->connect (tray_override, &QAction::toggled, this , &MainWindow::OnTrayActionOverrideDevice);
138- this -> _tray_icon_menu ->addAction (tray_override);
135+ menu ->addAction (tray_override);
139136
140137 for (std::size_t i = 0 , n = configurator.vulkan_system_info .physicalDevices .size (); i < n; ++i) {
141138 const VulkanPhysicalDeviceInfo &info = configurator.vulkan_system_info .physicalDevices [i];
@@ -146,15 +143,15 @@ void MainWindow::UpdateUI_Status() {
146143 action->setChecked (device_info == configurator.driver_override_info );
147144 action->setEnabled (enabled_device);
148145
149- this -> _tray_icon_menu ->addAction (action);
146+ menu ->addAction (action);
150147
151148 this ->connect (action, SIGNAL (triggered ()), mapper_device, SLOT (map ()));
152149 mapper_device->setMapping (action, i);
153150 }
154151
155152 this ->connect (mapper_device, &QSignalMapper::mappedInt, this , &MainWindow::OnDeviceChanged);
156153
157- this -> _tray_icon_menu ->addSeparator ();
154+ menu ->addSeparator ();
158155 const bool enabled_layers = configurator.layers_override_enabled && configurator.GetExecutableScope () != EXECUTABLE_PER ;
159156
160157 QAction *tray_override_layers = new QAction (" Override System Vulkan &Layers Configuration with:" , this );
@@ -163,7 +160,7 @@ void MainWindow::UpdateUI_Status() {
163160 tray_override_layers->setChecked (enabled_layers);
164161
165162 this ->connect (tray_override_layers, &QAction::toggled, this , &MainWindow::OnTrayActionOverrideLayers);
166- this -> _tray_icon_menu ->addAction (tray_override_layers);
163+ menu ->addAction (tray_override_layers);
167164
168165 for (std::size_t i = 0 , n = configurator.configurations .available_configurations .size (); i < n; ++i) {
169166 const Configuration &configuration = configurator.configurations .available_configurations [i];
@@ -173,41 +170,39 @@ void MainWindow::UpdateUI_Status() {
173170 action->setChecked (configuration.key == configurator.GetSelectedGlobalConfiguration ());
174171 action->setEnabled (enabled_layers);
175172
176- this -> _tray_icon_menu ->addAction (action);
173+ menu ->addAction (action);
177174
178175 this ->connect (action, SIGNAL (triggered ()), mapper_layers, SLOT (map ()));
179176 mapper_layers->setMapping (action, i);
180177 }
181178
182179 this ->connect (mapper_layers, &QSignalMapper::mappedInt, this , &MainWindow::OnLayersChanged);
183180
184- this -> _tray_icon_menu ->addSeparator ();
181+ menu ->addSeparator ();
185182
186183 QAction *tray_override_loader = new QAction (" Override System Vulkan Loader Log" , this );
187184 tray_override_loader->setFont (font);
188185 tray_override_loader->setCheckable (true );
189186 tray_override_loader->setChecked (configurator.loader_log_enabled );
190187 this ->connect (tray_override_loader, &QAction::toggled, this , &MainWindow::OnTrayActionOverrideLog);
191- this -> _tray_icon_menu ->addAction (tray_override_loader);
188+ menu ->addAction (tray_override_loader);
192189
193- this -> _tray_icon_menu ->addSeparator ();
190+ menu ->addSeparator ();
194191
195192 QAction *tray_quit_action = new QAction (" &Quit Vulkan Configurator" , this );
196193 tray_quit_action->setIcon (::Get (configurator.current_theme_mode , ::ICON_EXIT ));
197194 tray_quit_action->setFont (font);
198195 this ->connect (tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit);
199- this ->_tray_icon_menu ->addAction (tray_quit_action);
200-
201- /*
202- if (VKC_ENV != VKC_ENV_WIN32) {
203- if (this->_tray_icon != nullptr) {
204- delete this->_tray_icon;
205- }
206- this->_tray_icon = new QSystemTrayIcon(this);
207- }
208- */
209-
210- this ->_tray_icon ->setContextMenu (this ->_tray_icon_menu );
196+ menu->addAction (tray_quit_action);
197+
198+ if (VKC_PLATFORM == PLATFORM_LINUX ) {
199+ if (this ->_tray_icon != nullptr ) {
200+ delete this ->_tray_icon ;
201+ }
202+ this ->_tray_icon = new QSystemTrayIcon (this );
203+ }
204+
205+ this ->_tray_icon ->setContextMenu (menu);
211206 this ->connect (this ->_tray_icon , &QSystemTrayIcon::activated, this , &MainWindow::OnIconActivated);
212207
213208 if (configurator.layers_override_enabled || configurator.driver_override_enabled || configurator.loader_log_enabled ) {
0 commit comments