Changeset 83179 in vbox
- Timestamp:
- Feb 28, 2020 3:29:09 PM (5 years ago)
- 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 43 43 , m_configurationAccessLevel(ConfigurationAccessLevel_Null) 44 44 , m_pBuildStep(0) 45 , m_iLastStepNumber(-1)46 45 { 47 46 /* Add set to the parent group: */ … … 73 72 m_settings = settings; 74 73 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: 89 84 { 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; 92 103 } 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 103 134 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();141 135 } 142 136 … … 152 146 153 147 /* Step number feats the bounds: */ 154 if (iStepNumber >= 0 && iStepNumber < = m_iLastStepNumber)148 if (iStepNumber >= 0 && iStepNumber < m_types.size()) 155 149 { 156 150 /* Load details settings: */ 157 DetailsElementType enmElementType = (DetailsElementType)iStepNumber;151 const DetailsElementType enmElementType = m_types.at(iStepNumber); 158 152 /* Should the element be visible? */ 159 153 bool fVisible = m_settings.contains(enmElementType); … … 646 640 647 641 /* Request to build first step: */ 648 emit sigBuildStep(m_uSetId, DetailsElementType_General);642 emit sigBuildStep(m_uSetId, 0); 649 643 } 650 644 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.h
r83149 r83179 78 78 * @{ */ 79 79 /** Handles request about starting step build. 80 * @param uStepId Brings the step ID.80 * @param uStepId Brings the step ID. 81 81 * @param iStepNumber Brings the step number. */ 82 82 virtual void sltBuildStep(const QUuid &uStepId, int iStepNumber) /* override */; … … 216 216 217 217 /** Holds the build step instance. */ 218 UIPrepareStep *m_pBuildStep;219 /** Holds the l ast 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; 221 221 /** Holds the generated set ID. */ 222 QUuid m_uSetId;222 QUuid m_uSetId; 223 223 /** @} */ 224 224
Note:
See TracChangeset
for help on using the changeset viewer.