VirtualBox

Changeset 49581 in vbox


Ignore:
Timestamp:
Nov 20, 2013 12:20:31 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Medium Manager: Cleanup some unused stuff, few coding-style fixes.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r49553 r49581  
    6060
    6161    /* Medium-item type: */
    62     enum { MediaItemType = QTreeWidgetItem::UserType + 1 };
     62    enum { Type = QTreeWidgetItem::UserType + 1 };
    6363
    6464    /* Constructor: Top-level item: */
    6565    UIMediumItem(const UIMedium &medium, QTreeWidget *pParent)
    66         : QTreeWidgetItem(pParent, MediaItemType)
     66        : QTreeWidgetItem(pParent, Type)
    6767        , m_medium(medium)
    6868    { refresh(); }
     
    7070    /* Constructor: Child item: */
    7171    UIMediumItem(const UIMedium &medium, UIMediumItem *pParent)
    72         : QTreeWidgetItem(pParent, MediaItemType)
     72        : QTreeWidgetItem(pParent, Type)
    7373        , m_medium(medium)
    7474    { refresh(); }
     
    8989    }
    9090
    91     /* API: Type stuff: */
    92     UIMediumType type() const { return m_medium.type(); }
     91    /* API: Medium-type stuff: */
     92    UIMediumType mediumType() const { return m_medium.type(); }
    9393
    9494    /* API: State stuff: */
     
    146146
    147147
    148 /* Medium-item: */
     148/* Medium-item iterator: */
    149149class UIMediumItemIterator : public QTreeWidgetItemIterator
    150150{
     
    157157    {
    158158        QTreeWidgetItem *pItem = QTreeWidgetItemIterator::operator*();
    159         return pItem && pItem->type() == UIMediumItem::MediaItemType ?
     159        return pItem && pItem->type() == UIMediumItem::Type ?
    160160            static_cast<UIMediumItem*>(pItem) : 0;
    161161    }
     
    264264void UIMediumManager::refreshAll()
    265265{
    266     // TODO (Planned to 4.3.release by Dsen)
    267     // Currently we just restarting medium-enumeration which is *very* expensive.
    268     // To make it proper way, we have to invalidate mediums which were known as *related*
    269     // to machine who's event called for *full-refresh* and start medium-enumeration.
    270     // But medium-enumeration itself should update *only* invalidated mediums.
    271266    vboxGlobal().startMediumEnumeration();
    272267}
     
    522517    QString strMediumID = pMediumItem->id();
    523518    AssertReturnVoid(!strMediumID.isNull());
    524     UIMediumType type = pMediumItem->type();
     519    UIMediumType type = pMediumItem->mediumType();
    525520
    526521    /* Confirm medium removal: */
     
    752747        /* Show context menu: */
    753748        m_pContextMenu->exec(pTree->viewport()->mapToGlobal(position));
    754     }
    755 }
    756 
    757 void UIMediumManager::sltHandleMachineStateChanged(QString, KMachineState state)
    758 {
    759     switch (state)
    760     {
    761         case KMachineState_PoweredOff:
    762         case KMachineState_Aborted:
    763         case KMachineState_Saved:
    764         case KMachineState_Teleported:
    765         case KMachineState_Starting:
    766         case KMachineState_Restoring:
    767         case KMachineState_TeleportingIn:
    768         {
    769             refreshAll();
    770             break;
    771         }
    772         default:
    773             break;
    774749    }
    775750}
     
    14871462{
    14881463    /* Return UIMediumItem based on QTreeWidgetItem if it is valid: */
    1489     if (pItem && pItem->type() == UIMediumItem::MediaItemType)
     1464    if (pItem && pItem->type() == UIMediumItem::Type)
    14901465        return static_cast<UIMediumItem*>(pItem);
    14911466    /* Null by default: */
     
    15191494    /* Prepare medium-item: */
    15201495    UIMediumItem *pMediumItem = 0;
    1521     CMedium parent = medium.medium().GetParent();
    15221496
    15231497    /* First try to create item under corresponding parent: */
    1524     if (!parent.isNull())
    1525         if (UIMediumItem *pRoot = searchItem(pTree, parent.GetId()))
     1498    if (medium.parentID() != UIMedium::nullID())
     1499        if (UIMediumItem *pRoot = searchItem(pTree, medium.parentID()))
    15261500            pMediumItem = new UIMediumItem(medium, pRoot);
    15271501    /* Else just create item as top-level one: */
     
    15421516    const QIcon *pIcon = 0;
    15431517    bool *pfInaccessible = 0;
    1544     switch (pMediumItem->type())
     1518    switch (pMediumItem->mediumType())
    15451519    {
    15461520        case UIMediumType_HardDisk:
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r49553 r49581  
    8484    void sltHandleDoubleClick();
    8585    void sltHandleContextMenuCall(const QPoint &position);
    86 
    87     /* Handler: Machine stuff: */
    88     void sltHandleMachineStateChanged(QString strId, KMachineState state);
    8986
    9087    /* Handlers: Geometry stuff:  */
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