Changeset 102750 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 3, 2024 4:10:44 PM (16 months ago)
- svn:sync-xref-src-repo-rev:
- 160927
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r102525 r102750 327 327 #elif defined(VBOX_WS_WIN) 328 328 m_fDarkMode = isWindowsInDarkMode(); 329 #endif 329 #else /* Linux, BSD, Solaris */ 330 m_fDarkMode = isPaletteInDarkMode(); 331 #endif /* Linux, BSD, Solaris */ 330 332 /* Load color theme: */ 331 333 loadColorTheme(); … … 1011 1013 } 1012 1014 1013 #ifdef VBOX_WS_WIN 1015 #if defined(VBOX_WS_MAC) 1016 // Provided by UICocoaApplication .. 1017 1018 #elif defined(VBOX_WS_WIN) 1019 1014 1020 bool UICommon::isWindowsInDarkMode() const 1015 1021 { … … 1029 1035 return enmColorTheme == UIColorThemeType_Dark; 1030 1036 } 1031 #endif /* VBOX_WS_WIN */ 1037 1038 #else /* Linux, BSD, Solaris */ 1039 1040 bool UICommon::isPaletteInDarkMode() const 1041 { 1042 const QPalette pal = qApp->palette(); 1043 const QColor background = pal.color(QPalette::Active, QPalette::Window); 1044 const double dLuminance = (0.299 * background.red() + 0.587 * background.green() + 0.114 * background.blue()) / 255; 1045 return dLuminance < 0.5; 1046 } 1047 #endif /* Linux, BSD, Solaris */ 1032 1048 1033 1049 void UICommon::loadColorTheme() -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r102525 r102750 233 233 QString hostOperatingSystem() const; 234 234 235 #ifdef VBOX_WS_WIN 235 #if defined(VBOX_WS_MAC) 236 // Provided by UICocoaApplication .. 237 #elif defined(VBOX_WS_WIN) 236 238 /** Returns whether Windows host is in Dark mode. */ 237 239 bool isWindowsInDarkMode() const; 238 #endif 240 #else /* Linux, BSD, Solaris */ 241 /** Returns whether palette is in Dark mode. */ 242 bool isPaletteInDarkMode() const; 243 #endif /* Linux, BSD, Solaris */ 239 244 240 245 /** Returns whether host OS is in Dark mode. */
Note:
See TracChangeset
for help on using the changeset viewer.