VirtualBox

Ignore:
Timestamp:
May 25, 2016 2:21:50 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Extra-data Manager: Continue with the r106215 to use the same approach on base extra-data getters.

File:
1 edited

Legend:

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

    r60599 r61191  
    20802080QString UIExtraDataManager::extraDataString(const QString &strKey, const QString &strID /* = GlobalID */)
    20812081{
    2082     /* Hot-load machine extra-data map if necessary: */
    2083     if (strID != GlobalID && !m_data.contains(strID))
    2084         hotloadMachineExtraDataMap(strID);
    2085 
    2086     // TODO: Check if we can avoid copying here..
    2087     /* Make a read-only copy of the corresponding map: */
    2088     const ExtraDataMap data = m_data.value(strID);
    2089 
    2090     /* QString() if value was not set: */
    2091     if (!data.contains(strKey))
     2082    /* Get the value. Return 'QString()' if not found: */
     2083    const QString strValue = extraDataStringUnion(strKey, strID);
     2084    if (strValue.isNull())
    20922085        return QString();
    20932086
    20942087    /* Returns corresponding value: */
    2095     return data[strKey];
     2088    return strValue;
    20962089}
    20972090
     
    21882181QStringList UIExtraDataManager::extraDataStringList(const QString &strKey, const QString &strID /* = GlobalID */)
    21892182{
    2190     /* Hot-load machine extra-data map if necessary: */
    2191     if (strID != GlobalID && !m_data.contains(strID))
    2192         hotloadMachineExtraDataMap(strID);
    2193 
    2194     /* Read-only access corresponding map: */
    2195     const ExtraDataMap data = m_data.value(strID);
    2196 
    2197     /* QStringList() if machine value was not set: */
    2198     if (!data.contains(strKey))
     2183    /* Get the value. Return 'QStringList()' if not found: */
     2184    const QString strValue = extraDataStringUnion(strKey, strID);
     2185    if (strValue.isNull())
    21992186        return QStringList();
    22002187
    22012188    /* Few old extra-data string-lists were separated with 'semicolon' symbol.
    22022189     * All new separated by 'comma'. We have to take that into account. */
    2203     return data[strKey].split(QRegExp("[;,]"), QString::SkipEmptyParts);
     2190    return strValue.split(QRegExp("[;,]"), QString::SkipEmptyParts);
    22042191}
    22052192
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