Changeset 89298 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 26, 2021 3:32:54 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r89296 r89298 40 40 #ifdef VBOX_WS_WIN 41 41 # include <QEventLoop> 42 # include <QStyleFactory> 42 43 #endif 43 44 #ifdef VBOX_WS_X11 … … 723 724 } 724 725 726 #ifdef VBOX_WS_WIN 727 /* static */ 728 void UICommon::loadColorTheme() 729 { 730 /* Load saved color theme: */ 731 UIColorThemeType enmColorTheme = gEDataManager->colorTheme(); 732 733 /* Check whether we have dark system theme requested: */ 734 if (enmColorTheme == UIColorThemeType_Auto) 735 { 736 QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 737 QSettings::NativeFormat); 738 if (settings.value("AppsUseLightTheme") == 0) 739 enmColorTheme = UIColorThemeType_Dark; 740 } 741 742 /* Check whether dark theme was requested by any means: */ 743 if (enmColorTheme == UIColorThemeType_Dark) 744 { 745 qApp->setStyle(QStyleFactory::create("Fusion")); 746 QPalette darkPalette; 747 QColor windowColor1 = QColor(59, 60, 61); 748 QColor windowColor2 = QColor(63, 64, 65); 749 QColor baseColor1 = QColor(46, 47, 48); 750 QColor baseColor2 = QColor(56, 57, 58); 751 QColor disabledColor = QColor(113, 114, 115); 752 darkPalette.setColor(QPalette::Window, windowColor1); 753 darkPalette.setColor(QPalette::WindowText, Qt::white); 754 darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledColor); 755 darkPalette.setColor(QPalette::Base, baseColor1); 756 darkPalette.setColor(QPalette::AlternateBase, baseColor2); 757 darkPalette.setColor(QPalette::PlaceholderText, disabledColor); 758 darkPalette.setColor(QPalette::Text, Qt::white); 759 darkPalette.setColor(QPalette::Disabled, QPalette::Text, disabledColor); 760 darkPalette.setColor(QPalette::Button, windowColor2); 761 darkPalette.setColor(QPalette::ButtonText, Qt::white); 762 darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, disabledColor); 763 darkPalette.setColor(QPalette::BrightText, Qt::red); 764 darkPalette.setColor(QPalette::Link, QColor(179, 214, 242)); 765 darkPalette.setColor(QPalette::Highlight, QColor(29, 84, 92)); 766 darkPalette.setColor(QPalette::HighlightedText, Qt::white); 767 darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, disabledColor); 768 qApp->setPalette(darkPalette); 769 qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2b2b2b; border: 1px solid #737373; }"); 770 } 771 } 772 #endif /* VBOX_WS_WIN */ 773 725 774 /* static */ 726 775 void UICommon::loadLanguage(const QString &strLangId) … … 4147 4196 m_pThreadPoolCloud = new UIThreadPool(2 /* worker count */, 1000 /* worker timeout */); 4148 4197 4198 #ifdef VBOX_WS_WIN 4199 /* Load color theme: */ 4200 loadColorTheme(); 4201 #endif 4202 4149 4203 /* Load translation based on the user settings: */ 4150 4204 QString sLanguageId = gEDataManager->languageId(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r88678 r89298 5 5 6 6 /* 7 * Copyright (C) 2006-202 0Oracle Corporation7 * Copyright (C) 2006-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 315 315 /** Returns the system language ID. */ 316 316 static QString systemLanguageId(); 317 318 #ifdef VBOX_WS_WIN 319 /** Loads the color theme. */ 320 static void loadColorTheme(); 321 #endif 317 322 318 323 /** Loads the language by language ID.
Note:
See TracChangeset
for help on using the changeset viewer.