VirtualBox

Changeset 98829 in vbox


Ignore:
Timestamp:
Mar 3, 2023 12:20:45 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156151
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CMachine wrapper usage step-by-step; Remaining USB related stuff.

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

Legend:

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

    r98811 r98829  
    794794{
    795795    return uisession()->updateMachineStorage(target, pActionPool);
     796}
     797
     798void UIMachine::acquireWhetherUSBControllerEnabled(bool &fEnabled)
     799{
     800    return uisession()->acquireWhetherUSBControllerEnabled(fEnabled);
     801}
     802
     803void UIMachine::acquireWhetherVideoInputDevicesEnabled(bool &fEnabled)
     804{
     805    return uisession()->acquireWhetherVideoInputDevicesEnabled(fEnabled);
    796806}
    797807
     
    18151825{
    18161826    /* Get host and prepare restrictions: */
    1817     const CHost comHost = uiCommon().host();
    18181827    UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionForMachine =
    18191828        UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid;
     
    18851894    {
    18861895        /* Check whether there is at least one USB controller with an available proxy. */
    1887         const bool fUSBEnabled =    !uisession()->machine().GetUSBDeviceFilters().isNull()
    1888                                  && !uisession()->machine().GetUSBControllers().isEmpty()
    1889                                  && uisession()->machine().GetUSBProxyAvailable();
     1896        bool fUSBEnabled = false;
     1897        acquireWhetherUSBControllerEnabled(fUSBEnabled);
    18901898        if (!fUSBEnabled)
    18911899            restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
     
    18961904    {
    18971905        /* Check whether there is an accessible video input devices pool: */
    1898         comHost.GetVideoInputDevices();
    1899         const bool fWebCamsEnabled = comHost.isOk() && !uisession()->machine().GetUSBControllers().isEmpty();
     1906        bool fWebCamsEnabled = false;
     1907        acquireWhetherVideoInputDevicesEnabled(fWebCamsEnabled);
    19001908        if (!fWebCamsEnabled)
    19011909            restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98811 r98829  
    544544    /** @name USB stuff.
    545545     ** @{ */
     546        /** Acquires whether USB controller is enabled. */
     547        void acquireWhetherUSBControllerEnabled(bool &fEnabled);
     548        /** Acquires whether video input devices are enabled. */
     549        void acquireWhetherVideoInputDevicesEnabled(bool &fEnabled);
     550
    546551        /** Returns a list of USB devices. */
    547552        bool usbDevices(QList<USBDeviceInfo> &guiUSBDevices);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98811 r98829  
    909909    CMachine comMachine = machine();
    910910    uiCommon().updateMachineStorage(comMachine, target, pActionPool);
     911}
     912
     913void UISession::acquireWhetherUSBControllerEnabled(bool &fEnabled)
     914{
     915    fEnabled = false;
     916
     917    /* Check whether USB device filters are available: */
     918    CMachine comMachine = machine();
     919    CUSBDeviceFilters comUSBDeviceFilters = comMachine.GetUSBDeviceFilters();
     920    if (!comMachine.isOk() || comUSBDeviceFilters.isNull())
     921        return;
     922    /* Check whether USB controllers are available: */
     923    CUSBControllerVector comUSBControllers = comMachine.GetUSBControllers();
     924    if (!comMachine.isOk() || comUSBControllers.isEmpty())
     925        return;
     926    /* Check whether USB proxy is available: */
     927    const BOOL fUSBProxyAvailable = comMachine.GetUSBProxyAvailable();
     928    if (!comMachine.isOk() || fUSBProxyAvailable == FALSE)
     929        return;
     930
     931    fEnabled = true;
     932}
     933
     934void UISession::acquireWhetherVideoInputDevicesEnabled(bool &fEnabled)
     935{
     936    fEnabled = false;
     937
     938    /* Check whether video input devices are available: */
     939    CHost comHost = uiCommon().host();
     940    CHostVideoInputDeviceVector comVideoInputDevices = comHost.GetVideoInputDevices();
     941    if (!comHost.isOk() || comVideoInputDevices.isEmpty())
     942        return;
     943    /* Check whether USB controllers are available: */
     944    CMachine comMachine = machine();
     945    CUSBControllerVector comUSBControllers = comMachine.GetUSBControllers();
     946    if (!comMachine.isOk() || comUSBControllers.isEmpty())
     947        return;
     948
     949    fEnabled = true;
    911950}
    912951
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98811 r98829  
    354354    /** @name USB stuff.
    355355     ** @{ */
     356        /** Acquires whether USB controller is enabled. */
     357        void acquireWhetherUSBControllerEnabled(bool &fEnabled);
     358        /** Acquires whether video input devices are enabled. */
     359        void acquireWhetherVideoInputDevicesEnabled(bool &fEnabled);
     360
    356361        /** Returns a list of USB devices. */
    357362        bool usbDevices(QList<USBDeviceInfo> &guiUSBDevices);
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