Warning, file /education/parley/src/practice/abstractfrontend.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: 2009 Daniel Laidig <d.laidig@gmx.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef PRACTICE_ABSTRACTFRONTEND_H 0007 #define PRACTICE_ABSTRACTFRONTEND_H 0008 0009 #include <KEduVocText> 0010 #include <QFont> 0011 #include <QObject> 0012 0013 class QUrl; 0014 0015 namespace Practice 0016 { 0017 class AbstractFrontend : public QObject 0018 { 0019 Q_OBJECT 0020 public: 0021 enum Mode { 0022 None, 0023 FlashCard, 0024 MixedLetters, 0025 MultipleChoice, 0026 Written, 0027 Conjugation, 0028 Comparison, 0029 ExampleSentence, 0030 }; 0031 0032 enum ResultState { 0033 QuestionState, 0034 AnswerCorrect, 0035 AnswerSynonym, 0036 AnswerWrong, 0037 }; 0038 0039 explicit AbstractFrontend(QObject *parent = nullptr); 0040 ~AbstractFrontend() override 0041 { 0042 } 0043 0044 /** 0045 * Enables access to the input of the user. 0046 * This is queried by the backend when it needs to evaluate the input. 0047 */ 0048 virtual QVariant userInput() = 0; 0049 0050 /** The status such as lesson or number of words has changed */ 0051 virtual void setFinishedWordsTotalWords(int finished, int total) = 0; 0052 0053 /** fonts for learning and known languages. These will be used to 0054 * set question and answer fonts for individual entries. 0055 */ 0056 virtual QFont knownLangFont() const = 0; 0057 virtual QFont learningLangFont() const = 0; 0058 virtual void setKnownLangFont(const QFont &font) = 0; 0059 virtual void setLearningLangFont(const QFont &font) = 0; 0060 0061 virtual void setQuestion(const QVariant &question) = 0; 0062 virtual void setSolution(const QVariant &solution) = 0; 0063 virtual void setFeedback(const QVariant &feedback) = 0; 0064 0065 virtual void setQuestionFont(const QFont &font) = 0; 0066 virtual void setSolutionFont(const QFont &font) = 0; 0067 0068 virtual void setHint(const QVariant &hint) = 0; 0069 virtual void setQuestionImage(const QUrl &img) = 0; 0070 virtual void setSolutionImage(const QUrl &img) = 0; 0071 virtual void setQuestionSound(const QUrl &soundUrl) = 0; 0072 virtual void setSolutionSound(const QUrl &soundUrl) = 0; 0073 virtual void setSolutionPronunciation(const QString &pronunciationText) = 0; 0074 virtual void setQuestionPronunciation(const QString &pronunciationText) = 0; 0075 0076 virtual void setLessonName(const QString &lesson) = 0; 0077 virtual void showGrade(int preGrade, int grade) = 0; 0078 0079 /** The feedback state tells the user if the currently entered word is correct 0080 (independent of whether the word is counted as correct) **/ 0081 virtual void setFeedbackState(ResultState feedbackState) = 0; 0082 0083 /** The result state indicated whether a word is counted as correct (and grades are raised) 0084 and can be changed by the user. **/ 0085 virtual void setResultState(ResultState resultState) = 0; 0086 virtual ResultState resultState() = 0; 0087 0088 /** set a new synonym that should be shown */ 0089 virtual void setSynonym(const QString &entry) = 0; 0090 0091 public Q_SLOTS: 0092 /** enter question mode - the user is asked to provide the solution */ 0093 virtual void showQuestion() = 0; 0094 /** enter show solution mode - the solution is shown */ 0095 virtual void showSolution() = 0; 0096 0097 /** show the synonyms */ 0098 virtual void showSynonym() = 0; 0099 0100 /** switch between different modes such as written, flash card, etc */ 0101 virtual void setMode(Practice::AbstractFrontend::Mode mode) = 0; 0102 virtual void setBoxes(grade_t currentBox, grade_t newBoxIfCorrect, grade_t newBoxIfWrong) = 0; 0103 0104 Q_SIGNALS: 0105 void continueAction(); 0106 void hintAction(); 0107 void skipAction(); 0108 /** request to stop practicing */ 0109 void stopPractice(); 0110 }; 0111 0112 } 0113 0114 #endif // PRACTICE_ABSTRACTFRONTEND_H