File indexing completed on 2024-05-05 03:49:16

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef DECLARATIVE_MAPTHEMEMANAGER_H
0007 #define DECLARATIVE_MAPTHEMEMANAGER_H
0008 
0009 #include "MapThemeManager.h"
0010 
0011 #include <QQuickImageProvider>
0012 
0013 class MapThemeImageProvider : public QQuickImageProvider
0014 {
0015 public:
0016     MapThemeImageProvider();
0017 
0018     QPixmap requestPixmap( const QString &id, QSize *size, const QSize &requestedSize ) override;
0019 
0020 private:
0021     /** @todo FIXME It is a bit ugly to keep a separate object that loads all themes again
0022       * just to provide their images to QML. The API change before Qt 4.7 made this necessary
0023       * however (it's not possible anymore to assign a QPixmap property to QML images) */
0024     Marble::MapThemeManager m_mapThemeManager;
0025 };
0026 
0027 /**
0028   * Provides access to all map themes installed locally
0029   */
0030 class MapThemeManager : public QObject
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     /** Constructor. Map themes are loaded later on demand. */
0036     explicit MapThemeManager( QObject *parent = nullptr );
0037 
0038     /**
0039       * A list of all installed map theme ids, each entry has the form
0040       * "planet/themeid/themeid.dgml", e.g. "earth/bluemarble/bluemarble.dgml"
0041       */
0042     QStringList mapThemeIds() const;
0043 
0044 private:
0045     /** Marble map theme manager doing the real work */
0046     Marble::MapThemeManager m_mapThemeManager;
0047 };
0048 
0049 #endif // DECLARATIVE_MAPTHEMEMANAGER_H