VirtualBox

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


Ignore:
Timestamp:
Jul 19, 2019 5:42:59 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132305
Message:

FE/Qt: bugref:7720: Small styling cleanup for UIDetailsElement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r79365 r79897  
    410410void UIDetailsElement::sltHandleAnchorClicked(const QString &strAnchor)
    411411{
     412    /* Enumerate known anchor roles: */
     413    enum AnchorRole
     414    {
     415        AnchorRole_Invalid,
     416        AnchorRole_Storage,
     417    };
     418    /* Compose a map of known anchor roles: */
     419    QMap<QString, AnchorRole> roles;
     420    roles["#mount"] = AnchorRole_Storage;
     421    roles["#attach"] = AnchorRole_Storage;
     422
    412423    /* Current anchor role: */
    413424    const QString strRole = strAnchor.section(',', 0, 0);
     
    415426
    416427    /* Handle known anchor roles: */
    417     if (   strRole == "#mount"  // Optical and floppy attachments..
    418         || strRole == "#attach" // Hard-drive attachments..
    419         )
    420     {
    421         /* Prepare storage-menu: */
    422         UIMenu menu;
    423         menu.setShowToolTip(true);
    424 
    425         /* Storage-controller name: */
    426         QString strControllerName = strData.section(',', 0, 0);
    427         /* Storage-slot: */
    428         StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strData.section(',', 1));
    429 
    430         /* Fill storage-menu: */
    431         uiCommon().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()),
    432                                         machine(), strControllerName, storageSlot);
    433 
    434         /* Exec menu: */
    435         menu.exec(QCursor::pos());
     428    switch (roles.value(strRole, AnchorRole_Invalid))
     429    {
     430        case AnchorRole_Storage:
     431        {
     432            /* Prepare storage-menu: */
     433            UIMenu menu;
     434            menu.setShowToolTip(true);
     435
     436            /* Storage-controller name: */
     437            QString strControllerName = strData.section(',', 0, 0);
     438            /* Storage-slot: */
     439            StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strData.section(',', 1));
     440
     441            /* Fill storage-menu: */
     442            uiCommon().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()),
     443                                          machine(), strControllerName, storageSlot);
     444
     445            /* Exec menu: */
     446            menu.exec(QCursor::pos());
     447            break;
     448        }
     449        default:
     450            break;
    436451    }
    437452}
Note: See TracChangeset for help on using the changeset viewer.

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