/* 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. */ //! \file #ifndef BLACKGUI_ATCSTATIONCOMPONENT_H #define BLACKGUI_ATCSTATIONCOMPONENT_H #include "blackcore/network.h" #include "blackgui/blackguiexport.h" #include "blackgui/components/enablefordockwidgetinfoarea.h" #include "blackgui/settings/viewupdatesettings.h" #include "blackgui/settings/atcstationssettings.h" #include "blackmisc/aviation/atcstation.h" #include "blackmisc/aviation/comsystem.h" #include "blackmisc/identifiable.h" #include "blackmisc/pq/frequency.h" #include #include #include #include #include #include #include #include class QWidget; namespace BlackMisc { namespace Aviation { class CCallsign; } } namespace Ui { class CAtcStationComponent; } namespace BlackGui { class CDockWidgetInfoArea; namespace Components { //! ATC stations component class BLACKGUI_EXPORT CAtcStationComponent : public QTabWidget, public CEnableForDockWidgetInfoArea, public BlackMisc::CIdentifiable { Q_OBJECT public: //! Constructor explicit CAtcStationComponent(QWidget *parent = nullptr); //! Destructor virtual ~CAtcStationComponent(); //! Number of booked stations int countBookedStations() const; //! Number of online stations int countOnlineStations() const; //! Update stations void update(); //! Get METAR for given ICAO airport code void getMetar(const QString &airportIcaoCode); //! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget) override; signals: //! Request a text message void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign); //! Request audio widget void requestAudioWidget(); private: //! \copydoc Models::CAtcStationListModel::changedAtcStationConnectionStatus void changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &station, bool added); //! Get all METARs void getMetarAsEntered(); //! Request new ATIS void requestAtis(); //! Online ATC station selected void onlineAtcStationSelected(QModelIndex index); //! Tab changed void atcStationsTabChanged(); //! Booked stations reloading void reloadAtcStationsBooked(); //! Booked stations changed void changedAtcStationsBooked(); //! Online stations changed void changedAtcStationsOnline(); //! Connection status has been changed void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); //! Request dummy ATC online stations void testCreateDummyOnlineAtcStations(int number); //! Request udpate void requestOnlineStationsUpdate(); //! Info area tab bar has changed void infoAreaTabBarChanged(int index); //! Count has been changed void onCountChanged(int count, bool withFilter); //! Set COM frequency void setComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit); //! Airports read from web readers void airportsRead(); //! Build a tree view for ATC stations void updateTreeView(); //! Init the completers void initCompleters(); //! Settings have been changed void settingsChanged(); QScopedPointer ui; QTimer m_updateTimer; QDateTime m_timestampLastReadOnlineStations; //!< stations read QDateTime m_timestampOnlineStationsChanged; //!< stations marked as changed QDateTime m_timestampLastReadBookedStations; //!< stations read QDateTime m_timestampBookedStationsChanged; //!< stations marked as changed BlackMisc::CSettingReadOnly m_settingsView { this, &CAtcStationComponent::settingsChanged }; BlackMisc::CSettingReadOnly m_settingsAtc { this, &CAtcStationComponent::settingsChanged }; }; } // namespace } // namespace #endif // guard