VirtualBox

Changeset 90411 in vbox for trunk/src


Ignore:
Timestamp:
Jul 29, 2021 2:16:15 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Notification signature for virtual cloud machine terminate progress (in UIVirtualBoxManager) which should now go to center instead of modal dialogs; A bit of cleanup and sanity checks besides that.

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  
    12471247                            if (strConsoleConnectionFingerprint.isEmpty())
    12481248                            {
    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);
    12591254                            }
    12601255                        }
     
    12941289                    if (strConsoleConnectionFingerprint.isEmpty())
    12951290                    {
    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);
    13061296                    }
    13071297                }
     
    13381328                    if (!strConsoleConnectionFingerprint.isEmpty())
    13391329                    {
    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);
    13491334                    }
    13501335                }
     
    13751360            if (!strConsoleConnectionFingerprint.isEmpty())
    13761361            {
    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);
    13861366            }
    13871367        }
     
    17021682    foreach (UIVirtualMachineItem *pItem, items)
    17031683    {
     1684        /* Sanity check: */
     1685        AssertPtrReturnVoid(pItem);
     1686
    17041687        /* Check if current item could be saved: */
    1705         AssertPtrReturnVoid(pItem);
    17061688        if (!isActionEnabled(UIActionIndexMN_M_Machine_M_Close_S_SaveState, QList<UIVirtualMachineItem*>() << pItem))
    17071689            continue;
     
    17401722    foreach (UIVirtualMachineItem *pItem, itemsToTerminate)
    17411723    {
    1742         /* Get cloud machine: */
     1724        /* Sanity check: */
    17431725        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);
    17651731    }
    17661732}
     
    17921758    foreach (UIVirtualMachineItem *pItem, itemsToShutdown)
    17931759    {
     1760        /* Sanity check: */
     1761        AssertPtrReturnVoid(pItem);
     1762
    17941763        /* For local machine: */
    17951764        if (pItem->itemType() == UIVirtualMachineItemType_Local)
     
    18151784            /* Shutting cloud VM down: */
    18161785            UINotificationProgressCloudMachineShutdown *pNotification =
    1817                     new UINotificationProgressCloudMachineShutdown(pItem->toCloud()->machine());
     1786                new UINotificationProgressCloudMachineShutdown(pItem->toCloud()->machine());
    18181787            notificationCenter().append(pNotification);
    18191788        }
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90410 r90411  
    749749
    750750/*********************************************************************************************************************************
     751*   Class UINotificationProgressCloudMachineTerminate implementation.                                                            *
     752*********************************************************************************************************************************/
     753
     754UINotificationProgressCloudMachineTerminate::UINotificationProgressCloudMachineTerminate(const CCloudMachine &comMachine)
     755    : m_comMachine(comMachine)
     756{
     757}
     758
     759QString UINotificationProgressCloudMachineTerminate::name() const
     760{
     761    return   UINotificationProgress::tr("Terminating cloud VM ...");
     762}
     763
     764QString UINotificationProgressCloudMachineTerminate::details() const
     765{
     766    return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
     767}
     768
     769CProgress 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/*********************************************************************************************************************************
    751791*   Class UINotificationProgressCloudConsoleConnectionCreate implementation.                                                     *
    752792*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90410 r90411  
    588588};
    589589
     590/** UINotificationProgress extension for cloud machine terminate functionality. */
     591class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineTerminate : public UINotificationProgress
     592{
     593    Q_OBJECT;
     594
     595public:
     596
     597    /** Constructs cloud machine terminate notification-progress.
     598      * @param  comMachine  Brings the machine being terminate. */
     599    UINotificationProgressCloudMachineTerminate(const CCloudMachine &comMachine);
     600
     601protected:
     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
     610private:
     611
     612    /** Holds the machine being terminated. */
     613    CCloudMachine  m_comMachine;
     614    /** Holds the machine name. */
     615    QString        m_strName;
     616};
     617
    590618/** UINotificationProgress extension for cloud console connection create functionality. */
    591619class SHARED_LIBRARY_STUFF UINotificationProgressCloudConsoleConnectionCreate : public UINotificationProgress
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette