VirtualBox

Changeset 105266 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 11, 2024 7:49:37 AM (7 months ago)
Author:
vboxsync
Message:

Recording: Implemented support for a dedicated progress object, which is exposed to API clients. This can be used for better tracking the recording progress as well as for error reporting. The RecordingSettings API also now has a dedicated start() method to start recording, as well as support for attaching to an already ongoing recording by retrieving the progress object at a later time. Adapted FE/Qt (draft, see @todos), FE/VBoxManage and the Validation Kit testdriver to the new APIs. VBoxManage also can attach to an ongoing recording now. The recording progress object also will have multiple operations to get the recording progress for convenience. bugref:10718

Location:
trunk/src/VBox/Frontends
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r101035 r105266  
    17971797                 || !strcmp(a->argv[1], "videocap") /* legacy command */)
    17981798        {
     1799            if (!strcmp(a->argv[1], "videocap"))
     1800                RTMsgWarning(ControlVM::tr("Sub command 'videocap' is deprecated -- please use 'recording' instead ."));
     1801
    17991802            if (a->argc < 3)
    18001803            {
     
    18151818            /* Note: For now all screens have the same configuration. */
    18161819
    1817             /*
    1818              * Note: Commands starting with "vcp" are the deprecated versions and are
    1819              *       kept to ensure backwards compatibility.
    1820              */
    18211820            bool fEnabled;
    18221821            if (RT_SUCCESS(parseBool(a->argv[2], &fEnabled)))
    18231822            {
    1824                 setCurrentSubcommand(HELP_SCOPE_CONTROLVM_RECORDING);
     1823                //setCurrentSubcommand(HELP_SCOPE_CONTROLVM_RECORDING);
    18251824                CHECK_ERROR_RET(recordingSettings, COMSETTER(Enabled)(fEnabled), RTEXITCODE_FAILURE);
     1825
     1826                if (fEnabled)
     1827                    RTPrintf(ControlVM::tr("Recording enabled. Use 'start' to start recording.\n"));
     1828            }
     1829            else if (!strcmp(a->argv[2], "start"))
     1830            {
     1831                //setCurrentSubcommand(HELP_SCOPE_CONTROLVM_RECORDING_START);
     1832                bool fWait = false;
     1833                if (a->argc >= 4 && !strcmp(a->argv[3], "--wait"))
     1834                    fWait = true;
     1835
     1836                ComPtr<IProgress> progress;
     1837                CHECK_ERROR_BREAK(recordingSettings, Start(progress.asOutParam()));
     1838
     1839                if (fWait)
     1840                {
     1841                    hrc = showProgress(progress, SHOW_PROGRESS_OPS);
     1842                    CHECK_PROGRESS_ERROR(progress, (ControlVM::tr("Recording failed.")));
     1843                }
     1844                else
     1845                    RTPrintf(ControlVM::tr("Recording started (detacted).\n"));
     1846            }
     1847            else if (!strcmp(a->argv[2], "stop"))
     1848            {
     1849                //setCurrentSubcommand(HELP_SCOPE_CONTROLVM_RECORDING_STOP);
     1850                ComPtr<IProgress> progress;
     1851                CHECK_ERROR_BREAK(recordingSettings, COMGETTER(Progress)(progress.asOutParam()));
     1852                CHECK_ERROR_BREAK(progress, Cancel());
     1853            }
     1854            else if (!strcmp(a->argv[2], "attach"))
     1855            {
     1856                //setCurrentSubcommand(HELP_SCOPE_CONTROLVM_RECORDING_ATTACH);
     1857                ComPtr<IProgress> progress;
     1858                CHECK_ERROR_BREAK(recordingSettings, COMGETTER(Progress)(progress.asOutParam()));
     1859                hrc = showProgress(progress, SHOW_PROGRESS_OPS);
    18261860            }
    18271861            else if (!strcmp(a->argv[2], "screens"))
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r105087 r105266  
    28992899        CHECK_ERROR_RET(machine, COMGETTER(RecordingSettings)(recordingSettings.asOutParam()), hrc);
    29002900
    2901         BOOL  fEnabled;
     2901        BOOL fStarted = FALSE;
     2902        ComPtr<IProgress> progress;
     2903        hrc = recordingSettings->COMGETTER(Progress)(progress.asOutParam());
     2904        if (SUCCEEDED(hrc))
     2905        {
     2906            hrc = progress->COMGETTER(Completed)(&fStarted);
     2907            fStarted = !fStarted;
     2908        }
     2909        SHOW_BOOL_VALUE_EX("recording_started", Info::tr("Recording status:"), fStarted, Info::tr("started"), Info::tr("stopped"));
     2910
     2911        BOOL fEnabled;
    29022912        CHECK_ERROR_RET(recordingSettings, COMGETTER(Enabled)(&fEnabled), hrc);
    29032913        SHOW_BOOL_VALUE_EX("recording_enabled", Info::tr("Recording enabled:"), fEnabled, Info::tr("yes"), Info::tr("no"));
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r105265 r105266  
    527527    {
    528528        CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
    529         if (comRecordingSettings.GetEnabled())
     529        CProgress comProgress = comRecordingSettings.GetProgress(); /** @todo r=andy Revamp this. */
     530        /** @r=andy Check if recording is running: if not completed AND not canceled. */
     531        if (comProgress.isOk() && !comProgress.GetCompleted() && !comProgress.GetCanceled())
    530532        {
    531533            /* For now all screens have the same config: */
     
    14621464    /* Get recording settings: */
    14631465    CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
    1464     fRecordingEnabled = comRecordingSettings.GetEnabled();
     1466    CProgress comProgress = comRecordingSettings.GetProgress(); /** r=andy Revamp this. */
     1467    /** @r=andy Check if recording is running: if not completed AND not canceled. */
     1468    fRecordingEnabled = comProgress.isOk() && !comProgress.GetCompleted() && !comProgress.GetCanceled();
    14651469    if (fRecordingEnabled)
    14661470    {
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp

    r103803 r105266  
    481481            break;
    482482        }
    483         case KVBoxEventType_OnRecordingChanged:
     483        case KVBoxEventType_OnRecordingStateChanged:
    484484        {
    485485            emit sigRecordingChange();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp

    r103803 r105266  
    217217        << KVBoxEventType_OnVRDEServerChanged
    218218        << KVBoxEventType_OnVRDEServerInfoChanged
    219         << KVBoxEventType_OnRecordingChanged
     219        << KVBoxEventType_OnRecordingStateChanged
    220220        << KVBoxEventType_OnUSBControllerChanged
    221221        << KVBoxEventType_OnUSBDeviceStateChanged
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r105265 r105266  
    19391939    else
    19401940    {
    1941         const BOOL fSettingsEnabled = comSettings.GetEnabled();
    1942         fSuccess = comSettings.isOk();
    1943         if (!fSuccess)
    1944             UINotificationMessage::cannotAcquireRecordingSettingsParameter(comSettings);
    1945         else
    1946             fEnabled = fSettingsEnabled == TRUE;
     1941        /** @todo r=andy Revamp this. */
     1942        CProgress comProgress = comSettings.GetProgress();
     1943        fEnabled = comProgress.isOk() && !comProgress.GetCompleted() && !comProgress.GetCanceled();
    19471944    }
    19481945    return fSuccess;
     
    19581955    else
    19591956    {
    1960         comSettings.SetEnabled(fEnabled);
    1961         fSuccess = comSettings.isOk();
    1962         if (!fSuccess)
    1963             UINotificationMessage::cannotToggleRecording(comSettings, machineName(), fEnabled);
     1957        /** @todo r=andy Revamp this function to better use the progress object.
     1958         *               Probably also needs a bit of refactoring of the overall handling within FE/Qt. */
     1959        CProgress comProgress;
     1960        if (fEnabled)
     1961        {
     1962            comProgress = comSettings.Start();
     1963            fSuccess = comSettings.isOk();
     1964            if (!fSuccess)
     1965                UINotificationMessage::cannotToggleRecording(comSettings, machineName(), fEnabled);
     1966        }
     1967        else
     1968        {
     1969            comProgress = comSettings.GetProgress();
     1970            if (comProgress.isOk())
     1971                comProgress.Cancel();
     1972            else
     1973                UINotificationMessage::cannotToggleRecording(comSettings, machineName(), fEnabled);
     1974        }
     1975
    19641976    }
    19651977    return fSuccess;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r105120 r105266  
    5353#include "CExtPackManager.h"
    5454#include "CGraphicsAdapter.h"
     55#include "CProgress.h" /* For starting recording. */
    5556#include "CRecordingScreenSettings.h"
    5657#include "CRecordingSettings.h"
     
    13291330                    fSuccess = comRecordingScreenSettings.isOk();
    13301331                }
    1331 
    13321332                if (!fSuccess)
    13331333                {
     
    13441344                recordingSettings.SetEnabled(newDisplayData.m_fRecordingEnabled);
    13451345                fSuccess = recordingSettings.isOk();
     1346                if (fSuccess)
     1347                {
     1348                    /* Start recording when recording got enabled. */
     1349                    /** @todo r=andy Not sure if this is the right place for it. */
     1350                    CProgress comProgress = recordingSettings.Start();
     1351                    fSuccess = recordingSettings.isOk();
     1352                }
    13461353            }
    13471354        }
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