VirtualBox

Changeset 90920 in vbox


Ignore:
Timestamp:
Aug 26, 2021 4:10:52 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146557
Message:

FE/Qt: bugref:10067: Reworking r146504; UINotificationProgressMachinePowerDown needs machine wrapper in both cases.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90893 r90920  
    976976*********************************************************************************************************************************/
    977977
    978 UINotificationProgressMachinePowerOff::UINotificationProgressMachinePowerOff(const CMachine &comMachine)
     978UINotificationProgressMachinePowerOff::UINotificationProgressMachinePowerOff(const CMachine &comMachine,
     979                                                                             const CConsole &comConsole /* = CConsole() */)
    979980    : m_comMachine(comMachine)
     981    , m_comConsole(comConsole)
    980982{
    981983    connect(this, &UINotificationProgress::sigProgressFinished,
     
    983985}
    984986
    985 UINotificationProgressMachinePowerOff::UINotificationProgressMachinePowerOff(const CConsole &comConsole)
    986     : m_comConsole(comConsole)
    987 {
    988     connect(this, &UINotificationProgress::sigProgressFinished,
    989             this, &UINotificationProgressMachinePowerOff::sltHandleProgressFinished);
    990 }
    991 
    992987QString UINotificationProgressMachinePowerOff::name() const
    993988{
     
    1004999    /* Prepare machine to power off: */
    10051000    CMachine comMachine = m_comMachine;
    1006 
    1007     /* For Runtime UI: */
     1001    /* Prepare console to power off: */
     1002    CConsole comConsole = m_comConsole;
     1003
     1004    /* For Manager UI: */
    10081005    switch (uiCommon().uiType())
    10091006    {
    1010         case UICommon::UIType_RuntimeUI:
     1007        case UICommon::UIType_SelectorUI:
    10111008        {
    1012             /* Acquire VM: */
    1013             AssertReturn(m_comConsole.isNotNull(), CProgress());
    1014             comMachine = m_comConsole.GetMachine();
    1015             if (!m_comConsole.isOk())
     1009            /* Acquire VM id: */
     1010            const QUuid uId = comMachine.GetId();
     1011            if (!comMachine.isOk())
    10161012            {
    1017                 comResult = m_comConsole;
     1013                comResult = comMachine;
    10181014                return CProgress();
    10191015            }
    10201016
    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;
    1032         return CProgress();
    1033     }
    1034 
    1035     /* Acquire VM name: */
    1036     m_strName = comMachine.GetName();
    1037     if (!comMachine.isOk())
    1038     {
    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         {
    10511017            /* Open a session thru which we will modify the machine: */
    10521018            m_comSession = uiCommon().openExistingSession(uId);
     
    10801046    /* Initialize progress-wrapper: */
    10811047    CProgress comProgress = comConsole.PowerDown();
     1048
     1049    /* For Runtime UI: */
     1050    switch (uiCommon().uiType())
     1051    {
     1052        case UICommon::UIType_RuntimeUI:
     1053        {
     1054            /* Check the console state, it might be already gone: */
     1055            if (!comConsole.isNull())
     1056            {
     1057                /* This can happen if VBoxSVC is not running: */
     1058                COMResult res(comConsole);
     1059                if (FAILED_DEAD_INTERFACE(res.rc()))
     1060                    return CProgress();
     1061            }
     1062
     1063            break;
     1064        }
     1065        default:
     1066            break;
     1067    }
     1068
    10821069    /* Store COM result: */
    10831070    comResult = comConsole;
     1071
     1072    /* Acquire VM name, no error checks, too late: */
     1073    m_strName = comMachine.GetName();
     1074
    10841075    /* Return progress-wrapper: */
    10851076    return comProgress;
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90893 r90920  
    567567
    568568    /** Constructs machine power-off notification-progress.
    569       * @param  comMachine  Brings the machine being powered off. */
    570     UINotificationProgressMachinePowerOff(const CMachine &comMachine);
    571     /** Constructs machine power-off notification-progress.
    572       * @param  comConsole  Brings the console of machine being powered off. */
    573     UINotificationProgressMachinePowerOff(const CConsole &comConsole);
     569      * @param  comMachine         Brings the machine being powered off.
     570      * @param  comConsole         Brings the console of machine being powered off.
     571      * @param  fIncludingDiscard  Brings whether machine state should be discarded. */
     572    UINotificationProgressMachinePowerOff(const CMachine &comMachine,
     573                                          const CConsole &comConsole = CConsole());
    574574
    575575protected:
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette