File indexing completed on 2024-04-28 03:41:42
0001 /* GCompris - Dataset.h 0002 * 0003 * SPDX-FileCopyrightText: 2020 Johnny Jazeix <jazeix@gmail.com> 0004 * 0005 * Authors: 0006 * Johnny Jazeix <jazeix@gmail.com> 0007 * 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 0011 #ifndef DATASET_H 0012 #define DATASET_H 0013 0014 #include <QObject> 0015 #include <QString> 0016 #include <QVariant> 0017 0018 /** 0019 * @class Dataset 0020 * @short A QML component holding meta information about a dataset. 0021 * @ingroup components 0022 * 0023 * Each GCompris activity may provide some datasets for its content. 0024 * This class stores all the meta information required to define a dataset. 0025 * This data will be displayed in the Activity Configuration panel (difficulty + objective) 0026 * and used in the activity itself (data). 0027 * 0028 * @sa ActivityInfo 0029 */ 0030 class Dataset : public QObject 0031 { 0032 Q_OBJECT 0033 0034 /** 0035 * Objective of this dataset. 0036 */ 0037 Q_PROPERTY(QString objective READ objective WRITE setObjective NOTIFY objectiveChanged) 0038 0039 /** 0040 * Difficulty of the dataset. 0041 * 0042 * A difficulty level from 1 (easiest) to 6 (most difficult). 0043 */ 0044 Q_PROPERTY(quint32 difficulty READ difficulty WRITE setDifficulty NOTIFY difficultyChanged) 0045 /** 0046 * Content of the dataset (json array). 0047 */ 0048 Q_PROPERTY(QVariant data READ data WRITE setData NOTIFY dataChanged) 0049 /** 0050 * If the dataset is enabled. 0051 */ 0052 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) 0053 0054 public: 0055 /// @cond INTERNAL_DOCS 0056 explicit Dataset(QObject *parent = nullptr); 0057 0058 QString objective() const; 0059 void setObjective(const QString &); 0060 quint32 difficulty() const; 0061 void setDifficulty(const quint32 &); 0062 QVariant data() const; 0063 void setData(const QVariant &); 0064 bool enabled() const; 0065 void setEnabled(const bool &); 0066 /// @endcond 0067 Q_SIGNALS: 0068 void objectiveChanged(); 0069 void difficultyChanged(); 0070 void dataChanged(); 0071 void enabledChanged(); 0072 0073 private: 0074 QString m_objective; 0075 quint32 m_difficulty; 0076 QVariant m_data; 0077 bool m_enabled; 0078 }; 0079 0080 #endif // DATASET_H