11 #include "ui_aircraftcomponent.h"
28 using namespace swift::gui::settings;
30 using namespace swift::core::context;
31 using namespace swift::misc::network;
32 using namespace swift::misc::simulation;
33 using namespace swift::misc::physical_quantities;
37 CAircraftComponent::CAircraftComponent(QWidget *parent) : QTabWidget(parent), ui(new Ui::
CAircraftComponent)
45 this->setCurrentIndex(0);
46 this->tabBar()->setExpanding(
false);
47 this->tabBar()->setUsesScrollButtons(
true);
48 ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::NetworkMode);
49 ui->tvp_AircraftInRange->configureMenu(
true,
true,
false,
true,
true,
true);
51 connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::modelDataChangedDigest,
this,
52 &CAircraftComponent::onRowCountChanged);
53 connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget,
this,
56 &CAircraftComponent::onConnectionStatusChanged, Qt::QueuedConnection);
58 &CAircraftComponent::onOwnAircraftMoved, Qt::QueuedConnection);
61 this->onSettingsChanged();
62 m_updateTimer.start();
69 Q_ASSERT(ui->tvp_AircraftInRange);
70 return ui->tvp_AircraftInRange->rowCount();
77 &CAircraftComponent::onInfoAreaTabBarChanged, Qt::QueuedConnection);
78 Q_ASSERT_X(c, Q_FUNC_INFO,
"failed connect");
79 Q_ASSERT_X(parentDockableWidget, Q_FUNC_INFO,
"missing parent");
80 return c && parentDockableWidget;
90 const bool visible = (this->
isVisibleWidget() && this->currentWidget() == ui->tb_AircraftInRange);
102 const int tabIndex =
static_cast<int>(tab);
103 this->setCurrentIndex(tabIndex);
106 void CAircraftComponent::updateViews()
112 void CAircraftComponent::onInfoAreaTabBarChanged(
int index)
120 QPointer<CAircraftComponent> myself(
this);
122 if (!myself) {
return; }
128 void CAircraftComponent::onRowCountChanged(
int count,
bool withFilter)
132 const int ac = this->indexOf(ui->tb_AircraftInRange);
133 QString acs = this->tabBar()->tabText(ac);
147 ui->tvp_AircraftInRange->configureMenuFastPositionUpdates(sendFast);
152 void CAircraftComponent::onSettingsChanged()
156 m_updateTimer.setInterval(ms);
159 void CAircraftComponent::onOwnAircraftMoved(
const CLength &distance)
const context::IContextOwnAircraft * getIContextOwnAircraft() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
const context::IContextSimulator * getIContextSimulator() const
Direct access to contexts if a CCoreFacade has been initialized.
virtual swift::misc::simulation::CSimulatedAircraftList getAircraftInRange() const =0
Aircraft list.
virtual swift::misc::network::CServer getConnectedServer() const =0
Server which is connected, if not connected empty default object.
virtual bool isConnected() const =0
Network connected?
static QString replaceTabCountValue(const QString &oldName, int count)
Replace count in name such as "stations (4)".
void changedInfoAreaTabBarIndex(int index)
Tab bar changed.
virtual bool setParentDockWidgetInfoArea(swift::gui::CDockWidgetInfoArea *parentDockableWidget)
Corresponding dockable widget in info area.
void requestTextMessageWidget(const swift::misc::aviation::CCallsign &callsign)
Request a text message.
void update()
Update aircraft/airport view.
void setTab(AircraftTab tab)
Set tab.
int countAircraftInView() const
Aircraft in range.
virtual ~CAircraftComponent()
Destructor.
Settings about view update rates.
const swift::misc::physical_quantities::CTime & getAircraftUpdateTime() const
Get time.
T get() const
Get a copy of the current value.
Value object encapsulating information about a connection status.
bool isConnected() const
Query status.
bool isDisconnected() const
Query status.
bool sendInterimPositions() const
FSD setup flags.
Value object encapsulating information of a server.
const CFsdSetup & getFsdSetup() const
Get FSD setup.
Physical unit length (length)
int toMs() const
Convenience functions when used with timers etc.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Models to be used with views, mainly QTableView.
Views, mainly QTableView.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...