VirtualBox

Changeset 84456 in vbox for trunk/src


Ignore:
Timestamp:
May 22, 2020 12:43:11 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane cleanup: Move group sorting action trigger handling to proper place in UIVirtualBoxManager class.

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  
    13031303}
    13041304
     1305void UIVirtualBoxManager::sltPerformGroupSorting()
     1306{
     1307    m_pWidget->performGroupSorting();
     1308}
     1309
    13051310void UIVirtualBoxManager::sltGroupCloseMenuAboutToShow()
    13061311{
     
    15241529    connect(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut), &UIAction::triggered,
    15251530            this, &UIVirtualBoxManager::sltPerformCreateMachineShortcut);
     1531    connect(actionPool()->action(UIActionIndexST_M_Group_S_Sort), &UIAction::triggered,
     1532            this, &UIVirtualBoxManager::sltPerformGroupSorting);
    15261533
    15271534    /* 'Machine' menu connections: */
     
    15501557    connect(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut), &UIAction::triggered,
    15511558            this, &UIVirtualBoxManager::sltPerformCreateMachineShortcut);
     1559    connect(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent), &UIAction::triggered,
     1560            this, &UIVirtualBoxManager::sltPerformGroupSorting);
    15521561
    15531562    /* 'Group/Start or Show' menu connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r84439 r84456  
    247247        /** Handles call to create machine shortcut. */
    248248        void sltPerformCreateMachineShortcut();
     249
     250        /** Handles call to sort group. */
     251        void sltPerformGroupSorting();
    249252
    250253        /** Handles call to show group Close menu. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r84439 r84456  
    114114{
    115115    m_pPaneChooser->openGroupNameEditor();
     116}
     117
     118void UIVirtualBoxManagerWidget::performGroupSorting()
     119{
     120    m_pPaneChooser->performGroupSorting();
    116121}
    117122
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r84439 r84456  
    137137        /** Opens group name editor. */
    138138        void openGroupNameEditor();
     139        /** Performs group sorting. */
     140        void performGroupSorting();
    139141    /** @} */
    140142
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp

    r84439 r84456  
    111111    AssertPtrReturnVoid(model());
    112112    model()->startEditingSelectedGroupItemName();
     113}
     114
     115void UIChooser::performGroupSorting()
     116{
     117    AssertPtrReturnVoid(model());
     118    model()->sortSelectedGroupItem();
    113119}
    114120
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h

    r84439 r84456  
    131131        /** Opens group name editor. */
    132132        void openGroupNameEditor();
     133        /** Performs group sorting. */
     134        void performGroupSorting();
    133135    /** @} */
    134136
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r84439 r84456  
    570570}
    571571
     572void 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
    572595void UIChooserModel::setCurrentDragObject(QDrag *pDragObject)
    573596{
     
    796819}
    797820
    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 
    814821void UIChooserModel::sltUngroupSelectedGroup()
    815822{
     
    10261033    setSelectedItem(pNewGroupItem);
    10271034    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();
    10441035}
    10451036
     
    13911382    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh), &UIAction::triggered,
    13921383            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);
    13971384    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Search), &UIAction::triggered,
    13981385            this, &UIChooserModel::sltShowHideSearchWidget);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r84439 r84456  
    215215        /** Starts editing selected group item name. */
    216216        void startEditingSelectedGroupItemName();
    217 
    218217        /** Starts or shows selected items. */
    219218        void startOrShowSelectedItems();
     219        /** Sorts selected [parent] group item. */
     220        void sortSelectedGroupItem();
    220221
    221222        /** Defines current @a pDragObject. */
     
    289290    /** @name Children stuff.
    290291      * @{ */
    291         /** Handles group sort request. */
    292         void sltSortGroup();
    293292        /** Handles group destroy request. */
    294293        void sltUngroupSelectedGroup();
     
    298297        /** Handles group selected machines request. */
    299298        void sltGroupSelectedMachines();
    300         /** Handles sort parent group request. */
    301         void sltSortParentGroup();
    302299        /** Handles refresh request. */
    303300        void sltPerformRefreshAction();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette