VirtualBox

Ignore:
Timestamp:
May 26, 2021 3:21:24 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10003: Introducing new GUI_ColorTheme extra-data flag and corresponding setter/getter; That stuff isn't yet handled anywhere.

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  
    55
    66/*
    7  * Copyright (C) 2012-2020 Oracle Corporation
     7 * Copyright (C) 2012-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    105105template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>();
    106106template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>();
     107template<> SHARED_LIBRARY_STUFF bool canConvert<UIColorThemeType>();
    107108template<> SHARED_LIBRARY_STUFF bool canConvert<UIToolType>();
    108109template<> SHARED_LIBRARY_STUFF bool canConvert<UIVisualStateType>();
     
    217218template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &enmDetailsElementOptionTypeDescription);
    218219template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(const QString &strDetailsElementOptionTypeDescription);
     220template<> SHARED_LIBRARY_STUFF QString toString(const UIColorThemeType &colorThemeType);
     221template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIColorThemeType &colorThemeType);
     222template<> SHARED_LIBRARY_STUFF UIColorThemeType fromInternalString<UIColorThemeType>(const QString &strColorThemeType);
    219223template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIToolType &enmToolType);
    220224template<> SHARED_LIBRARY_STUFF UIToolType fromInternalString<UIToolType>(const QString &strToolType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r88173 r89295  
    55
    66/*
    7  * Copyright (C) 2012-2020 Oracle Corporation
     7 * Copyright (C) 2012-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5959template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>() { return true; }
    6060template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>() { return true; }
     61template<> bool canConvert<UIColorThemeType>() { return true; }
    6162template<> bool canConvert<UIToolType>() { return true; }
    6263template<> bool canConvert<UIVisualStateType>() { return true; }
     
    15061507}
    15071508
     1509/* QString <= UIColorThemeType: */
     1510template<> 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: */
     1528template<> 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: */
     1546template<> 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
    15081560/* QString <= UIToolType: */
    15091561template<> QString toInternalString(const UIToolType &enmToolType)
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r88411 r89295  
    55
    66/*
    7  * Copyright (C) 2006-2020 Oracle Corporation
     7 * Copyright (C) 2006-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2222/* General: */
    2323const char *UIExtraDataDefs::GUI_RestrictedDialogs = "GUI/RestrictedDialogs";
     24const char *UIExtraDataDefs::GUI_ColorTheme = "GUI/ColorTheme";
    2425
    2526
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r88411 r89295  
    55
    66/*
    7  * Copyright (C) 2006-2020 Oracle Corporation
     7 * Copyright (C) 2006-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4646        /** Holds restricted dialogs. */
    4747        SHARED_LIBRARY_STUFF extern const char *GUI_RestrictedDialogs;
     48
     49        /** Holds the color theme type. */
     50        SHARED_LIBRARY_STUFF extern const char *GUI_ColorTheme;
    4851    /** @} */
    4952
     
    879882
    880883
     884/** Common UI: Color Theme types. */
     885enum UIColorThemeType
     886{
     887    UIColorThemeType_Auto,
     888    UIColorThemeType_Light,
     889    UIColorThemeType_Dark,
     890};
     891Q_DECLARE_METATYPE(UIColorThemeType);
     892
     893
    881894/** Tool item classes. */
    882895enum UIToolClass
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r88585 r89295  
    55
    66/*
    7  * Copyright (C) 2010-2020 Oracle Corporation
     7 * Copyright (C) 2010-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    23132313}
    23142314
     2315UIColorThemeType UIExtraDataManager::colorTheme()
     2316{
     2317    return gpConverter->fromInternalString<UIColorThemeType>(extraDataString(GUI_ColorTheme));
     2318}
     2319
     2320void UIExtraDataManager::setColorTheme(const UIColorThemeType &enmType)
     2321{
     2322    setExtraDataString(GUI_ColorTheme, gpConverter->toInternalString(enmType));
     2323}
     2324
    23152325QStringList UIExtraDataManager::suppressedMessages(const QUuid &uID /* = GlobalID */)
    23162326{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r88585 r89295  
    55
    66/*
    7  * Copyright (C) 2010-2020 Oracle Corporation
     7 * Copyright (C) 2010-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    162162        /** Defines a list of restricted dialogs. */
    163163        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);
    164169    /** @} */
    165170
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette