File indexing completed on 2025-01-05 03:59:21
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2006-2008 Torsten Rahn <tackat@kde.org> 0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org> 0005 // SPDX-FileCopyrightText: 2008 Jens-Michael Hoffmann <jensmh@gmx.de> 0006 // 0007 0008 #ifndef MARBLE_MAPTHEMEMANAGER_H 0009 #define MARBLE_MAPTHEMEMANAGER_H 0010 0011 #include <QObject> 0012 0013 #include "digikam_export.h" 0014 0015 #include <QStandardItemModel> 0016 #include <QString> 0017 #include <QStringList> 0018 0019 namespace Marble 0020 { 0021 0022 class GeoSceneDocument; 0023 class GeoDataPhotoOverlay; 0024 /** 0025 * @short The class that handles map themes that are locally available . 0026 * 0027 * This class which is able to check for maps that are locally available. 0028 * After parsing the data it only stores the name, description and path 0029 * into a QStandardItemModel. 0030 * 0031 * The MapThemeManager is not owned by the MarbleWidget/Map itself. 0032 * Instead it is owned by the widget or application that contains 0033 * MarbleWidget/Map ( usually: the ControlView convenience class ) 0034 * 0035 * For convenience MarbleThemeManager provides a static helper class 0036 * that loads the properties of a map theme into a GeoSceneDocument 0037 * object. 0038 * 0039 * @see GeoSceneDocument 0040 */ 0041 0042 class DIGIKAM_EXPORT MapThemeManager : public QObject 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 explicit MapThemeManager(QObject *parent = nullptr); 0048 ~MapThemeManager() override; 0049 0050 /** 0051 * @brief Returns a list of all locally available map theme IDs 0052 */ 0053 QStringList mapThemeIds() const; 0054 0055 /** 0056 * @brief Provides a model of the locally existing themes. 0057 * 0058 * This method provides a QStandardItemModel of all themes 0059 * that are available via MarbleDirs. 0060 */ 0061 QStandardItemModel* mapThemeModel(); 0062 0063 /** 0064 * @brief Provides a model of all installed planets. 0065 */ 0066 QStandardItemModel *celestialBodiesModel(); 0067 0068 /** 0069 * @brief Returns the map theme as a GeoSceneDocument object 0070 * @param mapThemeStringID the string ID that refers to the map theme 0071 * 0072 * This helper method should only get used by MarbleModel to load the 0073 * current theme into memory or by the MapThemeManager. 0074 */ 0075 static GeoSceneDocument* loadMapTheme( const QString& mapThemeStringID ); 0076 0077 /** 0078 * @brief Returns a map as a GeoSceneDocument object created from a GeoDataPhotoOverlay 0079 */ 0080 static GeoSceneDocument* createMapThemeFromOverlay( const GeoDataPhotoOverlay *overlayData ); 0081 0082 /** 0083 * @brief Deletes the map theme with the specified map theme ID. 0084 * @param mapThemeId ID of the map theme to be deleted 0085 * 0086 * Deletion will only succeed for local map themes, that is, if the map 0087 * theme's directory structure resides in the user's home directory. 0088 */ 0089 static void deleteMapTheme( const QString &mapThemeId ); 0090 0091 Q_SIGNALS: 0092 /** 0093 * @brief This signal will be Q_EMITted, when the themes change. 0094 */ 0095 void themesChanged(); 0096 0097 private: 0098 Q_PRIVATE_SLOT( d, void directoryChanged( const QString& path ) ) 0099 Q_PRIVATE_SLOT( d, void fileChanged( const QString & path ) ) 0100 0101 Q_DISABLE_COPY( MapThemeManager ) 0102 0103 class Private; 0104 friend class Private; 0105 Private * const d; 0106 }; 0107 0108 } 0109 0110 #endif