mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #335, renaming
* the term "components" will only be used for GUI components (derived from QWidget/ QWidget derived classes) fron now on * timer, and enabler classes renamed accordingly: CEnableForRuntime, CEnableForDockWidgetInfoArea, CUpdateTimer * adjusted all dependent classes
This commit is contained in:
committed by
Roland Winklmeier
parent
bb8b515c87
commit
df5169ee98
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "aircraftcomponent.h"
|
||||
#include "ui_aircraftcomponent.h"
|
||||
#include "dockwidgetinfoareacomponent.h"
|
||||
#include "enablefordockwidgetinfoarea.h"
|
||||
#include "../guiutility.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_simulator.h"
|
||||
@@ -24,14 +24,14 @@ namespace BlackGui
|
||||
|
||||
CAircraftComponent::CAircraftComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CDockWidgetInfoAreaComponent(this),
|
||||
CRuntimeBasedComponent(nullptr, false),
|
||||
ui(new Ui::CAircraftComponent), m_timerComponent(nullptr)
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CAircraftComponent), m_updateTimer(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->ui->tvp_AirportsInRange->setResizeMode(CAirportView::ResizingOnce);
|
||||
m_timerComponent = new CTimerBasedComponent(SLOT(update()), this);
|
||||
m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
|
||||
connect(this->ui->tvp_AircraftsInRange, &CAircraftView::countChanged, this, &CAircraftComponent::ps_countChanged);
|
||||
connect(this->ui->tvp_AirportsInRange, &CAircraftView::countChanged, this, &CAircraftComponent::ps_countChanged);
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_AIRCRAFTCOMPONENT_H
|
||||
#define BLACKGUI_AIRCRAFTCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/timerbasedcomponent.h"
|
||||
#include "blackgui/components/dockwidgetinfoareacomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/components/updatetimer.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
@@ -28,8 +28,8 @@ namespace BlackGui
|
||||
//! Aircraft widget
|
||||
class CAircraftComponent :
|
||||
public QTabWidget,
|
||||
public CDockWidgetInfoAreaComponent,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace BlackGui
|
||||
~CAircraftComponent();
|
||||
|
||||
//! Timer for updating
|
||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||
CUpdateTimer *getTimerComponent() { return this->m_updateTimer; }
|
||||
|
||||
//! Aircrafts in range
|
||||
int countAircrafts() const;
|
||||
@@ -54,13 +54,13 @@ namespace BlackGui
|
||||
void update();
|
||||
|
||||
//! \copydoc CTimerBasedComponent::setUpdateIntervalSeconds
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateIntervalSeconds(seconds); }
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->setUpdateIntervalSeconds(seconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::setUpdateInterval
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateInterval(milliSeconds); }
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->setUpdateInterval(milliSeconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::stopTimer
|
||||
void stopTimer() { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->stopTimer(); }
|
||||
void stopTimer() { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->stopTimer(); }
|
||||
|
||||
protected:
|
||||
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||
@@ -75,7 +75,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftComponent> ui;
|
||||
CTimerBasedComponent *m_timerComponent;
|
||||
CUpdateTimer *m_updateTimer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace BlackGui
|
||||
{
|
||||
CAtcStationComponent::CAtcStationComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CDockWidgetInfoAreaComponent(this),
|
||||
CRuntimeBasedComponent(nullptr, false),
|
||||
ui(new Ui::CAtcStationComponent), m_timerComponent(nullptr)
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CAtcStationComponent), m_updateTimer(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->m_timerComponent = new CTimerBasedComponent(SLOT(update()), this);
|
||||
this->m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
|
||||
// some icons
|
||||
this->ui->pb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
@@ -217,8 +217,8 @@ namespace BlackGui
|
||||
|
||||
void CAtcStationComponent::ps_requestOnlineStationsUpdate()
|
||||
{
|
||||
this->m_timerComponent->fireTimer();
|
||||
this->m_timestampLastReadOnlineStations = CTimerBasedComponent::epoch();
|
||||
this->m_updateTimer->fireTimer();
|
||||
this->m_timestampLastReadOnlineStations = CUpdateTimer::epoch();
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_infoAreaTabBarChanged(int index)
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_ATCSTATIONCOMPONENT_H
|
||||
#define BLACKGUI_ATCSTATIONCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/timerbasedcomponent.h"
|
||||
#include "blackgui/components/dockwidgetinfoareacomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/components/updatetimer.h"
|
||||
|
||||
#include "blackmisc/avatcstation.h"
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace BlackGui
|
||||
*/
|
||||
class CAtcStationComponent :
|
||||
public QTabWidget,
|
||||
public CDockWidgetInfoAreaComponent,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
~CAtcStationComponent();
|
||||
|
||||
//! Timer for updating
|
||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||
CUpdateTimer *getTimerComponent() { return this->m_updateTimer; }
|
||||
|
||||
//! Number of booked stations
|
||||
int countBookedStations() const;
|
||||
@@ -59,13 +59,13 @@ namespace BlackGui
|
||||
void update();
|
||||
|
||||
//! \copydoc CTimerBasedComponent::setUpdateIntervalSeconds
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateIntervalSeconds(seconds); }
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->setUpdateIntervalSeconds(seconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::setUpdateInterval
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateInterval(milliSeconds); }
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->setUpdateInterval(milliSeconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::stopTimer
|
||||
void stopTimer() { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->stopTimer(); }
|
||||
void stopTimer() { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->stopTimer(); }
|
||||
|
||||
//! Get METAR for given ICAO airport code
|
||||
void getMetar(const QString &airportIcaoCode = "");
|
||||
@@ -113,11 +113,11 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAtcStationComponent> ui;
|
||||
CTimerBasedComponent *m_timerComponent;
|
||||
QDateTime m_timestampLastReadOnlineStations = CTimerBasedComponent::epoch(); //!< stations read
|
||||
QDateTime m_timestampOnlineStationsChanged = CTimerBasedComponent::epoch(); //!< stations marked as changed
|
||||
QDateTime m_timestampLastReadBookedStations = CTimerBasedComponent::epoch(); //!< stations read
|
||||
QDateTime m_timestampBookedStationsChanged = CTimerBasedComponent::epoch(); //!< stations marked as changed
|
||||
CUpdateTimer *m_updateTimer;
|
||||
QDateTime m_timestampLastReadOnlineStations = CUpdateTimer::epoch(); //!< stations read
|
||||
QDateTime m_timestampOnlineStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||
QDateTime m_timestampLastReadBookedStations = CUpdateTimer::epoch(); //!< stations read
|
||||
QDateTime m_timestampBookedStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace BlackGui
|
||||
{
|
||||
CCockpitComComponent::CCockpitComComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
CDockWidgetInfoAreaComponent(this),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
ui(new Ui::CCockpitMainComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||
#define BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||
|
||||
#include "dockwidgetinfoareacomponent.h"
|
||||
#include "enablefordockwidgetinfoarea.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackGui
|
||||
//! The main cockpit area
|
||||
class CCockpitComComponent :
|
||||
public QFrame,
|
||||
public CDockWidgetInfoAreaComponent
|
||||
public CEnableForDockWidgetInfoArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
~CCockpitComComponent();
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::paintEvent
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CCockpitV1Component::CCockpitV1Component(QWidget *parent) :
|
||||
QWidget(parent), CRuntimeBasedComponent(nullptr, false), ui(new Ui::CCockpitV1Component), m_externalCockpitIdentButton(nullptr), m_voiceRoomMembersTimer(nullptr)
|
||||
QWidget(parent), CEnableForRuntime(nullptr, false), ui(new Ui::CCockpitV1Component), m_externalCockpitIdentButton(nullptr), m_voiceRoomMembersTimer(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define BLACKGUI_COCKPITV1COMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include "blackmisc/aviocomsystem.h"
|
||||
#include "blackmisc/voiceroomlist.h"
|
||||
@@ -29,7 +30,7 @@ namespace BlackGui
|
||||
//! Cockpit component
|
||||
class CCockpitV1Component :
|
||||
public QWidget,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "dockwidgetinfoareacomponent.h"
|
||||
#include "enablefordockwidgetinfoarea.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CDockWidgetInfoAreaComponent::CDockWidgetInfoAreaComponent(QWidget *parent)
|
||||
CEnableForDockWidgetInfoArea::CEnableForDockWidgetInfoArea(QWidget *parent)
|
||||
{
|
||||
// it the parent is already an info area at this time, we keep it
|
||||
// otherwise we expect the info area to set it later
|
||||
@@ -25,7 +25,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
bool CDockWidgetInfoAreaComponent::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||
bool CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||
{
|
||||
// sanity check
|
||||
if (this->m_parentDockableInfoArea)
|
||||
@@ -40,28 +40,28 @@ namespace BlackGui
|
||||
return true;
|
||||
}
|
||||
|
||||
const CInfoArea *CDockWidgetInfoAreaComponent::getParentInfoArea() const
|
||||
const CInfoArea *CEnableForDockWidgetInfoArea::getParentInfoArea() const
|
||||
{
|
||||
Q_ASSERT(this->m_parentDockableInfoArea);
|
||||
if (!this->m_parentDockableInfoArea) return nullptr;
|
||||
return this->m_parentDockableInfoArea->getParentInfoArea();
|
||||
}
|
||||
|
||||
CInfoArea *CDockWidgetInfoAreaComponent::getParentInfoArea()
|
||||
CInfoArea *CEnableForDockWidgetInfoArea::getParentInfoArea()
|
||||
{
|
||||
Q_ASSERT(this->m_parentDockableInfoArea);
|
||||
if (!this->m_parentDockableInfoArea) return nullptr;
|
||||
return this->m_parentDockableInfoArea->getParentInfoArea();
|
||||
}
|
||||
|
||||
bool CDockWidgetInfoAreaComponent::isParentDockWidgetFloating() const
|
||||
bool CEnableForDockWidgetInfoArea::isParentDockWidgetFloating() const
|
||||
{
|
||||
Q_ASSERT(this->m_parentDockableInfoArea);
|
||||
if (!this->m_parentDockableInfoArea) return false;
|
||||
return this->m_parentDockableInfoArea->isFloating();
|
||||
}
|
||||
|
||||
bool CDockWidgetInfoAreaComponent::isVisibleWidget() const
|
||||
bool CEnableForDockWidgetInfoArea::isVisibleWidget() const
|
||||
{
|
||||
Q_ASSERT(this->m_parentDockableInfoArea);
|
||||
if (!this->m_parentDockableInfoArea) return false;
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_DOCKWIDGETINFOAREACOMPONENT_H
|
||||
#define BLACKGUI_DOCKWIDGETINFOAREACOMPONENT_H
|
||||
#ifndef BLACKGUI_ENABLEFORDOCKWIDGETINFOAREA_H
|
||||
#define BLACKGUI_ENABLEFORDOCKWIDGETINFOAREA_H
|
||||
|
||||
#include "../dockwidgetinfoarea.h"
|
||||
#include "../infoarea.h"
|
||||
@@ -21,16 +21,16 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
|
||||
//! Helper class: Component is residing in an dockable widget.
|
||||
//! Helper class: If a component is residing in an dockable widget.
|
||||
//! This class provides access to its info area and dockable widget.
|
||||
class CDockWidgetInfoAreaComponent
|
||||
class CEnableForDockWidgetInfoArea
|
||||
{
|
||||
public:
|
||||
//! Corresponding dockable widget in info area
|
||||
BlackGui::CDockWidgetInfoArea *getDockWidget() { return m_parentDockableInfoArea; }
|
||||
BlackGui::CDockWidgetInfoArea *getDockWidgetInfoArea() { return m_parentDockableInfoArea; }
|
||||
|
||||
//! Corresponding dockable widget in info area
|
||||
const BlackGui::CDockWidgetInfoArea *getDockWidget() const { return m_parentDockableInfoArea; }
|
||||
const BlackGui::CDockWidgetInfoArea *getDockWidgetInfoArea() const { return m_parentDockableInfoArea; }
|
||||
|
||||
//! Corresponding dockable widget in info area
|
||||
//! \remarks Usually set from CDockWidgetInfoArea when it is fully initialized
|
||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CDockWidgetInfoAreaComponent(QWidget *parent);
|
||||
CEnableForDockWidgetInfoArea(QWidget *parent);
|
||||
|
||||
private:
|
||||
BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackcore/context_all_interfaces.h"
|
||||
#include <QWidget>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
void CRuntimeBasedComponent::setRuntime(BlackCore::CRuntime *runtime, bool runtimeOwner)
|
||||
void CEnableForRuntime::setRuntime(BlackCore::CRuntime *runtime, bool runtimeOwner)
|
||||
{
|
||||
Q_ASSERT(runtime);
|
||||
this->m_runtime = runtime;
|
||||
@@ -23,7 +23,7 @@ namespace BlackGui
|
||||
this->runtimeHasBeenSet();
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent)
|
||||
void CEnableForRuntime::setRuntimeForComponents(BlackCore::CRuntime *runtime, QWidget *parent)
|
||||
{
|
||||
if (!parent) return;
|
||||
|
||||
@@ -32,90 +32,90 @@ namespace BlackGui
|
||||
foreach(QWidget * widget, children)
|
||||
{
|
||||
if (widget->objectName().isEmpty()) continue; // rule out unamed widgets
|
||||
CRuntimeBasedComponent *rbc = dynamic_cast<CRuntimeBasedComponent *>(widget);
|
||||
CEnableForRuntime *rbc = dynamic_cast<CEnableForRuntime *>(widget);
|
||||
if (rbc) rbc->setRuntime(runtime, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::createRuntime(const BlackCore::CRuntimeConfig &config, QObject *parent)
|
||||
void CEnableForRuntime::createRuntime(const BlackCore::CRuntimeConfig &config, QObject *parent)
|
||||
{
|
||||
this->m_runtime = new BlackCore::CRuntime(config, parent);
|
||||
this->m_runtimeOwner = true;
|
||||
}
|
||||
|
||||
const BlackCore::IContextApplication *CRuntimeBasedComponent::getIContextApplication() const
|
||||
const BlackCore::IContextApplication *CEnableForRuntime::getIContextApplication() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextApplication();
|
||||
}
|
||||
|
||||
BlackCore::IContextApplication *CRuntimeBasedComponent::getIContextApplication()
|
||||
BlackCore::IContextApplication *CEnableForRuntime::getIContextApplication()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextApplication();
|
||||
}
|
||||
|
||||
BlackCore::IContextAudio *CRuntimeBasedComponent::getIContextAudio()
|
||||
BlackCore::IContextAudio *CEnableForRuntime::getIContextAudio()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextAudio();
|
||||
}
|
||||
|
||||
const BlackCore::IContextAudio *CRuntimeBasedComponent::getIContextAudio() const
|
||||
const BlackCore::IContextAudio *CEnableForRuntime::getIContextAudio() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextAudio();
|
||||
}
|
||||
|
||||
BlackCore::IContextNetwork *CRuntimeBasedComponent::getIContextNetwork()
|
||||
BlackCore::IContextNetwork *CEnableForRuntime::getIContextNetwork()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextNetwork();
|
||||
}
|
||||
|
||||
const BlackCore::IContextNetwork *CRuntimeBasedComponent::getIContextNetwork() const
|
||||
const BlackCore::IContextNetwork *CEnableForRuntime::getIContextNetwork() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextNetwork();
|
||||
}
|
||||
|
||||
BlackCore::IContextOwnAircraft *CRuntimeBasedComponent::getIContextOwnAircraft()
|
||||
BlackCore::IContextOwnAircraft *CEnableForRuntime::getIContextOwnAircraft()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextOwnAircraft();
|
||||
}
|
||||
|
||||
const BlackCore::IContextOwnAircraft *CRuntimeBasedComponent::getIContextOwnAircraft() const
|
||||
const BlackCore::IContextOwnAircraft *CEnableForRuntime::getIContextOwnAircraft() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextOwnAircraft();
|
||||
}
|
||||
|
||||
BlackCore::IContextSettings *CRuntimeBasedComponent::getIContextSettings()
|
||||
BlackCore::IContextSettings *CEnableForRuntime::getIContextSettings()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSettings();
|
||||
}
|
||||
|
||||
const BlackCore::IContextSettings *CRuntimeBasedComponent::getIContextSettings() const
|
||||
const BlackCore::IContextSettings *CEnableForRuntime::getIContextSettings() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSettings();
|
||||
}
|
||||
|
||||
const BlackCore::IContextSimulator *CRuntimeBasedComponent::getIContextSimulator() const
|
||||
const BlackCore::IContextSimulator *CEnableForRuntime::getIContextSimulator() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSimulator();
|
||||
}
|
||||
|
||||
BlackCore::IContextSimulator *CRuntimeBasedComponent::getIContextSimulator()
|
||||
BlackCore::IContextSimulator *CEnableForRuntime::getIContextSimulator()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSimulator();
|
||||
}
|
||||
|
||||
void CRuntimeBasedComponent::playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const
|
||||
void CEnableForRuntime::playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const
|
||||
{
|
||||
if (!this->getIContextAudio()) return;
|
||||
this->getIContextAudio()->playNotification(static_cast<uint>(notification), true);
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_RUNTIMEBASEDCOMPONENT_H
|
||||
#define BLACKGUI_RUNTIMEBASEDCOMPONENT_H
|
||||
#ifndef BLACKGUI_ENABLEFORRUNTIME_H
|
||||
#define BLACKGUI_ENABLEFORRUNTIME_H
|
||||
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackmisc/notificationsounds.h"
|
||||
@@ -39,7 +39,7 @@ namespace BlackGui
|
||||
* the component widely independent from a central data provideer
|
||||
* \sa BlackCore::CRuntime
|
||||
*/
|
||||
class CRuntimeBasedComponent
|
||||
class CEnableForRuntime
|
||||
{
|
||||
public:
|
||||
//! Set runtime, usually set by runtime owner (must only be one, usually main window)
|
||||
@@ -59,7 +59,7 @@ namespace BlackGui
|
||||
//! Constructor
|
||||
//! \remarks Usually runtime will be provided later, not at initialization time.
|
||||
//! If runtime is provided right now, make sure to call runtimeHasBeenSet afterwards
|
||||
CRuntimeBasedComponent(BlackCore::CRuntime *runtime = nullptr, bool runtimeOwner = false) :
|
||||
CEnableForRuntime(BlackCore::CRuntime *runtime = nullptr, bool runtimeOwner = false) :
|
||||
m_runtime(runtime), m_runtimeOwner(runtimeOwner)
|
||||
{}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace BlackGui
|
||||
{
|
||||
CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CRuntimeBasedComponent(nullptr, false),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CFlightPlanComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_FLIGHTPLANCOMPONENT_H
|
||||
#define BLACKGUI_FLIGHTPLANCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include "blackmisc/avflightplan.h"
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace BlackGui
|
||||
//! Flight plan widget
|
||||
class CFlightPlanComponent :
|
||||
public QTabWidget,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_INFOBARSTATUSCOMPONENT_H
|
||||
#define BLACKGUI_INFOBARSTATUSCOMPONENT_H
|
||||
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "../led.h"
|
||||
#include <QFrame>
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackGui
|
||||
//! Info bar displaying status (Network, Simulator, DBus)
|
||||
class CInfoBarStatusComponent :
|
||||
public QFrame,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_LOGCOMPONENT_H
|
||||
#define BLACKGUI_LOGCOMPONENT_H
|
||||
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
|
||||
#include <QFrame>
|
||||
@@ -28,7 +28,7 @@ namespace BlackGui
|
||||
//! GUI displaying log and status messages
|
||||
class CLogComponent :
|
||||
public QFrame,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
||||
*/
|
||||
CSettingsComponent::CSettingsComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CRuntimeBasedComponent(nullptr, false),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CSettingsComponent),
|
||||
m_audioTestRunning(NoAudioTest)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_SETTINGSCOMPONENT_H
|
||||
#define BLACKGUI_SETTINGSCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackmisc/nwserver.h"
|
||||
#include "blackmisc/avaircrafticao.h"
|
||||
#include <QTabWidget>
|
||||
@@ -30,7 +30,7 @@ namespace BlackGui
|
||||
//! Settings component
|
||||
class CSettingsComponent :
|
||||
public QTabWidget,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CSettingsFsxComponent::CSettingsFsxComponent(QWidget *parent) :
|
||||
QFrame(parent), CRuntimeBasedComponent(nullptr, false), ui(new Ui::CSettingsFsxComponent)
|
||||
QFrame(parent), CEnableForRuntime(nullptr, false), ui(new Ui::CSettingsFsxComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_SETTINGSFSXCOMPONENT_H
|
||||
#define BLACKGUI_SETTINGSFSXCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CSettingsFsxComponent; }
|
||||
@@ -22,7 +22,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
//! Settings for FSX
|
||||
class CSettingsFsxComponent : public QFrame, public CRuntimeBasedComponent
|
||||
class CSettingsFsxComponent : public QFrame, public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackGui
|
||||
{
|
||||
CSettingsSimulatorComponent::CSettingsSimulatorComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
CRuntimeBasedComponent(nullptr, false),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CSettingsSimulatorComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
|
||||
#define BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
|
||||
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include "blacksim/setsimulator.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "enableforruntime.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CSettingsSimulatorComponent; }
|
||||
@@ -14,7 +24,7 @@ namespace BlackGui
|
||||
/*!
|
||||
* All simulator settings component (GUI)
|
||||
*/
|
||||
class CSettingsSimulatorComponent : public QFrame, public CRuntimeBasedComponent
|
||||
class CSettingsSimulatorComponent : public QFrame, public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace BlackGui
|
||||
{
|
||||
CSimulatorComponent::CSimulatorComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CDockWidgetInfoAreaComponent(this),
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
ui(new Ui::CSimulatorComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_SIMULATORCOMPONENT_H
|
||||
#define BLACKGUI_SIMULATORCOMPONENT_H
|
||||
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackgui/components/dockwidgetinfoareacomponent.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QScopedPointer>
|
||||
@@ -28,8 +28,8 @@ namespace BlackGui
|
||||
//! Simulator component
|
||||
class CSimulatorComponent :
|
||||
public QTabWidget,
|
||||
public CDockWidgetInfoAreaComponent,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace BlackGui
|
||||
{
|
||||
|
||||
CTextMessageComponent::CTextMessageComponent(QWidget *parent) :
|
||||
QTabWidget(parent), CRuntimeBasedComponent(nullptr, false), ui(new Ui::CTextMessageComponent), m_selcalCallback(nullptr), m_clearTextEditAction(nullptr), m_currentTextEdit(nullptr)
|
||||
QTabWidget(parent), CEnableForRuntime(nullptr, false), ui(new Ui::CTextMessageComponent), m_selcalCallback(nullptr), m_clearTextEditAction(nullptr), m_currentTextEdit(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->m_clearTextEditAction = new QAction("Clear", this);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_TEXTMESSAGECOMPONENT_H
|
||||
#define BLACKGUI_TEXTMESSAGECOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include "blackmisc/nwtextmessagelist.h"
|
||||
@@ -30,7 +30,7 @@ namespace BlackGui
|
||||
//! Text message widget
|
||||
class CTextMessageComponent :
|
||||
public QTabWidget,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "timerbasedcomponent.h"
|
||||
#include "updatetimer.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CTimerBasedComponent::CTimerBasedComponent(const char *slot, QObject *parent) :
|
||||
CUpdateTimer::CUpdateTimer(const char *slot, QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
@@ -24,13 +24,14 @@ namespace BlackGui
|
||||
this->connect(this->m_timerSingleShot, SIGNAL(timeout()), parent, slot);
|
||||
}
|
||||
|
||||
CTimerBasedComponent::~CTimerBasedComponent()
|
||||
CUpdateTimer::~CUpdateTimer()
|
||||
{
|
||||
this->m_timer->stop();
|
||||
this->m_timerSingleShot->stop();
|
||||
if (this->parent()) this->disconnect(this->parent());
|
||||
}
|
||||
|
||||
void CTimerBasedComponent::setUpdateInterval(int milliSeconds)
|
||||
void CUpdateTimer::setUpdateInterval(int milliSeconds)
|
||||
{
|
||||
if (milliSeconds < 100)
|
||||
{
|
||||
@@ -43,11 +44,11 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CTimerBasedComponent::fireTimer()
|
||||
void CUpdateTimer::fireTimer()
|
||||
{
|
||||
Q_ASSERT(this->m_timerSingleShot);
|
||||
this->m_timer->start(); // restart other timer
|
||||
this->m_timerSingleShot->start(10);
|
||||
}
|
||||
}
|
||||
} // guard
|
||||
} // namespace
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_TIMERBASEDCOMPONENT_H
|
||||
#define BLACKGUI_TIMERBASEDCOMPONENT_H
|
||||
#ifndef BLACKGUI_UPDATETIMER_H
|
||||
#define BLACKGUI_UPDATETIMER_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
@@ -19,17 +19,17 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
//! Helper class: Timer based componenet
|
||||
class CTimerBasedComponent: public QObject
|
||||
//! Timer used in components for updates
|
||||
class CUpdateTimer: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CTimerBasedComponent(const char *slot, QObject *parent);
|
||||
CUpdateTimer(const char *slot, QObject *parent);
|
||||
|
||||
//! Destructor
|
||||
~CTimerBasedComponent();
|
||||
~CUpdateTimer();
|
||||
|
||||
//! Date/time of 1/1/1970, used to init timestamp values as "outdated"
|
||||
static const QDateTime &epoch()
|
||||
@@ -52,8 +52,8 @@ namespace BlackGui
|
||||
void fireTimer();
|
||||
|
||||
private:
|
||||
QTimer *m_timer = nullptr;
|
||||
QTimer *m_timerSingleShot = nullptr;
|
||||
QTimer *m_timer = nullptr; //!< periodically updating
|
||||
QTimer *m_timerSingleShot = nullptr; //!< single update
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,13 @@ namespace BlackGui
|
||||
{
|
||||
CUserComponent::CUserComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CDockWidgetInfoAreaComponent(this),
|
||||
CRuntimeBasedComponent(nullptr, false),
|
||||
ui(new Ui::CUserComponent), m_timerComponent(nullptr)
|
||||
CEnableForDockWidgetInfoArea(this),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CUserComponent), m_updateTimer(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->m_timerComponent = new CTimerBasedComponent(SLOT(update()), this);
|
||||
this->m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
|
||||
connect(this->ui->tvp_AllUsers, &CUserView::countChanged, this, &CUserComponent::ps_countChanged);
|
||||
connect(this->ui->tvp_Clients, &CClientView::countChanged, this, &CUserComponent::ps_countChanged);
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_USERCOMPONENT_H
|
||||
#define BLACKGUI_USERCOMPONENT_H
|
||||
|
||||
#include "blackgui/components/runtimebasedcomponent.h"
|
||||
#include "blackgui/components/timerbasedcomponent.h"
|
||||
#include "blackgui/components/dockwidgetinfoareacomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/components/updatetimer.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QTimer>
|
||||
@@ -29,8 +29,8 @@ namespace BlackGui
|
||||
//! User componenet (users, clients)
|
||||
class CUserComponent :
|
||||
public QTabWidget,
|
||||
public CDockWidgetInfoAreaComponent,
|
||||
public CRuntimeBasedComponent
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
||||
~CUserComponent();
|
||||
|
||||
//! Timer for updating
|
||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||
CUpdateTimer *getTimerComponent() { return this->m_updateTimer; }
|
||||
|
||||
//! Number of clients
|
||||
int countClients() const;
|
||||
@@ -55,13 +55,13 @@ namespace BlackGui
|
||||
void update();
|
||||
|
||||
//! \copydoc CTimerBasedComponent::setUpdateIntervalSeconds
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateIntervalSeconds(seconds); }
|
||||
void setUpdateIntervalSeconds(int seconds) { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->setUpdateIntervalSeconds(seconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::setUpdateInterval
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->setUpdateInterval(milliSeconds); }
|
||||
void setUpdateInterval(int milliSeconds) { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->setUpdateInterval(milliSeconds); }
|
||||
|
||||
//! \copydoc CTimerBasedComponent::stopTimer
|
||||
void stopTimer() { Q_ASSERT(this->m_timerComponent); this->m_timerComponent->stopTimer(); }
|
||||
void stopTimer() { Q_ASSERT(this->m_updateTimer); this->m_updateTimer->stopTimer(); }
|
||||
|
||||
private slots:
|
||||
//! Number of elements changed
|
||||
@@ -69,7 +69,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CUserComponent> ui;
|
||||
CTimerBasedComponent *m_timerComponent;
|
||||
CUpdateTimer *m_updateTimer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user