Changeset 100654 in vbox
- Timestamp:
- Jul 19, 2023 2:50:18 PM (17 months ago)
- 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 1788 1788 foreach (UIVirtualMachineItem *pItem, itemsToReset) 1789 1789 { 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 } 1802 1819 } 1803 1820 } … … 2926 2943 pMenu->addSeparator(); 2927 2944 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)); 2945 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Reset)); 2928 2946 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Console)->menu()); 2929 2947 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Stop)->menu()); … … 2983 3001 pMenu->addSeparator(); 2984 3002 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 3003 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset)); 2985 3004 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Console)->menu()); 2986 3005 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop)->menu()); … … 3593 3612 case UIActionIndexMN_M_Machine_S_Reset: 3594 3613 { 3595 return isItemsLocal(items) && 3596 isAtLeastOneItemRunning(items); 3614 return isAtLeastOneItemRunning(items); 3597 3615 } 3598 3616 case UIActionIndexMN_M_Group_S_Detach: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r100469 r100654 1549 1549 pMenuGroup->addSeparator(); 1550 1550 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)); 1551 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Reset)); 1551 1552 pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Console)->menu()); 1552 1553 pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Stop)->menu()); … … 1566 1567 pMenuMachine->addSeparator(); 1567 1568 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 1569 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset)); 1568 1570 pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Console)->menu()); 1569 1571 pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop)->menu()); -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r100606 r100654 3184 3184 if (error().isEmpty()) 3185 3185 emit sigCloudMachineRemoved(m_strProviderShortName, m_strProfileName, m_strName); 3186 } 3187 3188 3189 /********************************************************************************************************************************* 3190 * Class UINotificationProgressCloudMachineReset implementation. * 3191 *********************************************************************************************************************************/ 3192 3193 UINotificationProgressCloudMachineReset::UINotificationProgressCloudMachineReset(const CCloudMachine &comMachine) 3194 : m_comMachine(comMachine) 3195 { 3196 } 3197 3198 QString UINotificationProgressCloudMachineReset::name() const 3199 { 3200 return UINotificationProgress::tr("Resetting cloud VM ..."); 3201 } 3202 3203 QString UINotificationProgressCloudMachineReset::details() const 3204 { 3205 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName); 3206 } 3207 3208 CProgress 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; 3186 3226 } 3187 3227 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r100606 r100654 1822 1822 }; 1823 1823 1824 /** UINotificationProgress extension for cloud machine reset functionality. */ 1825 class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineReset : public UINotificationProgress 1826 { 1827 Q_OBJECT; 1828 1829 public: 1830 1831 /** Constructs cloud machine reset notification-progress. 1832 * @param comMachine Brings the machine being reset. */ 1833 UINotificationProgressCloudMachineReset(const CCloudMachine &comMachine); 1834 1835 protected: 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 1844 private: 1845 1846 /** Holds the machine being reset. */ 1847 CCloudMachine m_comMachine; 1848 /** Holds the machine name. */ 1849 QString m_strName; 1850 }; 1851 1824 1852 /** UINotificationProgress extension for cloud machine power-off functionality. */ 1825 1853 class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachinePowerOff : public UINotificationProgress
Note:
See TracChangeset
for help on using the changeset viewer.