VirtualBox

Changeset 90922 in vbox


Ignore:
Timestamp:
Aug 26, 2021 4:17:20 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Notification signature for virtual machine power-off progress (in Runtime UI) which should now go to center instead of modal dialogs, s.a. r145997.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

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

    r90920 r90922  
    977977
    978978UINotificationProgressMachinePowerOff::UINotificationProgressMachinePowerOff(const CMachine &comMachine,
    979                                                                              const CConsole &comConsole /* = CConsole() */)
     979                                                                             const CConsole &comConsole /* = CConsole() */,
     980                                                                             bool fIncludingDiscard /* = false */)
    980981    : m_comMachine(comMachine)
    981982    , m_comConsole(comConsole)
     983    , m_fIncludingDiscard(fIncludingDiscard)
    982984{
    983985    connect(this, &UINotificationProgress::sigProgressFinished,
     
    10821084    if (m_comSession.isNotNull())
    10831085        m_comSession.UnlockMachine();
     1086
     1087    /* Notifies listeners: */
     1088    emit sigMachinePoweredOff(error().isEmpty(), m_fIncludingDiscard);
    10841089}
    10851090
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90920 r90922  
    564564    Q_OBJECT;
    565565
     566signals:
     567
     568    /** Notifies listeners about machine powered off.
     569      * @param  fSuccess           Brings whether power off sequence successfully.
     570      * @param  fIncludingDiscard  Brings whether machine state should be discarded. */
     571    void sigMachinePoweredOff(bool fSuccess, bool fIncludingDiscard);
     572
    566573public:
    567574
     
    571578      * @param  fIncludingDiscard  Brings whether machine state should be discarded. */
    572579    UINotificationProgressMachinePowerOff(const CMachine &comMachine,
    573                                           const CConsole &comConsole = CConsole());
     580                                          const CConsole &comConsole = CConsole(),
     581                                          bool fIncludingDiscard = false);
    574582
    575583protected:
     
    593601    /** Holds the console of machine being powered off. */
    594602    CConsole  m_comConsole;
     603    /** Holds whether machine state should be discarded. */
     604    bool      m_fIncludingDiscard;
    595605    /** Holds the session being opened. */
    596606    CSession  m_comSession;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r90893 r90922  
    371371void UISession::powerOff(bool fIncludingDiscard)
    372372{
    373     /* Prepare result: */
    374     bool fSuccess = false;
    375 
    376373    /* Enable 'manual-override',
    377374     * preventing automatic Runtime UI closing: */
    378375    setManualOverrideMode(true);
    379376
    380     /* Prepare the power-off progress: */
     377    /* Now, do the magic: */
    381378    LogRel(("GUI: Powering VM off..\n"));
    382     CProgress comProgress = console().PowerDown();
    383     if (!console().isOk())
    384     {
    385         /* Check the console state, it might be already gone: */
    386         if (!console().isNull())
    387         {
    388             /* This can happen if VBoxSVC is not running: */
    389             COMResult res(console());
    390             if (FAILED_DEAD_INTERFACE(res.rc()))
    391                fSuccess = true;
    392         }
    393 
    394         if (!fSuccess)
    395             msgCenter().cannotPowerOffMachine(console());
    396     }
    397     else
    398     {
    399         /* Show the power-off progress: */
    400         msgCenter().showModalProgressDialog(comProgress, machineName(), ":/progress_poweroff_90px.png");
    401         if (comProgress.isOk() && comProgress.GetResultCode() == 0)
    402         {
    403             fSuccess = true;
    404 
    405             /* Discard the current state if requested: */
    406             if (fIncludingDiscard)
    407                 uiCommon().restoreCurrentSnapshot(uiCommon().managedVMUuid());
    408         }
    409         else
    410             msgCenter().cannotPowerOffMachine(comProgress, machineName());
    411     }
    412 
    413     /* Disable 'manual-override' finally: */
    414     setManualOverrideMode(false);
    415 
    416     /* Manually close Runtime UI: */
    417     if (fSuccess)
    418         closeRuntimeUI();
     379    UINotificationProgressMachinePowerOff *pNotification =
     380        new UINotificationProgressMachinePowerOff(machine(), console(), fIncludingDiscard);
     381    connect(pNotification, &UINotificationProgressMachinePowerOff::sigMachinePoweredOff,
     382            this, &UISession::sltHandleMachinePoweredOff);
     383    gpNotificationCenter->append(pNotification);
    419384}
    420385
     
    850815    if (fSuccess)
    851816        closeRuntimeUI();
     817}
     818
     819void UISession::sltHandleMachinePoweredOff(bool fSuccess, bool fIncludingDiscard)
     820{
     821    /* Disable 'manual-override' finally: */
     822    setManualOverrideMode(false);
     823
     824    /* Do we have other tasks? */
     825    if (fSuccess)
     826    {
     827        if (fIncludingDiscard)
     828            uiCommon().restoreCurrentSnapshot(uiCommon().managedVMUuid());
     829        closeRuntimeUI();
     830    }
    852831}
    853832
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r90893 r90922  
    403403      * @param  fSuccess  Brings whether state was saved successfully. */
    404404    void sltHandleMachineStateSaved(bool fSuccess);
     405    /** Handles signal about machine powered off.
     406      * @param  fSuccess           Brings whether machine was powered off successfully.
     407      * @param  fIncludingDiscard  Brings whether machine state should be discarded. */
     408    void sltHandleMachinePoweredOff(bool fSuccess, bool fIncludingDiscard);
    405409
    406410private:
Note: See TracChangeset for help on using the changeset viewer.

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