From: Frederik Gladhorn Date: Thu, 11 Oct 2007 18:27:03 +0000 (+0000) Subject: Use the index from the Conjugation class in the conjugation practice for the line... X-Git-Tag: v3.95.0~10 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=9beda61944ca68d2e7ea2c169434cfdcff38cd42;p=libqmvoc.git Use the index from the Conjugation class in the conjugation practice for the line edits. Much cleaner less redundant code. Change from totaly unusable to actually somewhat working. Askes the tenses chosen in the config and actually should even ask one tense after the other. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=724206 --- diff --git a/keduvocdocument/keduvocconjugation.cpp b/keduvocdocument/keduvocconjugation.cpp index 9439f54..498e253 100644 --- a/keduvocdocument/keduvocconjugation.cpp +++ b/keduvocdocument/keduvocconjugation.cpp @@ -85,15 +85,20 @@ bool KEduVocConjugation::operator ==(const KEduVocConjugation& other) const } -QString KEduVocConjugation::conjugation(ConjugationPerson person, ConjugationNumber number) const +QString KEduVocConjugation::conjugation(int index) const { - int index = indexOf(person, number); if ( d->m_conjugations.contains(index) ) { return d->m_conjugations.value(index); } return QString(); } + +QString KEduVocConjugation::conjugation(ConjugationPerson person, ConjugationNumber number) const +{ + return conjugation(indexOf(person, number)); +} + void KEduVocConjugation::setConjugation(const QString & conjugation, ConjugationPerson person, ConjugationNumber number) { if ( !conjugation.isEmpty() ) { @@ -107,7 +112,7 @@ void KEduVocConjugation::setConjugation(const QString & conjugation, Conjugation } -int KEduVocConjugation::indexOf(ConjugationPerson person, ConjugationNumber number) const +int KEduVocConjugation::indexOf(ConjugationPerson person, ConjugationNumber number) { return person + PersonMAX * number; } diff --git a/keduvocdocument/keduvocconjugation.h b/keduvocdocument/keduvocconjugation.h index 6cad438..2fabf9f 100644 --- a/keduvocdocument/keduvocconjugation.h +++ b/keduvocdocument/keduvocconjugation.h @@ -67,11 +67,12 @@ public: bool operator == ( const KEduVocConjugation& a ) const; QString conjugation(ConjugationPerson person, ConjugationNumber number) const; + QString conjugation(int index) const; void setConjugation(const QString& conjugation, ConjugationPerson person, ConjugationNumber number); bool isEmpty(); - int indexOf(ConjugationPerson person, ConjugationNumber number) const; + static int indexOf(ConjugationPerson person, ConjugationNumber number); private: class Private;