• 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
examplesentencebackendmode.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright 2010 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 "examplesentencebackendmode.h"
16 
17 #include <KLocalizedString>
18 
19 using namespace Practice;
20 
21 ExampleSentenceBackendMode::ExampleSentenceBackendMode(const Practice::PracticeOptions& practiceOptions, AbstractFrontend* frontend, QObject* parent, TestEntryManager* testEntryManager, KEduVocDocument* doc)
22 :WrittenBackendMode(practiceOptions, frontend, parent,testEntryManager,doc)
23 {
24 }
25 
26 bool ExampleSentenceBackendMode::setTestEntry(TestEntry* current)
27 {
28  Practice::WrittenBackendMode::setTestEntry(current);
29  QString sentence = current->entry()->translation(m_practiceOptions.languageTo())->example();
30  if (sentence.isEmpty()) {
31  return false;
32  }
33 
34  QString answer = current->entry()->translation(m_practiceOptions.languageTo())->text();
35  int pos = -1;
36  while ((pos = sentence.indexOf(answer)) >= 0) {
37  sentence.remove(pos, answer.length());
38  sentence.insert(pos, "<font color=\"#FF0000\"><b>...</b></font>");
39  }
40  m_frontend->setQuestion(sentence);
41  return true;
42 }
43 
44 #include "examplesentencebackendmode.moc"
Practice::ExampleSentenceBackendMode::setTestEntry
virtual bool setTestEntry(TestEntry *current)
start practicing a new word.
Definition: examplesentencebackendmode.cpp:26
Practice::PracticeOptions
Definition: practiceoptions.h:22
Practice::AbstractFrontend::setQuestion
virtual void setQuestion(const QVariant &question)=0
Practice::WrittenBackendMode
Definition: writtenbackendmode.h:24
Practice::TestEntryManager
Definition: testentrymanager.h:31
QObject
Practice::WrittenBackendMode::setTestEntry
virtual bool setTestEntry(TestEntry *current)
start practicing a new word.
Definition: writtenbackendmode.cpp:29
Practice::AbstractBackendMode::m_frontend
AbstractFrontend * m_frontend
Definition: abstractbackendmode.h:83
Practice::ExampleSentenceBackendMode::ExampleSentenceBackendMode
ExampleSentenceBackendMode(const Practice::PracticeOptions &practiceOptions, Practice::AbstractFrontend *frontend, QObject *parent, Practice::TestEntryManager *testEntryManager, KEduVocDocument *doc)
Definition: examplesentencebackendmode.cpp:21
Practice::PracticeOptions::languageTo
int languageTo() const
Definition: practiceoptions.h:28
examplesentencebackendmode.h
Practice::AbstractFrontend
Definition: abstractfrontend.h:25
Practice::AbstractBackendMode::m_practiceOptions
PracticeOptions m_practiceOptions
Definition: abstractbackendmode.h:82
TestEntry::entry
KEduVocExpression * entry()
Definition: testentry.cpp:134
TestEntry
Definition: testentry.h:22
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