File indexing completed on 2024-04-28 15:16:05
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de> 0004 // 0005 0006 #ifndef MARBLE_RENDERPLUGINMODEL_H 0007 #define MARBLE_RENDERPLUGINMODEL_H 0008 0009 #include "marble_export.h" 0010 #include <QStandardItemModel> 0011 0012 #include <QList> 0013 0014 #include "PluginInterface.h" 0015 0016 namespace Marble 0017 { 0018 0019 class DialogConfigurationInterface; 0020 class RenderPlugin; 0021 0022 /** 0023 * @brief Provides common access to various kinds of plugins without having to know about their details. 0024 */ 0025 class MARBLE_EXPORT RenderPluginModel : public QStandardItemModel 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 /** 0031 * This enum contains the data roles for the QStandardItems. 0032 */ 0033 enum ItemDataRole { 0034 Name = Qt::DisplayRole, // QString 0035 Icon = Qt::DecorationRole, // QIcon 0036 Description = Qt::ToolTipRole, // QString 0037 NameId = Qt::UserRole + 2, // QString 0038 ConfigurationDialogAvailable, // bool 0039 BackendTypes, // QStringList 0040 Version, // QString 0041 AboutDataText, // QString 0042 CopyrightYears // QString 0043 }; 0044 0045 explicit RenderPluginModel( QObject *parent = nullptr ); 0046 0047 ~RenderPluginModel() override; 0048 0049 /** 0050 * @brief Set the RenderPlugins the model should manage. 0051 * 0052 * The given plugins must not be deleted as long as the model has a hold on them, 0053 * i.e. until the model is deleted or a different set of plugins is assigned. 0054 * 0055 * @param renderPlugins the RenderPlugins to be managed 0056 */ 0057 void setRenderPlugins( const QList<RenderPlugin *> &renderPlugins ); 0058 0059 QVector<PluginAuthor> pluginAuthors( const QModelIndex &index ) const; 0060 0061 DialogConfigurationInterface *pluginDialogConfigurationInterface( const QModelIndex &index ); 0062 0063 public Q_SLOTS: 0064 /** 0065 * Retrieve the current plugin state for the user interface. 0066 */ 0067 void retrievePluginState(); 0068 0069 /** 0070 * Apply the plugin state from the user interface. 0071 */ 0072 void applyPluginState(); 0073 0074 private: 0075 class Private; 0076 Private *const d; 0077 friend class Private; 0078 }; 0079 0080 } 0081 0082 #endif // MARBLE_RENDERPLUGINMODEL_H