VirtualBox

Ignore:
Timestamp:
Mar 27, 2014 3:21:43 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93034
Message:

FE/Qt: UIMediumTarget rework: Taking into account further use (hard-drive mediums) and some simplification.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r50897 r50910  
    19521952    /* Prepare open-existing-medium action: */
    19531953    QAction *pActionOpenExistingMedium = menu.addAction(QIcon(":/select_file_16px.png"), QString(), pListener, pszSlotName);
    1954     pActionOpenExistingMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(),
    1955                                                                           currentAttachment.GetDevice(), mediumType)));
     1954    pActionOpenExistingMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice(),
     1955                                                                          mediumType)));
    19561956
    19571957
     
    19911991            pActionChooseHostDrive->setCheckable(true);
    19921992            pActionChooseHostDrive->setChecked(!currentMedium.isNull() && medium.GetId() == strCurrentID);
    1993             pActionChooseHostDrive->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(),
    1994                                                                                currentAttachment.GetDevice(), medium.GetId())));
     1993            pActionChooseHostDrive->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice(),
     1994                                                                               mediumType, UIMediumTarget::UIMediumTargetType_WithID, medium.GetId())));
    19951995        }
    19961996    }
     
    20342034            pActionChooseRecentMedium->setCheckable(true);
    20352035            pActionChooseRecentMedium->setChecked(!currentMedium.isNull() && strRecentMediumLocation == strCurrentLocation);
    2036             pActionChooseRecentMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(),
    2037                                                                                   currentAttachment.GetDevice(), mediumType,
    2038                                                                                   strRecentMediumLocation)));
     2036            pActionChooseRecentMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice(),
     2037                                                                                  mediumType, UIMediumTarget::UIMediumTargetType_WithLocation, strRecentMediumLocation)));
    20392038            pActionChooseRecentMedium->setToolTip(strRecentMediumLocation);
    20402039        }
     
    20492048    QAction *pActionUnmountMedium = menu.addAction(QString(), pListener, pszSlotName);
    20502049    pActionUnmountMedium->setEnabled(!currentMedium.isNull());
    2051     pActionUnmountMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName,
    2052                                                                      currentAttachment.GetPort(), currentAttachment.GetDevice())));
     2050    pActionUnmountMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice())));
    20532051
    20542052
     
    20932091            /* New mount-target attributes: */
    20942092            QString strNewID;
    2095             const bool fSelectWithMediaManager = target.mediumType != UIMediumType_Invalid;
     2093            const bool fSelectWithMediaManager = target.mediumType != UIMediumType_Invalid && target.data.isNull();
    20962094
    20972095            /* Invoke file-open dialog to choose medium ID: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h

    r50864 r50910  
    4949    enum UIMediumTargetType { UIMediumTargetType_WithID, UIMediumTargetType_WithLocation };
    5050
    51     /** Default medium-target constructor. */
    52     UIMediumTarget()
    53         : type(UIMediumTargetType_WithID)
    54         , name(QString()), port(0), device(0), mediumType(UIMediumType_Invalid)
    55         , data(QString())
     51    /** Medium-target constructor. */
     52    UIMediumTarget(const QString &strName = QString(), LONG iPort = 0, LONG iDevice = 0,
     53                   UIMediumType aMediumType = UIMediumType_Invalid,
     54                   UIMediumTargetType aType = UIMediumTargetType_WithID, const QString &strData = QString())
     55        : name(strName), port(iPort), device(iDevice)
     56        , mediumType(aMediumType)
     57        , type(aType), data(strData)
    5658    {}
    57 
    58     /** Unmount medium-target constructor. */
    59     UIMediumTarget(const QString &strName, LONG iPort, LONG iDevice)
    60         : type(UIMediumTargetType_WithID)
    61         , name(strName), port(iPort), device(iDevice), mediumType(UIMediumType_Invalid)
    62         , data(QString())
    63     {}
    64 
    65     /** Open medium-target constructor. */
    66     UIMediumTarget(const QString &strName, LONG iPort, LONG iDevice, UIMediumType otherMediumType)
    67         : type(UIMediumTargetType_WithID)
    68         , name(strName), port(iPort), device(iDevice), mediumType(otherMediumType)
    69         , data(QString())
    70     {}
    71 
    72     /** Predefined medium-target constructor. */
    73     UIMediumTarget(const QString &strName, LONG iPort, LONG iDevice, const QString &strID)
    74         : type(UIMediumTargetType_WithID)
    75         , name(strName), port(iPort), device(iDevice), mediumType(UIMediumType_Invalid)
    76         , data(strID)
    77     {}
    78 
    79     /** Recent medium-target constructor. */
    80     UIMediumTarget(const QString &strName, LONG iPort, LONG iDevice, UIMediumType otherMediumType, const QString &strLocation)
    81         : type(UIMediumTargetType_WithLocation)
    82         , name(strName), port(iPort), device(iDevice), mediumType(otherMediumType)
    83         , data(strLocation)
    84     {}
    85 
    86     /** Determines medium-target type. */
    87     UIMediumTargetType type;
    8859
    8960    /** Determines controller name. */
     
    9768    UIMediumType mediumType;
    9869
     70    /** Determines medium-target type. */
     71    UIMediumTargetType type;
    9972    /** Depending on medium-target type holds <i>ID</i> or <i>location</i>. */
    10073    QString data;
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