moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kbruch / src / taskview.h
blob60c3e75c43bcc59f80880994bd9ec379870d93f0
1 /***************************************************************************
2 taskview.cpp - Header File
3 -------------------
4 begin : Tue Feb 08 13:42:00 CET 2002
5 copyright : (C) 2001 - 2004 by Sebastian Stein
6 email : seb.kde@hpfsc.de
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 TASKVIEW_H
19 #define TASKVIEW_H
21 #define _CHECK_TASK 0
22 #define _NEXT_TASK 1
24 #include "exercisebase.h"
25 #include "resultwidget.h"
26 #include "task.h"
27 #include "taskwidget.h"
29 #ifdef DEBUG
30 #include <kdebug.h>
31 #endif
33 #include <qwidget.h>
36 class QVBoxLayout;
37 class QHBoxLayout;
38 class QGridLayout;
39 class QSpacerItem;
40 class QLabel;
41 class QPushButton;
42 class QLineEdit;
43 class QFrame;
45 /*! Constructs a QWidget, which shows the task to the user.
46 * The class also provides input fields, so that the user can enter the result.
47 * It also controls the interaction, so that the entered result gets checked
48 * and a new task can be generated.
49 * \author Sebastian Stein
50 * */
51 class TaskView : public ExerciseBase
53 Q_OBJECT
55 public:
56 /** constructor */
57 TaskView(QWidget * parent = 0, const char * name = 0,
58 bool padd_sub = true, bool pmul_div = false,
59 unsigned int pnr_ratios = 2, unsigned int pmax_md = 10);
61 /** destructor */
62 ~TaskView();
64 /** set new task parameters, which will be used for the next task to be
65 * generated */
66 void setTaskParameters(bool padd_sub, bool pmul_div, unsigned int pnr_ratios, unsigned int pmax_md);
68 /** force the creation of a new task */
69 void forceNewTask();
71 public slots:
72 void update();
74 signals:
75 /** class emits this signal, if the task was solved correctly by the user */
76 void signalTaskSolvedCorrect();
78 /** class emits this signal, if the task was solved not correctly by the user
79 * */
80 void signalTaskSolvedWrong();
82 private:
83 bool add_sub;
84 bool mul_div;
85 unsigned int nr_ratios;
86 unsigned int curr_nr_ratios;
87 unsigned int max_md;
88 short m_currentState;
90 ResultWidget* m_resultWidget;
91 QPushButton* m_checkButton;
92 QLabel* result_label;
93 TaskWidget* m_taskWidget;
94 QLineEdit* numer_edit;
95 QFrame* edit_line;
96 QLineEdit* deno_edit;
98 QGridLayout* baseGrid;
99 QWidget* baseWidget;
100 QVBoxLayout* realLayout;
102 task current_task;
103 ratio result;
104 ratio entered_result;
106 void showResult();
107 void nextTask();
109 private slots:
110 void slotCheckButtonClicked();
113 #endif