1 /***************************************************************************
2 keducaview.h - description
4 begin : Thu May 24 2001
5 copyright : (C) 2001 by Javier Campos
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
24 #include <qsplitter.h>
25 #include <qwidgetstack.h>
37 /**Main view of keduca file (questions and answers)
38 This is the widget for asking questions and allowing selection of answers
39 as used by KEduca TestMaster (class KEduca)
40 *@author Javier Campos
43 class KEducaView
: public QWidgetStack
48 KEducaView(QWidget
*parent
=0, const char *name
=0);
51 bool openURL( const KURL
&url
);
52 FileRead
const *getKeducaFile() const {return _keducaFile
; };
58 /** Init graphical interface */
60 /** Show record, returns false if there is no record to show. */
63 void showResults( const QString
&text
);
67 QString
setFinalResult();
70 /** current results Points */
71 QString
currentStatusPoints();
72 /** Set HTML table view with correct and incorrect answers */
73 QString
getTableQuestion( bool isCorrect
, const QString
&correct
, const QString
&incorrect
);
74 /** Define the next questions (random, secuencial) */
77 QString
getInformation();
78 /** Init table with title and colspan */
79 QString
insertTable( const QString
&title
= "", unsigned int col
=0);
81 QString
insertRow( const QString
&text
, bool title
, unsigned int colSpan
=0 );
82 QString
insertRow( const QString
&label
, const QString
&field
, bool formBased
);
83 QString
insertRow( const QString
&label1
, const QString
&field1
, const QString
&label2
, const QString
&field2
, bool formBased
);
84 /** Close current table */
85 QString
insertTableClose();
91 QWidget
*_infoWidget
, *_questionWidget
, *_resultsWidget
;
93 KPushButton
*_buttonNext
;
94 KPushButton
*_buttonSave
;
95 KPushButton
*_buttonResultsNext
; // FIXME: this is a hack
96 KPushButton
*_buttonStartTest
;
97 /** Group of answers. This is a frame an check or radio buttons. */
98 KGroupEduca
*_buttonGroup
;
100 FileRead
*_keducaFile
;
101 /** A question text with pixmaps and movies support */
102 KQuestion
*_questionText
;
103 /** A question text with pixmaps and movies support */
104 QTextEdit
*_viewResults
;
105 QTextEdit
*_viewInfo
;
106 /** Current record */
107 int _keducaFileIndex
;
108 /** Current results */
114 /** Current results */
115 QString _currentResults
;
116 /** If is init window */
118 QTimer
*_timeoutTimer
;
119 /** Num of correct answers */
121 /** Number of incorrect answers */
122 int _incorrectAnswer
;
123 /** Number of correct answers in points*/
125 /** Number of incorrect answers in points*/
126 int _incorrectPoints
;
129 /** Show results when finish? */
130 bool _showResultFinish
;
131 /** Show random questions */
132 bool _showRandomQuestions
;
133 /** Show random answers */
134 bool _showRandomAnswers
;
135 /** Save real order by random questions */
136 QValueList
<uint
> _randomQuestions
;
137 /** Save real order by random answers */
138 QValueList
<uint
> _randomAnswers
;
140 /** Button Next action */
141 void slotButtonNext();
142 void slotButtonSave();
143 void slotButtonStartTest();
144 void questionTimedOut();