1 /*
2     SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #ifndef WRITTENBACKENDMODE_H
7 #define WRITTENBACKENDMODE_H
8 
9 #include "abstractbackendmode.h"
10 #include "practice/sessionmanagerbase.h"
11 #include "practice/writtenpracticevalidator.h"
12 #include <QScopedPointer>
13 
14 namespace Practice
15 {
16 class WrittenBackendMode : public AbstractBackendMode
17 {
18     Q_OBJECT
19 
20 public:
21     WrittenBackendMode(Practice::AbstractFrontend *frontend, QObject *parent, Practice::SessionManagerBase *sessionManager, KEduVocDocument *doc);
22 
23     bool setTestEntry(TestEntry *current) override;
24 
25     void checkAnswer() override;
26 
27 public Q_SLOTS:
28     void hintAction() override;
29 
30 private:
31     QString getFeedbackString(TestEntry::ErrorTypes error);
32 
33     QString m_lastAnswer;
34     QString m_currentHint;
35     bool m_firstAttempt{true};
36     SessionManagerBase *m_sessionManager{nullptr};
37     QScopedPointer<WrittenPracticeValidator> m_validator;
38     KEduVocDocument *m_doc{nullptr};
39 };
40 
41 }
42 
43 #endif // WRITTENBACKENDMODE_H
44