VirtualBox

Changeset 100654 in vbox


Ignore:
Timestamp:
Jul 19, 2023 2:50:18 PM (17 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10489: VBox Manager: Adding Reset action for cloud VMs same place as for local.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r100075 r100654  
    17881788    foreach (UIVirtualMachineItem *pItem, itemsToReset)
    17891789    {
    1790         /* Open a session to modify VM state: */
    1791         CSession comSession = uiCommon().openExistingSession(pItem->id());
    1792         if (comSession.isNull())
    1793             return;
    1794 
    1795         /* Get session console: */
    1796         CConsole comConsole = comSession.GetConsole();
    1797         /* Reset VM: */
    1798         comConsole.Reset();
    1799 
    1800         /* Unlock machine finally: */
    1801         comSession.UnlockMachine();
     1790        switch (pItem->itemType())
     1791        {
     1792            case UIVirtualMachineItemType_Local:
     1793            {
     1794                /* Open a session to modify VM state: */
     1795                CSession comSession = uiCommon().openExistingSession(pItem->id());
     1796                if (comSession.isNull())
     1797                    return;
     1798
     1799                /* Get session console: */
     1800                CConsole comConsole = comSession.GetConsole();
     1801                /* Reset VM: */
     1802                comConsole.Reset();
     1803
     1804                /* Unlock machine finally: */
     1805                comSession.UnlockMachine();
     1806                break;
     1807            }
     1808            case UIVirtualMachineItemType_CloudReal:
     1809            {
     1810                /* Reset VM: */
     1811                UINotificationProgressCloudMachineReset *pNotification =
     1812                    new UINotificationProgressCloudMachineReset(pItem->toCloud()->machine());
     1813                gpNotificationCenter->append(pNotification);
     1814                break;
     1815            }
     1816            default:
     1817                break;
     1818        }
    18021819    }
    18031820}
     
    29262943        pMenu->addSeparator();
    29272944        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow));
     2945        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Reset));
    29282946        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Console)->menu());
    29292947        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Stop)->menu());
     
    29833001        pMenu->addSeparator();
    29843002        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     3003        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset));
    29853004        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Console)->menu());
    29863005        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop)->menu());
     
    35933612        case UIActionIndexMN_M_Machine_S_Reset:
    35943613        {
    3595             return isItemsLocal(items) &&
    3596                    isAtLeastOneItemRunning(items);
     3614            return isAtLeastOneItemRunning(items);
    35973615        }
    35983616        case UIActionIndexMN_M_Group_S_Detach:
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r100469 r100654  
    15491549        pMenuGroup->addSeparator();
    15501550        pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow));
     1551        pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Reset));
    15511552        pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Console)->menu());
    15521553        pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Stop)->menu());
     
    15661567        pMenuMachine->addSeparator();
    15671568        pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     1569        pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset));
    15681570        pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Console)->menu());
    15691571        pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop)->menu());
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r100606 r100654  
    31843184    if (error().isEmpty())
    31853185        emit sigCloudMachineRemoved(m_strProviderShortName, m_strProfileName, m_strName);
     3186}
     3187
     3188
     3189/*********************************************************************************************************************************
     3190*   Class UINotificationProgressCloudMachineReset implementation.                                                                *
     3191*********************************************************************************************************************************/
     3192
     3193UINotificationProgressCloudMachineReset::UINotificationProgressCloudMachineReset(const CCloudMachine &comMachine)
     3194    : m_comMachine(comMachine)
     3195{
     3196}
     3197
     3198QString UINotificationProgressCloudMachineReset::name() const
     3199{
     3200    return UINotificationProgress::tr("Resetting cloud VM ...");
     3201}
     3202
     3203QString UINotificationProgressCloudMachineReset::details() const
     3204{
     3205    return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
     3206}
     3207
     3208CProgress UINotificationProgressCloudMachineReset::createProgress(COMResult &comResult)
     3209{
     3210    /* Acquire cloud VM name: */
     3211    m_strName = m_comMachine.GetName();
     3212    if (!m_comMachine.isOk())
     3213    {
     3214        /* Store COM result: */
     3215        comResult = m_comMachine;
     3216        /* Return progress-wrapper: */
     3217        return CProgress();
     3218    }
     3219
     3220    /* Initialize progress-wrapper: */
     3221    CProgress comProgress = m_comMachine.Reset();
     3222    /* Store COM result: */
     3223    comResult = m_comMachine;
     3224    /* Return progress-wrapper: */
     3225    return comProgress;
    31863226}
    31873227
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r100606 r100654  
    18221822};
    18231823
     1824/** UINotificationProgress extension for cloud machine reset functionality. */
     1825class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineReset : public UINotificationProgress
     1826{
     1827    Q_OBJECT;
     1828
     1829public:
     1830
     1831    /** Constructs cloud machine reset notification-progress.
     1832      * @param  comMachine  Brings the machine being reset. */
     1833    UINotificationProgressCloudMachineReset(const CCloudMachine &comMachine);
     1834
     1835protected:
     1836
     1837    /** Returns object name. */
     1838    virtual QString name() const /* override final */;
     1839    /** Returns object details. */
     1840    virtual QString details() const /* override final */;
     1841    /** Creates and returns started progress-wrapper. */
     1842    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     1843
     1844private:
     1845
     1846    /** Holds the machine being reset. */
     1847    CCloudMachine  m_comMachine;
     1848    /** Holds the machine name. */
     1849    QString        m_strName;
     1850};
     1851
    18241852/** UINotificationProgress extension for cloud machine power-off functionality. */
    18251853class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachinePowerOff : 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