From beccf3012a7fdee63eb5b67b8ede8aea2aae5573 Mon Sep 17 00:00:00 2001 From: Reto Zingg Date: Fri, 9 Apr 2010 22:12:37 +0300 Subject: [PATCH] rename classes and rename files --- keduvocarticle.cpp | 95 -------- ...ment_export.h => libqmvocdocument_export.h | 11 +- qmvocarticle.cpp | 96 ++++++++ keduvocarticle.h => qmvocarticle.h | 27 +-- keduvoccommon_p.h => qmvoccommon_p.h | 5 +- ...vocconjugation.cpp => qmvocconjugation.cpp | 109 ++++----- keduvocconjugation.h => qmvocconjugation.h | 37 ++-- keduvoccontainer.cpp => qmvoccontainer.cpp | 103 ++++----- keduvoccontainer.h => qmvoccontainer.h | 53 ++--- keduvoccsvreader.cpp => qmvoccsvreader.cpp | 18 +- keduvoccsvreader.h => qmvoccsvreader.h | 17 +- keduvoccsvwriter.cpp => qmvoccsvwriter.cpp | 20 +- keduvoccsvwriter.h => qmvoccsvwriter.h | 17 +- keduvocdeclension.cpp => qmvocdeclension.cpp | 97 ++++---- keduvocdeclension.h => qmvocdeclension.h | 31 +-- keduvocdocument.cpp => qmvocdocument.cpp | 181 ++++++++------- keduvocdocument.h => qmvocdocument.h | 62 +++--- keduvocexpression.cpp => qmvocexpression.cpp | 80 +++---- keduvocexpression.h => qmvocexpression.h | 50 ++--- keduvocidentifier.cpp => qmvocidentifier.cpp | 41 ++-- keduvocidentifier.h => qmvocidentifier.h | 33 +-- ...ckvtml2reader.cpp => qmvockvtml2reader.cpp | 161 +++++++------- keduvockvtml2reader.h => qmvockvtml2reader.h | 56 ++--- ...ckvtml2writer.cpp => qmvockvtml2writer.cpp | 156 ++++++------- keduvockvtml2writer.h => qmvockvtml2writer.h | 63 +++--- ...mpability.cpp => qmvockvtmlcompability.cpp | 102 ++++----- ...mlcompability.h => qmvockvtmlcompability.h | 19 +- ...vockvtmlreader.cpp => qmvockvtmlreader.cpp | 127 ++++++----- keduvockvtmlreader.h => qmvockvtmlreader.h | 39 ++-- ...vockvtmlwriter.cpp => qmvockvtmlwriter.cpp | 74 +++---- keduvockvtmlwriter.h => qmvockvtmlwriter.h | 45 ++-- keduvocleitnerbox.cpp => qmvocleitnerbox.cpp | 31 +-- keduvocleitnerbox.h => qmvocleitnerbox.h | 31 +-- keduvoclesson.cpp => qmvoclesson.cpp | 31 +-- keduvoclesson.h => qmvoclesson.h | 39 ++-- ...tiplechoice.cpp => qmvocmultiplechoice.cpp | 36 +-- ...cmultiplechoice.h => qmvocmultiplechoice.h | 26 ++- ...cpaukerreader.cpp => qmvocpaukerreader.cpp | 28 +-- keduvocpaukerreader.h => qmvocpaukerreader.h | 15 +- ...nalpronoun.cpp => qmvocpersonalpronoun.cpp | 47 ++-- ...ersonalpronoun.h => qmvocpersonalpronoun.h | 27 +-- keduvoctext.cpp => qmvoctext.cpp | 67 +++--- keduvoctext.h => qmvoctext.h | 23 +- ...voctranslation.cpp => qmvoctranslation.cpp | 208 +++++++++--------- keduvoctranslation.h => qmvoctranslation.h | 104 ++++----- ...abelnreader.cpp => qmvocvokabelnreader.cpp | 18 +- ...cvokabelnreader.h => qmvocvokabelnreader.h | 17 +- keduvocwordflags.h => qmvocwordflags.h | 13 +- keduvocwordtype.cpp => qmvocwordtype.cpp | 43 ++-- keduvocwordtype.h => qmvocwordtype.h | 41 ++-- keduvocwqlreader.cpp => qmvocwqlreader.cpp | 16 +- keduvocwqlreader.h => qmvocwqlreader.h | 17 +- keduvocxdxfreader.cpp => qmvocxdxfreader.cpp | 20 +- keduvocxdxfreader.h => qmvocxdxfreader.h | 15 +- sharedkvtmlfiles.cpp | 6 +- sharedkvtmlfiles.h | 14 +- 56 files changed, 1494 insertions(+), 1464 deletions(-) delete mode 100644 keduvocarticle.cpp rename libkeduvocdocument_export.h => libqmvocdocument_export.h (87%) create mode 100644 qmvocarticle.cpp rename keduvocarticle.h => qmvocarticle.h (77%) rename keduvoccommon_p.h => qmvoccommon_p.h (88%) rename keduvocconjugation.cpp => qmvocconjugation.cpp (61%) rename keduvocconjugation.h => qmvocconjugation.h (74%) rename keduvoccontainer.cpp => qmvoccontainer.cpp (59%) rename keduvoccontainer.h => qmvoccontainer.h (74%) rename keduvoccsvreader.cpp => qmvoccsvreader.cpp (83%) rename keduvoccsvreader.h => qmvoccsvreader.h (80%) rename keduvoccsvwriter.cpp => qmvoccsvwriter.cpp (81%) rename keduvoccsvwriter.h => qmvoccsvwriter.h (78%) rename keduvocdeclension.cpp => qmvocdeclension.cpp (64%) rename keduvocdeclension.h => qmvocdeclension.h (77%) rename keduvocdocument.cpp => qmvocdocument.cpp (83%) rename keduvocdocument.h => qmvocdocument.h (86%) rename keduvocexpression.cpp => qmvocexpression.cpp (59%) rename keduvocexpression.h => qmvocexpression.h (75%) rename keduvocidentifier.cpp => qmvocidentifier.cpp (73%) rename keduvocidentifier.h => qmvocidentifier.h (77%) rename keduvockvtml2reader.cpp => qmvockvtml2reader.cpp (80%) rename keduvockvtml2reader.h => qmvockvtml2reader.h (74%) rename keduvockvtml2writer.cpp => qmvockvtml2writer.cpp (81%) rename keduvockvtml2writer.h => qmvockvtml2writer.h (69%) rename keduvockvtmlcompability.cpp => qmvockvtmlcompability.cpp (70%) rename keduvockvtmlcompability.h => qmvockvtmlcompability.h (90%) rename keduvockvtmlreader.cpp => qmvockvtmlreader.cpp (87%) rename keduvockvtmlreader.h => qmvockvtmlreader.h (79%) rename keduvockvtmlwriter.cpp => qmvockvtmlwriter.cpp (92%) rename keduvockvtmlwriter.h => qmvockvtmlwriter.h (68%) rename keduvocleitnerbox.cpp => qmvocleitnerbox.cpp (75%) rename keduvocleitnerbox.h => qmvocleitnerbox.h (72%) rename keduvoclesson.cpp => qmvoclesson.cpp (71%) rename keduvoclesson.h => qmvoclesson.h (67%) rename keduvocmultiplechoice.cpp => qmvocmultiplechoice.cpp (67%) rename keduvocmultiplechoice.h => qmvocmultiplechoice.h (74%) rename keduvocpaukerreader.cpp => qmvocpaukerreader.cpp (83%) rename keduvocpaukerreader.h => qmvocpaukerreader.h (81%) rename keduvocpersonalpronoun.cpp => qmvocpersonalpronoun.cpp (59%) rename keduvocpersonalpronoun.h => qmvocpersonalpronoun.h (69%) rename keduvoctext.cpp => qmvoctext.cpp (71%) rename keduvoctext.h => qmvoctext.h (90%) rename keduvoctranslation.cpp => qmvoctranslation.cpp (62%) rename keduvoctranslation.h => qmvoctranslation.h (74%) rename keduvocvokabelnreader.cpp => qmvocvokabelnreader.cpp (90%) rename keduvocvokabelnreader.h => qmvocvokabelnreader.h (79%) rename keduvocwordflags.h => qmvocwordflags.h (91%) rename keduvocwordtype.cpp => qmvocwordtype.cpp (73%) rename keduvocwordtype.h => qmvocwordtype.h (72%) rename keduvocwqlreader.cpp => qmvocwqlreader.cpp (93%) rename keduvocwqlreader.h => qmvocwqlreader.h (81%) rename keduvocxdxfreader.cpp => qmvocxdxfreader.cpp (88%) rename keduvocxdxfreader.h => qmvocxdxfreader.h (81%) diff --git a/keduvocarticle.cpp b/keduvocarticle.cpp deleted file mode 100644 index ea1036a..0000000 --- a/keduvocarticle.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/*************************************************************************** -* this file is from kdeedu project. Filename: keduvocarticle.cpp -***************************************************************************/ - -/*************************************************************************** - - Copyright 1999-2001 Ewald Arnold - Copyright 2004, 2005, 2007 Peter Hedlund - Copyright 2007-2008 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 "keduvocarticle.h" -#include "keduvocwordflags.h" - -#include - -class KEduVocArticle::Private -{ -public: - QMap m_articles; -}; - -KEduVocArticle::KEduVocArticle() - :d( new Private ) -{} - -KEduVocArticle::KEduVocArticle( const KEduVocArticle &other ) - :d( new Private ) -{ - d->m_articles = other.d->m_articles; -} - -KEduVocArticle &KEduVocArticle::operator= ( const KEduVocArticle& other ) -{ - d->m_articles = other.d->m_articles; - return *this; -} - -KEduVocArticle::KEduVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &neu_def, const QString &neu_indef ) - :d( new Private ) -{ - setArticle( mal_def, KEduVocWordFlag::Singular | KEduVocWordFlag::Definite | KEduVocWordFlag::Masculine ); - setArticle( fem_def, KEduVocWordFlag::Singular | KEduVocWordFlag::Definite | KEduVocWordFlag::Feminine ); - setArticle( neu_def, KEduVocWordFlag::Singular | KEduVocWordFlag::Definite | KEduVocWordFlag::Neuter ); - - setArticle( mal_indef, KEduVocWordFlag::Singular | KEduVocWordFlag::Indefinite | KEduVocWordFlag::Masculine ); - setArticle( fem_indef, KEduVocWordFlag::Singular | KEduVocWordFlag::Indefinite | KEduVocWordFlag::Feminine ); - setArticle( neu_indef, KEduVocWordFlag::Singular | KEduVocWordFlag::Indefinite | KEduVocWordFlag::Neuter ); -} - -KEduVocArticle::~KEduVocArticle() -{ - delete d; -} - - -QString KEduVocArticle::article(const KEduVocWordFlags& flags) -{ - return d->m_articles.value(flags & (KEduVocWordFlag::genders | KEduVocWordFlag::numbers | KEduVocWordFlag::Definite | KEduVocWordFlag::Indefinite)); -} - -void KEduVocArticle::setArticle(const QString & article, const KEduVocWordFlags& flags) -{ - d->m_articles[flags & (KEduVocWordFlag::genders | KEduVocWordFlag::numbers | KEduVocWordFlag::Definite | KEduVocWordFlag::Indefinite)] = article; -} - - -bool KEduVocArticle::isArticle(const QString & article) const -{ - return d->m_articles.values().contains(article); -} - -bool KEduVocArticle::isEmpty() -{ - // we don't count empty strings as articles - foreach(const QString& s, d->m_articles) - { - if (!s.isEmpty()) - return false; - } - return true; -} - - - diff --git a/libkeduvocdocument_export.h b/libqmvocdocument_export.h similarity index 87% rename from libkeduvocdocument_export.h rename to libqmvocdocument_export.h index 25ee0b9..2323bf0 100644 --- a/libkeduvocdocument_export.h +++ b/libqmvocdocument_export.h @@ -22,8 +22,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef LIBKEDUVOCDOCUMENT_EXPORT_H -#define LIBKEDUVOCDOCUMENT_EXPORT_H +#ifndef LIBQMVOCDOCUMENT_EXPORT_H +#define LIBQMVOCDOCUMENT_EXPORT_H /* needed for KDE_EXPORT and KDE_IMPORT macros */ // #include @@ -47,17 +47,16 @@ #ifndef KEDUVOCDOCUMENT_EXPORT # if defined(MAKE_KEDUVOCDOCUMENT_LIB) /* We are building this library */ -# define KEDUVOCDOCUMENT_EXPORT KDE_EXPORT +# define QMVOCDOCUMENT_EXPORT KDE_EXPORT # else /* We are using this library */ -# define KEDUVOCDOCUMENT_EXPORT KDE_IMPORT +# define QMVOCDOCUMENT_EXPORT KDE_IMPORT # endif #endif # ifndef KEDUVOCDOCUMENT_EXPORT_DEPRECATED -# define KEDUVOCDOCUMENT_EXPORT_DEPRECATED KDE_DEPRECATED KEDUVOCDOCUMENT_EXPORT +# define KEDUVOCDOCUMENT_EXPORT_DEPRECATED KDE_DEPRECATED QMVOCDOCUMENT_EXPORT # endif #endif -#define KUrl QUrl diff --git a/qmvocarticle.cpp b/qmvocarticle.cpp new file mode 100644 index 0000000..d6623cc --- /dev/null +++ b/qmvocarticle.cpp @@ -0,0 +1,96 @@ +/*************************************************************************** +* this file is from kdeedu project. Filename: keduvocarticle.cpp +***************************************************************************/ + +/*************************************************************************** + + Copyright 1999-2001 Ewald Arnold + Copyright 2004, 2005, 2007 Peter Hedlund + Copyright 2007-2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg + + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 "qmvocarticle.h" +#include "qmvocwordflags.h" + +#include + +class QmVocArticle::Private +{ +public: + QMap m_articles; +}; + +QmVocArticle::QmVocArticle() + :d( new Private ) +{} + +QmVocArticle::QmVocArticle( const QmVocArticle &other ) + :d( new Private ) +{ + d->m_articles = other.d->m_articles; +} + +QmVocArticle &QmVocArticle::operator= ( const QmVocArticle& other ) +{ + d->m_articles = other.d->m_articles; + return *this; +} + +QmVocArticle::QmVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &neu_def, const QString &neu_indef ) + :d( new Private ) +{ + setArticle( mal_def, QmVocWordFlag::Singular | QmVocWordFlag::Definite | QmVocWordFlag::Masculine ); + setArticle( fem_def, QmVocWordFlag::Singular | QmVocWordFlag::Definite | QmVocWordFlag::Feminine ); + setArticle( neu_def, QmVocWordFlag::Singular | QmVocWordFlag::Definite | QmVocWordFlag::Neuter ); + + setArticle( mal_indef, QmVocWordFlag::Singular | QmVocWordFlag::Indefinite | QmVocWordFlag::Masculine ); + setArticle( fem_indef, QmVocWordFlag::Singular | QmVocWordFlag::Indefinite | QmVocWordFlag::Feminine ); + setArticle( neu_indef, QmVocWordFlag::Singular | QmVocWordFlag::Indefinite | QmVocWordFlag::Neuter ); +} + +QmVocArticle::~QmVocArticle() +{ + delete d; +} + + +QString QmVocArticle::article(const QmVocWordFlags& flags) +{ + return d->m_articles.value(flags & (QmVocWordFlag::genders | QmVocWordFlag::numbers | QmVocWordFlag::Definite | QmVocWordFlag::Indefinite)); +} + +void QmVocArticle::setArticle(const QString & article, const QmVocWordFlags& flags) +{ + d->m_articles[flags & (QmVocWordFlag::genders | QmVocWordFlag::numbers | QmVocWordFlag::Definite | QmVocWordFlag::Indefinite)] = article; +} + + +bool QmVocArticle::isArticle(const QString & article) const +{ + return d->m_articles.values().contains(article); +} + +bool QmVocArticle::isEmpty() +{ + // we don't count empty strings as articles + foreach(const QString& s, d->m_articles) + { + if (!s.isEmpty()) + return false; + } + return true; +} + + + diff --git a/keduvocarticle.h b/qmvocarticle.h similarity index 77% rename from keduvocarticle.h rename to qmvocarticle.h index f7d3061..1bb9642 100644 --- a/keduvocarticle.h +++ b/qmvocarticle.h @@ -7,6 +7,7 @@ Copyright 1999-2001 Ewald Arnold Copyright 2005, 2007 Peter Hedlund Copyright 2007-2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ @@ -19,22 +20,22 @@ * * ***************************************************************************/ -#ifndef KEDUVOCARTICLE_H -#define KEDUVOCARTICLE_H +#ifndef QMVOCARTICLE_H +#define QMVOCARTICLE_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" #include -#include "keduvocwordflags.h" +#include "qmvocwordflags.h" -class KEduVocWordType; +class QmVocWordType; /** * Class representing the articles of a language * * It contains all available articles of the language as QString */ -class KEDUVOCDOCUMENT_EXPORT KEduVocArticle +class QMVOCDOCUMENT_EXPORT QmVocArticle { public: @@ -43,12 +44,12 @@ public: /** * The constructor without arguments */ - explicit KEduVocArticle(); + explicit QmVocArticle(); /** copy constructor for d-pointer safety * @param other article object to copy */ - KEduVocArticle( const KEduVocArticle &other ); + QmVocArticle( const QmVocArticle &other ); /** * DEPRECATED The constructor with arguments, assumes singular! @@ -59,21 +60,21 @@ public: * @param nat_def reference to a QString with the definite neutral article * @param nat_indef reference to a QString with the indefinite neutral article */ - KDE_DEPRECATED KEduVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &nat_def, const QString &nat_indef ); + KDE_DEPRECATED QmVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &nat_def, const QString &nat_indef ); /** * default destructor, deletes the d pointer */ - ~KEduVocArticle(); + ~QmVocArticle(); /** * assignment operator for d-pointer copying */ - KEduVocArticle &operator= ( const KEduVocArticle& other ); + QmVocArticle &operator= ( const QmVocArticle& other ); - QString article(const KEduVocWordFlags&); + QString article(const QmVocWordFlags&); - void setArticle(const QString& article, const KEduVocWordFlags&); + void setArticle(const QString& article, const QmVocWordFlags&); bool isArticle(const QString& article) const; diff --git a/keduvoccommon_p.h b/qmvoccommon_p.h similarity index 88% rename from keduvoccommon_p.h rename to qmvoccommon_p.h index 8dc8e98..628409a 100644 --- a/keduvoccommon_p.h +++ b/qmvoccommon_p.h @@ -5,6 +5,7 @@ /*************************************************************************** * Copyright 2007 Jeremy Whiting * * Copyright 2007 Frederik Gladhorn * + * Copyright (C) 2010 Reto Zingg * * * * 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 * @@ -12,8 +13,8 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef KEDUVOCCOMMON_P_H -#define KEDUVOCCOMMON_P_H +#ifndef QMVOCCOMMON_P_H +#define QMVOCCOMMON_P_H #define KVD_VERS_PREFIX " v" // kvoctrain v0.1.0 diff --git a/keduvocconjugation.cpp b/qmvocconjugation.cpp similarity index 61% rename from keduvocconjugation.cpp rename to qmvocconjugation.cpp index e1d0a15..ae83e00 100644 --- a/keduvocconjugation.cpp +++ b/qmvocconjugation.cpp @@ -4,13 +4,14 @@ /*************************************************************************** - C++ Implementation: keduvocconjugation + C++ Implementation: qmvocconjugation ----------------------------------------------------------------------- begin : Di Aug 28 2007 copyright : (C) 2007 Frederik Gladhorn + Copyright : (C) 2010 Reto Zingg ----------------------------------------------------------------------- @@ -25,88 +26,88 @@ * * ***************************************************************************/ -#include "keduvocconjugation.h" -#include "keduvoccommon_p.h" -#include "keduvoctext.h" +#include "qmvocconjugation.h" +#include "qmvoccommon_p.h" +#include "qmvoctext.h" #include "kvtml2defs.h" #include #include -#include +#include -class KEduVocConjugation::Private +class QmVocConjugation::Private { public: - QMap m_conjugations; + QMap m_conjugations; }; -KEduVocConjugation::KEduVocConjugation() +QmVocConjugation::QmVocConjugation() : d( new Private ) {} -KEduVocConjugation::KEduVocConjugation( const KEduVocConjugation& other ) +QmVocConjugation::QmVocConjugation( const QmVocConjugation& other ) : d( new Private ) { d->m_conjugations = other.d->m_conjugations; } -KEduVocConjugation::~KEduVocConjugation() +QmVocConjugation::~QmVocConjugation() { delete d; } -KEduVocConjugation& KEduVocConjugation::operator = ( const KEduVocConjugation& other ) +QmVocConjugation& QmVocConjugation::operator = ( const QmVocConjugation& other ) { d->m_conjugations = other.d->m_conjugations; return *this; } -bool KEduVocConjugation::operator ==(const KEduVocConjugation& other) const +bool QmVocConjugation::operator ==(const QmVocConjugation& other) const { return d->m_conjugations == other.d->m_conjugations; } -KEduVocText& KEduVocConjugation::conjugation(KEduVocWordFlags flags) const +QmVocText& QmVocConjugation::conjugation(QmVocWordFlags flags) const { - return d->m_conjugations[flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers | KEduVocWordFlag::genders)]; + return d->m_conjugations[flags & (QmVocWordFlag::persons | QmVocWordFlag::numbers | QmVocWordFlag::genders)]; } -void KEduVocConjugation::setConjugation(const KEduVocText& conjugation, KEduVocWordFlags flags) +void QmVocConjugation::setConjugation(const QmVocText& conjugation, QmVocWordFlags flags) { - d->m_conjugations[flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers | KEduVocWordFlag::genders)] = conjugation; + d->m_conjugations[flags & (QmVocWordFlag::persons | QmVocWordFlag::numbers | QmVocWordFlag::genders)] = conjugation; } -bool KEduVocConjugation::isEmpty() +bool QmVocConjugation::isEmpty() { return d->m_conjugations.isEmpty(); } -QList< KEduVocWordFlags > KEduVocConjugation::keys() +QList< QmVocWordFlags > QmVocConjugation::keys() { return d->m_conjugations.keys(); } -void KEduVocConjugation::toKVTML2(QDomElement & parent, const QString &tense) +void QmVocConjugation::toKVTML2(QDomElement & parent, const QString &tense) { if (isEmpty()) { return; } - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; - QMap persons; - persons[0] = KEduVocWordFlag::First; - persons[1] = KEduVocWordFlag::Second; - persons[2] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Masculine); - persons[3] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Feminine); - persons[4] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Neuter); + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; + QMap persons; + persons[0] = QmVocWordFlag::First; + persons[1] = QmVocWordFlag::Second; + persons[2] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Masculine); + persons[3] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Feminine); + persons[4] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Neuter); QDomDocument domDoc = parent.ownerDocument(); @@ -116,13 +117,13 @@ void KEduVocConjugation::toKVTML2(QDomElement & parent, const QString &tense) tenseElement.appendChild( domDoc.createTextNode(tense) ); parent.appendChild(tenseElement); } else { - kDebug() << "Saving conjugation with empty tense"; + qDebug() << "Saving conjugation with empty tense"; } for ( int num = 0; num <= 2; ++num) { QDomElement numberElement = domDoc.createElement( KVTML_GRAMMATICAL_NUMBER[num] ); for ( int person = 0; person < 5; ++person) { - KEduVocWordFlags curFlags = numbers[num] | persons[person]; + QmVocWordFlags curFlags = numbers[num] | persons[person]; if (keys().contains(curFlags) && !conjugation(curFlags).isEmpty()) { QDomElement personElement = domDoc.createElement( KVTML_GRAMMATICAL_PERSON[person] ); @@ -139,27 +140,27 @@ void KEduVocConjugation::toKVTML2(QDomElement & parent, const QString &tense) /* QString first = conjugation.conjugation( - KEduVocConjugation::First, num ); + QmVocConjugation::First, num ); QString second = conjugation.conjugation( - KEduVocConjugation::Second, num ); + QmVocConjugation::Second, num ); QString third_male = conjugation.conjugation( - KEduVocConjugation::ThirdMale, num ); + QmVocConjugation::ThirdMale, num ); QString third_female = conjugation.conjugation( - KEduVocConjugation::ThirdFemale, num ); + QmVocConjugation::ThirdFemale, num ); QString third_neutral = conjugation.conjugation( - KEduVocConjugation::ThirdNeutralCommon, num ); + QmVocConjugation::ThirdNeutralCommon, num ); if ( !first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() || !third_male.isEmpty() || !third_neutral.isEmpty() ) { QDomElement number; switch (num) { - case KEduVocConjugation::Singular: + case QmVocConjugation::Singular: number = m_domDoc.createElement( KVTML_SINGULAR ); break; - case KEduVocConjugation::Dual: + case QmVocConjugation::Dual: number = m_domDoc.createElement( KVTML_DUAL ); break; - case KEduVocConjugation::Plural: + case QmVocConjugation::Plural: number = m_domDoc.createElement( KVTML_PLURAL ); break; } @@ -176,9 +177,9 @@ void KEduVocConjugation::toKVTML2(QDomElement & parent, const QString &tense) /* - for ( KEduVocWordFlag::DeclensionNumber num = KEduVocWordFlag::Singular; num <= KEduVocWordFlag::Plural; num = KEduVocWordFlag::DeclensionNumber(num +1) ) { + for ( QmVocWordFlag::DeclensionNumber num = QmVocWordFlag::Singular; num <= QmVocWordFlag::Plural; num = QmVocWordFlag::DeclensionNumber(num +1) ) { QDomElement numberElement = domDoc.createElement( KVTML_GRAMMATICAL_NUMBER[num] ); - for ( KEduVocWordFlag::DeclensionCase dcase = KEduVocWordFlag::Nominative; dcase < KEduVocWordFlag::DeclensionCaseMAX; dcase = KEduVocWordFlag::DeclensionCase(dcase +1) ) { + for ( QmVocWordFlag::DeclensionCase dcase = QmVocWordFlag::Nominative; dcase < QmVocWordFlag::DeclensionCaseMAX; dcase = QmVocWordFlag::DeclensionCase(dcase +1) ) { QDomElement caseElement = domDoc.createElement( KVTML_DECLENSION_CASE[dcase] ); declension(num, dcase).toKVTML2(caseElement); @@ -195,26 +196,26 @@ void KEduVocConjugation::toKVTML2(QDomElement & parent, const QString &tense) -KEduVocConjugation* KEduVocConjugation::fromKVTML2(QDomElement & parent) +QmVocConjugation* QmVocConjugation::fromKVTML2(QDomElement & parent) { // sanity check if (parent.isNull()) { return 0; } - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; - QMap persons; - persons[0] = KEduVocWordFlag::First; - persons[1] = KEduVocWordFlag::Second; - persons[2] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Masculine); - persons[3] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Feminine); - persons[4] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Neuter); + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; + QMap persons; + persons[0] = QmVocWordFlag::First; + persons[1] = QmVocWordFlag::Second; + persons[2] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Masculine); + persons[3] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Feminine); + persons[4] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Neuter); - KEduVocConjugation* conjugation = new KEduVocConjugation; + QmVocConjugation* conjugation = new QmVocConjugation; for ( int num = 0; num <= 2; num++ ) { QDomElement numberElement = parent.firstChildElement( KVTML_GRAMMATICAL_NUMBER[num] ); @@ -223,7 +224,7 @@ KEduVocConjugation* KEduVocConjugation::fromKVTML2(QDomElement & parent) for (int person = 0; person < 5; person++) { QDomElement personElement = numberElement.firstChildElement( KVTML_GRAMMATICAL_PERSON[person] ); if (!personElement.isNull()) { - KEduVocText text; + QmVocText text; text.fromKVTML2(personElement); if (text.text().isEmpty()) { // compatibility for kde 4.0. There the text was directly below the person, not enabling grades per conjugation form. diff --git a/keduvocconjugation.h b/qmvocconjugation.h similarity index 74% rename from keduvocconjugation.h rename to qmvocconjugation.h index 400cbbb..977f6e8 100644 --- a/keduvocconjugation.h +++ b/qmvocconjugation.h @@ -4,13 +4,14 @@ /*************************************************************************** - C++ Interface: keduvocconjugation + C++ Interface: qmvocconjugation ----------------------------------------------------------------------- begin : Di Aug 28 2007 copyright : (C) 2007 Frederik Gladhorn + Copyright : (C) 2010 Reto Zingg ----------------------------------------------------------------------- @@ -26,33 +27,33 @@ ***************************************************************************/ -#ifndef KEDUVOCCONJUGATION_H -#define KEDUVOCCONJUGATION_H +#ifndef QMVOCCONJUGATION_H +#define QMVOCCONJUGATION_H -#include "libkeduvocdocument_export.h" -#include "keduvoctext.h" -#include "keduvocwordflags.h" +#include "libqmvocdocument_export.h" +#include "qmvoctext.h" +#include "qmvocwordflags.h" #include /** * The conjugation of a verb */ -class KEDUVOCDOCUMENT_EXPORT KEduVocConjugation +class QMVOCDOCUMENT_EXPORT QmVocConjugation { public: /** * The constructor */ - explicit KEduVocConjugation(); + explicit QmVocConjugation(); - KEduVocConjugation( const KEduVocConjugation& rhs ); + QmVocConjugation( const QmVocConjugation& rhs ); - ~KEduVocConjugation(); + ~QmVocConjugation(); - KEduVocConjugation& operator = ( const KEduVocConjugation& a ); - bool operator == ( const KEduVocConjugation& a ) const; + QmVocConjugation& operator = ( const QmVocConjugation& a ); + bool operator == ( const QmVocConjugation& a ) const; /** * Returns an existing conjugation object. It is an error and leads to undefined behaviour @@ -63,13 +64,13 @@ public: * @param flags Flags obtained by a previous call to keys() * @return The existing conjugation object with the specified properties */ - KEduVocText& conjugation(KEduVocWordFlags flags) const; + QmVocText& conjugation(QmVocWordFlags flags) const; /** * Updates or creates the conjugation object for the given word flags. */ - void setConjugation(const KEduVocText& conjugation, KEduVocWordFlags flags); + void setConjugation(const QmVocText& conjugation, QmVocWordFlags flags); - QList keys(); + QList keys(); bool isEmpty(); @@ -84,13 +85,11 @@ public: * @param parent * @return */ - static KEduVocConjugation* fromKVTML2(QDomElement& parent); + static QmVocConjugation* fromKVTML2(QDomElement& parent); private: class Private; Private* const d; }; - -#endif // KEDUVOCCONJUGATION_H - +#endif // QMVOCCONJUGATION_H diff --git a/keduvoccontainer.cpp b/qmvoccontainer.cpp similarity index 59% rename from keduvoccontainer.cpp rename to qmvoccontainer.cpp index e9e7fc6..d951582 100644 --- a/keduvoccontainer.cpp +++ b/qmvoccontainer.cpp @@ -19,15 +19,16 @@ * * ***************************************************************************/ -#include "keduvoccontainer.h" +#include "qmvoccontainer.h" -#include "keduvocexpression.h" +#include "qmvocexpression.h" -#include +// #include #include +#include /** private class to store information about a lesson */ -class KEduVocContainer::Private +class QmVocContainer::Private { public: ~Private(); @@ -37,24 +38,24 @@ public: bool m_inPractice; // other lessons in the tree - KEduVocContainer *m_parentContainer; - QList < KEduVocContainer * > m_childContainers; + QmVocContainer *m_parentContainer; + QList < QmVocContainer * > m_childContainers; EnumContainerType m_type; - QList < KEduVocExpression* > m_childLessonEntries; + QList < QmVocExpression* > m_childLessonEntries; bool m_childLessonEntriesValid; /// Image url - KUrl m_imageUrl; + QUrl m_imageUrl; }; -KEduVocContainer::Private::~Private() +QmVocContainer::Private::~Private() { qDeleteAll(m_childContainers); } -KEduVocContainer::KEduVocContainer(const QString& name, EnumContainerType type, KEduVocContainer *parent) +QmVocContainer::QmVocContainer(const QString& name, EnumContainerType type, QmVocContainer *parent) : d( new Private ) { d->m_parentContainer = parent; @@ -64,7 +65,7 @@ KEduVocContainer::KEduVocContainer(const QString& name, EnumContainerType type, d->m_childLessonEntriesValid = false; } -KEduVocContainer::KEduVocContainer( const KEduVocContainer &other ) +QmVocContainer::QmVocContainer( const QmVocContainer &other ) : d( new Private ) { d->m_name = other.d->m_name; @@ -74,12 +75,12 @@ KEduVocContainer::KEduVocContainer( const KEduVocContainer &other ) d->m_childLessonEntriesValid = false; } -KEduVocContainer::~KEduVocContainer() +QmVocContainer::~QmVocContainer() { delete d; } -void KEduVocContainer::appendChildContainer(KEduVocContainer * child) +void QmVocContainer::appendChildContainer(QmVocContainer * child) { d->m_childContainers.append(child); child->d->m_parentContainer = this; @@ -87,20 +88,20 @@ void KEduVocContainer::appendChildContainer(KEduVocContainer * child) invalidateChildLessonEntries(); } -KEduVocContainer * KEduVocContainer::childContainer(int row) +QmVocContainer * QmVocContainer::childContainer(int row) { return d->m_childContainers.value(row); } -KEduVocContainer * KEduVocContainer::childContainer(const QString & name) +QmVocContainer * QmVocContainer::childContainer(const QString & name) { if (d->m_name == name) { return this; } - foreach (KEduVocContainer *container, d->m_childContainers) { - KEduVocContainer *found = container->childContainer(name); + foreach (QmVocContainer *container, d->m_childContainers) { + QmVocContainer *found = container->childContainer(name); if (found) { return found; } @@ -109,43 +110,43 @@ KEduVocContainer * KEduVocContainer::childContainer(const QString & name) } -void KEduVocContainer::deleteChildContainer(int row) +void QmVocContainer::deleteChildContainer(int row) { - kDebug() << "Delete of container - check entry deletion!"; + qDebug() << "Delete of container - check entry deletion!"; delete d->m_childContainers.takeAt(row); invalidateChildLessonEntries(); } -void KEduVocContainer::removeChildContainer(int row) +void QmVocContainer::removeChildContainer(int row) { d->m_childContainers.removeAt(row); invalidateChildLessonEntries(); } -int KEduVocContainer::childContainerCount() const +int QmVocContainer::childContainerCount() const { return d->m_childContainers.count(); } -int KEduVocContainer::row() const +int QmVocContainer::row() const { if (d->m_parentContainer) { - return d->m_parentContainer->d->m_childContainers.indexOf(const_cast(this)); + return d->m_parentContainer->d->m_childContainers.indexOf(const_cast(this)); } return 0; } -KEduVocContainer& KEduVocContainer::operator= ( const KEduVocContainer &other ) +QmVocContainer& QmVocContainer::operator= ( const QmVocContainer &other ) { d->m_name = other.d->m_name; d->m_inPractice = other.d->m_inPractice; return *this; } -bool KEduVocContainer::operator==(const KEduVocContainer &other) +bool QmVocContainer::operator==(const QmVocContainer &other) { return d->m_name == other.d->m_name && d->m_inPractice == other.d->m_inPractice @@ -153,38 +154,38 @@ bool KEduVocContainer::operator==(const KEduVocContainer &other) ; } -void KEduVocContainer::setName( const QString &name ) +void QmVocContainer::setName( const QString &name ) { d->m_name = name; } -QString KEduVocContainer::name() +QString QmVocContainer::name() { return d->m_name; } -bool KEduVocContainer::inPractice() +bool QmVocContainer::inPractice() { return d->m_inPractice; } -void KEduVocContainer::setInPractice(bool inPractice) +void QmVocContainer::setInPractice(bool inPractice) { d->m_inPractice = inPractice; } -void KEduVocContainer::removeTranslation(int translation) +void QmVocContainer::removeTranslation(int translation) { - foreach(KEduVocContainer *childContainer, d->m_childContainers) { + foreach(QmVocContainer *childContainer, d->m_childContainers) { childContainer->removeTranslation(translation); } - foreach(KEduVocExpression *entry, entries() ) { + foreach(QmVocExpression *entry, entries() ) { entry->removeTranslation( translation ); } } -QList< KEduVocExpression * > KEduVocContainer::entriesRecursive() +QList< QmVocExpression * > QmVocContainer::entriesRecursive() { if (!d->m_childLessonEntriesValid) { updateChildLessonEntries(); @@ -192,38 +193,38 @@ QList< KEduVocExpression * > KEduVocContainer::entriesRecursive() return d->m_childLessonEntries; } -QList< KEduVocContainer * > KEduVocContainer::childContainers() +QList< QmVocContainer * > QmVocContainer::childContainers() { return d->m_childContainers; } -KEduVocContainer * KEduVocContainer::parent() +QmVocContainer * QmVocContainer::parent() { return d->m_parentContainer; } -void KEduVocContainer::setContainerType(KEduVocContainer::EnumContainerType type) +void QmVocContainer::setContainerType(QmVocContainer::EnumContainerType type) { d->m_type = type; } -KEduVocContainer::EnumContainerType KEduVocContainer::containerType() +QmVocContainer::EnumContainerType QmVocContainer::containerType() { return d->m_type; } -KUrl KEduVocContainer::imageUrl() +QUrl QmVocContainer::imageUrl() { return d->m_imageUrl; } -void KEduVocContainer::setImageUrl(const KUrl &url) +void QmVocContainer::setImageUrl(const QUrl &url) { d->m_imageUrl = url; } -void KEduVocContainer::insertChildContainer(int row, KEduVocContainer * child) +void QmVocContainer::insertChildContainer(int row, QmVocContainer * child) { d->m_childContainers.insert(row, child); child->d->m_parentContainer = this; @@ -231,19 +232,19 @@ void KEduVocContainer::insertChildContainer(int row, KEduVocContainer * child) invalidateChildLessonEntries(); } -void KEduVocContainer::updateChildLessonEntries() +void QmVocContainer::updateChildLessonEntries() { - QList < KEduVocExpression* > entriesRecursive = entries(); + QList < QmVocExpression* > entriesRecursive = entries(); - foreach(KEduVocContainer *childContainer, d->m_childContainers) - foreach(KEduVocExpression * expr, childContainer->entries(Recursive)) + foreach(QmVocContainer *childContainer, d->m_childContainers) + foreach(QmVocExpression * expr, childContainer->entries(Recursive)) entriesRecursive.append(expr); d->m_childLessonEntries = entriesRecursive; d->m_childLessonEntriesValid = true; } -void KEduVocContainer::invalidateChildLessonEntries() +void QmVocContainer::invalidateChildLessonEntries() { d->m_childLessonEntriesValid = false; // propagate to parent @@ -252,21 +253,21 @@ void KEduVocContainer::invalidateChildLessonEntries() } } -double KEduVocContainer::averageGrade(int translation, EnumEntriesRecursive recursive) +double QmVocContainer::averageGrade(int translation, EnumEntriesRecursive recursive) { // grades range from 0..7 right now int sum = 0; - foreach (KEduVocExpression *entry, entries(recursive)) { + foreach (QmVocExpression *entry, entries(recursive)) { sum += entry->translation(translation)->grade(); } // make that a percentage return (sum * 100.0/7.0)/entryCount(recursive); } -int KEduVocContainer::expressionsOfGrade(int translation, grade_t grade, EnumEntriesRecursive recursive) +int QmVocContainer::expressionsOfGrade(int translation, grade_t grade, EnumEntriesRecursive recursive) { int sum = 0; - foreach (KEduVocExpression *entry, entries(recursive)) { + foreach (QmVocExpression *entry, entries(recursive)) { if (entry->translation(translation)->grade() == grade) { sum++; } @@ -274,9 +275,9 @@ int KEduVocContainer::expressionsOfGrade(int translation, grade_t grade, EnumEnt return sum; } -void KEduVocContainer::resetGrades(int translation, EnumEntriesRecursive recursive) +void QmVocContainer::resetGrades(int translation, EnumEntriesRecursive recursive) { - foreach (KEduVocExpression *entry, entries(recursive)) { + foreach (QmVocExpression *entry, entries(recursive)) { entry->resetGrades(translation); } } diff --git a/keduvoccontainer.h b/qmvoccontainer.h similarity index 74% rename from keduvoccontainer.h rename to qmvoccontainer.h index e48463b..b262de4 100644 --- a/keduvoccontainer.h +++ b/qmvoccontainer.h @@ -19,20 +19,21 @@ * * ***************************************************************************/ -#ifndef KEDUVOCCONTAINER_H -#define KEDUVOCCONTAINER_H +#ifndef QMVOCCONTAINER_H +#define QMVOCCONTAINER_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvoctext.h" +#include "qmvoctext.h" -#include +// #include +#include #include -class KEduVocExpression; +class QmVocExpression; /** class to store information about a container - that can be a lesson or word types */ -class KEDUVOCDOCUMENT_EXPORT KEduVocContainer +class QMVOCDOCUMENT_EXPORT QmVocContainer { // make this a template? @@ -50,13 +51,13 @@ public: }; /** default constructor */ - explicit KEduVocContainer(const QString& name, EnumContainerType type, KEduVocContainer *parent = 0); + explicit QmVocContainer(const QString& name, EnumContainerType type, QmVocContainer *parent = 0); - void appendChildContainer(KEduVocContainer *child); - void insertChildContainer(int row, KEduVocContainer *child); + void appendChildContainer(QmVocContainer *child); + void insertChildContainer(int row, QmVocContainer *child); void deleteChildContainer(int row); void removeChildContainer(int row); - KEduVocContainer *childContainer(int row); + QmVocContainer *childContainer(int row); /** * Retrieve a child container by its name @@ -64,30 +65,30 @@ public: * @param name container name * @return the child container */ - KEduVocContainer *childContainer(const QString& name); + QmVocContainer *childContainer(const QString& name); - QList childContainers(); + QList childContainers(); /** * Find a child container * @param name * @return */ -// KEduVocContainer *childContainer(const QString& name); +// QmVocContainer *childContainer(const QString& name); int childContainerCount() const; int row() const; - virtual KEduVocContainer *parent(); + virtual QmVocContainer *parent(); /** copy constructor for d-pointer safe copying */ - KEduVocContainer( const KEduVocContainer &other ); + QmVocContainer( const QmVocContainer &other ); /** destructor */ - virtual ~KEduVocContainer(); + virtual ~QmVocContainer(); /** assignment operator */ - KEduVocContainer& operator= ( const KEduVocContainer& ); + QmVocContainer& operator= ( const QmVocContainer& ); /** set the container name * @param name text to set for the name @@ -98,9 +99,9 @@ public: QString name(); /** get a list of all entries in the container */ - virtual QList < KEduVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive) =0; + virtual QList < QmVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive) =0; virtual int entryCount(EnumEntriesRecursive recursive = NotRecursive) =0; - virtual KEduVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive) =0; + virtual QmVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive) =0; /** * Removes a translation. This has to be called when a language is removed from a document. @@ -112,29 +113,29 @@ public: void setInPractice( bool inPractice ); /** equality operator */ - bool operator==(const KEduVocContainer &other); + bool operator==(const QmVocContainer &other); /** * The type of this container. @see EnumContainerType * @return */ - KEduVocContainer::EnumContainerType containerType(); + QmVocContainer::EnumContainerType containerType(); /** * Set the type of container. * For convenience by default this is taken over from the parent, so no need to set. * @param type the new type */ - void setContainerType(KEduVocContainer::EnumContainerType type); + void setContainerType(QmVocContainer::EnumContainerType type); /** get the image url for this container if it exists */ - KUrl imageUrl(); + QUrl imageUrl(); /** set the image url for this container * @param url url of the image */ - void setImageUrl(const KUrl &url); + void setImageUrl(const QUrl &url); double averageGrade(int translation, EnumEntriesRecursive recursive); @@ -148,7 +149,7 @@ public: void resetGrades(int translation, EnumEntriesRecursive recursive); protected: - QList< KEduVocExpression * > entriesRecursive(); + QList< QmVocExpression * > entriesRecursive(); /** * Set the child entry cache to invalid diff --git a/keduvoccsvreader.cpp b/qmvoccsvreader.cpp similarity index 83% rename from keduvoccsvreader.cpp rename to qmvoccsvreader.cpp index 18e4587..439e78a 100644 --- a/keduvoccsvreader.cpp +++ b/qmvoccsvreader.cpp @@ -4,7 +4,7 @@ /*************************************************************************** - create a KEduVocDocument from a text file + create a QmVocDocument from a text file ----------------------------------------------------------------------- @@ -29,7 +29,7 @@ * * ***************************************************************************/ -#include "keduvoccsvreader.h" +#include "qmvoccsvreader.h" #include #include @@ -37,11 +37,11 @@ // #include -#include "keduvocdocument.h" -#include "keduvoclesson.h" -#include "keduvocexpression.h" +#include "qmvocdocument.h" +#include "qmvoclesson.h" +#include "qmvocexpression.h" -KEduVocCsvReader::KEduVocCsvReader( QIODevice *file ) +QmVocCsvReader::QmVocCsvReader( QIODevice *file ) { // the file must be already open m_inputFile = file; @@ -49,7 +49,7 @@ KEduVocCsvReader::KEduVocCsvReader( QIODevice *file ) } -bool KEduVocCsvReader::readDoc( KEduVocDocument *doc ) +bool QmVocCsvReader::readDoc( QmVocDocument *doc ) { m_doc = doc; @@ -62,14 +62,14 @@ bool KEduVocCsvReader::readDoc( KEduVocDocument *doc ) int languageCount = 0; - KEduVocLesson* lesson = new KEduVocLesson( "Vocabulary", m_doc->lesson()); + QmVocLesson* lesson = new QmVocLesson( "Vocabulary", m_doc->lesson()); m_doc->lesson()->appendChildContainer(lesson); while ( !inputStream.atEnd() ) { QString s = inputStream.readLine(); if ( !s.simplified().isEmpty() ) { - KEduVocExpression* expression = new KEduVocExpression( s.split(separator) ); + QmVocExpression* expression = new QmVocExpression( s.split(separator) ); languageCount = qMax( languageCount, expression->translationIndices().count() ); lesson->appendEntry( expression ); diff --git a/keduvoccsvreader.h b/qmvoccsvreader.h similarity index 80% rename from keduvoccsvreader.h rename to qmvoccsvreader.h index bc8b855..924793e 100644 --- a/keduvoccsvreader.h +++ b/qmvoccsvreader.h @@ -3,9 +3,10 @@ ***************************************************************************/ /*************************************************************************** - create a KEduVocDocument from a text file + create a QmVocDocument from a text file ----------------------------------------------------------------------- copyright : (C) 2007 Peter Hedlund + Copyright : (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,21 +19,21 @@ * * ***************************************************************************/ -#ifndef KEDUVOCCSVREADER_H -#define KEDUVOCCSVREADER_H +#ifndef QMVOCCSVREADER_H +#define QMVOCCSVREADER_H #include class QIODevice; -class KEduVocDocument; +class QmVocDocument; -class KEduVocCsvReader +class QmVocCsvReader { public: - KEduVocCsvReader( QIODevice *file ); + QmVocCsvReader( QIODevice *file ); - bool readDoc( KEduVocDocument *doc ); + bool readDoc( QmVocDocument *doc ); QString errorMessage() const { @@ -41,7 +42,7 @@ public: private: QIODevice *m_inputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; QString m_errorMessage; }; diff --git a/keduvoccsvwriter.cpp b/qmvoccsvwriter.cpp similarity index 81% rename from keduvoccsvwriter.cpp rename to qmvoccsvwriter.cpp index e439123..137d15c 100644 --- a/keduvoccsvwriter.cpp +++ b/qmvoccsvwriter.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - export a KEduVocDocument to a delimited text file + export a QmVocDocument to a delimited text file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold @@ -21,25 +21,25 @@ * * ***************************************************************************/ -#include "keduvoccsvwriter.h" +#include "qmvoccsvwriter.h" #include #include // #include -#include "keduvocdocument.h" -#include "keduvoclesson.h" -#include "keduvocexpression.h" +#include "qmvocdocument.h" +#include "qmvoclesson.h" +#include "qmvocexpression.h" -KEduVocCsvWriter::KEduVocCsvWriter( QFile *file ) +QmVocCsvWriter::QmVocCsvWriter( QFile *file ) { // the file must be already open m_outputFile = file; } -bool KEduVocCsvWriter::writeDoc( KEduVocDocument *doc, const QString &generator ) +bool QmVocCsvWriter::writeDoc( QmVocDocument *doc, const QString &generator ) { Q_UNUSED( generator ); @@ -55,12 +55,12 @@ bool KEduVocCsvWriter::writeDoc( KEduVocDocument *doc, const QString &generator outputStream << "Title:" << separator << m_doc->title() << "\n"; outputStream << "Author:" << separator << m_doc->author() << "\n"; - KEduVocExpression *expression; + QmVocExpression *expression; int idCount = m_doc->identifierCount(); QString currentRow; - for ( int e = 0; e < m_doc->lesson()->entryCount(KEduVocLesson::Recursive); e++ ) { - expression = m_doc->lesson()->entries(KEduVocLesson::Recursive).value( e ); + for ( int e = 0; e < m_doc->lesson()->entryCount(QmVocLesson::Recursive); e++ ) { + expression = m_doc->lesson()->entries(QmVocLesson::Recursive).value( e ); currentRow = ""; bool sep = false; diff --git a/keduvoccsvwriter.h b/qmvoccsvwriter.h similarity index 78% rename from keduvoccsvwriter.h rename to qmvoccsvwriter.h index 0f957eb..233f0c0 100644 --- a/keduvoccsvwriter.h +++ b/qmvoccsvwriter.h @@ -3,11 +3,12 @@ ***************************************************************************/ /*************************************************************************** - export a KEduVocDocument to a delimited text file + export a QmVocDocument to a delimited text file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold (C) 2007 Peter Hedlund + (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -19,23 +20,23 @@ * * ***************************************************************************/ -#ifndef KEDUVOCCSVWRITER_H -#define KEDUVOCCSVWRITER_H +#ifndef QMVOCCSVWRITER_H +#define QMVOCCSVWRITER_H class QFile; class QString; -class KEduVocDocument; +class QmVocDocument; -class KEduVocCsvWriter +class QmVocCsvWriter { public: - KEduVocCsvWriter( QFile *file ); + QmVocCsvWriter( QFile *file ); - bool writeDoc( KEduVocDocument *doc, const QString &generator ); + bool writeDoc( QmVocDocument *doc, const QString &generator ); private: QFile *m_outputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; }; #endif diff --git a/keduvocdeclension.cpp b/qmvocdeclension.cpp similarity index 64% rename from keduvocdeclension.cpp rename to qmvocdeclension.cpp index 0a9bbc4..61749b1 100644 --- a/keduvocdeclension.cpp +++ b/qmvocdeclension.cpp @@ -4,13 +4,14 @@ /*************************************************************************** - C++ Implementation: keduvocdeclension + C++ Implementation: qmvocdeclension ----------------------------------------------------------------------- begin : Do Sep 20 2007 copyright : (C) 2007 Frederik Gladhorn + Copyright : (C) 2010 Reto Zingg ----------------------------------------------------------------------- @@ -25,58 +26,58 @@ * * ***************************************************************************/ -#include "keduvocdeclension.h" +#include "qmvocdeclension.h" #include "kvtml2defs.h" -#include "keduvockvtml2writer.h" +#include "qmvockvtml2writer.h" #include #include -class KEduVocDeclension::Private +class QmVocDeclension::Private { public: - QMap m_declensions; + QMap m_declensions; }; -KEduVocDeclension::KEduVocDeclension() +QmVocDeclension::QmVocDeclension() :d (new Private) { } -KEduVocDeclension::KEduVocDeclension(const KEduVocDeclension & other) +QmVocDeclension::QmVocDeclension(const QmVocDeclension & other) :d (new Private) { d->m_declensions = other.d->m_declensions; } -KEduVocDeclension & KEduVocDeclension::operator =(const KEduVocDeclension & other) +QmVocDeclension & QmVocDeclension::operator =(const QmVocDeclension & other) { d->m_declensions = other.d->m_declensions; return *this; } -KEduVocDeclension::~KEduVocDeclension() +QmVocDeclension::~QmVocDeclension() { delete d; } -KEduVocText& KEduVocDeclension::declension(KEduVocWordFlags flags) +QmVocText& QmVocDeclension::declension(QmVocWordFlags flags) { return d->m_declensions[flags]; } -void KEduVocDeclension::setDeclension(const KEduVocText & declension, KEduVocWordFlags flags) +void QmVocDeclension::setDeclension(const QmVocText & declension, QmVocWordFlags flags) { d->m_declensions[flags] = declension; } -bool KEduVocDeclension::isEmpty() +bool QmVocDeclension::isEmpty() { return d->m_declensions.isEmpty(); } -void KEduVocDeclension::toKVTML2(QDomElement & parent) +void QmVocDeclension::toKVTML2(QDomElement & parent) { if (isEmpty()) { return; @@ -84,24 +85,24 @@ void KEduVocDeclension::toKVTML2(QDomElement & parent) QDomDocument domDoc = parent.ownerDocument(); QDomElement declensionElement = domDoc.createElement( KVTML_DECLENSION ); - QMap genders; - genders[0] = KEduVocWordFlag::Masculine; - genders[1] = KEduVocWordFlag::Feminine; - genders[2] = KEduVocWordFlag::Neuter; + QMap genders; + genders[0] = QmVocWordFlag::Masculine; + genders[1] = QmVocWordFlag::Feminine; + genders[2] = QmVocWordFlag::Neuter; - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; - QMap cases; - cases[0] = KEduVocWordFlag::Nominative; - cases[1] = KEduVocWordFlag::Genitive; - cases[2] = KEduVocWordFlag::Dative; - cases[3] = KEduVocWordFlag::Accusative; - cases[4] = KEduVocWordFlag::Ablative; - cases[5] = KEduVocWordFlag::Locative; - cases[6] = KEduVocWordFlag::Vocative; + QMap cases; + cases[0] = QmVocWordFlag::Nominative; + cases[1] = QmVocWordFlag::Genitive; + cases[2] = QmVocWordFlag::Dative; + cases[3] = QmVocWordFlag::Accusative; + cases[4] = QmVocWordFlag::Ablative; + cases[5] = QmVocWordFlag::Locative; + cases[6] = QmVocWordFlag::Vocative; for ( int gen = 0; gen <= 2; ++gen) @@ -130,7 +131,7 @@ void KEduVocDeclension::toKVTML2(QDomElement & parent) } } -KEduVocDeclension* KEduVocDeclension::fromKVTML2(QDomElement & parent) +QmVocDeclension* QmVocDeclension::fromKVTML2(QDomElement & parent) { QDomElement declensionElement = parent.firstChildElement( KVTML_DECLENSION ); // we don't create empty objects, if necessary, create later on demand. @@ -139,27 +140,27 @@ KEduVocDeclension* KEduVocDeclension::fromKVTML2(QDomElement & parent) } - QMap genders; - genders[0] = KEduVocWordFlag::Masculine; - genders[1] = KEduVocWordFlag::Feminine; - genders[2] = KEduVocWordFlag::Neuter; + QMap genders; + genders[0] = QmVocWordFlag::Masculine; + genders[1] = QmVocWordFlag::Feminine; + genders[2] = QmVocWordFlag::Neuter; - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; - QMap cases; - cases[0] = KEduVocWordFlag::Nominative; - cases[1] = KEduVocWordFlag::Genitive; - cases[2] = KEduVocWordFlag::Dative; - cases[3] = KEduVocWordFlag::Accusative; - cases[4] = KEduVocWordFlag::Ablative; - cases[5] = KEduVocWordFlag::Locative; - cases[6] = KEduVocWordFlag::Vocative; + QMap cases; + cases[0] = QmVocWordFlag::Nominative; + cases[1] = QmVocWordFlag::Genitive; + cases[2] = QmVocWordFlag::Dative; + cases[3] = QmVocWordFlag::Accusative; + cases[4] = QmVocWordFlag::Ablative; + cases[5] = QmVocWordFlag::Locative; + cases[6] = QmVocWordFlag::Vocative; - KEduVocDeclension* declension = new KEduVocDeclension; + QmVocDeclension* declension = new QmVocDeclension; for ( int gen = 0; gen <= 2; ++gen ) { QDomElement genderElement = declensionElement.firstChildElement( KVTML_GRAMMATICAL_GENDER[gen] ); @@ -171,7 +172,7 @@ KEduVocDeclension* KEduVocDeclension::fromKVTML2(QDomElement & parent) for ( int dcase = 0; dcase <= 6; ++dcase) { QDomElement caseElement = numberElement.firstChildElement( KVTML_DECLENSION_CASE[dcase] ); if (!caseElement.isNull()) { - KEduVocText text; + QmVocText text; text.fromKVTML2(caseElement); declension->setDeclension(text, genders[gen] | numbers[num] | cases[dcase]); } diff --git a/keduvocdeclension.h b/qmvocdeclension.h similarity index 77% rename from keduvocdeclension.h rename to qmvocdeclension.h index d872a28..4a1070d 100644 --- a/keduvocdeclension.h +++ b/qmvocdeclension.h @@ -4,13 +4,14 @@ /*************************************************************************** - C++ Interface: keduvocdeclension + C++ Interface: qmvocdeclension ----------------------------------------------------------------------- begin : Do Sep 20 2007 copyright : (C) 2007 Frederik Gladhorn + Copyright : (C) 2010 Reto Zingg ----------------------------------------------------------------------- @@ -24,46 +25,46 @@ * (at your option) any later version. * * * ***************************************************************************/ -#ifndef KEDUVOCDECLENSION_H -#define KEDUVOCDECLENSION_H +#ifndef QMVOCDECLENSION_H +#define QMVOCDECLENSION_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvoctext.h" -#include "keduvocwordflags.h" +#include "qmvoctext.h" +#include "qmvocwordflags.h" /** A declension contains all forms that a NOUN possibly can have. @author Frederik Gladhorn */ -class KEDUVOCDOCUMENT_EXPORT KEduVocDeclension{ +class QMVOCDOCUMENT_EXPORT QmVocDeclension{ public: /** * The constructor without arguments */ - explicit KEduVocDeclension(); + explicit QmVocDeclension(); /** copy constructor * @param other comparison object to copy */ - KEduVocDeclension( const KEduVocDeclension &other ); + QmVocDeclension( const QmVocDeclension &other ); - ~KEduVocDeclension(); + ~QmVocDeclension(); /** equality operator * @param a object to compare to * @returns true if comparisons are the same, false otherwise */ // will probably not be necessary -// bool operator == ( const KEduVocDeclension& a ) const; +// bool operator == ( const QmVocDeclension& a ) const; /** assignment operator for d-pointer copying * @param other object to copy from * @returns reference to this object */ - KEduVocDeclension& operator= ( const KEduVocDeclension& other ); + QmVocDeclension& operator= ( const QmVocDeclension& other ); /** * The grammatical number, there is singular and plural for english, some languages have dual for exactly two items. @@ -71,7 +72,7 @@ public: * @param decCase * @return */ - KEduVocText& declension(KEduVocWordFlags flags); + QmVocText& declension(QmVocWordFlags flags); /** * Set a declension @@ -79,7 +80,7 @@ public: * @param number * @param decCase */ - void setDeclension(const KEduVocText& declension, KEduVocWordFlags flags); + void setDeclension(const QmVocText& declension, QmVocWordFlags flags); bool isEmpty(); @@ -95,7 +96,7 @@ public: * @param parent * @return */ - static KEduVocDeclension* fromKVTML2(QDomElement& parent); + static QmVocDeclension* fromKVTML2(QDomElement& parent); private: class Private; diff --git a/keduvocdocument.cpp b/qmvocdocument.cpp similarity index 83% rename from keduvocdocument.cpp rename to qmvocdocument.cpp index 19be077..5e35a2e 100644 --- a/keduvocdocument.cpp +++ b/qmvocdocument.cpp @@ -22,7 +22,7 @@ * * ***************************************************************************/ -#include "keduvocdocument.h" +#include "qmvocdocument.h" #include // #include @@ -38,19 +38,19 @@ // #include // #include -#include "keduvocexpression.h" -#include "keduvoclesson.h" -#include "keduvocleitnerbox.h" -#include "keduvocwordtype.h" -#include "keduvockvtmlwriter.h" -#include "keduvockvtml2writer.h" -#include "keduvoccsvreader.h" -#include "keduvoccsvwriter.h" -#include "keduvockvtml2reader.h" -#include "keduvocwqlreader.h" -#include "keduvocpaukerreader.h" -#include "keduvocvokabelnreader.h" -#include "keduvocxdxfreader.h" +#include "qmvocexpression.h" +#include "qmvoclesson.h" +#include "qmvocleitnerbox.h" +#include "qmvocwordtype.h" +#include "qmvockvtmlwriter.h" +#include "qmvockvtml2writer.h" +#include "qmvoccsvreader.h" +#include "qmvoccsvwriter.h" +#include "qmvockvtml2reader.h" +#include "qmvocwqlreader.h" +#include "qmvocpaukerreader.h" +#include "qmvocvokabelnreader.h" +#include "qmvocxdxfreader.h" #define WQL_IDENT "WordQuiz" @@ -59,10 +59,10 @@ #define TXT_EXT "txt" #define WQL_EXT "wql" -class KEduVocDocument::KEduVocDocumentPrivate +class QmVocDocument::QmVocDocumentPrivate { public: - KEduVocDocumentPrivate( KEduVocDocument* qq ) + QmVocDocumentPrivate( QmVocDocument* qq ) : q( qq ) { m_lessonContainer = 0; @@ -71,17 +71,17 @@ public: init(); } - ~KEduVocDocumentPrivate(); + ~QmVocDocumentPrivate(); void init(); - KEduVocDocument* q; + QmVocDocument* q; bool m_dirty; - KUrl m_url; + QUrl m_url; // save these to document - QList m_identifiers; + QList m_identifiers; QList m_extraSizeHints; QList m_sizeHints; @@ -106,28 +106,28 @@ public: */ QString m_category; - KEduVocLesson * m_lessonContainer; - KEduVocWordType * m_wordTypeContainer; - KEduVocLeitnerBox * m_leitnerContainer; + QmVocLesson * m_lessonContainer; + QmVocWordType * m_wordTypeContainer; + QmVocLeitnerBox * m_leitnerContainer; }; -KEduVocDocument::KEduVocDocumentPrivate::~KEduVocDocumentPrivate() +QmVocDocument::QmVocDocumentPrivate::~QmVocDocumentPrivate() { delete m_lessonContainer; delete m_wordTypeContainer; delete m_leitnerContainer; } -void KEduVocDocument::KEduVocDocumentPrivate::init() +void QmVocDocument::QmVocDocumentPrivate::init() { delete m_lessonContainer; - m_lessonContainer = new KEduVocLesson( "Document Lesson"); - m_lessonContainer->setContainerType(KEduVocLesson::Lesson); + m_lessonContainer = new QmVocLesson( "Document Lesson"); + m_lessonContainer->setContainerType(QmVocLesson::Lesson); delete m_wordTypeContainer; - m_wordTypeContainer = new KEduVocWordType( "Word types" ); + m_wordTypeContainer = new QmVocWordType( "Word types" ); delete m_leitnerContainer; - m_leitnerContainer = new KEduVocLeitnerBox( "Leitner Box" ); + m_leitnerContainer = new QmVocLeitnerBox( "Leitner Box" ); m_tenseDescriptions.clear(); m_identifiers.clear(); @@ -151,27 +151,27 @@ void KEduVocDocument::KEduVocDocumentPrivate::init() } -KEduVocDocument::KEduVocDocument( QObject *parent ) - : QObject( parent ), d( new KEduVocDocumentPrivate( this ) ) +QmVocDocument::QmVocDocument( QObject *parent ) + : QObject( parent ), d( new QmVocDocumentPrivate( this ) ) { qDebug() << "constructor done"; } -KEduVocDocument::~KEduVocDocument() +QmVocDocument::~QmVocDocument() { delete d; } -void KEduVocDocument::setModified( bool dirty ) +void QmVocDocument::setModified( bool dirty ) { d->m_dirty = dirty; emit docModified( d->m_dirty ); } -KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileName ) +QmVocDocument::FileType QmVocDocument::detectFileType( const QString &fileName ) { // QIODevice * f = KFilterDev::deviceForFile( fileName ); QFile f(fileName); @@ -252,7 +252,7 @@ KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileNa } -int KEduVocDocument::open( const KUrl& url ) +int QmVocDocument::open( const QUrl& url ) { // temp solution for KUrl -> QString QString myFile = url.path(); @@ -288,7 +288,7 @@ int KEduVocDocument::open( const KUrl& url ) switch ( ft ) { case Kvtml: { qDebug() << "Reading KVTML document..."; - KEduVocKvtml2Reader kvtmlReader( f ); + QmVocKvtml2Reader kvtmlReader( f ); read = kvtmlReader.readDoc( this ); if ( !read ) { errorMessage = kvtmlReader.errorMessage(); @@ -302,7 +302,7 @@ int KEduVocDocument::open( const KUrl& url ) qDebug() << "Reading WordQuiz (WQL) document..."; qCritical ("WordQuiz (WQL) document not yet supported..."); errorMessage = "WordQuiz (WQL) document not yet supported..."; -// KEduVocWqlReader wqlReader( f ); +// QmVocWqlReader wqlReader( f ); // d->m_url.setFileName( "Untitled" ); // read = wqlReader.readDoc( this ); // if ( !read ) { @@ -315,7 +315,7 @@ int KEduVocDocument::open( const KUrl& url ) qDebug() << "Reading Pauker document..."; qCritical ("Pauker document not yet supported..."); errorMessage = "Pauker document not yet supported..."; -// KEduVocPaukerReader paukerReader( this ); +// QmVocPaukerReader paukerReader( this ); // d->m_url.setFileName( "Untitled" ); // read = paukerReader.read( f ); // if ( !read ) { @@ -328,7 +328,7 @@ int KEduVocDocument::open( const KUrl& url ) qDebug() << "Reading Vokabeln document..."; qCritical ("Vokabeln document not yet supported..."); errorMessage = "Vokabeln document not yet supported..."; -// KEduVocVokabelnReader vokabelnReader( f ); +// QmVocVokabelnReader vokabelnReader( f ); // d->m_url.setFileName( "Untitled" ); // read = vokabelnReader.readDoc( this ); // if ( !read ) { @@ -341,7 +341,7 @@ int KEduVocDocument::open( const KUrl& url ) qDebug() << "Reading CVS document..."; qCritical ("CVS document not yet supported..."); errorMessage = "CVS document not yet supported..."; -// KEduVocCsvReader csvReader( f ); +// QmVocCsvReader csvReader( f ); // read = csvReader.readDoc( this ); // if ( !read ) { // errorMessage = csvReader.errorMessage(); @@ -353,7 +353,7 @@ int KEduVocDocument::open( const KUrl& url ) qDebug() << "Reading XDXF document..."; qCritical ("XDXF document not yet supported..."); errorMessage = "XDXF document not yet supported..."; -// KEduVocXdxfReader xdxfReader( this ); +// QmVocXdxfReader xdxfReader( this ); // d->m_url.setFileName( "Untitled" ); // read = xdxfReader.read( f ); // if ( !read ) { @@ -364,7 +364,7 @@ int KEduVocDocument::open( const KUrl& url ) default: { qDebug() << "Reading KVTML document (fallback)..."; - KEduVocKvtml2Reader kvtmlReader( f ); + QmVocKvtml2Reader kvtmlReader( f ); read = kvtmlReader.readDoc( this ); if ( !read ) { errorMessage = kvtmlReader.errorMessage(); @@ -397,9 +397,9 @@ int KEduVocDocument::open( const KUrl& url ) } -int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & generator ) +int QmVocDocument::saveAs( const QUrl & url, FileType ft, const QString & generator ) { - KUrl tmp( url ); + QUrl tmp( url ); if ( ft == Automatic ) { if ( tmp.path().right( strlen( "." KVTML_EXT ) ) == "." KVTML_EXT ) @@ -423,19 +423,19 @@ int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & gene switch ( ft ) { case Kvtml: { // write version 2 file - KEduVocKvtml2Writer kvtmlWriter( &f ); + QmVocKvtml2Writer kvtmlWriter( &f ); saved = kvtmlWriter.writeDoc( this, generator ); } break; ///@todo port me // case Kvtml1: { // // write old version 1 file -// KEduVocKvtmlWriter kvtmlWriter( &f ); +// QmVocKvtmlWriter kvtmlWriter( &f ); // saved = kvtmlWriter.writeDoc( this, generator ); // } // break; case Csv: { - KEduVocCsvWriter csvWriter( &f ); + QmVocCsvWriter csvWriter( &f ); saved = csvWriter.writeDoc( this, generator ); } break; @@ -457,14 +457,14 @@ int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & gene return 0; } -QByteArray KEduVocDocument::toByteArray(const QString &generator) +QByteArray QmVocDocument::toByteArray(const QString &generator) { // no file needed - KEduVocKvtml2Writer kvtmlWriter(0); + QmVocKvtml2Writer kvtmlWriter(0); return kvtmlWriter.toByteArray( this, generator ); } -void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers ) +void QmVocDocument::merge( QmVocDocument *docToMerge, bool matchIdentifiers ) { Q_UNUSED(docToMerge) Q_UNUSED(matchIdentifiers) @@ -524,7 +524,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers if (equal) { // easy way: same language codes, just append for (int i = 0; i < docToMerge->entryCount(); i++) { - KEduVocExpression *expr = docToMerge->entry(i); + QmVocExpression *expr = docToMerge->entry(i); expr->setLesson(expr->lesson() + lesson_offset); @@ -573,7 +573,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers expr->translation(lang).setUsageLabel (tg); } - KEduVocConjugation conj = expr->translation(lang).conjugation(); + QmVocConjugation conj = expr->translation(lang).conjugation(); bool condirty = false; for (int ci = 0; ci < conj.entryCount(); ci++) { t = conj.getType(ci); @@ -607,8 +607,8 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers move_matrix.append(docToMerge->indexOfIdentifier(identifier(i))); for (int j = 0; j < docToMerge->entryCount(); j++) { - KEduVocExpression new_expr; - KEduVocExpression *expr = docToMerge->entry(j); + QmVocExpression new_expr; + QmVocExpression *expr = docToMerge->entry(j); new_expr.setLesson(expr->lesson()+lesson_offset); for (int i = 0; i < move_matrix.count(); i++) { @@ -650,7 +650,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers new_expr.setUsageLabel(i, t2); } - KEduVocConjugation conj = expr->conjugation(lpos); + QmVocConjugation conj = expr->conjugation(lpos); for (int ci = 0; ci < conj.entryCount(); ci++) { t = conj.getType(ci); if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) { @@ -680,7 +680,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers */ } -const KEduVocIdentifier& KEduVocDocument::identifier( int index ) const +const QmVocIdentifier& QmVocDocument::identifier( int index ) const { if ( index < 0 || index >= d->m_identifiers.size() ) { qCritical() << " Error: Invalid identifier index: " << index; @@ -688,7 +688,7 @@ const KEduVocIdentifier& KEduVocDocument::identifier( int index ) const return d->m_identifiers[index]; } -KEduVocIdentifier& KEduVocDocument::identifier( int index ) +QmVocIdentifier& QmVocDocument::identifier( int index ) { if ( index < 0 || index >= d->m_identifiers.size() ) { qCritical() << " Error: Invalid identifier index: " << index; @@ -696,7 +696,7 @@ KEduVocIdentifier& KEduVocDocument::identifier( int index ) return d->m_identifiers[index]; } -void KEduVocDocument::setIdentifier( int idx, const KEduVocIdentifier &id ) +void QmVocDocument::setIdentifier( int idx, const QmVocIdentifier &id ) { if ( idx >= 0 && idx < d->m_identifiers.size() ) { d->m_identifiers[idx] = id; @@ -705,7 +705,7 @@ void KEduVocDocument::setIdentifier( int idx, const KEduVocIdentifier &id ) } // works if const is removed -int KEduVocDocument::indexOfIdentifier( const QString &name ) const +int QmVocDocument::indexOfIdentifier( const QString &name ) const { for (int i = 0; i < identifierCount(); i++) if (identifier(i).locale() == name) @@ -713,7 +713,7 @@ int KEduVocDocument::indexOfIdentifier( const QString &name ) const return -1; } -void KEduVocDocument::removeIdentifier( int index ) +void QmVocDocument::removeIdentifier( int index ) { if ( index < d->m_identifiers.size() && index >= 0 ) { d->m_identifiers.removeAt( index ); @@ -722,18 +722,18 @@ void KEduVocDocument::removeIdentifier( int index ) } -bool KEduVocDocument::isModified() const +bool QmVocDocument::isModified() const { return d->m_dirty; } -int KEduVocDocument::identifierCount() const +int QmVocDocument::identifierCount() const { return d->m_identifiers.count(); // number of translations } -int KEduVocDocument::appendIdentifier( const KEduVocIdentifier& id ) +int QmVocDocument::appendIdentifier( const QmVocIdentifier& id ) { int i = d->m_identifiers.size(); qDebug() << "appendIdentifier: " << i << id.name() << id.locale(); @@ -750,32 +750,32 @@ int KEduVocDocument::appendIdentifier( const KEduVocIdentifier& id ) return i; } -KEduVocLesson * KEduVocDocument::lesson() +QmVocLesson * QmVocDocument::lesson() { return d->m_lessonContainer; } -KEduVocWordType * KEduVocDocument::wordTypeContainer() +QmVocWordType * QmVocDocument::wordTypeContainer() { return d->m_wordTypeContainer; } -KEduVocLeitnerBox * KEduVocDocument::leitnerContainer() +QmVocLeitnerBox * QmVocDocument::leitnerContainer() { return d->m_leitnerContainer; } -KUrl KEduVocDocument::url() const +QUrl QmVocDocument::url() const { return d->m_url; } -void KEduVocDocument::setUrl( const KUrl& url ) +void QmVocDocument::setUrl( const QUrl& url ) { d->m_url = url; } -QString KEduVocDocument::title() const +QString QmVocDocument::title() const { if ( d->m_title.isEmpty() ) return d->m_url.path(); @@ -783,117 +783,117 @@ QString KEduVocDocument::title() const return d->m_title; } -void KEduVocDocument::setTitle( const QString & title ) +void QmVocDocument::setTitle( const QString & title ) { d->m_title = title; d->m_lessonContainer->setName(title); setModified(true); } -QString KEduVocDocument::author() const +QString QmVocDocument::author() const { return d->m_author; } -void KEduVocDocument::setAuthor( const QString & s ) +void QmVocDocument::setAuthor( const QString & s ) { d->m_author = s.simplified(); setModified(true); } -QString KEduVocDocument::authorContact() const +QString QmVocDocument::authorContact() const { return d->m_authorContact; } -void KEduVocDocument::setAuthorContact( const QString & s ) +void QmVocDocument::setAuthorContact( const QString & s ) { d->m_authorContact = s.simplified(); setModified(true); } -QString KEduVocDocument::license() const +QString QmVocDocument::license() const { return d->m_license; } -QString KEduVocDocument::documentComment() const +QString QmVocDocument::documentComment() const { return d->m_comment; } -void KEduVocDocument::setCategory( const QString & category ) +void QmVocDocument::setCategory( const QString & category ) { d->m_category = category; setModified(true); } -QString KEduVocDocument::category() const +QString QmVocDocument::category() const { return d->m_category; ///@todo make writer/reader use this } -void KEduVocDocument::queryIdentifier( QString &org, QString &trans ) const +void QmVocDocument::queryIdentifier( QString &org, QString &trans ) const { org = d->m_queryorg; trans = d->m_querytrans; } -void KEduVocDocument::setQueryIdentifier( const QString &org, const QString &trans ) +void QmVocDocument::setQueryIdentifier( const QString &org, const QString &trans ) { d->m_queryorg = org; d->m_querytrans = trans; setModified(true); } -void KEduVocDocument::setLicense( const QString & s ) +void QmVocDocument::setLicense( const QString & s ) { d->m_license = s.simplified(); setModified(true); } -void KEduVocDocument::setDocumentComment( const QString & s ) +void QmVocDocument::setDocumentComment( const QString & s ) { d->m_comment = s.trimmed(); setModified(true); } -void KEduVocDocument::setGenerator( const QString & generator ) +void QmVocDocument::setGenerator( const QString & generator ) { d->m_generator = generator; setModified(true); } -QString KEduVocDocument::generator() const +QString QmVocDocument::generator() const { return d->m_generator; } -QString KEduVocDocument::version() const +QString QmVocDocument::version() const { return d->m_version; } -void KEduVocDocument::setVersion( const QString & vers ) +void QmVocDocument::setVersion( const QString & vers ) { d->m_version = vers; setModified(true); } -QString KEduVocDocument::csvDelimiter() const +QString QmVocDocument::csvDelimiter() const { return d->m_csvDelimiter; } -void KEduVocDocument::setCsvDelimiter( const QString &delimiter ) +void QmVocDocument::setCsvDelimiter( const QString &delimiter ) { d->m_csvDelimiter = delimiter; setModified(true); } -QString KEduVocDocument::pattern( FileDialogMode mode ) +QString QmVocDocument::pattern( FileDialogMode mode ) { static const struct SupportedFilter { bool reading; @@ -926,7 +926,7 @@ QString KEduVocDocument::pattern( FileDialogMode mode ) return newfilters.join( "\n" ); } -QString KEduVocDocument::errorDescription( int errorCode ) +QString QmVocDocument::errorDescription( int errorCode ) { switch (errorCode) { case NoError: @@ -952,5 +952,4 @@ QString KEduVocDocument::errorDescription( int errorCode ) } } -// #include "keduvocdocument.moc" diff --git a/keduvocdocument.h b/qmvocdocument.h similarity index 86% rename from keduvocdocument.h rename to qmvocdocument.h index eae8a37..fece2a9 100644 --- a/keduvocdocument.h +++ b/qmvocdocument.h @@ -21,14 +21,14 @@ * * ***************************************************************************/ -#ifndef KEDUVOCDOCUMENT_H -#define KEDUVOCDOCUMENT_H +#ifndef QMVOCDOCUMENT_H +#define QMVOCDOCUMENT_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvocidentifier.h" -#include "keduvocarticle.h" -#include "keduvocconjugation.h" +#include "qmvocidentifier.h" +#include "qmvocarticle.h" +#include "qmvocconjugation.h" #include #include @@ -38,16 +38,16 @@ #include class QStringList; -class KEduVocExpression; -class KEduVocLesson; -class KEduVocWordType; -class KEduVocLeitnerBox; +class QmVocExpression; +class QmVocLesson; +class QmVocWordType; +class QmVocLeitnerBox; /** * This class contains the expressions of your vocabulary * as well as other information about the vocabulary */ -class KEDUVOCDOCUMENT_EXPORT KEduVocDocument : public QObject +class QMVOCDOCUMENT_EXPORT QmVocDocument : public QObject { Q_OBJECT public: @@ -97,12 +97,12 @@ public: * * @param parent calling object */ - explicit KEduVocDocument( QObject* parent = 0 ); + explicit QmVocDocument( QObject* parent = 0 ); /** * Destructor */ - ~KEduVocDocument(); + ~QmVocDocument(); // *** whole document methods *** @@ -112,7 +112,7 @@ public: * @param url url to file to open * @returns ErrorCode */ - int open( const KUrl& url ); + int open( const QUrl& url ); /** * Saves the data under the given name @@ -122,7 +122,7 @@ public: * @param generator the name of the application saving the document * @returns ErrorCode */ - int saveAs( const KUrl & url, FileType ft, const QString & generator ); + int saveAs( const QUrl & url, FileType ft, const QString & generator ); QByteArray toByteArray(const QString &generator); @@ -133,7 +133,7 @@ public: * @param matchIdentifiers if true only entries having identifiers present in the * current document will be mergedurl is empty (or NULL) actual name is preserved */ - void merge( KEduVocDocument *docToMerge, bool matchIdentifiers ); + void merge( QmVocDocument *docToMerge, bool matchIdentifiers ); /** * Indicates if the document is modified @@ -148,10 +148,10 @@ public: /** * Sets the URL of the XML file */ - void setUrl( const KUrl& url ); + void setUrl( const QUrl& url ); /** @returns the URL of the XML file */ - KUrl url() const; + QUrl url() const; /** Set the title of the file @@ -224,7 +224,7 @@ public: * @param identifier the identifier to append. If empty default names are used. * @returns the identifier number */ - int appendIdentifier( const KEduVocIdentifier & identifier = KEduVocIdentifier()); + int appendIdentifier( const QmVocIdentifier & identifier = QmVocIdentifier()); /** * Sets the identifier of translation @@ -232,7 +232,7 @@ public: * @param index number of translation 0..x * @param lang the language identifier: en=english, de=german, ... */ - void setIdentifier( int index, const KEduVocIdentifier& lang ); + void setIdentifier( int index, const QmVocIdentifier& lang ); /** * Returns the identifier of translation @p index @@ -240,12 +240,12 @@ public: * @param index number of translation 0..x * @returns the language identifier: en=english, de=german, ... */ - KEduVocIdentifier& identifier( int index ); + QmVocIdentifier& identifier( int index ); /** * Const overload of identifier(int); */ - const KEduVocIdentifier& identifier( int index ) const; + const QmVocIdentifier& identifier( int index ) const; /** * Removes identifier and the according translation in all entries @@ -287,11 +287,11 @@ public: /** Get the lesson root object * @returns a pointer to the lesson object */ - KEduVocLesson * lesson(); + QmVocLesson * lesson(); - KEduVocWordType * wordTypeContainer(); + QmVocWordType * wordTypeContainer(); - KEduVocLeitnerBox * leitnerContainer(); + QmVocLeitnerBox * leitnerContainer(); // *** file format specific methods *** @@ -325,7 +325,7 @@ public: static QString errorDescription( int errorCode ); Q_SIGNALS: - void progressChanged( KEduVocDocument *, int curr_percent ); + void progressChanged( QmVocDocument *, int curr_percent ); /** * Emitted when the document becomes modified or saved. @@ -334,12 +334,12 @@ Q_SIGNALS: void docModified( bool mod ); private: - // The private data of this - see KEduVocDocument::Private, implemented in keduvocdocument.cpp - class KEduVocDocumentPrivate; - KEduVocDocumentPrivate* const d; + // The private data of this - see QmVocDocument::Private, implemented in qmvocdocument.cpp + class QmVocDocumentPrivate; + QmVocDocumentPrivate* const d; - Q_DISABLE_COPY( KEduVocDocument ) + Q_DISABLE_COPY( QmVocDocument ) }; -#endif // KEDUVOCDOCUMENT_H +#endif // QMVOCDOCUMENT_H diff --git a/keduvocexpression.cpp b/qmvocexpression.cpp similarity index 59% rename from keduvocexpression.cpp rename to qmvocexpression.cpp index 4e59058..9c694c2 100644 --- a/keduvocexpression.cpp +++ b/qmvocexpression.cpp @@ -23,44 +23,44 @@ ***************************************************************************/ -#include "keduvocexpression.h" +#include "qmvocexpression.h" -class KEduVocExpression::KEduVocExpressionPrivate +class QmVocExpression::QmVocExpressionPrivate { public: - KEduVocExpressionPrivate() + QmVocExpressionPrivate() { m_active = true; m_lesson = 0; } - ~KEduVocExpressionPrivate(); + ~QmVocExpressionPrivate(); - KEduVocExpressionPrivate(const KEduVocExpressionPrivate &other); - KEduVocExpressionPrivate& operator= (const KEduVocExpressionPrivate &other); + QmVocExpressionPrivate(const QmVocExpressionPrivate &other); + QmVocExpressionPrivate& operator= (const QmVocExpressionPrivate &other); - bool operator== ( const KEduVocExpressionPrivate &p ) const; + bool operator== ( const QmVocExpressionPrivate &p ) const; - KEduVocLesson* m_lesson; + QmVocLesson* m_lesson; bool m_active; - QMap m_translations; + QMap m_translations; }; -KEduVocExpression::KEduVocExpressionPrivate::~KEduVocExpressionPrivate() +QmVocExpression::QmVocExpressionPrivate::~QmVocExpressionPrivate() { - QMap translations = m_translations; + QMap translations = m_translations; // empty the translations map, otherwise removal from word type will try to access them again when they don't exist any more m_translations.clear(); qDeleteAll(translations); } -KEduVocExpression::KEduVocExpressionPrivate::KEduVocExpressionPrivate(const KEduVocExpressionPrivate & other) +QmVocExpression::QmVocExpressionPrivate::QmVocExpressionPrivate(const QmVocExpressionPrivate & other) { m_active = other.m_active; m_lesson = 0; } -KEduVocExpression::KEduVocExpressionPrivate & KEduVocExpression::KEduVocExpressionPrivate::operator =(const KEduVocExpressionPrivate & other) +QmVocExpression::QmVocExpressionPrivate & QmVocExpression::QmVocExpressionPrivate::operator =(const QmVocExpressionPrivate & other) { m_active = other.m_active; m_lesson = 0; @@ -68,7 +68,7 @@ KEduVocExpression::KEduVocExpressionPrivate & KEduVocExpression::KEduVocExpressi return *this; } -bool KEduVocExpression::KEduVocExpressionPrivate::operator== ( const KEduVocExpression::KEduVocExpressionPrivate &p ) const +bool QmVocExpression::QmVocExpressionPrivate::operator== ( const QmVocExpression::QmVocExpressionPrivate &p ) const { return m_translations == p.m_translations && @@ -76,18 +76,18 @@ bool KEduVocExpression::KEduVocExpressionPrivate::operator== ( const KEduVocExpr m_active == p.m_active; } -KEduVocExpression::KEduVocExpression() - : d( new KEduVocExpressionPrivate ) +QmVocExpression::QmVocExpression() + : d( new QmVocExpressionPrivate ) {} -KEduVocExpression::KEduVocExpression( const QString & expression ) - : d( new KEduVocExpressionPrivate ) +QmVocExpression::QmVocExpression( const QString & expression ) + : d( new QmVocExpressionPrivate ) { setTranslation( 0, expression.simplified() ); } -KEduVocExpression::KEduVocExpression( const QStringList & translations) - : d( new KEduVocExpressionPrivate ) +QmVocExpression::QmVocExpression( const QStringList & translations) + : d( new QmVocExpressionPrivate ) { foreach ( const QString &translation, translations ) { setTranslation(d->m_translations.count(), translation); @@ -95,32 +95,32 @@ KEduVocExpression::KEduVocExpression( const QStringList & translations) } -KEduVocExpression::KEduVocExpression(const KEduVocExpression & other) - : d(new KEduVocExpressionPrivate(*other.d)) +QmVocExpression::QmVocExpression(const QmVocExpression & other) + : d(new QmVocExpressionPrivate(*other.d)) { foreach (int key, other.d->m_translations.keys()) { - d->m_translations[key] = new KEduVocTranslation(*other.d->m_translations.value(key)); + d->m_translations[key] = new QmVocTranslation(*other.d->m_translations.value(key)); d->m_translations[key]->setEntry(this); } } -KEduVocExpression& KEduVocExpression::operator= ( const KEduVocExpression &other ) +QmVocExpression& QmVocExpression::operator= ( const QmVocExpression &other ) { *d = *other.d; foreach (int key, other.d->m_translations.keys()) { - d->m_translations[key] = new KEduVocTranslation(*other.d->m_translations.value(key)); + d->m_translations[key] = new QmVocTranslation(*other.d->m_translations.value(key)); d->m_translations[key]->setEntry(this); } return *this; } -KEduVocExpression::~KEduVocExpression() +QmVocExpression::~QmVocExpression() { setLesson(0); delete d; } -void KEduVocExpression::removeTranslation( int index ) +void QmVocExpression::removeTranslation( int index ) { int count = d->m_translations.count(); @@ -134,41 +134,41 @@ void KEduVocExpression::removeTranslation( int index ) } -void KEduVocExpression::setTranslation( int index, const QString & expr ) +void QmVocExpression::setTranslation( int index, const QString & expr ) { if ( index < 0 ) { return; } if (!d->m_translations.contains(index)) { - d->m_translations[index] = new KEduVocTranslation(this); + d->m_translations[index] = new QmVocTranslation(this); } d->m_translations[index]->setText(expr.simplified()); } -KEduVocLesson* KEduVocExpression::lesson() const +QmVocLesson* QmVocExpression::lesson() const { return d->m_lesson; } -bool KEduVocExpression::isActive() const +bool QmVocExpression::isActive() const { return d->m_active; } -void KEduVocExpression::setActive( bool flag ) +void QmVocExpression::setActive( bool flag ) { d->m_active = flag; } -void KEduVocExpression::resetGrades( int index ) +void QmVocExpression::resetGrades( int index ) { if ( index == -1 ) { // clear grades for all languages - foreach( KEduVocTranslation* trans, d->m_translations ) { + foreach( QmVocTranslation* trans, d->m_translations ) { trans->resetGrades(); } return; @@ -180,21 +180,21 @@ void KEduVocExpression::resetGrades( int index ) } } -bool KEduVocExpression::operator== ( const KEduVocExpression &expression ) const +bool QmVocExpression::operator== ( const QmVocExpression &expression ) const { return ( *d == *expression.d ); } -KEduVocTranslation* KEduVocExpression::translation( int index ) +QmVocTranslation* QmVocExpression::translation( int index ) { if(translationIndices().contains(index)) { return d->m_translations[index]; } - d->m_translations[index] = new KEduVocTranslation(this); + d->m_translations[index] = new QmVocTranslation(this); return d->m_translations[index]; } -KEduVocTranslation * KEduVocExpression::translation(int index) const +QmVocTranslation * QmVocExpression::translation(int index) const { if(d->m_translations.contains(index)) { return 0; @@ -202,12 +202,12 @@ KEduVocTranslation * KEduVocExpression::translation(int index) const return d->m_translations[index]; } -QList< int > KEduVocExpression::translationIndices() const +QList< int > QmVocExpression::translationIndices() const { return d->m_translations.keys(); } -void KEduVocExpression::setLesson(KEduVocLesson * l) +void QmVocExpression::setLesson(QmVocLesson * l) { if (d->m_lesson) { d->m_lesson->removeEntry(this); diff --git a/keduvocexpression.h b/qmvocexpression.h similarity index 75% rename from keduvocexpression.h rename to qmvocexpression.h index a2f1e51..bb4df64 100644 --- a/keduvocexpression.h +++ b/qmvocexpression.h @@ -22,39 +22,39 @@ * * ***************************************************************************/ -#ifndef KEDUVOCEXPRESSION_H -#define KEDUVOCEXPRESSION_H +#ifndef QMVOCEXPRESSION_H +#define QMVOCEXPRESSION_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" #include #include -#include "keduvoclesson.h" -#include "keduvocarticle.h" -#include "keduvocmultiplechoice.h" -#include "keduvoctranslation.h" +#include "qmvoclesson.h" +#include "qmvocarticle.h" +#include "qmvocmultiplechoice.h" +#include "qmvoctranslation.h" -class KEduVocLesson; +class QmVocLesson; /** This class contains one vocabulary expression as an original with one or more translations */ -class KEDUVOCDOCUMENT_EXPORT KEduVocExpression +class QMVOCDOCUMENT_EXPORT QmVocExpression { public: /** default constructor for an empty vocabulary expression */ - explicit KEduVocExpression(); + explicit QmVocExpression(); /** Constructor for a vocabulary expression with one translation * * @param expression translation * @param lesson lesson number */ - explicit KEduVocExpression( const QString & expression ); + explicit QmVocExpression( const QString & expression ); /** Constructor for a vocabulary expression with an original and one or more translations * @@ -62,15 +62,15 @@ public: * @param separator expression will be split into an original and one or more translations using separator * @param lesson lesson number, 0 for none */ - explicit KEduVocExpression( const QStringList & translations ); + explicit QmVocExpression( const QStringList & translations ); - KEduVocExpression(const KEduVocExpression& other); + QmVocExpression(const QmVocExpression& other); - ~KEduVocExpression(); + ~QmVocExpression(); /** return the lesson */ - KEduVocLesson * lesson() const; + QmVocLesson * lesson() const; /** reset all grades of the entry @@ -89,7 +89,7 @@ public: int sizeHint() const; void setSizeHint( int sizeHint ); - void setTranslation( int index, KEduVocTranslation* translation ); + void setTranslation( int index, QmVocTranslation* translation ); /** * Add a translation to this expression * @param index number of translation = the identifier @@ -108,23 +108,23 @@ public: * @param index of the language identifier * @return the translation */ - KEduVocTranslation* translation( int index ); - KEduVocTranslation* translation( int index ) const; + QmVocTranslation* translation( int index ); + QmVocTranslation* translation( int index ) const; QList translationIndices() const; - KEduVocExpression& operator= ( const KEduVocExpression &expression ); - bool operator== ( const KEduVocExpression &expression ) const; + QmVocExpression& operator= ( const QmVocExpression &expression ); + bool operator== ( const QmVocExpression &expression ) const; private: - class KEduVocExpressionPrivate; - KEduVocExpressionPrivate* const d; + class QmVocExpressionPrivate; + QmVocExpressionPrivate* const d; /** only called by lesson to add itself to the lesson list */ - void setLesson( KEduVocLesson * l ); + void setLesson( QmVocLesson * l ); - friend class KEduVocLesson; + friend class QmVocLesson; }; -#endif // KEduVocExpression_H +#endif // QMVOCEXPRESSION_H diff --git a/keduvocidentifier.cpp b/qmvocidentifier.cpp similarity index 73% rename from keduvocidentifier.cpp rename to qmvocidentifier.cpp index 73f228f..ccb9575 100644 --- a/keduvocidentifier.cpp +++ b/qmvocidentifier.cpp @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2007-2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -14,9 +15,9 @@ * (at your option) any later version. * * * ***************************************************************************/ -#include "keduvocidentifier.h" +#include "qmvocidentifier.h" -class KEduVocIdentifier::Private +class QmVocIdentifier::Private { public: /// the name: English, Anatomy, Fruit salad @@ -34,29 +35,29 @@ public: QString m_type; /** I, you, he, she, it... */ - KEduVocPersonalPronoun m_personalPronouns; + QmVocPersonalPronoun m_personalPronouns; /** the for english ;) der, die, das ... in german */ - KEduVocArticle m_articles; + QmVocArticle m_articles; /** Future, present and past... and many more */ QStringList m_tenses; }; -KEduVocIdentifier::KEduVocIdentifier() +QmVocIdentifier::QmVocIdentifier() : d( new Private ) { ///@todo maybe the user locale would be more appropriate d->m_locale = "en"; } -KEduVocIdentifier::~KEduVocIdentifier() +QmVocIdentifier::~QmVocIdentifier() { delete d; } -KEduVocIdentifier::KEduVocIdentifier( const KEduVocIdentifier &other ) +QmVocIdentifier::QmVocIdentifier( const QmVocIdentifier &other ) : d( new Private( *other.d ) ) { #if 0 @@ -70,7 +71,7 @@ KEduVocIdentifier::KEduVocIdentifier( const KEduVocIdentifier &other ) #endif } -KEduVocIdentifier& KEduVocIdentifier::operator= ( const KEduVocIdentifier &other ) +QmVocIdentifier& QmVocIdentifier::operator= ( const QmVocIdentifier &other ) { d->m_locale = other.d->m_locale; d->m_name = other.d->m_name; @@ -82,53 +83,53 @@ KEduVocIdentifier& KEduVocIdentifier::operator= ( const KEduVocIdentifier &other return *this; } -QString KEduVocIdentifier::name() const +QString QmVocIdentifier::name() const { return d->m_name; } -void KEduVocIdentifier::setName(const QString & name) +void QmVocIdentifier::setName(const QString & name) { d->m_name = name; } -QString KEduVocIdentifier::locale() const +QString QmVocIdentifier::locale() const { return d->m_locale; } -void KEduVocIdentifier::setLocale(const QString & locale) +void QmVocIdentifier::setLocale(const QString & locale) { d->m_locale = locale; } -void KEduVocIdentifier::setArticle( const KEduVocArticle& articles ) +void QmVocIdentifier::setArticle( const QmVocArticle& articles ) { d->m_articles = articles; } -KEduVocArticle& KEduVocIdentifier::article() const +QmVocArticle& QmVocIdentifier::article() const { return d->m_articles; } -KEduVocPersonalPronoun& KEduVocIdentifier::personalPronouns() const +QmVocPersonalPronoun& QmVocIdentifier::personalPronouns() const { return d->m_personalPronouns; } -void KEduVocIdentifier::setPersonalPronouns( const KEduVocPersonalPronoun & pronouns ) +void QmVocIdentifier::setPersonalPronouns( const QmVocPersonalPronoun & pronouns ) { d->m_personalPronouns = pronouns; } -QString KEduVocIdentifier::tense(int tenseIndex) const +QString QmVocIdentifier::tense(int tenseIndex) const { Q_ASSERT(d->m_tenses.size() > tenseIndex); return d->m_tenses.value(tenseIndex); } -void KEduVocIdentifier::setTense(int tenseIndex, const QString& tense) +void QmVocIdentifier::setTense(int tenseIndex, const QString& tense) { Q_ASSERT(d->m_tenses.size() >= tenseIndex); if (tenseIndex == d->m_tenses.size()) { @@ -138,12 +139,12 @@ void KEduVocIdentifier::setTense(int tenseIndex, const QString& tense) } } -QStringList KEduVocIdentifier::tenseList() const +QStringList QmVocIdentifier::tenseList() const { return d->m_tenses; } -void KEduVocIdentifier::setTenseList(const QStringList& tenses) +void QmVocIdentifier::setTenseList(const QStringList& tenses) { d->m_tenses = tenses; } diff --git a/keduvocidentifier.h b/qmvocidentifier.h similarity index 77% rename from keduvocidentifier.h rename to qmvocidentifier.h index 9a35c58..c548f10 100644 --- a/keduvocidentifier.h +++ b/qmvocidentifier.h @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2007-2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -14,13 +15,13 @@ * (at your option) any later version. * * * ***************************************************************************/ -#ifndef KEDUVOCIDENTIFIER_H -#define KEDUVOCIDENTIFIER_H +#ifndef QMVOCIDENTIFIER_H +#define QMVOCIDENTIFIER_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvocpersonalpronoun.h" -#include "keduvocarticle.h" +#include "qmvocpersonalpronoun.h" +#include "qmvocarticle.h" #include #include @@ -30,31 +31,31 @@ /** Class to store meta information about a language or any other category in the vocabulary. */ -class KEDUVOCDOCUMENT_EXPORT KEduVocIdentifier +class QMVOCDOCUMENT_EXPORT QmVocIdentifier { public: /** * Default ctor. */ - explicit KEduVocIdentifier(); + explicit QmVocIdentifier(); /** * Copy ctor. * @param other */ - KEduVocIdentifier( const KEduVocIdentifier &other ); + QmVocIdentifier( const QmVocIdentifier &other ); /** * dtor */ - ~KEduVocIdentifier(); + ~QmVocIdentifier(); /** * assignment operator * @param other * @return */ - KEduVocIdentifier& operator= ( const KEduVocIdentifier &other ); + QmVocIdentifier& operator= ( const QmVocIdentifier &other ); public: /** @@ -83,25 +84,25 @@ public: * Articles (a, the in English, el, la,... in Spanish) * @returns articles */ - KEduVocArticle& article() const; + QmVocArticle& article() const; /** * Sets the articles for this identifier * @param art article block */ - void setArticle( const KEduVocArticle& article ); + void setArticle( const QmVocArticle& article ); /** * Get the personal pronouns for this identifier - * @returns a KEduVocPersonalPronoun containing the personal pronouns + * @returns a QmVocPersonalPronoun containing the personal pronouns */ - KEduVocPersonalPronoun& personalPronouns() const; + QmVocPersonalPronoun& personalPronouns() const; /** * Sets personal pronouns - * @param pronouns a KEduVocConjugation containing the personal pronouns + * @param pronouns a QmVocConjugation containing the personal pronouns */ - void setPersonalPronouns( const KEduVocPersonalPronoun &pronouns ); + void setPersonalPronouns( const QmVocPersonalPronoun &pronouns ); /** * Returns the name of tense number @p tenseIndex diff --git a/keduvockvtml2reader.cpp b/qmvockvtml2reader.cpp similarity index 80% rename from keduvockvtml2reader.cpp rename to qmvockvtml2reader.cpp index b8b7456..bacafe9 100644 --- a/keduvockvtml2reader.cpp +++ b/qmvockvtml2reader.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - read a KEduVocDocument from a KVTML file + read a QmVocDocument from a KVTML file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold @@ -23,7 +23,7 @@ * * ***************************************************************************/ -#include "keduvockvtml2reader.h" +#include "qmvockvtml2reader.h" #include #include @@ -33,33 +33,33 @@ // #include -#include "keduvocdocument.h" -#include "keduvoclesson.h" -#include "keduvocleitnerbox.h" -#include "keduvocwordtype.h" +#include "qmvocdocument.h" +#include "qmvoclesson.h" +#include "qmvocleitnerbox.h" +#include "qmvocwordtype.h" #include "kvtml2defs.h" -#include "keduvockvtmlreader.h" -#include "keduvoccommon_p.h" +#include "qmvockvtmlreader.h" +#include "qmvoccommon_p.h" // #include -KEduVocKvtml2Reader::KEduVocKvtml2Reader( QFile *file ) +QmVocKvtml2Reader::QmVocKvtml2Reader( QFile *file ) : m_inputFile( file ) { // the file must be already open if ( !m_inputFile->isOpen() ) { m_errorMessage = "file must be opened first" ; } - qDebug("KEduVocKvtml2Reader constructor"); + qDebug("QmVocKvtml2Reader constructor"); } -bool KEduVocKvtml2Reader::readDoc( KEduVocDocument *doc ) +bool QmVocKvtml2Reader::readDoc( QmVocDocument *doc ) { - qDebug("KEduVocKvtml2Reader::readDoc"); + qDebug("QmVocKvtml2Reader::readDoc"); m_doc = doc; - QDomDocument domDoc( "KEduVocDocument" ); + QDomDocument domDoc( "QmVocDocument" ); if ( !domDoc.setContent( m_inputFile, &m_errorMessage ) ) return false; @@ -75,7 +75,7 @@ bool KEduVocKvtml2Reader::readDoc( KEduVocDocument *doc ) // first reset the file to the beginning m_inputFile->seek( 0 ); - KEduVocKvtmlReader oldFormat( m_inputFile ); + QmVocKvtmlReader oldFormat( m_inputFile ); // get the return value bool retval = oldFormat.readDoc( doc ); @@ -100,7 +100,7 @@ bool KEduVocKvtml2Reader::readDoc( KEduVocDocument *doc ) return result; } -bool KEduVocKvtml2Reader::readInformation( QDomElement &informationElement ) +bool QmVocKvtml2Reader::readInformation( QDomElement &informationElement ) { // read the generator QDomElement currentElement = informationElement.firstChildElement( KVTML_GENERATOR ); @@ -151,7 +151,7 @@ bool KEduVocKvtml2Reader::readInformation( QDomElement &informationElement ) return true; } -bool KEduVocKvtml2Reader::readGroups( QDomElement &domElementParent ) +bool QmVocKvtml2Reader::readGroups( QDomElement &domElementParent ) { bool result = false; @@ -220,10 +220,10 @@ bool KEduVocKvtml2Reader::readGroups( QDomElement &domElementParent ) } // Additional cleanup: Put orphaned entries without a lesson into a default lesson. - KEduVocLesson *defaultLesson = new KEduVocLesson("Default Lesson", m_doc->lesson()); + QmVocLesson *defaultLesson = new QmVocLesson("Default Lesson", m_doc->lesson()); // now make sure we don't have any orphan entries - foreach (KEduVocExpression * entry, m_allEntries) { + foreach (QmVocExpression * entry, m_allEntries) { if (!entry->lesson()) { defaultLesson->appendEntry(entry); @@ -241,7 +241,7 @@ bool KEduVocKvtml2Reader::readGroups( QDomElement &domElementParent ) } -bool KEduVocKvtml2Reader::readIdentifier( QDomElement &identifierElement ) +bool QmVocKvtml2Reader::readIdentifier( QDomElement &identifierElement ) { bool result = true; int id = identifierElement.attribute( KVTML_ID ).toInt( &result ); @@ -252,7 +252,7 @@ bool KEduVocKvtml2Reader::readIdentifier( QDomElement &identifierElement ) // generate empty identifiers in the doc for ( int i = m_doc->identifierCount(); i <= id; i++ ) { - m_doc->appendIdentifier( KEduVocIdentifier() ); + m_doc->appendIdentifier( QmVocIdentifier() ); } // the first element, create the identifier, even if empty @@ -275,7 +275,7 @@ bool KEduVocKvtml2Reader::readIdentifier( QDomElement &identifierElement ) currentElement = identifierElement.firstChildElement( KVTML_PERSONALPRONOUNS ); if ( !currentElement.isNull() ) { - KEduVocPersonalPronoun personalPronoun; + QmVocPersonalPronoun personalPronoun; readPersonalPronoun( currentElement, personalPronoun ); m_doc->identifier(id).setPersonalPronouns( personalPronoun ); } @@ -287,7 +287,7 @@ bool KEduVocKvtml2Reader::readIdentifier( QDomElement &identifierElement ) return result; } -bool KEduVocKvtml2Reader::readEntry( QDomElement &entryElement ) +bool QmVocKvtml2Reader::readEntry( QDomElement &entryElement ) { QDomElement currentElement; bool result = true; @@ -299,7 +299,7 @@ bool KEduVocKvtml2Reader::readEntry( QDomElement &entryElement ) return false; } - KEduVocExpression *expr = new KEduVocExpression; + QmVocExpression *expr = new QmVocExpression; // read info tags: inactive, inquery, and sizehint currentElement = entryElement.firstChildElement( KVTML_DEACTIVATED ); @@ -337,8 +337,8 @@ bool KEduVocKvtml2Reader::readEntry( QDomElement &entryElement ) return result; } -bool KEduVocKvtml2Reader::readTranslation( QDomElement &translationElement, - KEduVocExpression *expr, int index ) +bool QmVocKvtml2Reader::readTranslation( QDomElement &translationElement, + QmVocExpression *expr, int index ) { // read the text, grade, declension and conjugation expr->translation(index)->fromKVTML2(translationElement); @@ -347,7 +347,7 @@ bool KEduVocKvtml2Reader::readTranslation( QDomElement &translationElement, // article grade currentElement = translationElement.firstChildElement( KVTML_ARTICLE ); if ( !currentElement.isNull() ) { - KEduVocText article; + QmVocText article; article.fromKVTML2(currentElement); expr->translation(index)->setArticle(article); } @@ -381,7 +381,7 @@ bool KEduVocKvtml2Reader::readTranslation( QDomElement &translationElement, return true; } -bool KEduVocKvtml2Reader::readChildLessons( KEduVocLesson* parentLesson, QDomElement &lessonElement ) +bool QmVocKvtml2Reader::readChildLessons( QmVocLesson* parentLesson, QDomElement &lessonElement ) { QDomElement currentElement = lessonElement.firstChildElement( KVTML_CONTAINER ); while ( !currentElement.isNull() ) { @@ -391,11 +391,11 @@ bool KEduVocKvtml2Reader::readChildLessons( KEduVocLesson* parentLesson, QDomEle return true; } -bool KEduVocKvtml2Reader::readLesson( KEduVocLesson* parentLesson, QDomElement &lessonElement ) +bool QmVocKvtml2Reader::readLesson( QmVocLesson* parentLesson, QDomElement &lessonElement ) { //Lesson name QDomElement currentElement = lessonElement.firstChildElement( KVTML_NAME ); - KEduVocLesson * lesson = new KEduVocLesson(currentElement.text(), parentLesson); + QmVocLesson * lesson = new QmVocLesson(currentElement.text(), parentLesson); parentLesson->appendChildContainer( lesson ); readChildLessons( lesson, lessonElement ); @@ -419,18 +419,18 @@ bool KEduVocKvtml2Reader::readLesson( KEduVocLesson* parentLesson, QDomElement & return true; } -bool KEduVocKvtml2Reader::readSynonymsAntonymsFalseFriends( QDomElement &rootElement ) +bool QmVocKvtml2Reader::readSynonymsAntonymsFalseFriends( QDomElement &rootElement ) { QDomElement pairElement; - for(int type = KEduVocTranslation::Synonym; type <= KEduVocTranslation::FalseFriend; type++) { + for(int type = QmVocTranslation::Synonym; type <= QmVocTranslation::FalseFriend; type++) { switch (type) { - case KEduVocTranslation::Synonym: + case QmVocTranslation::Synonym: pairElement= rootElement.firstChildElement( KVTML_SYNONYM ); break; - case KEduVocTranslation::Antonym: + case QmVocTranslation::Antonym: pairElement= rootElement.firstChildElement( KVTML_ANTONYM ); break; - case KEduVocTranslation::FalseFriend: + case QmVocTranslation::FalseFriend: pairElement= rootElement.firstChildElement( KVTML_FALSEFRIEND ); break; } @@ -451,19 +451,19 @@ bool KEduVocKvtml2Reader::readSynonymsAntonymsFalseFriends( QDomElement &rootEle int secondTranslationId = translationElement.attribute( KVTML_ID ).toInt(); // pair them up - KEduVocTranslation *first = m_allEntries[firstEntryId]->translation(firstTranslationId); - KEduVocTranslation *second = m_allEntries[secondEntryId]->translation(secondTranslationId); + QmVocTranslation *first = m_allEntries[firstEntryId]->translation(firstTranslationId); + QmVocTranslation *second = m_allEntries[secondEntryId]->translation(secondTranslationId); switch (type) { - case KEduVocTranslation::Synonym: + case QmVocTranslation::Synonym: first->addSynonym(second); second->addSynonym(first); break; - case KEduVocTranslation::Antonym: + case QmVocTranslation::Antonym: first->addAntonym(second); second->addAntonym(first); break; - case KEduVocTranslation::FalseFriend: + case QmVocTranslation::FalseFriend: first->addFalseFriend(second); second->addFalseFriend(first); break; @@ -474,7 +474,7 @@ bool KEduVocKvtml2Reader::readSynonymsAntonymsFalseFriends( QDomElement &rootEle return true; } -bool KEduVocKvtml2Reader::readArticle( QDomElement &articleElement, int identifierNum ) +bool QmVocKvtml2Reader::readArticle( QDomElement &articleElement, int identifierNum ) /*
@@ -494,17 +494,17 @@ bool KEduVocKvtml2Reader::readArticle( QDomElement &articleElement, int identifi
*/ { - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; - QMap genders; - genders[0] = KEduVocWordFlag::Masculine; - genders[1] = KEduVocWordFlag::Feminine; - genders[2] = KEduVocWordFlag::Neuter; - QMap defs; - defs[0] = KEduVocWordFlag::Definite; - defs[1] = KEduVocWordFlag::Indefinite; + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; + QMap genders; + genders[0] = QmVocWordFlag::Masculine; + genders[1] = QmVocWordFlag::Feminine; + genders[2] = QmVocWordFlag::Neuter; + QMap defs; + defs[0] = QmVocWordFlag::Definite; + defs[1] = QmVocWordFlag::Indefinite; for ( int num = 0; num <= 2; ++num) { QDomElement numberElement = articleElement.firstChildElement( KVTML_GRAMMATICAL_NUMBER[num] ); @@ -529,7 +529,7 @@ bool KEduVocKvtml2Reader::readArticle( QDomElement &articleElement, int identifi } -bool KEduVocKvtml2Reader::readChildWordTypes(KEduVocWordType* parentContainer, QDomElement &lessonElement) +bool QmVocKvtml2Reader::readChildWordTypes(QmVocWordType* parentContainer, QDomElement &lessonElement) { QDomElement currentElement = lessonElement.firstChildElement( KVTML_CONTAINER ); while ( !currentElement.isNull() ) { @@ -539,13 +539,13 @@ bool KEduVocKvtml2Reader::readChildWordTypes(KEduVocWordType* parentContainer, Q return true; } -bool KEduVocKvtml2Reader::readLeitner( KEduVocLeitnerBox* parentContainer, QDomElement &leitnerParentElement ) +bool QmVocKvtml2Reader::readLeitner( QmVocLeitnerBox* parentContainer, QDomElement &leitnerParentElement ) { QDomElement leitnerElement = leitnerParentElement.firstChildElement( KVTML_CONTAINER ); while ( !leitnerElement.isNull() ) { QString name = leitnerElement.firstChildElement( KVTML_NAME ).text(); - KEduVocLeitnerBox * leitner = new KEduVocLeitnerBox(name, parentContainer); + QmVocLeitnerBox * leitner = new QmVocLeitnerBox(name, parentContainer); parentContainer->appendChildContainer(leitner); // for leitner we only allow a flat list, no sub boxes. @@ -568,41 +568,41 @@ bool KEduVocKvtml2Reader::readLeitner( KEduVocLeitnerBox* parentContainer, QDomE return true; } -bool KEduVocKvtml2Reader::readWordType( KEduVocWordType* parentContainer, QDomElement &typeElement ) +bool QmVocKvtml2Reader::readWordType( QmVocWordType* parentContainer, QDomElement &typeElement ) { // set type and specialtype QString typeName = typeElement.firstChildElement( KVTML_NAME ).text(); - KEduVocWordType * wordTypeContainer = new KEduVocWordType(typeName, parentContainer); + QmVocWordType * wordTypeContainer = new QmVocWordType(typeName, parentContainer); parentContainer->appendChildContainer(wordTypeContainer); QString specialType = typeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text(); if ( !specialType.isEmpty() ) { // get the localized version if ( specialType == KVTML_SPECIALWORDTYPE_NOUN ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Noun); + wordTypeContainer->setWordType(QmVocWordFlag::Noun); } if ( specialType == KVTML_SPECIALWORDTYPE_VERB ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Verb); + wordTypeContainer->setWordType(QmVocWordFlag::Verb); } if ( specialType == KVTML_SPECIALWORDTYPE_ADVERB ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Adverb); + wordTypeContainer->setWordType(QmVocWordFlag::Adverb); } if ( specialType == KVTML_SPECIALWORDTYPE_ADJECTIVE ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Adjective); + wordTypeContainer->setWordType(QmVocWordFlag::Adjective); } if ( specialType == KVTML_SPECIALWORDTYPE_NOUN_MALE ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Noun | KEduVocWordFlag::Masculine); + wordTypeContainer->setWordType(QmVocWordFlag::Noun | QmVocWordFlag::Masculine); } if ( specialType == KVTML_SPECIALWORDTYPE_NOUN_FEMALE ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Noun | KEduVocWordFlag::Feminine); + wordTypeContainer->setWordType(QmVocWordFlag::Noun | QmVocWordFlag::Feminine); } if ( specialType == KVTML_SPECIALWORDTYPE_NOUN_NEUTRAL ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Noun| KEduVocWordFlag::Neuter); + wordTypeContainer->setWordType(QmVocWordFlag::Noun| QmVocWordFlag::Neuter); } if ( specialType == KVTML_SPECIALWORDTYPE_CONJUNCTION ) { - wordTypeContainer->setWordType(KEduVocWordFlag::Conjunction); + wordTypeContainer->setWordType(QmVocWordFlag::Conjunction); } } // special type @@ -626,7 +626,7 @@ bool KEduVocKvtml2Reader::readWordType( KEduVocWordType* parentContainer, QDomEl return true; } -QStringList KEduVocKvtml2Reader::readTenses( QDomElement &tensesElement ) +QStringList QmVocKvtml2Reader::readTenses( QDomElement &tensesElement ) { QStringList tenses; @@ -641,7 +641,7 @@ QStringList KEduVocKvtml2Reader::readTenses( QDomElement &tensesElement ) return tenses; } -bool KEduVocKvtml2Reader::readComparison( QDomElement &domElementParent, KEduVocTranslation* translation ) +bool QmVocKvtml2Reader::readComparison( QDomElement &domElementParent, QmVocTranslation* translation ) /* better @@ -654,7 +654,7 @@ bool KEduVocKvtml2Reader::readComparison( QDomElement &domElementParent, KEduVoc currentElement = domElementParent.firstChildElement( KVTML_COMPARATIVE ); if ( !currentElement.isNull() ) { - KEduVocText comparative; + QmVocText comparative; comparative.fromKVTML2(currentElement); // be compatible for KDE < 4.5 @@ -667,7 +667,7 @@ bool KEduVocKvtml2Reader::readComparison( QDomElement &domElementParent, KEduVoc currentElement = domElementParent.firstChildElement( KVTML_SUPERLATIVE ); if ( !currentElement.isNull() ) { - KEduVocText superlative; + QmVocText superlative; superlative.fromKVTML2(currentElement); // be compatible for KDE < 4.5 @@ -679,7 +679,7 @@ bool KEduVocKvtml2Reader::readComparison( QDomElement &domElementParent, KEduVoc return true; } -bool KEduVocKvtml2Reader::readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation ) +bool QmVocKvtml2Reader::readMultipleChoice( QDomElement &multipleChoiceElement, QmVocTranslation* translation ) /* good @@ -703,7 +703,7 @@ bool KEduVocKvtml2Reader::readMultipleChoice( QDomElement &multipleChoiceElement } -bool KEduVocKvtml2Reader::readPersonalPronoun(QDomElement & pronounElement, KEduVocPersonalPronoun & pronoun) +bool QmVocKvtml2Reader::readPersonalPronoun(QDomElement & pronounElement, QmVocPersonalPronoun & pronoun) { pronoun.setMaleFemaleDifferent(!pronounElement.firstChildElement( KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT).isNull()); @@ -714,30 +714,30 @@ bool KEduVocKvtml2Reader::readPersonalPronoun(QDomElement & pronounElement, KEdu QDomElement personElement = pronounElement.firstChildElement( KVTML_GRAMMATICAL_NUMBER[0] ); if ( !personElement.isNull() ) { - readPersonalPronounChild( personElement, pronoun, KEduVocWordFlag::Singular ); + readPersonalPronounChild( personElement, pronoun, QmVocWordFlag::Singular ); } personElement = pronounElement.firstChildElement( KVTML_GRAMMATICAL_NUMBER[1] ); if ( !personElement.isNull() ) { - readPersonalPronounChild( personElement, pronoun, KEduVocWordFlag::Dual ); + readPersonalPronounChild( personElement, pronoun, QmVocWordFlag::Dual ); } personElement = pronounElement.firstChildElement( KVTML_GRAMMATICAL_NUMBER[2] ); if ( !personElement.isNull() ) { - readPersonalPronounChild( personElement, pronoun, KEduVocWordFlag::Plural ); + readPersonalPronounChild( personElement, pronoun, QmVocWordFlag::Plural ); } return true; } -bool KEduVocKvtml2Reader::readPersonalPronounChild(QDomElement & personElement, KEduVocPersonalPronoun & pronoun, KEduVocWordFlags number) +bool QmVocKvtml2Reader::readPersonalPronounChild(QDomElement & personElement, QmVocPersonalPronoun & pronoun, QmVocWordFlags number) { - QMap persons; - persons[0] = KEduVocWordFlag::First; - persons[1] = KEduVocWordFlag::Second; - persons[2] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Masculine); - persons[3] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Feminine); - persons[4] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Neuter); + QMap persons; + persons[0] = QmVocWordFlag::First; + persons[1] = QmVocWordFlag::Second; + persons[2] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Masculine); + persons[3] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Feminine); + persons[4] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Neuter); @@ -750,4 +750,3 @@ bool KEduVocKvtml2Reader::readPersonalPronounChild(QDomElement & personElement, } -// #include "keduvockvtml2reader.moc" diff --git a/keduvockvtml2reader.h b/qmvockvtml2reader.h similarity index 74% rename from keduvockvtml2reader.h rename to qmvockvtml2reader.h index e13a6f8..d2013f4 100644 --- a/keduvockvtml2reader.h +++ b/qmvockvtml2reader.h @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - read a KEduVocDocument from a KVTML2 file + read a QmVocDocument from a KVTML2 file ----------------------------------------------------------------------- copyright : (C) 2007 Jeremy Whiting Copyright 2007-2008 Frederik Gladhorn @@ -20,39 +20,39 @@ * * ***************************************************************************/ -#ifndef KEDUVOCKVTML2READER_H -#define KEDUVOCKVTML2READER_H +#ifndef QMVOCKVTML2READER_H +#define QMVOCKVTML2READER_H #include #include #include -#include "keduvocexpression.h" -#include "keduvocpersonalpronoun.h" -#include "keduvocarticle.h" -#include "keduvocmultiplechoice.h" +#include "qmvocexpression.h" +#include "qmvocpersonalpronoun.h" +#include "qmvocarticle.h" +#include "qmvocmultiplechoice.h" class QIODevice; -class KEduVocDocument; -class KEduVocWordType; +class QmVocDocument; +class QmVocWordType; /** -* @brief class to read kvtml2 data files into keduvocdocument +* @brief class to read kvtml2 data files into qmvocdocument * @author Jeremy Whiting */ -class KEduVocKvtml2Reader : public QObject +class QmVocKvtml2Reader : public QObject { Q_OBJECT public: /** default constructor * @param file file to read from */ - KEduVocKvtml2Reader( QFile *file ); + QmVocKvtml2Reader( QFile *file ); /** read the document * @param doc document object to store the data in */ - bool readDoc( KEduVocDocument *doc ); + bool readDoc( QmVocDocument *doc ); /** get the errormessage string * @returns the errormessage string @@ -82,25 +82,25 @@ private: */ bool readArticle( QDomElement &articleElement, int identifierNum ); - bool readPersonalPronoun( QDomElement &conjugElement, KEduVocPersonalPronoun &pronoun ); + bool readPersonalPronoun( QDomElement &conjugElement, QmVocPersonalPronoun &pronoun ); - bool readPersonalPronounChild(QDomElement & personElement, KEduVocPersonalPronoun &pronoun, KEduVocWordFlags flags); + bool readPersonalPronounChild(QDomElement & personElement, QmVocPersonalPronoun &pronoun, QmVocWordFlags flags); /** read the types * @param typesElement QDomElement for the types group */ - bool readWordType( KEduVocWordType* parentContainer, QDomElement &typesElement ); + bool readWordType( QmVocWordType* parentContainer, QDomElement &typesElement ); /** * Read a leitner box container. * This is a grading system where the vocabulary are kept in boxes and promoted/demoted during the learning. * Be aware that leitner boxes are a list only and no sub boxes will ever be read or written. - * While reusing the lesson class is quite easy for this a proper subclass of KEduVocContainer would be the better solution. + * While reusing the lesson class is quite easy for this a proper subclass of QmVocContainer would be the better solution. * @param parentContainer the parent to append the new leitner container to * @param leitnerElement the element in the dom * @return success */ - bool readLeitner( KEduVocLeitnerBox* parentContainer, QDomElement &leitnerElement ); + bool readLeitner( QmVocLeitnerBox* parentContainer, QDomElement &leitnerElement ); /** * Read all tags within a word type definition. @@ -108,7 +108,7 @@ private: * @param lessonElement * @return */ - bool readChildWordTypes( KEduVocWordType* parentContainer, QDomElement &lessonElement ); + bool readChildWordTypes( QmVocWordType* parentContainer, QDomElement &lessonElement ); /** read the tenses * @param tensesElement QDomElement for the tenses group @@ -128,19 +128,19 @@ private: /** read a translation * @param translationElement QDomElement for the translation to read */ - bool readTranslation( QDomElement &translationElement, KEduVocExpression *expr, int index ); + bool readTranslation( QDomElement &translationElement, QmVocExpression *expr, int index ); /** read a comparison * @param comparisonElement comparison group element * @param comp comparison object to read into */ - bool readComparison( QDomElement &comparisonElement, KEduVocTranslation *translation ); + bool readComparison( QDomElement &comparisonElement, QmVocTranslation *translation ); /** read a multiple choice group * @param multipleChoiceElement element to read from - * @param mc KEduVocMultipleChoice object to read to + * @param mc QmVocMultipleChoice object to read to */ - bool readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation ); + bool readMultipleChoice( QDomElement &multipleChoiceElement, QmVocTranslation* translation ); /** * Read tags. @@ -148,24 +148,24 @@ private: * @param lessonElement * @return */ - bool readChildLessons( KEduVocLesson* parentLesson, QDomElement &lessonElement ); + bool readChildLessons( QmVocLesson* parentLesson, QDomElement &lessonElement ); /** read a lesson, and append it to the document * @param lessonElement element to read from */ - bool readLesson( KEduVocLesson* parentLesson, QDomElement &lessonElement ); + bool readLesson( QmVocLesson* parentLesson, QDomElement &lessonElement ); bool readSynonymsAntonymsFalseFriends( QDomElement &rootElement ); /** pre-opened QIODevice to read from */ QIODevice *m_inputFile; - /** KEduVocDocument to read to */ - KEduVocDocument *m_doc; + /** QmVocDocument to read to */ + QmVocDocument *m_doc; /** because we read the entries first, we store them here temporarily. * later we read the lessons and put the entries there based on the key (their id) */ - QMap m_allEntries; + QMap m_allEntries; /** error message */ QString m_errorMessage; diff --git a/keduvockvtml2writer.cpp b/qmvockvtml2writer.cpp similarity index 81% rename from keduvockvtml2writer.cpp rename to qmvockvtml2writer.cpp index 54d600d..159be5c 100644 --- a/keduvockvtml2writer.cpp +++ b/qmvockvtml2writer.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - export a KEduVocDocument to a KVTML file + export a QmVocDocument to a KVTML file ----------------------------------------------------------------------- copyright : (C) 2007 Jeremy Whiting Copyright 2007-2010 Frederik Gladhorn @@ -20,7 +20,7 @@ * * ***************************************************************************/ -#include "keduvockvtml2writer.h" +#include "qmvockvtml2writer.h" #include #include @@ -28,20 +28,20 @@ // #include #include -#include "keduvocdocument.h" -#include "keduvocexpression.h" -#include "keduvoclesson.h" -#include "keduvocleitnerbox.h" -#include "keduvocwordtype.h" +#include "qmvocdocument.h" +#include "qmvocexpression.h" +#include "qmvoclesson.h" +#include "qmvocleitnerbox.h" +#include "qmvocwordtype.h" #include "kvtml2defs.h" -KEduVocKvtml2Writer::KEduVocKvtml2Writer( QFile *file ) +QmVocKvtml2Writer::QmVocKvtml2Writer( QFile *file ) { // the file must be already open m_outputFile = file; } -bool KEduVocKvtml2Writer::writeDoc( KEduVocDocument *doc, const QString &generator ) +bool QmVocKvtml2Writer::writeDoc( QmVocDocument *doc, const QString &generator ) { if (createXmlDocument(doc, generator)) { QTextStream ts( m_outputFile ); @@ -51,7 +51,7 @@ bool KEduVocKvtml2Writer::writeDoc( KEduVocDocument *doc, const QString &generat return false; } -QByteArray KEduVocKvtml2Writer::toByteArray(KEduVocDocument * doc, const QString & generator) +QByteArray QmVocKvtml2Writer::toByteArray(QmVocDocument * doc, const QString & generator) { if (createXmlDocument(doc, generator)) { return m_domDoc.toByteArray(); @@ -59,7 +59,7 @@ QByteArray KEduVocKvtml2Writer::toByteArray(KEduVocDocument * doc, const QString return QByteArray(); } -bool KEduVocKvtml2Writer::createXmlDocument( KEduVocDocument *doc, const QString &generator ) +bool QmVocKvtml2Writer::createXmlDocument( QmVocDocument *doc, const QString &generator ) { m_doc = doc; @@ -116,7 +116,7 @@ bool KEduVocKvtml2Writer::createXmlDocument( KEduVocDocument *doc, const QString return true; } -bool KEduVocKvtml2Writer::writeInformation( QDomElement &informationElement, const QString &generator ) +bool QmVocKvtml2Writer::writeInformation( QDomElement &informationElement, const QString &generator ) { QDomElement currentElement; QDomText textNode; @@ -161,7 +161,7 @@ bool KEduVocKvtml2Writer::writeInformation( QDomElement &informationElement, con } -bool KEduVocKvtml2Writer::writeIdentifiers( QDomElement &identifiersElement ) +bool QmVocKvtml2Writer::writeIdentifiers( QDomElement &identifiersElement ) { for ( int i = 0; i < m_doc->identifierCount(); ++i ) { // create the node @@ -202,12 +202,12 @@ bool KEduVocKvtml2Writer::writeIdentifiers( QDomElement &identifiersElement ) return true; } -bool KEduVocKvtml2Writer::writeLessons( KEduVocLesson *parentLesson, QDomElement &lessonsElement ) +bool QmVocKvtml2Writer::writeLessons( QmVocLesson *parentLesson, QDomElement &lessonsElement ) { // iterate over child lessons. // the first time this is called with the root lesson which does not have a entry. for( int i = 0; i < parentLesson->childContainerCount(); i++ ) { - KEduVocLesson *lesson = static_cast(parentLesson->childContainer(i)); + QmVocLesson *lesson = static_cast(parentLesson->childContainer(i)); // make lesson element QDomElement thisLessonElement = m_domDoc.createElement( KVTML_CONTAINER ); @@ -223,7 +223,7 @@ bool KEduVocKvtml2Writer::writeLessons( KEduVocLesson *parentLesson, QDomElement writeLessons(lesson, thisLessonElement); // child entries - foreach(KEduVocExpression *entry, lesson->entries()) { + foreach(QmVocExpression *entry, lesson->entries()) { QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY ); entryElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(entry)) ); thisLessonElement.appendChild(entryElement); @@ -235,22 +235,22 @@ bool KEduVocKvtml2Writer::writeLessons( KEduVocLesson *parentLesson, QDomElement -void KEduVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentElement) +void QmVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentElement) { - QList< KEduVocTranslation* > currentList; + QList< QmVocTranslation* > currentList; QDomElement synonymElement; // synonym, antonym, false friend - for(int type = KEduVocTranslation::Synonym; type <= KEduVocTranslation::FalseFriend; type++) { + for(int type = QmVocTranslation::Synonym; type <= QmVocTranslation::FalseFriend; type++) { switch (type) { - case KEduVocTranslation::Synonym: + case QmVocTranslation::Synonym: synonymElement = m_domDoc.createElement( KVTML_SYNONYM ); currentList = m_synonyms; break; - case KEduVocTranslation::Antonym: + case QmVocTranslation::Antonym: synonymElement = m_domDoc.createElement( KVTML_ANTONYM ); currentList = m_antonyms; break; - case KEduVocTranslation::FalseFriend: + case QmVocTranslation::FalseFriend: synonymElement = m_domDoc.createElement( KVTML_FALSEFRIEND ); currentList = m_falseFriends; break; @@ -258,23 +258,23 @@ void KEduVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentEle while (!currentList.isEmpty()) { // after writing a translation, remove it from the list - KEduVocTranslation* translation = currentList.takeFirst(); + QmVocTranslation* translation = currentList.takeFirst(); QDomElement relatedElement; - QList list; + QList list; switch (type) { - case KEduVocTranslation::Synonym: + case QmVocTranslation::Synonym: list = translation->synonyms(); break; - case KEduVocTranslation::Antonym: + case QmVocTranslation::Antonym: list = translation->antonyms(); break; - case KEduVocTranslation::FalseFriend: + case QmVocTranslation::FalseFriend: list = translation->falseFriends(); break; } - foreach (KEduVocTranslation* synonym, list) { + foreach (QmVocTranslation* synonym, list) { // if it is not in the list it has already been written and we can move on if (currentList.contains(synonym)) { relatedElement = m_domDoc.createElement( KVTML_PAIR ); @@ -320,9 +320,9 @@ void KEduVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentEle } // iterate over types } /* -bool KEduVocKvtml2Writer::writeRelated(QDomElement & parentElement, QList< KEduVocTranslation * > relatedList) +bool QmVocKvtml2Writer::writeRelated(QDomElement & parentElement, QList< QmVocTranslation * > relatedList) { - foreach (KEduVocTranslation* synonym, translation->synonyms()) { + foreach (QmVocTranslation* synonym, translation->synonyms()) { QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY ); entryElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(translation->entry())) ); @@ -339,20 +339,20 @@ bool KEduVocKvtml2Writer::writeRelated(QDomElement & parentElement, QList< KEduV } }*/ -bool KEduVocKvtml2Writer::writeArticle( QDomElement &articleElement, int language ) +bool QmVocKvtml2Writer::writeArticle( QDomElement &articleElement, int language ) { ///@todo only write if not empty - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; - QMap genders; - genders[0] = KEduVocWordFlag::Masculine; - genders[1] = KEduVocWordFlag::Feminine; - genders[2] = KEduVocWordFlag::Neuter; - QMap defs; - defs[0] = KEduVocWordFlag::Definite; - defs[1] = KEduVocWordFlag::Indefinite; + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; + QMap genders; + genders[0] = QmVocWordFlag::Masculine; + genders[1] = QmVocWordFlag::Feminine; + genders[2] = QmVocWordFlag::Neuter; + QMap defs; + defs[0] = QmVocWordFlag::Definite; + defs[1] = QmVocWordFlag::Indefinite; for (int num = 0; num <= 2; num++) { @@ -380,44 +380,44 @@ bool KEduVocKvtml2Writer::writeArticle( QDomElement &articleElement, int languag } -bool KEduVocKvtml2Writer::writeWordTypes( QDomElement &typesElement, KEduVocWordType* parentContainer ) +bool QmVocKvtml2Writer::writeWordTypes( QDomElement &typesElement, QmVocWordType* parentContainer ) { - foreach( KEduVocContainer* container, parentContainer->childContainers() ) { - KEduVocWordType* wordType = static_cast(container); + foreach( QmVocContainer* container, parentContainer->childContainers() ) { + QmVocWordType* wordType = static_cast(container); QDomElement typeDefinitionElement = m_domDoc.createElement( KVTML_CONTAINER ); typeDefinitionElement.appendChild( newTextElement( KVTML_NAME, wordType->name() ) ); - if (wordType->wordType().testFlag(KEduVocWordFlag::Noun)) + if (wordType->wordType().testFlag(QmVocWordFlag::Noun)) { - if (wordType->wordType().testFlag(KEduVocWordFlag::Masculine)) + if (wordType->wordType().testFlag(QmVocWordFlag::Masculine)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_NOUN_MALE ) ); - else if (wordType->wordType().testFlag(KEduVocWordFlag::Feminine)) + else if (wordType->wordType().testFlag(QmVocWordFlag::Feminine)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_NOUN_FEMALE ) ); - else if (wordType->wordType().testFlag(KEduVocWordFlag::Neuter)) + else if (wordType->wordType().testFlag(QmVocWordFlag::Neuter)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_NOUN_NEUTRAL ) ); else typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_NOUN ) ); } - else if (wordType->wordType().testFlag(KEduVocWordFlag::Verb)) + else if (wordType->wordType().testFlag(QmVocWordFlag::Verb)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_VERB ) ); - else if (wordType->wordType().testFlag(KEduVocWordFlag::Adjective)) + else if (wordType->wordType().testFlag(QmVocWordFlag::Adjective)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_ADJECTIVE ) ); - else if (wordType->wordType().testFlag(KEduVocWordFlag::Adverb)) + else if (wordType->wordType().testFlag(QmVocWordFlag::Adverb)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_ADVERB ) ); - else if (wordType->wordType().testFlag(KEduVocWordFlag::Conjunction)) + else if (wordType->wordType().testFlag(QmVocWordFlag::Conjunction)) typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, KVTML_SPECIALWORDTYPE_CONJUNCTION ) ); // child entries // child entries - foreach(KEduVocExpression *entry, wordType->entries()) { + foreach(QmVocExpression *entry, wordType->entries()) { QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY ); entryElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(entry)) ); for(int translation = 0; translationidentifierCount(); translation++) { @@ -439,16 +439,16 @@ bool KEduVocKvtml2Writer::writeWordTypes( QDomElement &typesElement, KEduVocWord return true; } -bool KEduVocKvtml2Writer::writeLeitnerBoxes( QDomElement &leitnerParentElement, KEduVocLeitnerBox* parentContainer ) +bool QmVocKvtml2Writer::writeLeitnerBoxes( QDomElement &leitnerParentElement, QmVocLeitnerBox* parentContainer ) { - foreach( KEduVocContainer* container, parentContainer->childContainers() ) { - KEduVocLeitnerBox* leitnerBox = static_cast(container); + foreach( QmVocContainer* container, parentContainer->childContainers() ) { + QmVocLeitnerBox* leitnerBox = static_cast(container); QDomElement containerElement = m_domDoc.createElement( KVTML_CONTAINER ); containerElement.appendChild( newTextElement( KVTML_NAME, leitnerBox->name() ) ); // child entries - foreach(KEduVocExpression *entry, leitnerBox->entries()) { + foreach(QmVocExpression *entry, leitnerBox->entries()) { QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY ); entryElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(entry)) ); for(int translation = 0; translationidentifierCount(); translation++) { @@ -468,13 +468,13 @@ bool KEduVocKvtml2Writer::writeLeitnerBoxes( QDomElement &leitnerParentElement, return true; } -bool KEduVocKvtml2Writer::writeEntries( QDomElement &entriesElement ) +bool QmVocKvtml2Writer::writeEntries( QDomElement &entriesElement ) { - m_allEntries = m_doc->lesson()->entries(KEduVocLesson::Recursive); + m_allEntries = m_doc->lesson()->entries(QmVocLesson::Recursive); // loop through entries for ( int i = 0; i < m_allEntries.count(); ++i ) { - KEduVocExpression *thisEntry = m_allEntries.value(i); + QmVocExpression *thisEntry = m_allEntries.value(i); // write entry tag QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY ); @@ -502,14 +502,14 @@ bool KEduVocKvtml2Writer::writeEntries( QDomElement &entriesElement ) } -bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEduVocTranslation* translation ) +bool QmVocKvtml2Writer::writeTranslation( QDomElement &translationElement, QmVocTranslation* translation ) { - // so far only for KEduVocWord - text and grades + // so far only for QmVocWord - text and grades translation->toKVTML2(translationElement); // comparison if ( !(translation->comparativeForm().text().isEmpty() || translation->superlativeForm().text().isEmpty())) { - kDebug() << "Write comp"; + qDebug() << "Write comp"; QDomElement comparisonElement = m_domDoc.createElement( KVTML_COMPARISON ); translationElement.appendChild(comparisonElement); @@ -592,7 +592,7 @@ bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEd // } // } -bool KEduVocKvtml2Writer::writeMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation ) +bool QmVocKvtml2Writer::writeMultipleChoice( QDomElement &multipleChoiceElement, QmVocTranslation* translation ) /* good @@ -609,7 +609,7 @@ bool KEduVocKvtml2Writer::writeMultipleChoice( QDomElement &multipleChoiceElemen return true; } -QDomElement KEduVocKvtml2Writer::newTextElement( const QString &elementName, const QString &text ) +QDomElement QmVocKvtml2Writer::newTextElement( const QString &elementName, const QString &text ) { QDomElement retval = m_domDoc.createElement( elementName ); QDomText textNode = m_domDoc.createTextNode( text ); @@ -617,7 +617,7 @@ QDomElement KEduVocKvtml2Writer::newTextElement( const QString &elementName, con return retval; } -bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, const KEduVocPersonalPronoun & pronoun) +bool QmVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, const QmVocPersonalPronoun & pronoun) { // general pronoun properties if ( pronoun.maleFemaleDifferent() ) { @@ -631,16 +631,16 @@ bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, con } - QMap numbers; - numbers[0] = KEduVocWordFlag::Singular; - numbers[1] = KEduVocWordFlag::Dual; - numbers[2] = KEduVocWordFlag::Plural; - QMap persons; - persons[0] = KEduVocWordFlag::First; - persons[1] = KEduVocWordFlag::Second; - persons[2] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Masculine); - persons[3] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Feminine); - persons[4] = (KEduVocWordFlag::Flags)((int)KEduVocWordFlag::Third | (int)KEduVocWordFlag::Neuter); + QMap numbers; + numbers[0] = QmVocWordFlag::Singular; + numbers[1] = QmVocWordFlag::Dual; + numbers[2] = QmVocWordFlag::Plural; + QMap persons; + persons[0] = QmVocWordFlag::First; + persons[1] = QmVocWordFlag::Second; + persons[2] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Masculine); + persons[3] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Feminine); + persons[4] = (QmVocWordFlag::Flags)((int)QmVocWordFlag::Third | (int)QmVocWordFlag::Neuter); @@ -660,7 +660,7 @@ bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, con return true; } -void KEduVocKvtml2Writer::appendTextElement(QDomElement & parent, const QString & elementName, const QString & text) +void QmVocKvtml2Writer::appendTextElement(QDomElement & parent, const QString & elementName, const QString & text) { // empty will never be written if (text.isEmpty()) { diff --git a/keduvockvtml2writer.h b/qmvockvtml2writer.h similarity index 69% rename from keduvockvtml2writer.h rename to qmvockvtml2writer.h index 8a466e8..46089fa 100644 --- a/keduvockvtml2writer.h +++ b/qmvockvtml2writer.h @@ -3,10 +3,11 @@ ***************************************************************************/ /*************************************************************************** - export a KEduVocDocument to a KVTML file + export a QmVocDocument to a KVTML file ----------------------------------------------------------------------- copyright : (C) 2007 Jeremy Whiting (C) 2007-2008 Frederik Gladhorn + (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -18,35 +19,35 @@ * * ***************************************************************************/ -#ifndef KEDUVOCKVTML2WRITER_H -#define KEDUVOCKVTML2WRITER_H +#ifndef QMVOCKVTML2WRITER_H +#define QMVOCKVTML2WRITER_H #include #include #include -#include "keduvocarticle.h" -#include "keduvocmultiplechoice.h" -#include "keduvoctranslation.h" -#include "keduvocpersonalpronoun.h" +#include "qmvocarticle.h" +#include "qmvocmultiplechoice.h" +#include "qmvoctranslation.h" +#include "qmvocpersonalpronoun.h" -class KEduVocDocument; -class KEduVocExpression; -class KEduVocLesson; -class KEduVocLeitnerBox; +class QmVocDocument; +class QmVocExpression; +class QmVocLesson; +class QmVocLeitnerBox; /** -* @brief Class to write kvtml2 data files from KEduVocDocument +* @brief Class to write kvtml2 data files from QmVocDocument * @author Jeremy Whiting */ -class KEduVocKvtml2Writer +class QmVocKvtml2Writer { public: - KEduVocKvtml2Writer( QFile *file ); + QmVocKvtml2Writer( QFile *file ); - bool writeDoc( KEduVocDocument *doc, const QString &generator ); + bool writeDoc( QmVocDocument *doc, const QString &generator ); - QByteArray toByteArray( KEduVocDocument *doc, const QString &generator ); + QByteArray toByteArray( QmVocDocument *doc, const QString &generator ); /** * Helper function, appends a new element AND a text child to @p parent @@ -59,7 +60,7 @@ public: private: - bool createXmlDocument( KEduVocDocument *doc, const QString &generator ); + bool createXmlDocument( QmVocDocument *doc, const QString &generator ); /** write information entries * @param informationElement QDomElement information to write to @@ -78,19 +79,19 @@ private: */ bool writeArticle( QDomElement &articleElement, int article ); - bool writePersonalPronoun( QDomElement &pronounElement, const KEduVocPersonalPronoun &pronoun); + bool writePersonalPronoun( QDomElement &pronounElement, const QmVocPersonalPronoun &pronoun); /** write types * @param typesElement QDomElement types to write to */ - bool writeWordTypes( QDomElement &typesElement, KEduVocWordType* parentContainer ); + bool writeWordTypes( QDomElement &typesElement, QmVocWordType* parentContainer ); /** - * write the leitner boxes @see KEduVocLeitnerBox + * write the leitner boxes @see QmVocLeitnerBox * @param leitnerParentElement parent dom element - * @param parentContainer parent of the KEduVocLeitnerBoxes to write + * @param parentContainer parent of the QmVocLeitnerBoxes to write * @return success */ - bool writeLeitnerBoxes( QDomElement &leitnerParentElement, KEduVocLeitnerBox* parentContainer ); + bool writeLeitnerBoxes( QDomElement &leitnerParentElement, QmVocLeitnerBox* parentContainer ); /** write entries * @param entriesElement QDomElement entries to write to @@ -101,7 +102,7 @@ private: * @param translationElement QDomElement translation to write to, with id pre-set * @param translation object to write */ - bool writeTranslation( QDomElement &translationElement, KEduVocTranslation* translation ); + bool writeTranslation( QDomElement &translationElement, QmVocTranslation* translation ); /** * Used to write synonym, antonym and false friend lists @@ -109,13 +110,13 @@ private: * @param parentContainer * @return */ - bool writeRelated( QDomElement &parentElement, QList relatedList ); + bool writeRelated( QDomElement &parentElement, QList relatedList ); /** write the lesson group * @param parentLesson the parent lesson of the current lesson * @param lessonsElement QDomElement lessons to write to */ - bool writeLessons( KEduVocLesson *parentLesson, QDomElement &lessonsElement ); + bool writeLessons( QmVocLesson *parentLesson, QDomElement &lessonsElement ); void writeSynonymAntonymFalseFriend(QDomElement & parentElement); @@ -123,17 +124,17 @@ private: * @param multipleChoiceElement QDomElement multiplechoice to write to * @returns success */ - bool writeMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation ); + bool writeMultipleChoice( QDomElement &multipleChoiceElement, QmVocTranslation* translation ); QDomElement newTextElement( const QString &elementName, const QString &text ); QFile *m_outputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; - QList m_allEntries; - QList m_synonyms; - QList m_antonyms; - QList m_falseFriends; + QList m_allEntries; + QList m_synonyms; + QList m_antonyms; + QList m_falseFriends; QDomDocument m_domDoc; }; diff --git a/keduvockvtmlcompability.cpp b/qmvockvtmlcompability.cpp similarity index 70% rename from keduvockvtmlcompability.cpp rename to qmvockvtmlcompability.cpp index 164bfe1..2724935 100644 --- a/keduvockvtmlcompability.cpp +++ b/qmvockvtmlcompability.cpp @@ -4,7 +4,7 @@ /*************************************************************************** - C++ Implementation: keduvockvtml1compability_p + C++ Implementation: qmvockvtml1compability_p ----------------------------------------------------------------------- @@ -26,19 +26,19 @@ * * ***************************************************************************/ -#include "keduvockvtmlcompability.h" -#include "keduvocwordtype.h" +#include "qmvockvtmlcompability.h" +#include "qmvocwordtype.h" // #include // #include #include #include -const QString KEduVocKvtmlCompability::KVTML_1_USER_DEFINED = QString( "#" ); -const QString KEduVocKvtmlCompability::KVTML_1_SEPERATOR = QString( ":" ); +const QString QmVocKvtmlCompability::KVTML_1_USER_DEFINED = QString( "#" ); +const QString QmVocKvtmlCompability::KVTML_1_SEPERATOR = QString( ":" ); -KEduVocKvtmlCompability::KEduVocKvtmlCompability() +QmVocKvtmlCompability::QmVocKvtmlCompability() { m_userdefinedTenseCounter = 0; m_userdefinedTypeCounter = 0; @@ -49,7 +49,7 @@ KEduVocKvtmlCompability::KEduVocKvtmlCompability() ////////////////// TYPES ///////////////////////////////////////// -void KEduVocKvtmlCompability::initOldTypeLists() +void QmVocKvtmlCompability::initOldTypeLists() { m_oldMainTypeNames.clear(); m_oldMainTypeNames.insert( "v", "Verb" ); @@ -81,13 +81,13 @@ void KEduVocKvtmlCompability::initOldTypeLists() } -KEduVocWordType* KEduVocKvtmlCompability::typeFromOldFormat(KEduVocWordType* parent, const QString & typeSubtypeString ) const +QmVocWordType* QmVocKvtmlCompability::typeFromOldFormat(QmVocWordType* parent, const QString & typeSubtypeString ) const { // check if it's user defined if ( typeSubtypeString.length() >= 2 && typeSubtypeString.left( 1 ) == QM_USER_TYPE ) { // they started counting at 1, we need to know which index we are dealing with: int selfDefinedTypeIndex = typeSubtypeString.right( typeSubtypeString.count()-1 ).toInt() -1; - return static_cast(parent->childContainer(selfDefinedTypeIndex)); + return static_cast(parent->childContainer(selfDefinedTypeIndex)); } // assume the parent is set up to contain the old types correctly @@ -120,14 +120,14 @@ KEduVocWordType* KEduVocKvtmlCompability::typeFromOldFormat(KEduVocWordType* par QString subTypeName = m_oldSubTypeNames.value( subType ); - foreach (KEduVocContainer* wordType, parent->childContainers()) { + foreach (QmVocContainer* wordType, parent->childContainers()) { if (wordType->name() == typeName) { if (subType.isEmpty()) { - return static_cast(wordType); + return static_cast(wordType); } else { - foreach (KEduVocContainer* subWordType, wordType->childContainers()) { + foreach (QmVocContainer* subWordType, wordType->childContainers()) { if (subWordType->name() == subTypeName) { - return static_cast(subWordType); + return static_cast(subWordType); } } } @@ -179,7 +179,7 @@ if ( oldType.length() >= 2 && type.left( 1 ) == QM_USER_TYPE ) { -void KEduVocKvtmlCompability::initOldTenses() +void QmVocKvtmlCompability::initOldTenses() { m_oldTenses["PrSi"] = "Simple Present" ; m_oldTenses["PrPr"] = "Present Progressive" ; @@ -191,7 +191,7 @@ void KEduVocKvtmlCompability::initOldTenses() } -void KEduVocKvtmlCompability::addUserdefinedTense(const QString & tense) +void QmVocKvtmlCompability::addUserdefinedTense(const QString & tense) { m_userdefinedTenseCounter++; m_oldTenses[KVTML_1_USER_DEFINED + QString::number( m_userdefinedTenseCounter )] = tense; @@ -201,7 +201,7 @@ void KEduVocKvtmlCompability::addUserdefinedTense(const QString & tense) } -QString KEduVocKvtmlCompability::tenseFromKvtml1(const QString & oldTense) +QString QmVocKvtmlCompability::tenseFromKvtml1(const QString & oldTense) { // in case the document got chaged, at least make up something as tense if (!m_oldTenses.keys().contains(oldTense)) { @@ -213,13 +213,13 @@ QString KEduVocKvtmlCompability::tenseFromKvtml1(const QString & oldTense) } -QStringList KEduVocKvtmlCompability::documentTenses() const +QStringList QmVocKvtmlCompability::documentTenses() const { return m_tenses.values(); } -QString KEduVocKvtmlCompability::oldTense(const QString & tense) +QString QmVocKvtmlCompability::oldTense(const QString & tense) { ///@todo writing of the user defined tenses is probably messed up if ( !m_oldTenses.values().contains(tense) ) { @@ -229,7 +229,7 @@ QString KEduVocKvtmlCompability::oldTense(const QString & tense) return m_oldTenses.key(tense); } -void KEduVocKvtmlCompability::setupWordTypes(KEduVocWordType * parent) +void QmVocKvtmlCompability::setupWordTypes(QmVocWordType * parent) { QStringList wordTypeNames; wordTypeNames @@ -247,58 +247,58 @@ void KEduVocKvtmlCompability::setupWordTypes(KEduVocWordType * parent) << "Question" ; foreach (const QString &typeName, wordTypeNames) { - KEduVocWordType* wordType = new KEduVocWordType(typeName, parent); + QmVocWordType* wordType = new QmVocWordType(typeName, parent); parent->appendChildContainer(wordType); m_userdefinedTypeCounter++; } - static_cast(parent->childContainer(4))->setWordType(KEduVocWordFlag::Adjective); - static_cast(parent->childContainer(5))->setWordType(KEduVocWordFlag::Adverb); + static_cast(parent->childContainer(4))->setWordType(QmVocWordFlag::Adjective); + static_cast(parent->childContainer(5))->setWordType(QmVocWordFlag::Adverb); - KEduVocWordType* numeral = static_cast(parent->childContainer(8)); - KEduVocWordType* wordType = new KEduVocWordType( "Ordinal", numeral); - wordType->setWordType(KEduVocWordFlag::Adjective); + QmVocWordType* numeral = static_cast(parent->childContainer(8)); + QmVocWordType* wordType = new QmVocWordType( "Ordinal", numeral); + wordType->setWordType(QmVocWordFlag::Adjective); numeral->appendChildContainer(wordType); - wordType = new KEduVocWordType( "Cardinal" , numeral); + wordType = new QmVocWordType( "Cardinal" , numeral); - wordType->setWordType(KEduVocWordFlag::Adjective); + wordType->setWordType(QmVocWordFlag::Adjective); numeral->appendChildContainer(wordType); - KEduVocWordType* article = static_cast(parent->childContainer(3)); - wordType = new KEduVocWordType( "Definite" , article); - wordType->setWordType(KEduVocWordFlag::Article | KEduVocWordFlag::Definite); + QmVocWordType* article = static_cast(parent->childContainer(3)); + wordType = new QmVocWordType( "Definite" , article); + wordType->setWordType(QmVocWordFlag::Article | QmVocWordFlag::Definite); article->appendChildContainer(wordType); - wordType = new KEduVocWordType( "Indefinite" , article); - wordType->setWordType(KEduVocWordFlag::Article | KEduVocWordFlag::Indefinite); + wordType = new QmVocWordType( "Indefinite" , article); + wordType->setWordType(QmVocWordFlag::Article | QmVocWordFlag::Indefinite); article->appendChildContainer(wordType); - KEduVocWordType* verb = static_cast(parent->childContainer(0)); - verb->setWordType(KEduVocWordFlag::Verb); - wordType = new KEduVocWordType( "Regular" , verb); - wordType->setWordType(KEduVocWordFlag::Verb | KEduVocWordFlag::Regular); + QmVocWordType* verb = static_cast(parent->childContainer(0)); + verb->setWordType(QmVocWordFlag::Verb); + wordType = new QmVocWordType( "Regular" , verb); + wordType->setWordType(QmVocWordFlag::Verb | QmVocWordFlag::Regular); verb->appendChildContainer(wordType); - wordType = new KEduVocWordType( "Irregular" , verb); + wordType = new QmVocWordType( "Irregular" , verb); verb->appendChildContainer(wordType); - wordType->setWordType(KEduVocWordFlag::Verb | KEduVocWordFlag::Irregular); + wordType->setWordType(QmVocWordFlag::Verb | QmVocWordFlag::Irregular); - KEduVocWordType* noun = static_cast(parent->childContainer(1)); - noun->setWordType(KEduVocWordFlag::Noun); - wordType = new KEduVocWordType( "Male" , noun); + QmVocWordType* noun = static_cast(parent->childContainer(1)); + noun->setWordType(QmVocWordFlag::Noun); + wordType = new QmVocWordType( "Male" , noun); noun->appendChildContainer(wordType); - wordType->setWordType(KEduVocWordFlag::Noun | KEduVocWordFlag::Masculine); - wordType = new KEduVocWordType( "Female" , noun); + wordType->setWordType(QmVocWordFlag::Noun | QmVocWordFlag::Masculine); + wordType = new QmVocWordType( "Female" , noun); noun->appendChildContainer(wordType); - wordType->setWordType(KEduVocWordFlag::Noun | KEduVocWordFlag::Feminine); - wordType = new KEduVocWordType( "Neutral" , noun); + wordType->setWordType(QmVocWordFlag::Noun | QmVocWordFlag::Feminine); + wordType = new QmVocWordType( "Neutral" , noun); noun->appendChildContainer(wordType); - wordType->setWordType(KEduVocWordFlag::Noun | KEduVocWordFlag::Neuter); + wordType->setWordType(QmVocWordFlag::Noun | QmVocWordFlag::Neuter); - KEduVocWordType* pronoun = static_cast(parent->childContainer(6)); - wordType = new KEduVocWordType( "Possessive" , pronoun); - wordType->setWordType(KEduVocWordFlag::Pronoun); + QmVocWordType* pronoun = static_cast(parent->childContainer(6)); + wordType = new QmVocWordType( "Possessive" , pronoun); + wordType->setWordType(QmVocWordFlag::Pronoun); pronoun->appendChildContainer(wordType); - wordType = new KEduVocWordType( "Personal" , pronoun); - wordType->setWordType(KEduVocWordFlag::Pronoun); + wordType = new QmVocWordType( "Personal" , pronoun); + wordType->setWordType(QmVocWordFlag::Pronoun); pronoun->appendChildContainer(wordType); } diff --git a/keduvockvtmlcompability.h b/qmvockvtmlcompability.h similarity index 90% rename from keduvockvtmlcompability.h rename to qmvockvtmlcompability.h index 2a2188a..766659a 100644 --- a/keduvockvtmlcompability.h +++ b/qmvockvtmlcompability.h @@ -4,13 +4,14 @@ /*************************************************************************** - C++ Interface: keduvockvtml1compability_p + C++ Interface: qmvockvtml1compability_p ----------------------------------------------------------------------- begin : Di Aug 28 2007 copyright : (C) 2007 Frederik Gladhorn + Copyright : (C) 2010 Reto Zingg ----------------------------------------------------------------------- @@ -25,8 +26,8 @@ * * ***************************************************************************/ -#ifndef KEDUVOCKVTMLCOMPABILITY_H -#define KEDUVOCKVTMLCOMPABILITY_H +#ifndef QMVOCKVTMLCOMPABILITY_H +#define QMVOCKVTMLCOMPABILITY_H #include #include @@ -70,19 +71,19 @@ #define UL_USER_USAGE "#" // designates number of user type -class KEduVocWordType; +class QmVocWordType; /** * @file contains defines and constants necessary for reading kvtml files prior to KDE4. kvtml version 1. */ -class KEduVocKvtmlCompability +class QmVocKvtmlCompability { public: /** * Constructor, initialize the map. */ - KEduVocKvtmlCompability(); + QmVocKvtmlCompability(); ///// TYPES /** @@ -90,7 +91,7 @@ public: * @param typeSubtypeString the old string containing everything * @return type */ - KEduVocWordType* typeFromOldFormat(KEduVocWordType* parent, const QString & typeSubtypeString ) const; + QmVocWordType* typeFromOldFormat(QmVocWordType* parent, const QString & typeSubtypeString ) const; /** * To write old docs: convert a nice new type to the ugly old style. @@ -106,7 +107,7 @@ public: QStringList documentTenses() const; QString oldTense( const QString& tense ); - void setupWordTypes(KEduVocWordType* parent); + void setupWordTypes(QmVocWordType* parent); private: @@ -130,4 +131,4 @@ private: static const QString KVTML_1_SEPERATOR; }; -#endif // KEDUVOCKVTMLCOMPABILITY_H +#endif // QMVOCKVTMLCOMPABILITY_H diff --git a/keduvockvtmlreader.cpp b/qmvockvtmlreader.cpp similarity index 87% rename from keduvockvtmlreader.cpp rename to qmvockvtmlreader.cpp index 43bcdeb..edd78d6 100644 --- a/keduvockvtmlreader.cpp +++ b/qmvockvtmlreader.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - read a KEduVocDocument from a KVTML file + read a QmVocDocument from a KVTML file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold @@ -22,7 +22,7 @@ * * ***************************************************************************/ -#include "keduvockvtmlreader.h" +#include "qmvockvtmlreader.h" #include #include @@ -33,28 +33,28 @@ // #include // #include -#include "keduvocdocument.h" -#include "keduvoclesson.h" -#include "keduvocwordtype.h" +#include "qmvocdocument.h" +#include "qmvoclesson.h" +#include "qmvocwordtype.h" #include "kvtmldefs.h" -#include "keduvoccommon_p.h" +#include "qmvoccommon_p.h" -KEduVocKvtmlReader::KEduVocKvtmlReader( QIODevice *file ) +QmVocKvtmlReader::QmVocKvtmlReader( QIODevice *file ) { // the file must be already open m_inputFile = file; m_errorMessage = ""; - qDebug() << "KEduVocKvtmlReader for kvtml version 1 files started."; + qDebug() << "QmVocKvtmlReader for kvtml version 1 files started."; } -bool KEduVocKvtmlReader::readDoc( KEduVocDocument *doc ) +bool QmVocKvtmlReader::readDoc( QmVocDocument *doc ) { m_doc = doc; m_cols = 0; m_lines = 0; - QDomDocument domDoc( "KEduVocDocument" ); + QDomDocument domDoc( "QmVocDocument" ); if ( !domDoc.setContent( m_inputFile, &m_errorMessage ) ) return false; @@ -118,7 +118,7 @@ bool KEduVocKvtmlReader::readDoc( KEduVocDocument *doc ) } -bool KEduVocKvtmlReader::readBody( QDomElement &domElementParent ) +bool QmVocKvtmlReader::readBody( QDomElement &domElementParent ) { bool result = false; @@ -151,7 +151,7 @@ bool KEduVocKvtmlReader::readBody( QDomElement &domElementParent ) return false; } - KEduVocPersonalPronoun pronouns; + QmVocPersonalPronoun pronouns; if (! readPersonalPronouns( domElementConjugChild, pronouns ) ) { return false; } @@ -201,7 +201,7 @@ bool KEduVocKvtmlReader::readBody( QDomElement &domElementParent ) } -bool KEduVocKvtmlReader::readLesson( QDomElement &domElementParent ) +bool QmVocKvtmlReader::readLesson( QDomElement &domElementParent ) { QString s; QDomAttr attribute; @@ -233,7 +233,7 @@ bool KEduVocKvtmlReader::readLesson( QDomElement &domElementParent ) } s = currentElement.text(); - KEduVocLesson* lesson = new KEduVocLesson(s, m_doc->lesson()); + QmVocLesson* lesson = new QmVocLesson(s, m_doc->lesson()); lesson->setInPractice(inQuery); m_doc->lesson()->appendChildContainer( lesson ); if ( m_doc->lesson()->childContainerCount() != no-1 ) { @@ -246,7 +246,7 @@ bool KEduVocKvtmlReader::readLesson( QDomElement &domElementParent ) } -bool KEduVocKvtmlReader::readArticle( QDomElement &domElementParent ) +bool QmVocKvtmlReader::readArticle( QDomElement &domElementParent ) /*
lang determines also lang order in entries !! @@ -272,7 +272,7 @@ bool KEduVocKvtmlReader::readArticle( QDomElement &domElementParent ) for ( int i = 0; i < entryList.count(); ++i ) { -//kDebug() << "KEduVocKvtmlReader::readArticle() read " << entryList.count() << " articles. "; +//kDebug() << "QmVocKvtmlReader::readArticle() read " << entryList.count() << " articles. "; currentElement = entryList.item( i ).toElement(); if ( currentElement.parentNode() == domElementParent ) { QString lang; @@ -334,7 +334,7 @@ bool KEduVocKvtmlReader::readArticle( QDomElement &domElementParent ) nat_indef = ""; } - m_doc->identifier(i).setArticle( KEduVocArticle( fem_def, fem_indef, mal_def, mal_indef, nat_def, nat_indef ) ); + m_doc->identifier(i).setArticle( QmVocArticle( fem_def, fem_indef, mal_def, mal_indef, nat_def, nat_indef ) ); } } @@ -342,7 +342,7 @@ bool KEduVocKvtmlReader::readArticle( QDomElement &domElementParent ) } -bool KEduVocKvtmlReader::readTranslationConjugations( QDomElement &domElementParent, KEduVocTranslation* translation ) +bool QmVocKvtmlReader::readTranslationConjugations( QDomElement &domElementParent, QmVocTranslation* translation ) { QString tense; @@ -354,7 +354,7 @@ bool KEduVocKvtmlReader::readTranslationConjugations( QDomElement &domElementPar QString oldShortTense = domAttrLang.value(); tense = m_compability.tenseFromKvtml1( oldShortTense ); - KEduVocConjugation conjugation; + QmVocConjugation conjugation; readConjugation(domElementConjugChild, conjugation); translation->setConjugation(tense, conjugation); @@ -363,7 +363,7 @@ bool KEduVocKvtmlReader::readTranslationConjugations( QDomElement &domElementPar return true; } -bool KEduVocKvtmlReader::readConjugation( QDomElement &domElementParent, KEduVocConjugation& conjugation ) +bool QmVocKvtmlReader::readConjugation( QDomElement &domElementParent, QmVocConjugation& conjugation ) /* used in header for definiton of "prefix" lang determines also lang order in entries !! @@ -466,34 +466,34 @@ bool KEduVocKvtmlReader::readConjugation( QDomElement &domElementParent, KEduVoc // type - the tense? // finally the person - const KEduVocWordFlags numS = KEduVocWordFlag::Singular; - const KEduVocWordFlags numP = KEduVocWordFlag::Plural; + const QmVocWordFlags numS = QmVocWordFlag::Singular; + const QmVocWordFlags numP = QmVocWordFlag::Plural; - conjugation.setConjugation( pers1_sing, KEduVocWordFlag::First | numS); - conjugation.setConjugation( pers2_sing, KEduVocWordFlag::Second | numS); - conjugation.setConjugation( pers1_plur, KEduVocWordFlag::First | numP); - conjugation.setConjugation( pers2_plur, KEduVocWordFlag::Second | numP); + conjugation.setConjugation( pers1_sing, QmVocWordFlag::First | numS); + conjugation.setConjugation( pers2_sing, QmVocWordFlag::Second | numS); + conjugation.setConjugation( pers1_plur, QmVocWordFlag::First | numP); + conjugation.setConjugation( pers2_plur, QmVocWordFlag::Second | numP); if ( s3_common ) { - conjugation.setConjugation( pers3_f_sing, KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | KEduVocWordFlag::Singular ); + conjugation.setConjugation( pers3_f_sing, QmVocWordFlag::Third | QmVocWordFlag::Neuter | QmVocWordFlag::Singular ); } else { conjugation.setConjugation( pers3_m_sing, - KEduVocWordFlag::Third | KEduVocWordFlag::Masculine | KEduVocWordFlag::Singular ); + QmVocWordFlag::Third | QmVocWordFlag::Masculine | QmVocWordFlag::Singular ); conjugation.setConjugation( pers3_f_sing, - KEduVocWordFlag::Third | KEduVocWordFlag::Feminine | KEduVocWordFlag::Singular ); + QmVocWordFlag::Third | QmVocWordFlag::Feminine | QmVocWordFlag::Singular ); conjugation.setConjugation( pers3_n_sing, - KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | KEduVocWordFlag::Singular ); + QmVocWordFlag::Third | QmVocWordFlag::Neuter | QmVocWordFlag::Singular ); } if ( p3_common ) { - conjugation.setConjugation( pers3_f_plur, KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | KEduVocWordFlag::Plural ); + conjugation.setConjugation( pers3_f_plur, QmVocWordFlag::Third | QmVocWordFlag::Neuter | QmVocWordFlag::Plural ); } else { conjugation.setConjugation( pers3_m_plur, - KEduVocWordFlag::Third | KEduVocWordFlag::Masculine | KEduVocWordFlag::Plural ); + QmVocWordFlag::Third | QmVocWordFlag::Masculine | QmVocWordFlag::Plural ); conjugation.setConjugation( pers3_f_plur, - KEduVocWordFlag::Third | KEduVocWordFlag::Feminine | KEduVocWordFlag::Plural ); + QmVocWordFlag::Third | QmVocWordFlag::Feminine | QmVocWordFlag::Plural ); conjugation.setConjugation( pers3_n_plur, - KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | KEduVocWordFlag::Plural ); + QmVocWordFlag::Third | QmVocWordFlag::Neuter | QmVocWordFlag::Plural ); } return true; @@ -502,7 +502,7 @@ bool KEduVocKvtmlReader::readConjugation( QDomElement &domElementParent, KEduVoc -bool KEduVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, KEduVocPersonalPronoun& pronouns ) +bool QmVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, QmVocPersonalPronoun& pronouns ) { // QString s; bool p3_common; @@ -574,37 +574,37 @@ bool KEduVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, KE // type - the tense? // finally the person - KEduVocWordFlags numS = KEduVocWordFlag::Singular; + QmVocWordFlags numS = QmVocWordFlag::Singular; pronouns.setMaleFemaleDifferent(false); - pronouns.setPersonalPronoun( pers1_sing, KEduVocWordFlag::First | numS ); - pronouns.setPersonalPronoun( pers2_sing, KEduVocWordFlag::Second | numS ); + pronouns.setPersonalPronoun( pers1_sing, QmVocWordFlag::First | numS ); + pronouns.setPersonalPronoun( pers2_sing, QmVocWordFlag::Second | numS ); // used to have common in female if ( s3_common ) { - pronouns.setPersonalPronoun( pers3_f_sing, KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | numS ); + pronouns.setPersonalPronoun( pers3_f_sing, QmVocWordFlag::Third | QmVocWordFlag::Neuter | numS ); } else { pronouns.setPersonalPronoun( pers3_m_sing, - KEduVocWordFlag::Third | KEduVocWordFlag::Masculine | numS ); + QmVocWordFlag::Third | QmVocWordFlag::Masculine | numS ); pronouns.setPersonalPronoun( pers3_f_sing, - KEduVocWordFlag::Third | KEduVocWordFlag::Feminine | numS ); + QmVocWordFlag::Third | QmVocWordFlag::Feminine | numS ); pronouns.setPersonalPronoun( pers3_n_sing, - KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | numS ); + QmVocWordFlag::Third | QmVocWordFlag::Neuter | numS ); pronouns.setMaleFemaleDifferent(true); } - KEduVocWordFlags numP = KEduVocWordFlag::Plural; + QmVocWordFlags numP = QmVocWordFlag::Plural; - pronouns.setPersonalPronoun( pers1_plur, KEduVocWordFlag::First | numP ); - pronouns.setPersonalPronoun( pers2_plur, KEduVocWordFlag::Second | numP ); + pronouns.setPersonalPronoun( pers1_plur, QmVocWordFlag::First | numP ); + pronouns.setPersonalPronoun( pers2_plur, QmVocWordFlag::Second | numP ); if ( p3_common ) { - pronouns.setPersonalPronoun( pers3_f_plur, KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | numP ); + pronouns.setPersonalPronoun( pers3_f_plur, QmVocWordFlag::Third | QmVocWordFlag::Neuter | numP ); } else { pronouns.setPersonalPronoun( pers3_m_plur, - KEduVocWordFlag::Third | KEduVocWordFlag::Masculine | numP ); + QmVocWordFlag::Third | QmVocWordFlag::Masculine | numP ); pronouns.setPersonalPronoun( pers3_f_plur, - KEduVocWordFlag::Third | KEduVocWordFlag::Feminine | numP ); + QmVocWordFlag::Third | QmVocWordFlag::Feminine | numP ); pronouns.setPersonalPronoun( pers3_n_plur, - KEduVocWordFlag::Third | KEduVocWordFlag::Neuter | numP ); + QmVocWordFlag::Third | QmVocWordFlag::Neuter | numP ); pronouns.setMaleFemaleDifferent(true); } @@ -612,7 +612,7 @@ bool KEduVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, KE } -bool KEduVocKvtmlReader::readType( QDomElement &domElementParent ) +bool QmVocKvtmlReader::readType( QDomElement &domElementParent ) { QString s; QDomElement currentElement; @@ -629,7 +629,7 @@ bool KEduVocKvtmlReader::readType( QDomElement &domElementParent ) qDebug() << "Adding old self defined type: " << currentElement.text(); // add the type to the list of available types - KEduVocWordType* type = new KEduVocWordType(currentElement.text(), m_doc->wordTypeContainer()); + QmVocWordType* type = new QmVocWordType(currentElement.text(), m_doc->wordTypeContainer()); m_doc->wordTypeContainer()->appendChildContainer( type ); // from this the #1 are transformed to something sensible again @@ -641,7 +641,7 @@ bool KEduVocKvtmlReader::readType( QDomElement &domElementParent ) } -bool KEduVocKvtmlReader::readTense( QDomElement &domElementParent ) +bool QmVocKvtmlReader::readTense( QDomElement &domElementParent ) { QDomElement currentElement; @@ -655,7 +655,7 @@ bool KEduVocKvtmlReader::readTense( QDomElement &domElementParent ) } -bool KEduVocKvtmlReader::readComparison( QDomElement &domElementParent, KEduVocTranslation * translation ) +bool QmVocKvtmlReader::readComparison( QDomElement &domElementParent, QmVocTranslation * translation ) /* good --- this one is dead as it always has to be the word itself @@ -676,7 +676,7 @@ bool KEduVocKvtmlReader::readComparison( QDomElement &domElementParent, KEduVocT } -bool KEduVocKvtmlReader::readMultipleChoice( QDomElement &domElementParent, KEduVocTranslation* translation ) +bool QmVocKvtmlReader::readMultipleChoice( QDomElement &domElementParent, QmVocTranslation* translation ) /* good @@ -719,7 +719,7 @@ bool KEduVocKvtmlReader::readMultipleChoice( QDomElement &domElementParent, KEdu } -bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementExpressionChild, +bool QmVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementExpressionChild, QString &lang, grade_t &grade, grade_t &rev_grade, int &count, int &rev_count, @@ -860,7 +860,7 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE } -bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) +bool QmVocKvtmlReader::readExpression( QDomElement &domElementParent ) { grade_t grade; grade_t r_grade; @@ -909,7 +909,7 @@ bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) // so make sure this lesson is in the document qDebug() << "Warning: lesson > m_doc->lessonCount() in readExpression."; - KEduVocLesson* lesson = new KEduVocLesson( QString("Lesson %1").arg(lessonNumber) , m_doc->lesson()); + QmVocLesson* lesson = new QmVocLesson( QString("Lesson %1").arg(lessonNumber) , m_doc->lesson()); m_doc->lesson()->appendChildContainer(lesson); } } @@ -953,7 +953,7 @@ bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) return false; } - KEduVocExpression* entry = 0; + QmVocExpression* entry = 0; while ( !currentElement.isNull() ) { @@ -979,10 +979,10 @@ bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) textstr = currentElement.lastChild().toText().data(); if ( i == 0 ) { - entry = new KEduVocExpression( textstr ); + entry = new QmVocExpression( textstr ); entry->setActive( active ); if ( lessonNumber != -1 ) { - static_cast(m_doc->lesson()->childContainer(lessonNumber))->appendEntry(entry); + static_cast(m_doc->lesson()->childContainer(lessonNumber))->appendEntry(entry); } else { m_doc->lesson()->appendEntry(entry); } @@ -990,7 +990,7 @@ bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) entry->setTranslation( i, textstr ); } - if ( m_doc->lesson()->entries(KEduVocLesson::Recursive).count() == 1 ) { // this is because in kvtml the languages are saved in the FIRST ENTRY ONLY. + if ( m_doc->lesson()->entries(QmVocLesson::Recursive).count() == 1 ) { // this is because in kvtml the languages are saved in the FIRST ENTRY ONLY. // new translation if (!addLanguage(i, lang)) { return false; @@ -1020,7 +1020,7 @@ bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) } if ( !type.isEmpty() ) { - KEduVocWordType* wordType = m_compability.typeFromOldFormat(m_doc->wordTypeContainer(), type); + QmVocWordType* wordType = m_compability.typeFromOldFormat(m_doc->wordTypeContainer(), type); entry->translation(i)->setWordType(wordType); } @@ -1065,7 +1065,7 @@ bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent ) } -bool KEduVocKvtmlReader::addLanguage( int languageId, const QString& locale) +bool QmVocKvtmlReader::addLanguage( int languageId, const QString& locale) { if ( m_doc->identifierCount() <= languageId ) { m_doc->appendIdentifier(); @@ -1099,4 +1099,3 @@ bool KEduVocKvtmlReader::addLanguage( int languageId, const QString& locale) } -// #include "keduvockvtmlreader.moc" diff --git a/keduvockvtmlreader.h b/qmvockvtmlreader.h similarity index 79% rename from keduvockvtmlreader.h rename to qmvockvtmlreader.h index 61a7bd7..0a59ee5 100644 --- a/keduvockvtmlreader.h +++ b/qmvockvtmlreader.h @@ -3,13 +3,14 @@ ***************************************************************************/ /*************************************************************************** - read a KEduVocDocument from a KVTML file + read a QmVocDocument from a KVTML file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold (C) 2005 Eric Pignet (C) 2007 Peter Hedlund (C) 2007 Frederik Gladhorn + (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -21,32 +22,32 @@ * * ***************************************************************************/ -#ifndef KEDUVOCKVTMLREADER_H -#define KEDUVOCKVTMLREADER_H +#ifndef QMVOCKVTMLREADER_H +#define QMVOCKVTMLREADER_H #include #include -#include "keduvocexpression.h" -#include "keduvocarticle.h" -#include "keduvocmultiplechoice.h" -#include "keduvockvtmlcompability.h" -#include "keduvocpersonalpronoun.h" +#include "qmvocexpression.h" +#include "qmvocarticle.h" +#include "qmvocmultiplechoice.h" +#include "qmvockvtmlcompability.h" +#include "qmvocpersonalpronoun.h" class QIODevice; -class KEduVocDocument; +class QmVocDocument; /** @author Eric Pignet */ -class KEduVocKvtmlReader : public QObject +class QmVocKvtmlReader : public QObject { Q_OBJECT public: - KEduVocKvtmlReader( QIODevice *file ); + QmVocKvtmlReader( QIODevice *file ); - bool readDoc( KEduVocDocument *doc ); + bool readDoc( QmVocDocument *doc ); /** * Attempt to add a language/locale. Language/locale are set to the same value. @@ -59,14 +60,14 @@ public: bool readLesson( QDomElement &domElementParent ); bool readArticle( QDomElement &domElementParent ); - bool readPersonalPronouns( QDomElement &domElementParent, KEduVocPersonalPronoun& pronouns ); - bool readConjugation( QDomElement &domElementParent, KEduVocConjugation &conjugation ); - bool readTranslationConjugations( QDomElement &domElementParent, KEduVocTranslation* translation ); + bool readPersonalPronouns( QDomElement &domElementParent, QmVocPersonalPronoun& pronouns ); + bool readConjugation( QDomElement &domElementParent, QmVocConjugation &conjugation ); + bool readTranslationConjugations( QDomElement &domElementParent, QmVocTranslation* translation ); bool readType( QDomElement &domElementParent ); bool readTense( QDomElement &domElementParent ); bool readUsage( QDomElement &domElementParent ); - bool readComparison( QDomElement &domElementParent, KEduVocTranslation* translation ); - bool readMultipleChoice( QDomElement &domElementParent, KEduVocTranslation* translation ); + bool readComparison( QDomElement &domElementParent, QmVocTranslation* translation ); + bool readMultipleChoice( QDomElement &domElementParent, QmVocTranslation* translation ); bool readExpressionChildAttributes( QDomElement &domElementExpressionChild, QString &lang, grade_t &grade, grade_t &rev_grade, @@ -95,13 +96,13 @@ public: private: QIODevice *m_inputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; QString m_errorMessage; int m_cols; int m_lines; QStringList m_oldSelfDefinedTypes; - KEduVocKvtmlCompability m_compability; + QmVocKvtmlCompability m_compability; }; #endif diff --git a/keduvockvtmlwriter.cpp b/qmvockvtmlwriter.cpp similarity index 92% rename from keduvockvtmlwriter.cpp rename to qmvockvtmlwriter.cpp index ddc45b6..34f7188 100644 --- a/keduvockvtmlwriter.cpp +++ b/qmvockvtmlwriter.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - export a KEduVocDocument to a KVTML file + export a QmVocDocument to a KVTML file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold @@ -23,7 +23,7 @@ * * ***************************************************************************/ -#include "keduvockvtmlwriter.h" +#include "qmvockvtmlwriter.h" #include #include @@ -32,21 +32,21 @@ // #include #include -#include "keduvocdocument.h" -// #include "keduvocgrade.h" -#include "keduvoclesson.h" -#include "keduvocexpression.h" +#include "qmvocdocument.h" +// #include "qmvocgrade.h" +#include "qmvoclesson.h" +#include "qmvocexpression.h" #include "kvtmldefs.h" -#include "keduvoccommon_p.h" +#include "qmtvoccommon_p.h" -KEduVocKvtmlWriter::KEduVocKvtmlWriter( QFile *file ) +QmVocKvtmlWriter::QmVocKvtmlWriter( QFile *file ) { // the file must be already open m_outputFile = file; } -bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generator ) +bool QmVocKvtmlWriter::writeDoc( QmVocDocument *doc, const QString &generator ) { bool first_expr = true; @@ -80,7 +80,7 @@ bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generato if ( !writeArticle( domElementKvtml ) ) return false; - QList pronouns; + QList pronouns; for ( int i = 0; i < m_doc->identifierCount(); i++ ) pronouns.append( m_doc->identifier(i).personalPronouns() ); if ( pronouns.count() > 0 ) { @@ -103,7 +103,7 @@ bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generato int entryCount = m_doc->entryCount(); for ( int i = 0; i < entryCount; i++ ) { - KEduVocExpression *entry = m_doc->entry( i ); + QmVocExpression *entry = m_doc->entry( i ); QDomElement domElementExpression = m_domDoc.createElement( KV_EXPR ); if ( entry->lesson() != 0 ) { @@ -183,7 +183,7 @@ bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generato } else if ( entype == QM_ADJ && !entry->translation( 0 ).comparison().isEmpty() ) { - KEduVocComparison comp = entry->translation( 0 ).comparison(); + QmVocComparison comp = entry->translation( 0 ).comparison(); if ( !writeComparison(domElementOriginal, comp ) ) return false; } @@ -274,7 +274,7 @@ bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generato } if ( entype == QM_ADJ && !entry->translation( trans ).comparison().isEmpty() ) { - KEduVocComparison comp = entry->translation( trans ).comparison(); + QmVocComparison comp = entry->translation( trans ).comparison(); if ( !writeComparison(domElementTranslation, comp ) ) return false; } @@ -300,7 +300,7 @@ bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generato } -bool KEduVocKvtmlWriter::writeLesson( QDomElement &domElementParent ) +bool QmVocKvtmlWriter::writeLesson( QDomElement &domElementParent ) { if ( m_doc->lessonCount() == 0 ) return true; @@ -328,7 +328,7 @@ bool KEduVocKvtmlWriter::writeLesson( QDomElement &domElementParent ) } -bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) +bool QmVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) /*
lang determines also lang order in entries !! @@ -355,7 +355,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) QString articleString; // female - articleString = m_doc->identifier(i).article().article( KEduVocWordFlag::Singular | KEduVocWordFlag::Definite | KEduVocWordFlag::Feminine ); + articleString = m_doc->identifier(i).article().article( QmVocWordFlag::Singular | QmVocWordFlag::Definite | QmVocWordFlag::Feminine ); if ( !articleString.isEmpty() ) { QDomElement domElementFD = m_domDoc.createElement( KV_ART_FD ); QDomText domTextFD = m_domDoc.createTextNode( articleString ); @@ -363,7 +363,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) domElementFD.appendChild( domTextFD ); domElementEntry.appendChild( domElementFD ); } - articleString = m_doc->identifier(i).article().article( KEduVocWordFlag::Singular | KEduVocWordFlag::Indefinite | KEduVocWordFlag::Feminine ); + articleString = m_doc->identifier(i).article().article( QmVocWordFlag::Singular | QmVocWordFlag::Indefinite | QmVocWordFlag::Feminine ); if ( !articleString.isEmpty() ) { QDomElement domElementFI = m_domDoc.createElement( KV_ART_FI ); QDomText domTextFI = m_domDoc.createTextNode( articleString ); @@ -374,7 +374,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) // male - articleString = m_doc->identifier(i).article().article( KEduVocWordFlag::Singular | KEduVocWordFlag::Definite | KEduVocWordFlag::Masculine ); + articleString = m_doc->identifier(i).article().article( QmVocWordFlag::Singular | QmVocWordFlag::Definite | QmVocWordFlag::Masculine ); if ( !articleString.isEmpty() ) { QDomElement domElementMD = m_domDoc.createElement( KV_ART_MD ); QDomText domTextMD = m_domDoc.createTextNode( articleString ); @@ -382,7 +382,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) domElementMD.appendChild( domTextMD ); domElementEntry.appendChild( domElementMD ); } - articleString = m_doc->identifier(i).article().article( KEduVocWordFlag::Singular | KEduVocWordFlag::Indefinite | KEduVocWordFlag::Masculine ); + articleString = m_doc->identifier(i).article().article( QmVocWordFlag::Singular | QmVocWordFlag::Indefinite | QmVocWordFlag::Masculine ); if ( !articleString.isEmpty() ) { QDomElement domElementMI = m_domDoc.createElement( KV_ART_MI ); QDomText domTextMI = m_domDoc.createTextNode( articleString ); @@ -392,7 +392,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) } // neutral - articleString = m_doc->identifier(i).article().article( KEduVocWordFlag::Singular | KEduVocWordFlag::Definite | KEduVocWordFlag::Neutral ); + articleString = m_doc->identifier(i).article().article( QmVocWordFlag::Singular | QmVocWordFlag::Definite | QmVocWordFlag::Neutral ); if ( !articleString.isEmpty() ) { QDomElement domElementND = m_domDoc.createElement( KV_ART_ND ); QDomText domTextND = m_domDoc.createTextNode( articleString ); @@ -400,7 +400,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) domElementND.appendChild( domTextND ); domElementEntry.appendChild( domElementND ); } - articleString = m_doc->identifier(i).article().article( KEduVocWordFlag::Singular | KEduVocWordFlag::Indefinite | KEduVocWordFlag::Neutral ); + articleString = m_doc->identifier(i).article().article( QmVocWordFlag::Singular | QmVocWordFlag::Indefinite | QmVocWordFlag::Neutral ); if ( !articleString.isEmpty() ) { QDomElement domElementNI = m_domDoc.createElement( KV_ART_NI ); QDomText domTextNI = m_domDoc.createTextNode( articleString ); @@ -417,7 +417,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent ) } -bool KEduVocKvtmlWriter::writeType( QDomElement &domElementParent ) +bool QmVocKvtmlWriter::writeType( QDomElement &domElementParent ) { /** @todo port to new type handling */ /* @@ -447,7 +447,7 @@ bool KEduVocKvtmlWriter::writeType( QDomElement &domElementParent ) } /* -bool KEduVocKvtmlWriter::writeTense( QDomElement &domElementParent ) +bool QmVocKvtmlWriter::writeTense( QDomElement &domElementParent ) { if ( m_doc->tenseDescriptions().count() == 0 ) return true; @@ -472,7 +472,7 @@ bool KEduVocKvtmlWriter::writeTense( QDomElement &domElementParent ) } */ -bool KEduVocKvtmlWriter::writeUsage( QDomElement &domElementParent ) +bool QmVocKvtmlWriter::writeUsage( QDomElement &domElementParent ) { ///@todo usages @@ -503,7 +503,7 @@ bool KEduVocKvtmlWriter::writeUsage( QDomElement &domElementParent ) } -bool KEduVocKvtmlWriter::writeComparison( QDomElement &domElementParent, const KEduVocTranslation* translation ) +bool QmVocKvtmlWriter::writeComparison( QDomElement &domElementParent, const QmVocTranslation* translation ) /* good @@ -547,7 +547,7 @@ bool KEduVocKvtmlWriter::writeComparison( QDomElement &domElementParent, const K } -bool KEduVocKvtmlWriter::writeMultipleChoice( QDomElement &domElementParent, const KEduVocMultipleChoice &mc ) +bool QmVocKvtmlWriter::writeMultipleChoice( QDomElement &domElementParent, const QmVocMultipleChoice &mc ) /* good @@ -608,7 +608,7 @@ bool KEduVocKvtmlWriter::writeMultipleChoice( QDomElement &domElementParent, con } -bool KEduVocKvtmlWriter::writeConjugHeader( QDomElement &domElementParent, QList &curr_conjug ) +bool QmVocKvtmlWriter::writeConjugHeader( QDomElement &domElementParent, QList &curr_conjug ) { /* used in header for definiton of "prefix" @@ -654,7 +654,7 @@ bool KEduVocKvtmlWriter::writeConjugHeader( QDomElement &domElementParent, QList } -bool KEduVocKvtmlWriter::writeConjugEntry( QDomElement &domElementParent, KEduVocTranslation &translation ) +bool QmVocKvtmlWriter::writeConjugEntry( QDomElement &domElementParent, QmVocTranslation &translation ) /* in entry for definition of tenses of (irreg.) verbs @@ -692,7 +692,7 @@ bool KEduVocKvtmlWriter::writeConjugEntry( QDomElement &domElementParent, KEduVo } -bool KEduVocKvtmlWriter::writeConjug( QDomElement &domElementParent, const KEduVocConjugation &curr_conjug, const QString &type ) +bool QmVocKvtmlWriter::writeConjug( QDomElement &domElementParent, const QmVocConjugation &curr_conjug, const QString &type ) { ///@todo if we are to enable the writer: port this! /* @@ -787,7 +787,7 @@ bool KEduVocKvtmlWriter::writeConjug( QDomElement &domElementParent, const KEduV return false; } -bool KEduVocKvtmlWriter::writePersonalPronouns( QDomElement &domElementParent, QList &curr_conjug ) +bool QmVocKvtmlWriter::writePersonalPronouns( QDomElement &domElementParent, QList &curr_conjug ) { /* used in header for definiton of "prefix" @@ -834,17 +834,17 @@ bool KEduVocKvtmlWriter::writePersonalPronouns( QDomElement &domElementParent, Q } -bool KEduVocKvtmlWriter::writePersonalPronounChild( QDomElement &domElementParent, const KEduVocPersonalPronoun &curr_conjug ) +bool QmVocKvtmlWriter::writePersonalPronounChild( QDomElement &domElementParent, const QmVocPersonalPronoun &curr_conjug ) { // the old stuff only has singular - const KEduVocWordFlag::ConjugationNumber num = KEduVocWordFlag::Singular; + const QmVocWordFlag::ConjugationNumber num = QmVocWordFlag::Singular; - if ( !curr_conjug.personalPronoun( KEduVocWordFlag::First, num ).isEmpty() ) { - domElementParent.appendChild( newTextElement( KV_CON_P1S, curr_conjug.personalPronoun( KEduVocWordFlag::First, num ) ) ); + if ( !curr_conjug.personalPronoun( QmVocWordFlag::First, num ).isEmpty() ) { + domElementParent.appendChild( newTextElement( KV_CON_P1S, curr_conjug.personalPronoun( QmVocWordFlag::First, num ) ) ); } - if ( !curr_conjug.personalPronoun( KEduVocWordFlag::Second, num ).isEmpty() ) { - domElementParent.appendChild( newTextElement( KV_CON_P2S, curr_conjug.personalPronoun( KEduVocWordFlag::Second, num ) ) ); + if ( !curr_conjug.personalPronoun( QmVocWordFlag::Second, num ).isEmpty() ) { + domElementParent.appendChild( newTextElement( KV_CON_P2S, curr_conjug.personalPronoun( QmVocWordFlag::Second, num ) ) ); } ///@todo if the writer ever becomes enabled, write the other pronouns @@ -930,7 +930,7 @@ bool KEduVocKvtmlWriter::writePersonalPronounChild( QDomElement &domElementParen return true; } -QDomElement KEduVocKvtmlWriter::newTextElement( const QString &elementName, const QString &text ) +QDomElement QmVocKvtmlWriter::newTextElement( const QString &elementName, const QString &text ) { QDomElement retval = m_domDoc.createElement( elementName ); QDomText textNode = m_domDoc.createTextNode( text ); diff --git a/keduvockvtmlwriter.h b/qmvockvtmlwriter.h similarity index 68% rename from keduvockvtmlwriter.h rename to qmvockvtmlwriter.h index 2398c8a..b062950 100644 --- a/keduvockvtmlwriter.h +++ b/qmvockvtmlwriter.h @@ -3,13 +3,14 @@ ***************************************************************************/ /*************************************************************************** - export a KEduVocDocument to a KVTML file + export a QmVocDocument to a KVTML file ----------------------------------------------------------------------- copyright : (C) 1999-2001 Ewald Arnold (C) 2005 Eric Pignet (C) 2007 Peter Hedlund (C) 2007 Frederik Gladhorn + (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -21,31 +22,31 @@ * * ***************************************************************************/ -#ifndef KEDUVOCKVTMLWRITER_H -#define KEDUVOCKVTMLWRITER_H +#ifndef QMVOCKVTMLWRITER_H +#define QMVOCKVTMLWRITER_H #include #include #include -#include "keduvocarticle.h" -#include "keduvocpersonalpronoun.h" -#include "keduvocconjugation.h" -#include "keduvocmultiplechoice.h" -#include "keduvockvtmlcompability.h" -#include "keduvoctranslation.h" +#include "qmvocarticle.h" +#include "qmvocpersonalpronoun.h" +#include "qmvocconjugation.h" +#include "qmvocmultiplechoice.h" +#include "qmvockvtmlcompability.h" +#include "qmvoctranslation.h" -class KEduVocDocument; +class QmVocDocument; /** @author Eric Pignet */ -class KEduVocKvtmlWriter +class QmVocKvtmlWriter { public: - KEduVocKvtmlWriter( QFile *file ); + QmVocKvtmlWriter( QFile *file ); - bool writeDoc( KEduVocDocument *doc, const QString &generator ); + bool writeDoc( QmVocDocument *doc, const QString &generator ); private: bool writeLesson( QDomElement &domElementParent ); @@ -55,23 +56,23 @@ private: bool writeOption( QDomElement &domElementParent ); bool writeArticle( QDomElement &domElementParent ); - bool writePersonalPronouns( QDomElement &domElementParent, QList &curr_conjug ); - bool writePersonalPronounChild( QDomElement &domElementParent, const KEduVocPersonalPronoun &curr_conjug ); + bool writePersonalPronouns( QDomElement &domElementParent, QList &curr_conjug ); + bool writePersonalPronounChild( QDomElement &domElementParent, const QmVocPersonalPronoun &curr_conjug ); - bool writeConjugHeader( QDomElement &domElementParent, QList &curr_conjug ); - bool writeConjug( QDomElement &domElementParent, const KEduVocConjugation &curr_conjug, const QString &type ); - bool writeConjugEntry( QDomElement &domElementParent, KEduVocTranslation &translation ); - bool writeComparison( QDomElement &domElementParent, KEduVocTranslation* translation ); - bool writeMultipleChoice( QDomElement &domElementParent, const KEduVocMultipleChoice &mc ); + bool writeConjugHeader( QDomElement &domElementParent, QList &curr_conjug ); + bool writeConjug( QDomElement &domElementParent, const QmVocConjugation &curr_conjug, const QString &type ); + bool writeConjugEntry( QDomElement &domElementParent, QmVocTranslation &translation ); + bool writeComparison( QDomElement &domElementParent, QmVocTranslation* translation ); + bool writeMultipleChoice( QDomElement &domElementParent, const QmVocMultipleChoice &mc ); QDomElement newTextElement( const QString &elementName, const QString &text ); QFile *m_outputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; QDomDocument m_domDoc; - KEduVocKvtmlCompability m_compability; + QmVocKvtmlCompability m_compability; }; #endif diff --git a/keduvocleitnerbox.cpp b/qmvocleitnerbox.cpp similarity index 75% rename from keduvocleitnerbox.cpp rename to qmvocleitnerbox.cpp index f225197..d031a98 100644 --- a/keduvocleitnerbox.cpp +++ b/qmvocleitnerbox.cpp @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -15,49 +16,49 @@ * * ***************************************************************************/ -#include "keduvocleitnerbox.h" +#include "qmvocleitnerbox.h" -#include "keduvocexpression.h" +#include "qmvocexpression.h" #include -class KEduVocLeitnerBox::Private +class QmVocLeitnerBox::Private { public: // cache the entries - QList m_expressions; + QList m_expressions; // list of translations - QList m_translations; + QList m_translations; }; -KEduVocLeitnerBox::KEduVocLeitnerBox(const QString& name, KEduVocLeitnerBox *parent) - : KEduVocContainer(name, Leitner, parent), d( new Private ) +QmVocLeitnerBox::QmVocLeitnerBox(const QString& name, QmVocLeitnerBox *parent) + : QmVocContainer(name, Leitner, parent), d( new Private ) { // only one top level and children, this is only a list Q_ASSERT(!parent || !parent->parent()); } -KEduVocLeitnerBox::~KEduVocLeitnerBox() +QmVocLeitnerBox::~QmVocLeitnerBox() { - foreach(KEduVocTranslation* translation, d->m_translations) { + foreach(QmVocTranslation* translation, d->m_translations) { translation->setLeitnerBox(0); } delete d; } -QList KEduVocLeitnerBox::entries(EnumEntriesRecursive recursive) +QList QmVocLeitnerBox::entries(EnumEntriesRecursive recursive) { Q_UNUSED(recursive) return d->m_expressions; } -int KEduVocLeitnerBox::entryCount(EnumEntriesRecursive recursive) +int QmVocLeitnerBox::entryCount(EnumEntriesRecursive recursive) { Q_UNUSED(recursive) return d->m_expressions.count(); } -void KEduVocLeitnerBox::addTranslation(KEduVocTranslation* translation) +void QmVocLeitnerBox::addTranslation(QmVocTranslation* translation) { // add to expression - if not already there because another translation of the same word is there. bool found = false; @@ -74,7 +75,7 @@ void KEduVocLeitnerBox::addTranslation(KEduVocTranslation* translation) invalidateChildLessonEntries(); } -void KEduVocLeitnerBox::removeTranslation(KEduVocTranslation* translation) +void QmVocLeitnerBox::removeTranslation(QmVocTranslation* translation) { int index = d->m_translations.indexOf(translation); d->m_translations.removeAt(index); @@ -102,12 +103,12 @@ void KEduVocLeitnerBox::removeTranslation(KEduVocTranslation* translation) invalidateChildLessonEntries(); } -KEduVocTranslation * KEduVocLeitnerBox::translation(int row) +QmVocTranslation * QmVocLeitnerBox::translation(int row) { return d->m_translations.value(row); } -KEduVocExpression * KEduVocLeitnerBox::entry(int row, EnumEntriesRecursive recursive) +QmVocExpression * QmVocLeitnerBox::entry(int row, EnumEntriesRecursive recursive) { Q_UNUSED(recursive) return entries().value(row); diff --git a/keduvocleitnerbox.h b/qmvocleitnerbox.h similarity index 72% rename from keduvocleitnerbox.h rename to qmvocleitnerbox.h index 8b20714..92bfcbe 100644 --- a/keduvocleitnerbox.h +++ b/qmvocleitnerbox.h @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -15,46 +16,46 @@ * * ***************************************************************************/ -#ifndef KEDUVOCLEITNERBOX_H -#define KEDUVOCLEITNERBOX_H +#ifndef QMVOCLEITNERBOX_H +#define QMVOCLEITNERBOX_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvoccontainer.h" +#include "qmvoccontainer.h" #include #include -class KEduVocExpression; -class KEduVocTranslation; +class QmVocExpression; +class QmVocTranslation; /** * Leitner Boxes are an alternative grading system. * Classically flash cards are kept in boxes and moved corresponding to the users knowledge level. */ -class KEDUVOCDOCUMENT_EXPORT KEduVocLeitnerBox :public KEduVocContainer +class QMVOCDOCUMENT_EXPORT QmVocLeitnerBox :public QmVocContainer { public: /** default constructor */ - explicit KEduVocLeitnerBox(const QString& name, KEduVocLeitnerBox *parent = 0); + explicit QmVocLeitnerBox(const QString& name, QmVocLeitnerBox *parent = 0); /** destructor */ - ~KEduVocLeitnerBox(); + ~QmVocLeitnerBox(); /** * The leitner box class keeps track of individual translations, because for one entry, the translations can have different grades. * @param row * @return */ - KEduVocTranslation * translation(int row); + QmVocTranslation * translation(int row); /** * get a list of all entries in the box * @return */ - QList < KEduVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive); + QList < QmVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive); - KEduVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive); + QmVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive); /** get the number of entries in the lesson */ int entryCount(EnumEntriesRecursive recursive = NotRecursive); @@ -66,14 +67,14 @@ private: /** add an entry to the lesson * @param entryid id of the entry to add */ - void addTranslation(KEduVocTranslation* translation); + void addTranslation(QmVocTranslation* translation); /** remove an entry from the lesson * @param entryid id of the entry to remove */ - void removeTranslation(KEduVocTranslation* translation); + void removeTranslation(QmVocTranslation* translation); - friend class KEduVocTranslation; + friend class QmVocTranslation; }; #endif diff --git a/keduvoclesson.cpp b/qmvoclesson.cpp similarity index 71% rename from keduvoclesson.cpp rename to qmvoclesson.cpp index a8e9db4..4327ca7 100644 --- a/keduvoclesson.cpp +++ b/qmvoclesson.cpp @@ -6,6 +6,7 @@ Copyright 2007 Jeremy Whiting Copyright 2007 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,41 +19,41 @@ * * ***************************************************************************/ -#include "keduvoclesson.h" +#include "qmvoclesson.h" -#include "keduvocexpression.h" +#include "qmvocexpression.h" #include /** private class to store information about a lesson */ -class KEduVocLesson::Private +class QmVocLesson::Private { public: // entries - QList m_entries; + QList m_entries; }; -KEduVocLesson::KEduVocLesson(const QString& name, KEduVocContainer *parent) - : KEduVocContainer(name, Lesson, parent), d( new Private ) +QmVocLesson::QmVocLesson(const QString& name, QmVocContainer *parent) + : QmVocContainer(name, Lesson, parent), d( new Private ) { } -KEduVocLesson::KEduVocLesson( const KEduVocLesson &other ) - : KEduVocContainer(other), d( new Private ) +QmVocLesson::QmVocLesson( const QmVocLesson &other ) + : QmVocContainer(other), d( new Private ) { d->m_entries = other.d->m_entries; } -KEduVocLesson::~KEduVocLesson() +QmVocLesson::~QmVocLesson() { qDeleteAll(d->m_entries); delete d; } -QList KEduVocLesson::entries(EnumEntriesRecursive recursive) +QList QmVocLesson::entries(EnumEntriesRecursive recursive) { if (recursive == Recursive) { return entriesRecursive(); @@ -60,7 +61,7 @@ QList KEduVocLesson::entries(EnumEntriesRecursive recursive) return d->m_entries; } -int KEduVocLesson::entryCount(EnumEntriesRecursive recursive) +int QmVocLesson::entryCount(EnumEntriesRecursive recursive) { if (recursive == Recursive) { return entriesRecursive().count(); @@ -68,12 +69,12 @@ int KEduVocLesson::entryCount(EnumEntriesRecursive recursive) return d->m_entries.count(); } -void KEduVocLesson::appendEntry(KEduVocExpression* entry) +void QmVocLesson::appendEntry(QmVocExpression* entry) { insertEntry(d->m_entries.size(), entry); } -void KEduVocLesson::insertEntry(int index, KEduVocExpression * entry) +void QmVocLesson::insertEntry(int index, QmVocExpression * entry) { Q_ASSERT(entry); d->m_entries.insert( index, entry ); @@ -81,7 +82,7 @@ void KEduVocLesson::insertEntry(int index, KEduVocExpression * entry) invalidateChildLessonEntries(); } -void KEduVocLesson::removeEntry(KEduVocExpression* entry) +void QmVocLesson::removeEntry(QmVocExpression* entry) { Q_ASSERT(entry); if (d->m_entries.indexOf(entry) == -1) { @@ -92,7 +93,7 @@ void KEduVocLesson::removeEntry(KEduVocExpression* entry) invalidateChildLessonEntries(); } -KEduVocExpression * KEduVocLesson::entry(int row, EnumEntriesRecursive recursive) +QmVocExpression * QmVocLesson::entry(int row, EnumEntriesRecursive recursive) { if (recursive == Recursive) { return entriesRecursive().value(row); diff --git a/keduvoclesson.h b/qmvoclesson.h similarity index 67% rename from keduvoclesson.h rename to qmvoclesson.h index a51fba1..1e175dc 100644 --- a/keduvoclesson.h +++ b/qmvoclesson.h @@ -6,6 +6,7 @@ Copyright 2007 Jeremy Whiting Copyright 2007 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,45 +19,45 @@ * * ***************************************************************************/ -#ifndef KEDUVOCLESSON_H -#define KEDUVOCLESSON_H +#ifndef QMVOCLESSON_H +#define QMVOCLESSON_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvoccontainer.h" +#include "qmvoccontainer.h" -class KEduVocExpression; +class QmVocExpression; /** class to store information about a lesson */ -class KEDUVOCDOCUMENT_EXPORT KEduVocLesson :public KEduVocContainer +class QMVOCDOCUMENT_EXPORT QmVocLesson :public QmVocContainer { public: /** default constructor */ - explicit KEduVocLesson(const QString& name, KEduVocContainer *parent = 0); + explicit QmVocLesson(const QString& name, QmVocContainer *parent = 0); -// void appendChildLesson(KEduVocLesson *child); +// void appendChildLesson(QmVocLesson *child); -// QList childLessons(); -// KEduVocLesson *childLesson(int row); +// QList childLessons(); +// QmVocLesson *childLesson(int row); // int childLessonCount() const; // int row() const; -// KEduVocLesson *parent(); +// QmVocLesson *parent(); /** copy constructor for d-pointer safe copying */ - KEduVocLesson( const KEduVocLesson &other ); + QmVocLesson( const QmVocLesson &other ); /** destructor */ - ~KEduVocLesson(); + ~QmVocLesson(); /** assignment operator */ - KEduVocLesson& operator= ( const KEduVocLesson& ); + QmVocLesson& operator= ( const QmVocLesson& ); - KEduVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive); + QmVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive); /** get a list of all entries in the lesson */ - QList < KEduVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive); + QList < QmVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive); /** get the number of entries in the lesson */ int entryCount(EnumEntriesRecursive recursive = NotRecursive); @@ -64,19 +65,19 @@ public: /** append an entry to the lesson * @param entryid id of the entry to add */ - void appendEntry(KEduVocExpression* entry); + void appendEntry(QmVocExpression* entry); /** * insert an entry at a specific position * @param index * @param entry */ - void insertEntry(int index, KEduVocExpression* entry); + void insertEntry(int index, QmVocExpression* entry); /** remove an entry from the lesson * @param entryid id of the entry to remove */ - void removeEntry(KEduVocExpression* entry); + void removeEntry(QmVocExpression* entry); private: class Private; diff --git a/keduvocmultiplechoice.cpp b/qmvocmultiplechoice.cpp similarity index 67% rename from keduvocmultiplechoice.cpp rename to qmvocmultiplechoice.cpp index f2df9fb..c655437 100644 --- a/keduvocmultiplechoice.cpp +++ b/qmvocmultiplechoice.cpp @@ -13,6 +13,8 @@ copyright : (C) 1999-2001 Ewald Arnold (C) 2005 Peter Hedlund + + (C) 2010 Reto Zingg ----------------------------------------------------------------------- @@ -27,26 +29,26 @@ * * ***************************************************************************/ -#include "keduvocmultiplechoice.h" +#include "qmvocmultiplechoice.h" -class KEduVocMultipleChoice::KEduVocMultipleChoicePrivate +class QmVocMultipleChoice::QmVocMultipleChoicePrivate { public: QStringList m_choices; }; -KEduVocMultipleChoice::KEduVocMultipleChoice() - : d( new KEduVocMultipleChoicePrivate ) +QmVocMultipleChoice::QmVocMultipleChoice() + : d( new QmVocMultipleChoicePrivate ) {} -KEduVocMultipleChoice::KEduVocMultipleChoice( const KEduVocMultipleChoice &other ) - : d( new KEduVocMultipleChoicePrivate ) +QmVocMultipleChoice::QmVocMultipleChoice( const QmVocMultipleChoice &other ) + : d( new QmVocMultipleChoicePrivate ) { d->m_choices = other.choices(); } -KEduVocMultipleChoice::KEduVocMultipleChoice( const QStringList &choices ) - : d( new KEduVocMultipleChoicePrivate ) +QmVocMultipleChoice::QmVocMultipleChoice( const QStringList &choices ) + : d( new QmVocMultipleChoicePrivate ) { foreach ( const QString &choice, choices ) { // use appendChoice to check for empty entries @@ -54,35 +56,35 @@ KEduVocMultipleChoice::KEduVocMultipleChoice( const QStringList &choices ) } } -KEduVocMultipleChoice::~KEduVocMultipleChoice() +QmVocMultipleChoice::~QmVocMultipleChoice() { delete d; } -KEduVocMultipleChoice &KEduVocMultipleChoice::operator= ( const KEduVocMultipleChoice &other ) +QmVocMultipleChoice &QmVocMultipleChoice::operator= ( const QmVocMultipleChoice &other ) { d->m_choices = other.choices(); return *this; } -QStringList KEduVocMultipleChoice::choices() const +QStringList QmVocMultipleChoice::choices() const { return d->m_choices; } -bool KEduVocMultipleChoice::isEmpty() const +bool QmVocMultipleChoice::isEmpty() const { return d->m_choices.isEmpty(); } -void KEduVocMultipleChoice::clear() +void QmVocMultipleChoice::clear() { d->m_choices.clear(); } -QString KEduVocMultipleChoice::choice( int index ) const +QString QmVocMultipleChoice::choice( int index ) const { QString choice; if ( d->m_choices.size() > index ) { @@ -91,17 +93,17 @@ QString KEduVocMultipleChoice::choice( int index ) const return choice; } -unsigned KEduVocMultipleChoice::size() const +unsigned QmVocMultipleChoice::size() const { return d->m_choices.size(); } -bool KEduVocMultipleChoice::operator== ( const KEduVocMultipleChoice &choice ) const +bool QmVocMultipleChoice::operator== ( const QmVocMultipleChoice &choice ) const { return d->m_choices == choice.choices(); } -void KEduVocMultipleChoice::appendChoice( const QString &s ) +void QmVocMultipleChoice::appendChoice( const QString &s ) { if ( !s.isEmpty() ) { d->m_choices.append( s ); diff --git a/keduvocmultiplechoice.h b/qmvocmultiplechoice.h similarity index 74% rename from keduvocmultiplechoice.h rename to qmvocmultiplechoice.h index c15f169..89ab46d 100644 --- a/keduvocmultiplechoice.h +++ b/qmvocmultiplechoice.h @@ -14,6 +14,8 @@ (C) 2005 Peter Hedlund + (C) 2010 Reto Zingg + ----------------------------------------------------------------------- ***************************************************************************/ @@ -28,21 +30,21 @@ ***************************************************************************/ -#ifndef KEDUVOCMULTIPLECHOICE_H -#define KEDUVOCMULTIPLECHOICE_H +#ifndef QMVOCMULTIPLECHOICE_H +#define QMVOCMULTIPLECHOICE_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" #include -class KEDUVOCDOCUMENT_EXPORT KEduVocMultipleChoice +class QMVOCDOCUMENT_EXPORT QmVocMultipleChoice { public: - KEduVocMultipleChoice(); - KEduVocMultipleChoice( const KEduVocMultipleChoice &other ); - KEduVocMultipleChoice( const QStringList &choices ); + QmVocMultipleChoice(); + QmVocMultipleChoice( const QmVocMultipleChoice &other ); + QmVocMultipleChoice( const QStringList &choices ); - ~KEduVocMultipleChoice(); + ~QmVocMultipleChoice(); QStringList choices() const; void appendChoice( const QString &s ); @@ -53,13 +55,13 @@ public: void clear(); unsigned size() const; - bool operator== ( const KEduVocMultipleChoice &choice ) const; + bool operator== ( const QmVocMultipleChoice &choice ) const; - KEduVocMultipleChoice &operator= ( const KEduVocMultipleChoice &other ); + QmVocMultipleChoice &operator= ( const QmVocMultipleChoice &other ); private: - class KEduVocMultipleChoicePrivate; - KEduVocMultipleChoicePrivate * const d; + class QmVocMultipleChoicePrivate; + QmVocMultipleChoicePrivate * const d; }; diff --git a/keduvocpaukerreader.cpp b/qmvocpaukerreader.cpp similarity index 83% rename from keduvocpaukerreader.cpp rename to qmvocpaukerreader.cpp index 2746aa6..ab94b02 100644 --- a/keduvocpaukerreader.cpp +++ b/qmvocpaukerreader.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - create a KEduVocDocument from a Pauker file + create a QmVocDocument from a Pauker file ----------------------------------------------------------------------- copyright : (C) 2004, 2007 Peter Hedlund (C) 2010 Reto Zingg @@ -19,23 +19,23 @@ * * ***************************************************************************/ -#include "keduvocpaukerreader.h" +#include "qmvocpaukerreader.h" #include // #include -#include "keduvocexpression.h" -#include "keduvoclesson.h" -#include "keduvocdocument.h" +#include "qmvocexpression.h" +#include "qmvoclesson.h" +#include "qmvocdocument.h" -KEduVocPaukerReader::KEduVocPaukerReader( KEduVocDocument * doc ) +QmVocPaukerReader::QmVocPaukerReader( QmVocDocument * doc ) { m_doc = doc; } -bool KEduVocPaukerReader::read( QIODevice * device ) +bool QmVocPaukerReader::read( QIODevice * device ) { setDevice( device ); @@ -54,7 +54,7 @@ bool KEduVocPaukerReader::read( QIODevice * device ) } -void KEduVocPaukerReader::readUnknownElement() +void QmVocPaukerReader::readUnknownElement() { while ( !atEnd() ) { readNext(); @@ -68,7 +68,7 @@ void KEduVocPaukerReader::readUnknownElement() } -void KEduVocPaukerReader::readPauker() +void QmVocPaukerReader::readPauker() { m_doc->setAuthor( "http://pauker.sf.net" ); ///Pauker does not provide any column titles @@ -93,7 +93,7 @@ void KEduVocPaukerReader::readPauker() } -void KEduVocPaukerReader::readBatch() +void QmVocPaukerReader::readBatch() { while ( !atEnd() ) { readNext(); @@ -111,7 +111,7 @@ void KEduVocPaukerReader::readBatch() } -void KEduVocPaukerReader::readCard() +void QmVocPaukerReader::readCard() { QString front; QString back; @@ -132,15 +132,15 @@ void KEduVocPaukerReader::readCard() } } - KEduVocLesson* lesson = new KEduVocLesson("Vocabulary", m_doc->lesson()); + QmVocLesson* lesson = new QmVocLesson("Vocabulary", m_doc->lesson()); m_doc->lesson()->appendChildContainer(lesson); - KEduVocExpression* expr = new KEduVocExpression( QStringList() << front << back); + QmVocExpression* expr = new QmVocExpression( QStringList() << front << back); lesson->appendEntry( expr ); } -QString KEduVocPaukerReader::readText() +QString QmVocPaukerReader::readText() { QString result; diff --git a/keduvocpaukerreader.h b/qmvocpaukerreader.h similarity index 81% rename from keduvocpaukerreader.h rename to qmvocpaukerreader.h index 34c8411..ecfcafe 100644 --- a/keduvocpaukerreader.h +++ b/qmvocpaukerreader.h @@ -3,9 +3,10 @@ ***************************************************************************/ /*************************************************************************** - create a KEduVocDocument from a Pauker file + create a QmVocDocument from a Pauker file ----------------------------------------------------------------------- copyright : (C) 2004, 2007 Peter Hedlund + Copyright : (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,18 +19,18 @@ * * ***************************************************************************/ -#ifndef KEDUVOCPAUKERREADER_H -#define KEDUVOCPAUKERREADER_H +#ifndef QMVOCPAUKERREADER_H +#define QMVOCPAUKERREADER_H #include class QIODevice; -class KEduVocDocument; +class QmVocDocument; -class KEduVocPaukerReader : public QXmlStreamReader +class QmVocPaukerReader : public QXmlStreamReader { public: - KEduVocPaukerReader( KEduVocDocument *doc ); + QmVocPaukerReader( QmVocDocument *doc ); bool read( QIODevice *device ); @@ -40,7 +41,7 @@ private: void readCard(); QString readText(); - KEduVocDocument *m_doc; + QmVocDocument *m_doc; }; #endif diff --git a/keduvocpersonalpronoun.cpp b/qmvocpersonalpronoun.cpp similarity index 59% rename from keduvocpersonalpronoun.cpp rename to qmvocpersonalpronoun.cpp index 9bfd9aa..0120a48 100644 --- a/keduvocpersonalpronoun.cpp +++ b/qmvocpersonalpronoun.cpp @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2007 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -15,12 +16,12 @@ * * ***************************************************************************/ -#include "keduvocpersonalpronoun.h" -#include "keduvoccommon_p.h" +#include "qmvocpersonalpronoun.h" +#include "qmvoccommon_p.h" #include -class KEduVocPersonalPronoun::Private +class QmVocPersonalPronoun::Private { public: Private(); @@ -28,23 +29,23 @@ public: bool m_maleFemaleDifferent; bool m_neutralExists; bool m_dualExists; - QMap m_personalpronouns; + QMap m_personalpronouns; }; -KEduVocPersonalPronoun::Private::Private() +QmVocPersonalPronoun::Private::Private() { m_maleFemaleDifferent = false; m_neutralExists = false; m_dualExists = false; } -KEduVocPersonalPronoun::KEduVocPersonalPronoun() +QmVocPersonalPronoun::QmVocPersonalPronoun() : d( new Private ) {} -KEduVocPersonalPronoun::KEduVocPersonalPronoun( const KEduVocPersonalPronoun& other ) +QmVocPersonalPronoun::QmVocPersonalPronoun( const QmVocPersonalPronoun& other ) : d( new Private ) { d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent; @@ -54,13 +55,13 @@ KEduVocPersonalPronoun::KEduVocPersonalPronoun( const KEduVocPersonalPronoun& ot } -KEduVocPersonalPronoun::~KEduVocPersonalPronoun() +QmVocPersonalPronoun::~QmVocPersonalPronoun() { delete d; } -KEduVocPersonalPronoun& KEduVocPersonalPronoun::operator = ( const KEduVocPersonalPronoun& other ) +QmVocPersonalPronoun& QmVocPersonalPronoun::operator = ( const QmVocPersonalPronoun& other ) { d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent; d->m_neutralExists = other.d->m_neutralExists; @@ -70,7 +71,7 @@ KEduVocPersonalPronoun& KEduVocPersonalPronoun::operator = ( const KEduVocPerson } -bool KEduVocPersonalPronoun::operator ==(const KEduVocPersonalPronoun& other) const +bool QmVocPersonalPronoun::operator ==(const QmVocPersonalPronoun& other) const { return d->m_personalpronouns == other.d->m_personalpronouns && d->m_maleFemaleDifferent == other.d->m_maleFemaleDifferent && @@ -79,50 +80,50 @@ bool KEduVocPersonalPronoun::operator ==(const KEduVocPersonalPronoun& other) co } -QString KEduVocPersonalPronoun::personalPronoun(KEduVocWordFlags flags) const +QString QmVocPersonalPronoun::personalPronoun(QmVocWordFlags flags) const { - QString p = d->m_personalpronouns.value(flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers| KEduVocWordFlag::genders)); - if (p.isEmpty() && !(flags & KEduVocWordFlag::genders) && d->m_maleFemaleDifferent && d->m_neutralExists) + QString p = d->m_personalpronouns.value(flags & (QmVocWordFlag::persons | QmVocWordFlag::numbers| QmVocWordFlag::genders)); + if (p.isEmpty() && !(flags & QmVocWordFlag::genders) && d->m_maleFemaleDifferent && d->m_neutralExists) { //initial flag lookup failed, adding neuter gender flag - flags |= KEduVocWordFlag::Neuter; - p = d->m_personalpronouns.value(flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers| KEduVocWordFlag::genders)); + flags |= QmVocWordFlag::Neuter; + p = d->m_personalpronouns.value(flags & (QmVocWordFlag::persons | QmVocWordFlag::numbers| QmVocWordFlag::genders)); } return p; } -void KEduVocPersonalPronoun::setPersonalPronoun(const QString & personalpronoun, KEduVocWordFlags flags) +void QmVocPersonalPronoun::setPersonalPronoun(const QString & personalpronoun, QmVocWordFlags flags) { - d->m_personalpronouns[flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers| KEduVocWordFlag::genders)] = personalpronoun; + d->m_personalpronouns[flags & (QmVocWordFlag::persons | QmVocWordFlag::numbers| QmVocWordFlag::genders)] = personalpronoun; } -bool KEduVocPersonalPronoun::maleFemaleDifferent() const +bool QmVocPersonalPronoun::maleFemaleDifferent() const { return d->m_maleFemaleDifferent; } -void KEduVocPersonalPronoun::setMaleFemaleDifferent(bool different) +void QmVocPersonalPronoun::setMaleFemaleDifferent(bool different) { d->m_maleFemaleDifferent = different; } -bool KEduVocPersonalPronoun::neutralExists() const +bool QmVocPersonalPronoun::neutralExists() const { return d->m_neutralExists; } -void KEduVocPersonalPronoun::setNeutralExists(bool exists) +void QmVocPersonalPronoun::setNeutralExists(bool exists) { d->m_neutralExists = exists; } -bool KEduVocPersonalPronoun::dualExists() const +bool QmVocPersonalPronoun::dualExists() const { return d->m_dualExists; } -void KEduVocPersonalPronoun::setDualExists(bool exists) +void QmVocPersonalPronoun::setDualExists(bool exists) { d->m_dualExists = exists; } diff --git a/keduvocpersonalpronoun.h b/qmvocpersonalpronoun.h similarity index 69% rename from keduvocpersonalpronoun.h rename to qmvocpersonalpronoun.h index 8f8db94..d30bb62 100644 --- a/keduvocpersonalpronoun.h +++ b/qmvocpersonalpronoun.h @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2007 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -16,34 +17,34 @@ ***************************************************************************/ -#ifndef KEDUVOCPERSONALPRONOUN_H -#define KEDUVOCPERSONALPRONOUN_H +#ifndef QMVOCPERSONALPRONOUN_H +#define QMVOCPERSONALPRONOUN_H -#include "libkeduvocdocument_export.h" -#include "keduvocconjugation.h" +#include "libqmvocdocument_export.h" +#include "qmvocconjugation.h" #include /** * The conjugation of a verb */ -class KEDUVOCDOCUMENT_EXPORT KEduVocPersonalPronoun +class QMVOCDOCUMENT_EXPORT QmVocPersonalPronoun { public: /** * The constructor */ - explicit KEduVocPersonalPronoun(); + explicit QmVocPersonalPronoun(); - KEduVocPersonalPronoun( const KEduVocPersonalPronoun& rhs ); + QmVocPersonalPronoun( const QmVocPersonalPronoun& rhs ); - ~KEduVocPersonalPronoun(); + ~QmVocPersonalPronoun(); - KEduVocPersonalPronoun& operator = ( const KEduVocPersonalPronoun& a ); - bool operator == ( const KEduVocPersonalPronoun& a ) const; + QmVocPersonalPronoun& operator = ( const QmVocPersonalPronoun& a ); + bool operator == ( const QmVocPersonalPronoun& a ) const; - QString personalPronoun(KEduVocWordFlags flags) const; - void setPersonalPronoun(const QString& conjugation, KEduVocWordFlags flags); + QString personalPronoun(QmVocWordFlags flags) const; + void setPersonalPronoun(const QString& conjugation, QmVocWordFlags flags); bool maleFemaleDifferent() const; void setMaleFemaleDifferent(bool different); @@ -61,5 +62,5 @@ private: -#endif // KEDUVOCCONJUGATION_H +#endif // QMVOCCONJUGATION_H diff --git a/keduvoctext.cpp b/qmvoctext.cpp similarity index 71% rename from keduvoctext.cpp rename to qmvoctext.cpp index ff382be..982c2e3 100644 --- a/keduvoctext.cpp +++ b/qmvoctext.cpp @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2007-2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -15,14 +16,14 @@ * * ***************************************************************************/ -#include "keduvoctext.h" +#include "qmvoctext.h" #include "kvtml2defs.h" -#include "keduvockvtml2writer.h" +#include "qmvockvtml2writer.h" #include -class KEduVocText::KEduVocTextPrivate +class QmVocText::QmVocTextPrivate { public: /// This is the word itself. The vocabulary. This is what it is all about. @@ -34,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() ); @@ -51,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; @@ -78,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; @@ -93,13 +94,13 @@ void KEduVocText::setGrade( grade_t grade ) } -void KEduVocText::incGrade() +void QmVocText::incGrade() { setGrade( qMax(grade() + 1, KV_LEV1_GRADE ) ); } -void KEduVocText::decGrade() +void QmVocText::decGrade() { if ( grade() == KV_MIN_GRADE ) { return; @@ -108,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; @@ -166,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 && @@ -176,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) { @@ -184,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 ); //2 - KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_CURRENTGRADE, QString::number( grade() ) ); + QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_CURRENTGRADE, QString::number( grade() ) ); //6 - KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_COUNT, QString::number( practiceCount() ) ); + QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_COUNT, QString::number( practiceCount() ) ); //1 - KEduVocKvtml2Writer::appendTextElement( gradeElement, KVTML_ERRORCOUNT, QString::number( badCount() ) ); + QmVocKvtml2Writer::appendTextElement( gradeElement, KVTML_ERRORCOUNT, QString::number( badCount() ) ); //949757271 - 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() ); @@ -228,7 +229,7 @@ void KEduVocText::fromKVTML2(QDomElement & parent) } } -bool KEduVocText::isEmpty() +bool QmVocText::isEmpty() { return d->m_text.isEmpty(); } diff --git a/keduvoctext.h b/qmvoctext.h similarity index 90% rename from keduvoctext.h rename to qmvoctext.h index f6511a5..22fc949 100644 --- a/keduvoctext.h +++ b/qmvoctext.h @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2007-2008 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -15,10 +16,10 @@ * * ***************************************************************************/ -#ifndef KEDUVOCTEXT_H -#define KEDUVOCTEXT_H +#ifndef QMVOCTEXT_H +#define QMVOCTEXT_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" #include @@ -60,20 +61,20 @@ class QDomElement; * This should be used instead of strings for all things that can be tested and thus get a grade. @author Frederik Gladhorn */ -class KEDUVOCDOCUMENT_EXPORT KEduVocText +class QMVOCDOCUMENT_EXPORT QmVocText { public: /** default constructor */ - KEduVocText(const QString& text = QString()); + QmVocText(const QString& text = QString()); /** copy constructor * provides safe copy of d pointer * @param other object to copy from */ - KEduVocText( const KEduVocText &other ); + QmVocText( const QmVocText &other ); /** default destructor */ - ~KEduVocText(); + ~QmVocText(); /** * The translation as string (the word itself) @@ -92,13 +93,13 @@ public: * @param other grades copied * @return reference to the new grades */ - KEduVocText& operator= ( const KEduVocText &other ); + QmVocText& operator= ( const QmVocText &other ); /** * Compare two sets of grades. * @param other * @return true if equal */ - bool operator== ( const KEduVocText &other ) const; + bool operator== ( const QmVocText &other ) const; /** returns how often this entry has been practiced as int @@ -167,8 +168,8 @@ public: void toKVTML2(QDomElement& parent); private: - class KEduVocTextPrivate; - KEduVocTextPrivate * const d; + class QmVocTextPrivate; + QmVocTextPrivate * const d; }; #endif diff --git a/keduvoctranslation.cpp b/qmvoctranslation.cpp similarity index 62% rename from keduvoctranslation.cpp rename to qmvoctranslation.cpp index b2f38d8..1ae4086 100644 --- a/keduvoctranslation.cpp +++ b/qmvoctranslation.cpp @@ -21,29 +21,29 @@ ***************************************************************************/ -#include "keduvoctranslation.h" +#include "qmvoctranslation.h" -#include "keduvocdeclension.h" -#include "keduvocwordtype.h" -#include "keduvocleitnerbox.h" +#include "qmvocdeclension.h" +#include "qmvocwordtype.h" +#include "qmvocleitnerbox.h" #include "kvtml2defs.h" -#include "keduvockvtml2writer.h" +#include "qmvockvtml2writer.h" #include -class KEduVocTranslation::KEduVocTranslationPrivate +class QmVocTranslation::QmVocTranslationPrivate { public: - KEduVocTranslationPrivate(KEduVocExpression* parent); + QmVocTranslationPrivate(QmVocExpression* parent); - ~KEduVocTranslationPrivate(); + ~QmVocTranslationPrivate(); - KEduVocExpression* m_entry; + QmVocExpression* m_entry; /// Type of a word noun, verb, adjective etc - KEduVocWordType* m_wordType; + QmVocWordType* m_wordType; /// Leitner box of the translation. - KEduVocLeitnerBox* m_leitnerBox; + QmVocLeitnerBox* m_leitnerBox; /// A comment giving additional information. QString m_comment; @@ -56,35 +56,35 @@ public: /// Pronunciation QString m_pronunciation; /// Image url - KUrl m_imageUrl; + QUrl m_imageUrl; /// Sound url - KUrl m_soundUrl; + QUrl m_soundUrl; /// When creating multiple choice tests, these are possible answers. (otherwise other words are added randomly) QStringList m_multipleChoice; /// Conjugations of a word (I go, you go, he goes... boring in english) - QMap m_conjugations; + QMap m_conjugations; /// The comparison forms of adjectives and adverbs: (fast), faster, fastest - KEduVocText* m_comparative; - KEduVocText* m_superlative; + QmVocText* m_comparative; + QmVocText* m_superlative; /// The grade of an article. The text part should not be used. - KEduVocText* m_articleGrade; + QmVocText* m_articleGrade; - KEduVocDeclension* m_declension; + QmVocDeclension* m_declension; // connections to other translations /// Synonyms for a word: sick and ill, student and pupil - QList< KEduVocTranslation* > m_synonyms; + QList< QmVocTranslation* > m_synonyms; /// An antonym - the opposite: hot - cold - QList< KEduVocTranslation* > m_antonyms; + QList< QmVocTranslation* > m_antonyms; /// List of false friends - QList< KEduVocTranslation* > m_falseFriends; + QList< QmVocTranslation* > m_falseFriends; }; -KEduVocTranslation::KEduVocTranslationPrivate::KEduVocTranslationPrivate(KEduVocExpression* parent) +QmVocTranslation::QmVocTranslationPrivate::QmVocTranslationPrivate(QmVocExpression* parent) { m_entry = parent; m_wordType = 0; @@ -97,25 +97,25 @@ KEduVocTranslation::KEduVocTranslationPrivate::KEduVocTranslationPrivate(KEduVoc } -KEduVocTranslation::KEduVocTranslationPrivate::~KEduVocTranslationPrivate() +QmVocTranslation::QmVocTranslationPrivate::~QmVocTranslationPrivate() { delete m_declension; } -KEduVocTranslation::KEduVocTranslation(KEduVocExpression* entry) : d( new KEduVocTranslationPrivate(entry) ) +QmVocTranslation::QmVocTranslation(QmVocExpression* entry) : d( new QmVocTranslationPrivate(entry) ) { } -KEduVocTranslation::KEduVocTranslation(KEduVocExpression* entry, const QString &translation ) : d( new KEduVocTranslationPrivate(entry) ) +QmVocTranslation::QmVocTranslation(QmVocExpression* entry, const QString &translation ) : d( new QmVocTranslationPrivate(entry) ) { setText(translation.simplified()); } -KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other ) - : KEduVocText(other), +QmVocTranslation::QmVocTranslation( const QmVocTranslation &other ) + : QmVocText(other), // set the entry to 0, the translation will be put into a copied entry by the expression copy constructor - d( new KEduVocTranslationPrivate(0) ) + d( new QmVocTranslationPrivate(0) ) { // beter no word type copy as this is pointer copying // will not work as this is not added to the word type container! @@ -136,29 +136,29 @@ KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other ) // d->m_antonyms = other.d->m_antonyms; // d->m_falseFriends = other.d->m_falseFriends; if (other.d->m_declension) { - d->m_declension = new KEduVocDeclension(*other.d->m_declension); + d->m_declension = new QmVocDeclension(*other.d->m_declension); } } -KEduVocTranslation::~KEduVocTranslation() +QmVocTranslation::~QmVocTranslation() { setWordType(0); setLeitnerBox(0); - foreach (KEduVocTranslation *synonym, d->m_synonyms) { + foreach (QmVocTranslation *synonym, d->m_synonyms) { synonym->removeSynonym(this); } - foreach (KEduVocTranslation *antonym, d->m_antonyms) { + foreach (QmVocTranslation *antonym, d->m_antonyms) { antonym->removeAntonym(this); } - foreach (KEduVocTranslation *falseFriend, d->m_falseFriends) { + foreach (QmVocTranslation *falseFriend, d->m_falseFriends) { falseFriend->removeFalseFriend(this); } delete d; } -bool KEduVocTranslation::operator == ( const KEduVocTranslation & translation ) const +bool QmVocTranslation::operator == ( const QmVocTranslation & translation ) const { - return KEduVocText::operator==(translation) && + return QmVocText::operator==(translation) && d->m_wordType == translation.d->m_wordType && d->m_leitnerBox == translation.d->m_leitnerBox && d->m_comment == translation.d->m_comment && @@ -177,9 +177,9 @@ bool KEduVocTranslation::operator == ( const KEduVocTranslation & translation ) /// @todo check and include declensions d->m_declension == translation.d->m_declension; } -KEduVocTranslation & KEduVocTranslation::operator = ( const KEduVocTranslation & translation ) +QmVocTranslation & QmVocTranslation::operator = ( const QmVocTranslation & translation ) { - KEduVocText::operator=(translation); + QmVocText::operator=(translation); d->m_entry = translation.d->m_entry; // d->m_wordType = translation.d->m_wordType; // d->m_leitnerBox = translation.d->m_leitnerBox; @@ -197,154 +197,154 @@ KEduVocTranslation & KEduVocTranslation::operator = ( const KEduVocTranslation & d->m_antonyms = translation.d->m_antonyms; d->m_conjugations = translation.d->m_conjugations; if (translation.d->m_declension) { - d->m_declension = new KEduVocDeclension(*translation.d->m_declension); + d->m_declension = new QmVocDeclension(*translation.d->m_declension); } return *this; } -QString KEduVocTranslation::comment() const +QString QmVocTranslation::comment() const { return d->m_comment; } -void KEduVocTranslation::setComment( const QString & expr ) +void QmVocTranslation::setComment( const QString & expr ) { d->m_comment = expr.simplified(); } -void KEduVocTranslation::addFalseFriend( KEduVocTranslation* falseFriend ) +void QmVocTranslation::addFalseFriend( QmVocTranslation* falseFriend ) { d->m_falseFriends.append(falseFriend); } -void KEduVocTranslation::removeFalseFriend(KEduVocTranslation * falseFriend) +void QmVocTranslation::removeFalseFriend(QmVocTranslation * falseFriend) { d->m_falseFriends.removeAt(d->m_falseFriends.indexOf(falseFriend)); } -QList< KEduVocTranslation* > KEduVocTranslation::falseFriends() const +QList< QmVocTranslation* > QmVocTranslation::falseFriends() const { return d->m_falseFriends; } -void KEduVocTranslation::addSynonym( KEduVocTranslation* synonym ) +void QmVocTranslation::addSynonym( QmVocTranslation* synonym ) { d->m_synonyms.append(synonym); } -void KEduVocTranslation::removeSynonym(KEduVocTranslation * synonym) +void QmVocTranslation::removeSynonym(QmVocTranslation * synonym) { d->m_synonyms.removeAt(d->m_synonyms.indexOf(synonym)); } -QList KEduVocTranslation::synonyms() const +QList QmVocTranslation::synonyms() const { return d->m_synonyms; } -void KEduVocTranslation::addAntonym( KEduVocTranslation* antonym ) +void QmVocTranslation::addAntonym( QmVocTranslation* antonym ) { d->m_antonyms.append(antonym); } -QList KEduVocTranslation::antonyms() const +QList QmVocTranslation::antonyms() const { return d->m_antonyms; } -void KEduVocTranslation::removeAntonym(KEduVocTranslation * antonym) +void QmVocTranslation::removeAntonym(QmVocTranslation * antonym) { d->m_antonyms.removeAt(d->m_antonyms.indexOf(antonym)); } -void KEduVocTranslation::setExample( const QString & expr ) +void QmVocTranslation::setExample( const QString & expr ) { d->m_example = expr.simplified(); } -QString KEduVocTranslation::example() const +QString QmVocTranslation::example() const { return d->m_example; } -void KEduVocTranslation::setParaphrase( const QString & expr ) +void QmVocTranslation::setParaphrase( const QString & expr ) { d->m_paraphrase = expr.simplified(); } -QString KEduVocTranslation::paraphrase() const +QString QmVocTranslation::paraphrase() const { return d->m_paraphrase; } -void KEduVocTranslation::setConjugation( const QString& tense, const KEduVocConjugation& con ) +void QmVocTranslation::setConjugation( const QString& tense, const QmVocConjugation& con ) { d->m_conjugations[tense] = con; } -KEduVocConjugation& KEduVocTranslation::conjugation( const QString& tense ) +QmVocConjugation& QmVocTranslation::conjugation( const QString& tense ) { return d->m_conjugations[tense]; } -QStringList & KEduVocTranslation::multipleChoice() +QStringList & QmVocTranslation::multipleChoice() { return d->m_multipleChoice; } -QString KEduVocTranslation::pronunciation() const +QString QmVocTranslation::pronunciation() const { return d->m_pronunciation; } -void KEduVocTranslation::setPronunciation( const QString & expr ) +void QmVocTranslation::setPronunciation( const QString & expr ) { d->m_pronunciation = expr.simplified(); } -QStringList KEduVocTranslation::conjugationTenses() const +QStringList QmVocTranslation::conjugationTenses() const { return d->m_conjugations.keys(); } -QMap< QString, KEduVocConjugation > KEduVocTranslation::conjugations() const +QMap< QString, QmVocConjugation > QmVocTranslation::conjugations() const { return d->m_conjugations; } -void KEduVocTranslation::setConjugations(const QMap< QString, KEduVocConjugation > & conjugations) +void QmVocTranslation::setConjugations(const QMap< QString, QmVocConjugation > & conjugations) { d->m_conjugations = conjugations; } /** get the sound url for this translation if it exists */ -KUrl KEduVocTranslation::soundUrl() +QUrl QmVocTranslation::soundUrl() { return d->m_soundUrl; } /** set the sound url for this translation * @param url url of the sound file */ -void KEduVocTranslation::setSoundUrl(const KUrl &url) +void QmVocTranslation::setSoundUrl(const QUrl &url) { d->m_soundUrl = url; } /** get the image url for this translation if it exists */ -KUrl KEduVocTranslation::imageUrl() +QUrl QmVocTranslation::imageUrl() { return d->m_imageUrl; } @@ -352,12 +352,12 @@ KUrl KEduVocTranslation::imageUrl() /** set the image url for this translation * @param url url of the image */ -void KEduVocTranslation::setImageUrl(const KUrl &url) +void QmVocTranslation::setImageUrl(const QUrl &url) { d->m_imageUrl = url; } -KEduVocWordType * KEduVocTranslation::wordType() const +QmVocWordType * QmVocTranslation::wordType() const { if (d) { return d->m_wordType; @@ -366,7 +366,7 @@ KEduVocWordType * KEduVocTranslation::wordType() const } } -void KEduVocTranslation::setWordType(KEduVocWordType * wordType) +void QmVocTranslation::setWordType(QmVocWordType * wordType) { if ( d->m_wordType ) { d->m_wordType->removeTranslation(this); @@ -377,12 +377,12 @@ void KEduVocTranslation::setWordType(KEduVocWordType * wordType) d->m_wordType = wordType; } -KEduVocLeitnerBox * KEduVocTranslation::leitnerBox() const +QmVocLeitnerBox * QmVocTranslation::leitnerBox() const { return d->m_leitnerBox; } -void KEduVocTranslation::setLeitnerBox(KEduVocLeitnerBox * leitnerBox) +void QmVocTranslation::setLeitnerBox(QmVocLeitnerBox * leitnerBox) { if ( d->m_leitnerBox ) { d->m_leitnerBox->removeTranslation(this); @@ -393,12 +393,12 @@ void KEduVocTranslation::setLeitnerBox(KEduVocLeitnerBox * leitnerBox) d->m_leitnerBox = leitnerBox; } -KEduVocExpression * KEduVocTranslation::entry() +QmVocExpression * QmVocTranslation::entry() { return d->m_entry; } -QString KEduVocTranslation::comparative() const +QString QmVocTranslation::comparative() const { if (d->m_comparative) { return d->m_comparative->text(); @@ -406,16 +406,16 @@ QString KEduVocTranslation::comparative() const return QString(); } -void KEduVocTranslation::setComparative(const QString & comparative) +void QmVocTranslation::setComparative(const QString & comparative) { if (!d->m_comparative) { - d->m_comparative = new KEduVocText(comparative); + d->m_comparative = new QmVocText(comparative); } else { d->m_comparative->setText(comparative); } } -QString KEduVocTranslation::superlative() const +QString QmVocTranslation::superlative() const { if (d->m_superlative) { return d->m_superlative->text(); @@ -423,82 +423,82 @@ QString KEduVocTranslation::superlative() const return QString(); } -void KEduVocTranslation::setSuperlative(const QString & superlative) +void QmVocTranslation::setSuperlative(const QString & superlative) { if (!d->m_superlative) { - d->m_superlative = new KEduVocText(superlative); + d->m_superlative = new QmVocText(superlative); } else { d->m_superlative->setText(superlative); } } -KEduVocText KEduVocTranslation::comparativeForm() const +QmVocText QmVocTranslation::comparativeForm() const { if (!d->m_comparative) { - return KEduVocText(); + return QmVocText(); } - KEduVocText t(*(d->m_comparative)); + QmVocText t(*(d->m_comparative)); return t; } -void KEduVocTranslation::setComparativeForm(const KEduVocText& comparative) +void QmVocTranslation::setComparativeForm(const QmVocText& comparative) { if (!d->m_comparative) { - d->m_comparative = new KEduVocText(); + d->m_comparative = new QmVocText(); } *(d->m_comparative) = comparative; } -KEduVocText KEduVocTranslation::superlativeForm() const +QmVocText QmVocTranslation::superlativeForm() const { if (!d->m_superlative) { - return KEduVocText(); + return QmVocText(); } - KEduVocText t(*d->m_superlative); + QmVocText t(*d->m_superlative); return t; } -void KEduVocTranslation::setSuperlativeForm(const KEduVocText& superlative) +void QmVocTranslation::setSuperlativeForm(const QmVocText& superlative) { if (!d->m_superlative) { - d->m_superlative = new KEduVocText(); + d->m_superlative = new QmVocText(); } *d->m_superlative = superlative; } -KEduVocText KEduVocTranslation::article() const +QmVocText QmVocTranslation::article() const { if (!d->m_articleGrade) { - return KEduVocText(); + return QmVocText(); } - KEduVocText t(*d->m_articleGrade); + QmVocText t(*d->m_articleGrade); return t; } -void KEduVocTranslation::setArticle(const KEduVocText& article) +void QmVocTranslation::setArticle(const QmVocText& article) { if (!d->m_articleGrade) { - d->m_articleGrade = new KEduVocText(); + d->m_articleGrade = new QmVocText(); } *d->m_articleGrade = article; } -KEduVocDeclension * KEduVocTranslation::declension() +QmVocDeclension * QmVocTranslation::declension() { return d->m_declension; } -void KEduVocTranslation::setDeclension(KEduVocDeclension * declension) +void QmVocTranslation::setDeclension(QmVocDeclension * declension) { // remove the old declension object delete d->m_declension; d->m_declension = declension; } -void KEduVocTranslation::toKVTML2(QDomElement & parent) +void QmVocTranslation::toKVTML2(QDomElement & parent) { // text and grade - KEduVocText::toKVTML2(parent); + QmVocText::toKVTML2(parent); // declension if (d->m_declension) { @@ -515,26 +515,26 @@ void KEduVocTranslation::toKVTML2(QDomElement & parent) } // - KEduVocKvtml2Writer::appendTextElement( parent, KVTML_COMMENT, comment() ); + QmVocKvtml2Writer::appendTextElement( parent, KVTML_COMMENT, comment() ); // - KEduVocKvtml2Writer::appendTextElement( parent, KVTML_PRONUNCIATION, pronunciation() ); + QmVocKvtml2Writer::appendTextElement( parent, KVTML_PRONUNCIATION, pronunciation() ); // - KEduVocKvtml2Writer::appendTextElement( parent, KVTML_EXAMPLE, example() ); + QmVocKvtml2Writer::appendTextElement( parent, KVTML_EXAMPLE, example() ); // - KEduVocKvtml2Writer::appendTextElement( parent, KVTML_PARAPHRASE, paraphrase() ); + QmVocKvtml2Writer::appendTextElement( parent, KVTML_PARAPHRASE, paraphrase() ); ///@todo synonyms, antonyms ///@todo false friends } -void KEduVocTranslation::fromKVTML2(QDomElement & parent) +void QmVocTranslation::fromKVTML2(QDomElement & parent) { - KEduVocText::fromKVTML2(parent); + QmVocText::fromKVTML2(parent); - setDeclension(KEduVocDeclension::fromKVTML2(parent)); + setDeclension(QmVocDeclension::fromKVTML2(parent)); setComment( parent.firstChildElement( KVTML_COMMENT ).text() ); @@ -551,7 +551,7 @@ void KEduVocTranslation::fromKVTML2(QDomElement & parent) while ( !conjugationElement.isNull() ) { QDomElement tenseElement = conjugationElement.firstChildElement( KVTML_TENSE ); QString tense = tenseElement.text(); - KEduVocConjugation *conjugation = KEduVocConjugation::fromKVTML2(conjugationElement); + QmVocConjugation *conjugation = QmVocConjugation::fromKVTML2(conjugationElement); setConjugation(tense, *conjugation); delete conjugation; conjugationElement = conjugationElement.nextSiblingElement( KVTML_CONJUGATION ); @@ -561,7 +561,7 @@ void KEduVocTranslation::fromKVTML2(QDomElement & parent) ///@todo false friends } -void KEduVocTranslation::setEntry(KEduVocExpression * entry) +void QmVocTranslation::setEntry(QmVocExpression * entry) { d->m_entry = entry; } diff --git a/keduvoctranslation.h b/qmvoctranslation.h similarity index 74% rename from keduvoctranslation.h rename to qmvoctranslation.h index f0cc0f4..2561cff 100644 --- a/keduvoctranslation.h +++ b/qmvoctranslation.h @@ -20,27 +20,27 @@ ***************************************************************************/ -#ifndef KEDUVOCTRANSLATION_H -#define KEDUVOCTRANSLATION_H +#ifndef QMVOCTRANSLATION_H +#define QMVOCTRANSLATION_H -#include "libkeduvocdocument_export.h" -#include "keduvocconjugation.h" -#include "keduvoctext.h" +#include "libqmvocdocument_export.h" +#include "qmvocconjugation.h" +#include "qmvoctext.h" // #include #include #include -class KEduVocExpression; -class KEduVocString; -class KEduVocWordType; -class KEduVocLeitnerBox; -class KEduVocDeclension; +class QmVocExpression; +class QmVocString; +class QmVocWordType; +class QmVocLeitnerBox; +class QmVocDeclension; /** @author Frederik Gladhorn */ -class KEDUVOCDOCUMENT_EXPORT KEduVocTranslation - :public KEduVocText +class QMVOCDOCUMENT_EXPORT QmVocTranslation + :public QmVocText { public: enum Related { @@ -52,23 +52,23 @@ public: /** * Default constructor for an empty translation. */ - KEduVocTranslation(KEduVocExpression* entry); + QmVocTranslation(QmVocExpression* entry); /** * Constructor * @param translation is used as translation */ - KEduVocTranslation(KEduVocExpression* entry, const QString &translation ); + QmVocTranslation(QmVocExpression* entry, const QString &translation ); /** copy constructor for d-pointer safety */ - KEduVocTranslation( const KEduVocTranslation &other ); + QmVocTranslation( const QmVocTranslation &other ); /** * Destructor */ - ~KEduVocTranslation(); + ~QmVocTranslation(); - KEduVocExpression* entry(); + QmVocExpression* entry(); /** Sets the pronunciation of this expression * @param expression pronunciation of this index @@ -137,53 +137,53 @@ public: * * @return type or "" if no type available */ - KEduVocWordType* wordType() const; + QmVocWordType* wordType() const; /** Sets the word type of this expression * @param type type of this expression ("" = none) */ - void setWordType( KEduVocWordType* wordType ); + void setWordType( QmVocWordType* wordType ); /** Returns the leitner box of this translation * @return the box */ - KEduVocLeitnerBox* leitnerBox() const; + QmVocLeitnerBox* leitnerBox() const; /** Sets the leitner box of this translation * @param leitnerBox the box */ - void setLeitnerBox( KEduVocLeitnerBox* leitnerBox ); + void setLeitnerBox( QmVocLeitnerBox* leitnerBox ); /** * Returns a conjugation if available * @param tense tense of the requested conjugation * @return the conjugation */ - KEduVocConjugation& conjugation( const QString& tense ); + QmVocConjugation& conjugation( const QString& tense ); /** adds conjugations or replaces them, if they exist. * @param conjugation conjugation */ - void setConjugation( const QString& tense, const KEduVocConjugation & conjugation ); + void setConjugation( const QString& tense, const QmVocConjugation & conjugation ); /** * Returns a pointer to the declension object of this translation. * Returns 0 if no declension object exists! * @return the declension */ - KEduVocDeclension* declension(); + QmVocDeclension* declension(); /** * Set a new declension for a translation * @param declension */ - void setDeclension(KEduVocDeclension* declension); + void setDeclension(QmVocDeclension* declension); /** * Bad, only used for tense entry page, will be deleted later. Deprecated. * @param conjugation */ - void setConjugations( const QMap& conjugations ); + void setConjugations( const QMap& conjugations ); QStringList conjugationTenses() const; @@ -191,7 +191,7 @@ public: * Bad, only compatibility. Deprecated. * @return */ - KDE_DEPRECATED QMap conjugations() const; + KDE_DEPRECATED QMap conjugations() const; /** * Comparison forms of adjectives/adverbs. @@ -199,16 +199,16 @@ public: KDE_DEPRECATED QString comparative() const; KDE_DEPRECATED void setComparative(const QString& comparative); // TODO rename to comparative and remove the deprecated function - KEduVocText comparativeForm() const; - void setComparativeForm(const KEduVocText& comparative); + QmVocText comparativeForm() const; + void setComparativeForm(const QmVocText& comparative); KDE_DEPRECATED QString superlative() const; KDE_DEPRECATED void setSuperlative(const QString& superlative); - KEduVocText superlativeForm() const; - void setSuperlativeForm(const KEduVocText& superlative); + QmVocText superlativeForm() const; + void setSuperlativeForm(const QmVocText& superlative); - KEduVocText article() const; - void setArticle(const KEduVocText& article); + QmVocText article() const; + void setArticle(const QmVocText& article); /** Returns multiple choice if available */ @@ -220,98 +220,98 @@ public: // void setMultipleChoice( const QStringList &mc ); /** Get the sound url for this translation if it exists */ - KUrl soundUrl(); + QUrl soundUrl(); /** Set the sound url for this translation * @param url url of the sound file */ - void setSoundUrl(const KUrl &url); + void setSoundUrl(const QUrl &url); /** Get the image url for this translation if it exists */ - KUrl imageUrl(); + QUrl imageUrl(); /** Set the image url for this translation * @param url url of the image */ - void setImageUrl(const KUrl &url); + void setImageUrl(const QUrl &url); /** * Add a false friend * @param falseFriend false friend of this index */ - void addFalseFriend( KEduVocTranslation* falseFriend ); + void addFalseFriend( QmVocTranslation* falseFriend ); /** * Remove a false friend * @param falseFriend false friend of this index */ - void removeFalseFriend( KEduVocTranslation* falseFriend ); + void removeFalseFriend( QmVocTranslation* falseFriend ); /** * Returns false friends of this expression * @return list of false friends */ - QList falseFriends() const; + QList falseFriends() const; /** * Add a synonym * @param synonym */ - void addSynonym( KEduVocTranslation* synonym ); + void addSynonym( QmVocTranslation* synonym ); /** * Remove a synonym * @param synonym */ - void removeSynonym( KEduVocTranslation* synonym ); + void removeSynonym( QmVocTranslation* synonym ); /** * Returns synonyms of this expression * @return synonyms */ - QList synonyms() const; + QList synonyms() const; /** * Add a antonym * @param antonym */ - void addAntonym( KEduVocTranslation* antonym ); + void addAntonym( QmVocTranslation* antonym ); /** * Remove a antonym * @param antonym */ - void removeAntonym( KEduVocTranslation* antonym ); + void removeAntonym( QmVocTranslation* antonym ); /** * Returns antonyms of this expression * @return antonyms */ - QList antonyms() const; + QList antonyms() const; /** * Equal operator to assing a translation to another one. * @param translation translation to be copied * @return reference to the new translation */ - KEduVocTranslation& operator= ( const KEduVocTranslation &translation ); + QmVocTranslation& operator= ( const QmVocTranslation &translation ); /** * Compare two translations, including word type etc. * @param translation * @return true if equal */ - bool operator== ( const KEduVocTranslation &translation ) const; + bool operator== ( const QmVocTranslation &translation ) const; void fromKVTML2(QDomElement& parent); void toKVTML2(QDomElement& parent); private: - class KEduVocTranslationPrivate; - KEduVocTranslationPrivate* const d; + class QmVocTranslationPrivate; + QmVocTranslationPrivate* const d; // for the copy constructor - void setEntry(KEduVocExpression* entry); - friend class KEduVocExpression; + void setEntry(QmVocExpression* entry); + friend class QmVocExpression; }; #endif diff --git a/keduvocvokabelnreader.cpp b/qmvocvokabelnreader.cpp similarity index 90% rename from keduvocvokabelnreader.cpp rename to qmvocvokabelnreader.cpp index 97cd82c..69f7021 100644 --- a/keduvocvokabelnreader.cpp +++ b/qmvocvokabelnreader.cpp @@ -4,7 +4,7 @@ /*************************************************************************** - create a KEduVocDocument from a Vokabeln file + create a QmVocDocument from a Vokabeln file ----------------------------------------------------------------------- @@ -27,7 +27,7 @@ * * ***************************************************************************/ -#include "keduvocvokabelnreader.h" +#include "qmvocvokabelnreader.h" #include @@ -35,10 +35,10 @@ // #include #include -#include "keduvocdocument.h" -#include "keduvocexpression.h" +#include "qmvocdocument.h" +#include "qmvocexpression.h" -KEduVocVokabelnReader::KEduVocVokabelnReader( QIODevice *file ) +QmVocVokabelnReader::QmVocVokabelnReader( QIODevice *file ) { // the file must be already open m_inputFile = file; @@ -46,7 +46,7 @@ KEduVocVokabelnReader::KEduVocVokabelnReader( QIODevice *file ) } -bool KEduVocVokabelnReader::readDoc( KEduVocDocument *doc ) +bool QmVocVokabelnReader::readDoc( QmVocDocument *doc ) { qDebug() << "Reading vokabeln.de document..."; m_doc = doc; @@ -157,16 +157,16 @@ bool KEduVocVokabelnReader::readDoc( KEduVocDocument *doc ) } while(m_doc->lesson()->childContainerCount() <= lessonNumber) { - KEduVocLesson* lesson = new KEduVocLesson(QString("Lesson %1").arg(lessonNumber), m_doc->lesson()); + QmVocLesson* lesson = new QmVocLesson(QString("Lesson %1").arg(lessonNumber), m_doc->lesson()); m_doc->lesson()->appendChildContainer(lesson); qDebug() << "Created lesson " << lessonNumber; } - KEduVocExpression* kve = new KEduVocExpression; + QmVocExpression* kve = new QmVocExpression; kve->setTranslation( 0, original ); kve->setTranslation( 1, translation ); - static_cast(m_doc->lesson()->childContainer(lessonNumber))->appendEntry(kve); + static_cast(m_doc->lesson()->childContainer(lessonNumber))->appendEntry(kve); inputStream.readLine(); inputStream.readLine(); diff --git a/keduvocvokabelnreader.h b/qmvocvokabelnreader.h similarity index 79% rename from keduvocvokabelnreader.h rename to qmvocvokabelnreader.h index 0550aeb..857adee 100644 --- a/keduvocvokabelnreader.h +++ b/qmvocvokabelnreader.h @@ -3,9 +3,10 @@ ***************************************************************************/ /*************************************************************************** - create a KEduVocDocument from a Vokabeln file + create a QmVocDocument from a Vokabeln file ----------------------------------------------------------------------- copyright : (C) 2007 Peter Hedlund + Copyright : (C) 2010 Reto Zingg ***************************************************************************/ @@ -19,20 +20,20 @@ * * ***************************************************************************/ -#ifndef KEDUVOCVOKABELNREADER_H -#define KEDUVOCVOKABELNREADER_H +#ifndef QMVOCVOKABELNREADER_H +#define QMVOCVOKABELNREADER_H #include class QIODevice; -class KEduVocDocument; +class QmVocDocument; -class KEduVocVokabelnReader +class QmVocVokabelnReader { public: - KEduVocVokabelnReader( QIODevice *file ); + QmVocVokabelnReader( QIODevice *file ); - bool readDoc( KEduVocDocument *doc ); + bool readDoc( QmVocDocument *doc ); QString errorMessage() const { @@ -41,7 +42,7 @@ public: private: QIODevice *m_inputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; QString m_errorMessage; }; diff --git a/keduvocwordflags.h b/qmvocwordflags.h similarity index 91% rename from keduvocwordflags.h rename to qmvocwordflags.h index d359953..67be5b0 100644 --- a/keduvocwordflags.h +++ b/qmvocwordflags.h @@ -4,6 +4,7 @@ /*************************************************************************** Copyright 2008 David Capel + Copyright (C) 2010 Reto Zingg ***************************************************************************/ /*************************************************************************** @@ -15,12 +16,12 @@ * * ***************************************************************************/ -#ifndef KEDUVOCWORDFLAGS_H -#define KEDUVOCWORDFLAGS_H +#ifndef QMVOCWORDFLAGS_H +#define QMVOCWORDFLAGS_H #include -class KEduVocWordFlag +class QmVocWordFlag { public: enum Flags @@ -73,10 +74,10 @@ public: static const Flags numbers = (Flags)(Singular | Plural | Dual); static const Flags cases = (Flags)(Nominative|Genitive|Dative|Accusative|Ablative|Locative|Vocative); static const Flags persons = (Flags)(First | Second | Third); - }; -Q_DECLARE_FLAGS(KEduVocWordFlags, KEduVocWordFlag::Flags) -Q_DECLARE_OPERATORS_FOR_FLAGS(KEduVocWordFlags) +Q_DECLARE_FLAGS(QmVocWordFlags, QmVocWordFlag::Flags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QmVocWordFlags) + #endif diff --git a/keduvocwordtype.cpp b/qmvocwordtype.cpp similarity index 73% rename from keduvocwordtype.cpp rename to qmvocwordtype.cpp index 1216a51..2669eb7 100644 --- a/keduvocwordtype.cpp +++ b/qmvocwordtype.cpp @@ -6,6 +6,7 @@ Copyright 2007 Jeremy Whiting Copyright 2007 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,36 +19,36 @@ * * ***************************************************************************/ -#include "keduvocwordtype.h" +#include "qmvocwordtype.h" -#include "keduvocexpression.h" +#include "qmvocexpression.h" #include #include -class KEduVocWordType::Private +class QmVocWordType::Private { public: // bitvector of word type flags - KEduVocWordFlags m_flags; - QList m_expressions; + QmVocWordFlags m_flags; + QList m_expressions; // list of translations - QList m_translations; + QList m_translations; }; -KEduVocWordType::KEduVocWordType(const QString& name, KEduVocWordType *parent) - : KEduVocContainer(name, WordType, parent), d( new Private ) +QmVocWordType::QmVocWordType(const QString& name, QmVocWordType *parent) + : QmVocContainer(name, WordType, parent), d( new Private ) {} -KEduVocWordType::~KEduVocWordType() +QmVocWordType::~QmVocWordType() { - foreach(KEduVocTranslation* translation, d->m_translations) { + foreach(QmVocTranslation* translation, d->m_translations) { translation->setWordType(0); } delete d; } -QList KEduVocWordType::entries(EnumEntriesRecursive recursive) +QList QmVocWordType::entries(EnumEntriesRecursive recursive) { if (recursive == Recursive) { return entriesRecursive(); @@ -56,7 +57,7 @@ QList KEduVocWordType::entries(EnumEntriesRecursive recursiv return d->m_expressions; } -int KEduVocWordType::entryCount(EnumEntriesRecursive recursive) +int QmVocWordType::entryCount(EnumEntriesRecursive recursive) { if (recursive == Recursive) { return entriesRecursive().count(); @@ -64,7 +65,7 @@ int KEduVocWordType::entryCount(EnumEntriesRecursive recursive) return d->m_expressions.count(); } -void KEduVocWordType::addTranslation(KEduVocTranslation* translation) +void QmVocWordType::addTranslation(QmVocTranslation* translation) { // add to expression - if not already there because another translation of the same word is there. bool found = false; @@ -81,7 +82,7 @@ void KEduVocWordType::addTranslation(KEduVocTranslation* translation) invalidateChildLessonEntries(); } -void KEduVocWordType::removeTranslation(KEduVocTranslation* translation) +void QmVocWordType::removeTranslation(QmVocTranslation* translation) { d->m_translations.removeAt( d->m_translations.indexOf(translation) ); @@ -108,13 +109,13 @@ void KEduVocWordType::removeTranslation(KEduVocTranslation* translation) invalidateChildLessonEntries(); } -KEduVocTranslation * KEduVocWordType::translation(int row) +QmVocTranslation * QmVocWordType::translation(int row) { return d->m_translations.value(row); } -KEduVocExpression * KEduVocWordType::entry(int row, EnumEntriesRecursive recursive) +QmVocExpression * QmVocWordType::entry(int row, EnumEntriesRecursive recursive) { if (recursive == Recursive) { return entriesRecursive().value(row); @@ -122,23 +123,23 @@ KEduVocExpression * KEduVocWordType::entry(int row, EnumEntriesRecursive recursi return entries().value(row); } -KEduVocWordFlags KEduVocWordType::wordType() const +QmVocWordFlags QmVocWordType::wordType() const { return d->m_flags; } -void KEduVocWordType::setWordType(KEduVocWordFlags flags) +void QmVocWordType::setWordType(QmVocWordFlags flags) { d->m_flags = flags; } -KEduVocWordType* KEduVocWordType::childOfType(const KEduVocWordFlags& flags) +QmVocWordType* QmVocWordType::childOfType(const QmVocWordFlags& flags) { if(d->m_flags == flags) { return this; } - foreach(KEduVocContainer* child, childContainers()) { - KEduVocWordType* result = static_cast(child)->childOfType(flags); + foreach(QmVocContainer* child, childContainers()) { + QmVocWordType* result = static_cast(child)->childOfType(flags); if(result) { return result; } diff --git a/keduvocwordtype.h b/qmvocwordtype.h similarity index 72% rename from keduvocwordtype.h rename to qmvocwordtype.h index ea69dbf..5a2230c 100644 --- a/keduvocwordtype.h +++ b/qmvocwordtype.h @@ -6,6 +6,7 @@ Copyright 2007 Jeremy Whiting Copyright 2007 Frederik Gladhorn + Copyright (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,70 +19,70 @@ * * ***************************************************************************/ -#ifndef KEDUVOCWORDTYPE_H -#define KEDUVOCWORDTYPE_H +#ifndef QMVOCWORDTYPE_H +#define QMVOCWORDTYPE_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" -#include "keduvoccontainer.h" +#include "qmvoccontainer.h" -#include "keduvocwordflags.h" +#include "qmvocwordflags.h" #include #include -class KEduVocExpression; -class KEduVocTranslation; +class QmVocExpression; +class QmVocTranslation; /** class to store translation word types */ -class KEDUVOCDOCUMENT_EXPORT KEduVocWordType :public KEduVocContainer +class QMVOCDOCUMENT_EXPORT QmVocWordType :public QmVocContainer { public: /** default constructor */ - explicit KEduVocWordType(const QString& name, KEduVocWordType *parent = 0); + explicit QmVocWordType(const QString& name, QmVocWordType *parent = 0); /** destructor */ - ~KEduVocWordType(); + ~QmVocWordType(); /** assignment operator */ -// KEduVocWordType& operator= ( const KEduVocWordType& ); +// QmVocWordType& operator= ( const QmVocWordType& ); /** * Internally (different from the name) the class can have one of the preset word types. These are used to determine special properties (verbs have conjugations available for example). * @param type */ - void setWordType(KEduVocWordFlags flags); + void setWordType(QmVocWordFlags flags); /** * Return the raw WordTypeFlags. Returns NoInformation if no flags are set. * @return WordTypeFlags */ - KEduVocWordFlags wordType() const; + QmVocWordFlags wordType() const; /** * Return a child class (or this class) that is of the specified type. Returns 0 if no class of that type is found. * @param type * @return */ - KEduVocWordType* childOfType(const KEduVocWordFlags& flags); + QmVocWordType* childOfType(const QmVocWordFlags& flags); /** * The word type class does keep track of individual translations, because for one entry, the translations can have different word types (eg. genders of nouns tend to be different in different langues). * @param row * @return */ - KEduVocTranslation * translation(int row); + QmVocTranslation * translation(int row); /** * get a list of all entries in the lesson * @param recursive include entries in sublessons * @return */ - QList < KEduVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive); + QList < QmVocExpression* > entries(EnumEntriesRecursive recursive = NotRecursive); - KEduVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive); + QmVocExpression* entry(int row, EnumEntriesRecursive recursive = NotRecursive); /** get the number of entries in the lesson */ int entryCount(EnumEntriesRecursive recursive = NotRecursive); @@ -93,14 +94,14 @@ private: /** add an entry to the lesson * @param entryid id of the entry to add */ - void addTranslation(KEduVocTranslation* translation); + void addTranslation(QmVocTranslation* translation); /** remove an entry from the lesson * @param entryid id of the entry to remove */ - void removeTranslation(KEduVocTranslation* translation); + void removeTranslation(QmVocTranslation* translation); - friend class KEduVocTranslation; + friend class QmVocTranslation; }; #endif diff --git a/keduvocwqlreader.cpp b/qmvocwqlreader.cpp similarity index 93% rename from keduvocwqlreader.cpp rename to qmvocwqlreader.cpp index f32ff2f..0b97f9f 100644 --- a/keduvocwqlreader.cpp +++ b/qmvocwqlreader.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - read a KEduVocDocument from a WQL file + read a QmVocDocument from a WQL file ----------------------------------------------------------------------- copyright : (C) 2004, 2007, 2008 Peter Hedlund (C) 2005 Eric Pignet @@ -21,7 +21,7 @@ * * ***************************************************************************/ -#include "keduvocwqlreader.h" +#include "qmvocwqlreader.h" #include #include @@ -29,10 +29,10 @@ // #include -#include "keduvocdocument.h" -#include "keduvocexpression.h" +#include "qmvocdocument.h" +#include "qmvocexpression.h" -KEduVocWqlReader::KEduVocWqlReader( QIODevice *file ) +QmVocWqlReader::QmVocWqlReader( QIODevice *file ) { // the file must be already open m_inputFile = file; @@ -40,7 +40,7 @@ KEduVocWqlReader::KEduVocWqlReader( QIODevice *file ) } -bool KEduVocWqlReader::readDoc( KEduVocDocument *doc ) +bool QmVocWqlReader::readDoc( QmVocDocument *doc ) { m_doc = doc; @@ -144,7 +144,7 @@ bool KEduVocWqlReader::readDoc( KEduVocDocument *doc ) if ( inputStream.atEnd() ) return false; - KEduVocLesson* lesson = new KEduVocLesson( "Vocabulary", m_doc->lesson()); + QmVocLesson* lesson = new QmVocLesson( "Vocabulary", m_doc->lesson()); m_doc->lesson()->appendChildContainer(lesson); s = inputStream.readLine(); @@ -169,7 +169,7 @@ bool KEduVocWqlReader::readDoc( KEduVocDocument *doc ) QString b; b = inputStream.readLine(); - KEduVocExpression * expr = new KEduVocExpression( s ); + QmVocExpression * expr = new QmVocExpression( s ); expr->setTranslation( 1, b ); lesson->appendEntry( expr ); } diff --git a/keduvocwqlreader.h b/qmvocwqlreader.h similarity index 81% rename from keduvocwqlreader.h rename to qmvocwqlreader.h index d033faa..2eff94a 100644 --- a/keduvocwqlreader.h +++ b/qmvocwqlreader.h @@ -3,10 +3,11 @@ ***************************************************************************/ /*************************************************************************** - read a KEduVocDocument from a WQL file + read a QmVocDocument from a WQL file ----------------------------------------------------------------------- copyright : (C) 2004, 2007 Peter Hedlund : (c) 2005 Eric Pignet + : (C) 2010 Reto Zingg ***************************************************************************/ @@ -19,20 +20,20 @@ * * ***************************************************************************/ -#ifndef KEDUVOCWQLREADER_H -#define KEDUVOCWQLREADER_H +#ifndef QMVOCWQLREADER_H +#define QMVOCWQLREADER_H #include class QIODevice; -class KEduVocDocument; +class QmVocDocument; -class KEduVocWqlReader +class QmVocWqlReader { public: - KEduVocWqlReader( QIODevice *file ); + QmVocWqlReader( QIODevice *file ); - bool readDoc( KEduVocDocument *doc ); + bool readDoc( QmVocDocument *doc ); QString errorMessage() const { @@ -41,7 +42,7 @@ public: private: QIODevice *m_inputFile; - KEduVocDocument *m_doc; + QmVocDocument *m_doc; QString m_errorMessage; }; diff --git a/keduvocxdxfreader.cpp b/qmvocxdxfreader.cpp similarity index 88% rename from keduvocxdxfreader.cpp rename to qmvocxdxfreader.cpp index b8996fb..70ade40 100644 --- a/keduvocxdxfreader.cpp +++ b/qmvocxdxfreader.cpp @@ -3,7 +3,7 @@ ***************************************************************************/ /*************************************************************************** - create a KEduVocDocument from a XDXF file + create a QmVocDocument from a XDXF file ----------------------------------------------------------------------- copyright : (C) 2007 Peter Hedlund @@ -20,22 +20,22 @@ * * ***************************************************************************/ -#include "keduvocxdxfreader.h" +#include "qmvocxdxfreader.h" #include // #include -#include "keduvocexpression.h" -#include "keduvocdocument.h" +#include "qmvocexpression.h" +#include "qmvocdocument.h" -KEduVocXdxfReader::KEduVocXdxfReader( KEduVocDocument *doc ) +QmVocXdxfReader::QmVocXdxfReader( QmVocDocument *doc ) { m_doc = doc; } -bool KEduVocXdxfReader::read( QIODevice *device ) +bool QmVocXdxfReader::read( QIODevice *device ) { setDevice( device ); @@ -54,7 +54,7 @@ bool KEduVocXdxfReader::read( QIODevice *device ) } -void KEduVocXdxfReader::readUnknownElement() +void QmVocXdxfReader::readUnknownElement() { while ( !atEnd() ) { readNext(); @@ -68,7 +68,7 @@ void KEduVocXdxfReader::readUnknownElement() } -void KEduVocXdxfReader::readXdxf() +void QmVocXdxfReader::readXdxf() { ///The language attributes are required and should be ISO 639-2 codes, but you never know... QStringRef id1 = attributes().value( "lang_from" ); @@ -106,7 +106,7 @@ void KEduVocXdxfReader::readXdxf() } -void KEduVocXdxfReader::readEntry() +void QmVocXdxfReader::readEntry() { QString front; QString back; @@ -119,7 +119,7 @@ void KEduVocXdxfReader::readEntry() back.append( text().toString() ); } - KEduVocExpression expr = KEduVocExpression( front ); + QmVocExpression expr = QmVocExpression( front ); expr.setTranslation( 1, back ); m_doc->lesson()->appendEntry( &expr ); } diff --git a/keduvocxdxfreader.h b/qmvocxdxfreader.h similarity index 81% rename from keduvocxdxfreader.h rename to qmvocxdxfreader.h index ed6b710..32bcea5 100644 --- a/keduvocxdxfreader.h +++ b/qmvocxdxfreader.h @@ -3,9 +3,10 @@ ***************************************************************************/ /*************************************************************************** - create a KEduVocDocument from a XDXF file + create a QmVocDocument from a XDXF file ----------------------------------------------------------------------- copyright : (C) 2007 Peter Hedlund + Copyright : (C) 2010 Reto Zingg ***************************************************************************/ @@ -18,18 +19,18 @@ * * ***************************************************************************/ -#ifndef KEDUVOCXDXFREADER_H -#define KEDUVOCXDXFREADER_H +#ifndef QMVOCXDXFREADER_H +#define QMVOCXDXFREADER_H #include class QIODevice; -class KEduVocDocument; +class QmVocDocument; -class KEduVocXdxfReader : public QXmlStreamReader +class QmVocXdxfReader : public QXmlStreamReader { public: - KEduVocXdxfReader( KEduVocDocument *doc ); + QmVocXdxfReader( QmVocDocument *doc ); bool read( QIODevice *device ); @@ -38,7 +39,7 @@ private: void readXdxf(); void readEntry(); - KEduVocDocument *m_doc; + QmVocDocument *m_doc; }; #endif diff --git a/sharedkvtmlfiles.cpp b/sharedkvtmlfiles.cpp index aa0ab87..106ba3f 100644 --- a/sharedkvtmlfiles.cpp +++ b/sharedkvtmlfiles.cpp @@ -21,7 +21,7 @@ #include "sharedkvtmlfiles.h" -#include "keduvocdocument.h" +#include "qmvocdocument.h" // #include // #include @@ -99,7 +99,7 @@ void SharedKvtmlFilesPrivate::rescan() // } // } // -// KEduVocDocument *doc = new KEduVocDocument(); +// QmVocDocument *doc = new QmVocDocument(); // for ( int i = 0; i < this->m_fileList.size(); ++i ) { // // // open the file @@ -171,7 +171,7 @@ void SharedKvtmlFiles::sortDownloadedFiles() // QString( "kvtml/*.kvtml" ) ); // // -// KEduVocDocument doc; +// QmVocDocument doc; // // while ( !unsortedFiles.isEmpty() ) { // KUrl fileUrl( KUrl::fromPath( unsortedFiles.first() ) ); diff --git a/sharedkvtmlfiles.h b/sharedkvtmlfiles.h index b6690ce..4a30e45 100644 --- a/sharedkvtmlfiles.h +++ b/sharedkvtmlfiles.h @@ -23,7 +23,7 @@ #ifndef SHAREDKVTMLFILES_H #define SHAREDKVTMLFILES_H -#include "libkeduvocdocument_export.h" +#include "libqmvocdocument_export.h" #include @@ -99,31 +99,31 @@ static struct K_GLOBAL_STATIC_STRUCT_NAME(NAME) \ namespace SharedKvtmlFiles { /** get list of all languages found in any files */ - KEDUVOCDOCUMENT_EXPORT QStringList languages(); + QMVOCDOCUMENT_EXPORT QStringList languages(); /** get list of filenames found of given language *@param language language requested QString() for all languages *@return a list of filenames with words in language */ - KEDUVOCDOCUMENT_EXPORT QStringList fileNames( const QString &language = QString() ); + QMVOCDOCUMENT_EXPORT QStringList fileNames( const QString &language = QString() ); /** get the list of document titles found of a given language *@param language requested language QString() for all titles *@return a list of document titles with words in language */ - KEDUVOCDOCUMENT_EXPORT QStringList titles( const QString &language = QString() ); + QMVOCDOCUMENT_EXPORT QStringList titles( const QString &language = QString() ); /** get the list of document remarks found of a given language *@param language requested language QString() for all comments *@return a list of document remarks with words in language */ - KEDUVOCDOCUMENT_EXPORT QStringList comments( const QString &language = QString() ); + QMVOCDOCUMENT_EXPORT QStringList comments( const QString &language = QString() ); /** rescan the shared kvtml locations */ - KEDUVOCDOCUMENT_EXPORT void rescan(); + QMVOCDOCUMENT_EXPORT void rescan(); /** sort files downloaded to kvtml top-level dir into locale sub-folders */ - KEDUVOCDOCUMENT_EXPORT void sortDownloadedFiles(); + QMVOCDOCUMENT_EXPORT void sortDownloadedFiles(); } #endif -- 2.47.3