QuizFrame.h

Go to the documentation of this file.
00001 #ifndef QUIZ_H
00002 #define QUIZ_H
00003 
00004 #include <qapplication.h>
00005 #include <qevent.h>
00006 #include <qfont.h>
00007 #include <qframe.h>
00008 #include <qhbox.h>
00009 #include <qhgroupbox.h>
00010 #include <qiconset.h>
00011 #include <qlabel.h>
00012 #include <qlayout.h>
00013 #include <qlineedit.h>
00014 #include <qmessagebox.h>
00015 #include <qmultilineedit.h>
00016 #include <qobjectlist.h>
00017 #include <qpushbutton.h>
00018 #include <qsizepolicy.h>
00019 #include <qstringlist.h>
00020 #include <qtooltip.h>
00021 #include <qvbox.h>
00022 #include <qvgroupbox.h>
00023 #include <qwidgetstack.h>
00024 #include <qpe/resource.h>
00025 #include "Controller.h"
00026 #include "ImageBox.h"
00027 #include "ScrollableLineEdit.h"
00028 #include "ScrollableMultiLineEdit.h"
00029 #include "Term.h"
00030 #include "TermDialog.h"
00031 #include "Translation.h"
00032 #include "Util.h"
00033 
00034 extern QAction* action[ ACTION_COUNT ];
00035 
00036 class QuizFrame : public QWidget {
00037 
00038     Q_OBJECT
00039 
00040 public:
00041 
00042     QuizFrame( Controller* controller, QWidget* parent = 0, const char* name = 0 );
00043     ~QuizFrame();
00044 
00045     void startQuiz();
00046     void restartQuiz();
00047     void resumeQuiz();
00048     void setTerm( const Term& term );
00049     void concludeQuiz();
00050     Term* askCurrentTerm();
00051     Term* askNextTerm();
00052     void askTerm( const Term& term );
00053     void updateLanguageLabels();
00054     void setButtonsHidden( bool areHidden );
00055     bool areButtonsHidden() const;
00056 
00057 protected:
00058 
00059     void showEvent( QShowEvent* showEvt );
00060     void hideEvent( QHideEvent* hideEvt );
00061     bool event( QEvent* evt );
00062 
00063 public slots:
00064 
00065     virtual bool eventFilter( QObject* obj, QEvent* evt );
00066 
00067     void scrollLeft();
00068     void scrollRight();
00069 
00070     void updateFonts();
00071     void retranslateUi();
00072 
00073     void toggleMaximizeComment( bool isOn );
00074 
00075 signals:
00076 
00077     void quizShown();
00078     void quizHidden();
00079 
00080 private slots:
00081 
00082     void rightAnswer();
00083     void wrongAnswer();
00084     void reveal();
00085     void revealAll();
00086     void revealAltTerm();
00087     void revealFirstLangTerm();
00088     void revealTestLangTerm();
00089     void revealComment();
00090     void revealImage();
00091 
00092     void editCurrentTerm();
00093 
00094 private:
00095 
00096     void init();
00097 
00098     void hideAnswers();
00099     void setButtonsEnabled( bool isEnabled );
00100 
00101     bool isFirstLangTermRevealed() const;
00102     bool isAltTermRevealed() const;
00103     bool isTestLangTermRevealed() const;
00104     bool isCommentRevealed() const;
00105     bool isImageRevealed() const;
00106 
00107     void maximizeCommentField();
00108     void restoreCommentField();
00109 
00110     Controller*                 controller;
00111 
00112     QVBoxLayout*                mainLayout;
00113 
00114     QHBox*                      topPanel;
00115     QVBox*                      topLeftPanel;
00116 
00117     QHGroupBox*                 firstLangPanel;
00118     QVGroupBox*                 testLangPanel;
00119 
00120     QWidget*                    controlPanel;
00121     QHBoxLayout*                controlPanelLayout;
00122     QHBox*                      answerControlPanel;
00123     QPushButton*                revealAllDataButton;
00124     QPushButton*                rightAnswerButton;
00125     QPushButton*                wrongAnswerButton;
00126     QPushButton*                editionButton;
00127 
00128     QWidget*                    firstLangTermPanel;
00129     QHBoxLayout*                firstLangTermPanelLayout;
00130     
00131     QLabel*                     firstLangTermLabel;
00132     QWidgetStack*               firstLangTermStack;
00133     ScrollableLineEdit*         firstLangTermLineEdit;
00134     QPushButton*                firstLangTermButton;
00135 
00136     QWidget*                    testLangTopPanel;
00137     QBoxLayout*                 testLangTopPanelLayout;
00138     QVBox*                      testLangLabelsPanel;
00139     QVBox*                      testLangFieldsPanel;
00140     
00141     QLabel*                     testLangTermLabel;
00142     QWidgetStack*               testLangTermStack;
00143     ScrollableLineEdit*         testLangTermLineEdit;
00144     QPushButton*                testLangTermButton;
00145 
00146     QLabel*                     testLangTermAltLabel;
00147     QWidgetStack*               testLangTermAltStack;
00148     ScrollableLineEdit*         testLangTermAltLineEdit;
00149     QPushButton*                testLangTermAltButton;
00150    
00151     QVBox*                      commentBox;
00152     QWidget*                    commentLabelPanel;
00153     QHBoxLayout*                commentLabelPanelLayout;
00154     QLabel*                     commentLabel;
00155     QPushButton*                maximizeCommentButton;
00156     QWidgetStack*               commentStack;
00157     ScrollableMultiLineEdit*    commentMultiLineEdit;
00158     QPushButton*                commentButton;
00159 
00160     ImageBox*                   imageBox;
00161 
00162     bool                        buttonsHidden;
00163 
00164 };
00165 
00166 #endif

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