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.
25 #include <krandomsequence.h>
28 #include "kwritewords.h"
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
38 class KmwView
: public FrontEnd
43 KmwView(MainWindow
*parent
=0, const char *name
=0);
47 ///Holds the different levels
48 QStringList m_levelString
;
50 ///language is the current language for data file
53 ///Each time the level changes, reset some parameters and restart game
54 virtual void slot_changeLevel(int);
59 ///Instance of the config class
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
67 ///Number of rounds tried for each person in the 10 top scores
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
75 ///Number of attemps for guessing the answer right for a given word
77 ///Number of words you guessed right
79 ///Number of games you played (number of messed words you tried to solve)
81 ///Number of total guesses
83 ///Holds the messed word i.e. the word with the shuffled letters
85 ///The word before it has been messed
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
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.
100 ///Shuffle the letters in the word
101 virtual void slot_messup();
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
108 ///When you click Play Again in the Answer dialod this slot is called, it resets some variables and call sthe messup slot
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
);