Changeset 43444 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 27, 2012 7:18:12 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r43424 r43444 796 796 797 797 /* Determine which menu to show: */ 798 m_pGroupMenuAction->setVisible(m_pChooser-> singleGroupSelected());799 m_pMachineMenuAction->setVisible(!m_pChooser-> singleGroupSelected());798 m_pGroupMenuAction->setVisible(m_pChooser->isSingleGroupSelected()); 799 m_pMachineMenuAction->setVisible(!m_pChooser->isSingleGroupSelected()); 800 800 if (m_pGroupMenuAction->isVisible()) 801 801 { … … 832 832 /* Always hide snapshots-view if 833 833 * single group or more than one machine is selected: */ 834 if (currentItems().size() > 1 || m_pChooser-> singleGroupSelected())834 if (currentItems().size() > 1 || m_pChooser->isSingleGroupSelected()) 835 835 m_pVMDesktop->lockSnapshots(); 836 836 } … … 1678 1678 { 1679 1679 return !m_pChooser->isGroupSavingInProgress() && 1680 m_pChooser-> singleGroupSelected();1680 m_pChooser->isSingleGroupSelected(); 1681 1681 } 1682 1682 case UIActionIndexSelector_Simple_Machine_Settings: … … 1701 1701 { 1702 1702 return !m_pChooser->isGroupSavingInProgress() && 1703 !m_pChooser->isAllItemsOfOneGroupSelected() && 1703 1704 isItemsPoweredOff(items); 1704 1705 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp
r43005 r43444 95 95 } 96 96 97 bool UIGChooser:: singleGroupSelected() const97 bool UIGChooser::isSingleGroupSelected() const 98 98 { 99 return m_pChooserModel->singleGroupSelected(); 99 return m_pChooserModel->isSingleGroupSelected(); 100 } 101 102 bool UIGChooser::isAllItemsOfOneGroupSelected() const 103 { 104 return m_pChooserModel->isAllItemsOfOneGroupSelected(); 100 105 } 101 106 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.h
r43005 r43444 63 63 UIVMItem* currentItem() const; 64 64 QList<UIVMItem*> currentItems() const; 65 bool singleGroupSelected() const; 65 bool isSingleGroupSelected() const; 66 bool isAllItemsOfOneGroupSelected() const; 66 67 67 68 /* API: Status bar stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r43424 r43444 346 346 } 347 347 348 bool UIGChooserModel:: singleGroupSelected() const348 bool UIGChooserModel::isSingleGroupSelected() const 349 349 { 350 350 return selectionList().size() == 1 && 351 351 selectionList().first()->type() == UIGChooserItemType_Group; 352 } 353 354 bool UIGChooserModel::isAllItemsOfOneGroupSelected() const 355 { 356 /* Make sure at least on item selected: */ 357 if (selectionList().isEmpty()) 358 return false; 359 360 /* Determine the parent group of the first item: */ 361 UIGChooserItem *pFirstParent = selectionList().first()->parentItem(); 362 363 /* Make sure this parent is not main root item: */ 364 if (pFirstParent == mainRoot()) 365 return false; 366 367 /* Enumerate selected set: */ 368 QSet<UIGChooserItem*> selectedSet; 369 foreach (UIGChooserItem *pSelectedItem, selectionList()) 370 selectedSet << pSelectedItem; 371 372 /* Enumerate first parent children set: */ 373 QSet<UIGChooserItem*> firstParentSet; 374 foreach (UIGChooserItem *pSelectedItem, pFirstParent->items()) 375 firstParentSet << pSelectedItem; 376 377 /* Check if both sets contains the same: */ 378 return selectedSet == firstParentSet; 352 379 } 353 380 … … 885 912 886 913 /* Only for single selected group: */ 887 if (! singleGroupSelected())914 if (!isSingleGroupSelected()) 888 915 return; 889 916 … … 895 922 { 896 923 UIGChooserItem *pGroup = 0; 897 if ( singleGroupSelected())924 if (isSingleGroupSelected()) 898 925 pGroup = selectionList().first(); 899 926 else if (!selectionList().isEmpty()) … … 1003 1030 void UIGChooserModel::sltSortGroup() 1004 1031 { 1005 if ( singleGroupSelected())1032 if (isSingleGroupSelected()) 1006 1033 sortItems(selectionList().first()); 1007 1034 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
r43155 r43444 118 118 void setCurrentItemDefinition(const QString &strDefinition); 119 119 QString currentItemDefinition() const; 120 bool singleGroupSelected() const; 120 bool isSingleGroupSelected() const; 121 bool isAllItemsOfOneGroupSelected() const; 121 122 122 123 /* API: Focus item stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.