]> Git trees. - libqmvoc.git/commitdiff
adapt qmvoctext.cpp for querymee
authorReto Zingg <g.d0b3rm4n@gmail.com>
Sat, 15 Dec 2012 17:28:48 +0000 (19:28 +0200)
committerReto Zingg <g.d0b3rm4n@gmail.com>
Sat, 15 Dec 2012 18:08:17 +0000 (20:08 +0200)
qmvoctext.cpp

index 41d44d08201d90070b1eb878d2d7ab8e081bf66e..0d91df9f00f355f0cfbe55b3a853c8d3bd8b382c 100644 (file)
@@ -1,5 +1,10 @@
+/***************************************************************************
+*   this file is from kdeedu project. Filename: keduvoctext.cpp
+***************************************************************************/
+
 /***************************************************************************
     Copyright 2007-2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+    Copyright (C) 2010, 2012 Reto Zingg <g.d0b3rm4n@gmail.com>
  ***************************************************************************/
 
 /***************************************************************************
  *                                                                         *
  ***************************************************************************/
 
-#include "keduvoctext.h"
+#include "qmvoctext.h"
 
 #include "kvtml2defs.h"
-#include "keduvockvtml2writer.h"
+#include "qmvockvtml2writer.h"
 
 #include <QtXml/QDomDocument>
 
-class KEduVocText::KEduVocTextPrivate
+class QmVocText::QmVocTextPrivate
 {
 public:
     /// This is the word itself. The vocabulary. This is what it is all about.
@@ -30,15 +35,15 @@ public:
     QDateTime m_practiceDate;
 };
 
-KEduVocText::KEduVocText(const QString& text)
-        :d( new KEduVocTextPrivate )
+QmVocText::QmVocText(const QString& text)
+        :d( new QmVocTextPrivate )
 {
     d->m_text = text;
     resetGrades();
 }
 
-KEduVocText::KEduVocText( const KEduVocText &other )
-        :d( new KEduVocTextPrivate )
+QmVocText::QmVocText( const QmVocText &other )
+        :d( new QmVocTextPrivate )
 {
     d->m_text = other.d->m_text;
     setGrade( other.grade() );
@@ -47,22 +52,22 @@ KEduVocText::KEduVocText( const KEduVocText &other )
     setPracticeDate( other.practiceDate() );
 }
 
-KEduVocText::~KEduVocText()
+QmVocText::~QmVocText()
 {
     delete d;
 }
 
-QString KEduVocText::text() const
+QString QmVocText::text() const
 {
     return d->m_text;
 }
 
-void KEduVocText::setText( const QString & expr )
+void QmVocText::setText( const QString & expr )
 {
     d->m_text = expr.simplified();
 }
 
-void KEduVocText::resetGrades()
+void QmVocText::resetGrades()
 {
     d->m_grade = KV_NORM_GRADE;
     d->m_totalPracticeCount = 0;
@@ -74,13 +79,13 @@ void KEduVocText::resetGrades()
 }
 
 
-grade_t KEduVocText::grade() const
+grade_t QmVocText::grade() const
 {
     return d->m_grade;
 }
 
 
