VirtualBox

Changeset 74546 in vbox for trunk


Ignore:
Timestamp:
Oct 1, 2018 11:19:13 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager: Tools pane: A bit of fixes for type conversion stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r74466 r74546  
    536536QString UIToolsModel::typeToString(UIToolsType enmType)
    537537{
    538     switch (enmType)
    539     {
    540         /* Global classes: */
    541         case UIToolsType_Media:     return "Media";
    542         case UIToolsType_Network:   return "Network";
    543         /* Machine classes: */
    544         case UIToolsType_Details:   return "Details";
    545         case UIToolsType_Snapshots: return "Snapshots";
    546         case UIToolsType_Logs:      return "Logs";
    547         default: break;
    548     }
    549     return QString();
     538    QMap<UIToolsType, QString> values;
     539    /* Global classes: */
     540    values[UIToolsType_Media]     = "Media";
     541    values[UIToolsType_Network]   = "Network";
     542    /* Machine classes: */
     543    values[UIToolsType_Details]   = "Details";
     544    values[UIToolsType_Snapshots] = "Snapshots";
     545    values[UIToolsType_Logs]      = "Logs";
     546    /* Return value, null-string by default: */
     547    return values.value(enmType, QString());
    550548}
    551549
     
    553551UIToolsType UIToolsModel::typeFromString(const QString &strType)
    554552{
     553    QMap<QString, UIToolsType> values;
    555554    /* Global classes: */
    556     if      (strType == "Media")     return UIToolsType_Media;
    557     else if (strType == "Network")   return UIToolsType_Network;
     555    values["Media"]     = UIToolsType_Media;
     556    values["Network"]   = UIToolsType_Network;
    558557    /* Machine classes: */
    559     else if (strType == "Details")   return UIToolsType_Details;
    560     else if (strType == "Snapshots") return UIToolsType_Snapshots;
    561     else if (strType == "Logs")      return UIToolsType_Logs;
    562     return UIToolsType_Invalid;
     558    values["Details"]   = UIToolsType_Details;
     559    values["Snapshots"] = UIToolsType_Snapshots;
     560    values["Logs"]      = UIToolsType_Logs;
     561    /* Return value, UIToolsType_Invalid by default: */
     562    return values.value(strType, UIToolsType_Invalid);
    563563}
    564564
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