- Timestamp:
- Dec 10, 2024 11:07:35 AM (5 months ago)
- svn:sync-xref-src-repo-rev:
- 166296
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r107266 r107275 112 112 } 113 113 114 bool UIVirtualBoxManagerWidget::isItemAccessible(UIVirtualMachineItem *pItem /* = 0 */) const 115 { 116 if (!pItem) 117 pItem = currentItem(); 118 return pItem && pItem->accessible(); 119 } 120 114 121 bool UIVirtualBoxManagerWidget::isGroupItemSelected() const 115 122 { … … 160 167 { 161 168 return m_pPaneChooser->isAllItemsOfOneGroupSelected(); 169 } 170 171 UIVirtualBoxManagerWidget::SelectionType UIVirtualBoxManagerWidget::selectionType() const 172 { 173 return isSingleLocalGroupSelected() 174 ? SelectionType_SingleLocalGroupItem 175 : isSingleCloudProviderGroupSelected() || isSingleCloudProfileGroupSelected() 176 ? SelectionType_SingleCloudGroupItem 177 : isGlobalItemSelected() 178 ? SelectionType_FirstIsGlobalItem 179 : isLocalMachineItemSelected() 180 ? SelectionType_FirstIsLocalMachineItem 181 : isCloudMachineItemSelected() 182 ? SelectionType_FirstIsCloudMachineItem 183 : SelectionType_Invalid; 162 184 } 163 185 … … 476 498 recacheCurrentMachineItemInformation(); 477 499 478 /* Calculate selection type: */ 479 const SelectionType enmSelectedItemType = isSingleLocalGroupSelected() 480 ? SelectionType_SingleLocalGroupItem 481 : isSingleCloudProviderGroupSelected() || isSingleCloudProfileGroupSelected() 482 ? SelectionType_SingleCloudGroupItem 483 : isGlobalItemSelected() 484 ? SelectionType_FirstIsGlobalItem 485 : isLocalMachineItemSelected() 486 ? SelectionType_FirstIsLocalMachineItem 487 : isCloudMachineItemSelected() 488 ? SelectionType_FirstIsCloudMachineItem 489 : SelectionType_Invalid; 490 491 /* Update toolbar if selection type or item accessibility got changed: */ 492 const bool fCurrentItemIsOk = pItem && pItem->accessible(); 500 /* Calculate new selection type: */ 501 const SelectionType enmSelectedItemType = selectionType(); 502 /* Calculate new item accessibility status: */ 503 const bool fCurrentItemIsOk = isItemAccessible(); 504 505 /* Update toolbar if selection type or item accessibility status got changed: */ 493 506 if ( m_enmSelectionType != enmSelectedItemType 494 507 || m_fSelectedMachineItemAccessible != fCurrentItemIsOk) 495 508 updateToolbar(); 496 509 497 /* Remember the last selection type: */510 /* Remember selection type and item accessibility status: */ 498 511 m_enmSelectionType = enmSelectedItemType; 499 /* Remember whether the last selected item was accessible: */500 512 m_fSelectedMachineItemAccessible = fCurrentItemIsOk; 501 513 } … … 544 556 /* Acquire current item: */ 545 557 UIVirtualMachineItem *pItem = currentItem(); 546 const bool fCurrentItemIsOk = pItem && pItem->accessible();558 const bool fCurrentItemIsOk = isItemAccessible(pItem); 547 559 548 560 /* If current item is Ok: */ … … 1139 1151 /* Get current item: */ 1140 1152 UIVirtualMachineItem *pItem = currentItem(); 1141 const bool fCurrentItemIsOk = pItem && pItem->accessible();1153 const bool fCurrentItemIsOk = isItemAccessible(pItem); 1142 1154 1143 1155 /* If current item is Ok: */ … … 1185 1197 { 1186 1198 /* Get current item state: */ 1187 const bool fCurrentItemIsOk = pItem && pItem->accessible();1199 const bool fCurrentItemIsOk = isItemAccessible(pItem); 1188 1200 1189 1201 /* Update machine tools restrictions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r107266 r107275 155 155 QList<UIVirtualMachineItem*> currentItems() const; 156 156 157 /** Returns whether passed @a pItem accessible, by default it's the current one. */ 158 bool isItemAccessible(UIVirtualMachineItem *pItem = 0) const; 159 157 160 /** Returns whether group item is selected. */ 158 161 bool isGroupItemSelected() const; … … 176 179 /** Returns whether all items of one group are selected. */ 177 180 bool isAllItemsOfOneGroupSelected() const; 181 182 /** Returns current selection type. */ 183 SelectionType selectionType() const; 178 184 179 185 /** Returns full name of currently selected group. */
Note:
See TracChangeset
for help on using the changeset viewer.