Changeset 108289 in vbox
- Timestamp:
- Feb 19, 2025 12:41:58 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 167632
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIGlobalToolsManagerWidget.cpp
r108277 r108289 351 351 /* Hide restricted tools in the menu: */ 352 352 const QList restrictions(restrictedTypes.begin(), restrictedTypes.end()); 353 toolMenu()->setRestrictedToolTypes( restrictions);353 toolMenu()->setRestrictedToolTypes(UIToolClass_Global, restrictions); 354 354 355 355 /* Close all restricted tools (besides the Machines): */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIMachineToolsManagerWidget.cpp
r108277 r108289 574 574 void UIMachineToolsManagerWidget::updateToolsMenu(UIVirtualMachineItem *pItem) 575 575 { 576 /* Get current item state: */ 577 const bool fCurrentItemIsOk = isItemAccessible(pItem); 578 579 /* Update machine tools restrictions: */ 576 /* Prepare tool restrictions: */ 580 577 QSet<UIToolType> restrictedTypes; 578 579 /* Restrict some types for Basic mode: */ 581 580 const bool fExpertMode = gEDataManager->isSettingsInExpertMode(); 582 581 if (!fExpertMode) 583 582 restrictedTypes << UIToolType_FileManager; 583 584 /* Make sure local VM tools are hidden for cloud VMs: */ 584 585 if (pItem && pItem->itemType() != UIVirtualMachineItemType_Local) 585 586 restrictedTypes << UIToolType_Snapshots 586 587 << UIToolType_Logs 587 588 << UIToolType_FileManager; 589 590 /* Make sure no restricted tool is selected: */ 588 591 if (restrictedTypes.contains(toolMenu()->toolsType(UIToolClass_Machine))) 589 toolMenu()->setToolsType(UIToolType_Details); 592 setMenuToolType(UIToolType_Details); 593 594 /* Hide restricted tools in the menu: */ 590 595 const QList restrictions(restrictedTypes.begin(), restrictedTypes.end()); 591 toolMenu()->setRestrictedToolTypes(restrictions); 596 toolMenu()->setRestrictedToolTypes(UIToolClass_Machine, restrictions); 597 598 /* Disable even unrestricted tools for inacccessible VMs: */ 599 const bool fCurrentItemIsOk = isItemAccessible(pItem); 592 600 toolMenu()->setItemsEnabled(fCurrentItemIsOk); 593 601 594 /* Take restrictions into account, closingall restricted tools: */602 /* Close all restricted tools: */ 595 603 foreach (const UIToolType &enmRestrictedType, restrictedTypes) 596 604 toolPane()->closeTool(enmRestrictedType); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.cpp
r108277 r108289 78 78 } 79 79 80 void UITools::setRestrictedToolTypes( const QList<UIToolType> &types)80 void UITools::setRestrictedToolTypes(UIToolClass enmClass, const QList<UIToolType> &types) 81 81 { 82 m_pToolsModel->setRestrictedToolTypes(types); 83 } 84 85 QList<UIToolType> UITools::restrictedToolTypes() const 86 { 87 return m_pToolsModel->restrictedToolTypes(); 82 m_pToolsModel->setRestrictedToolTypes(enmClass, types); 88 83 } 89 84 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.h
r108277 r108289 83 83 bool isItemsEnabled() const; 84 84 85 /** Defines restructed tool @a types. */ 86 void setRestrictedToolTypes(const QList<UIToolType> &types); 87 /** Returns restricted tool types. */ 88 QList<UIToolType> restrictedToolTypes() const; 85 /** Defines restructed tool @a types for the @a enmClass specified. */ 86 void setRestrictedToolTypes(UIToolClass enmClass, const QList<UIToolType> &types); 89 87 /** @} */ 90 88 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r108286 r108289 132 132 } 133 133 134 void UIToolsModel::setRestrictedToolTypes( const QList<UIToolType> &types)135 { 136 if (m_ restrictedToolTypes!= types)137 { 138 m_ restrictedToolTypes= types;134 void UIToolsModel::setRestrictedToolTypes(UIToolClass enmClass, const QList<UIToolType> &types) 135 { 136 if (m_mapRestrictedToolTypes.value(enmClass) != types) 137 { 138 m_mapRestrictedToolTypes[enmClass] = types; 139 139 foreach (UIToolsItem *pItem, items()) 140 pItem->setVisible(!m_restrictedToolTypes.contains(pItem->itemType())); 140 { 141 if (pItem->itemClass() != enmClass) 142 continue; 143 const bool fRestricted = m_mapRestrictedToolTypes.value(enmClass).contains(pItem->itemType()); 144 pItem->setVisible(!fRestricted); 145 } 141 146 142 147 /* Update linked values: */ … … 145 150 sltItemMinimumHeightHintChanged(); 146 151 } 147 }148 149 QList<UIToolType> UIToolsModel::restrictedToolTypes() const150 {151 return m_restrictedToolTypes;152 152 } 153 153 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r108283 r108289 119 119 bool isItemsEnabled() const; 120 120 121 /** Defines restructed tool @a types. */ 122 void setRestrictedToolTypes(const QList<UIToolType> &types); 123 /** Returns restricted tool types. */ 124 QList<UIToolType> restrictedToolTypes() const; 121 /** Defines restructed tool @a types for the @a enmClass specified. */ 122 void setRestrictedToolTypes(UIToolClass enmClass, const QList<UIToolType> &types); 125 123 126 124 /** Asks parent to close. */ … … 243 241 244 242 /** Holds a list of restricted tool types. */ 245 Q List<UIToolType> m_restrictedToolTypes;243 QMap<UIToolClass, QList<UIToolType> > m_mapRestrictedToolTypes; 246 244 /** @} */ 247 245
Note:
See TracChangeset
for help on using the changeset viewer.