moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kmessedwords / kmessedwords / kmwview.h
blob58082aadb9cfaa818f5d9e93627b872bd4a1b613
1 /*
2 * Copyright (C) 2001 by Primoz Anzur
3 (C) 2004 Anne-Marie Mahfouf <annma@kde.org>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of version 2 of the GNU General Public
7 License as published by the Free Software Foundation.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef KMWVIEW_H
20 #define KMWVIEW_H
22 #include <stdlib.h>
24 #include <kconfig.h>
25 #include <krandomsequence.h>
27 #include "frontend.h"
28 #include "kwritewords.h"
30 class MainWindow;
32 /**
33 * This is the main view class for KMessedWords. Most of the non-menu,
34 * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
35 * here.
38 class KmwView : public FrontEnd
40 Q_OBJECT
41 public:
42 ///constructor
43 KmwView(MainWindow *parent=0, const char *name=0);
44 ///destructor
45 virtual ~KmwView();
47 ///Holds the different levels
48 QStringList m_levelString;
50 ///language is the current language for data file
51 QString language;
52 public slots:
53 ///Each time the level changes, reset some parameters and restart game
54 virtual void slot_changeLevel(int);
56 private:
58 protected:
59 ///Instance of the config class
60 KConfig *config;
61 ///A dictionary instance
62 KWriteWords configInputData;
63 ///Get each word in random with a randomsequence instance
64 KRandomSequence m_random;
65 ///The number of solved messed words for each
66 int m_readSolved[10];
67 ///Number of rounds tried for each person in the 10 top scores
68 int m_readRounds[10];
69 ///The guesses for each highscore
70 int m_readGuesses[10];
71 ///The names of the 10 top players in scores
72 QString m_readName[10];
73 ///Number of lines (=words) for the current level
74 int m_lines;
75 ///Number of attemps for guessing the answer right for a given word
76 int m_guesses;
77 ///Number of words you guessed right
78 int m_solvedWords;
79 ///Number of games you played (number of messed words you tried to solve)
80 int m_messups;
81 ///Number of total guesses
82 int m_tGuesses;
83 ///Holds the messed word i.e. the word with the shuffled letters
84 QString m_messedWord;
85 ///The word before it has been messed
86 QString m_cleanWord;
87 ///Get randomly the clean word from the current level data file
88 void randomizer(int level);
89 ///Shuffle the letters in the cleanWord to get the messedWord
90 void messWord();
91 ///Get the files for each level
92 void reloadStructure();
93 /** This is to reset the game.
94 * This is called quite a few times, so to make it easier to make changes.
95 * I added this to make it easier to maintain.
97 void resetKMW();
99 public slots:
100 ///Shuffle the letters in the word
101 virtual void slot_messup();
103 private slots:
104 ///Assess wether the answer is right or wrong
105 virtual void slot_try();
106 ///When you click Quit in the Answer dialog this slot is called, it displays your score and the application quits
107 void slotEnd();
108 ///When you click Play Again in the Answer dialod this slot is called, it resets some variables and call sthe messup slot
109 void slotReply();
111 signals:
112 /** Emit a signal each time the level changes
113 * @param text the text (level name) hat will be written in the statusbar
115 void changeLevel(const QString &text);
118 #endif // KMWVIEW_H