- Timestamp:
- May 25, 2020 3:56:53 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r84512 r84513 777 777 } 778 778 779 void UIVirtualBoxManager::sltPerformMachineMoveToNewGroup() 780 { 781 m_pWidget->moveMachineToNewGroup(); 782 } 783 779 784 void UIVirtualBoxManager::sltPerformStartOrShowMachine() 780 785 { … … 1600 1605 connect(actionPool()->action(UIActionIndexST_M_Machine_S_ExportToOCI), &UIAction::triggered, 1601 1606 this, &UIVirtualBoxManager::sltOpenExportApplianceWizard); 1607 connect(actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New), &UIAction::triggered, 1608 this, &UIVirtualBoxManager::sltPerformMachineMoveToNewGroup); 1602 1609 connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow), &UIAction::triggered, 1603 1610 this, &UIVirtualBoxManager::sltPerformStartOrShowMachine); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r84512 r84513 210 210 /** Handles call to move machine. */ 211 211 void sltPerformMachineMove(); 212 213 /** Handles call to move machine to a new group. */ 214 void sltPerformMachineMoveToNewGroup(); 212 215 213 216 /** Handles call to start or show machine. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r84512 r84513 124 124 { 125 125 m_pPaneChooser->disbandGroup(); 126 } 127 128 void UIVirtualBoxManagerWidget::moveMachineToNewGroup() 129 { 130 m_pPaneChooser->moveMachineToNewGroup(); 126 131 } 127 132 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r84512 r84513 142 142 /** Disbands group. */ 143 143 void disbandGroup(); 144 /** Moves machine to a new group. */ 145 void moveMachineToNewGroup(); 144 146 /** Sorts group. */ 145 147 void sortGroup(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r84512 r84513 123 123 AssertPtrReturnVoid(model()); 124 124 model()->disbandSelectedGroupItem(); 125 } 126 127 void UIChooser::moveMachineToNewGroup() 128 { 129 AssertPtrReturnVoid(model()); 130 model()->moveSelectedMachineItemsToNewGroupItem(); 125 131 } 126 132 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r84512 r84513 136 136 /** Disbands group. */ 137 137 void disbandGroup(); 138 /** Moves machine to a new group. */ 139 void moveMachineToNewGroup(); 138 140 /** Sorts group. */ 139 141 void sortGroup(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r84463 r84513 663 663 } 664 664 665 void UIChooserModel::moveSelectedMachineItemsToNewGroupItem() 666 { 667 /* Create new group node in the current root: */ 668 UIChooserNodeGroup *pNewGroupNode = new UIChooserNodeGroup(invisibleRoot(), 669 false /* favorite */, 670 invisibleRoot()->nodes().size() /* position */, 671 uniqueGroupName(invisibleRoot()), 672 UIChooserNodeGroupType_Local, 673 true /* opened */); 674 UIChooserItemGroup *pNewGroupItem = new UIChooserItemGroup(root(), pNewGroupNode); 675 676 /* For each of currently selected-items: */ 677 QStringList busyGroupNames; 678 QStringList busyMachineNames; 679 foreach (UIChooserItem *pItem, selectedItems()) 680 { 681 /* For each of known types: */ 682 switch (pItem->type()) 683 { 684 case UIChooserNodeType_Group: 685 { 686 /* Avoid name collisions: */ 687 if (busyGroupNames.contains(pItem->name())) 688 break; 689 /* Add name to busy: */ 690 busyGroupNames << pItem->name(); 691 /* Copy or move group-item: */ 692 UIChooserNodeGroup *pNewGroupSubNode = new UIChooserNodeGroup(pNewGroupNode, 693 pItem->node()->toGroupNode(), 694 pNewGroupNode->nodes().size()); 695 new UIChooserItemGroup(pNewGroupItem, pNewGroupSubNode); 696 delete pItem->node(); 697 break; 698 } 699 case UIChooserNodeType_Machine: 700 { 701 /* Avoid name collisions: */ 702 if (busyMachineNames.contains(pItem->name())) 703 break; 704 /* Add name to busy: */ 705 busyMachineNames << pItem->name(); 706 /* Copy or move machine-item: */ 707 UIChooserNodeMachine *pNewMachineSubNode = new UIChooserNodeMachine(pNewGroupNode, 708 pItem->node()->toMachineNode(), 709 pNewGroupNode->nodes().size()); 710 new UIChooserItemMachine(pNewGroupItem, pNewMachineSubNode); 711 delete pItem->node(); 712 break; 713 } 714 } 715 } 716 717 /* Update model: */ 718 wipeOutEmptyGroups(); 719 updateTreeForMainRoot(); 720 setSelectedItem(pNewGroupItem); 721 saveGroups(); 722 } 723 665 724 void UIChooserModel::startOrShowSelectedItems() 666 725 { … … 917 976 } 918 977 919 void UIChooserModel::sltGroupSelectedMachines()920 {921 /* Check if action is enabled: */922 if (!actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New)->isEnabled())923 return;924 925 /* Create new group node in the current root: */926 UIChooserNodeGroup *pNewGroupNode = new UIChooserNodeGroup(invisibleRoot(),927 false /* favorite */,928 invisibleRoot()->nodes().size() /* position */,929 uniqueGroupName(invisibleRoot()),930 UIChooserNodeGroupType_Local,931 true /* opened */);932 UIChooserItemGroup *pNewGroupItem = new UIChooserItemGroup(root(), pNewGroupNode);933 934 /* Enumerate all the currently selected-items: */935 QStringList busyGroupNames;936 QStringList busyMachineNames;937 foreach (UIChooserItem *pItem, selectedItems())938 {939 /* For each of known types: */940 switch (pItem->type())941 {942 case UIChooserNodeType_Group:943 {944 /* Avoid name collisions: */945 if (busyGroupNames.contains(pItem->name()))946 break;947 /* Add name to busy: */948 busyGroupNames << pItem->name();949 /* Copy or move group-item: */950 UIChooserNodeGroup *pNewGroupSubNode = new UIChooserNodeGroup(pNewGroupNode,951 pItem->node()->toGroupNode(),952 pNewGroupNode->nodes().size());953 new UIChooserItemGroup(pNewGroupItem, pNewGroupSubNode);954 delete pItem->node();955 break;956 }957 case UIChooserNodeType_Machine:958 {959 /* Avoid name collisions: */960 if (busyMachineNames.contains(pItem->name()))961 break;962 /* Add name to busy: */963 busyMachineNames << pItem->name();964 /* Copy or move machine-item: */965 UIChooserNodeMachine *pNewMachineSubNode = new UIChooserNodeMachine(pNewGroupNode,966 pItem->node()->toMachineNode(),967 pNewGroupNode->nodes().size());968 new UIChooserItemMachine(pNewGroupItem, pNewMachineSubNode);969 delete pItem->node();970 break;971 }972 }973 }974 975 /* Update model: */976 wipeOutEmptyGroups();977 updateTreeForMainRoot();978 setSelectedItem(pNewGroupItem);979 saveGroups();980 }981 982 978 void UIChooserModel::sltPerformRefreshAction() 983 979 { … … 1313 1309 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Remove), &UIAction::triggered, 1314 1310 this, &UIChooserModel::sltRemoveSelectedMachine); 1315 connect(actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New), &UIAction::triggered,1316 this, &UIChooserModel::sltGroupSelectedMachines);1317 1311 connect(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), &UIAction::triggered, 1318 1312 this, &UIChooserModel::sltPerformRefreshAction); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r84463 r84513 220 220 /** Disbands selected group item. */ 221 221 void disbandSelectedGroupItem(); 222 /** Moves selected machine items to new group item. */ 223 void moveSelectedMachineItemsToNewGroupItem(); 222 224 /** Starts or shows selected items. */ 223 225 void startOrShowSelectedItems(); … … 295 297 /** @name Children stuff. 296 298 * @{ */ 297 /** Handles group selected machines request. */298 void sltGroupSelectedMachines();299 299 /** Handles refresh request. */ 300 300 void sltPerformRefreshAction();
Note:
See TracChangeset
for help on using the changeset viewer.