File indexing completed on 2024-05-19 03:51:51

0001 /*
0002     SPDX-FileCopyrightText: 2008 Torsten Rahn <rahn@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef MARBLE_GEOSCENESETTINGS_H
0008 #define MARBLE_GEOSCENESETTINGS_H
0009 
0010 #include <QObject>
0011 #include <QVector>
0012 
0013 #include <geodata_export.h>
0014 
0015 #include "GeoDocument.h"
0016 
0017 class QString;
0018 
0019 namespace Marble
0020 {
0021 
0022 class GeoSceneProperty;
0023 class GeoSceneGroup;
0024 
0025 class GeoSceneSettingsPrivate;
0026 
0027 /**
0028  * @short Settings of a GeoScene document.
0029  */
0030 class GEODATA_EXPORT GeoSceneSettings : public QObject, 
0031                                         public GeoNode
0032 {
0033     Q_OBJECT
0034 
0035  public:
0036     GeoSceneSettings();
0037     ~GeoSceneSettings() override;
0038     const char* nodeType() const override;
0039 
0040     /**
0041      * @brief  Get the availability of a property across groups
0042      * @param  name  the property name
0043      * @param  available  availability of the property
0044      * @return @c true  the property was registered across groups
0045      *         @c false the property wasn't registered across groups
0046      */
0047     bool propertyAvailable( const QString& name, bool& available ) const;
0048 
0049     /**
0050      * @brief  Set the value of a property across groups
0051      * @param  name  the property name
0052      * @param  value  the value of the property
0053      * @return @c true  the property was found and changed accordingly
0054      *         @c false the property couldn't be found here
0055      */
0056     bool setPropertyValue( const QString& name, bool value );
0057 
0058     /**
0059      * @brief  Get the value of a property across groups
0060      * @param  name  the property name
0061      * @param  value  the value of the property
0062      * @return @c true  the property was found and returned accordingly
0063      *         @c false the property couldn't be found in this group
0064      */
0065     bool propertyValue( const QString& name, bool& value ) const;
0066 
0067     /**
0068      * @brief  Get the whole list of properties stored in the settings
0069      */
0070     QVector<GeoSceneProperty*> allProperties();
0071 
0072     /**
0073      * @brief  Get the whole list of properties stored in the settings
0074      */
0075     QVector<const GeoSceneProperty*> allProperties() const;
0076 
0077     /**
0078      * @brief  Add a group to the settings
0079      * @param  group  the new group
0080      */
0081     void addGroup( GeoSceneGroup* group );
0082 
0083     /**
0084      * @brief  Get a group from the settings
0085      * @param  name  the name of the group
0086      */
0087     const GeoSceneGroup* group( const QString& name ) const;
0088     GeoSceneGroup* group( const QString& name );
0089 
0090     /**
0091      * @brief  Add a property to the settings
0092      * @param  property  the new property
0093      */
0094     void addProperty( GeoSceneProperty* property );
0095 
0096     /**
0097      * @brief  Get a property from the settings
0098      * @param  name  the name of the property
0099      */
0100     const GeoSceneProperty* property( const QString& name ) const;
0101     GeoSceneProperty* property( const QString& name );
0102 
0103     /**
0104      * @brief  Get the properties that are categorized into groups
0105      *
0106      * NOTE: If you want all the properties distributed among groups 
0107      *       then please use:  QVector<GeoSceneProperty*> allProperties().
0108      */
0109     QVector<GeoSceneProperty*> rootProperties();
0110 
0111  Q_SIGNALS:
0112     void valueChanged( const QString&, bool );
0113 
0114  private:
0115     Q_DISABLE_COPY( GeoSceneSettings )
0116     GeoSceneSettingsPrivate * const d;
0117 };
0118 
0119 }
0120 
0121 #endif