VirtualBox

Changeset 99083 in vbox for trunk


Ignore:
Timestamp:
Mar 21, 2023 11:34:44 AM (23 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Network status-bar indicator do not need update timer anymore, we have network-adapter-change event for attachment type and cable state.

File:
1 edited

Legend:

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

    r99082 r99083  
    382382    UIIndicatorNetwork(UIMachine *pMachine)
    383383        : UISessionStateStatusBarIndicator(IndicatorType_Network, pMachine)
    384         , m_pTimerAutoUpdate(0)
    385384    {
    386385        /* Assign state-icons: */
     
    389388        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/nw_write_16px.png"));
    390389        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/nw_disabled_16px.png"));
    391         /* Configure machine state-change listener: */
     390        /* Configure connection: */
    392391        connect(m_pMachine, &UIMachine::sigMachineStateChange,
    393                 this, &UIIndicatorNetwork::sltHandleMachineStateChange);
    394         /* Create auto-update timer: */
    395         m_pTimerAutoUpdate = new QTimer(this);
    396         if (m_pTimerAutoUpdate)
    397         {
    398             /* Configure auto-update timer: */
    399             connect(m_pTimerAutoUpdate, &QTimer::timeout,
    400                     this, &UIIndicatorNetwork::updateAppearance);
    401             /* Start timer immediately if machine is running: */
    402             sltHandleMachineStateChange();
    403         }
     392                this, &UIIndicatorNetwork::updateAppearance);
     393        connect(m_pMachine, &UIMachine::sigNetworkAdapterChange,
     394                this, &UIIndicatorNetwork::updateAppearance);
    404395        /* Translate finally: */
    405396        retranslateUi();
     
    428419        setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null);
    429420    }
    430 
    431 private slots:
    432 
    433     /** Updates auto-update timer depending on machine state. */
    434     void sltHandleMachineStateChange()
    435     {
    436         if (m_pMachine->machineState() == KMachineState_Running)
    437         {
    438             /* Start auto-update timer otherwise: */
    439             m_pTimerAutoUpdate->start(5000);
    440             return;
    441         }
    442         /* Stop auto-update timer otherwise: */
    443         m_pTimerAutoUpdate->stop();
    444     }
    445 
    446 private:
    447 
    448     /** Holds the auto-update timer instance. */
    449     QTimer *m_pTimerAutoUpdate;
    450421};
    451422
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