summaryrefslogtreecommitdiffstats
path: root/kpercentage/kpercentage/kanswer.h
blob: 5d603e4141eae782e2c76bd2bbd17fa6400c0cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/***************************************************************************
                        kanswer.h  -  description
                           -------------------
  begin                : Fri Nov 30 2001
  copyright            : (C) 2001 by Matthias Messmer &
                                     Carsten Niehaus &
                                     Robert Gogolok
  email                : bmlmessmer@web.de &
                         cniehaus@gmx.de &
                         mail@robert-gogolok.de
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KANSWER_H
#define KANSWER_H

// Qt includes

// KDE includes
#include <kdialog.h>

class QCanvas;
class QCanvasPixmapArray;
class QCanvasSprite;
class QCanvasView;
class QHBoxLayout;
class QLabel;

class KAnimation;

class KPushButton;

/**
 * A small dialog, which gives feedback, if the input was wrong or false.
 * It provides reading several sentences from file and selecting by chance.
 *
 * @author Matthias Messmer & Carsten Niehaus & Robert Gogolok
 */
class KAnswer : public KDialog
{
    Q_OBJECT
    public:
        /**
        * The constructor doesn't need any parameters but the parent,
        * because it will not be used in any other context.
        *
        * @param parent Parent widget for modal functionality
        */
        KAnswer( TQWidget *parent );

        // public functions
        /** setting/changing feedback text and pic */
        void setAnswer( int modus );

    public slots:
        /** reimplemented: close the window after some time */
        void timerEvent( TQTimerEvent * );
        void accept();
        
        int exec();

    private:
        // private functions
        /** Loads feadback sentences from file */
        void loadAnswers();
        /** Gets a answer by chance for well solved tasks. */
        TQString getRightAnswer();
        /** Gets a answer by chance for not solved tasks. */
        TQString getWrongAnswer();

        // GUI widgets
        /** Label for the answer text */
        TQLabel *TextLabelAnswer;
        /** OK button */
        KPushButton *ButtonOK;

        /** List of feedback text for well solved tasks. */
        TQStringList rightAnswerList;
        /** List of feedback text for not solved tasks. */
        TQStringList wrongAnswerList;

        TQHBoxLayout *mainLayout;

        KAnimation *right_animation;
        KAnimation *wrong_animation;
        
        int advPer;

        TQCanvasView *canvas_view;
        TQCanvasPixmapArray *pixs;
        TQCanvas *canvas;

        void setupSprite();
};

#endif