VirtualBox

Changeset 46599 in vbox for trunk


Ignore:
Timestamp:
Jun 17, 2013 3:52:39 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: More strict VRDE server enable/disable error handling.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r46586 r46599  
    810810            this, SLOT(sltOpenSharedFoldersDialog()));
    811811    connect(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer), SIGNAL(toggled(bool)),
    812             this, SLOT(sltSwitchVrde(bool)));
     812            this, SLOT(sltToggleVRDE(bool)));
    813813    connect(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture), SIGNAL(toggled(bool)),
    814814            this, SLOT(sltToggleVideoCapture(bool)));
     
    18901890}
    18911891
    1892 void UIMachineLogic::sltSwitchVrde(bool fOn)
    1893 {
    1894     /* Prepare variables: */
     1892void UIMachineLogic::sltToggleVRDE(bool fEnabled)
     1893{
     1894    /* Do not process if window(s) missed! */
     1895    if (!isMachineWindowsCreated())
     1896        return;
     1897
     1898    /* Access VRDE server: */
    18951899    CMachine machine = session().GetMachine();
    18961900    CVRDEServer server = machine.GetVRDEServer();
    1897     AssertMsg(!server.isNull(), ("VRDE server should not be null!\n"));
    1898 
    1899     /* Toggle VRDE server state: */
    1900     server.SetEnabled(fOn);
    1901     if (!server.isOk())
    1902     {
    1903         /* Notify about the error: */
    1904         msgCenter().cannotToggleVRDEServer(server, machine.GetName(), fOn);
    1905         /* Make sure action is updated! */
    1906         uisession()->updateStatusVRDE();
     1901    AssertMsg(!server.isNull(), ("VRDE server should NOT be null!\n"));
     1902    if (!machine.isOk() || server.isNull())
     1903        return;
     1904
     1905    /* Make sure something had changed: */
     1906    if (server.GetEnabled() == static_cast<BOOL>(fEnabled))
     1907        return;
     1908
     1909    /* Server is OK? */
     1910    if (server.isOk())
     1911    {
     1912        /* Update VRDE server state: */
     1913        server.SetEnabled(fEnabled);
     1914        /* Server still OK? */
     1915        if (server.isOk())
     1916        {
     1917            /* Save machine-settings: */
     1918            machine.SaveSettings();
     1919            /* Machine still OK? */
     1920            if (!machine.isOk())
     1921            {
     1922                /* Notify about the error: */
     1923                msgCenter().cannotSaveMachineSettings(machine);
     1924                /* Make sure action is updated! */
     1925                uisession()->updateStatusVRDE();
     1926            }
     1927        }
     1928        else
     1929        {
     1930            /* Notify about the error: */
     1931            msgCenter().cannotToggleVRDEServer(server, machine.GetName(), fEnabled);
     1932            /* Make sure action is updated! */
     1933            uisession()->updateStatusVRDE();
     1934        }
    19071935    }
    19081936}
     
    19331961    /* Machine had failed on one of steps? */
    19341962    if (!machine.isOk())
    1935         msgCenter().cannotSaveMachineSettings(machine, activeMachineWindow());
     1963        msgCenter().cannotSaveMachineSettings(machine);
    19361964}
    19371965
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r46582 r46599  
    205205    void sltPrepareDragAndDropMenu();
    206206    void sltChangeDragAndDropType(QAction *pAction);
    207     void sltSwitchVrde(bool fOn);
     207    void sltToggleVRDE(bool fEnabled);
    208208    void sltToggleVideoCapture(bool fEnabled);
    209209    void sltOpenVideoCaptureOptions();
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