• 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
  • scripts
  • scripting
text.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  Copyright 2008 Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
4 
5  ***************************************************************************/
6 
7 /***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef SCRIPTINGTEXT_H
16 #define SCRIPTINGTEXT_H
17 
18 #include <QObject>
19 #include <keduvoctext.h>
20 
21 namespace Scripting
22 {
23 
39  class Text : public QObject
40  {
41  Q_OBJECT
42 
44  Q_PROPERTY ( QString text READ text WRITE setText )
45 
46 
47  Q_PROPERTY ( unsigned int practiceCount READ practiceCount WRITE setPracticeCount )
48 
50  Q_PROPERTY ( unsigned int badCount READ badCount WRITE setBadCount )
51 
53  Q_PROPERTY ( unsigned int grade READ grade() WRITE setGrade )
54 
55  // last date when this word was practiced
56 // Q_PROPERTY ( QDateTime practiceDate READ practiceDate WRITE setPracticeDate )
57 
59  Q_PROPERTY ( bool isEmpty READ isEmpty )
60 
61  public:
62  /* default constructor */
63  Text ( const QString& text = QString() );
64 
65  /* copy constructor
66  * provides safe copy of d pointer
67  * @param other object to copy from
68  */
69 // KEduVocText ( const KEduVocText &other );
70 
71  /*
72  * Constructor from KEduVocText (not used by scripts)
73  * @param text KEduVocText to initialize Scripting::Text
74  */
75  Text ( KEduVocText * text );
76 
77  Text ( const KEduVocText & text );
78 
79  ~Text();
80 
81  KEduVocText * kEduVocText() { return m_text; }
82 
83  /*
84  * The translation as string (the word itself)
85  * @return the translation
86  */
87  QString text() const { return m_text->text(); }
88 
89  /*
90  * Sets the translation
91  * @param expr
92  */
93  void setText ( const QString & expr ) { m_text->setText ( expr ); }
94 
95  /*
96  * Equal operator to copy grades.
97  * @param other grades copied
98  * @return reference to the new grades
99  */
100 // Text& operator= ( const Text &other ) { m_text->operator=(*(other.kEduVocText())); }
101  /*
102  * Compare two sets of grades.
103  * @param other
104  * @return true if equal
105  */
106 // bool operator== ( const KEduVocText &other ) const;
107 
108 
109  /* returns how often this entry has been practiced as int
110  * @returns total count
111  */
112  unsigned int practiceCount() const { return m_text->practiceCount(); }
113 
114  /* set how often this entry has been practiced as int
115  * @param count the new count
116  */
117  void setPracticeCount ( unsigned int count ) { m_text->setPracticeCount ( count ); }
118 
119  /* returns bad query count as int
120  * @returns bad query count
121  */
122  unsigned int badCount() const { return m_text->badCount(); }
123 
124  /* set bad query count as int
125  * @param count the new count
126  */
127  void setBadCount ( unsigned int count ) { m_text->setBadCount ( count ); }
128 
129  /* sets the grade
130  * @param grade number of knowlegde: 0=known, x=numbers not knows
131  */
132  void setGrade ( unsigned int grade ) { m_text->setGrade ( grade ); }
133 
134  /* returns grade as int
135  * @returns number of knowlegde: 0=known, x=numbers not knows
136  */
137  unsigned int grade() const { return m_text->grade(); }
138 
139  /*
140  * If the string inside is empty this returns true.
141  * @return
142  */
143  bool isEmpty() { return m_text->isEmpty(); }
144 
145 // void fromKVTML2 ( QDomElement& parent );
146 // void toKVTML2 ( QDomElement& parent );
147 
148  public slots:
150  void incBadCount() { m_text->incBadCount(); }
151 
153  void incPracticeCount() { m_text->incPracticeCount(); }
154 
156  void resetGrades() { m_text->resetGrades(); }
157 
159  void incGrade() { m_text->incGrade(); }
160 
162  void decGrade() { m_text->decGrade(); }
163 
165  QString practiceDate() const { return m_text->practiceDate().toString(); }
166 
176  QString practiceDate ( const QString & format ) const { return m_text->practiceDate().toString ( format ); }
177 
179  void setPracticeDate ( const QString & date ) { m_text->setPracticeDate ( QDateTime::fromString ( date ) ); }
180 
190  void setPracticeDate ( const QString & date, const QString & format ) { m_text->setPracticeDate ( QDateTime::fromString ( date, format ) ); }
191 
192  protected:
193  KEduVocText * m_text;
194 
195  };
196 
197 }
198 
199 #endif
Scripting::Text::setText
void setText(const QString &expr)
Definition: text.h:93
Scripting::Text::setBadCount
void setBadCount(unsigned int count)
Definition: text.h:127
Scripting::Text::setPracticeDate
void setPracticeDate(const QString &date, const QString &format)
Sets the laast date this word was practiced.
Definition: text.h:190
Scripting::Text::practiceDate
QString practiceDate() const
returns the last date when this word was practiced
Definition: text.h:165
Scripting::Text::setPracticeCount
void setPracticeCount(unsigned int count)
Definition: text.h:117
QObject
Scripting::Text::practiceDate
QString practiceDate(const QString &format) const
Last date this word was practiced.
Definition: text.h:176
Scripting::Text::isEmpty
bool isEmpty()
Definition: text.h:143
Scripting::Text::kEduVocText
KEduVocText * kEduVocText()
Definition: text.h:81
Scripting::Text::badCount
unsigned int badCount() const
Definition: text.h:122
Scripting::Text::setGrade
void setGrade(unsigned int grade)
Definition: text.h:132
Scripting::Text::incGrade
void incGrade()
increments grade
Definition: text.h:159
Scripting::Text::text
QString text() const
Definition: text.h:87
Scripting::Text
Scripting::Text class object provides methods and properties for accessing Parley text's value and gr...
Definition: text.h:39
Scripting::Text::resetGrades
void resetGrades()
Clears grading and date information.
Definition: text.h:156
Scripting::Text::practiceCount
unsigned int practiceCount() const
Definition: text.h:112
Scripting::Text::setPracticeDate
void setPracticeDate(const QString &date)
Sets the last date when this word was practiced.
Definition: text.h:179
Scripting::Text::m_text
KEduVocText * m_text
Definition: text.h:193
Scripting::Text::incPracticeCount
void incPracticeCount()
increment query count of given translation by 1
Definition: text.h:153
Scripting::Text::decGrade
void decGrade()
decrements grade
Definition: text.h:162
Scripting::Text::grade
unsigned int grade() const
Definition: text.h:137
Scripting::Text::incBadCount
void incBadCount()
increment bad query count of given translation by 1
Definition: text.h:150
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:06 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