mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
refs #239, added a helper class for timer based pulls
* changed user componet to use new component * all new components (aircraft, ATC stations) will use this timer * it is implemented as "has a" timer based component, as inheriting from 2 QObjects would be problematic
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define BLACKGUI_USERCOMPONENT_H
|
||||
|
||||
#include "blackgui/runtimebasedcomponent.h"
|
||||
#include "blackgui/timerbasedcomponent.h"
|
||||
#include "blackmisc/nwuserlist.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
@@ -24,19 +25,25 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
~CUserComponent();
|
||||
|
||||
//! Timer for updating
|
||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||
|
||||
public slots:
|
||||
//! Update users
|
||||
void update();
|
||||
|
||||
//! Update time, time < 100 stops updates
|
||||
void setUpdateInterval(int milliSeconds);
|
||||
//! \copydoc CTimerBasedComponent::setUpdateIntervalSeconds
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateIntervalSeconds(seconds); }
|
||||
|
||||
//! Update time
|
||||
void setUpdateIntervalSeconds(int seconds) { this->setUpdateInterval(1000 * seconds); }
|
||||
//! \copydoc CTimerBasedComponent::setUpdateInterval
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateInterval(milliSeconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::stopTimer
|
||||
void stopTimer() { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->stopTimer(); }
|
||||
|
||||
private:
|
||||
Ui::CUserComponent *ui;
|
||||
QTimer *m_timer;
|
||||
CTimerBasedComponent *m_timerComponent;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user