@@ -71,7 +71,7 @@ TabPreferences::TabPreferences(MainWindow &window, std::shared_ptr<Ui::MainWindo
7171
7272 this ->ui ->preferences_keep_running ->setEnabled (QSystemTrayIcon::isSystemTrayAvailable ());
7373 if (!QSystemTrayIcon::isSystemTrayAvailable ()) {
74- this ->ui ->preferences_keep_running ->setToolTip (" I couldn't detect any system tray on this system." );
74+ this ->ui ->preferences_keep_running ->setToolTip (" No system tray on this system." );
7575 }
7676
7777 this ->ui ->preferences_theme_mode ->setEnabled (QT_VERSION >= QT_VERSION_CHECK (6 , 8 , 0 ));
@@ -90,8 +90,6 @@ TabPreferences::TabPreferences(MainWindow &window, std::shared_ptr<Ui::MainWindo
9090 this ->ui ->preferences_app_log_max_blocks ->setValue (configurator.app_log_max_blocks );
9191 this ->ui ->preferences_app_log_max_blocks ->blockSignals (false );
9292
93- this ->on_theme_mode_changed (configurator.current_theme_mode );
94-
9593 this ->ui ->preferences_progress ->setVisible (false );
9694 this ->ui ->preferences_notify_releases ->setChecked (configurator.GetUseNotifyReleases ());
9795 this ->ui ->preferences_download ->setText (" Searching Latest Vulkan SDK..." );
@@ -111,6 +109,8 @@ TabPreferences::TabPreferences(MainWindow &window, std::shared_ptr<Ui::MainWindo
111109#if WORKAROUND_WINARM_RELEASE_NOTIFICATION_BUG
112110 }
113111#endif
112+
113+ this ->UpdatePreferences (configurator.current_theme_mode );
114114}
115115
116116TabPreferences::~TabPreferences () {}
@@ -147,56 +147,24 @@ void TabPreferences::UpdateUI(UpdateUIMode mode) {
147147
148148void TabPreferences::CleanUI () {}
149149
150- bool TabPreferences::EventFilter (QObject *target, QEvent *event) {
151- (void )target;
152- (void )event;
153-
154- return false ;
155- }
156-
157- void TabPreferences::on_show_executables_scope_toggled (bool checked) {
158- Configurator &configurator = Configurator::Get ();
159- configurator.configuration_show_scope = checked;
160-
161- this ->UpdateUI (UPDATE_REFRESH_UI );
162- }
163-
164- void TabPreferences::on_all_enabled_executables_changed (int index) {
165- Configurator &configurator = Configurator::Get ();
166-
167- configurator.Surrender (OVERRIDE_AREA_ALL );
168-
169- const ExecutableAllEnabledBehavior behavior = static_cast <ExecutableAllEnabledBehavior>(index);
170- configurator.SetAllEnabledExecutableBehavior (behavior);
171-
172- configurator.Override (OVERRIDE_AREA_ALL );
173- }
174-
175- void TabPreferences::on_app_text_max_blocks_changed (int index) {
176- Configurator &configurator = Configurator::Get ();
177- configurator.app_log_max_blocks = index;
178- }
179-
180- void TabPreferences::on_theme_mode_changed (int index) {
150+ void TabPreferences::UpdatePreferences (ThemeMode new_theme_mode) {
181151 Configurator &configurator = Configurator::Get ();
182152
183- const ThemeMode new_theme_mode = static_cast <ThemeMode>(index);
184-
185- // Configurations
153+ // Configurations
186154 this ->ui ->configurations_executable_append ->setIcon (::Get (new_theme_mode, ::ICON_FILE_SEARCH ));
187155 this ->ui ->configurations_executable_remove ->setIcon (::Get (new_theme_mode, ::ICON_FILE_REMOVE ));
188156 this ->ui ->configurations_settings_reset ->setIcon (::Get (new_theme_mode, ::ICON_RELOAD ));
189157
190- // Drivers
158+ // Drivers
191159 this ->ui ->driver_browse ->setIcon (::Get (new_theme_mode, ::ICON_FOLDER_SEARCH ));
192160 this ->ui ->driver_search_clear ->setIcon (::Get (new_theme_mode, ::ICON_EXIT ));
193161
194- // Layers
162+ // Layers
195163 this ->ui ->layers_browse_button ->setIcon (::Get (new_theme_mode, ::ICON_FOLDER_SEARCH ));
196164 this ->ui ->layers_reload_button ->setIcon (::Get (new_theme_mode, ::ICON_FOLDER_RELOAD ));
197165 this ->ui ->layers_search_clear ->setIcon (::Get (new_theme_mode, ::ICON_EXIT ));
198166
199- // Applications
167+ // Applications
200168 this ->ui ->launch_executable_search ->setIcon (::Get (new_theme_mode, ::ICON_FILE_SEARCH ));
201169 this ->ui ->launch_executable_append ->setIcon (::Get (new_theme_mode, ::ICON_FILE_APPEND ));
202170 this ->ui ->launch_executable_remove ->setIcon (::Get (new_theme_mode, ::ICON_FILE_REMOVE ));
@@ -213,7 +181,7 @@ void TabPreferences::on_theme_mode_changed(int index) {
213181 this ->ui ->launch_search_whole ->setIcon (::Get (new_theme_mode, ::ICON_SEARCH_WHOLE ));
214182 this ->ui ->launch_search_regex ->setIcon (::Get (new_theme_mode, ::ICON_SEARCH_REGEX ));
215183
216- // Diagnostics
184+ // Diagnostics
217185 this ->ui ->diagnostic_export_folder ->setIcon (::Get (new_theme_mode, ::ICON_FOLDER_EXPORT ));
218186 this ->ui ->diagnostic_export_file ->setIcon (::Get (new_theme_mode, ::ICON_FILE_EXPORT ));
219187 this ->ui ->diagnostic_refresh ->setIcon (::Get (new_theme_mode, ::ICON_RELOAD ));
@@ -279,63 +247,88 @@ void TabPreferences::on_theme_mode_changed(int index) {
279247 }
280248
281249 {
282- if (VKC_PLATFORM == PLATFORM_LINUX && this ->initialized ) {
283- if (!(configurator.Get (HIDE_MESSAGE_WARN_DARK_THEME_LINUX ))) {
284- QMessageBox alert;
285- alert.setWindowTitle (" Dark Mode on Linux system" );
286- alert.setText (
287- " The support of Dark Mode depends on the Linux desktop support so this option may have limited effects..." );
288- alert.setInformativeText (" Only Vulkan Configurator icons may change color when dark mode is not supported." );
289- alert.setStandardButtons (QMessageBox::Ok);
290- alert.setDefaultButton (QMessageBox::Ok);
291- alert.setIcon (QMessageBox::Warning);
292- alert.setCheckBox (new QCheckBox (" Do not show again." ));
293- alert.exec ();
294- if (alert.checkBox ()->isChecked ()) {
295- configurator.Set (HIDE_MESSAGE_WARN_DARK_THEME_LINUX );
296- }
297- }
298- }
299-
300250 if (configurator.current_theme_mode == new_theme_mode && this ->initialized ) {
301251 return ; // Prevent Qt 6.8 crash
302252 }
303253
304254 configurator.current_theme_mode = new_theme_mode;
255+ }
305256
306- #if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
307- switch (new_theme_mode) {
308- default :
309- case THEME_MODE_AUTO :
310- this ->window .app .styleHints ()->unsetColorScheme ();
311- break ;
312- case THEME_MODE_FORCE_LIGHT : {
313- this ->window .app .styleHints ()->setColorScheme (Qt::ColorScheme::Light);
314- break ;
315- }
316- case THEME_MODE_FORCE_DARK : {
317- this ->window .app .styleHints ()->setColorScheme (Qt::ColorScheme::Dark);
318- break ;
257+ this ->initialized = true ;
258+ }
259+
260+ bool TabPreferences::EventFilter (QObject *target, QEvent *event) {
261+ (void )target;
262+ (void )event;
263+
264+ return false ;
265+ }
266+
267+ void TabPreferences::on_show_executables_scope_toggled (bool checked) {
268+ Configurator &configurator = Configurator::Get ();
269+ configurator.configuration_show_scope = checked;
270+
271+ this ->UpdateUI (UPDATE_REFRESH_UI );
272+ }
273+
274+ void TabPreferences::on_all_enabled_executables_changed (int index) {
275+ Configurator &configurator = Configurator::Get ();
276+
277+ configurator.Surrender (OVERRIDE_AREA_ALL );
278+
279+ const ExecutableAllEnabledBehavior behavior = static_cast <ExecutableAllEnabledBehavior>(index);
280+ configurator.SetAllEnabledExecutableBehavior (behavior);
281+
282+ configurator.Override (OVERRIDE_AREA_ALL );
283+ }
284+
285+ void TabPreferences::on_app_text_max_blocks_changed (int index) {
286+ Configurator &configurator = Configurator::Get ();
287+ configurator.app_log_max_blocks = index;
288+ }
289+
290+ void TabPreferences::on_theme_mode_changed (int index) {
291+ static bool only_once = true ;
292+
293+ if (VKC_PLATFORM == PLATFORM_LINUX ) {
294+ Configurator &configurator = Configurator::Get ();
295+
296+ if (only_once && !(configurator.Get (HIDE_MESSAGE_WARN_DARK_THEME_LINUX ))) {
297+ QMessageBox alert;
298+ alert.setWindowTitle (" Dark Mode on Linux system" );
299+ alert.setText (
300+ " The support of Dark Mode depends on the Linux desktop support so this option may have limited effects..." );
301+ alert.setInformativeText (" Only Vulkan Configurator icons may change color when dark mode is not supported." );
302+ alert.setStandardButtons (QMessageBox::Ok);
303+ alert.setDefaultButton (QMessageBox::Ok);
304+ alert.setIcon (QMessageBox::Warning);
305+ alert.setCheckBox (new QCheckBox (" Do not show again." ));
306+ alert.exec ();
307+ if (alert.checkBox ()->isChecked ()) {
308+ configurator.Set (HIDE_MESSAGE_WARN_DARK_THEME_LINUX );
319309 }
310+
311+ only_once = false ;
320312 }
321- #endif
322313 }
323314
324- this ->initialized = true ;
315+ const ThemeMode new_theme_mode = static_cast <ThemeMode>(index);
316+
317+ this ->UpdatePreferences (new_theme_mode);
325318}
326319
327320void TabPreferences::on_theme_light_alternate_enabled (bool checked) {
328321 Configurator &configurator = Configurator::Get ();
329322 configurator.theme_light_alternate_enabled = checked;
330323
331- this ->on_theme_mode_changed (configurator.current_theme_mode );
324+ this ->UpdatePreferences (configurator.current_theme_mode );
332325}
333326
334327void TabPreferences::on_theme_dark_alternate_enabled (bool checked) {
335328 Configurator &configurator = Configurator::Get ();
336329 configurator.theme_dark_alternate_enabled = checked;
337330
338- this ->on_theme_mode_changed (configurator.current_theme_mode );
331+ this ->UpdatePreferences (configurator.current_theme_mode );
339332}
340333
341334void TabPreferences::on_theme_light_alternate_pressed () {
@@ -351,7 +344,7 @@ void TabPreferences::on_theme_light_alternate_pressed() {
351344 configurator.theme_light_alternate_color = color;
352345 }
353346
354- this ->on_theme_mode_changed (configurator.current_theme_mode );
347+ this ->UpdatePreferences (configurator.current_theme_mode );
355348}
356349
357350void TabPreferences::on_theme_dark_alternate_pressed () {
@@ -366,7 +359,7 @@ void TabPreferences::on_theme_dark_alternate_pressed() {
366359 configurator.theme_dark_alternate_color = color;
367360 }
368361
369- this ->on_theme_mode_changed (configurator.current_theme_mode );
362+ this ->UpdatePreferences (configurator.current_theme_mode );
370363}
371364
372365void TabPreferences::on_keep_running_toggled (bool checked) {
0 commit comments