From: Martin Pfeiffer Date: Fri, 8 Jul 2005 14:39:45 +0000 (+0000) Subject: some little changes X-Git-Tag: v3.80.2~237^2~33 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=40ec2d530ece7c678604099b6c565981cb7f4a0e;p=libqmvoc.git some little changes svn path=/branches/work/kwordquiz/src/keduvocdocument.h; revision=432783 --- diff --git a/kwordquiz/keduvocdocument.cpp b/kwordquiz/keduvocdocument.cpp index d5f976b..ebd681a 100644 --- a/kwordquiz/keduvocdocument.cpp +++ b/kwordquiz/keduvocdocument.cpp @@ -37,6 +37,7 @@ using namespace std; #include "keduvockvtmlwriter.h" #include "keduvockvtmlreader.h" +#include "leitnersystem.h" //#include "prefs.h" //******************************************************** @@ -86,6 +87,9 @@ void KEduVocDocument::Init () doc_url.setFileName(i18n("Untitled")); doctitle = ""; author = ""; + + activeLeitnerSystem = false; + leitnerSystem = 0; } @@ -661,6 +665,67 @@ bool KEduVocDocument::sortByLesson_index () return sort_lesson; } +bool KEduVocDocument::leitnerSystemActive() +{ + return activeLeitnerSystem; +} + +void KEduVocDocument::setLeitnerSystemActive( bool yes ) +{ + if( yes ) + { + if( leitnerSystem == 0 ) + createStandardLeitnerSystem(); //if nothing is loaded yet + + activeLeitnerSystem = true; + } + else if( !yes ) + activeLeitnerSystem = false; +} + +void KEduVocDocument::createStandardLeitnerSystem() +{ + LeitnerSystem* tmpSystem = new LeitnerSystem(); + QString name = "Standard"; + + tmpSystem->setSystemName( name ); + tmpSystem->insertBox( "Box 1" ); + tmpSystem->insertBox( "Box 2" ); + tmpSystem->insertBox( "Box 3" ); + tmpSystem->insertBox( "Box 4" ); + tmpSystem->insertBox( "Box 5" ); + + tmpSystem->setCorrectBox( "Box 1", "Box 2" ); + tmpSystem->setWrongBox( "Box 1", "Box 1" ); + + tmpSystem->setCorrectBox( "Box 2", "Box 3" ); + tmpSystem->setWrongBox( "Box 2", "Box 1" ); + + tmpSystem->setCorrectBox( "Box 3", "Box 4" ); + tmpSystem->setWrongBox( "Box 3", "Box 1" ); + + tmpSystem->setCorrectBox( "Box 4", "Box 5" ); + tmpSystem->setWrongBox( "Box 4", "Box 1" ); + + tmpSystem->setCorrectBox( "Box 5", "Box 1" ); + tmpSystem->setWrongBox( "Box 5", "Box 1" ); + + leitnerSystem = tmpSystem; +} + +void KEduVocDocument::setLeitnerSystem( LeitnerSystem* system ) +{ + leitnerSystem = system; + + /*KWordQuizApp* app = (KWordQuizApp*) parent(); + app->slotLeitnerSystem();*/ +} + +LeitnerSystem* KEduVocDocument::getLeitnerSystem() +{ + return leitnerSystem; +} + class resetAll : public unary_function { diff --git a/kwordquiz/keduvocdocument.h b/kwordquiz/keduvocdocument.h index 35ca42e..af0aac3 100644 --- a/kwordquiz/keduvocdocument.h +++ b/kwordquiz/keduvocdocument.h @@ -243,6 +243,7 @@ class QTextStream; class QStringList; class MultipleChoice; +class LeitnerSystem; /************************************************************* * This class contains the expressions of your vocabulary @@ -590,6 +591,12 @@ class KEduVocDocument : public QObject */ void setSizeHint (int index, const int width); + bool leitnerSystemActive(); + void setLeitnerSystemActive(bool yes); + void createStandardLeitnerSystem(); + void setLeitnerSystem( LeitnerSystem* system ); + LeitnerSystem* getLeitnerSystem(); + bool unknownAttribute (int line, const QString &name, const QString &attr); void unknownElement (int line, const QString &elem ); void errorKvtMl (int line, const QString &text ); @@ -671,6 +678,9 @@ protected: vector
articles; vector conjugations; + + LeitnerSystem* leitnerSystem; + bool activeLeitnerSystem; };