Changeset 89295 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 26, 2021 3:21:24 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r88082 r89295 5 5 6 6 /* 7 * Copyright (C) 2012-202 0Oracle Corporation7 * Copyright (C) 2012-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 105 105 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(); 106 106 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(); 107 template<> SHARED_LIBRARY_STUFF bool canConvert<UIColorThemeType>(); 107 108 template<> SHARED_LIBRARY_STUFF bool canConvert<UIToolType>(); 108 109 template<> SHARED_LIBRARY_STUFF bool canConvert<UIVisualStateType>(); … … 217 218 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &enmDetailsElementOptionTypeDescription); 218 219 template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(const QString &strDetailsElementOptionTypeDescription); 220 template<> SHARED_LIBRARY_STUFF QString toString(const UIColorThemeType &colorThemeType); 221 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIColorThemeType &colorThemeType); 222 template<> SHARED_LIBRARY_STUFF UIColorThemeType fromInternalString<UIColorThemeType>(const QString &strColorThemeType); 219 223 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIToolType &enmToolType); 220 224 template<> SHARED_LIBRARY_STUFF UIToolType fromInternalString<UIToolType>(const QString &strToolType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r88173 r89295 5 5 6 6 /* 7 * Copyright (C) 2012-202 0Oracle Corporation7 * Copyright (C) 2012-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 59 59 template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>() { return true; } 60 60 template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>() { return true; } 61 template<> bool canConvert<UIColorThemeType>() { return true; } 61 62 template<> bool canConvert<UIToolType>() { return true; } 62 63 template<> bool canConvert<UIVisualStateType>() { return true; } … … 1506 1507 } 1507 1508 1509 /* QString <= UIColorThemeType: */ 1510 template<> QString toString(const UIColorThemeType &colorThemeType) 1511 { 1512 QString strResult; 1513 switch (colorThemeType) 1514 { 1515 case UIColorThemeType_Auto: strResult = QApplication::translate("UICommon", "Follow System Settings", "color theme"); break; 1516 case UIColorThemeType_Light: strResult = QApplication::translate("UICommon", "Light", "color theme"); break; 1517 case UIColorThemeType_Dark: strResult = QApplication::translate("UICommon", "Dark", "color theme"); break; 1518 default: 1519 { 1520 AssertMsgFailed(("No text for color theme type=%d", colorThemeType)); 1521 break; 1522 } 1523 } 1524 return strResult; 1525 } 1526 1527 /* QString <= UIColorThemeType: */ 1528 template<> QString toInternalString(const UIColorThemeType &colorThemeType) 1529 { 1530 QString strResult; 1531 switch (colorThemeType) 1532 { 1533 case UIColorThemeType_Auto: break; 1534 case UIColorThemeType_Light: strResult = "Light"; break; 1535 case UIColorThemeType_Dark: strResult = "Dark"; break; 1536 default: 1537 { 1538 AssertMsgFailed(("No text for color theme type=%d", colorThemeType)); 1539 break; 1540 } 1541 } 1542 return strResult; 1543 } 1544 1545 /* UIColorThemeType <= QString: */ 1546 template<> UIColorThemeType fromInternalString<UIColorThemeType>(const QString &strColorThemeType) 1547 { 1548 /* Here we have some fancy stuff allowing us 1549 * to search through the keys using 'case-insensitive' rule: */ 1550 QStringList keys; QList<UIColorThemeType> values; 1551 keys << "Light"; values << UIColorThemeType_Light; 1552 keys << "Dark"; values << UIColorThemeType_Dark; 1553 /* Auto type for unknown words: */ 1554 if (!keys.contains(strColorThemeType, Qt::CaseInsensitive)) 1555 return UIColorThemeType_Auto; 1556 /* Corresponding type for known words: */ 1557 return values.at(keys.indexOf(QRegExp(strColorThemeType, Qt::CaseInsensitive))); 1558 } 1559 1508 1560 /* QString <= UIToolType: */ 1509 1561 template<> QString toInternalString(const UIToolType &enmToolType) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r88411 r89295 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 … … 22 22 /* General: */ 23 23 const char *UIExtraDataDefs::GUI_RestrictedDialogs = "GUI/RestrictedDialogs"; 24 const char *UIExtraDataDefs::GUI_ColorTheme = "GUI/ColorTheme"; 24 25 25 26 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r88411 r89295 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 … … 46 46 /** Holds restricted dialogs. */ 47 47 SHARED_LIBRARY_STUFF extern const char *GUI_RestrictedDialogs; 48 49 /** Holds the color theme type. */ 50 SHARED_LIBRARY_STUFF extern const char *GUI_ColorTheme; 48 51 /** @} */ 49 52 … … 879 882 880 883 884 /** Common UI: Color Theme types. */ 885 enum UIColorThemeType 886 { 887 UIColorThemeType_Auto, 888 UIColorThemeType_Light, 889 UIColorThemeType_Dark, 890 }; 891 Q_DECLARE_METATYPE(UIColorThemeType); 892 893 881 894 /** Tool item classes. */ 882 895 enum UIToolClass -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r88585 r89295 5 5 6 6 /* 7 * Copyright (C) 2010-202 0Oracle Corporation7 * Copyright (C) 2010-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 2313 2313 } 2314 2314 2315 UIColorThemeType UIExtraDataManager::colorTheme() 2316 { 2317 return gpConverter->fromInternalString<UIColorThemeType>(extraDataString(GUI_ColorTheme)); 2318 } 2319 2320 void UIExtraDataManager::setColorTheme(const UIColorThemeType &enmType) 2321 { 2322 setExtraDataString(GUI_ColorTheme, gpConverter->toInternalString(enmType)); 2323 } 2324 2315 2325 QStringList UIExtraDataManager::suppressedMessages(const QUuid &uID /* = GlobalID */) 2316 2326 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r88585 r89295 5 5 6 6 /* 7 * Copyright (C) 2010-202 0Oracle Corporation7 * Copyright (C) 2010-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 162 162 /** Defines a list of restricted dialogs. */ 163 163 void setRestrictedDialogTypes(UIExtraDataMetaDefs::DialogType enmTypes, const QUuid &uID); 164 165 /** Returns color theme type. */ 166 UIColorThemeType colorTheme(); 167 /** Defines color theme @a enmType. */ 168 void setColorTheme(const UIColorThemeType &enmType); 164 169 /** @} */ 165 170
Note:
See TracChangeset
for help on using the changeset viewer.