Warning, file /education/parley/src/practice/practicestatemachine.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2010 Frederik Gladhorn <gladhorn@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef PRACTICESTATEMACHINE_H 0007 #define PRACTICESTATEMACHINE_H 0008 0009 #include <QObject> 0010 0011 #include "abstractbackendmode.h" 0012 0013 class ParleyDocument; 0014 0015 namespace Practice 0016 { 0017 class SessionManagerBase; 0018 0019 class PracticeStateMachine : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 PracticeStateMachine(AbstractFrontend *frontend, ParleyDocument *doc, SessionManagerBase *sessionManager, QObject *parent = nullptr); 0024 void start(); 0025 0026 Q_SIGNALS: 0027 void practiceFinished(); 0028 void stopPractice(); 0029 0030 public Q_SLOTS: 0031 void slotPracticeFinished(); 0032 0033 private Q_SLOTS: 0034 /** Call when current entry is finished and next one should be selected */ 0035 void nextEntry(); 0036 0037 void continueAction(); 0038 0039 // these come from the mode 0040 void answerRight(); 0041 void answerWrongRetry(); 0042 void answerWrongShowSolution(); 0043 void showSolution(); 0044 0045 void gradeEntryAndContinue(); 0046 0047 private: 0048 /** Set the current word as done, so it will not be repeated */ 0049 void currentEntryFinished(); 0050 void createPracticeMode(); 0051 void updateFrontend(); 0052 0053 enum State { NotAnswered, AnswerWasWrong, SolutionShown }; 0054 0055 State m_state; 0056 0057 AbstractFrontend *m_frontend{nullptr}; 0058 AbstractBackendMode *m_mode{nullptr}; 0059 ParleyDocument *m_document{nullptr}; 0060 TestEntry *m_current{nullptr}; 0061 SessionManagerBase *m_sessionManager{nullptr}; 0062 }; 0063 0064 } 0065 0066 #endif