]> Git trees. - libqmvoc.git/commitdiff
Prepare Translation class to become usefull and add KEduVocGrade class.
authorFrederik Gladhorn <gladhorn@kde.org>
Mon, 11 Jun 2007 05:21:46 +0000 (05:21 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Mon, 11 Jun 2007 05:21:46 +0000 (05:21 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=673769

kdeeducore/keduvocexpression.cpp
kdeeducore/keduvocexpression.h
kdeeducore/keduvocgrade.cpp [new file with mode: 0644]
kdeeducore/keduvocgrade.h [new file with mode: 0644]
kdeeducore/keduvoctranslation.cpp
kdeeducore/keduvoctranslation.h

index 638273721dde9cdf3ec1072d429c7f1f478e13cb..c3153f5b6d2485e91383418d8d1d04f21deeb199 100644 (file)
@@ -18,8 +18,6 @@
 #include <KDebug>
 
 #include "keduvocexpression.h"
-#include "keduvoctranslation.h"
-
 
 class KEduVocExpression::KEduVocExpressionPrivate
 {
index 6dc39eab295d81485c13acd8e0fe93cab44a6e6e..96987c2a35e2c65402067ee9faa0cce928d28f7b 100644 (file)
@@ -52,9 +52,7 @@
 
 #include "keduvocgrammar.h"
 #include "keduvocmultiplechoice.h"
-
-typedef signed char grade_t;
-typedef unsigned short count_t;
+#include "keduvoctranslation.h"
 
 /**
   This class contains one vocabulary expression as an original with one or more
diff --git a/kdeeducore/keduvocgrade.cpp b/kdeeducore/keduvocgrade.cpp
new file mode 100644 (file)
index 0000000..43184ef
--- /dev/null
@@ -0,0 +1,21 @@
+/***************************************************************************
+                        Vocabulary Expression Grades for KDE Edu
+    -----------------------------------------------------------------------
+    copyright      :(C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "keduvocgrade.h"
+
+// KEduVocGrade::KEduVocGrade()
+// {
+// }
+//
diff --git a/kdeeducore/keduvocgrade.h b/kdeeducore/keduvocgrade.h
new file mode 100644 (file)
index 0000000..0c96afa
--- /dev/null
@@ -0,0 +1,37 @@
+/***************************************************************************
+                        Vocabulary Expression Grades for KDE Edu
+    -----------------------------------------------------------------------
+    copyright      :(C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef KEDUVOCGRADE_H
+#define KEDUVOCGRADE_H
+
+typedef signed char grade_t;
+typedef unsigned short count_t;
+
+/**
+Contains grading information (query date, bad count) for one language with respect to another.
+
+       @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+*/
+class KEduVocGrade
+{
+/// @todo make these private and write the according functions like updateQueryDate, increaseGrade, decreaseGrade etc.
+public:
+    grade_t m_grade;
+    count_t m_queryCount;
+    count_t m_badCount;
+    QDateTime m_queryDate;
+};
+
+#endif
index 4aedd7b0d8a857d50c869aecc308b08869970ba4..052e787758970ea93e54e2d7f1fd1b545cea5fcb 100644 (file)
@@ -1,24 +1,28 @@
-//
-// C++ Implementation: KEduVocTranslationtranslation
-//
-// Description:
-//
-//
-// Author: Frederik Gladhorn <frederik.gladhorn@kdemail.net>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/***************************************************************************
+                        Vocabulary Expression Translation for KDE Edu
+    -----------------------------------------------------------------------
+    copyright      :(C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
 
 //#include "keduvocexpression.h"
 
 #include "keduvoctranslation.h"
 #include <KDebug>
 
+/*
 class KEduVocTranslationPrivate
 {
 public:
-/*
+
     KEduVocTranslationPrivate () // ( KEduVocTranslation* qq )
             //: q ( qq )
     {
@@ -32,36 +36,9 @@ public:
     bool operator== ( const KEduVocTranslationPrivate &p ) const;
 
     //KEduVocTranslation* q;
-*/
-    QString m_translation; // This is the word itself. The vocabulary. This is what it is all about.
-
-//     QString m_types; // noun:male etc (language dependend)
-//     QString m_usageLabel;
-//     QString m_comment;
-//     QString m_paraphrase;
-//     QString m_synonym;
-//     QString m_example;
-//     QString m_antonym;
-//     QString m_pronunciation;
-//
-//     //QMap<int, KEduVocConjugation> m_conjugations; /// Conjugations are numbered 0..n with respect to the tenses they are for.
-//
-//     KEduVocComparison m_comparison;
-//
-//     KEduVocMultipleChoice m_multipleChoice;
-
-        // Here come all int indexFrom grades. (If you want, imagine the TO grades as int indexFrom of the other translation. That is where they belong. )
-    // User is asked to give THIS here as answer, than the grades go here.
-    // User answers, this is the source, grades go to the other translation.
-    // Grades go to the translation the user has to supply.
-    //not all have to be supplied
-
-    //QMap<int, TranslationGrade> m_grades;
-
-    // one false friend per other language is allowed
-    //QMap<int, QString> m_falseFriends;
 
 };
+*/
 
 /*
 void KEduVocTranslation::KEduVocTranslationPrivate::init()
@@ -400,19 +377,7 @@ bool KEduVocTranslation::operator ==(const KEduVocTranslation & translation) con
 
 KEduVocTranslation & KEduVocTranslation::operator =(const KEduVocTranslation & translation)
 {
-    // Check for self-assignment!
-    if (this == &translation) {      // Same object?
-      return *this;        // Yes, so skip assignment, and just return *this.
-      kDebug() << "Warning - self assignment" << endl;
-    }
-//kDebug() << "KEduVocTranslation & KEduVocTranslation::operator =(const KEduVocTranslation & translation)" << translation.d->m_translation << " d: " << d << endl;
-
     m_translation = translation.m_translation;
-
-//    *d = *translation.d;
-
-//    d->m_translation = translation.d->m_translation;
-kDebug() << "KEduVocTranslation & KEduVocTranslation::operator =(const KEduVocTranslation & translation)" << translation.m_translation << "This: " << this << endl;
     return *this;
 }
 
index 7715562c7b56f083daee6efeb36b8fca03ccfc53..8aed1c016998aeea3ecee1455b21ba2192e501dd 100644 (file)
@@ -1,14 +1,17 @@
-//
-// C++ Interface: keduvocexpressiontranslation
-//
-// Description:
-//
-//
-// Author: Frederik Gladhorn <frederik.gladhorn@kdemail.net>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/***************************************************************************
+                        Vocabulary Expression Translation for KDE Edu
+    -----------------------------------------------------------------------
+    copyright      :(C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
 
 
 #ifndef KEDUVOCEXPRESSIONTRANSLATION_H
 #include <QMap>
 #include <QString>
 
-//#include "keduvocgrammar.h"
-//#include "keduvocconjugation.h"
-//#include "keduvocmultiplechoice.h"
-/*
-///@todo move this into a seperate header, I guess
-typedef signed char grade_t;
-typedef unsigned short count_t;
-*/
+#include "keduvocgrade.h"
+#include "keduvocgrammar.h"
+#include "keduvocmultiplechoice.h"
+// @todo: move conjugation to it's proper file #include "keduvocconjugation.h"
+
 
 /**
        @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
 */
 
-
-class KEduVocTranslationPrivate;
-
 class KDEEDUCORE_EXPORT KEduVocTranslation
 {
 public:
@@ -357,19 +354,36 @@ public:
     bool operator==(const KEduVocTranslation &translation) const;
 
 private:
-/*
-    class TranslationGrade
-    {
-    public:
-        grade_t m_grade;
-        count_t m_queryCount;
-        count_t m_badCount;
-        QDateTime m_queryDate;
-    };
-*/
-
     //KEduVocTranslationPrivate* const d;
+
+    /// This is the word itself. The vocabulary. This is what it is all about.
     QString m_translation;
+    /// noun:male etc (language dependend)
+    QString m_types;
+    QString m_usageLabel;
+    QString m_comment;
+    QString m_paraphrase;
+    QString m_synonym;
+    QString m_example;
+    QString m_antonym;
+    QString m_pronunciation;
+
+    /// Conjugations are numbered 0..n with respect to the tenses they are for.
+    QMap<int, KEduVocConjugation> m_conjugations;
+
+    KEduVocComparison m_comparison;
+
+    KEduVocMultipleChoice m_multipleChoice;
+
+    // Here come all int indexFrom grades. (If you want, imagine the TO grades as int indexFrom of the other translation. That is where they belong. )
+    // User is asked to give THIS here as answer, than the grades go here.
+    // User answers, this is the source, grades go to the other translation.
+    // Grades go to the translation the user has to type/choose/whatever.
+    // not all have to be supplied
+    QMap<int, KEduVocGrade> m_grades;
+
+    /// One false friend string per other language
+    QMap<int, QString> m_falseFriends;
 
 };