VirtualBox

Changeset 105233 in vbox


Ignore:
Timestamp:
Jul 9, 2024 11:04:57 AM (5 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10672: Runtime UI: Improve accessibility for USB indicator; Had to adjust details generation stuff for that as well.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r105150 r105233  
    13761376
    13771377void UIDetailsGenerator::acquireUsbStatusInfo(CMachine &comMachine, CConsole &comConsole,
    1378                                               QString &strInfo, bool &fUsbEnabled)
     1378                                              QString &strInfo, bool &fUsbEnabled, uint &cUsbFilterCount)
    13791379{
    13801380    /* Check whether there is at least one USB controller with an available proxy: */
     
    13861386        /* Enumerate all the USB devices: */
    13871387        foreach (const CUSBDevice &comUsbDevice, comConsole.GetUSBDevices())
     1388        {
     1389            ++cUsbFilterCount;
    13881390            strInfo += e_strTableRow1.arg(usbDetails(comUsbDevice));
     1391        }
    13891392        /* Handle 'no-usb-devices' case: */
    13901393        if (strInfo.isNull())
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h

    r104917 r105233  
    105105
    106106    SHARED_LIBRARY_STUFF void acquireUsbStatusInfo(CMachine &comMachine, CConsole &comConsole,
    107                                                    QString &strInfo, bool &fUsbEnableds);
     107                                                   QString &strInfo, bool &fUsbEnabled, uint &cUsbFilterCount);
    108108
    109109    SHARED_LIBRARY_STUFF void acquireSharedFoldersStatusInfo(CMachine &comMachine, CConsole &comConsole, CGuest &comGuest,
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r105197 r105233  
    568568    UIIndicatorUSB(UIMachine *pMachine)
    569569        : UISessionStateStatusBarIndicator(IndicatorType_USB, pMachine)
     570        , m_fUsbEnabled(false)
     571        , m_cUsbFilterCount(0)
    570572    {
    571573        /* Assign state-icons: */
     
    591593    {
    592594        QString strFullData;
    593         bool fUsbEnabled = false;
    594         m_pMachine->acquireUsbStatusInfo(strFullData, fUsbEnabled);
     595        m_fUsbEnabled = false;
     596        m_cUsbFilterCount = 0;
     597        m_pMachine->acquireUsbStatusInfo(strFullData, m_fUsbEnabled, m_cUsbFilterCount);
    595598
    596599        /* Show/hide indicator if there are no attachments
     
    598601        if (   parentWidget()
    599602            && parentWidget()->isVisible())
    600             setVisible(fUsbEnabled);
     603            setVisible(m_fUsbEnabled);
    601604
    602605        /* Update tool-tip: */
     
    604607            setToolTip(s_strTable.arg(strFullData));
    605608        /* Update indicator state: */
    606         setState(fUsbEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);
     609        setState(m_fUsbEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);
    607610
    608611        /* Retranslate finally: */
    609612        sltRetranslateUI();
    610613    }
     614
     615    /** Handles translation event. */
     616    virtual void sltRetranslateUI() RT_OVERRIDE
     617    {
     618        /* Call to base-class: */
     619        UISessionStateStatusBarIndicator::sltRetranslateUI();
     620
     621        /* Append description with more info: */
     622        const QString strUsbStatus = m_fUsbEnabled ? tr("USB enabled") : tr("USB disabled");
     623        const QString strFilterCount = m_cUsbFilterCount ? tr("%1 USB devices attached").arg(m_cUsbFilterCount)
     624                                                         : tr("No USB devices attached", "USB tooltip");
     625        m_strDescription = QString("%1, %2, %3").arg(m_strDescription, strUsbStatus, strFilterCount);
     626    }
     627
     628private:
     629
     630    /** Holds whether USB subsystem is enabled. */
     631    bool  m_fUsbEnabled;
     632    /** Holds USB device filter count. */
     633    uint  m_cUsbFilterCount;
     634
    611635};
    612636
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r105081 r105233  
    927927}
    928928
    929 void UIMachine::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds)
    930 {
    931     uisession()->acquireUsbStatusInfo(strInfo, fUsbEnableds);
     929void UIMachine::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnabled, uint &cUsbFilterCount)
     930{
     931    uisession()->acquireUsbStatusInfo(strInfo, fUsbEnabled, cUsbFilterCount);
    932932}
    933933
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r104917 r105233  
    635635        void acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected);
    636636        /** Acquires status info for USB indicator. */
    637         void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds);
     637        void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnabled, uint &cUsbFilterCount);
    638638        /** Acquires status info for Shared Folders indicator. */
    639639        void acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r105150 r105233  
    20182018}
    20192019
    2020 void UISession::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds)
     2020void UISession::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnabled, uint &cUsbFilterCount)
    20212021{
    20222022    CMachine comMachine = machine();
     
    20262026    if (comConsole.isNull())
    20272027        return;
    2028     UIDetailsGenerator::acquireUsbStatusInfo(comMachine, comConsole, strInfo, fUsbEnableds);
     2028    UIDetailsGenerator::acquireUsbStatusInfo(comMachine, comConsole, strInfo, fUsbEnabled, cUsbFilterCount);
    20292029}
    20302030
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r104917 r105233  
    517517        void acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected);
    518518        /** Acquires status info for USB indicator. */
    519         void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds);
     519        void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnabled, uint &cUsbFilterCount);
    520520        /** Acquires status info for Shared Folders indicator. */
    521521        void acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent);
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