Changeset 42879 in vbox
- Timestamp:
- Aug 20, 2012 11:34:13 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r42766 r42879 1245 1245 } 1246 1246 1247 void UIMessageCenter::notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName) 1248 { 1249 message(&vboxGlobal().selectorWnd(), 1250 Error, 1251 tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> " 1252 "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>" 1253 "<p>Please resolve this name-conflict and try again.</p>") 1254 .arg(strName, strGroupName), 1255 0, /* auto-confirm id */ 1256 QIMessageBox::Ok | QIMessageBox::Default); 1257 } 1258 1259 int UIMessageCenter::askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName) 1260 { 1261 return message(&vboxGlobal().selectorWnd(), 1262 Question, 1263 tr("<p>You are trying to move group <nobr><b>%1</b></nobr> " 1264 "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>" 1265 "<p>Would you like to automatically rename it?</p>") 1266 .arg(strName, strGroupName), 1267 0, /* auto-confirm id */ 1268 QIMessageBox::Ok, 1269 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 1270 0, 1271 tr("Rename")); 1272 } 1273 1247 1274 int UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) 1248 1275 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r42766 r42879 255 255 int cannotEnterSeamlessMode(); 256 256 257 void notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName); 258 int askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName); 257 259 int confirmMachineItemRemoval(const QStringList &names); 258 260 int confirmMachineDeletion(const QList<CMachine> &machines); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
r42850 r42879 258 258 ":/vm_delete_disabled_32px.png", ":/delete_dis_16px.png") 259 259 { 260 setShortcut(gSS->keySequence(UISelectorShortcuts:: BreakVMGroupShortcut));261 retranslateUi(); 262 } 263 264 protected: 265 266 void retranslateUi() 267 { 268 setText(QApplication::translate("UIActionPool", "& Break Group..."));269 setStatusTip(QApplication::translate("UIActionPool", " Breakthe selected virtual machine group"));260 setShortcut(gSS->keySequence(UISelectorShortcuts::AddVMGroupShortcut)); 261 retranslateUi(); 262 } 263 264 protected: 265 266 void retranslateUi() 267 { 268 setText(QApplication::translate("UIActionPool", "&Ungroup...")); 269 setStatusTip(QApplication::translate("UIActionPool", "Ungroup items of the selected virtual machine group")); 270 270 } 271 271 }; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.cpp
r42751 r42879 36 36 m_Shortcuts[SettingsVMShortcut] = UIKeySequence("SettingsVM", "Ctrl+S"); 37 37 m_Shortcuts[CloneVMShortcut] = UIKeySequence("CloneVM", "Ctrl+O"); 38 m_Shortcuts[BreakVMGroupShortcut] = UIKeySequence("BreakVMGroup", "Ctrl+B");39 38 m_Shortcuts[RemoveVMShortcut] = UIKeySequence("RemoveVM", "Ctrl+R"); 40 39 m_Shortcuts[RenameVMGroupShortcut] = UIKeySequence("RenameVMGroup", "Ctrl+M"); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.h
r42751 r42879 38 38 SettingsVMShortcut, 39 39 CloneVMShortcut, 40 BreakVMGroupShortcut,41 40 RemoveVMShortcut, 42 41 RenameVMGroupShortcut, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
r42873 r42879 166 166 { 167 167 return m_strName; 168 } 169 170 void UIGChooserItemGroup::setName(const QString &strName) 171 { 172 m_strName = strName; 168 173 } 169 174 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
r42795 r42879 64 64 /* API: Basic stuff: */ 65 65 QString name() const; 66 void setName(const QString &strName); 66 67 bool closed() const; 67 68 bool opened() const; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r42862 r42879 689 689 AssertMsg(focusItem()->type() == UIGChooserItemType_Group, ("This is not group item!")); 690 690 691 /* Compose focus group name: */ 692 QString strFocusGroupName = fullName(focusItem()); 693 /* Enumerate all the unique sub-machine-items recursively: */ 694 QList<UIVMItem*> items; 695 enumerateCurrentItems(focusItem()->items(), items); 696 /* Enumerate all the machine groups recursively: */ 697 QMap<QString, QStringList> groupMap; 698 gatherGroupTree(groupMap, mainRoot()); 699 700 /* For each the sub-machine-item: */ 701 foreach (UIVMItem *pItem, items) 702 { 703 /* Get machine groups: */ 704 QStringList groups = groupMap.value(pItem->id()); 705 /* For each the machine group: */ 706 bool fUniqueMachine = true; 707 foreach (const QString &strGroupName, groups) 708 { 709 /* Check if this item is unique: */ 710 if (strGroupName != strFocusGroupName && 711 !strGroupName.startsWith(strFocusGroupName + "/")) 691 /* Check if we have collisions with our siblings: */ 692 UIGChooserItem *pFocusItem = focusItem(); 693 UIGChooserItem *pParentItem = pFocusItem->parentItem(); 694 QList<UIGChooserItem*> siblings = pParentItem->items(); 695 QList<UIGChooserItem*> toBeRenamed; 696 QList<UIGChooserItem*> toBeRemoved; 697 foreach (UIGChooserItem *pItem, pFocusItem->items()) 698 { 699 QString strItemName = pItem->name(); 700 UIGChooserItem *pCollisionSibling = 0; 701 foreach (UIGChooserItem *pSibling, siblings) 702 if (pSibling != pFocusItem && pSibling->name() == strItemName) 703 pCollisionSibling = pSibling; 704 if (pCollisionSibling) 705 { 706 if (pItem->type() == UIGChooserItemType_Machine) 712 707 { 713 fUniqueMachine = false; 708 if (pCollisionSibling->type() == UIGChooserItemType_Machine) 709 toBeRemoved << pItem; 710 else if (pCollisionSibling->type() == UIGChooserItemType_Group) 711 { 712 msgCenter().notifyAboutCollisionOnGroupRemovingCantBeResolved(strItemName, pParentItem->name()); 713 return; 714 } 715 } 716 else if (pItem->type() == UIGChooserItemType_Group) 717 { 718 if (msgCenter().askAboutCollisionOnGroupRemoving(strItemName, pParentItem->name()) == QIMessageBox::Ok) 719 toBeRenamed << pItem; 720 else 721 return; 722 } 723 } 724 } 725 726 /* Copy all the children into our parent: */ 727 foreach (UIGChooserItem *pItem, pFocusItem->items()) 728 { 729 if (toBeRemoved.contains(pItem)) 730 continue; 731 switch (pItem->type()) 732 { 733 case UIGChooserItemType_Group: 734 { 735 UIGChooserItemGroup *pGroupItem = new UIGChooserItemGroup(pParentItem, pItem->toGroupItem()); 736 if (toBeRenamed.contains(pItem)) 737 pGroupItem->setName(uniqueGroupName(pParentItem)); 714 738 break; 715 739 } 716 } 717 /* Add unique item into root: */ 718 if (fUniqueMachine) 719 createMachineItem(pItem->machine(), mainRoot()); 740 case UIGChooserItemType_Machine: 741 { 742 new UIGChooserItemMachine(pParentItem, pItem->toMachineItem()); 743 break; 744 } 745 } 720 746 } 721 747
Note:
See TracChangeset
for help on using the changeset viewer.