diff --git a/src/blackgui/aircraftcomponent.cpp b/src/blackgui/aircraftcomponent.cpp new file mode 100644 index 000000000..070b69f52 --- /dev/null +++ b/src/blackgui/aircraftcomponent.cpp @@ -0,0 +1,29 @@ +#include "aircraftcomponent.h" +#include "ui_aircraftcomponent.h" + +namespace BlackGui +{ + + CAircraftComponent::CAircraftComponent(QWidget *parent) : + QTabWidget(parent), CRuntimeBasedComponent(nullptr, false), ui(new Ui::CAircraftComponent), m_timerComponent(nullptr) + { + ui->setupUi(this); + m_timerComponent = new CTimerBasedComponent(SLOT(update()), this); + } + + CAircraftComponent::~CAircraftComponent() + { + delete ui; + } + + void CAircraftComponent::update() + { + Q_ASSERT(this->ui->tvp_AircraftsInRange); + Q_ASSERT(this->getIContextNetwork()); + + if (this->getIContextNetwork()->isConnected()) + { + this->ui->tvp_AircraftsInRange->update(this->getIContextNetwork()->getAircraftsInRange()); + } + } +} diff --git a/src/blackgui/aircraftcomponent.h b/src/blackgui/aircraftcomponent.h new file mode 100644 index 000000000..8ea93ee2d --- /dev/null +++ b/src/blackgui/aircraftcomponent.h @@ -0,0 +1,47 @@ +#ifndef BLACKGUI_AIRCRAFTCOMPONENT_H +#define BLACKGUI_AIRCRAFTCOMPONENT_H + +#include "blackgui/runtimebasedcomponent.h" +#include "blackgui/timerbasedcomponent.h" +#include "blackmisc/avaircraft.h" + +#include + +namespace Ui { class CAircraftComponent; } +namespace BlackGui +{ + //! Aircraft widget + class CAircraftComponent : public QTabWidget, public CRuntimeBasedComponent + { + Q_OBJECT + + public: + //! Constructor + explicit CAircraftComponent(QWidget *parent = nullptr); + + //! Destructor + ~CAircraftComponent(); + + //! Timer for updating + CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; } + + public slots: + //! Update users + void update(); + + //! \copydoc CTimerBasedComponent::setUpdateIntervalSeconds + void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateIntervalSeconds(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::CAircraftComponent *ui; + CTimerBasedComponent *m_timerComponent; + }; +} + +#endif // guard diff --git a/src/blackgui/aircraftcomponent.ui b/src/blackgui/aircraftcomponent.ui new file mode 100644 index 000000000..ab5715874 --- /dev/null +++ b/src/blackgui/aircraftcomponent.ui @@ -0,0 +1,58 @@ + + + CAircraftComponent + + + + 0 + 0 + 400 + 300 + + + + TabWidget + + + 0 + + + + In range + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + + + + + + + BlackGui::CAircraftView + QTableView +
blackgui/aircraftview.h
+
+
+ + +