]> Git trees. - libqmvoc.git/commitdiff
some little changes
authorMartin Pfeiffer <hubipete@gmx.net>
Fri, 8 Jul 2005 14:39:45 +0000 (14:39 +0000)
committerMartin Pfeiffer <hubipete@gmx.net>
Fri, 8 Jul 2005 14:39:45 +0000 (14:39 +0000)
svn path=/branches/work/kwordquiz/src/keduvocdocument.h; revision=432783

kwordquiz/keduvocdocument.cpp
kwordquiz/keduvocdocument.h

index d5f976be5f4a0f011d44253f2ca5029b29c0d806..ebd681a12afc2e3258a2edb7bdb87e313b5a349e 100644 (file)
@@ -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<KEduVocExpression, void>
 {
index 35ca42ebe0e47a5afa816ec72307e38963097e65..af0aac36b985fdf736cd166b88651ac0b0c19c52 100644 (file)
 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<Article>        articles;
   vector<Conjugation>    conjugations;
+
+  LeitnerSystem*        leitnerSystem;
+  bool                  activeLeitnerSystem;
 };