From 0cb3db4a3ca3bcbee308c31808b305124ddef1bf Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 11 Jun 2007 05:21:46 +0000 Subject: [PATCH] Prepare Translation class to become usefull and add KEduVocGrade class. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=673769 --- kdeeducore/keduvocexpression.cpp | 2 - kdeeducore/keduvocexpression.h | 4 +- kdeeducore/keduvocgrade.cpp | 21 ++++++++ kdeeducore/keduvocgrade.h | 37 ++++++++++++++ kdeeducore/keduvoctranslation.cpp | 69 +++++++------------------- kdeeducore/keduvoctranslation.h | 80 ++++++++++++++++++------------- 6 files changed, 123 insertions(+), 90 deletions(-) create mode 100644 kdeeducore/keduvocgrade.cpp create mode 100644 kdeeducore/keduvocgrade.h diff --git a/kdeeducore/keduvocexpression.cpp b/kdeeducore/keduvocexpression.cpp index 6382737..c3153f5 100644 --- a/kdeeducore/keduvocexpression.cpp +++ b/kdeeducore/keduvocexpression.cpp @@ -18,8 +18,6 @@ #include #include "keduvocexpression.h" -#include "keduvoctranslation.h" - class KEduVocExpression::KEduVocExpressionPrivate { diff --git a/kdeeducore/keduvocexpression.h b/kdeeducore/keduvocexpression.h index 6dc39ea..96987c2 100644 --- a/kdeeducore/keduvocexpression.h +++ b/kdeeducore/keduvocexpression.h @@ -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 index 0000000..43184ef --- /dev/null +++ b/kdeeducore/keduvocgrade.cpp @@ -0,0 +1,21 @@ +/*************************************************************************** + Vocabulary Expression Grades for KDE Edu + ----------------------------------------------------------------------- + copyright :(C) 2007 Frederik Gladhorn + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 index 0000000..0c96afa --- /dev/null +++ b/kdeeducore/keduvocgrade.h @@ -0,0 +1,37 @@ +/*************************************************************************** + Vocabulary Expression Grades for KDE Edu + ----------------------------------------------------------------------- + copyright :(C) 2007 Frederik Gladhorn + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 +*/ +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 diff --git a/kdeeducore/keduvoctranslation.cpp b/kdeeducore/keduvoctranslation.cpp index 4aedd7b..052e787 100644 --- a/kdeeducore/keduvoctranslation.cpp +++ b/kdeeducore/keduvoctranslation.cpp @@ -1,24 +1,28 @@ -// -// C++ Implementation: KEduVocTranslationtranslation -// -// Description: -// -// -// Author: Frederik Gladhorn , (C) 2007 -// -// Copyright: See COPYING file that comes with this distribution -// -// +/*************************************************************************** + Vocabulary Expression Translation for KDE Edu + ----------------------------------------------------------------------- + copyright :(C) 2007 Frederik Gladhorn + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 +/* 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 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 m_grades; - - // one false friend per other language is allowed - //QMap 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; } diff --git a/kdeeducore/keduvoctranslation.h b/kdeeducore/keduvoctranslation.h index 7715562..8aed1c0 100644 --- a/kdeeducore/keduvoctranslation.h +++ b/kdeeducore/keduvoctranslation.h @@ -1,14 +1,17 @@ -// -// C++ Interface: keduvocexpressiontranslation -// -// Description: -// -// -// Author: Frederik Gladhorn , (C) 2007 -// -// Copyright: See COPYING file that comes with this distribution -// -// +/*************************************************************************** + Vocabulary Expression Translation for KDE Edu + ----------------------------------------------------------------------- + copyright :(C) 2007 Frederik Gladhorn + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 @@ -50,22 +53,16 @@ #include #include -//#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 */ - -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 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 m_grades; + + /// One false friend string per other language + QMap m_falseFriends; }; -- 2.47.3