Changeset 108277 in vbox
- Timestamp:
- Feb 18, 2025 12:56:35 PM (3 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167605
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIGlobalToolsManagerWidget.cpp
r108272 r108277 76 76 { 77 77 AssertPtrReturn(toolMenu(), UIToolType_Invalid); 78 return toolMenu()->toolsType( );78 return toolMenu()->toolsType(UIToolClass_Global); 79 79 } 80 80 … … 180 180 /* On any VM registered switch from Home to Machines: */ 181 181 AssertPtrReturnVoid(toolMenu()); 182 if (fRegistered && toolMenu()->toolsType( ) == UIToolType_Home)182 if (fRegistered && toolMenu()->toolsType(UIToolClass_Global) == UIToolType_Home) 183 183 setMenuToolType(UIToolType_Machines); 184 184 } … … 288 288 { 289 289 /* Open tool last chosen in tools-menu: */ 290 switchToolTo(toolMenu()->toolsType( ));290 switchToolTo(toolMenu()->toolsType(UIToolClass_Global)); 291 291 292 292 /* Update tools restrictions: */ … … 346 346 347 347 /* Make sure no restricted tool is selected: */ 348 if (restrictedTypes.contains(toolMenu()->toolsType( )))348 if (restrictedTypes.contains(toolMenu()->toolsType(UIToolClass_Global))) 349 349 setMenuToolType(UIToolType_Home); 350 350 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIMachineToolsManagerWidget.cpp
r108173 r108277 139 139 { 140 140 AssertPtrReturn(toolMenu(), UIToolType_Invalid); 141 return toolMenu()->toolsType( );141 return toolMenu()->toolsType(UIToolClass_Machine); 142 142 } 143 143 … … 310 310 /* If Error-pane is chosen currently => switch to tool currently chosen in tools-menu: */ 311 311 if (toolPane()->currentTool() == UIToolType_Error) 312 switchToolTo(toolMenu()->toolsType( ));312 switchToolTo(toolMenu()->toolsType(UIToolClass_Machine)); 313 313 314 314 /* If we still have same item selected: */ … … 496 496 497 497 /* Open tool last chosen in tools-menu: */ 498 switchToolTo(toolMenu()->toolsType( ));498 switchToolTo(toolMenu()->toolsType(UIToolClass_Machine)); 499 499 } 500 500 … … 554 554 /* If Error-pane is chosen currently => switch to tool currently chosen in tools-menu: */ 555 555 if (toolPane()->currentTool() == UIToolType_Error) 556 switchToolTo(toolMenu()->toolsType( ));556 switchToolTo(toolMenu()->toolsType(UIToolClass_Machine)); 557 557 558 558 /* Propagate current items to the Tools pane: */ … … 586 586 << UIToolType_Logs 587 587 << UIToolType_FileManager; 588 if (restrictedTypes.contains(toolMenu()->toolsType( )))588 if (restrictedTypes.contains(toolMenu()->toolsType(UIToolClass_Machine))) 589 589 toolMenu()->setToolsType(UIToolType_Details); 590 590 const QList restrictions(restrictedTypes.begin(), restrictedTypes.end()); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.cpp
r108214 r108277 63 63 } 64 64 65 UIToolType UITools::toolsType( ) const65 UIToolType UITools::toolsType(UIToolClass enmClass) const 66 66 { 67 return m_pToolsModel->toolsType( );67 return m_pToolsModel->toolsType(enmClass); 68 68 } 69 69 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.h
r108214 r108277 75 75 /** Defines current tools @a enmType. */ 76 76 void setToolsType(UIToolType enmType); 77 /** Returns current tools type . */78 UIToolType toolsType( ) const;77 /** Returns current tools type for the @a enmClass specified. */ 78 UIToolType toolsType(UIToolClass enmClass) const; 79 79 80 80 /** Defines whether tool items @a fEnabled. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r108213 r108277 164 164 165 165 /* Compose the state of current item: */ 166 if (item() && item() == item()->model()->currentItem( ))166 if (item() && item() == item()->model()->currentItem(item()->itemClass())) 167 167 { 168 168 state.active = true; … … 545 545 { 546 546 /* If that item is current: */ 547 if (model()->currentItem( ) == this)547 if (model()->currentItem(itemClass()) == this) 548 548 { 549 549 /* Unset the current item: */ … … 625 625 { 626 626 /* Selection background: */ 627 if (model()->currentItem( ) == this)627 if (model()->currentItem(itemClass()) == this) 628 628 { 629 629 /* Prepare color: */ … … 720 720 { 721 721 /* Selection background: */ 722 if (model()->currentItem( ) == this)722 if (model()->currentItem(itemClass()) == this) 723 723 { 724 724 /* Acquire token color: */ … … 823 823 824 824 /* Selection frame: */ 825 if (model()->currentItem( ) == this)825 if (model()->currentItem(itemClass()) == this) 826 826 strokeColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(m_iHighlightLightnessStart - 40); 827 827 /* Hovering frame: */ … … 857 857 /* Selected or hovered item foreground for popup mode: */ 858 858 if ( model()->isPopup() 859 && (model()->currentItem( ) == this || isHovered()))859 && (model()->currentItem(itemClass()) == this || isHovered())) 860 860 { 861 861 /* Get background color: */ 862 862 const QColor highlight = pal.color(QPalette::Active, QPalette::Highlight); 863 const QColor background = model()->currentItem( ) == this863 const QColor background = model()->currentItem(itemClass()) == this 864 864 ? highlight.lighter(m_iHighlightLightnessStart) 865 865 : highlight.lighter(m_iHoverLightnessStart); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r108276 r108277 108 108 void UIToolsModel::setToolsType(UIToolType enmType) 109 109 { 110 if (!currentItem() || currentItem()->itemType() != enmType) 110 const UIToolClass enmClass = UIToolStuff::castTypeToClass(enmType); 111 if (!currentItem(enmClass) || currentItem(enmClass)->itemType() != enmType) 111 112 setCurrentItem(item(enmType)); 112 113 } 113 114 114 UIToolType UIToolsModel::toolsType( ) const115 { 116 return currentItem( ) ? currentItem()->itemType() : UIToolType_Invalid;115 UIToolType UIToolsModel::toolsType(UIToolClass enmClass) const 116 { 117 return currentItem(enmClass) ? currentItem(enmClass)->itemType() : UIToolType_Invalid; 117 118 } 118 119 … … 160 161 void UIToolsModel::setCurrentItem(UIToolsItem *pItem) 161 162 { 162 /* Is there something changed? */ 163 if (m_pCurrentItem == pItem) 164 return; 165 166 /* Remember old current-item: */ 167 UIToolsItem *pOldCurrentItem = m_pCurrentItem; 168 169 /* Update current item: */ 170 m_pCurrentItem = pItem; 171 172 /* Update old item (if any): */ 173 if (pOldCurrentItem) 174 pOldCurrentItem->update(); 175 /* Update new item (if any): */ 176 if (m_pCurrentItem) 177 m_pCurrentItem->update(); 178 179 /* Notify about selection change: */ 180 emit sigSelectionChanged(toolsType()); 181 } 182 183 UIToolsItem *UIToolsModel::currentItem() const 184 { 185 return m_pCurrentItem; 163 /* Valid item passed? */ 164 if (pItem) 165 { 166 /* What's the item class? */ 167 const UIToolClass enmClass = pItem->itemClass(); 168 169 /* Is there something changed? */ 170 if (m_mapCurrentItems.value(enmClass) == pItem) 171 return; 172 173 /* Remember old current-item: */ 174 UIToolsItem *pOldCurrentItem = m_mapCurrentItems.value(enmClass); 175 /* Set new item as current: */ 176 m_mapCurrentItems[enmClass] = pItem; 177 178 /* Update old item (if any): */ 179 if (pOldCurrentItem) 180 pOldCurrentItem->update(); 181 /* Update new item: */ 182 m_mapCurrentItems.value(enmClass)->update(); 183 184 /* Notify about selection change: */ 185 emit sigSelectionChanged(toolsType(enmClass)); 186 } 187 /* Null item passed? */ 188 else 189 { 190 /* Is there something changed? */ 191 if ( !m_mapCurrentItems.value(UIToolClass_Global) 192 && !m_mapCurrentItems.value(UIToolClass_Machine)) 193 return; 194 195 /* Clear all current items: */ 196 m_mapCurrentItems[UIToolClass_Global] = 0; 197 m_mapCurrentItems[UIToolClass_Machine] = 0; 198 199 /* Notify about selection change: */ 200 emit sigSelectionChanged(UIToolType_Invalid); 201 } 202 } 203 204 UIToolsItem *UIToolsModel::currentItem(UIToolClass enmClass) const 205 { 206 return m_mapCurrentItems.value(enmClass); 186 207 } 187 208 … … 541 562 542 563 /* Assign values depending on model class: */ 543 if (m_enmClass == UIToolClass_Global) 564 if ( m_enmClass == UIToolClass_Global 565 || m_enmClass == UIToolClass_Invalid) 544 566 { 545 567 UIToolsItem *pItem = item(enmTypeGlobal); … … 548 570 setCurrentItem(pItem); 549 571 } 550 else if (m_enmClass == UIToolClass_Machine) 572 if ( m_enmClass == UIToolClass_Machine 573 || m_enmClass == UIToolClass_Invalid) 551 574 { 552 575 UIToolsItem *pItem = item(enmTypeMachine); … … 564 587 565 588 /* Update values depending on model class: */ 566 if (currentItem()) 567 { 568 if (m_enmClass == UIToolClass_Global) 569 enmTypeGlobal = currentItem()->itemType(); 570 else if (m_enmClass == UIToolClass_Machine) 571 enmTypeMachine = currentItem()->itemType(); 589 if ( m_enmClass == UIToolClass_Global 590 || m_enmClass == UIToolClass_Invalid) 591 { 592 if (UIToolsItem *pItem = currentItem(UIToolClass_Global)) 593 enmTypeGlobal = pItem->itemType(); 594 } 595 if ( m_enmClass == UIToolClass_Machine 596 || m_enmClass == UIToolClass_Invalid) 597 { 598 if (UIToolsItem *pItem = currentItem(UIToolClass_Machine)) 599 enmTypeMachine = pItem->itemType(); 572 600 } 573 601 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r108266 r108277 111 111 /** Defines current tools @a enmType. */ 112 112 void setToolsType(UIToolType enmType); 113 /** Returns current tools type . */114 UIToolType toolsType( ) const;113 /** Returns current tools type for the @a enmClass specified. */ 114 UIToolType toolsType(UIToolClass enmClass) const; 115 115 116 116 /** Defines whether tool items @a fEnabled.*/ … … 144 144 /** Defines current @a pItem. */ 145 145 void setCurrentItem(UIToolsItem *pItem); 146 /** Returns current item . */147 UIToolsItem *currentItem( ) const;146 /** Returns current item for the @a enmClass specified. */ 147 UIToolsItem *currentItem(UIToolClass enmClass) const; 148 148 /** @} */ 149 149 … … 267 267 /** @name Selection stuff. 268 268 * @{ */ 269 /** Holds the selected item reference. */270 Q Pointer<UIToolsItem> m_pCurrentItem;269 /** Holds the selected item map reference. */ 270 QMap<UIToolClass, QPointer<UIToolsItem> > m_mapCurrentItems; 271 271 /** @} */ 272 272
Note:
See TracChangeset
for help on using the changeset viewer.