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

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_GEOSCENEGROUP_H
0008 #define MARBLE_GEOSCENEGROUP_H
0009 
0010 #include <QObject>
0011 #include <QString>
0012 #include <QVector>
0013 
0014 #include "GeoDocument.h"
0015 
0016 namespace Marble
0017 {
0018 
0019 class GeoSceneProperty;
0020 
0021 /**
0022  * @short Group inside the settings of a GeoScene document.
0023  */
0024 
0025 class GeoSceneGroup : public QObject,
0026                       public GeoNode
0027 {
0028     Q_OBJECT
0029 
0030  public:
0031     explicit GeoSceneGroup( const QString& name );
0032     ~GeoSceneGroup() override;
0033 
0034     /**
0035      * @brief  Get the availability of a property in this group
0036      * @param  name  the property name
0037      * @param  available  availability of the property
0038      * @return @c true  the property was registered in this group
0039      *         @c false the property wasn't registered in this group
0040      */
0041     bool propertyAvailable( const QString& name, bool& available ) const;
0042 
0043     /**
0044      * @brief  Set the value of a property in this group
0045      * @param  name  the property name
0046      * @param  value  the value of the property
0047      * @return @c true  the property was found and changed accordingly
0048      *         @c false the property couldn't be found in this group
0049      */
0050     bool setPropertyValue( const QString& name, bool value );
0051 
0052     /**
0053      * @brief  Get the value of a property in this group
0054      * @param  name  the property name
0055      * @param  value  the value of the property
0056      * @return @c true  the property was found and returned accordingly
0057      *         @c false the property couldn't be found in this group
0058      */
0059     bool propertyValue( const QString& name, bool& value ) const;
0060 
0061     /**
0062      * @brief  Add a property to this setting group
0063      * @param  property  the new property
0064      */
0065     void addProperty(GeoSceneProperty*);
0066     const GeoSceneProperty* property( const QString& name ) const;
0067     GeoSceneProperty* property( const QString& name );
0068     QVector<GeoSceneProperty*> properties();
0069     QVector<const GeoSceneProperty*> properties() const;
0070 
0071     QString name() const;
0072 
0073     const char *nodeType() const override;
0074 
0075  Q_SIGNALS:
0076     void valueChanged( const QString&, bool );
0077 
0078  private:
0079     Q_DISABLE_COPY( GeoSceneGroup )
0080 
0081     /// The vector holding all the properties in this settings group.
0082     QVector<GeoSceneProperty*> m_properties;
0083 
0084     QString m_name;
0085 };
0086 
0087 }
0088 
0089 #endif