File indexing completed on 2024-04-14 03:49:13

0001 /*
0002     SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
0003     SPDX-FileCopyrightText: 2009-2010 Daniel Laidig <laidig@kde.org>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PRACTICE_WRITTENPRACTICEWIDGET_H
0008 #define PRACTICE_WRITTENPRACTICEWIDGET_H
0009 
0010 #include "abstractwidget.h"
0011 
0012 namespace Ui
0013 {
0014 class WrittenPracticeWidget;
0015 }
0016 
0017 namespace Practice
0018 {
0019 class LatexRenderer;
0020 
0021 class WrittenPracticeWidget : public Practice::AbstractModeWidget
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit WrittenPracticeWidget(GuiFrontend *frontend, QWidget *parent = nullptr, bool isExampleSentenceMode = false);
0027     QVariant userInput() override;
0028 
0029     void setQuestion(const QVariant &question) override;
0030     void setSolution(const QVariant &solution) override;
0031 
0032     void setQuestionFont(const QFont &font) override;
0033     void setSolutionFont(const QFont &font) override;
0034     void setHint(const QVariant &hint) override;
0035     void setFeedback(const QVariant &feedback) override;
0036     void setFeedbackState(AbstractFrontend::ResultState feedbackState) override;
0037     void setResultState(AbstractFrontend::ResultState resultState) override;
0038 
0039     void setQuestionSound(const QUrl &soundUrl) override;
0040     void setSolutionSound(const QUrl &soundUrl) override;
0041     void setSolutionPronunciation(const QString &pronunciationText) override;
0042     void setQuestionPronunciation(const QString &pronunciationText) override;
0043 
0044     void setSynonym(const QString &entry) override;
0045 
0046 public Q_SLOTS:
0047     void showQuestion() override;
0048     void showSolution() override;
0049     void continueClicked();
0050     void showSynonym() override;
0051 
0052 protected:
0053     Ui::WrittenPracticeWidget *m_ui{nullptr};
0054 
0055 private:
0056     QString m_solution;
0057     QString m_synonym;
0058     AbstractFrontend::ResultState m_resultState;
0059     AbstractFrontend::ResultState m_feedbackState;
0060     QList<QWidget *> synonymWidgets;
0061     LatexRenderer *m_latexRenderer{nullptr};
0062     bool isExampleSentenceMode{false};
0063 };
0064 
0065 }
0066 
0067 #endif // PRACTICE_WRITTENPRACTICEWIDGET_H