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

parley

text.h

Go to the documentation of this file.
00001 /***************************************************************************
00002 
00003     Copyright 2008 Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
00004 
00005  ***************************************************************************/
00006 
00007 /***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 #ifndef SCRIPTINGTEXT_H
00016 #define SCRIPTINGTEXT_H
00017 
00018 #include <QObject>
00019 #include <keduvoctext.h>
00020 
00021 namespace Scripting
00022 {
00023 
00039     class Text : public QObject
00040     {
00041             Q_OBJECT
00042 
00044             Q_PROPERTY ( QString text READ text WRITE setText )
00045 
00046             
00047             Q_PROPERTY ( unsigned int practiceCount READ practiceCount WRITE setPracticeCount )
00048 
00050             Q_PROPERTY ( unsigned int badCount READ badCount WRITE setBadCount )
00051 
00053             Q_PROPERTY ( unsigned int grade READ grade() WRITE setGrade )
00054 
00055             // last date when this word was practiced
00056 //             Q_PROPERTY ( QDateTime practiceDate READ practiceDate WRITE setPracticeDate )
00057 
00059             Q_PROPERTY ( bool isEmpty READ isEmpty )
00060 
00061         public:
00062             /* default constructor */
00063             Text ( const QString& text = QString() );
00064 
00065             /* copy constructor
00066              * provides safe copy of d pointer
00067              * @param other object to copy from
00068              */
00069 //             KEduVocText ( const KEduVocText &other );
00070 
00071             /*
00072              * Constructor from KEduVocText (not used by scripts)
00073              * @param text KEduVocText to initialize Scripting::Text
00074              */
00075             Text ( KEduVocText * text );
00076 
00077             Text ( const KEduVocText & text );
00078 
00079             ~Text();
00080 
00081             KEduVocText * kEduVocText() { return m_text; }
00082 
00083             /*
00084              * The translation as string (the word itself)
00085              * @return the translation
00086              */
00087             QString text() const { return m_text->text(); }
00088 
00089             /*
00090              * Sets the translation
00091              * @param expr
00092              */
00093             void setText ( const QString & expr ) { m_text->setText ( expr ); }
00094 
00095             /*
00096              * Equal operator to copy grades.
00097              * @param other grades copied
00098              * @return reference to the new grades
00099              */
00100 //             Text& operator= ( const Text &other ) { m_text->operator=(*(other.kEduVocText())); }
00101             /*
00102              * Compare two sets of grades.
00103              * @param other
00104              * @return true if equal
00105              */
00106 //             bool operator== ( const KEduVocText &other ) const;
00107 
00108 
00109             /* returns how often this entry has been practiced as int
00110             * @returns total count
00111             */
00112             unsigned int practiceCount() const { return m_text->practiceCount(); }
00113 
00114             /* set how often this entry has been practiced as int
00115             * @param count the new count
00116             */
00117             void setPracticeCount ( unsigned int count ) { m_text->setPracticeCount ( count ); }
00118 
00119             /* returns bad query count as int
00120             * @returns bad query count
00121             */
00122             unsigned int badCount() const { return m_text->badCount(); }
00123 
00124             /* set bad query count as int
00125             * @param count the new count
00126             */
00127             void setBadCount ( unsigned int count ) { m_text->setBadCount ( count ); }
00128 
00129             /* sets the grade
00130             * @param grade number of knowlegde: 0=known, x=numbers not knows
00131             */
00132             void setGrade ( unsigned int grade ) { m_text->setGrade ( grade ); }
00133 
00134             /* returns grade as int
00135             * @returns number of knowlegde: 0=known, x=numbers not knows
00136             */
00137             unsigned int grade() const { return m_text->grade(); }
00138 
00139             /*
00140              * If the string inside is empty this returns true.
00141              * @return
00142              */
00143             bool isEmpty() { return m_text->isEmpty(); }
00144 
00145 //             void fromKVTML2 ( QDomElement& parent );
00146 //             void toKVTML2 ( QDomElement& parent );
00147 
00148         public slots:
00150             void incBadCount() { m_text->incBadCount(); }
00151 
00153             void incPracticeCount() { m_text->incPracticeCount(); }
00154 
00156             void resetGrades() { m_text->resetGrades(); }
00157 
00159             void incGrade() { m_text->incGrade(); }
00160 
00162             void decGrade() { m_text->decGrade(); }
00163 
00165             QString practiceDate() const { return m_text->practiceDate().toString(); }
00166 
00176             QString practiceDate ( const QString & format ) const { return m_text->practiceDate().toString ( format ); }
00177 
00179             void setPracticeDate ( const QString & date ) { m_text->setPracticeDate ( QDateTime::fromString ( date ) ); }
00180 
00190             void setPracticeDate ( const QString & date, const QString & format ) { m_text->setPracticeDate ( QDateTime::fromString ( date, format ) ); }
00191 
00192         protected:
00193             KEduVocText * m_text;
00194 
00195     };
00196 
00197 }
00198 
00199 #endif

parley

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

kdeedu

Skip menu "kdeedu"
  •     lib
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal