Warning, file /education/parley/src/practice/multiplechoicebackendmode.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 Frederik Gladhorn <gladhorn@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef MULTIPLECHOICEBACKENDMODE_H 0007 #define MULTIPLECHOICEBACKENDMODE_H 0008 0009 #include "abstractbackendmode.h" 0010 #include "practice/sessionmanagerbase.h" 0011 0012 namespace Practice 0013 { 0014 class MultipleChoiceBackendMode : public AbstractBackendMode 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 MultipleChoiceBackendMode(AbstractFrontend *frontend, QObject *parent, Practice::SessionManagerBase *sessionManager); 0020 0021 /** Start practicing a new word */ 0022 bool setTestEntry(TestEntry *current) override; 0023 0024 void checkAnswer() override; 0025 0026 public Q_SLOTS: 0027 void hintAction() override; 0028 0029 protected: 0030 /** 0031 * set the list of possible answers. This function needs to call setCorrectAnswer and setChoices 0032 */ 0033 virtual void prepareChoices(TestEntry *current); 0034 0035 /** 0036 * Set the question/original language 0037 */ 0038 void setQuestion(const QString &question); 0039 0040 /** 0041 * This must include the correct answer. The order of the choices will be preserved. 0042 */ 0043 void setChoices(const QStringList &choices); 0044 0045 /** 0046 * The correct solution, index of the choices. 0047 */ 0048 void setCorrectAnswer(int index); 0049 0050 int numberOfChoices(); 0051 0052 /** 0053 * Configure the multiple choice front end. 0054 */ 0055 virtual void populateFrontEnd(); 0056 0057 private: 0058 SessionManagerBase *m_sessionManager; 0059 QString m_question; 0060 int m_numberOfChoices{0}; 0061 QStringList m_choices; 0062 int m_correctAnswer{0}; 0063 QList<int> m_hints; 0064 }; 0065 0066 } 0067 0068 #endif