VirtualBox

Ignore:
Timestamp:
Mar 5, 2014 11:51:38 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Medium Manager rework/cleanup: Reusing enum stuff.

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

Legend:

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

    r50697 r50700  
    323323
    324324    /* Reset tab-widget icons: */
    325     mTabWidget->setTabIcon(HDTab, m_iconHD);
    326     mTabWidget->setTabIcon(CDTab, m_iconCD);
    327     mTabWidget->setTabIcon(FDTab, m_iconFD);
     325    mTabWidget->setTabIcon(TabIndex_HD, m_iconHD);
     326    mTabWidget->setTabIcon(TabIndex_CD, m_iconCD);
     327    mTabWidget->setTabIcon(TabIndex_FD, m_iconFD);
    328328
    329329    /* Repopulate tree-widgets content: */
     
    841841        /* Configure tab-widget: */
    842842        mTabWidget->setFocusPolicy(Qt::TabFocus);
    843         mTabWidget->setTabIcon(HDTab, m_iconHD);
    844         mTabWidget->setTabIcon(CDTab, m_iconCD);
    845         mTabWidget->setTabIcon(FDTab, m_iconFD);
     843        mTabWidget->setTabIcon(TabIndex_HD, m_iconHD);
     844        mTabWidget->setTabIcon(TabIndex_CD, m_iconCD);
     845        mTabWidget->setTabIcon(TabIndex_FD, m_iconFD);
    846846        connect(mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandleCurrentTabChanged()));
    847847    }
     
    10671067}
    10681068
    1069 void UIMediumManager::updateTabIcons(UIMediumItem *pMediumItem, ItemAction action)
     1069void UIMediumManager::updateTabIcons(UIMediumItem *pMediumItem, Action action)
    10701070{
    10711071    /* Make sure medium-item is valid: */
     
    10791079    {
    10801080        case UIMediumType_HardDisk:
    1081             iTab = HDTab;
     1081            iTab = TabIndex_HD;
    10821082            pIcon = &m_iconHD;
    10831083            pfInaccessible = &m_fInaccessibleHD;
    10841084            break;
    10851085        case UIMediumType_DVD:
    1086             iTab = CDTab;
     1086            iTab = TabIndex_CD;
    10871087            pIcon = &m_iconCD;
    10881088            pfInaccessible = &m_fInaccessibleCD;
    10891089            break;
    10901090        case UIMediumType_Floppy:
    1091             iTab = FDTab;
     1091            iTab = TabIndex_FD;
    10921092            pIcon = &m_iconFD;
    10931093            pfInaccessible = &m_fInaccessibleFD;
     
    11001100    switch (action)
    11011101    {
    1102         case ItemAction_Added:
     1102        case Action_Add:
    11031103        {
    11041104            /* Does it change the overall state? */
     
    11121112            break;
    11131113        }
    1114         case ItemAction_Updated:
    1115         case ItemAction_Removed:
     1114        case Action_Edit:
     1115        case Action_Remove:
    11161116        {
    11171117            bool fCheckRest = false;
    11181118
    1119             if (action == ItemAction_Updated)
     1119            if (action == Action_Edit)
    11201120            {
    11211121                /* Does it change the overall state? */
     
    14091409
    14101410    /* Update tab-icons: */
    1411     updateTabIcons(pMediumItem, ItemAction_Added);
     1411    updateTabIcons(pMediumItem, Action_Add);
    14121412
    14131413    /* If medium-enumeration is not currently in progress or
     
    14401440
    14411441    /* Update tab-icons: */
    1442     updateTabIcons(pMediumItem, ItemAction_Updated);
     1442    updateTabIcons(pMediumItem, Action_Edit);
    14431443
    14441444    /* Re-fetch medium-item if it is current one updated: */
     
    14691469
    14701470    /* Update tab-icons: */
    1471     updateTabIcons(pMediumItem, ItemAction_Removed);
     1471    updateTabIcons(pMediumItem, Action_Remove);
    14721472
    14731473    /* Delete medium-item: */
     
    16401640    switch (mTabWidget->currentIndex())
    16411641    {
    1642         case HDTab: return UIMediumType_HardDisk;
    1643         case CDTab: return UIMediumType_DVD;
    1644         case FDTab: return UIMediumType_Floppy;
     1642        case TabIndex_HD: return UIMediumType_HardDisk;
     1643        case TabIndex_CD: return UIMediumType_DVD;
     1644        case TabIndex_FD: return UIMediumType_Floppy;
    16451645        default: AssertMsgFailed(("Unknown page type: %d\n", mTabWidget->currentIndex())); break;
    16461646    }
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r50368 r50700  
    5050    Q_OBJECT;
    5151
    52     /* Enumerators: */
    53     enum TabIndex { HDTab = 0, CDTab, FDTab };
    54     enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
    55     enum Action { Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
     52    /** Tab index enumerator. */
     53    enum TabIndex { TabIndex_HD = 0, TabIndex_CD, TabIndex_FD };
     54
     55    /** Item action enumerator. */
     56    enum Action { Action_Add, Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
    5657
    5758    /* Constructor/destructor: */
     
    129130    void updateActions();
    130131    /** Update tab icons according last @a action happened with @a pItem. */
    131     void updateTabIcons(UIMediumItem *pItem, ItemAction action);
     132    void updateTabIcons(UIMediumItem *pItem, Action action);
    132133    /** Update information pane of passed medium @a type. */
    133134    void updateInformationPanes(UIMediumType type = UIMediumType_Invalid);
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