VirtualBox

Changeset 51178 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 30, 2014 2:43:00 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 6660: Advanced extra-data management framework: Common restriction rule (as pair to common allowance rule).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/extradata
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r51177 r51178  
    575575}
    576576
    577 QString UIExtraDataManager::extraDataString(const QString &strKey, const QString &strID /* = QString() */) const
     577bool UIExtraDataManager::isFeatureRestricted(const QString &strKey, const QString &strID /* = QString() */) const
    578578{
    579579    /* Hot-load machine extra-data map if necessary: */
     
    584584    ExtraDataMap &data = m_data[strID];
    585585
     586    /* 'false' if value was not set: */
     587    if (!data.contains(strKey))
     588        return false;
     589
     590    /* Check corresponding value: */
     591    const QString &strValue = data[strKey];
     592    return    strValue.compare("false", Qt::CaseInsensitive) == 0
     593           || strValue.compare("no", Qt::CaseInsensitive) == 0
     594           || strValue.compare("off", Qt::CaseInsensitive) == 0
     595           || strValue == "0";
     596}
     597
     598QString UIExtraDataManager::extraDataString(const QString &strKey, const QString &strID /* = QString() */) const
     599{
     600    /* Hot-load machine extra-data map if necessary: */
     601    if (!strID.isNull() && !m_data.contains(strID))
     602        hotloadMachineExtraDataMap(strID);
     603
     604    /* Access corresponding map: */
     605    ExtraDataMap &data = m_data[strID];
     606
    586607    /* QString() if value was not set: */
    587608    if (!data.contains(strKey))
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51177 r51178  
    170170      * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
    171171    bool isFeatureAllowed(const QString &strKey, const QString &strID = QString()) const;
     172    /** Determines whether feature corresponding to passed @a strKey is restricted.
     173      * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
     174    bool isFeatureRestricted(const QString &strKey, const QString &strID = QString()) const;
    172175
    173176    /** Returns extra-data value corresponding to passed @a strKey as QString.
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