moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / keduca / keduca / keducaview.h
blob416a91399cfaf1cc9c571b7ac7f1ec016d663ac3
1 /***************************************************************************
2 keducaview.h - description
3 -------------------
4 begin : Thu May 24 2001
5 copyright : (C) 2001 by Javier Campos
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
18 #ifndef KEDUCAVIEW_H
19 #define KEDUCAVIEW_H
21 #include <kurl.h>
23 #include <qlayout.h>
24 #include <qsplitter.h>
25 #include <qwidgetstack.h>
27 class QTimer;
28 class QTextEdit;
29 class QLabel;
31 class KPushButton;
33 class FileRead;
34 class KQuestion;
35 class KGroupEduca;
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
45 Q_OBJECT
47 public:
48 KEducaView(QWidget *parent=0, const char *name=0);
49 ~KEducaView();
50 /** Open url */
51 bool openURL( const KURL &url);
52 FileRead const *getKeducaFile() const {return _keducaFile; };
54 private:
56 // Private methods
58 /** Init graphical interface */
59 void init();
60 /** Show record, returns false if there is no record to show. */
61 void showRecord();
62 /** Show results */
63 void showResults( const QString &text );
64 /** Set results */
65 void setResults();
66 /** Set results */
67 QString setFinalResult();
68 /** Write settings */
69 void configWrite();
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) */
75 bool questionNext();
77 QString getInformation();
78 /** Init table with title and colspan */
79 QString insertTable( const QString &title = "", unsigned int col=0);
80 /** Insert row */
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();
87 // Private attributes
89 /** Widgets */
90 QLabel *_introWidget;
91 QWidget *_infoWidget, *_questionWidget, *_resultsWidget;
92 /** Push Buttons */
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;
99 /** KEDUCA file */
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 */
109 QString _results;
110 /** Main vbox */
111 QVBoxLayout *_vbox2;
112 /** Main splitt */
113 QSplitter *_split;
114 /** Current results */
115 QString _currentResults;
116 /** If is init window */
117 bool _isInitStatus;
118 QTimer *_timeoutTimer;
119 /** Num of correct answers */
120 int _correctAnswer;
121 /** Number of incorrect answers */
122 int _incorrectAnswer;
123 /** Number of correct answers in points*/
124 int _correctPoints;
125 /** Number of incorrect answers in points*/
126 int _incorrectPoints;
127 /** Current time */
128 int _currentTime;
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;
139 private slots:
140 /** Button Next action */
141 void slotButtonNext();
142 void slotButtonSave();
143 void slotButtonStartTest();
144 void questionTimedOut();
147 #endif