VirtualBox

Changeset 83179 in vbox


Ignore:
Timestamp:
Feb 28, 2020 3:29:09 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Details pane: Rework set build procedure to allow to build certain details types only; This is required since cloud VMs have different set of details elements than local VMs.

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

Legend:

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

    r83149 r83179  
    4343    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
    4444    , m_pBuildStep(0)
    45     , m_iLastStepNumber(-1)
    4645{
    4746    /* Add set to the parent group: */
     
    7372    m_settings = settings;
    7473
    75     /* Cleanup superfluous items: */
    76     if (   !m_fHasDetails
    77         || !m_fIsLocal
    78         || !m_fFullSet)
    79     {
    80         int iFirstItem = !m_fHasDetails
    81                        ? DetailsElementType_General
    82                        : !m_fIsLocal
    83                        ? DetailsElementType_Preview
    84                        : DetailsElementType_Display;
    85         int iLastItem = DetailsElementType_Description;
    86         bool fCleanupPerformed = false;
    87         for (int i = iFirstItem; i <= iLastItem; ++i)
    88             if (m_elements.contains(i))
     74    /* Prepare a list of types to build: */
     75    QList<DetailsElementType> types;
     76
     77    /* Make sure we have details: */
     78    if (m_fHasDetails)
     79    {
     80        /* Special handling wrt item type: */
     81        switch (m_pMachineItem->itemType())
     82        {
     83            case UIVirtualMachineItem::ItemType_Local:
    8984            {
    90                 delete m_elements[i];
    91                 fCleanupPerformed = true;
     85                /* Get local machine: */
     86                m_machine = m_pMachineItem->toLocal()->machine();
     87
     88                /* Compose a list of types to build: */
     89                if (m_fFullSet)
     90                    types << DetailsElementType_General << DetailsElementType_System << DetailsElementType_Preview
     91                          << DetailsElementType_Display << DetailsElementType_Storage << DetailsElementType_Audio
     92                          << DetailsElementType_Network << DetailsElementType_Serial << DetailsElementType_USB
     93                          << DetailsElementType_SF << DetailsElementType_UI << DetailsElementType_Description;
     94                else
     95                    types << DetailsElementType_General << DetailsElementType_System << DetailsElementType_Preview;
     96
     97                /* Take into account USB controller restrictions: */
     98                const CUSBDeviceFilters &filters = m_machine.GetUSBDeviceFilters();
     99                if (filters.isNull() || !m_machine.GetUSBProxyAvailable())
     100                    m_settings.remove(DetailsElementType_USB);
     101
     102                break;
    92103            }
    93         if (fCleanupPerformed)
    94             updateGeometry();
    95     }
    96 
    97     /* Make sure we have details: */
    98     if (!m_fHasDetails)
    99     {
    100         /* Reset last-step number: */
    101         m_iLastStepNumber = -1;
    102         /* Notify parent group we are built: */
     104            case UIVirtualMachineItem::ItemType_CloudReal:
     105            {
     106                /* Get cloud machine: */
     107                m_cloudMachine = m_pMachineItem->toCloud()->machine();
     108
     109                /* Compose a list of types to build: */
     110                types << DetailsElementType_General << DetailsElementType_System;
     111
     112                break;
     113            }
     114            default:
     115                break;
     116        }
     117    }
     118
     119    /* Cleanup if new types differs from old: */
     120    if (m_types != types)
     121    {
     122        qDeleteAll(m_elements);
     123        m_elements.clear();
     124        updateGeometry();
     125    }
     126
     127    /* Remember new types: */
     128    m_types = types;
     129
     130    /* Build or emit fake signal: */
     131    if (m_fHasDetails)
     132        rebuildSet();
     133    else
    103134        emit sigBuildDone();
    104         return;
    105     }
    106 
    107     /* Special handling wrt item type: */
    108     switch (m_pMachineItem->itemType())
    109     {
    110         case UIVirtualMachineItem::ItemType_Local:
    111         {
    112             /* Get local machine: */
    113             m_machine = m_pMachineItem->toLocal()->machine();
    114 
    115             /* Choose last-step number: */
    116             m_iLastStepNumber = m_fFullSet ? DetailsElementType_Description : DetailsElementType_Preview;
    117 
    118             /* Fetch USB controller restrictions: */
    119             const CUSBDeviceFilters &filters = m_machine.GetUSBDeviceFilters();
    120             if (filters.isNull() || !m_machine.GetUSBProxyAvailable())
    121                 m_settings.remove(DetailsElementType_USB);
    122 
    123             break;
    124         }
    125         case UIVirtualMachineItem::ItemType_CloudReal:
    126         {
    127             /* Get cloud machine: */
    128             m_cloudMachine = m_pMachineItem->toCloud()->machine();
    129 
    130             /* Choose last-step number: */
    131             m_iLastStepNumber = DetailsElementType_System;
    132 
    133             break;
    134         }
    135         default:
    136             break;
    137     }
    138 
    139     /* Start building set: */
    140     rebuildSet();
    141135}
    142136
     
    152146
    153147    /* Step number feats the bounds: */
    154     if (iStepNumber >= 0 && iStepNumber <= m_iLastStepNumber)
     148    if (iStepNumber >= 0 && iStepNumber < m_types.size())
    155149    {
    156150        /* Load details settings: */
    157         DetailsElementType enmElementType = (DetailsElementType)iStepNumber;
     151        const DetailsElementType enmElementType = m_types.at(iStepNumber);
    158152        /* Should the element be visible? */
    159153        bool fVisible = m_settings.contains(enmElementType);
     
    646640
    647641    /* Request to build first step: */
    648     emit sigBuildStep(m_uSetId, DetailsElementType_General);
     642    emit sigBuildStep(m_uSetId, 0);
    649643}
    650644
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.h

    r83149 r83179  
    7878      * @{ */
    7979        /** Handles request about starting step build.
    80           * @param  uStepId    Brings the step ID.
     80          * @param  uStepId      Brings the step ID.
    8181          * @param  iStepNumber  Brings the step number. */
    8282        virtual void sltBuildStep(const QUuid &uStepId, int iStepNumber) /* override */;
     
    216216
    217217        /** Holds the build step instance. */
    218         UIPrepareStep *m_pBuildStep;
    219         /** Holds the last step number. */
    220         int            m_iLastStepNumber;
     218        UIPrepareStep             *m_pBuildStep;
     219        /** Holds the list of types to build steps for. */
     220        QList<DetailsElementType>  m_types;
    221221        /** Holds the generated set ID. */
    222         QUuid          m_uSetId;
     222        QUuid                      m_uSetId;
    223223    /** @} */
    224224
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