Changeset 83709 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 15, 2020 4:53:18 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137216
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r83690 r83709 605 605 606 606 void UIMessageCenter::cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent /* = 0 */) const 607 { 608 /* Show the error: */ 609 error(pParent, MessageType_Error, 610 tr("Failed to acquire machine parameter."), UIErrorString::formatErrorInfo(comMachine)); 611 } 612 613 void UIMessageCenter::cannotAcquireMachineParameter(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */) const 607 614 { 608 615 /* Show the error: */ … … 758 765 } 759 766 767 bool UIMessageCenter::confirmCloudMachineRemoval(const QList<CCloudMachine> &machines) const 768 { 769 /* Enumerate the machines: */ 770 QStringList machineNames; 771 foreach (const CCloudMachine &comMachine, machines) 772 { 773 /* Append machine name to the full name string: */ 774 if (comMachine.GetAccessible()) 775 machineNames << QString("<b>%1</b>").arg(comMachine.GetName()); 776 } 777 778 /* Prepare message text: */ 779 QString strText = tr("<p>You are about to remove following cloud virtual machines from the machine list:</p>" 780 "<p>%1</p>") 781 .arg(machineNames.join(", ")); 782 783 /* Prepare message itself: */ 784 return questionBinary(0, MessageType_Question, 785 strText, 786 0 /* auto-confirm id */, 787 tr("Remove")); 788 } 789 760 790 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) const 761 791 { … … 772 802 .arg(CMachine(machine).GetName()), 773 803 UIErrorString::formatErrorInfo(progress)); 804 } 805 806 void UIMessageCenter::cannotRemoveCloudMachine(const CCloudMachine &comMachine) const 807 { 808 error(0, MessageType_Error, 809 tr("Failed to remove the cloud virtual machine <b>%1</b>.") 810 .arg(CCloudMachine(comMachine).GetName()), 811 UIErrorString::formatErrorInfo(comMachine)); 812 } 813 814 void UIMessageCenter::cannotRemoveCloudMachine(const CCloudMachine &comMachine, const CProgress &comProgress) const 815 { 816 error(0, MessageType_Error, 817 tr("Failed to remove the cloud virtual machine <b>%1</b>.") 818 .arg(CCloudMachine(comMachine).GetName()), 819 UIErrorString::formatErrorInfo(comProgress)); 774 820 } 775 821 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r83690 r83709 265 265 void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent = 0) const; 266 266 void cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent = 0) const; 267 void cannotAcquireMachineParameter(const CCloudMachine &comMachine, QWidget *pParent = 0) const; 267 268 268 269 /* API: Global cloud warnings: */ … … 277 278 bool confirmMachineItemRemoval(const QStringList &names) const; 278 279 int confirmMachineRemoval(const QList<CMachine> &machines) const; 280 bool confirmCloudMachineRemoval(const QList<CCloudMachine> &machines) const; 279 281 void cannotRemoveMachine(const CMachine &machine) const; 280 282 void cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const; 283 void cannotRemoveCloudMachine(const CCloudMachine &comMachine) const; 284 void cannotRemoveCloudMachine(const CCloudMachine &comMachine, const CProgress &comProgress) const; 281 285 bool warnAboutInaccessibleMedia() const; 282 286 bool confirmDiscardSavedState(const QString &strNames) const; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r83674 r83709 1953 1953 { 1954 1954 return !isGroupSavingInProgress() && 1955 isAtLeastOneItemRemovable(items) && 1956 isItemsLocal(items); 1955 isAtLeastOneItemRemovable(items); 1957 1956 } 1958 1957 case UIActionIndexST_M_Machine_S_AddGroup: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r83705 r83709 1156 1156 QList<UIChooserItem*> itemsToRemove; 1157 1157 QList<CMachine> localMachinesToUnregister; 1158 QList<CCloudMachine> cloudMachinesToUnregister; 1158 1159 1159 1160 /* For each selected machine-item: */ … … 1188 1189 verdicts.insert(uId, fVerdict); 1189 1190 if (fVerdict) 1190 localMachinesToUnregister.append(pItem->node()->toMachineNode()->cache()->toLocal()->machine()); 1191 { 1192 if (pItem->node()->toMachineNode()->cache()->itemType() == UIVirtualMachineItem::ItemType_Local) 1193 localMachinesToUnregister.append(pItem->node()->toMachineNode()->cache()->toLocal()->machine()); 1194 else if (pItem->node()->toMachineNode()->cache()->itemType() == UIVirtualMachineItem::ItemType_CloudReal) 1195 cloudMachinesToUnregister.append(pItem->node()->toMachineNode()->cache()->toCloud()->machine()); 1196 } 1191 1197 else 1192 1198 itemsToRemove << pItem; … … 1199 1205 if (!localMachinesToUnregister.isEmpty()) 1200 1206 unregisterLocalMachines(localMachinesToUnregister); 1207 /* If we have something cloud to unregister: */ 1208 if (!cloudMachinesToUnregister.isEmpty()) 1209 unregisterCloudMachines(cloudMachinesToUnregister); 1201 1210 } 1202 1211 … … 1721 1730 } 1722 1731 1732 void UIChooserModel::unregisterCloudMachines(const QList<CCloudMachine> &machines) 1733 { 1734 /* Confirm machine removal: */ 1735 if (!msgCenter().confirmCloudMachineRemoval(machines)) 1736 return; 1737 1738 /* Change selection to some close by item: */ 1739 setSelectedItem(findClosestUnselectedItem()); 1740 1741 /* For every selected machine: */ 1742 foreach (CCloudMachine comMachine, machines) 1743 { 1744 /* Remember machine ID: */ 1745 const QUuid uId = comMachine.GetId(); 1746 if (!comMachine.isOk()) 1747 { 1748 msgCenter().cannotAcquireMachineParameter(comMachine); 1749 continue; 1750 } 1751 /* Prepare unregister progress: */ 1752 CProgress comProgress = comMachine.Unregister(); 1753 if (!comMachine.isOk()) 1754 { 1755 msgCenter().cannotRemoveCloudMachine(comMachine); 1756 continue; 1757 } 1758 /* And show unregister progress finally: */ 1759 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_delete_90px.png"); 1760 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1761 { 1762 msgCenter().cannotRemoveCloudMachine(comMachine, comProgress); 1763 continue; 1764 } 1765 1766 // WORKAROUND: 1767 // Hehey! Now we have to remove deleted VM nodes and then update tree for the main root node 1768 // ourselves cause there is no corresponding event yet. So we are calling actual handler to do that. 1769 sltCloudMachineRegistered(QString() /* provider name */, 1770 QString() /* profile name */, 1771 uId /* machine ID */, 1772 false /* registered? */); 1773 } 1774 } 1775 1723 1776 bool UIChooserModel::processDragMoveEvent(QGraphicsSceneDragDropEvent *pEvent) 1724 1777 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r83705 r83709 31 31 /* COM includes: */ 32 32 #include "COMEnums.h" 33 #include "CCloudMachine.h" 33 34 #include "CMachine.h" 34 35 … … 370 371 /** Unregisters a list of local virtual @a machines. */ 371 372 void unregisterLocalMachines(const QList<CMachine> &machines); 373 /** Unregisters a list of cloud virtual @a machines. */ 374 void unregisterCloudMachines(const QList<CCloudMachine> &machines); 372 375 373 376 /** Processes drag move @a pEvent. */
Note:
See TracChangeset
for help on using the changeset viewer.