From: Frederik Gladhorn Date: Mon, 27 Aug 2007 09:41:33 +0000 (+0000) Subject: Added some special type handling functions to KEduVocWordType. Made special types... X-Git-Tag: v3.93.0~50 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=83dfc9d3145e6a76c7c245154f127afc2483fd65;p=libqmvoc.git Added some special type handling functions to KEduVocWordType. Made special types into static const strings, these have to be used now instead of hard coded string const. Fix: When selecting a new word type, the type box was not updated. (Still expected the old type handling system.) First class to really use special types. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=705142 --- diff --git a/keduvocdocument/keduvocwordtype.cpp b/keduvocdocument/keduvocwordtype.cpp index 06d4d94..2ed03ac 100644 --- a/keduvocdocument/keduvocwordtype.cpp +++ b/keduvocdocument/keduvocwordtype.cpp @@ -79,11 +79,54 @@ public: static const QString KVTML_1_TYPE_USER; static const QString KVTML_1_TYPE_DIV; + + static const QString WORDTYPE_NOUN; + static const QString WORDTYPE_NOUN_MALE; + static const QString WORDTYPE_NOUN_FEMALE; + static const QString WORDTYPE_NOUN_NEUTRAL; + + static const QString WORDTYPE_VERB; + static const QString WORDTYPE_VERB_REGULAR; + static const QString WORDTYPE_VERB_IRREGULAR; + static const QString WORDTYPE_ADJECTIVE; + static const QString WORDTYPE_ADVERB; + + static const QString WORDTYPE_NOUN_EXPLANATION; }; const QString KEduVocWordType::Private::KVTML_1_TYPE_USER = QString("#"); const QString KEduVocWordType::Private::KVTML_1_TYPE_DIV = QString(":"); +const QString KEduVocWordType::Private::WORDTYPE_NOUN = QString("noun"); +const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE = QString("noun:male"); +const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE = QString("noun:female"); +const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL = QString("noun:neutral"); + +const QString KEduVocWordType::Private::WORDTYPE_VERB = QString("verb"); +const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR = QString("verb:regular"); +const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR = QString("verb:irregular"); + +const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE = QString("adjective"); +const QString KEduVocWordType::Private::WORDTYPE_ADVERB = QString("adverb"); + + + + +const QString KEduVocWordType::Private::WORDTYPE_NOUN_EXPLANATION = QString(i18n("This holds the words of type noun. You can rename it but not delete since the article training relies on it!")); + +/* + +const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE = QString("male", "This holds the words of type noun male. You can rename it but not delete since the article training relies on it!"); +const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE = QString("female", "This holds the words of type noun female. You can rename it but not delete since the article training relies on it!"); +const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL = QString("neutral", "This holds the words of type noun neutral. You can rename it but not delete since the article training relies on it!"); + +const QString KEduVocWordType::Private::WORDTYPE_VERB = QString("verb", "This holds the words of type verb. You can rename it but not delete since the article training relies on it!"); +const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR = QString("regular", "This holds the words of type regular verbs. You can rename it but not delete since the article training relies on it!"); +const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR = QString("irregular", "This holds the words of type irregular verbs. You can rename it but not delete since the article training relies on it!"); + +const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE = QString("adjective", "This holds the words of type adjective. You can rename it but not delete since the article training relies on it!"); +const QString KEduVocWordType::Private::WORDTYPE_ADVERB = QString("adverb", "This holds the words of type adverb. You can rename it but not delete since the article training relies on it!");*/ + KEduVocWordType::KEduVocWordType() @@ -413,3 +456,35 @@ QString KEduVocWordType::specialSubType(const QString & mainTypeName, const QStr return QString(); } + + +QString KEduVocWordType::nounSpecialType() const +{ + return d->WORDTYPE_NOUN; +} + +QString KEduVocWordType::verbSpecialType() const +{ + return d->WORDTYPE_VERB; +} + +QString KEduVocWordType::adjectiveSpecialType() const +{ + return d->WORDTYPE_ADJECTIVE; +} + +QString KEduVocWordType::adverbSpecialType() const +{ + return d->WORDTYPE_ADVERB; +} + +QString KEduVocWordType::typeOfSpecialType(const QString & specialType) const +{ + for ( int i=0; i < d->m_wordTypeList.count(); i++ ) { + if ( d->m_wordTypeList.value(i).m_specialType == specialType ) { + return d->m_wordTypeList.value(i).m_typeName; + } + } + return QString(); +} + diff --git a/keduvocdocument/keduvocwordtype.h b/keduvocdocument/keduvocwordtype.h index 4387f5b..b748fa5 100644 --- a/keduvocdocument/keduvocwordtype.h +++ b/keduvocdocument/keduvocwordtype.h @@ -102,6 +102,13 @@ public: QString mainTypeFromOldFormat(const QString& typeSubtypeString) const; QString subTypeFromOldFormat(const QString& typeSubtypeString) const; + QString typeOfSpecialType( const QString& specialType ) const; + + QString nounSpecialType() const; + QString verbSpecialType() const; + QString adjectiveSpecialType() const; + QString adverbSpecialType() const; + private: void initOldTypeLists();