MarbleDBusInterface.h 1.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2015      Dennis Nienhüser <earthwings@gentoo.org>
//

namespace Marble
{
    class MarbleWidget;
}

#include <QDBusAbstractAdaptor>
#include <QScopedPointer>
#include <QStringList>
#include <QPointF>

namespace Marble {

class MarbleDBusInterface : public QDBusAbstractAdaptor
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "org.kde.marble")

    Q_PROPERTY(QString mapTheme READ mapTheme WRITE setMapTheme NOTIFY mapThemeChanged)
    Q_PROPERTY(QStringList mapThemes READ mapThemes)
    Q_PROPERTY(int tileLevel READ tileLevel NOTIFY tileLevelChanged)
    Q_PROPERTY(int zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
    Q_PROPERTY(QStringList properties READ properties)
    Q_PROPERTY(QPointF center READ center WRITE setCenter NOTIFY centerChanged)

public:
    explicit MarbleDBusInterface(MarbleWidget* widget);
    ~MarbleDBusInterface();

    QString mapTheme() const;
    QStringList mapThemes() const;
    int tileLevel() const;
    int zoom() const;
    QPointF center() const;

public Q_SLOTS:
    void setMapTheme( const QString & mapTheme );
    void setZoom( int zoom );
    QStringList properties() const;
    void setCenter( const QPointF &center ) const;

public Q_SLOTS:
    Q_INVOKABLE void setPropertyEnabled( const QString &key, bool enabled );
    Q_INVOKABLE bool isPropertyEnabled( const QString &key ) const;

Q_SIGNALS:
    void mapThemeChanged( const QString &mapTheme );
    void tileLevelChanged( int tileLevel );
    void zoomChanged( int zoom );
    void centerChanged( const QPointF &center );

private Q_SLOTS:
    void handleVisibleLatLonAltBoxChange();

private:
    Q_DISABLE_COPY(MarbleDBusInterface)
    class Private;
    friend class Private;
    QScopedPointer<Private> const d;
};

}