- Timestamp:
- Aug 25, 2021 10:21:27 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r90855 r90869 1821 1821 /* Powering VM down: */ 1822 1822 UINotificationProgressMachinePowerDown *pNotification = 1823 new UINotificationProgressMachinePowerDown(pItem-> id());1823 new UINotificationProgressMachinePowerDown(pItem->toLocal()->machine()); 1824 1824 gpNotificationCenter->append(pNotification); 1825 1825 } -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90856 r90869 976 976 *********************************************************************************************************************************/ 977 977 978 UINotificationProgressMachinePowerDown::UINotificationProgressMachinePowerDown(const QUuid &uId)979 : m_ uId(uId)978 UINotificationProgressMachinePowerDown::UINotificationProgressMachinePowerDown(const CMachine &comMachine) 979 : m_comMachine(comMachine) 980 980 { 981 981 connect(this, &UINotificationProgress::sigProgressFinished, … … 983 983 } 984 984 985 UINotificationProgressMachinePowerDown::UINotificationProgressMachinePowerDown(const CConsole &comConsole) 986 : m_comConsole(comConsole) 987 { 988 connect(this, &UINotificationProgress::sigProgressFinished, 989 this, &UINotificationProgressMachinePowerDown::sltHandleProgressFinished); 990 } 991 985 992 QString UINotificationProgressMachinePowerDown::name() const 986 993 { … … 995 1002 CProgress UINotificationProgressMachinePowerDown::createProgress(COMResult &comResult) 996 1003 { 997 /* Open a session thru which we will modify the machine: */ 998 m_comSession = uiCommon().openExistingSession(m_uId); 999 if (m_comSession.isNull()) 1000 return CProgress(); 1001 1002 /* Get session machine: */ 1003 CMachine comMachine = m_comSession.GetMachine(); 1004 if (!m_comSession.isOk()) 1005 { 1006 comResult = m_comSession; 1007 m_comSession.UnlockMachine(); 1004 /* Prepare machine to power off: */ 1005 CMachine comMachine = m_comMachine; 1006 1007 /* For Runtime UI: */ 1008 switch (uiCommon().uiType()) 1009 { 1010 case UICommon::UIType_RuntimeUI: 1011 { 1012 /* Acquire VM: */ 1013 AssertReturn(m_comConsole.isNotNull(), CProgress()); 1014 comMachine = m_comConsole.GetMachine(); 1015 if (!m_comConsole.isOk()) 1016 { 1017 comResult = m_comConsole; 1018 return CProgress(); 1019 } 1020 1021 break; 1022 } 1023 default: 1024 break; 1025 } 1026 1027 /* Acquire VM id: */ 1028 const QUuid uId = comMachine.GetId(); 1029 if (!comMachine.isOk()) 1030 { 1031 comResult = comMachine; 1008 1032 return CProgress(); 1009 1033 } … … 1014 1038 { 1015 1039 comResult = comMachine; 1040 return CProgress(); 1041 } 1042 1043 /* Prepare console to power off: */ 1044 CConsole comConsole = m_comConsole; 1045 1046 /* For Manager UI: */ 1047 switch (uiCommon().uiType()) 1048 { 1049 case UICommon::UIType_SelectorUI: 1050 { 1051 /* Open a session thru which we will modify the machine: */ 1052 m_comSession = uiCommon().openExistingSession(uId); 1053 if (m_comSession.isNull()) 1054 return CProgress(); 1055 1056 /* Get session machine: */ 1057 comMachine = m_comSession.GetMachine(); 1058 if (!m_comSession.isOk()) 1059 { 1060 comResult = m_comSession; 1061 m_comSession.UnlockMachine(); 1062 return CProgress(); 1063 } 1064 1065 /* Get session console: */ 1066 comConsole = m_comSession.GetConsole(); 1067 if (!m_comSession.isOk()) 1068 { 1069 comResult = m_comSession; 1070 m_comSession.UnlockMachine(); 1071 return CProgress(); 1072 } 1073 1074 break; 1075 } 1076 default: 1077 break; 1078 } 1079 1080 /* Initialize progress-wrapper: */ 1081 CProgress comProgress = comConsole.PowerDown(); 1082 /* Store COM result: */ 1083 comResult = comConsole; 1084 /* Return progress-wrapper: */ 1085 return comProgress; 1086 } 1087 1088 void UINotificationProgressMachinePowerDown::sltHandleProgressFinished() 1089 { 1090 /* Unlock session finally: */ 1091 if (m_comSession.isNotNull()) 1016 1092 m_comSession.UnlockMachine(); 1017 return CProgress();1018 }1019 1020 /* Get session console: */1021 CConsole comConsole = m_comSession.GetConsole();1022 if (!m_comSession.isOk())1023 {1024 comResult = m_comSession;1025 m_comSession.UnlockMachine();1026 return CProgress();1027 }1028 1029 /* Initialize progress-wrapper: */1030 CProgress comProgress = comConsole.PowerDown();1031 /* Store COM result: */1032 comResult = comConsole;1033 /* Return progress-wrapper: */1034 return comProgress;1035 }1036 1037 void UINotificationProgressMachinePowerDown::sltHandleProgressFinished()1038 {1039 /* Unlock session finally: */1040 m_comSession.UnlockMachine();1041 1093 } 1042 1094 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90856 r90869 34 34 #include "CCloudClient.h" 35 35 #include "CCloudMachine.h" 36 #include "CConsole.h" 36 37 #include "CExtPackFile.h" 37 38 #include "CExtPackManager.h" … … 47 48 /* Forward declarations: */ 48 49 class CAudioAdapter; 49 class CConsole;50 50 class CEmulatedUSB; 51 51 class CNetworkAdapter; … … 567 567 568 568 /** Constructs machine power-down notification-progress. 569 * @param uId Brings the machine id. */ 570 UINotificationProgressMachinePowerDown(const QUuid &uId); 571 572 protected: 573 574 /** Returns object name. */ 575 virtual QString name() const /* override final */; 576 /** Returns object details. */ 577 virtual QString details() const /* override final */; 578 /** Creates and returns started progress-wrapper. */ 579 virtual CProgress createProgress(COMResult &comResult) /* override final */; 580 581 private slots: 582 583 /** Handles signal about progress being finished. */ 584 void sltHandleProgressFinished(); 585 586 private: 587 588 /** Holds the machine id. */ 589 QUuid m_uId; 569 * @param comMachine Brings the machine being powered off. */ 570 UINotificationProgressMachinePowerDown(const CMachine &comMachine); 571 /** Constructs machine power-down notification-progress. 572 * @param comConsole Brings the console of machine being powered off. */ 573 UINotificationProgressMachinePowerDown(const CConsole &comConsole); 574 575 protected: 576 577 /** Returns object name. */ 578 virtual QString name() const /* override final */; 579 /** Returns object details. */ 580 virtual QString details() const /* override final */; 581 /** Creates and returns started progress-wrapper. */ 582 virtual CProgress createProgress(COMResult &comResult) /* override final */; 583 584 private slots: 585 586 /** Handles signal about progress being finished. */ 587 void sltHandleProgressFinished(); 588 589 private: 590 591 /** Holds the machine being powered off. */ 592 CMachine m_comMachine; 593 /** Holds the console of machine being powered off. */ 594 CConsole m_comConsole; 590 595 /** Holds the session being opened. */ 591 596 CSession m_comSession;
Note:
See TracChangeset
for help on using the changeset viewer.