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

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • practice
flashcardbackendmode.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 
15 #include "flashcardbackendmode.h"
16 
17 #include <klocale.h>
18 
19 using namespace Practice;
20 
21 FlashCardBackendMode::FlashCardBackendMode(AbstractFrontend* frontend, QObject* parent)
22  : AbstractBackendMode(frontend, parent)
23 {
24 }
25 
26 bool FlashCardBackendMode::setTestEntry(TestEntry* current)
27 {
28  Practice::AbstractBackendMode::setTestEntry(current);
29  m_current = current;
30  m_currentHint.clear();
31  m_solutionVisible = false;
32  m_frontend->showQuestion();
33  return true;
34 }
35 
36 void FlashCardBackendMode::checkAnswer()
37 {
38  emit showSolution();
39 }
40 
41 void FlashCardBackendMode::hintAction()
42 {
43  QString solution = m_current->entry()->translation(m_current->languageTo())->text();
44  m_currentHint = solution.left(m_currentHint.size() + 1);
45  if (m_currentHint.size() == solution.size()) {
46  // show solution
47  m_frontend->showSolution();
48  m_solutionVisible = true;
49  } else {
50  m_frontend->setHint(m_currentHint);
51  }
52 }
53 
54 #include "flashcardbackendmode.moc"
Practice::FlashCardBackendMode::setTestEntry
virtual bool setTestEntry(TestEntry *current)
start practicing a new word.
Definition: flashcardbackendmode.cpp:26
TestEntry::entry
KEduVocExpression * entry() const
Definition: testentry.cpp:149
Practice::FlashCardBackendMode::FlashCardBackendMode
FlashCardBackendMode(AbstractFrontend *frontend, QObject *parent)
Definition: flashcardbackendmode.cpp:21
Practice::AbstractFrontend::setHint
virtual void setHint(const QVariant &hint)=0
Practice::AbstractFrontend::showQuestion
virtual void showQuestion()=0
enter question mode - the user is asked to provide the solution
Practice::AbstractBackendMode::showSolution
void showSolution()
QString::size
int size() const
QString::clear
void clear()
Practice::AbstractBackendMode::m_frontend
AbstractFrontend * m_frontend
Definition: abstractbackendmode.h:121
QObject
QString
Practice::AbstractBackendMode::setTestEntry
virtual bool setTestEntry(TestEntry *current)
start practicing a new word.
Definition: abstractbackendmode.cpp:28
Practice::FlashCardBackendMode::checkAnswer
virtual void checkAnswer()
Definition: flashcardbackendmode.cpp:36
Practice::AbstractFrontend::showSolution
virtual void showSolution()=0
enter show solution mode - the solution is shown
Practice::AbstractBackendMode
Definition: abstractbackendmode.h:26
Practice::AbstractFrontend
Definition: abstractfrontend.h:26
QString::left
QString left(int n) const
TestEntry::languageTo
int languageTo() const
Definition: testentry.cpp:114
flashcardbackendmode.h
Practice::FlashCardBackendMode::hintAction
virtual void hintAction()
Definition: flashcardbackendmode.cpp:41
TestEntry
Definition: testentry.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 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
  • 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