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

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org>
0004 **
0005 ** This program is free software; you can redistribute it and/or
0006 ** modify it under the terms of the GNU General Public License as
0007 ** published by the Free Software Foundation; either version 2 of
0008 ** the License or (at your option) version 3 or any later version
0009 ** accepted by the membership of KDE e.V. (or its successor approved
0010 ** by the membership of KDE e.V.), which shall act as a proxy
0011 ** defined in Section 14 of version 3 of the license.
0012 **
0013 ** This program is distributed in the hope that it will be useful,
0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 ** GNU General Public License for more details.
0017 **
0018 ** You should have received a copy of the GNU General Public License
0019 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
0020 **
0021 ****************************************************************************/
0022 
0023 #ifndef MINUET_IEXERCISECONTROLLER_H
0024 #define MINUET_IEXERCISECONTROLLER_H
0025 
0026 #include <interfaces/minuetinterfacesexport.h>
0027 
0028 #include <QDebug>
0029 #include <QJsonArray>
0030 #include <QObject>
0031 #include <QVariantMap>
0032 
0033 namespace Minuet
0034 {
0035 class MINUETINTERFACES_EXPORT IExerciseController : public QObject
0036 {
0037     Q_OBJECT
0038     Q_PROPERTY(QJsonArray exercises READ exercises)  // clazy:exclude=qproperty-without-notify
0039     Q_PROPERTY(QVariantMap currentExercise MEMBER m_currentExercise WRITE setCurrentExercise NOTIFY
0040                    currentExerciseChanged)
0041     Q_PROPERTY(QJsonArray selectedExerciseOptions READ selectedExerciseOptions NOTIFY
0042                    selectedExerciseOptionsChanged)
0043 
0044 public:
0045     virtual ~IExerciseController() override = default;
0046 
0047     virtual QString errorString() const = 0;
0048 
0049     virtual QJsonArray exercises() const = 0;
0050     void setCurrentExercise(QVariantMap currentExercise);
0051     QJsonArray selectedExerciseOptions() const;
0052 
0053 public Q_SLOTS:
0054     virtual void randomlySelectExerciseOptions() = 0;
0055 
0056 Q_SIGNALS:
0057     void currentExerciseChanged(QVariantMap newCurrentExercise);
0058     void selectedExerciseOptionsChanged(QJsonArray newSelectedExerciseOptions);
0059 
0060 protected:
0061     explicit IExerciseController(QObject *parent = nullptr);
0062 
0063     QVariantMap m_currentExercise;
0064     QJsonArray m_selectedExerciseOptions;
0065 };
0066 
0067 }
0068 
0069 #endif