SVN commit 433985 by mpfeiffer: integrated the leitner system in the quiz M +10 -0 keduvocexpression.cpp M +13 -0 keduvocexpression.h M +10 -0 leitnersystem.cpp M +2 -0 leitnersystem.h M +6 -0 wqquiz.cpp --- branches/work/kwordquiz/src/keduvocexpression.cpp #433984:433985 @@ -790,3 +790,13 @@ exprtypes[idx] = type.stripWhiteSpace(); } +void KEduVocExpression::setLeitnerBox( const QString& box ) +{ + leitnerBox = box; +} + +QString& KEduVocExpression::getLeitnerBox() +{ + return leitnerBox; +} + --- branches/work/kwordquiz/src/keduvocexpression.h #433984:433985 @@ -416,6 +416,18 @@ */ void incQueryCount (int index, bool rev_count = false); + /** sets the box of the Leitner system which actually contains the expression + * + * @param box the box's name + */ + void setLeitnerBox(const QString& box); + + /** returns the name of the Leitner system's box actually containing the expression + * + * @result the box's name + */ + QString& getLeitnerBox(); + protected: void Init(); @@ -447,6 +459,7 @@ vector comparisons; vector mcs; + QString leitnerBox; int lesson; bool inquery; bool active; --- branches/work/kwordquiz/src/leitnersystem.cpp #433984:433985 @@ -92,6 +92,16 @@ return m_boxes[ box ].getWrongWordBox()->getBoxName(); } +const QString& LeitnerSystem::getCorrectBox( QString& box ) +{ + return getBoxWithName( box )->getCorrectWordBox()->getBoxName(); +} + +const QString& LeitnerSystem::getWrongBox( QString& box ) +{ + return getBoxWithName( box )->getWrongWordBox()->getBoxName(); +} + int LeitnerSystem::getWrongBoxNumber( int box ) { return getNumber( m_boxes[ box ].getWrongWordBox() ); --- branches/work/kwordquiz/src/leitnersystem.h #433984:433985 @@ -45,6 +45,8 @@ const QString& getCorrectBox( int box ); //returns the correct word box of "int box" const QString& getWrongBox( int box ); //returns the wrong word box of "int box" + const QString& getCorrectBox( QString& box ); + const QString& getWrongBox( QString& box ); int getWrongBoxNumber( int box ); int getCorrectBoxNumber( int box ); --- branches/work/kwordquiz/src/wqquiz.cpp #433984:433985 @@ -20,6 +20,7 @@ #include +#include "leitnersystem.h" #include "kwordquiz.h" #include "wqquiz.h" #include "prefs.h" @@ -279,11 +280,16 @@ } } + + QString tmpLeitner( m_doc->getEntry(li->oneOp())->getLeitnerBox() ); if (!result) { + m_doc->getEntry(li->oneOp())->setLeitnerBox(m_doc->getLeitnerSystem()->getWrongBox( tmpLeitner )); m_errorList -> append(li); } + else + m_doc->getEntry(li->oneOp())->setLeitnerBox(m_doc->getLeitnerSystem()->getCorrectBox( tmpLeitner )); return result; }