Changeset 43155 in vbox
- Timestamp:
- Sep 3, 2012 8:54:57 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r43005 r43155 707 707 } 708 708 709 void UISelectorWindow::sltPerformRefreshAction()710 {711 /* Get selected items: */712 QList<UIVMItem*> items = currentItems();713 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));714 715 // TODO: Notify selector-model to refresh selected items!716 717 /* Refresh details: */718 sltCurrentVMItemChanged();719 }720 721 709 void UISelectorWindow::sltShowLogDialog() 722 710 { … … 1405 1393 connect(m_pAction_Common_Reset, SIGNAL(triggered()), this, SLOT(sltPerformResetAction())); 1406 1394 connect(m_pAction_Common_Discard, SIGNAL(triggered()), this, SLOT(sltPerformDiscardAction())); 1407 connect(m_pAction_Common_Refresh, SIGNAL(triggered()), this, SLOT(sltPerformRefreshAction()));1408 1395 connect(m_pAction_Common_ShowInFileManager, SIGNAL(triggered()), this, SLOT(sltShowMachineInFileManager())); 1409 1396 connect(m_pAction_Common_CreateShortcut, SIGNAL(triggered()), this, SLOT(sltPerformCreateShortcutAction())); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r42853 r43155 96 96 void sltPerformACPIShutdownAction(); 97 97 void sltPerformPowerOffAction(); 98 void sltPerformRefreshAction();99 98 void sltShowLogDialog(); 100 99 void sltShowMachineInFileManager(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r43007 r43155 964 964 } 965 965 966 void UIGChooserModel::sltPerformRefreshAction() 967 { 968 /* Gather list of chosen inaccessible VMs: */ 969 QList<UIGChooserItem*> inaccessibleItems; 970 enumerateInaccessibleItems(selectionList(), inaccessibleItems); 971 972 /* For each inaccessible item: */ 973 UIGChooserItem *pSelectedItem = 0; 974 foreach (UIGChooserItem *pItem, inaccessibleItems) 975 if (UIGChooserItemMachine *pMachineItem = pItem->toMachineItem()) 976 { 977 /* Recache: */ 978 pMachineItem->recache(); 979 /* Become accessible? */ 980 if (pMachineItem->accessible()) 981 { 982 /* Machine name: */ 983 QString strMachineName = pMachineItem->name(); 984 /* We should reload this machine: */ 985 sltReloadMachine(pMachineItem->id()); 986 /* Select first of reloaded items: */ 987 if (!pSelectedItem) 988 pSelectedItem = findMachineItem(strMachineName, mainRoot()); 989 } 990 } 991 /* Some item to be selected? */ 992 if (pSelectedItem) 993 { 994 pSelectedItem->makeSureItsVisible(); 995 setCurrentItem(pSelectedItem); 996 } 997 } 998 966 999 void UIGChooserModel::sltSortParentGroup() 967 1000 { … … 1110 1143 connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroup), SIGNAL(triggered()), 1111 1144 this, SLOT(sltAddGroupBasedOnChosenItems())); 1145 connect(gActionPool->action(UIActionIndexSelector_Simple_Common_Refresh), SIGNAL(triggered()), 1146 this, SLOT(sltPerformRefreshAction())); 1112 1147 connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_SortParent), SIGNAL(triggered()), 1113 1148 this, SLOT(sltSortParentGroup())); … … 1923 1958 } 1924 1959 1960 void UIGChooserModel::enumerateInaccessibleItems(const QList<UIGChooserItem*> &il, QList<UIGChooserItem*> &ol) const 1961 { 1962 /* Enumerate all the passed items: */ 1963 foreach (UIGChooserItem *pItem, il) 1964 { 1965 /* If item is inaccessible machine: */ 1966 if (pItem->type() == UIGChooserItemType_Machine) 1967 { 1968 if (UIGChooserItemMachine *pMachineItem = pItem->toMachineItem()) 1969 if (!pMachineItem->accessible() && !contains(ol, pItem)) 1970 ol << pMachineItem; 1971 } 1972 /* If item is group: */ 1973 else if (pItem->type() == UIGChooserItemType_Group) 1974 { 1975 /* Enumerate all the machine items recursively: */ 1976 enumerateInaccessibleItems(pItem->items(UIGChooserItemType_Machine), ol); 1977 /* Enumerate all the group items recursively: */ 1978 enumerateInaccessibleItems(pItem->items(UIGChooserItemType_Group), ol); 1979 } 1980 } 1981 } 1982 1983 bool UIGChooserModel::contains(const QList<UIGChooserItem*> &il, UIGChooserItem *pLookupItem) const 1984 { 1985 /* We assume passed list contains only machine items: */ 1986 foreach (UIGChooserItem *pItem, il) 1987 if (UIGChooserItemMachine *pMachineItem = pItem->toMachineItem()) 1988 if (pMachineItem->id() == pLookupItem->toMachineItem()->id()) 1989 return true; 1990 return false; 1991 } 1992 1925 1993 void UIGChooserModel::sortItems(UIGChooserItem *pParent, bool fRecursively /* = false */) 1926 1994 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
r43007 r43155 206 206 void sltSlidingComplete(); 207 207 208 /* Handler: Refresh stuff: */ 209 void sltPerformRefreshAction(); 210 208 211 /* Handlers: Sorting stuff: */ 209 212 void sltSortParentGroup(); … … 304 307 void removeMachineItems(const QStringList &names, QList<UIGChooserItem*> &selectedItems); 305 308 void unregisterMachines(const QStringList &ids); 309 310 /* Helper: Refresh stuff: */ 311 void enumerateInaccessibleItems(const QList<UIGChooserItem*> &il, QList<UIGChooserItem*> &ol) const; 312 bool contains(const QList<UIGChooserItem*> &il, UIGChooserItem *pLookupItem) const; 306 313 307 314 /* Helper: Sorting stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.