TermScheduler.h

Go to the documentation of this file.
00001 #ifndef TERM_SCHEDULER_H
00002 #define TERM_SCHEDULER_H
00003 
00004 #include <qvaluelist.h>
00005 #include <iostream.h>
00006 #include <stdlib.h>
00007 #include <time.h>
00008 #include "BilingualKey.h"
00009 #include "Folder.h"
00010 #include "Preferences.h"
00011 #include "StandbyTerm.h"
00012 #include "TermKey.h"
00013 #include "Vocabulary.h"
00014 
00015 class TermScheduler {
00016 
00017     static const Q_UINT32 magicNumber( Q_UINT32( 0x22446677 ) );
00018     static const uint standbyPoolSize = 5;
00019 
00020 public:
00021 
00022     static const uint poolCount  = 5;
00023 
00024     TermScheduler( const Preferences& prefs );
00025     TermScheduler( const TermScheduler& scheduler );
00026     ~TermScheduler();
00027  
00028     bool isResumableQuizAvailable( const BilingualKey& key ) const;
00029     bool load( const BilingualKey& key );
00030     bool save();
00031 
00032     void concludeQuiz();
00033     void setApplicationDirName( const QString& applDir );
00034 
00035     QString getQuizFirstLanguage() const;
00036     QString getQuizTestLanguage() const;
00037     bool isQuizInProgress() const;
00038     void init( const QString& firstLanguage, const QString& testLanguage, Folder* rootFolder );
00039     void reinit();
00040     void addTerm( const TermKey& termKey, const int priority = 0 );
00041     void discardCurrentTerm();
00042     const TermKey getCurrentTerm() const;
00043     bool hasNextTerm() const;
00044     const TermKey getNextTerm();
00045     void increaseTermPriority();
00046     void decreaseTermPriority();
00047     void rightAnswer();
00048     void wrongAnswer();
00049     int getProgress() const;
00050     int getInitialTermCount() const;    
00051 
00052 private:
00053 
00054     void initRec( const QString& firstLanguage, const QString& testLanguage, Folder* folder );
00055     void initRec( const QString& firstLanguage, const QString& testLanguage, Vocabulary* vocab );
00056     void putCurrentTermOnStandby();
00057     void reintroduceStandbyTerm();
00058     QString getFilename( const BilingualKey& key ) const;
00059 
00060     QString                 quizFirstLang;
00061     QString                 quizTestLang;
00062 
00063     QValueList<TermKey>     termPool[ poolCount ];
00064     QValueList<StandbyTerm> standbyPool; 
00065 
00066     QValueList<TermKey>     allTerms;
00067 
00068     uint                    initQuizLength;
00069     int                     initTermCount;
00070     int                     currTermPool;
00071     TermKey                 currTerm;
00072 
00073     const Preferences&      prefs;
00074 
00075     QString                 applDir;
00076 
00077     friend QDataStream& operator<<( QDataStream& out, const TermScheduler& scheduler );
00078     friend QDataStream& operator>>( QDataStream& in, TermScheduler& scheduler );
00079 
00080 };
00081 
00082 #endif

Generated on Sun Mar 1 17:30:47 2009 for toMOTko by  doxygen 1.5.6