File indexing completed on 2024-04-28 15:15:51

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2015 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_DBUSINTERFACE_H
0007 #define MARBLE_DBUSINTERFACE_H
0008 
0009 #include "marble_export.h"
0010 
0011 namespace Marble
0012 {
0013     class MarbleWidget;
0014 }
0015 
0016 #include <QDBusAbstractAdaptor>
0017 #include <QScopedPointer>
0018 #include <QStringList>
0019 #include <QPointF>
0020 
0021 namespace Marble {
0022 
0023 class MARBLE_EXPORT MarbleDBusInterface : public QDBusAbstractAdaptor
0024 {
0025     Q_OBJECT
0026     Q_CLASSINFO("D-Bus Interface", "org.kde.marble")
0027 
0028     Q_PROPERTY(QString mapTheme READ mapTheme WRITE setMapTheme NOTIFY mapThemeChanged)
0029     Q_PROPERTY(QStringList mapThemes READ mapThemes)
0030     Q_PROPERTY(int tileLevel READ tileLevel NOTIFY tileLevelChanged)
0031     Q_PROPERTY(int zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
0032     Q_PROPERTY(QStringList properties READ properties)
0033     Q_PROPERTY(QPointF center READ center WRITE setCenter NOTIFY centerChanged)
0034 
0035 public:
0036     explicit MarbleDBusInterface(MarbleWidget* widget);
0037     ~MarbleDBusInterface() override;
0038 
0039     QString mapTheme() const;
0040     QStringList mapThemes() const;
0041     int tileLevel() const;
0042     int zoom() const;
0043     QPointF center() const;
0044 
0045 public Q_SLOTS:
0046     void setMapTheme( const QString & mapTheme );
0047     void setZoom( int zoom );
0048     QStringList properties() const;
0049     void setCenter( const QPointF &center ) const;
0050 
0051 public Q_SLOTS:
0052     Q_INVOKABLE void setPropertyEnabled( const QString &key, bool enabled );
0053     Q_INVOKABLE bool isPropertyEnabled( const QString &key ) const;
0054 
0055 Q_SIGNALS:
0056     void mapThemeChanged( const QString &mapTheme );
0057     void tileLevelChanged( int tileLevel );
0058     void zoomChanged( int zoom );
0059     void centerChanged( const QPointF &center );
0060 
0061 private Q_SLOTS:
0062     void handleVisibleLatLonAltBoxChange();
0063 
0064 private:
0065     Q_DISABLE_COPY(MarbleDBusInterface)
0066     class Private;
0067     friend class Private;
0068     QScopedPointer<Private> const d;
0069 };
0070 
0071 }
0072 
0073 #endif