Changeset 42542 in vbox
- Timestamp:
- Aug 2, 2012 2:04:02 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 8 edited
-
UIActionPoolSelector.cpp (modified) (2 diffs)
-
UIActionPoolSelector.h (modified) (1 diff)
-
UISelectorShortcuts.cpp (modified) (2 diffs)
-
UISelectorShortcuts.h (modified) (1 diff)
-
UISelectorWindow.cpp (modified) (5 diffs)
-
UISelectorWindow.h (modified) (2 diffs)
-
graphics/chooser/UIGChooserModel.cpp (modified) (3 diffs)
-
graphics/chooser/UIGChooserModel.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
r42526 r42542 531 531 }; 532 532 533 class UIActionSimpleMachineAddGroupDialog : public UIActionSimple 534 { 535 Q_OBJECT; 536 537 public: 538 539 UIActionSimpleMachineAddGroupDialog(QObject *pParent) 540 : UIActionSimple(pParent, ":/add_shared_folder_16px.png") 541 { 542 retranslateUi(); 543 } 544 545 protected: 546 547 void retranslateUi() 548 { 549 setText(QApplication::translate("UIActionPool", "&Add group...")); 550 setStatusTip(QApplication::translate("UIActionPool", "Add a new group based on the items selected")); 551 setShortcut(gSS->keySequence(UISelectorShortcuts::AddVMGroupShortcut)); 552 } 553 }; 554 533 555 class UIActionSimpleMachineSettingsDialog : public UIActionSimple 534 556 { … … 944 966 m_pool[UIActionIndexSelector_Simple_Machine_NewWizard] = new UIActionSimpleMachineNewWizard(this); 945 967 m_pool[UIActionIndexSelector_Simple_Machine_AddDialog] = new UIActionSimpleMachineAddDialog(this); 968 m_pool[UIActionIndexSelector_Simple_Machine_AddGroupDialog] = new UIActionSimpleMachineAddGroupDialog(this); 946 969 m_pool[UIActionIndexSelector_Simple_Machine_SettingsDialog] = new UIActionSimpleMachineSettingsDialog(this); 947 970 m_pool[UIActionIndexSelector_Simple_Machine_CloneWizard] = new UIActionSimpleMachineCloneWizard(this); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
r42526 r42542 52 52 UIActionIndexSelector_Simple_Machine_NewWizard, 53 53 UIActionIndexSelector_Simple_Machine_AddDialog, 54 UIActionIndexSelector_Simple_Machine_AddGroupDialog, 54 55 UIActionIndexSelector_Simple_Machine_SettingsDialog, 55 56 UIActionIndexSelector_Simple_Machine_CloneWizard, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.cpp
r42526 r42542 33 33 m_Shortcuts[NewVMShortcut] = UIKeySequence("NewVM", "Ctrl+N"); 34 34 m_Shortcuts[AddVMShortcut] = UIKeySequence("AddVM", "Ctrl+A"); 35 m_Shortcuts[AddVMGroupShortcut] = UIKeySequence("AddVMGroup", "Ctrl+U"); 35 36 m_Shortcuts[SettingsVMShortcut] = UIKeySequence("SettingsVM", "Ctrl+S"); 36 37 m_Shortcuts[CloneVMShortcut] = UIKeySequence("CloneVM", "Ctrl+O"); … … 42 43 m_Shortcuts[PauseVMShortcut] = UIKeySequence("PauseVM", "Ctrl+P"); 43 44 m_Shortcuts[ResetVMShortcut] = UIKeySequence("ResetVM", "Ctrl+T"); 44 m_Shortcuts[ACPIShutdownVMShortcut] = UIKeySequence("ACPIShutdownVM", "Ctrl+ U");45 m_Shortcuts[ACPIShutdownVMShortcut] = UIKeySequence("ACPIShutdownVM", "Ctrl+H"); 45 46 m_Shortcuts[PowerOffVMShortcut] = UIKeySequence("PowerOffVM", "Ctrl+F"); 46 47 m_Shortcuts[RefreshVMShortcut] = UIKeySequence("RefreshVM"); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.h
r42526 r42542 35 35 NewVMShortcut, 36 36 AddVMShortcut, 37 AddVMGroupShortcut, 37 38 SettingsVMShortcut, 38 39 CloneVMShortcut, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r42533 r42542 759 759 m_pActionMachineSettingsDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_SettingsDialog, items)); 760 760 m_pActionMachineCloneWizard->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CloneWizard, items)); 761 m_pActionMachineAddGroupDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_AddGroupDialog, items)); 761 762 m_pActionMachineRemoveDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, items)); 762 763 m_pActionMachineStartOrShow->setEnabled(isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, items)); … … 1206 1207 m_pActionMachineCloneWizard = gActionPool->action(UIActionIndexSelector_Simple_Machine_CloneWizard); 1207 1208 pMenu->addAction(m_pActionMachineCloneWizard); 1209 m_pActionMachineAddGroupDialog = gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroupDialog); 1210 pMenu->addAction(m_pActionMachineAddGroupDialog); 1208 1211 m_pActionMachineRemoveDialog = gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog); 1209 1212 pMenu->addAction(m_pActionMachineRemoveDialog); … … 1235 1238 m_machineActions << m_pActionMachineNewWizard << m_pActionMachineAddDialog 1236 1239 << m_pActionMachineSettingsDialog << m_pActionMachineCloneWizard 1240 << m_pActionMachineAddGroupDialog 1237 1241 << m_pActionMachineRemoveDialog << m_pActionMachineStartOrShow 1238 1242 << m_pActionMachineDiscard << m_pActionMachinePauseAndResume … … 1589 1593 pItem->sessionState() == KSessionState_Unlocked; 1590 1594 } 1595 case UIActionIndexSelector_Simple_Machine_AddGroupDialog: 1596 { 1597 /* Check that there is more than one item, 1598 * all items are accessible and in 'powered off' states: */ 1599 return items.size() > 1 && 1600 isItemsAccessible(items) && 1601 isItemsPoweredOff(items); 1602 } 1591 1603 case UIActionIndexSelector_Simple_Group_RenameDialog: 1592 1604 case UIActionIndexSelector_Simple_Group_RemoveDialog: … … 1768 1780 } 1769 1781 1782 /* static */ 1783 bool UISelectorWindow::isItemsPoweredOff(const QList<UIVMItem*> &items) 1784 { 1785 foreach (UIVMItem *pItem, items) 1786 if (!(pItem->machineState() == KMachineState_PoweredOff || 1787 pItem->machineState() == KMachineState_Saved || 1788 pItem->machineState() == KMachineState_Teleported || 1789 pItem->machineState() == KMachineState_Aborted)) 1790 return false; 1791 return true; 1792 } 1793 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r42533 r42542 139 139 static bool isItemsHasUnlockedSession(const QList<UIVMItem*> &items); 140 140 static bool isItemsSupportsShortcuts(const QList<UIVMItem*> &items); 141 static bool isItemsPoweredOff(const QList<UIVMItem*> &items); 141 142 142 143 /* Central splitter window: */ … … 192 193 UIAction *m_pActionMachineSettingsDialog; 193 194 UIAction *m_pActionMachineCloneWizard; 195 UIAction *m_pActionMachineAddGroupDialog; 194 196 UIAction *m_pActionMachineRemoveDialog; 195 197 UIAction *m_pActionMachineStartOrShow; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r42529 r42542 657 657 unregisterMachines(names); 658 658 } 659 } 660 661 void UIGChooserModel::sltAddGroupBasedOnChosenItems() 662 { 663 /* Create new group in the current root: */ 664 UIGChooserItemGroup *pNewGroupItem = new UIGChooserItemGroup(root(), uniqueGroupName(root())); 665 /* Enumerate all the currently chosen items: */ 666 QStringList busyGroupNames; 667 QStringList busyMachineNames; 668 foreach (UIGChooserItem *pItem, selectionList()) 669 { 670 /* For each of known types: */ 671 switch (pItem->type()) 672 { 673 case UIGChooserItemType_Group: 674 { 675 /* Avoid name collisions: */ 676 if (busyGroupNames.contains(pItem->name())) 677 break; 678 /* Copy group item: */ 679 new UIGChooserItemGroup(pNewGroupItem, pItem->toGroupItem()); 680 busyGroupNames << pItem->name(); 681 break; 682 } 683 case UIGChooserItemType_Machine: 684 { 685 /* Avoid name collisions: */ 686 if (busyMachineNames.contains(pItem->name())) 687 break; 688 /* Copy machine item: */ 689 new UIGChooserItemMachine(pNewGroupItem, pItem->toMachineItem()); 690 busyMachineNames << pItem->name(); 691 break; 692 } 693 } 694 } 695 /* Update model: */ 696 updateNavigation(); 697 updateLayout(); 698 setCurrentItem(pNewGroupItem); 659 699 } 660 700 … … 774 814 m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_SettingsDialog)); 775 815 m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_CloneWizard)); 816 m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroupDialog)); 776 817 m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog)); 777 818 m_pContextMenuMachine->addSeparator(); … … 798 839 connect(gActionPool->action(UIActionIndexSelector_Simple_Group_RemoveDialog), SIGNAL(triggered()), 799 840 this, SLOT(sltRemoveCurrentlySelectedGroup())); 841 connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroupDialog), SIGNAL(triggered()), 842 this, SLOT(sltAddGroupBasedOnChosenItems())); 800 843 connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog), SIGNAL(triggered()), 801 844 this, SLOT(sltRemoveCurrentlySelectedMachine())); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
r42529 r42542 156 156 void sltRemoveCurrentlySelectedMachine(); 157 157 158 /* Handler: Group add stuff: */ 159 void sltAddGroupBasedOnChosenItems(); 160 158 161 /* Handler: Group name editing stuff: */ 159 162 void sltStartEditingSelectedGroup();
Note:
See TracChangeset
for help on using the changeset viewer.

