moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / klettres / klettres / klettresview.h
blobd80ceeaa0407feb4410fb18c6cdd53cdf4d9e7d4
1 /***************************************************************************
2 * Copyright (C) 2001-2005 by Anne-Marie Mahfouf *
3 * annemarie.mahfouf@free.fr *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef KLETTRESVIEW_H
22 #define KLETTRESVIEW_H
24 #include <qwidget.h>
25 #include <qpalette.h>
26 #include <klineedit.h>
28 class QLabel;
29 class KLettres;
31 /**
32 * This class serves as the view for KLettres. It holds the GUI for the kid and grown-up looks
33 * and has the code to display the letter/syllable and play the sound.
35 * @short KLettres View class
36 * @author Anne-Marie Mahfouf <annma@kde.org>
37 * @version 1.1
41 class KLettresView : public QWidget
43 Q_OBJECT
44 public:
45 /**
46 * Default constructor
48 KLettresView(KLettres *parent);
50 /**
51 * Destructor
53 virtual ~KLettresView();
55 ///Set the Grown-up background, show menubar, show the Kid button
56 void viewThemeArctic();
57 ///Set the Kid background pic, hide the menubar, show the Grownup button
58 void viewThemeClassroom();
59 ///Set the Desert background pic, hide the menubar, show the Grownup button
60 void viewThemeDesert();
61 ///Start playing displaying a new letter/syllable, playing the associated sound
62 void game();
64 int selectedLanguage;
65 ///The timer value i.e. the time for displaying the letters/syllables
66 int m_timer;
67 ///A Klettres object
68 KLettres *m_klettres;
69 ///The line where the user enters his/her input
70 KLineEdit *m_letterEdit;
72 protected:
74 ///The pixmaps for the themes backgrounds
75 QPixmap m_grownupPicture,
76 m_kidPicture,
77 m_desertPicture;
78 ///Palette changes wether it's kid or grown-up
79 QPalette pal;
80 QColorGroup cg;
81 ///cursor position in the line edit
82 int m_cursorPos;
83 ///Random number that decides on the letter/syllable and sound
84 int m_random;
85 ///Length of the syllables
86 int m_length;
87 ///Choose a sound in random and ensure that it's not the same than the previous one
88 void chooseSound();
89 ///Current letter or syllable stored
90 QString m_currentLetter;
92 QString t1;
94 QString a1;
95 ///Paint the letter/syllable in levels 1 and 3
96 void paintEvent( QPaintEvent * );
98 protected slots:
99 ///Play the same sound again
100 void slotPlayAgain();
102 void slotProcess(const QString &inputLetter);
104 void slotTimerDone();
108 #endif // KLETTRESVIEW_H