• 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
  • 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() {
82  return m_text;
83  }
84 
85  /*
86  * The translation as string (the word itself)
87  * @return the translation
88  */
89  QString text() const {
90  return m_text->text();
91  }
92 
93  /*
94  * Sets the translation
95  * @param expr
96  */
97  void setText(const QString & expr) {
98  m_text->setText(expr);
99  }
100 
101  /*
102  * Equal operator to copy grades.
103  * @param other grades copied
104  * @return reference to the new grades
105  */
106 // Text& operator= ( const Text &other ) { m_text->operator=(*(other.kEduVocText())); }
107  /*
108  * Compare two sets of grades.
109  * @param other
110  * @return true if equal
111  */
112 // bool operator== ( const KEduVocText &other ) const;
113 
114 
115  /* returns how often this entry has been practiced as int
116  * @returns total count
117  */
118  unsigned int practiceCount() const {
119  return m_text->practiceCount();
120  }
121 
122  /* set how often this entry has been practiced as int
123  * @param count the new count
124  */
125  void setPracticeCount(unsigned int count) {
126  m_text->setPracticeCount(count);
127  }
128 
129  /* returns bad query count as int
130  * @returns bad query count
131  */
132  unsigned int badCount() const {
133  return m_text->badCount();
134  }
135 
136  /* set bad query count as int
137  * @param count the new count
138  */
139  void setBadCount(unsigned int count) {
140  m_text->setBadCount(count);
141  }
142 
143  /* sets the grade
144  * @param grade number of knowlegde: 0=known, x=numbers not knows
145  */
146  void setGrade(unsigned int grade) {
147  m_text->setGrade(grade);
148  }
149 
150  /* returns grade as int
151  * @returns number of knowlegde: 0=known, x=numbers not knows
152  */
153  unsigned int grade() const {
154  return m_text->grade();
155  }
156 
157  /*
158  * If the string inside is empty this returns true.
159  * @return
160  */
161  bool isEmpty() {
162  return m_text->isEmpty();
163  }
164 
165 // void fromKVTML2 ( QDomElement& parent );
166 // void toKVTML2 ( QDomElement& parent );
167 
168 public slots:
170  void incBadCount() {
171  m_text->incBadCount();
172  }
173 
175  void incPracticeCount() {
176  m_text->incPracticeCount();
177  }
178 
180  void resetGrades() {
181  m_text->resetGrades();
182  }
183 
185  void incGrade() {
186  m_text->incGrade();
187  }
188 
190  void decGrade() {
191  m_text->decGrade();
192  }
193 
195  QString practiceDate() const {
196  return m_text->practiceDate().toString();
197  }
198 
208  QString practiceDate(const QString & format) const {
209  return m_text->practiceDate().toString(format);
210  }
211 
213  void setPracticeDate(const QString & date) {
214  m_text->setPracticeDate(QDateTime::fromString(date));
215  }
216 
226  void setPracticeDate(const QString & date, const QString & format) {
227  m_text->setPracticeDate(QDateTime::fromString(date, format));
228  }
229 
230 protected:
231  KEduVocText * m_text;
232 
233 };
234 
235 }
236 
237 #endif
Scripting::Text::setText
void setText(const QString &expr)
Definition: text.h:97
Scripting::Text::setBadCount
void setBadCount(unsigned int count)
Definition: text.h:139
Scripting::Text::setPracticeDate
void setPracticeDate(const QString &date, const QString &format)
Sets the laast date this word was practiced.
Definition: text.h:226
Scripting::Text::practiceDate
QString practiceDate() const
returns the last date when this word was practiced
Definition: text.h:195
Scripting::Text::setPracticeCount
void setPracticeCount(unsigned int count)
Definition: text.h:125
Scripting::Text::practiceDate
QString practiceDate(const QString &format) const
Last date this word was practiced.
Definition: text.h:208
Scripting::Text::isEmpty
bool isEmpty()
Definition: text.h:161
Scripting::Text::kEduVocText
KEduVocText * kEduVocText()
Definition: text.h:81
Scripting::Text::badCount
unsigned int badCount() const
Definition: text.h:132
QObject
Scripting::Text::setGrade
void setGrade(unsigned int grade)
Definition: text.h:146
Scripting::Text::incGrade
void incGrade()
increments grade
Definition: text.h:185
QString
Scripting::Text::text
QString text() const
Definition: text.h:89
Scripting::Text
Scripting::Text class object provides methods and properties for accessing Parley text's value and gr...
Definition: text.h:39
QDateTime::fromString
QDateTime fromString(const QString &string, Qt::DateFormat format)
Scripting::Text::resetGrades
void resetGrades()
Clears grading and date information.
Definition: text.h:180
Scripting::Text::practiceCount
unsigned int practiceCount() const
Definition: text.h:118
Scripting::Text::setPracticeDate
void setPracticeDate(const QString &date)
Sets the last date when this word was practiced.
Definition: text.h:213
Scripting::Text::m_text
KEduVocText * m_text
Definition: text.h:231
Scripting::Text::incPracticeCount
void incPracticeCount()
increment query count of given translation by 1
Definition: text.h:175
Scripting::Text::decGrade
void decGrade()
decrements grade
Definition: text.h:190
Scripting::Text::grade
unsigned int grade() const
Definition: text.h:153
Scripting::Text::incBadCount
void incBadCount()
increment bad query count of given translation by 1
Definition: text.h:170
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