Changeset 102476 in vbox
- Timestamp:
- Dec 5, 2023 1:44:42 PM (12 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r102474 r102476 83 83 #include "UIWizardNewVD.h" 84 84 #ifdef VBOX_WS_MAC 85 # include "UICocoaApplication.h" 85 86 # include "UIMachineWindowFullscreen.h" 86 87 # include "UIMachineWindowSeamless.h" … … 190 191 , m_fDataCommitted(false) 191 192 #endif 193 #ifdef VBOX_WS_MAC 194 , m_fDarkMode(false) 195 #endif 192 196 #ifdef VBOX_WS_NIX 193 197 , m_enmWindowManagerType(X11WMType_Unknown) … … 311 315 m_pThreadPoolCloud = new UIThreadPool(2 /* worker count */, 1000 /* worker timeout */); 312 316 317 #ifdef VBOX_WS_MAC 318 /* Load whether macOS is in Dark mode: */ 319 m_fDarkMode = UICocoaApplication::instance()->isDarkMode(); 320 #endif 313 321 #ifdef VBOX_WS_WIN 314 322 /* Load color theme: */ … … 2729 2737 } 2730 2738 2739 #ifdef VBOX_WS_MAC 2740 /* Handle application palette change event: */ 2741 if ( pEvent->type() == QEvent::ApplicationPaletteChange 2742 && pObject == windowManager().mainWindowShown()) 2743 { 2744 const bool fDarkMode = UICocoaApplication::instance()->isDarkMode(); 2745 if (m_fDarkMode != fDarkMode) 2746 { 2747 m_fDarkMode = fDarkMode; 2748 emit sigThemeChange(); 2749 } 2750 } 2751 #endif 2752 2731 2753 /* Call to base-class: */ 2732 2754 return QObject::eventFilter(pObject, pEvent); 2733 2755 } 2734 2735 2756 2736 2757 void UICommon::sltHandleFontScaleFactorChanged(int iFontScaleFactor) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r102363 r102476 94 94 /** @} */ 95 95 96 /** @name Theme stuff. 97 * @{ */ 98 /** Notifies listeners about theme change. */ 99 void sigThemeChange(); 100 /** @} */ 101 96 102 /** @name COM: Extension Pack stuff. 97 103 * @{ */ … … 634 640 bool m_fDataCommitted; 635 641 #endif 642 643 #ifdef VBOX_WS_MAC 644 /** Holds whether macOS is in Dark mode. */ 645 bool m_fDarkMode; 646 #endif 636 647 /** @} */ 637 648 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h
r98103 r102476 77 77 bool isActive() const; 78 78 79 /** Returns whether app is in Dark mode. */ 80 bool isDarkMode() const; 81 79 82 /** Hides the application. */ 80 83 void hide(); -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
r98103 r102476 329 329 } 330 330 331 bool UICocoaApplication::isDarkMode() const 332 { 333 NativeNSStringRef pstrInterfaceMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; 334 return [pstrInterfaceMode isEqualToString :@"Dark"]; 335 } 336 331 337 void UICocoaApplication::hide() 332 338 {
Note:
See TracChangeset
for help on using the changeset viewer.