• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

parley

  • sources
  • kde-4.12
  • kdeedu
  • parley
  • src
  • practice
flashcardmodewidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright 2009 Frederik Gladhorn <gladhorn@kde.org>
3  ***************************************************************************/
4 
5 /***************************************************************************
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  ***************************************************************************/
13 
14 #include "flashcardmodewidget.h"
15 
16 #include "ui_practice_widget_flashcard.h"
17 
18 #include "guifrontend.h"
19 #include "latexrenderer.h"
20 
21 using namespace Practice;
22 
23 
24 FlashCardModeWidget::FlashCardModeWidget (GuiFrontend *frontend, QWidget* parent )
25  : AbstractModeWidget (frontend, parent), m_questionLatexRenderer(0), m_solutionLatexRenderer(0)
26 {
27  m_ui = new Ui::FlashCardPracticeWidget();
28  m_ui->setupUi(this);
29 }
30 
31 void FlashCardModeWidget::setQuestionFont(const QFont& font)
32 {
33  m_ui->questionLabel->setFont(font);
34 }
35 
36 void FlashCardModeWidget::setSolutionFont(const QFont& font)
37 {
38  m_ui->solutionLabel->setFont(font);
39 }
40 
41 void FlashCardModeWidget::setQuestion(const QVariant& question)
42 {
43  m_ui->questionLabel->setMinimumSize(QSize(0, 0));
44  if (LatexRenderer::isLatex(question.toString())) {
45  if(!m_questionLatexRenderer) {
46  m_questionLatexRenderer = new LatexRenderer(this);
47  m_questionLatexRenderer->setResultLabel(m_ui->questionLabel);
48  }
49  m_questionLatexRenderer->renderLatex(question.toString());
50  } else {
51  m_ui->questionLabel->setText(question.toString());
52  }
53 }
54 
55 void FlashCardModeWidget::showQuestion()
56 {
57  m_ui->solutionLabel->setHidden(true);
58  m_frontend->showSetResultButtons(false);
59 }
60 
61 void FlashCardModeWidget::setSolution(const QVariant& solution)
62 {
63  m_solution = solution.toString();
64 }
65 
66 void FlashCardModeWidget::setSynonym(const QString& entry)
67 {
68  //TODO Do something here to show synonyms
69 }
70 
71 void FlashCardModeWidget::showSynonym()
72 {
73  //TODO Do something here to show synonyms
74 }
75 
76 void FlashCardModeWidget::showSolution()
77 {
78  m_ui->solutionLabel->setPalette(m_correctPalette);
79 
80  m_ui->solutionLabel->setMinimumSize(QSize(0, 0));
81  if (LatexRenderer::isLatex(m_solution)) {
82  if(!m_solutionLatexRenderer) {
83  m_solutionLatexRenderer = new LatexRenderer(this);
84  m_solutionLatexRenderer->setResultLabel(m_ui->solutionLabel);
85  }
86  m_solutionLatexRenderer->renderLatex(m_solution);
87  } else {
88  m_ui->solutionLabel->setText(m_solution);
89  }
90 
91  m_ui->solutionLabel->setHidden(false);
92  m_frontend->showSetResultButtons(true);
93 }
94 
95 void FlashCardModeWidget::setHint(const QVariant& hint)
96 {
97  m_ui->solutionLabel->setHidden(false);
98  m_ui->solutionLabel->setText(hint.toString());
99 }
100 
101 QVariant FlashCardModeWidget::userInput()
102 {
103  return QVariant();
104 }
105 
106 void FlashCardModeWidget::setQuestionSound(const KUrl& soundUrl)
107 {
108 
109 }
110 
111 void FlashCardModeWidget::setSolutionSound(const KUrl& soundUrl)
112 {
113 
114 }
115 
116 void FlashCardModeWidget::setSolutionPronunciation(const QString& pronunciationText)
117 {
118 
119 }
120 
121 void FlashCardModeWidget::setQuestionPronunciation(const QString& pronunciationText)
122 {
123 
124 }
125 
126 #include "flashcardmodewidget.moc"
Practice::GuiFrontend
Definition: guifrontend.h:33
Practice::FlashCardModeWidget::setQuestion
virtual void setQuestion(const QVariant &question)
Definition: flashcardmodewidget.cpp:41
Practice::FlashCardModeWidget::setSolutionFont
virtual void setSolutionFont(const QFont &font)
Definition: flashcardmodewidget.cpp:36
Practice::FlashCardModeWidget::setSolution
virtual void setSolution(const QVariant &solution)
Definition: flashcardmodewidget.cpp:61
QWidget
Practice::FlashCardModeWidget::FlashCardModeWidget
FlashCardModeWidget(GuiFrontend *frontend, QWidget *parent=0)
Definition: flashcardmodewidget.cpp:24
Practice::FlashCardModeWidget::showSolution
virtual void showSolution()
Definition: flashcardmodewidget.cpp:76
Practice::LatexRenderer
Definition: latexrenderer.h:26
Practice::LatexRenderer::setResultLabel
void setResultLabel(QLabel *label)
Definition: latexrenderer.h:32
Practice::AbstractModeWidget
Definition: abstractwidget.h:26
Practice::GuiFrontend::showSetResultButtons
void showSetResultButtons(bool show)
Definition: guifrontend.cpp:169
Practice::FlashCardModeWidget::setSolutionSound
virtual void setSolutionSound(const KUrl &soundUrl)
Definition: flashcardmodewidget.cpp:111
Practice::FlashCardModeWidget::showSynonym
virtual void showSynonym()
Definition: flashcardmodewidget.cpp:71
Practice::FlashCardModeWidget::setHint
virtual void setHint(const QVariant &hint)
Definition: flashcardmodewidget.cpp:95
Practice::FlashCardModeWidget::setQuestionFont
virtual void setQuestionFont(const QFont &font)
Definition: flashcardmodewidget.cpp:31
Practice::AbstractModeWidget::m_frontend
GuiFrontend * m_frontend
Definition: abstractwidget.h:65
Practice::AbstractModeWidget::m_correctPalette
QPalette m_correctPalette
Definition: abstractwidget.h:67
Practice::FlashCardModeWidget::setQuestionPronunciation
virtual void setQuestionPronunciation(const QString &pronunciationText)
Definition: flashcardmodewidget.cpp:121
Practice::FlashCardModeWidget::showQuestion
virtual void showQuestion()
Definition: flashcardmodewidget.cpp:55
Practice::FlashCardModeWidget::setQuestionSound
virtual void setQuestionSound(const KUrl &soundUrl)
Definition: flashcardmodewidget.cpp:106
Practice::FlashCardModeWidget::setSolutionPronunciation
virtual void setSolutionPronunciation(const QString &pronunciationText)
Definition: flashcardmodewidget.cpp:116
guifrontend.h
flashcardmodewidget.h
Practice::FlashCardModeWidget::setSynonym
virtual void setSynonym(const QString &entry)
Definition: flashcardmodewidget.cpp:66
latexrenderer.h
Practice::FlashCardModeWidget::userInput
virtual QVariant userInput()
Definition: flashcardmodewidget.cpp:101
Practice::LatexRenderer::renderLatex
void renderLatex(QString tex)
Definition: latexrenderer.cpp:51
Practice::LatexRenderer::isLatex
static bool isLatex(const QString &tex)
Definition: latexrenderer.cpp:96
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal