]> Git trees. - libqmvoc.git/commitdiff
Use the index from the Conjugation class in the conjugation practice for the line...
authorFrederik Gladhorn <gladhorn@kde.org>
Thu, 11 Oct 2007 18:27:03 +0000 (18:27 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Thu, 11 Oct 2007 18:27:03 +0000 (18:27 +0000)
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

keduvocdocument/keduvocconjugation.cpp
keduvocdocument/keduvocconjugation.h

index 9439f546d8b3e16c3c7466244e0cf293bbdac8fb..498e253a66f717c526dc930f1970680bee99a3ca 100644 (file)
@@ -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;
 }
index 6cad438cd99fbae82cefb72baa88c10add9b14c3..2fabf9f09f3c9c145ac69e56965748e84e1e04f6 100644 (file)
@@ -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;