- Timestamp:
- Apr 17, 2020 1:34:45 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137273
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r83709 r83752 931 931 .arg(CConsole(console).GetMachine().GetName()), 932 932 UIErrorString::formatErrorInfo(console)); 933 } 934 935 void UIMessageCenter::cannotPowerDownMachine(const CCloudMachine &comMachine) const 936 { 937 error(0, MessageType_Error, 938 tr("Failed to stop the virtual machine <b>%1</b>.") 939 .arg(CCloudMachine(comMachine).GetName()), 940 UIErrorString::formatErrorInfo(comMachine)); 933 941 } 934 942 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r83709 r83752 295 295 void cannotACPIShutdownMachine(const CConsole &console) const; 296 296 void cannotPowerDownMachine(const CConsole &console) const; 297 void cannotPowerDownMachine(const CCloudMachine &comMachine) const; 297 298 void cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const; 298 299 bool confirmStartMultipleMachines(const QString &strNames) const; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r83751 r83752 847 847 continue; 848 848 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: */ 849 /* Open a session to modify VM state: */ 850 CSession comSession = uiCommon().openExistingSession(pItem->id()); 851 if (comSession.isNull()) 852 return; 853 854 /* Get session console: */ 855 CConsole comConsole = comSession.GetConsole(); 856 /* Pause/resume VM: */ 857 if (fPause) 858 comConsole.Pause(); 859 else 860 comConsole.Resume(); 861 if (!comConsole.isOk()) 862 { 860 863 if (fPause) 861 comConsole.Pause();864 msgCenter().cannotPauseMachine(comConsole); 862 865 else 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 } 866 msgCenter().cannotResumeMachine(comConsole); 867 } 868 869 /* Unlock machine finally: */ 870 comSession.UnlockMachine(); 883 871 } 884 872 } … … 1059 1047 foreach (UIVirtualMachineItem *pItem, itemsToPowerOff) 1060 1048 { 1061 /* Open a session to modify VM state: */ 1062 CSession comSession = uiCommon().openExistingSession(pItem->id()); 1063 if (comSession.isNull()) 1064 break; 1065 1066 /* Get session console: */ 1067 CConsole comConsole = comSession.GetConsole(); 1068 /* Prepare machine power down: */ 1069 CProgress comProgress = comConsole.PowerDown(); 1070 if (!comConsole.isOk()) 1071 msgCenter().cannotPowerDownMachine(comConsole); 1072 else 1073 { 1074 /* Show machine power down progress: */ 1075 msgCenter().showModalProgressDialog(comProgress, pItem->name(), ":/progress_poweroff_90px.png"); 1076 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1077 msgCenter().cannotPowerDownMachine(comProgress, pItem->name()); 1078 } 1079 1080 /* Unlock machine finally: */ 1081 comSession.UnlockMachine(); 1049 /* For local machine: */ 1050 if (pItem->itemType() == UIVirtualMachineItem::ItemType_Local) 1051 { 1052 /* Open a session to modify VM state: */ 1053 CSession comSession = uiCommon().openExistingSession(pItem->id()); 1054 if (comSession.isNull()) 1055 break; 1056 1057 /* Get session console: */ 1058 CConsole comConsole = comSession.GetConsole(); 1059 /* Prepare machine power down: */ 1060 CProgress comProgress = comConsole.PowerDown(); 1061 if (!comConsole.isOk()) 1062 msgCenter().cannotPowerDownMachine(comConsole); 1063 else 1064 { 1065 /* Show machine power down progress: */ 1066 msgCenter().showModalProgressDialog(comProgress, pItem->name(), ":/progress_poweroff_90px.png"); 1067 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1068 msgCenter().cannotPowerDownMachine(comProgress, pItem->name()); 1069 } 1070 1071 /* Unlock machine finally: */ 1072 comSession.UnlockMachine(); 1073 } 1074 /* For real cloud machine: */ 1075 else if (pItem->itemType() == UIVirtualMachineItem::ItemType_CloudReal) 1076 { 1077 /* Acquire cloud machine: */ 1078 CCloudMachine comCloudMachine = pItem->toCloud()->machine(); 1079 /* Prepare machine power down: */ 1080 CProgress comProgress = comCloudMachine.PowerDown(); 1081 if (!comCloudMachine.isOk()) 1082 msgCenter().cannotPowerDownMachine(comCloudMachine); 1083 else 1084 { 1085 /* Show machine power down progress: */ 1086 msgCenter().showModalProgressDialog(comProgress, pItem->name(), ":/progress_poweroff_90px.png"); 1087 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1088 msgCenter().cannotPowerDownMachine(comProgress, pItem->name()); 1089 /* Update info in any case: */ 1090 pItem->toCloud()->updateInfoAsync(false /* delayed? */); 1091 } 1092 } 1082 1093 } 1083 1094 } … … 1992 2003 case UIActionIndexST_M_Machine_T_Pause: 1993 2004 { 1994 return isAtLeastOneItemStarted(items); 2005 return isItemsLocal(items) && 2006 isAtLeastOneItemStarted(items); 1995 2007 } 1996 2008 case UIActionIndexST_M_Group_S_Reset: … … 2024 2036 case UIActionIndexST_M_Machine_M_Close: 2025 2037 { 2026 return isItemsLocal(items) && 2027 isAtLeastOneItemStarted(items); 2038 return isAtLeastOneItemStarted(items); 2028 2039 } 2029 2040 case UIActionIndexST_M_Group_M_Close_S_Detach: … … 2049 2060 case UIActionIndexST_M_Machine_M_Close_S_PowerOff: 2050 2061 { 2051 return isItemsLocal(items) && 2052 isActionEnabled(UIActionIndexST_M_Machine_M_Close, items); 2062 return isActionEnabled(UIActionIndexST_M_Machine_M_Close, items); 2053 2063 } 2054 2064 default:
Note:
See TracChangeset
for help on using the changeset viewer.