- Timestamp:
- Jul 29, 2021 2:16:15 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r90410 r90411 1247 1247 if (strConsoleConnectionFingerprint.isEmpty()) 1248 1248 { 1249 /* Acquire machine name: */ 1250 QString strName; 1251 if (cloudMachineName(comMachine, strName)) 1252 { 1253 /* Create cloud console connection: */ 1254 UINotificationProgressCloudConsoleConnectionCreate *pNotification = 1255 new UINotificationProgressCloudConsoleConnectionCreate(comMachine, 1256 pDialog->publicKey()); 1257 notificationCenter().append(pNotification); 1258 } 1249 /* Create cloud console connection: */ 1250 UINotificationProgressCloudConsoleConnectionCreate *pNotification = 1251 new UINotificationProgressCloudConsoleConnectionCreate(comMachine, 1252 pDialog->publicKey()); 1253 notificationCenter().append(pNotification); 1259 1254 } 1260 1255 } … … 1294 1289 if (strConsoleConnectionFingerprint.isEmpty()) 1295 1290 { 1296 /* Acquire machine name: */ 1297 QString strName; 1298 if (cloudMachineName(comMachine, strName)) 1299 { 1300 /* Create cloud console connection: */ 1301 UINotificationProgressCloudConsoleConnectionCreate *pNotification = 1302 new UINotificationProgressCloudConsoleConnectionCreate(comMachine, 1303 pDialog->publicKey()); 1304 notificationCenter().append(pNotification); 1305 } 1291 /* Create cloud console connection: */ 1292 UINotificationProgressCloudConsoleConnectionCreate *pNotification = 1293 new UINotificationProgressCloudConsoleConnectionCreate(comMachine, 1294 pDialog->publicKey()); 1295 notificationCenter().append(pNotification); 1306 1296 } 1307 1297 } … … 1338 1328 if (!strConsoleConnectionFingerprint.isEmpty()) 1339 1329 { 1340 /* Acquire machine name: */ 1341 QString strName; 1342 if (cloudMachineName(comMachine, strName)) 1343 { 1344 /* Delete cloud console connection: */ 1345 UINotificationProgressCloudConsoleConnectionDelete *pNotification = 1346 new UINotificationProgressCloudConsoleConnectionDelete(comMachine); 1347 notificationCenter().append(pNotification); 1348 } 1330 /* Delete cloud console connection: */ 1331 UINotificationProgressCloudConsoleConnectionDelete *pNotification = 1332 new UINotificationProgressCloudConsoleConnectionDelete(comMachine); 1333 notificationCenter().append(pNotification); 1349 1334 } 1350 1335 } … … 1375 1360 if (!strConsoleConnectionFingerprint.isEmpty()) 1376 1361 { 1377 /* Acquire machine name: */ 1378 QString strName; 1379 if (cloudMachineName(comMachine, strName)) 1380 { 1381 /* Delete cloud console connection: */ 1382 UINotificationProgressCloudConsoleConnectionDelete *pNotification = 1383 new UINotificationProgressCloudConsoleConnectionDelete(comMachine); 1384 notificationCenter().append(pNotification); 1385 } 1362 /* Delete cloud console connection: */ 1363 UINotificationProgressCloudConsoleConnectionDelete *pNotification = 1364 new UINotificationProgressCloudConsoleConnectionDelete(comMachine); 1365 notificationCenter().append(pNotification); 1386 1366 } 1387 1367 } … … 1702 1682 foreach (UIVirtualMachineItem *pItem, items) 1703 1683 { 1684 /* Sanity check: */ 1685 AssertPtrReturnVoid(pItem); 1686 1704 1687 /* Check if current item could be saved: */ 1705 AssertPtrReturnVoid(pItem);1706 1688 if (!isActionEnabled(UIActionIndexMN_M_Machine_M_Close_S_SaveState, QList<UIVirtualMachineItem*>() << pItem)) 1707 1689 continue; … … 1740 1722 foreach (UIVirtualMachineItem *pItem, itemsToTerminate) 1741 1723 { 1742 /* Get cloud machine: */1724 /* Sanity check: */ 1743 1725 AssertPtrReturnVoid(pItem); 1744 UIVirtualMachineItemCloud *pCloudItem = pItem->toCloud(); 1745 AssertPtrReturnVoid(pCloudItem); 1746 CCloudMachine comMachine = pCloudItem->machine(); 1747 1748 /* Acquire machine name: */ 1749 QString strName; 1750 if (!cloudMachineName(comMachine, strName)) 1751 continue; 1752 1753 /* Prepare terminate cloud instance progress: */ 1754 CProgress comProgress = comMachine.Terminate(); 1755 if (!comMachine.isOk()) 1756 { 1757 msgCenter().cannotTerminateCloudInstance(comMachine); 1758 continue; 1759 } 1760 1761 /* Show terminate cloud instance progress: */ 1762 msgCenter().showModalProgressDialog(comProgress, strName, ":/progress_delete_cloud_vm_90px.png", 0, 0); 1763 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1764 msgCenter().cannotTerminateCloudInstance(comProgress, strName); 1726 1727 /* Terminating cloud VM: */ 1728 UINotificationProgressCloudMachineTerminate *pNotification = 1729 new UINotificationProgressCloudMachineTerminate(pItem->toCloud()->machine()); 1730 notificationCenter().append(pNotification); 1765 1731 } 1766 1732 } … … 1792 1758 foreach (UIVirtualMachineItem *pItem, itemsToShutdown) 1793 1759 { 1760 /* Sanity check: */ 1761 AssertPtrReturnVoid(pItem); 1762 1794 1763 /* For local machine: */ 1795 1764 if (pItem->itemType() == UIVirtualMachineItemType_Local) … … 1815 1784 /* Shutting cloud VM down: */ 1816 1785 UINotificationProgressCloudMachineShutdown *pNotification = 1817 1786 new UINotificationProgressCloudMachineShutdown(pItem->toCloud()->machine()); 1818 1787 notificationCenter().append(pNotification); 1819 1788 } -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90410 r90411 749 749 750 750 /********************************************************************************************************************************* 751 * Class UINotificationProgressCloudMachineTerminate implementation. * 752 *********************************************************************************************************************************/ 753 754 UINotificationProgressCloudMachineTerminate::UINotificationProgressCloudMachineTerminate(const CCloudMachine &comMachine) 755 : m_comMachine(comMachine) 756 { 757 } 758 759 QString UINotificationProgressCloudMachineTerminate::name() const 760 { 761 return UINotificationProgress::tr("Terminating cloud VM ..."); 762 } 763 764 QString UINotificationProgressCloudMachineTerminate::details() const 765 { 766 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName); 767 } 768 769 CProgress UINotificationProgressCloudMachineTerminate::createProgress(COMResult &comResult) 770 { 771 /* Acquire cloud VM name: */ 772 m_strName = m_comMachine.GetName(); 773 if (!m_comMachine.isOk()) 774 { 775 /* Store COM result: */ 776 comResult = m_comMachine; 777 /* Return progress-wrapper: */ 778 return CProgress(); 779 } 780 781 /* Initialize progress-wrapper: */ 782 CProgress comProgress = m_comMachine.Terminate(); 783 /* Store COM result: */ 784 comResult = m_comMachine; 785 /* Return progress-wrapper: */ 786 return comProgress; 787 } 788 789 790 /********************************************************************************************************************************* 751 791 * Class UINotificationProgressCloudConsoleConnectionCreate implementation. * 752 792 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90410 r90411 588 588 }; 589 589 590 /** UINotificationProgress extension for cloud machine terminate functionality. */ 591 class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineTerminate : public UINotificationProgress 592 { 593 Q_OBJECT; 594 595 public: 596 597 /** Constructs cloud machine terminate notification-progress. 598 * @param comMachine Brings the machine being terminate. */ 599 UINotificationProgressCloudMachineTerminate(const CCloudMachine &comMachine); 600 601 protected: 602 603 /** Returns object name. */ 604 virtual QString name() const /* override final */; 605 /** Returns object details. */ 606 virtual QString details() const /* override final */; 607 /** Creates and returns started progress-wrapper. */ 608 virtual CProgress createProgress(COMResult &comResult) /* override final */; 609 610 private: 611 612 /** Holds the machine being terminated. */ 613 CCloudMachine m_comMachine; 614 /** Holds the machine name. */ 615 QString m_strName; 616 }; 617 590 618 /** UINotificationProgress extension for cloud console connection create functionality. */ 591 619 class SHARED_LIBRARY_STUFF UINotificationProgressCloudConsoleConnectionCreate : public UINotificationProgress
Note:
See TracChangeset
for help on using the changeset viewer.