Warning, file /education/parley/src/practice/guifrontend.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_GUIFRONTEND_H 0007 #define PRACTICE_GUIFRONTEND_H 0008 0009 #include "abstractfrontend.h" 0010 #include "abstractwidget.h" 0011 0012 #include <KXmlGuiWindow> 0013 #include <QUrl> 0014 0015 #include "practicemainwindow.h" 0016 0017 ///@brief classes generated from the .ui XML files 0018 namespace Ui 0019 { 0020 class PracticeMainWindow; 0021 } 0022 0023 namespace Practice 0024 { 0025 class ThemedBackgroundRenderer; 0026 class ImageWidget; 0027 0028 /** GuiFrontend **/ 0029 class GuiFrontend : public AbstractFrontend 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 explicit GuiFrontend(QWidget *parent = nullptr); 0035 ~GuiFrontend() override; 0036 0037 QVariant userInput() override; 0038 QWidget *widget(); 0039 0040 QFont knownLangFont() const override; 0041 QFont learningLangFont() const override; 0042 void setKnownLangFont(const QFont &font) override; 0043 void setLearningLangFont(const QFont &font) override; 0044 0045 void setQuestion(const QVariant &question) override; 0046 void setQuestionImage(const QUrl &img) override; 0047 void setQuestionPronunciation(const QString &pronunciationText) override; 0048 void setQuestionSound(const QUrl &soundUrl) override; 0049 void setQuestionFont(const QFont &font) override; 0050 0051 void setSolution(const QVariant &solution) override; 0052 void setSolutionImage(const QUrl &img) override; 0053 void setSolutionPronunciation(const QString &pronunciationText) override; 0054 void setSolutionSound(const QUrl &soundUrl) override; 0055 void setSolutionFont(const QFont &font) override; 0056 0057 void setHint(const QVariant &hint) override; 0058 void setFeedback(const QVariant &feedback) override; 0059 0060 void setFeedbackState(ResultState feedbackState) override; 0061 void setResultState(ResultState resultState) override; 0062 ResultState resultState() override; 0063 0064 /// update lesson label 0065 void setLessonName(const QString &lessonName) override; 0066 void showGrade(int preGrade, int grade) override; 0067 void setFinishedWordsTotalWords(int finished, int total) override; 0068 0069 void setSynonym(const QString &entry) override; 0070 0071 public Q_SLOTS: 0072 void setMode(Practice::AbstractFrontend::Mode mode) override; 0073 void showQuestion() override; 0074 void showSolution() override; 0075 void setBoxes(grade_t currentBox, grade_t newBoxIfCorrect, grade_t newBoxIfWrong) override; 0076 0077 void showSynonym() override; 0078 0079 void backgroundChanged(const QPixmap &pixmap); 0080 0081 // show two buttons (i didn't know it, i knew it) instead of the continue button and disable the correct/wrong toggle (needed for flash card mode) 0082 void showSetResultButtons(bool show); 0083 void toggleResultState(); 0084 0085 protected: 0086 bool eventFilter(QObject *object, QEvent *event) override; 0087 0088 private Q_SLOTS: 0089 void countAsCorrectButtonClicked(); 0090 void countAsWrongButtonClicked(); 0091 void updateBackground(); 0092 void updateFontColors(); 0093 void setTheme(); 0094 0095 private: 0096 void setImage(const QUrl &image); 0097 0098 ImageWidget *m_widget{nullptr}; 0099 Ui::PracticeMainWindow *m_ui{nullptr}; 0100 AbstractModeWidget *m_modeWidget{nullptr}; 0101 ResultState m_resultState; 0102 ResultState m_feedbackState; 0103 QUrl m_lastImage; 0104 QUrl m_questionImage; 0105 QUrl m_solutionImage; 0106 int m_currentBox{0}; 0107 int m_newBoxIfCorrect{0}; 0108 int m_newBoxIfWrong{0}; 0109 ThemedBackgroundRenderer *m_themedBackgroundRenderer{nullptr}; 0110 0111 QFont m_knownLangFont; 0112 QFont m_learningLangFont; 0113 }; 0114 0115 } 0116 0117 #endif // PRACTICE_GUIFRONTEND_H