Changeset 99083 in vbox for trunk/src/VBox
- Timestamp:
- Mar 21, 2023 11:34:44 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r99082 r99083 382 382 UIIndicatorNetwork(UIMachine *pMachine) 383 383 : UISessionStateStatusBarIndicator(IndicatorType_Network, pMachine) 384 , m_pTimerAutoUpdate(0)385 384 { 386 385 /* Assign state-icons: */ … … 389 388 setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/nw_write_16px.png")); 390 389 setStateIcon(KDeviceActivity_Null, UIIconPool::iconSet(":/nw_disabled_16px.png")); 391 /* Configure machine state-change listener: */390 /* Configure connection: */ 392 391 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); 404 395 /* Translate finally: */ 405 396 retranslateUi(); … … 428 419 setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null); 429 420 } 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;450 421 }; 451 422
Note:
See TracChangeset
for help on using the changeset viewer.