-void KEduVocText::setGrade( grade_t grade )
+void QmVocText::setGrade( grade_t grade )
 {
     if ( grade > KV_MAX_GRADE ) {
         grade = KV_MAX_GRADE;
@@ -89,13 +94,13 @@ void KEduVocText::setGrade( grade_t grade )
 }
 
 
-void KEduVocText::incGrade()
+void QmVocText::incGrade()
 {
     setGrade( qMax<grade_t>(grade() + 1, KV_LEV1_GRADE ) );
 }
 
 
-void KEduVocText::decGrade()
+void QmVocText::decGrade()
 {
     if ( grade() == KV_MIN_GRADE ) {
         return;
@@ -104,54 +109,54 @@ void KEduVocText::decGrade()
 }
 
 
-count_t KEduVocText::practiceCount()  const
+count_t QmVocText::practiceCount()  const
 {
     return d->m_totalPracticeCount;
 }
 
 
-void KEduVocText::incPracticeCount()
+void QmVocText::incPracticeCount()
 {
     setPracticeCount( practiceCount() + 1 );
 }
 
 
-void KEduVocText::incBadCount()
+void QmVocText::incBadCount()
 {
     setBadCount( badCount() + 1 );
 }
 
 
-void KEduVocText::setPracticeCount( count_t count )
+void QmVocText::setPracticeCount( count_t count )
 {
     d->m_totalPracticeCount = count;
 }
 
 
-count_t KEduVocText::badCount() const
+count_t QmVocText::badCount() const
 {
     return d->m_badCount;
 }
 
 
-void KEduVocText::setBadCount( count_t count )
+void QmVocText::setBadCount( count_t count )
 {
     d->m_badCount = count;
 }
 
 
-QDateTime KEduVocText::practiceDate() const
+QDateTime QmVocText::practiceDate() const
 {
     return d->m_practiceDate;
 }
 
 
-void KEduVocText::setPracticeDate( const QDateTime & date )
+void QmVocText::setPracticeDate( const QDateTime & date )
 {
     d->m_practiceDate = date;
 }
 
-KEduVocText & KEduVocText::operator =(const KEduVocText & other)
+QmVocText & QmVocText::operator =(const QmVocText & other)
 {
     d->m_text = other.d->m_text;
     d->m_grade = other.d->m_grade;
@@ -162,7 +167,7 @@ KEduVocText & KEduVocText::operator =(const KEduVocText & other)
     return *this;
 }
 
-bool KEduVocText::operator ==(const KEduVocText & other) const
+bool QmVocText::operator ==(const QmVocText & other) const
 {
     return
         d->m_text == other.d->m_text &&
@@ -172,7 +177,7 @@ bool KEduVocText::operator ==(const KEduVocText & other) const
         d->m_practiceDate == other.d->m_practiceDate;
 }
 
-void KEduVocText::toKVTML2(QDomElement& parent)
+void QmVocText::toKVTML2(QDomElement& parent)
 {
     QDomDocument domDoc = parent.ownerDocument();
     if (d->m_text.isEmpty() && d->m_totalPracticeCount == 0) {
@@ -180,29 +185,29 @@ void KEduVocText::toKVTML2(QDomElement& parent)
     }
 
     // the text
-    KEduVocKvtml2Writer::appendTextElement( parent, KVTML_TEXT, text() );
+    QmVocKvtml2Writer::appendTextElement( parent, KVTML_TEXT, text() );
 
     // grades
     if ( d->m_totalPracticeCount > 0 ) {
         QDomElement gradeElement = domDoc.createElement( KVTML_GRADE );
 
             //<currentgrade>2</currentgrade>
-        KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_CURRENTGRADE, QString::number( grade() ) );
+        QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_CURRENTGRADE, QString::number( grade() ) );
 
             //<count>6</count>
-        KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_COUNT, QString::number( practiceCount() ) );
+        QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_COUNT, QString::number( practiceCount() ) );
 
             //<errorcount>1</errorcount>
-        KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_ERRORCOUNT, QString::number( badCount() ) );
+        QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_ERRORCOUNT, QString::number( badCount() ) );
 
             //<date>949757271</date>
-        KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_DATE,  practiceDate().toString( Qt::ISODate ) );
+        QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_DATE,  practiceDate().toString( Qt::ISODate ) );
 
         parent.appendChild( gradeElement );
     }
 }
 
-void KEduVocText::fromKVTML2(QDomElement & parent)
+void QmVocText::fromKVTML2(QDomElement & parent)
 {
     setText( parent.firstChildElement( KVTML_TEXT ).text() );
 
@@ -224,7 +229,7 @@ void KEduVocText::fromKVTML2(QDomElement & parent)
     }
 }
 
-bool KEduVocText::isEmpty()
+bool QmVocText::isEmpty()
 {
     return d->m_text.isEmpty();
 }