- Timestamp:
- May 22, 2020 12:43:11 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
r84439 r84456 1303 1303 } 1304 1304 1305 void UIVirtualBoxManager::sltPerformGroupSorting() 1306 { 1307 m_pWidget->performGroupSorting(); 1308 } 1309 1305 1310 void UIVirtualBoxManager::sltGroupCloseMenuAboutToShow() 1306 1311 { … … 1524 1529 connect(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut), &UIAction::triggered, 1525 1530 this, &UIVirtualBoxManager::sltPerformCreateMachineShortcut); 1531 connect(actionPool()->action(UIActionIndexST_M_Group_S_Sort), &UIAction::triggered, 1532 this, &UIVirtualBoxManager::sltPerformGroupSorting); 1526 1533 1527 1534 /* 'Machine' menu connections: */ … … 1550 1557 connect(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut), &UIAction::triggered, 1551 1558 this, &UIVirtualBoxManager::sltPerformCreateMachineShortcut); 1559 connect(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent), &UIAction::triggered, 1560 this, &UIVirtualBoxManager::sltPerformGroupSorting); 1552 1561 1553 1562 /* 'Group/Start or Show' menu connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r84439 r84456 247 247 /** Handles call to create machine shortcut. */ 248 248 void sltPerformCreateMachineShortcut(); 249 250 /** Handles call to sort group. */ 251 void sltPerformGroupSorting(); 249 252 250 253 /** Handles call to show group Close menu. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r84439 r84456 114 114 { 115 115 m_pPaneChooser->openGroupNameEditor(); 116 } 117 118 void UIVirtualBoxManagerWidget::performGroupSorting() 119 { 120 m_pPaneChooser->performGroupSorting(); 116 121 } 117 122 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r84439 r84456 137 137 /** Opens group name editor. */ 138 138 void openGroupNameEditor(); 139 /** Performs group sorting. */ 140 void performGroupSorting(); 139 141 /** @} */ 140 142 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r84439 r84456 111 111 AssertPtrReturnVoid(model()); 112 112 model()->startEditingSelectedGroupItemName(); 113 } 114 115 void UIChooser::performGroupSorting() 116 { 117 AssertPtrReturnVoid(model()); 118 model()->sortSelectedGroupItem(); 113 119 } 114 120 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r84439 r84456 131 131 /** Opens group name editor. */ 132 132 void openGroupNameEditor(); 133 /** Performs group sorting. */ 134 void performGroupSorting(); 133 135 /** @} */ 134 136 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r84439 r84456 570 570 } 571 571 572 void UIChooserModel::sortSelectedGroupItem() 573 { 574 /* For single selected group, sort first selected item children: */ 575 if (isSingleGroupSelected()) 576 firstSelectedItem()->node()->sortNodes(); 577 /* Otherwise, sort first selected item neighbors: */ 578 else 579 firstSelectedItem()->parentItem()->node()->sortNodes(); 580 581 /* Remember first selected item definition: */ 582 const QString strDefinition = firstSelectedItem() ? firstSelectedItem()->definition() : QString(); 583 584 /* Rebuild tree for main root: */ 585 buildTreeForMainRoot(); 586 587 /* Restore selection if there was some item before: */ 588 if (!strDefinition.isNull()) 589 setSelectedItem(strDefinition); 590 /* Else make sure at least one item selected: */ 591 else 592 makeSureAtLeastOneItemSelected(); 593 } 594 572 595 void UIChooserModel::setCurrentDragObject(QDrag *pDragObject) 573 596 { … … 796 819 } 797 820 798 void UIChooserModel::sltSortGroup()799 {800 /* Check if action is enabled: */801 if (!actionPool()->action(UIActionIndexST_M_Group_S_Sort)->isEnabled())802 return;803 /* Only for single selected group: */804 if (!isSingleGroupSelected())805 return;806 807 /* Sort nodes: */808 firstSelectedItem()->node()->sortNodes();809 810 /* Rebuild tree for main root: */811 buildTreeForMainRoot();812 }813 814 821 void UIChooserModel::sltUngroupSelectedGroup() 815 822 { … … 1026 1033 setSelectedItem(pNewGroupItem); 1027 1034 saveGroups(); 1028 }1029 1030 void UIChooserModel::sltSortParentGroup()1031 {1032 /* Check if action is enabled: */1033 if (!actionPool()->action(UIActionIndexST_M_Machine_S_SortParent)->isEnabled())1034 return;1035 /* Only if some item selected: */1036 if (!firstSelectedItem())1037 return;1038 1039 /* Sort nodes: */1040 firstSelectedItem()->parentItem()->node()->sortNodes();1041 1042 /* Rebuild tree for main root: */1043 buildTreeForMainRoot();1044 1035 } 1045 1036 … … 1391 1382 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh), &UIAction::triggered, 1392 1383 this, &UIChooserModel::sltPerformRefreshAction); 1393 connect(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent), &UIAction::triggered,1394 this, &UIChooserModel::sltSortParentGroup);1395 connect(actionPool()->action(UIActionIndexST_M_Group_S_Sort), &UIAction::triggered,1396 this, &UIChooserModel::sltSortGroup);1397 1384 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Search), &UIAction::triggered, 1398 1385 this, &UIChooserModel::sltShowHideSearchWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r84439 r84456 215 215 /** Starts editing selected group item name. */ 216 216 void startEditingSelectedGroupItemName(); 217 218 217 /** Starts or shows selected items. */ 219 218 void startOrShowSelectedItems(); 219 /** Sorts selected [parent] group item. */ 220 void sortSelectedGroupItem(); 220 221 221 222 /** Defines current @a pDragObject. */ … … 289 290 /** @name Children stuff. 290 291 * @{ */ 291 /** Handles group sort request. */292 void sltSortGroup();293 292 /** Handles group destroy request. */ 294 293 void sltUngroupSelectedGroup(); … … 298 297 /** Handles group selected machines request. */ 299 298 void sltGroupSelectedMachines(); 300 /** Handles sort parent group request. */301 void sltSortParentGroup();302 299 /** Handles refresh request. */ 303 300 void sltPerformRefreshAction();
Note:
See TracChangeset
for help on using the changeset viewer.