- Timestamp:
- May 25, 2020 4:12:58 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
r84513 r84516 1308 1308 } 1309 1309 1310 void UIVirtualBoxManager::sltPerformRefreshMachine() 1311 { 1312 m_pWidget->refreshMachine(); 1313 } 1314 1310 1315 void UIVirtualBoxManager::sltShowMachineInFileManager() 1311 1316 { … … 1585 1590 connect(actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog), &UIAction::triggered, 1586 1591 this, &UIVirtualBoxManager::sltOpenLogViewerWindow); 1592 connect(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), &UIAction::triggered, 1593 this, &UIVirtualBoxManager::sltPerformRefreshMachine); 1587 1594 connect(actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager), &UIAction::triggered, 1588 1595 this, &UIVirtualBoxManager::sltShowMachineInFileManager); … … 1617 1624 connect(actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog), &UIAction::triggered, 1618 1625 this, &UIVirtualBoxManager::sltOpenLogViewerWindow); 1626 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh), &UIAction::triggered, 1627 this, &UIVirtualBoxManager::sltPerformRefreshMachine); 1619 1628 connect(actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager), &UIAction::triggered, 1620 1629 this, &UIVirtualBoxManager::sltShowMachineInFileManager); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r84513 r84516 248 248 /** Handles call to close machine Log Viewer window. */ 249 249 void sltCloseLogViewerWindow(); 250 251 /** Handles call to refresh machine. */ 252 void sltPerformRefreshMachine(); 250 253 251 254 /** Handles call to show machine in File Manager. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r84513 r84516 129 129 { 130 130 m_pPaneChooser->moveMachineToNewGroup(); 131 } 132 133 void UIVirtualBoxManagerWidget::refreshMachine() 134 { 135 m_pPaneChooser->refreshMachine(); 131 136 } 132 137 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r84513 r84516 144 144 /** Moves machine to a new group. */ 145 145 void moveMachineToNewGroup(); 146 /** Refreshes machine. */ 147 void refreshMachine(); 146 148 /** Sorts group. */ 147 149 void sortGroup(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r84513 r84516 129 129 AssertPtrReturnVoid(model()); 130 130 model()->moveSelectedMachineItemsToNewGroupItem(); 131 } 132 133 void UIChooser::refreshMachine() 134 { 135 AssertPtrReturnVoid(model()); 136 model()->refreshSelectedMachineItems(); 131 137 } 132 138 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r84513 r84516 138 138 /** Moves machine to a new group. */ 139 139 void moveMachineToNewGroup(); 140 /** Refreshes machine. */ 141 void refreshMachine(); 140 142 /** Sorts group. */ 141 143 void sortGroup(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r84513 r84516 727 727 } 728 728 729 void UIChooserModel::refreshSelectedMachineItems() 730 { 731 /* Gather list of current unique inaccessible machine-items: */ 732 QList<UIChooserItemMachine*> inaccessibleMachineItemList; 733 UIChooserItemMachine::enumerateMachineItems(selectedItems(), inaccessibleMachineItemList, 734 UIChooserItemMachineEnumerationFlag_Unique | 735 UIChooserItemMachineEnumerationFlag_Inaccessible); 736 737 /* Prepare item to be selected: */ 738 UIChooserItem *pSelectedItem = 0; 739 740 /* For each machine-item: */ 741 foreach (UIChooserItemMachine *pItem, inaccessibleMachineItemList) 742 { 743 AssertPtrReturnVoid(pItem); 744 switch (pItem->cacheType()) 745 { 746 case UIVirtualMachineItemType_Local: 747 { 748 /* Recache: */ 749 pItem->recache(); 750 751 /* Became accessible? */ 752 if (pItem->accessible()) 753 { 754 /* Acquire machine ID: */ 755 const QUuid uId = pItem->id(); 756 /* Reload this machine: */ 757 sltReloadMachine(uId); 758 /* Select first of reloaded items: */ 759 if (!pSelectedItem) 760 pSelectedItem = root()->searchForItem(uId.toString(), 761 UIChooserItemSearchFlag_Machine | 762 UIChooserItemSearchFlag_ExactId); 763 } 764 765 break; 766 } 767 case UIVirtualMachineItemType_CloudFake: 768 { 769 /* Create list cloud machines task: */ 770 UIChooserItem *pParent = pItem->parentItem(); 771 AssertPtrReturnVoid(pParent); 772 UIChooserItem *pParentOfParent = pParent->parentItem(); 773 AssertPtrReturnVoid(pParentOfParent); 774 UITaskCloudListMachines *pTask = new UITaskCloudListMachines(pParentOfParent->name(), 775 pParent->name()); 776 AssertPtrReturnVoid(pTask); 777 uiCommon().threadPoolCloud()->enqueueTask(pTask); 778 779 break; 780 } 781 case UIVirtualMachineItemType_CloudReal: 782 { 783 /* Much more simple than for local items, we are not reloading them, just refreshing: */ 784 pItem->cache()->toCloud()->updateInfoAsync(false /* delayed */); 785 786 break; 787 } 788 default: 789 break; 790 } 791 } 792 793 /* Some item to be selected? */ 794 if (pSelectedItem) 795 { 796 pSelectedItem->makeSureItsVisible(); 797 setSelectedItem(pSelectedItem); 798 } 799 } 800 729 801 void UIChooserModel::sortSelectedGroupItem() 730 802 { … … 976 1048 } 977 1049 978 void UIChooserModel::sltPerformRefreshAction()979 {980 /* Check if action is enabled: */981 if (!actionPool()->action(UIActionIndexST_M_Group_S_Refresh)->isEnabled())982 return;983 984 /* Gather list of current unique inaccessible machine-items: */985 QList<UIChooserItemMachine*> inaccessibleMachineItemList;986 UIChooserItemMachine::enumerateMachineItems(selectedItems(), inaccessibleMachineItemList,987 UIChooserItemMachineEnumerationFlag_Unique |988 UIChooserItemMachineEnumerationFlag_Inaccessible);989 990 /* Prepare item to be selected: */991 UIChooserItem *pSelectedItem = 0;992 993 /* For each machine-item: */994 foreach (UIChooserItemMachine *pItem, inaccessibleMachineItemList)995 {996 AssertPtrReturnVoid(pItem);997 switch (pItem->cacheType())998 {999 case UIVirtualMachineItemType_Local:1000 {1001 /* Recache: */1002 pItem->recache();1003 1004 /* Became accessible? */1005 if (pItem->accessible())1006 {1007 /* Acquire machine ID: */1008 const QUuid uId = pItem->id();1009 /* Reload this machine: */1010 sltReloadMachine(uId);1011 /* Select first of reloaded items: */1012 if (!pSelectedItem)1013 pSelectedItem = root()->searchForItem(uId.toString(),1014 UIChooserItemSearchFlag_Machine |1015 UIChooserItemSearchFlag_ExactId);1016 }1017 1018 break;1019 }1020 case UIVirtualMachineItemType_CloudFake:1021 {1022 /* Create list cloud machines task: */1023 UIChooserItem *pParent = pItem->parentItem();1024 AssertPtrReturnVoid(pParent);1025 UIChooserItem *pParentOfParent = pParent->parentItem();1026 AssertPtrReturnVoid(pParentOfParent);1027 UITaskCloudListMachines *pTask = new UITaskCloudListMachines(pParentOfParent->name(),1028 pParent->name());1029 AssertPtrReturnVoid(pTask);1030 uiCommon().threadPoolCloud()->enqueueTask(pTask);1031 1032 break;1033 }1034 case UIVirtualMachineItemType_CloudReal:1035 {1036 /* Much more simple than for local items, we are not reloading them, just refreshing: */1037 pItem->cache()->toCloud()->updateInfoAsync(false /* delayed */);1038 1039 break;1040 }1041 default:1042 break;1043 }1044 }1045 1046 /* Some item to be selected? */1047 if (pSelectedItem)1048 {1049 pSelectedItem->makeSureItsVisible();1050 setSelectedItem(pSelectedItem);1051 }1052 }1053 1054 1050 void UIChooserModel::sltRemoveSelectedMachine() 1055 1051 { … … 1309 1305 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Remove), &UIAction::triggered, 1310 1306 this, &UIChooserModel::sltRemoveSelectedMachine); 1311 connect(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), &UIAction::triggered,1312 this, &UIChooserModel::sltPerformRefreshAction);1313 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh), &UIAction::triggered,1314 this, &UIChooserModel::sltPerformRefreshAction);1315 1307 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Search), &UIAction::triggered, 1316 1308 this, &UIChooserModel::sltShowHideSearchWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r84513 r84516 224 224 /** Starts or shows selected items. */ 225 225 void startOrShowSelectedItems(); 226 /** Refreshes selected machine items. */ 227 void refreshSelectedMachineItems(); 226 228 /** Sorts selected [parent] group item. */ 227 229 void sortSelectedGroupItem(); … … 297 299 /** @name Children stuff. 298 300 * @{ */ 299 /** Handles refresh request. */300 void sltPerformRefreshAction();301 301 /** Handles remove selected machine request. */ 302 302 void sltRemoveSelectedMachine();
Note:
See TracChangeset
for help on using the changeset viewer.