VirtualBox

Changeset 90856 in vbox


Ignore:
Timestamp:
Aug 24, 2021 6:08:54 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146491
Message:

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

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

Legend:

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

    r90855 r90856  
    966966    if (m_comSession.isNotNull())
    967967        m_comSession.UnlockMachine();
     968
     969    /* Notifies listeners: */
     970    emit sigMachineStateSaved(error().isEmpty());
    968971}
    969972
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90855 r90856  
    523523    Q_OBJECT;
    524524
     525signals:
     526
     527    /** Notifies listeners about machine state saved.
     528      * @param  fSuccess  Brings whether state was saved successfully. */
     529    void sigMachineStateSaved(bool fSuccess);
     530
    525531public:
    526532
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r90695 r90856  
    404404void UIMachineLogic::saveState()
    405405{
    406     /* Enable 'manual-override',
    407      * preventing automatic Runtime UI closing: */
    408     setManualOverrideMode(true);
    409 
    410     /* Was the step successful? */
    411     bool fSuccess = true;
    412     /* If VM is not paused, we should pause it: */
    413     bool fWasPaused = uisession()->isPaused();
    414     if (fSuccess && !fWasPaused)
    415         fSuccess = uisession()->pause();
    416     /* Save-state: */
    417     if (fSuccess)
    418     {
     406    /* Do we save state? */
     407    bool fSaveState = true;
     408
     409    /* If VM is not paused, we should pause it first: */
     410    if (!uisession()->isPaused())
     411        fSaveState = uisession()->pause();
     412
     413    /* Saving state: */
     414    if (fSaveState)
     415    {
     416        /* Enable 'manual-override',
     417         * preventing automatic Runtime UI closing: */
     418        setManualOverrideMode(true);
     419
     420        /* Saving VM state: */
    419421        LogRel(("GUI: Passing request to save VM state from machine-logic to UI session.\n"));
    420         fSuccess = uisession()->saveState();
    421     }
    422 
    423     /* Disable 'manual-override' finally: */
    424     setManualOverrideMode(false);
    425 
    426     /* Manually close Runtime UI: */
    427     if (fSuccess)
    428         closeRuntimeUI();
     422        UINotificationProgressMachineSaveState *pNotification = new UINotificationProgressMachineSaveState(machine());
     423        connect(pNotification, &UINotificationProgressMachineSaveState::sigMachineStateSaved,
     424                this, &UIMachineLogic::sltHandleMachineStateSaved);
     425        gpNotificationCenter->append(pNotification);
     426    }
    429427}
    430428
     
    19431941}
    19441942
     1943void UIMachineLogic::sltHandleMachineStateSaved(bool fSuccess)
     1944{
     1945    /* Disable 'manual-override' finally: */
     1946    setManualOverrideMode(false);
     1947
     1948    /* Close Runtime UI if state was saved: */
     1949    if (fSuccess)
     1950        closeRuntimeUI();
     1951}
     1952
    19451953void UIMachineLogic::sltShutdown()
    19461954{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r90024 r90856  
    294294    void sltDetach();
    295295    void sltSaveState();
     296    /** Handles machine state saved. */
     297    void sltHandleMachineStateSaved(bool fSuccess);
    296298    void sltShutdown();
    297299    void sltPowerOff();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r90695 r90856  
    325325{
    326326    /* Nothing here for now: */
    327     return true;
    328 }
    329 
    330 bool UISession::saveState()
    331 {
    332     /* Prepare the saving progress: */
    333     CProgress progress = machine().SaveState();
    334     if (machine().isOk())
    335     {
    336         /* Show the saving progress: */
    337         msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_save_90px.png");
    338         if (!progress.isOk() || progress.GetResultCode() != 0)
    339         {
    340             /* Failed in progress: */
    341             msgCenter().cannotSaveMachineState(progress, machineName());
    342             return false;
    343         }
    344     }
    345     else
    346     {
    347         /* Failed in console: */
    348         msgCenter().cannotSaveMachineState(machine());
    349         return false;
    350     }
    351     /* Passed: */
    352327    return true;
    353328}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r90663 r90856  
    7777    bool powerUp();
    7878    bool detach();
    79     bool saveState();
    8079    bool shutdown();
    8180    bool powerOff(bool fIncludingDiscard, bool &fServerCrashed);
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