File indexing completed on 2024-04-28 03:50:13

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Wes Hardaker <hardaker@users.sourceforge.net>
0004 //
0005 
0006 #ifndef APRSPLUGIN_H
0007 #define APRSPLUGIN_H
0008 
0009 #include <QDialog>
0010 
0011 #include "RenderPlugin.h"
0012 #include "DialogConfigurationInterface.h"
0013 #include "AprsObject.h"
0014 #include "AprsGatherer.h"
0015 #include "GeoDataLatLonAltBox.h"
0016 
0017 #include "ui_AprsConfigWidget.h"
0018 
0019 class QMutex;
0020 
0021 namespace Ui
0022 {
0023     class AprsConfigWidget;
0024 }
0025 
0026 namespace Marble
0027 {
0028 
0029 /**
0030  * \brief This class displays a layer of aprs (which aprs TBD).
0031  *
0032  */
0033     class AprsPlugin : public RenderPlugin, public DialogConfigurationInterface
0034     {
0035         Q_OBJECT
0036         Q_PLUGIN_METADATA(IID "org.kde.marble.AprsPlugin")
0037         Q_INTERFACES( Marble::RenderPluginInterface )
0038         Q_INTERFACES( Marble::DialogConfigurationInterface )
0039         MARBLE_PLUGIN( AprsPlugin )
0040 
0041             public:
0042         explicit AprsPlugin( const MarbleModel *marbleModel=nullptr );
0043         ~AprsPlugin() override;
0044         QStringList backendTypes() const override;
0045         QString renderPolicy() const override;
0046         QStringList renderPosition() const override;
0047         QString name() const override;
0048         QString guiString() const override;
0049         QString nameId() const override;
0050 
0051         QString version() const override;
0052 
0053         QString description() const override;
0054 
0055         QString copyrightYears() const override;
0056 
0057         QVector<PluginAuthor> pluginAuthors() const override;
0058 
0059         QIcon icon () const override;
0060 
0061         void initialize () override;
0062         bool isInitialized () const override;
0063         bool render( GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer = nullptr ) override;
0064 
0065         QDialog *configDialog() override;
0066         QAction       *action() const;
0067 
0068         QHash<QString,QVariant> settings() const override;
0069         void setSettings( const QHash<QString,QVariant> &settings ) override;
0070 
0071         void stopGatherers();
0072         void restartGatherers();
0073 
0074 
0075         private Q_SLOTS: 
0076         void readSettings();
0077         void writeSettings();
0078         void updateVisibility( bool visible );
0079         RenderType renderType() const override;
0080 
0081       private:
0082 
0083         QMutex                        *m_mutex;
0084         QMap<QString, AprsObject *>    m_objects;
0085         bool m_initialized;
0086         GeoDataLatLonAltBox            m_lastBox;
0087         AprsGatherer                  *m_tcpipGatherer,
0088                                       *m_ttyGatherer,
0089                                       *m_fileGatherer;
0090         QString                        m_filter;
0091         QAction                       *m_action;
0092 
0093         bool m_useInternet;
0094         bool m_useTty;
0095         bool m_useFile;
0096         QString m_aprsHost;
0097         int m_aprsPort;
0098         QString m_tncTty;
0099         QString m_aprsFile;
0100         bool m_dumpTcpIp;
0101         bool m_dumpTty;
0102         bool m_dumpFile;
0103         int m_fadeTime;
0104         int m_hideTime;
0105 
0106         QDialog               *m_configDialog;
0107         Ui::AprsConfigWidget  *ui_configWidget;
0108 
0109     };
0110 
0111 }
0112 
0113 #endif