Changeset 83065 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 12, 2020 7:38:07 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r83064 r83065 37 37 #include "UISettingsDialogSpecific.h" 38 38 #include "UIVMLogViewerDialog.h" 39 #include "UIVirtualMachineItemCloud.h" 39 40 #include "UIVirtualMachineItemLocal.h" 40 41 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER … … 846 847 continue; 847 848 848 /* Open a session to modify VM state: */ 849 CSession comSession = uiCommon().openExistingSession(pItem->id()); 850 if (comSession.isNull()) 851 return; 852 853 /* Get session console: */ 854 CConsole comConsole = comSession.GetConsole(); 855 /* Pause/resume VM: */ 856 if (fPause) 857 comConsole.Pause(); 858 else 859 comConsole.Resume(); 860 if (!comConsole.isOk()) 861 { 849 /* For local machine: */ 850 if (pItem->itemType() == UIVirtualMachineItem::ItemType_Local) 851 { 852 /* Open a session to modify VM state: */ 853 CSession comSession = uiCommon().openExistingSession(pItem->id()); 854 if (comSession.isNull()) 855 return; 856 857 /* Get session console: */ 858 CConsole comConsole = comSession.GetConsole(); 859 /* Pause/resume VM: */ 862 860 if (fPause) 863 msgCenter().cannotPauseMachine(comConsole);861 comConsole.Pause(); 864 862 else 865 msgCenter().cannotResumeMachine(comConsole); 866 } 867 868 /* Unlock machine finally: */ 869 comSession.UnlockMachine(); 863 comConsole.Resume(); 864 if (!comConsole.isOk()) 865 { 866 if (fPause) 867 msgCenter().cannotPauseMachine(comConsole); 868 else 869 msgCenter().cannotResumeMachine(comConsole); 870 } 871 872 /* Unlock machine finally: */ 873 comSession.UnlockMachine(); 874 } 875 /* For real cloud machine: */ 876 else if (pItem->itemType() == UIVirtualMachineItem::ItemType_CloudReal) 877 { 878 if (fPause) 879 pItem->toCloud()->pause(this); 880 else 881 pItem->toCloud()->resume(this); 882 } 870 883 } 871 884 } … … 1967 1980 case UIActionIndexST_M_Machine_T_Pause: 1968 1981 { 1969 return isItemsLocal(items) && 1970 isAtLeastOneItemStarted(items); 1982 return isAtLeastOneItemStarted(items); 1971 1983 } 1972 1984 case UIActionIndexST_M_Group_S_Reset: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r83056 r83065 128 128 return QString(); 129 129 } 130 131 void UIVirtualMachineItemCloud::pause(QWidget *pParent) 132 { 133 pauseOrResume(true /* pause? */, pParent); 134 } 135 136 void UIVirtualMachineItemCloud::resume(QWidget *pParent) 137 { 138 pauseOrResume(false /* pause? */, pParent); 139 } 140 141 void UIVirtualMachineItemCloud::pauseOrResume(bool fPause, QWidget *pParent) 142 { 143 /* Acquire cloud client: */ 144 CCloudClient comCloudClient = m_pCloudMachine->client(); 145 146 /* Now execute async method: */ 147 CProgress comProgress; 148 if (fPause) 149 comProgress = comCloudClient.PauseInstance(m_strId); 150 else 151 comProgress = comCloudClient.StartInstance(m_strId); 152 if (!comCloudClient.isOk()) 153 msgCenter().cannotAcquireCloudClientParameter(comCloudClient); 154 else 155 { 156 /* Show progress: */ 157 /// @todo use proper pause icon 158 if (fPause) 159 msgCenter().showModalProgressDialog(comProgress, UICommon::tr("Pause instance ..."), 160 ":/progress_reading_appliance_90px.png", pParent, 0); 161 else 162 msgCenter().showModalProgressDialog(comProgress, UICommon::tr("Start instance ..."), 163 ":/progress_start_90px.png", pParent, 0); 164 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 165 msgCenter().cannotAcquireCloudClientParameter(comProgress); 166 else 167 updateState(pParent); 168 } 169 } 170 130 171 void UIVirtualMachineItemCloud::recache() 131 172 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h
r83055 r83065 68 68 * @param pWidget Brings parent widget to show messages according to. */ 69 69 QString acquireInstanceInfo(KVirtualSystemDescriptionType enmType, QWidget *pParent); 70 71 /** Puts cloud VM on pause. 72 * @param pWidget Brings parent widget to show messages according to. */ 73 void pause(QWidget *pParent); 74 /** Resumes cloud VM execution. 75 * @param pWidget Brings parent widget to show messages according to. */ 76 void resume(QWidget *pParent); 77 /** Wrapper to handle two tasks above. 78 * @param fPause Brings whether cloud VM should be paused or resumed otherwise. 79 * @param pWidget Brings parent widget to show messages according to. */ 80 void pauseOrResume(bool fPause, QWidget *pParent); 70 81 /** @} */ 71 82
Note:
See TracChangeset
for help on using the changeset viewer.