File indexing completed on 2024-04-28 07:39:27

0001 /*
0002     SPDX-FileCopyrightText: 2010 Frederik Gladhorn <gladhorn@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef CONJUGATIONBACKENDMODE_H
0007 #define CONJUGATIONBACKENDMODE_H
0008 
0009 #include "abstractbackendmode.h"
0010 #include "practice/sessionmanagerbase.h"
0011 
0012 namespace Practice
0013 {
0014 class ConjugationBackendMode : public AbstractBackendMode
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     ConjugationBackendMode(AbstractFrontend *frontend, QObject *parent, Practice::SessionManagerBase *sessionManager, KEduVocDocument *doc);
0020 
0021     bool setTestEntry(TestEntry *current) override;
0022 
0023     /** Return the worst pregrade for any pronoun of the current entry */
0024     grade_t currentPreGradeForEntry() const override;
0025     /** Return the worst grade for any pronoun of the current entry */
0026     grade_t currentGradeForEntry() const override;
0027 
0028     void updateGrades() override;
0029 
0030 public Q_SLOTS:
0031     void hintAction() override;
0032     void checkAnswer() override;
0033 
0034 private:
0035     QStringList validPersonalPronouns();
0036 
0037     SessionManagerBase *m_sessionManager{nullptr};
0038     KEduVocDocument *m_doc{nullptr};
0039 
0040     QString m_currentTense;
0041     QList<KEduVocWordFlags> m_pronounFlags;
0042     KEduVocConjugation m_conjugation;
0043 
0044     QStringList m_lastAnswers;
0045 };
0046 
0047 }
0048 
0049 #endif