VirtualBox

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


Ignore:
Timestamp:
Aug 22, 2017 2:42:51 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7820: Allow to enable/disable audio output/input at runtime through Devices => Audio menu and status-bar context-menu indicator; Still waiting for proper menu icons, temporary icons used for now.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
21 edited
16 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc

    r68214 r68508  
    1515        <file alias="attachment_remove_16px.png">images/attachment_remove_16px.png</file>
    1616        <file alias="attachment_remove_disabled_16px.png">images/attachment_remove_disabled_16px.png</file>
     17        <file alias="audio_16px.png">images/audio_16px.png</file>
     18        <file alias="audio_all_off_16px.png">images/audio_all_off_16px.png</file>
     19        <file alias="audio_input_16px.png">images/audio_input_16px.png</file>
     20        <file alias="audio_input_off_16px.png">images/audio_input_off_16px.png</file>
     21        <file alias="audio_input_on_16px.png">images/audio_input_on_16px.png</file>
     22        <file alias="audio_output_16px.png">images/audio_output_16px.png</file>
     23        <file alias="audio_output_off_16px.png">images/audio_output_off_16px.png</file>
     24        <file alias="audio_output_on_16px.png">images/audio_output_on_16px.png</file>
    1725        <file alias="auto_resize_on_16px.png">images/auto_resize_on_16px.png</file>
    1826        <file alias="auto_resize_on_disabled_16px.png">images/auto_resize_on_disabled_16px.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox1_hidpi.qrc

    r68214 r68508  
    1515        <file alias="attachment_remove_16px_hidpi.png">images/hidpi/attachment_remove_16px_hidpi.png</file>
    1616        <file alias="attachment_remove_disabled_16px_hidpi.png">images/hidpi/attachment_remove_disabled_16px_hidpi.png</file>
     17        <file alias="audio_16px_hidpi.png">images/hidpi/audio_16px_hidpi.png</file>
     18        <file alias="audio_all_off_16px_hidpi.png">images/hidpi/audio_all_off_16px_hidpi.png</file>
     19        <file alias="audio_input_16px_hidpi.png">images/hidpi/audio_input_16px_hidpi.png</file>
     20        <file alias="audio_input_off_16px_hidpi.png">images/hidpi/audio_input_off_16px_hidpi.png</file>
     21        <file alias="audio_input_on_16px_hidpi.png">images/hidpi/audio_input_on_16px_hidpi.png</file>
     22        <file alias="audio_output_16px_hidpi.png">images/hidpi/audio_output_16px_hidpi.png</file>
     23        <file alias="audio_output_off_16px_hidpi.png">images/hidpi/audio_output_off_16px_hidpi.png</file>
     24        <file alias="audio_output_on_16px_hidpi.png">images/hidpi/audio_output_on_16px_hidpi.png</file>
    1725        <file alias="auto_resize_on_16px_hidpi.png">images/hidpi/auto_resize_on_16px_hidpi.png</file>
    1826        <file alias="auto_resize_on_disabled_16px_hidpi.png">images/hidpi/auto_resize_on_disabled_16px_hidpi.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r68394 r68508  
    732732        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices:        strResult = "OpticalDevices"; break;
    733733        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices:         strResult = "FloppyDevices"; break;
     734        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio:                 strResult = "Audio"; break;
     735        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput:           strResult = "AudioOutput"; break;
     736        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput:            strResult = "AudioInput"; break;
    734737        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network:               strResult = "Network"; break;
    735738        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings:       strResult = "NetworkSettings"; break;
     
    763766    keys << "OpticalDevices";        values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices;
    764767    keys << "FloppyDevices";         values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices;
     768    keys << "Audio";                 values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio;
     769    keys << "AudioOutput";           values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput;
     770    keys << "AudioInput";            values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput;
    765771    keys << "Network";               values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network;
    766772    keys << "NetworkSettings";       values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings;
     
    14101416        case IndicatorType_OpticalDisks:  strResult = "OpticalDisks"; break;
    14111417        case IndicatorType_FloppyDisks:   strResult = "FloppyDisks"; break;
     1418        case IndicatorType_Audio:         strResult = "Audio"; break;
    14121419        case IndicatorType_Network:       strResult = "Network"; break;
    14131420        case IndicatorType_USB:           strResult = "USB"; break;
     
    14361443    keys << "OpticalDisks";  values << IndicatorType_OpticalDisks;
    14371444    keys << "FloppyDisks";   values << IndicatorType_FloppyDisks;
     1445    keys << "Audio";         values << IndicatorType_Audio;
    14381446    keys << "Network";       values << IndicatorType_Network;
    14391447    keys << "USB";           values << IndicatorType_USB;
     
    14601468        case IndicatorType_OpticalDisks:  strResult = QApplication::translate("VBoxGlobal", "Optical Disks", "IndicatorType"); break;
    14611469        case IndicatorType_FloppyDisks:   strResult = QApplication::translate("VBoxGlobal", "Floppy Disks", "IndicatorType"); break;
     1470        case IndicatorType_Audio:         strResult = QApplication::translate("VBoxGlobal", "Audio", "IndicatorType"); break;
    14621471        case IndicatorType_Network:       strResult = QApplication::translate("VBoxGlobal", "Network", "IndicatorType"); break;
    14631472        case IndicatorType_USB:           strResult = QApplication::translate("VBoxGlobal", "USB", "IndicatorType"); break;
     
    14851494        case IndicatorType_OpticalDisks:  return UIIconPool::iconSet(":/cd_16px.png");
    14861495        case IndicatorType_FloppyDisks:   return UIIconPool::iconSet(":/fd_16px.png");
     1496        case IndicatorType_Audio:         return UIIconPool::iconSet(":/audio_16px.png");
    14871497        case IndicatorType_Network:       return UIIconPool::iconSet(":/nw_16px.png");
    14881498        case IndicatorType_USB:           return UIIconPool::iconSet(":/usb_16px.png");
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r68394 r68508  
    485485        RuntimeMenuDevicesActionType_OpticalDevices        = RT_BIT(2),
    486486        RuntimeMenuDevicesActionType_FloppyDevices         = RT_BIT(3),
    487         RuntimeMenuDevicesActionType_Network               = RT_BIT(4),
    488         RuntimeMenuDevicesActionType_NetworkSettings       = RT_BIT(5),
    489         RuntimeMenuDevicesActionType_USBDevices            = RT_BIT(6),
    490         RuntimeMenuDevicesActionType_USBDevicesSettings    = RT_BIT(7),
    491         RuntimeMenuDevicesActionType_WebCams               = RT_BIT(8),
    492         RuntimeMenuDevicesActionType_SharedClipboard       = RT_BIT(9),
    493         RuntimeMenuDevicesActionType_DragAndDrop           = RT_BIT(10),
    494         RuntimeMenuDevicesActionType_SharedFolders         = RT_BIT(11),
    495         RuntimeMenuDevicesActionType_SharedFoldersSettings = RT_BIT(12),
    496         RuntimeMenuDevicesActionType_InstallGuestTools     = RT_BIT(13),
    497         RuntimeMenuDevicesActionType_Nothing               = RT_BIT(14),
     487        RuntimeMenuDevicesActionType_Audio                 = RT_BIT(4),
     488        RuntimeMenuDevicesActionType_AudioOutput           = RT_BIT(5),
     489        RuntimeMenuDevicesActionType_AudioInput            = RT_BIT(6),
     490        RuntimeMenuDevicesActionType_Network               = RT_BIT(7),
     491        RuntimeMenuDevicesActionType_NetworkSettings       = RT_BIT(8),
     492        RuntimeMenuDevicesActionType_USBDevices            = RT_BIT(9),
     493        RuntimeMenuDevicesActionType_USBDevicesSettings    = RT_BIT(10),
     494        RuntimeMenuDevicesActionType_WebCams               = RT_BIT(11),
     495        RuntimeMenuDevicesActionType_SharedClipboard       = RT_BIT(12),
     496        RuntimeMenuDevicesActionType_DragAndDrop           = RT_BIT(13),
     497        RuntimeMenuDevicesActionType_SharedFolders         = RT_BIT(14),
     498        RuntimeMenuDevicesActionType_SharedFoldersSettings = RT_BIT(15),
     499        RuntimeMenuDevicesActionType_InstallGuestTools     = RT_BIT(16),
     500        RuntimeMenuDevicesActionType_Nothing               = RT_BIT(17),
    498501        RuntimeMenuDevicesActionType_All                   = 0xFFFF
    499502    };
     
    673676    IndicatorType_OpticalDisks,
    674677    IndicatorType_FloppyDisks,
     678    IndicatorType_Audio,
    675679    IndicatorType_Network,
    676680    IndicatorType_USB,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp

    r60544 r68508  
    399399            break;
    400400        }
    401 //        case KVBoxEventType_OnSerialPortChanged:
    402 //        case KVBoxEventType_OnParallelPortChanged:
    403 //        case KVBoxEventType_OnStorageControllerChanged:
    404 //        case KVBoxEventType_OnCPUChange:
     401        case KVBoxEventType_OnAudioAdapterChanged:
     402        {
     403            emit sigAudioAdapterChange();
     404            break;
     405        }
    405406
    406407        default: break;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h

    r60250 r68508  
    119119    /** Notifies about VM window with specified @a winId should be shown. */
    120120    void sigShowWindow(qint64 &winId); /* use Qt::DirectConnection */
     121    /** Notifies about audio adapter state change. */
     122    void sigAudioAdapterChange();
    121123
    122124public:
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r68435 r68508  
    21102110}
    21112111
     2112void UIMessageCenter::cannotToggleAudioOutput(const CAudioAdapter &comAdapter, const QString &strMachineName, bool fEnable)
     2113{
     2114    error(0, MessageType_Error,
     2115          fEnable ?
     2116              tr("Failed to enable the audio adapter output for the virtual machine <b>%1</b>.").arg(strMachineName) :
     2117              tr("Failed to disable the audio adapter output for the virtual machine <b>%1</b>.").arg(strMachineName),
     2118          UIErrorString::formatErrorInfo(comAdapter));
     2119}
     2120
     2121void UIMessageCenter::cannotToggleAudioInput(const CAudioAdapter &comAdapter, const QString &strMachineName, bool fEnable)
     2122{
     2123    error(0, MessageType_Error,
     2124          fEnable ?
     2125              tr("Failed to enable the audio adapter input for the virtual machine <b>%1</b>.").arg(strMachineName) :
     2126              tr("Failed to disable the audio adapter input for the virtual machine <b>%1</b>.").arg(strMachineName),
     2127          UIErrorString::formatErrorInfo(comAdapter));
     2128}
     2129
    21122130void UIMessageCenter::cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect)
    21132131{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r68435 r68508  
    320320    void cannotToggleVideoCapture(const CMachine &machine, bool fEnable);
    321321    void cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable);
     322    void cannotToggleAudioOutput(const CAudioAdapter &comAdapter, const QString &strMachineName, bool fEnable);
     323    void cannotToggleAudioInput(const CAudioAdapter &comAdapter, const QString &strMachineName, bool fEnable);
    322324    void cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect);
    323325    void remindAboutGuestAdditionsAreNotActive() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r64659 r68508  
    14391439    {
    14401440        setName(QApplication::translate("UIActionPool", "&Floppy Drives"));
     1441    }
     1442};
     1443
     1444class UIActionMenuAudio : public UIActionMenu
     1445{
     1446    Q_OBJECT;
     1447
     1448public:
     1449
     1450    UIActionMenuAudio(UIActionPool *pParent)
     1451        : UIActionMenu(pParent, ":/audio_16px.png", ":/audio_all_off_16px.png") {}
     1452
     1453protected:
     1454
     1455    /** Returns action extra-data ID. */
     1456    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio; }
     1457    /** Returns action extra-data key. */
     1458    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio); }
     1459    /** Returns whether action is allowed. */
     1460    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio); }
     1461
     1462    void retranslateUi()
     1463    {
     1464        setName(QApplication::translate("UIActionPool", "&Audio"));
     1465    }
     1466};
     1467
     1468class UIActionToggleAudioOutput : public UIActionToggle
     1469{
     1470    Q_OBJECT;
     1471
     1472public:
     1473
     1474    UIActionToggleAudioOutput(UIActionPool *pParent)
     1475        : UIActionToggle(pParent,
     1476                         ":/audio_output_on_16px.png", ":/audio_output_16px.png",
     1477                         ":/audio_output_on_16px.png", ":/audio_output_16px.png") {}
     1478
     1479protected:
     1480
     1481    /** Returns action extra-data ID. */
     1482    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput; }
     1483    /** Returns action extra-data key. */
     1484    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput); }
     1485    /** Returns whether action is allowed. */
     1486    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput); }
     1487
     1488    QString shortcutExtraDataID() const
     1489    {
     1490        return QString("ToggleAudioOutput");
     1491    }
     1492
     1493    void retranslateUi()
     1494    {
     1495        setName(QApplication::translate("UIActionPool", "Audio Output"));
     1496        setStatusTip(QApplication::translate("UIActionPool", "Enable audio output"));
     1497    }
     1498};
     1499
     1500class UIActionToggleAudioInput : public UIActionToggle
     1501{
     1502    Q_OBJECT;
     1503
     1504public:
     1505
     1506    UIActionToggleAudioInput(UIActionPool *pParent)
     1507        : UIActionToggle(pParent,
     1508                         ":/audio_input_on_16px.png", ":/audio_input_16px.png",
     1509                         ":/audio_input_on_16px.png", ":/audio_input_16px.png") {}
     1510
     1511protected:
     1512
     1513    /** Returns action extra-data ID. */
     1514    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput; }
     1515    /** Returns action extra-data key. */
     1516    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput); }
     1517    /** Returns whether action is allowed. */
     1518    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput); }
     1519
     1520    QString shortcutExtraDataID() const
     1521    {
     1522        return QString("ToggleAudioInput");
     1523    }
     1524
     1525    void retranslateUi()
     1526    {
     1527        setName(QApplication::translate("UIActionPool", "Audio Input"));
     1528        setStatusTip(QApplication::translate("UIActionPool", "Enable audio input"));
    14411529    }
    14421530};
     
    22162304    m_pool[UIActionIndexRT_M_Devices_M_OpticalDevices] = new UIActionMenuOpticalDevices(this);
    22172305    m_pool[UIActionIndexRT_M_Devices_M_FloppyDevices] = new UIActionMenuFloppyDevices(this);
     2306    m_pool[UIActionIndexRT_M_Devices_M_Audio] = new UIActionMenuAudio(this);
     2307    m_pool[UIActionIndexRT_M_Devices_M_Audio_T_Output] = new UIActionToggleAudioOutput(this);
     2308    m_pool[UIActionIndexRT_M_Devices_M_Audio_T_Input] = new UIActionToggleAudioInput(this);
    22182309    m_pool[UIActionIndexRT_M_Devices_M_Network] = new UIActionMenuNetworkAdapters(this);
    22192310    m_pool[UIActionIndexRT_M_Devices_M_Network_S_Settings] = new UIActionSimpleShowNetworkSettingsDialog(this);
     
    22582349    m_menuUpdateHandlers[UIActionIndexRT_M_Devices].ptfr =                 &UIActionPoolRuntime::updateMenuDevices;
    22592350    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_HardDrives].ptfr =    &UIActionPoolRuntime::updateMenuDevicesHardDrives;
     2351    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_Audio].ptfr =         &UIActionPoolRuntime::updateMenuDevicesAudio;
    22602352    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_Network].ptfr =       &UIActionPoolRuntime::updateMenuDevicesNetwork;
    22612353    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_USBDevices].ptfr =    &UIActionPoolRuntime::updateMenuDevicesUSBDevices;
     
    29723064    /* 'Floppy Devices' submenu: */
    29733065    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_FloppyDevices)) || fSeparator;
     3066    /* 'Audio' submenu: */
     3067    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Audio)) || fSeparator;
     3068    updateMenuDevicesAudio();
    29743069    /* 'Network' submenu: */
    29753070    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network)) || fSeparator;
     
    29803075    /* 'Web Cams' submenu: */
    29813076    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_WebCams)) || fSeparator;
     3077
     3078    /* Separator: */
     3079    if (fSeparator)
     3080    {
     3081        pMenu->addSeparator();
     3082        fSeparator = false;
     3083    }
     3084
    29823085    /* 'Shared Folders' submenu: */
    29833086    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders)) || fSeparator;
    29843087    updateMenuDevicesSharedFolders();
    2985 
    2986     /* Separator: */
    2987     if (fSeparator)
    2988     {
    2989         pMenu->addSeparator();
    2990         fSeparator = false;
    2991     }
    2992 
    29933088    /* 'Shared Clipboard' submenu: */
    29943089    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedClipboard)) || fSeparator;
     
    30233118    /* Mark menu as valid: */
    30243119    m_invalidations.remove(UIActionIndexRT_M_Devices_M_HardDrives);
     3120}
     3121
     3122void UIActionPoolRuntime::updateMenuDevicesAudio()
     3123{
     3124    /* Get corresponding menu: */
     3125    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_Audio)->menu();
     3126    AssertPtrReturnVoid(pMenu);
     3127    /* Clear contents: */
     3128    pMenu->clear();
     3129
     3130    /* 'Output' action: */
     3131    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Audio_T_Output));
     3132    /* 'Input' action: */
     3133    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Audio_T_Input));
     3134
     3135    /* Mark menu as valid: */
     3136    m_invalidations.remove(UIActionIndexRT_M_Devices_M_Audio);
    30253137}
    30263138
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r64659 r68508  
    9999    UIActionIndexRT_M_Devices_M_OpticalDevices,
    100100    UIActionIndexRT_M_Devices_M_FloppyDevices,
     101    UIActionIndexRT_M_Devices_M_Audio,
     102    UIActionIndexRT_M_Devices_M_Audio_T_Output,
     103    UIActionIndexRT_M_Devices_M_Audio_T_Input,
    101104    UIActionIndexRT_M_Devices_M_Network,
    102105    UIActionIndexRT_M_Devices_M_Network_S_Settings,
     
    261264    /** Update 'Devices' : 'Hard Drives' menu routine. */
    262265    void updateMenuDevicesHardDrives();
     266    /** Update 'Devices' : 'Audio' menu routine. */
     267    void updateMenuDevicesAudio();
    263268    /** Update 'Devices' : 'Network' menu routine. */
    264269    void updateMenuDevicesNetwork();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp

    r63626 r68508  
    8282    void sigShowWindow();
    8383#endif /* RT_OS_DARWIN */
     84    /** Notifies about audio adapter state change. */
     85    void sigAudioAdapterChange();
    8486
    8587public:
     
    194196        << KVBoxEventType_OnRuntimeError
    195197        << KVBoxEventType_OnCanShowWindow
    196         << KVBoxEventType_OnShowWindow;
     198        << KVBoxEventType_OnShowWindow
     199        << KVBoxEventType_OnAudioAdapterChanged;
    197200
    198201    /* Register event listener for console event source: */
     
    265268    connect(m_pQtListener->getWrapped(), SIGNAL(sigShowWindow(qint64 &)),
    266269            this, SLOT(sltShowWindow(qint64 &)),
     270            Qt::DirectConnection);
     271    connect(m_pQtListener->getWrapped(), SIGNAL(sigAudioAdapterChange()),
     272            this, SIGNAL(sigAudioAdapterChange()),
    267273            Qt::DirectConnection);
    268274}
     
    421427            Qt::QueuedConnection);
    422428#endif /* RT_OS_DARWIN */
     429    connect(m_pProxy, SIGNAL(sigAudioAdapterChange()),
     430            this, SIGNAL(sigAudioAdapterChange()),
     431            Qt::QueuedConnection);
    423432}
    424433
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h

    r60227 r68508  
    7878    void sigShowWindow();
    7979#endif /* RT_OS_DARWIN */
     80    /** Notifies about audio adapter state change. */
     81    void sigAudioAdapterChange();
    8082
    8183public:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r66946 r68508  
    4141
    4242/* COM includes: */
     43# include "CAudioAdapter.h"
    4344# include "CConsole.h"
    4445# include "CMachine.h"
     
    384385        /* Update indicator state: */
    385386        setState(fAttachmentsMounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
     387    }
     388};
     389
     390
     391/** UISessionStateStatusBarIndicator extension for Runtime UI: Audio indicator. */
     392class UIIndicatorAudio : public UISessionStateStatusBarIndicator
     393{
     394    Q_OBJECT;
     395
     396public:
     397
     398    /** Audio states. */
     399    enum AudioState
     400    {
     401        AudioState_AllOff   = 0,
     402        AudioState_OutputOn = RT_BIT(0),
     403        AudioState_InputOn  = RT_BIT(1),
     404        AudioState_AllOn    = AudioState_InputOn | AudioState_OutputOn
     405    };
     406
     407    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     408    UIIndicatorAudio(UISession *pSession)
     409        : UISessionStateStatusBarIndicator(IndicatorType_Audio, pSession)
     410    {
     411        /* Assign state-icons: */
     412        setStateIcon(AudioState_AllOff, UIIconPool::iconSet(":/audio_all_off_16px.png"));
     413        setStateIcon(AudioState_OutputOn, UIIconPool::iconSet(":/audio_input_off_16px.png"));
     414        setStateIcon(AudioState_InputOn, UIIconPool::iconSet(":/audio_output_off_16px.png"));
     415        setStateIcon(AudioState_AllOn, UIIconPool::iconSet(":/audio_16px.png"));
     416        /* Translate finally: */
     417        retranslateUi();
     418    }
     419
     420private:
     421
     422    /** Update routine. */
     423    void updateAppearance()
     424    {
     425        /* Get machine: */
     426        const CMachine comMachine = m_pSession->machine();
     427
     428        /* Prepare tool-tip: */
     429        QString strToolTip = QApplication::translate("UIIndicatorsPool",
     430                                                     "<nobr>Indicates the activity of the "
     431                                                     "audio:</nobr>%1", "Audio tooltip");
     432        QString strFullData;
     433
     434        /* Get audio adapter: */
     435        const CAudioAdapter comAdapter = comMachine.GetAudioAdapter();
     436        const bool fAudioEnabled = comAdapter.GetEnabled();
     437        if (fAudioEnabled)
     438        {
     439            const bool fEnabledOutput = comAdapter.GetEnabledOut();
     440            const bool fEnabledInput = comAdapter.GetEnabledIn();
     441            strFullData = QString(s_strTableRow2).arg(QApplication::translate("UIGDetails", "Audio Output", "details (audio)"),
     442                                                      fEnabledOutput ?
     443                                                      QApplication::translate("UIGDetails", "Enabled", "details (audio/output)") :
     444                                                      QApplication::translate("UIGDetails", "Disabled", "details (audio/output)"))
     445                        + QString(s_strTableRow2).arg(QApplication::translate("UIGDetails", "Audio Input", "details (audio)"),
     446                                                      fEnabledInput ?
     447                                                      QApplication::translate("UIGDetails", "Enabled", "details (audio/input)") :
     448                                                      QApplication::translate("UIGDetails", "Disabled", "details (audio/input)"));
     449            AudioState enmState = AudioState_AllOff;
     450            if (fEnabledOutput)
     451                enmState = (AudioState)(enmState | AudioState_OutputOn);
     452            if (fEnabledInput)
     453                enmState = (AudioState)(enmState | AudioState_InputOn);
     454            setState(enmState);
     455        }
     456        else
     457        {
     458            strFullData = QString(s_strTableRow2).arg(QApplication::translate("UIGDetails", "Disabled", "details (audio)"));
     459            setState(AudioState_AllOff);
     460        }
     461
     462        /* Update tool-tip: */
     463        setToolTip(strToolTip.arg(s_strTable.arg(strFullData)));
    386464    }
    387465};
     
    13221400                case IndicatorType_OpticalDisks:      m_pool[indicatorType] = new UIIndicatorOpticalDisks(m_pSession);  break;
    13231401                case IndicatorType_FloppyDisks:       m_pool[indicatorType] = new UIIndicatorFloppyDisks(m_pSession);   break;
     1402                case IndicatorType_Audio:             m_pool[indicatorType] = new UIIndicatorAudio(m_pSession);         break;
    13241403                case IndicatorType_Network:           m_pool[indicatorType] = new UIIndicatorNetwork(m_pSession);       break;
    13251404                case IndicatorType_USB:               m_pool[indicatorType] = new UIIndicatorUSB(m_pSession);           break;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h

    r62493 r68508  
    3131    UIVisualElement_CDStuff               = RT_BIT(4),
    3232    UIVisualElement_FDStuff               = RT_BIT(5),
    33     UIVisualElement_NetworkStuff          = RT_BIT(6),
    34     UIVisualElement_USBStuff              = RT_BIT(7),
    35     UIVisualElement_SharedFolderStuff     = RT_BIT(8),
    36     UIVisualElement_Display               = RT_BIT(9),
    37     UIVisualElement_VideoCapture          = RT_BIT(10),
    38     UIVisualElement_FeaturesStuff         = RT_BIT(11),
     33    UIVisualElement_AudioStuff            = RT_BIT(6),
     34    UIVisualElement_NetworkStuff          = RT_BIT(7),
     35    UIVisualElement_USBStuff              = RT_BIT(8),
     36    UIVisualElement_SharedFolderStuff     = RT_BIT(9),
     37    UIVisualElement_Display               = RT_BIT(10),
     38    UIVisualElement_VideoCapture          = RT_BIT(11),
     39    UIVisualElement_FeaturesStuff         = RT_BIT(12),
    3940#ifndef VBOX_WS_MAC
    40     UIVisualElement_MiniToolBar           = RT_BIT(12),
     41    UIVisualElement_MiniToolBar           = RT_BIT(13),
    4142#endif /* !VBOX_WS_MAC */
    4243    UIVisualElement_AllStuff              = 0xFFFF
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r68315 r68508  
    7171
    7272/* COM includes: */
     73# include "CAudioAdapter.h"
    7374# include "CVirtualBoxErrorInfo.h"
    7475# include "CMachineDebugger.h"
     
    10541055    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices));
    10551056    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices));
     1057    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Audio));
     1058    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output));
     1059    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output));
    10561060    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Network));
    10571061    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Network_S_Settings));
     
    11431147    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings), SIGNAL(triggered()),
    11441148            this, SLOT(sltOpenStorageSettingsDialog()));
     1149    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output), &UIAction::toggled,
     1150            this, &UIMachineLogic::sltToggleAudioOutput);
     1151    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input), &UIAction::toggled,
     1152            this, &UIMachineLogic::sltToggleAudioInput);
    11451153    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_Network_S_Settings), SIGNAL(triggered()),
    11461154            this, SLOT(sltOpenNetworkSettingsDialog()));
     
    19461954}
    19471955
     1956void UIMachineLogic::sltToggleAudioOutput(bool fEnabled)
     1957{
     1958    /* Do not process if window(s) missed! */
     1959    if (!isMachineWindowsCreated())
     1960        return;
     1961
     1962    /* Access audio adapter: */
     1963    CAudioAdapter comAdapter = machine().GetAudioAdapter();
     1964    AssertMsgReturnVoid(machine().isOk() && comAdapter.isNotNull(),
     1965                        ("Audio adapter should NOT be null!\n"));
     1966
     1967    /* Make sure something had changed: */
     1968    if (comAdapter.GetEnabledOut() == static_cast<BOOL>(fEnabled))
     1969        return;
     1970
     1971    /* Update audio output state: */
     1972    comAdapter.SetEnabledOut(fEnabled);
     1973    if (!comAdapter.isOk())
     1974    {
     1975        /* Make sure action is updated: */
     1976        uisession()->updateAudioOutput();
     1977        /* Notify about the error: */
     1978        return msgCenter().cannotToggleAudioOutput(comAdapter, machineName(), fEnabled);
     1979    }
     1980
     1981    /* Save machine-settings: */
     1982    machine().SaveSettings();
     1983    if (!machine().isOk())
     1984    {
     1985        /* Make sure action is updated: */
     1986        uisession()->updateAudioOutput();
     1987        /* Notify about the error: */
     1988        return msgCenter().cannotSaveMachineSettings(machine());
     1989    }
     1990}
     1991
     1992void UIMachineLogic::sltToggleAudioInput(bool fEnabled)
     1993{
     1994    /* Do not process if window(s) missed! */
     1995    if (!isMachineWindowsCreated())
     1996        return;
     1997
     1998    /* Access audio adapter: */
     1999    CAudioAdapter comAdapter = machine().GetAudioAdapter();
     2000    AssertMsgReturnVoid(machine().isOk() && comAdapter.isNotNull(),
     2001                        ("Audio adapter should NOT be null!\n"));
     2002
     2003    /* Make sure something had changed: */
     2004    if (comAdapter.GetEnabledIn() == static_cast<BOOL>(fEnabled))
     2005        return;
     2006
     2007    /* Update audio input state: */
     2008    comAdapter.SetEnabledIn(fEnabled);
     2009    if (!comAdapter.isOk())
     2010    {
     2011        /* Make sure action is updated: */
     2012        uisession()->updateAudioInput();
     2013        /* Notify about the error: */
     2014        return msgCenter().cannotToggleAudioInput(comAdapter, machineName(), fEnabled);
     2015    }
     2016
     2017    /* Save machine-settings: */
     2018    machine().SaveSettings();
     2019    if (!machine().isOk())
     2020    {
     2021        /* Make sure action is updated: */
     2022        uisession()->updateAudioInput();
     2023        /* Notify about the error: */
     2024        return msgCenter().cannotSaveMachineSettings(machine());
     2025    }
     2026}
     2027
    19482028void UIMachineLogic::sltOpenNetworkSettingsDialog()
    19492029{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r64659 r68508  
    289289    void sltOpenVMSettingsDialog(const QString &strCategory = QString(), const QString &strControl = QString());
    290290    void sltOpenStorageSettingsDialog();
     291    void sltToggleAudioOutput(bool fEnabled);
     292    void sltToggleAudioInput(bool fEnabled);
    291293    void sltOpenNetworkSettingsDialog();
    292294    void sltOpenUSBDevicesSettingsDialog();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp

    r64813 r68508  
    12361236        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices));
    12371237        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices));
     1238        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_Audio));
    12381239        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_Network));
    12391240        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices));
    12401241        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_WebCams));
     1242        pMenu->addSeparator();
    12411243        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders));
    1242         pMenu->addSeparator();
    12431244        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard));
    12441245        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r68392 r68508  
    5959
    6060/* COM includes: */
     61# include "CAudioAdapter.h"
    6162# include "CSystemProperties.h"
    6263# include "CStorageController.h"
     
    756757    /* Notify listeners about storage device change: */
    757758    emit sigStorageDeviceChange(attachment, fRemoved, fSilent);
     759}
     760
     761void UISession::sltAudioAdapterChange()
     762{
     763    /* Make sure Audio adapter is present: */
     764    const CAudioAdapter comAdapter = machine().GetAudioAdapter();
     765    AssertMsgReturnVoid(machine().isOk() && comAdapter.isNotNull(),
     766                        ("Audio adapter should NOT be null!\n"));
     767
     768    /* Check/Uncheck Audio adapter output/input actions depending on features status: */
     769    actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(true);
     770    actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->setChecked(comAdapter.GetEnabledOut());
     771    actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(false);
     772    actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(true);
     773    actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->setChecked(comAdapter.GetEnabledIn());
     774    actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(false);
     775
     776    /* Notify listeners about Audio adapter change: */
     777    emit sigAudioAdapterChange();
     778
    758779}
    759780
     
    11381159    connect(gConsoleEvents, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
    11391160            this, SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
     1161
     1162    connect(gConsoleEvents, SIGNAL(sigAudioAdapterChange()),
     1163            this, SLOT(sltAudioAdapterChange()));
    11401164}
    11411165
     
    12781302        /* Input options: */
    12791303        actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->setChecked(isMouseIntegrated());
     1304
     1305        /* Devices options: */
     1306        {
     1307            const CAudioAdapter comAudio = m_machine.GetAudioAdapter();
     1308            actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(true);
     1309            actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->setChecked(comAudio.GetEnabledOut());
     1310            actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(false);
     1311            actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(true);
     1312            actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->setChecked(comAudio.GetEnabledIn());
     1313            actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(false);
     1314        }
    12801315
    12811316        /* What is the default close action and the restricted are? */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r67610 r68508  
    257257    /** Updates Video Capture action state. */
    258258    void updateStatusVideoCapture() { sltVideoCaptureChange(); }
     259    /** Updates Audio output action state. */
     260    void updateAudioOutput() { sltAudioAdapterChange(); }
     261    /** Updates Audio input action state. */
     262    void updateAudioInput() { sltAudioAdapterChange(); }
    259263
    260264    /** @name CPU hardware virtualization features for VM.
     
    302306    void sigCPUExecutionCapChange();
    303307    void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
     308    void sigAudioAdapterChange();
    304309
    305310    /** Notifies about host-screen count change. */
     
    347352    /** Handles storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */
    348353    void sltHandleStorageDeviceChange(const CMediumAttachment &attachment, bool fRemoved, bool fSilent);
     354    /** Handles audio adapter change. */
     355    void sltAudioAdapterChange();
    349356
    350357    /* Handlers: Display reconfiguration stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r68315 r68508  
    9898}
    9999
     100void UIMachineWindowNormal::sltAudioAdapterChange()
     101{
     102    /* Update audio stuff: */
     103    updateAppearanceOf(UIVisualElement_AudioStuff);
     104}
     105
    100106void UIMachineWindowNormal::sltNetworkAdapterChange()
    101107{
     
    208214        case IndicatorType_OpticalDisks:  pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices); break;
    209215        case IndicatorType_FloppyDisks:   pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);  break;
     216        case IndicatorType_Audio:         pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_Audio);          break;
    210217        case IndicatorType_Network:       pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_Network);        break;
    211218        case IndicatorType_USB:           pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices);     break;
     
    242249    connect(machineLogic()->uisession(), SIGNAL(sigUSBDeviceStateChange(const CUSBDevice &, bool, const CVirtualBoxErrorInfo &)),
    243250            this, SLOT(sltUSBDeviceStateChange()));
     251    connect(machineLogic()->uisession(), &UISession::sigAudioAdapterChange,
     252            this, &UIMachineWindowNormal::sltAudioAdapterChange);
    244253    connect(machineLogic()->uisession(), SIGNAL(sigNetworkAdapterChange(const CNetworkAdapter &)),
    245254            this, SLOT(sltNetworkAdapterChange()));
     
    451460    disconnect(machineLogic()->uisession(), SIGNAL(sigNetworkAdapterChange(const CNetworkAdapter &)),
    452461               this, SLOT(sltNetworkAdapterChange()));
     462    disconnect(machineLogic()->uisession(), &UISession::sigAudioAdapterChange,
     463               this, &UIMachineWindowNormal::sltAudioAdapterChange);
    453464    disconnect(machineLogic()->uisession(), SIGNAL(sigSharedFolderChange()),
    454465               this, SLOT(sltSharedFolderChange()));
     
    609620        if (iElement & UIVisualElement_FDStuff)
    610621            m_pIndicatorsPool->updateAppearance(IndicatorType_FloppyDisks);
     622        if (iElement & UIVisualElement_AudioStuff)
     623            m_pIndicatorsPool->updateAppearance(IndicatorType_Audio);
    611624        if (iElement & UIVisualElement_NetworkStuff)
    612625            m_pIndicatorsPool->updateAppearance(IndicatorType_Network);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r63229 r68508  
    5353    /** Handles USB device state change event. */
    5454    void sltUSBDeviceStateChange();
     55    /** Handles audio adapter change event. */
     56    void sltAudioAdapterChange();
    5557    /** Handles network adapter change event. */
    5658    void sltNetworkAdapterChange();
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