• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kgoldrunner

  • sources
  • kde-4.14
  • kdegames
  • kgoldrunner
  • src
kgoldrunner.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2002 Marco Krüger <grisuji@gmx.de> *
3  * Copyright 2002 Ian Wadham <iandw.au@gmail.com> *
4  * Copyright 2009 Ian Wadham <iandw.au@gmail.com> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18  ****************************************************************************/
19 
20 #include "kgoldrunner.h"
21 
22 #include <QApplication>
23 #include <QDesktopWidget>
24 #include <QSignalMapper>
25 #include <QShortcut>
26 #include <QKeySequence>
27 #include <QKeyEvent>
28 
29 #include <kglobal.h>
30 #include <kshortcutsdialog.h>
31 #include <KStandardDirs>
32 
33 #include <kconfig.h>
34 #include <kconfiggroup.h>
35 
36 #include <kdebug.h>
37 #include <QDebug>
38 
39 #include <ktoolbar.h>
40 #include <kmenubar.h>
41 
42 #include <kaction.h>
43 #include <kactioncollection.h>
44 #include <ktoggleaction.h>
45 #include <ktogglefullscreenaction.h>
46 #include <kstandardaction.h>
47 #include <kstandardgameaction.h>
48 #include <kicon.h>
49 #include <KMenu>
50 #include <KCmdLineArgs>
51 #include <KAboutData>
52 
53 #include <libkdegames_capabilities.h> //defines KGAUDIO_BACKEND_OPENAL (or not)
54 
55 #include "kgrgame.h"
56 #include "kgrview.h"
57 #include "kgrscene.h"
58 #include "kgrrenderer.h"
59 
60 // Shorthand for references to actions.
61 #define ACTION(x) (actionCollection()->action(x))
62 
63 KGoldrunner::KGoldrunner()
64  :
65  KXmlGuiWindow (0)
66 {
67 /******************************************************************************/
68 /************* FIND WHERE THE GAMES DATA AND HANDBOOK SHOULD BE *************/
69 /******************************************************************************/
70 
71  setObjectName ( QLatin1String("KGoldrunner" ));
72 
73  // Avoid "saveOK()" check if an error-exit occurs during the file checks.
74  startupOK = true;
75 
76  // Get directory paths for the system levels, user levels and manual.
77  if (! getDirectories()) {
78  fprintf (stderr, "getDirectories() FAILED\n");
79  startupOK = false;
80  return; // If games directory not found, abort.
81  }
82 
83  // This message is to help diagnose distribution or installation problems.
84  fprintf (stderr,
85  "The games data and handbook should be in the following locations:\n");
86  fprintf (stderr, "System games: %s\nUser data: %s\nHandbook: %s\n",
87  qPrintable(systemDataDir), qPrintable(userDataDir), qPrintable(systemHTMLDir));
88 
89 /******************************************************************************/
90 /************************ SET PLAYFIELD AND GAME DATA ***********************/
91 /******************************************************************************/
92 
93  // Base the size of playing-area and widgets on the monitor resolution.
94  int dw = QApplication::desktop()->width();
95 
96  // Need to consider the height, for widescreen displays (eg. 1280x768).
97  int dh = QApplication::desktop()->height();
98 
99  dw = qMin ((4 * dh + 1) / 3, dw); // KGoldrunner aspect ratio is 4:3.
100  dh = (3 * dw + 2) / 4;
101 
102  view = new KGrView (this);
103  view->setMinimumSize ((dw + 1) / 2, (dh + 1) / 2);
104 
105  game = new KGrGame (view, systemDataDir, userDataDir);
106 
107  // Initialise the lists of games (i.e. collections of levels).
108  if (! game->initGameLists()) {
109  startupOK = false;
110  return; // If no game files, abort.
111  }
112 
113 /******************************************************************************/
114 /************************* SET UP THE USER INTERFACE ************************/
115 /******************************************************************************/
116 
117  // Get catalog for translation.
118  KGlobal::locale()->insertCatalog ( QLatin1String( "libkdegames" ));
119 
120  // Tell the KMainWindow that the KGrCanvas object is the main widget.
121  setCentralWidget (view);
122 
123  scene = view->gameScene ();
124  renderer = scene->renderer ();
125 
126  // Set up our actions (menu, toolbar and keystrokes) ...
127  setupActions();
128 
129  // Do NOT put show/hide actions for the statusbar and toolbar in the GUI.
130  // We do not have a statusbar any more and the toolbar is relevant only
131  // when using the game editor and then it appears automatically. Maybe 1%
132  // of players would use the game editor for 5% of their time. Also we have
133  // our own action to configure shortcut keys, so disable the KXmlGui one.
134  setupGUI (static_cast<StandardWindowOption> (Default &
135  (~StatusBar) & (~ToolBar) & (~Keys)));
136 
137  // Initialize text-item lengths in the scene, before the first resize.
138  scene->showLives (0);
139  scene->showScore (0);
140  adjustHintAction (false);
141  gameFreeze (false);
142 
143  // Connect the game actions to the menu and toolbar displays.
144  connect (game, SIGNAL (quitGame()), SLOT (close()));
145  connect (game, SIGNAL (setEditMenu(bool)), SLOT (setEditMenu(bool)));
146  connect (game, SIGNAL (showLives(long)), scene, SLOT (showLives(long)));
147  connect (game, SIGNAL (showScore(long)), scene, SLOT (showScore(long)));
148  connect (game, SIGNAL (hintAvailable(bool)), SLOT (adjustHintAction(bool)));
149  connect (game, SIGNAL (gameFreeze(bool)), SLOT (gameFreeze(bool)));
150 
151  connect (game, SIGNAL (setAvail(const char*,bool)),
152  SLOT (setAvail(const char*,bool)));
153  connect (game, SIGNAL (setToggle(const char*,bool)),
154  SLOT (setToggle(const char*,bool)));
155 
156  connect (scene, SIGNAL (redrawEditToolbar()), SLOT (redrawEditToolbar()));
157 
158  // Apply the saved mainwindow settings, if any, and ask the mainwindow
159  // to automatically save settings if changed: window size, toolbar
160  // position, icon size, etc.
161  setAutoSaveSettings();
162 
163  // Explicitly hide the edit toolbar - we need it in edit mode only and we
164  // always start in play mode, even if the last session ended in edit mode.
165  // Besides, we cannot render it until after the initial resize event (s).
166  toolBar ("editToolbar")->hide();
167 
168  // Do NOT paint main widget yet (title bar, menu, blank playfield).
169  // Instead, queue a call to the "KGoldrunner_2" constructor extension.
170  QMetaObject::invokeMethod (this, "KGoldrunner_2", Qt::QueuedConnection);
171  kDebug() << "QMetaObject::invokeMethod (this, \"KGoldrunner_2\") done ... ";
172  kDebug() << "1st scan of event-queue ...";
173 }
174 
175 void KGoldrunner::KGoldrunner_2()
176 {
177  kDebug() << "Entered constructor extension ...";
178 
179  // Queue a call to the "initGame" method. This renders and paints the
180  // initial graphics, but only AFTER the initial main-window resize events
181  // have been seen and the final SVG scale is known.
182  QMetaObject::invokeMethod (game, "initGame", Qt::QueuedConnection);
183  kDebug() << "QMetaObject::invokeMethod (game, \"initGame\") done ... ";
184  kDebug() << "2nd scan of event-queue ...";
185 }
186 
187 KGoldrunner::~KGoldrunner()
188 {
189 }
190 
191 void KGoldrunner::setupActions()
192 {
193  /**************************************************************************/
194  /****************************** GAME MENU ******************************/
195  /**************************************************************************/
196 
197  QSignalMapper * gameMapper = new QSignalMapper (this);
198  connect (gameMapper, SIGNAL (mapped(int)), game, SLOT (gameActions(int)));
199  tempMapper = gameMapper;
200 
201  // New Game...
202  // Load Saved Game...
203  // --------------------------
204 
205  KAction * a = KStandardGameAction::gameNew (gameMapper, SLOT(map()), this);
206  actionCollection()->addAction (a->objectName(), a);
207  gameMapper->setMapping (a, NEW);
208  a->setText (i18n ("&New Game..."));
209 
210  a = gameAction ("next_level", NEXT_LEVEL,
211  i18n ("Pla&y Next Level"),
212  i18n ("Play next level."),
213  i18n ("Try the next level in the game "
214  "you are playing."),
215  Qt::Key_Y);
216 
217  a = KStandardGameAction::load (gameMapper, SLOT(map()), this);
218  actionCollection()->addAction (a->objectName(), a);
219  gameMapper->setMapping (a, LOAD);
220  a->setText (i18n ("&Load Saved Game..."));
221 
222  // Save Game...
223  // Save Edits... (extra copy)
224  // --------------------------
225 
226  saveGame = KStandardGameAction::save (gameMapper, SLOT(map()), this);
227  actionCollection()->addAction (saveGame->objectName(), saveGame);
228  gameMapper->setMapping (saveGame, SAVE_GAME);
229  saveGame->setText (i18n ("&Save Game..."));
230  saveGame->setShortcut (Qt::Key_S); // Alternate key.
231 
232  // Pause
233  // Show High Scores
234  // Get a Hint
235  // Kill the Hero
236  // --------------------------
237 
238  myPause = KStandardGameAction::pause (gameMapper, SLOT(map()), this);
239  actionCollection()->addAction (myPause->objectName(), myPause);
240  gameMapper->setMapping (myPause, PAUSE);
241 
242  // KAction * myPause gets KAction::shortcut(), returning 1 OR 2 shortcuts.
243  KShortcut pauseShortcut = myPause->shortcut();
244  pauseShortcut.setAlternate (Qt::Key_Escape); // Add "Esc" shortcut.
245  myPause->setShortcut (pauseShortcut);
246 
247  highScore = KStandardGameAction::highscores (gameMapper, SLOT(map()), this);
248  actionCollection()->addAction (highScore->objectName(), highScore);
249  gameMapper->setMapping (highScore, HIGH_SCORE);
250 
251  hintAction = KStandardGameAction::hint (gameMapper, SLOT (map()), this);
252  actionCollection()->addAction (hintAction->objectName(), hintAction);
253  gameMapper->setMapping (hintAction, HINT);
254 
255  a = KStandardGameAction::demo (gameMapper, SLOT (map()), this);
256  actionCollection()->addAction (a->objectName(), a);
257  gameMapper->setMapping (a, DEMO);
258 
259  a = KStandardGameAction::solve (gameMapper, SLOT (map()), this);
260  actionCollection()->addAction (a->objectName(), a);
261  gameMapper->setMapping (a, SOLVE);
262  a->setText (i18n ("&Show A Solution"));
263  a->setToolTip (i18n ("Show how to win this level."));
264  a->setWhatsThis (i18n ("Play a recording of how to win this level, if "
265  "there is one available."));
266 
267  a = gameAction ("instant_replay", INSTANT_REPLAY,
268  i18n ("&Instant Replay"),
269  i18n ("Instant replay."),
270  i18n ("Show a recording of the level "
271  "you are currently playing."),
272  Qt::Key_R);
273 
274  a = gameAction ("replay_last", REPLAY_LAST,
275  i18n ("Replay &Last Level"),
276  i18n ("Replay last level."),
277  i18n ("Show a recording of the last level you "
278  "played and finished, regardless of whether "
279  "you won or lost."),
280  Qt::Key_A);
281 
282  a = gameAction ("replay_any", REPLAY_ANY,
283  i18n ("&Replay Any Level"),
284  i18n ("Replay any level."),
285  i18n ("Show a recording of any level you have "
286  "played so far."),
287  QKeySequence()); // No key assigned.
288 
289  killHero = gameAction ("kill_hero", KILL_HERO,
290  i18n ("&Kill Hero"),
291  i18n ("Kill Hero."),
292  i18n ("Kill the hero, in case he finds himself in "
293  "a situation from which he cannot escape."),
294  Qt::Key_Q);
295 
296  // Quit
297  // --------------------------
298 
299  KStandardGameAction::quit (this, SLOT (close()), actionCollection());
300 
301  /**************************************************************************/
302  /*************************** GAME EDITOR MENU **************************/
303  /**************************************************************************/
304 
305  QSignalMapper * editMapper = new QSignalMapper (this);
306  connect (editMapper, SIGNAL (mapped(int)), game, SLOT (editActions(int)));
307  tempMapper = editMapper;
308 
309  // Create a Level
310  // Edit a Level...
311  // --------------------------
312 
313  KAction * ed = editAction ("create_level", CREATE_LEVEL,
314  i18n ("&Create Level"),
315  i18n ("Create level."),
316  i18n ("Create a completely new level."));
317  ed->setIcon (KIcon ( QLatin1String( "document-new" )));
318  ed->setIconText (i18n ("Create"));
319 
320  ed = editAction ("edit_any", EDIT_ANY,
321  i18n ("&Edit Level..."),
322  i18n ("Edit level..."),
323  i18n ("Edit any level..."));
324  ed->setIcon (KIcon ( QLatin1String( "document-open" )));
325  ed->setIconText (i18n ("Edit"));
326 
327  // Save Edits...
328  // Move Level...
329  // Delete Level...
330  // --------------------------
331 
332  saveEdits = editAction ("save_edits", SAVE_EDITS,
333  i18n ("&Save Edits..."),
334  i18n ("Save edits..."),
335  i18n ("Save your level after editing..."));
336  saveEdits->setIcon (KIcon ( QLatin1String( "document-save" )));
337  saveEdits->setIconText (i18n ("Save"));
338  saveEdits->setEnabled (false); // Nothing to save, yet.
339 
340  ed = editAction ("move_level", MOVE_LEVEL,
341  i18n ("&Move Level..."),
342  i18n ("Move level..."),
343  i18n ("Change a level's number or move "
344  "it to another game..."));
345 
346  ed = editAction ("delete_level", DELETE_LEVEL,
347  i18n ("&Delete Level..."),
348  i18n ("Delete level..."),
349  i18n ("Delete a level..."));
350 
351  // Create a Game
352  // Edit Game Info...
353  // --------------------------
354 
355  ed = editAction ("create_game", CREATE_GAME,
356  i18n ("Create &Game..."),
357  i18n ("Create game..."),
358  i18n ("Create a completely new game..."));
359 
360  ed = editAction ("edit_game", EDIT_GAME,
361  i18n ("Edit Game &Info..."),
362  i18n ("Edit game info..."),
363  i18n ("Change the name, rules or description "
364  "of a game..."));
365 
366  /**************************************************************************/
367  /**************************** SETTINGS MENU ****************************/
368  /**************************************************************************/
369 
370  // Theme settings are handled by this class and KGrRenderer.
371  QAction * themes = actionCollection()->addAction ("select_theme");
372  themes->setText (i18n ("Change &Theme..."));
373  themes->setToolTip (i18n ("Change the graphics theme..."));
374  themes->setWhatsThis (i18n ("Alter the visual appearance of the runners "
375  "and background scene..."));
376  connect (themes, SIGNAL (triggered(bool)), this, SLOT (changeTheme()));
377 
378  // Show/Exit Full Screen Mode
379  KToggleFullScreenAction * fullScreen = KStandardAction::fullScreen
380  (this, SLOT (viewFullScreen(bool)), this, this);
381  actionCollection()->addAction (fullScreen->objectName(), fullScreen);
382 
383  // Other settings are handled by KGrGame.
384  QSignalMapper * settingMapper = new QSignalMapper (this);
385  connect (settingMapper, SIGNAL (mapped(int)), game, SLOT (settings(int)));
386  tempMapper = settingMapper;
387 
388 #ifdef KGAUDIO_BACKEND_OPENAL
389  // Sound effects on/off
390  settingAction ("options_sounds", PLAY_SOUNDS,
391  i18n ("&Play Sounds"),
392  i18n ("Play sound effects."),
393  i18n ("Play sound effects during the game."));
394 
395  settingAction ("options_steps", PLAY_STEPS,
396  i18n ("Play &Footstep Sounds"),
397  i18n ("Make sounds of player's footsteps."),
398  i18n ("Make sounds of player's footsteps."));
399 #endif
400 
401  // Demo at start on/off.
402  settingAction ("options_demo", STARTUP_DEMO,
403  i18n ("&Demo At Start"),
404  i18n ("Run a demo when the game starts."),
405  i18n ("Run a demo when the game starts."));
406 
407  // Mouse Controls Hero
408  // Keyboard Controls Hero
409  // Laptop Hybrid
410  // --------------------------
411 
412  KToggleAction * setMouse = settingAction ("mouse_mode", MOUSE,
413  i18n ("&Mouse Controls Hero"),
414  i18n ("Mouse controls hero."),
415  i18n ("Use the mouse to control "
416  "the hero's moves."));
417 
418  KToggleAction * setKeyboard = settingAction ("keyboard_mode", KEYBOARD,
419  i18n ("&Keyboard Controls Hero"),
420  i18n ("Keyboard controls hero."),
421  i18n ("Use the keyboard to control "
422  "the hero's moves."));
423 
424  KToggleAction * setLaptop = settingAction ("laptop_mode", LAPTOP,
425  i18n ("Hybrid Control (&Laptop)"),
426  i18n ("Pointer controls hero; dig "
427  "using keyboard."),
428  i18n ("Use the laptop's pointer device "
429  "to control the hero's moves, and use "
430  "the keyboard to dig left and right."));
431 
432  QActionGroup* controlGrp = new QActionGroup (this);
433  controlGrp->addAction (setMouse);
434  controlGrp->addAction (setKeyboard);
435  controlGrp->addAction (setLaptop);
436  controlGrp->setExclusive (true);
437 
438  // Options within keyboard mode.
439  // Click key to begin moving and continue moving indefinitely.
440  // Click and hold key to begin moving: release key to stop.
441 
442  KToggleAction * clickKey = settingAction ("click_key", CLICK_KEY,
443  i18n ("&Click Key To Move"),
444  i18n ("Click Key To Move."),
445  i18n ("In keyboard mode, click a "
446  "direction-key to start moving "
447  "and keep on going until you "
448  "click another key."));
449 
450  KToggleAction * holdKey = settingAction ("hold_key", HOLD_KEY,
451  i18n ("&Hold Key To Move"),
452  i18n ("Hold Key To Move."),
453  i18n ("In keyboard mode, hold down a "
454  "direction-key to move "
455  "and release it to stop."));
456 
457  QActionGroup * keyGrp = new QActionGroup (this);
458  keyGrp->addAction (clickKey);
459  keyGrp->addAction (holdKey);
460  keyGrp->setExclusive (true);
461 
462  // Normal Speed
463  // Beginner Speed
464  // Champion Speed
465  // Increase Speed
466  // Decrease Speed
467  // --------------------------
468 
469  KToggleAction * nSpeed = settingAction ("normal_speed", NORMAL_SPEED,
470  i18n ("Normal Speed"),
471  i18n ("Set normal speed."),
472  i18n ("Set normal game speed."));
473 
474  KToggleAction * bSpeed = settingAction ("beginner_speed",
475  BEGINNER_SPEED,
476  i18n ("Beginner Speed"),
477  i18n ("Set beginners' speed."),
478  i18n ("Set beginners' game speed "
479  "(0.5 times normal)."));
480 
481  KToggleAction * cSpeed = settingAction ("champion_speed",
482  CHAMPION_SPEED,
483  i18n ("Champion Speed"),
484  i18n ("Set champions' speed."),
485  i18n ("Set champions' game speed "
486  "(1.5 times normal)."));
487 
488  a = gameAction ("increase_speed", INC_SPEED,
489  i18n ("Increase Speed"),
490  i18n ("Increase speed."),
491  i18n ("Increase the game speed by 0.1 "
492  "(maximum is 2.0 times normal)."),
493  Qt::Key_Plus);
494 
495  a = gameAction ("decrease_speed", DEC_SPEED,
496  i18n ("Decrease Speed"),
497  i18n ("Decrease speed."),
498  i18n ("Decrease the game speed by 0.1 "
499  "(minimum is 0.2 times normal)."),
500  Qt::Key_Minus);
501 
502  QActionGroup* speedGrp = new QActionGroup (this);
503  speedGrp->addAction (nSpeed);
504  speedGrp->addAction (bSpeed);
505  speedGrp->addAction (cSpeed);
506  speedGrp->setExclusive (true);
507 
508  // Configure Shortcuts...
509  // --------------------------
510 
511  KStandardAction::keyBindings (
512  this, SLOT (optionsConfigureKeys()),
513  actionCollection());
514 
515  /**************************************************************************/
516  /************************** KEYSTROKE ACTIONS **************************/
517  /**************************************************************************/
518 
519  // Two-handed KB controls and alternate one-handed controls for the hero.
520 
521  QSignalMapper * kbMapper = new QSignalMapper (this);
522  connect (kbMapper, SIGNAL (mapped(int)), game, SLOT(kbControl(int)));
523  tempMapper = kbMapper;
524 
525  // The actions for the movement keys are created but disabled. This lets
526  // keyPressEvent() come through, instead of a signal, while still allowing
527  // Settings->Configure Keys to change the key mappings. The keyPressEvent()
528  // call is needed so that the key can be identified and matched to the
529  // corresponding keyReleaseEvent() call and make the hold-key option
530  // work correctly when two keys are held down simultaneously.
531 
532  keyControl ("stop", i18n ("Stop"), Qt::Key_Space, STAND);
533  keyControl ("move_right", i18n ("Move Right"), Qt::Key_Right, RIGHT, true);
534  keyControl ("move_left", i18n ("Move Left"), Qt::Key_Left, LEFT, true);
535  keyControl ("move_up", i18n ("Move Up"), Qt::Key_Up, UP, true);
536  keyControl ("move_down", i18n ("Move Down"), Qt::Key_Down, DOWN, true);
537  keyControl ("dig_right", i18n ("Dig Right"), Qt::Key_C, DIG_RIGHT);
538  keyControl ("dig_left", i18n ("Dig Left"), Qt::Key_Z, DIG_LEFT);
539 
540  // Alternate one-handed controls. Set up in "kgoldrunnerui.rc".
541 
542  // Key_I, "move_up"
543  // Key_L, "move_right"
544  // Key_K, "move_down"
545  // Key_J, "move_left"
546  // Key_Space, "stop" (as above)
547  // Key_O, "dig_right"
548  // Key_U, "dig_left"
549 
550  setupEditToolbarActions(); // Uses pixmaps from "renderer".
551 
552  // Authors' debugging aids, effective when Pause is hit. Options include
553  // stepping through the animation, toggling a debug patch or log messages
554  // on or off during gameplay and printing the states of runners or tiles.
555 
556  KConfigGroup debugGroup (KGlobal::config(), "Debugging");
557  bool addDebuggingShortcuts = debugGroup.readEntry
558  ("DebuggingShortcuts", false); // Get debug option.
559  if (! addDebuggingShortcuts)
560  return;
561 
562  QSignalMapper * dbgMapper = new QSignalMapper (this);
563  connect (dbgMapper, SIGNAL (mapped(int)), game, SLOT(dbgControl(int)));
564  tempMapper = dbgMapper;
565 
566  keyControl ("do_step", i18n ("Do a Step"), Qt::Key_Period, DO_STEP);
567  keyControl ("bug_fix", i18n ("Test Bug Fix"), Qt::Key_B, BUG_FIX);
568  keyControl ("show_positions", i18n ("Show Positions"), Qt::Key_W, S_POSNS);
569  keyControl ("logging", i18n ("Start Logging"), Qt::Key_G, LOGGING);
570  keyControl ("show_hero", i18n ("Show Hero"), Qt::Key_E, S_HERO);
571  keyControl ("show_obj", i18n ("Show Object"), Qt::Key_Slash, S_OBJ);
572 
573  keyControl ("show_enemy_0", i18n ("Show Enemy") + '0', Qt::Key_0, ENEMY_0);
574  keyControl ("show_enemy_1", i18n ("Show Enemy") + '1', Qt::Key_1, ENEMY_1);
575  keyControl ("show_enemy_2", i18n ("Show Enemy") + '2', Qt::Key_2, ENEMY_2);
576  keyControl ("show_enemy_3", i18n ("Show Enemy") + '3', Qt::Key_3, ENEMY_3);
577  keyControl ("show_enemy_4", i18n ("Show Enemy") + '4', Qt::Key_4, ENEMY_4);
578  keyControl ("show_enemy_5", i18n ("Show Enemy") + '5', Qt::Key_5, ENEMY_5);
579  keyControl ("show_enemy_6", i18n ("Show Enemy") + '6', Qt::Key_6, ENEMY_6);
580 }
581 
582 KAction * KGoldrunner::gameAction (const QString & name,
583  const int code,
584  const QString & text,
585  const QString & toolTip,
586  const QString & whatsThis,
587  const QKeySequence & key)
588 {
589  KAction * ga = actionCollection()->addAction (name);
590  ga->setText (text);
591  ga->setToolTip (toolTip);
592  ga->setWhatsThis (whatsThis);
593  if (! key.isEmpty()) {
594  ga->setShortcut (key);
595  }
596  connect (ga, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
597  tempMapper->setMapping (ga, code);
598  return ga;
599 }
600 
601 KAction * KGoldrunner::editAction (const QString & name,
602  const int code,
603  const QString & text,
604  const QString & toolTip,
605  const QString & whatsThis)
606 {
607  KAction * ed = actionCollection()->addAction (name);
608  ed->setText (text);
609  ed->setToolTip (toolTip);
610  ed->setWhatsThis (whatsThis);
611  connect (ed, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
612  tempMapper->setMapping (ed, code);
613  return ed;
614 }
615 
616 KToggleAction * KGoldrunner::settingAction (const QString & name,
617  const int code,
618  const QString & text,
619  const QString & toolTip,
620  const QString & whatsThis)
621 {
622  KToggleAction * s = new KToggleAction (text, this);
623  actionCollection()->addAction (name, s);
624  s->setToolTip (toolTip);
625  s->setWhatsThis (whatsThis);
626  connect (s, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
627  tempMapper->setMapping (s, code);
628  return s;
629 }
630 
631 KToggleAction * KGoldrunner::editToolbarAction (const QString & name,
632  const char code,
633  const QString & shortText,
634  const QString & text,
635  const QString & toolTip,
636  const QString & whatsThis)
637 {
638  int mapCode = code;
639  KToggleAction * ed = new KToggleAction (text, this);
640  actionCollection()->addAction (name, ed);
641  ed->setIconText (shortText);
642  ed->setToolTip (toolTip);
643  ed->setWhatsThis (whatsThis);
644  connect (ed, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
645  tempMapper->setMapping (ed, mapCode);
646  return ed;
647 }
648 
649 void KGoldrunner::keyControl (const QString & name, const QString & text,
650  const QKeySequence & shortcut, const int code,
651  const bool mover)
652 {
653  KAction * a = actionCollection()->addAction (name);
654  a->setText (text);
655  a->setShortcut (shortcut);
656 
657  // If this is a move-key, let keyPressEvent() through, instead of signal.
658  if (mover) {
659  a->setEnabled (false);
660  }
661  else {
662  a->setAutoRepeat (false); // Else, prevent QAction signal repeat.
663  }
664 
665  connect (a, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
666  tempMapper->setMapping (a, code);
667  addAction (a);
668 }
669 
670 void KGoldrunner::keyPressEvent (QKeyEvent * event)
671 {
672  // For movement keys, all presses and releases are processed, thus allowing
673  // the hold-key option to work correctly when two keys are held down.
674 
675  if (! identifyMoveAction (event, true)) {
676  QWidget::keyPressEvent (event);
677  }
678 }
679 
680 void KGoldrunner::keyReleaseEvent (QKeyEvent * event)
681 {
682  if (! identifyMoveAction (event, false)) {
683  QWidget::keyReleaseEvent (event);
684  }
685 }
686 
687 bool KGoldrunner::identifyMoveAction (QKeyEvent * event, bool pressed)
688 {
689  bool result = false;
690  if (! event->isAutoRepeat()) {
691  QKeySequence keystroke (event->key() + event->modifiers());
692  result = true;
693 
694  if ((ACTION ("move_left"))->shortcuts().contains(keystroke)) {
695  game->kbControl (LEFT, pressed);
696  }
697  else if ((ACTION ("move_right"))->shortcuts().contains(keystroke)) {
698  game->kbControl (RIGHT, pressed);
699  }
700  else if ((ACTION ("move_up"))->shortcuts().contains(keystroke)) {
701  game->kbControl (UP, pressed);
702  }
703  else if ((ACTION ("move_down"))->shortcuts().contains(keystroke)) {
704  game->kbControl (DOWN, pressed);
705  }
706  else {
707  result = false;
708  }
709  }
710  return result;
711 }
712 
713 void KGoldrunner::viewFullScreen (bool activation)
714 {
715  KToggleFullScreenAction::setFullScreen (this, activation);
716 }
717 
718 void KGoldrunner::gameFreeze (bool on_off)
719 {
720  myPause->setChecked (on_off);
721  frozen = on_off; // Remember the state (for the configure-keys case).
722  QStringList pauseKeys;
723  foreach (const QKeySequence &s, myPause->shortcut().toList()) {
724  pauseKeys.append(s.toString(QKeySequence::NativeText));
725  }
726  QString msg;
727  if (on_off) {
728  if (pauseKeys.size() == 0) {
729  msg = i18n("The game is paused");
730  } else if (pauseKeys.size() == 1) {
731  msg = i18n("Press \"%1\" to RESUME", pauseKeys.at(0));
732  } else {
733  msg = i18n("Press \"%1\" or \"%2\" to RESUME", pauseKeys.at(0),
734  pauseKeys.at(1));
735  }
736  } else {
737  if (pauseKeys.size() == 0) {
738  msg = "";
739  } else if (pauseKeys.size() == 1) {
740  msg = i18n("Press \"%1\" to PAUSE", pauseKeys.at(0));
741  } else {
742  msg = i18n("Press \"%1\" or \"%2\" to PAUSE", pauseKeys.at(0),
743  pauseKeys.at(1));
744  }
745  }
746  scene->setPauseResumeText (msg);
747 }
748 
749 void KGoldrunner::adjustHintAction (bool hintAvailable)
750 {
751  hintAction->setEnabled (hintAvailable);
752 
753  QString msg;
754  msg = hintAvailable ? i18n("Has hint") : i18n("No hint");
755  scene->setHasHintText (msg);
756 }
757 
758 void KGoldrunner::setToggle (const char * actionName, const bool onOff)
759 {
760  ((KToggleAction *) ACTION (actionName))->setChecked (onOff);
761 }
762 
763 void KGoldrunner::setAvail (const char * actionName, const bool onOff)
764 {
765  ((KAction *) ACTION (actionName))->setEnabled (onOff);
766 }
767 
768 void KGoldrunner::setEditMenu (bool on_off)
769 {
770  saveEdits->setEnabled (on_off);
771 
772  saveGame->setEnabled (! on_off);
773  hintAction->setEnabled (! on_off);
774  killHero->setEnabled (! on_off);
775  highScore->setEnabled (! on_off);
776  setAvail ("instant_replay", (! on_off));
777  setAvail ("game_pause", (! on_off));
778 
779  if (on_off){
780  // Set the editToolbar icons to the current tile-size.
781  kDebug() << "ToolBar icon size:" << scene->tileSize ();
782  toolBar ("editToolbar")->setIconSize (scene->tileSize ());
783 
784  // Set the editToolbar icons up with pixmaps of the current theme.
785  setEditIcon ("brickbg", BRICK);
786  setEditIcon ("fbrickbg", FBRICK);
787  setEditIcon ("freebg", FREE);
788  setEditIcon ("nuggetbg", NUGGET);
789  setEditIcon ("polebg", BAR);
790  setEditIcon ("concretebg", CONCRETE);
791  setEditIcon ("ladderbg", LADDER);
792  setEditIcon ("hladderbg", HLADDER);
793  setEditIcon ("edherobg", HERO);
794  setEditIcon ("edenemybg", ENEMY);
795  setToggle ("brickbg", true); // Default edit-object is BRICK.
796 
797  toolBar ("editToolbar")->show();
798  }
799  else {
800  toolBar ("editToolbar")->hide();
801  }
802 }
803 
804 void KGoldrunner::setEditIcon (const QString & actionName, const char iconType)
805 {
806  ((KToggleAction *) (actionCollection()->action (actionName)))->
807  setIcon (KIcon (renderer->getPixmap (iconType)));
808 }
809 
810 /******************************************************************************/
811 /******************* SLOTS FOR MENU AND KEYBOARD ACTIONS *******************/
812 /******************************************************************************/
813 
814 void KGoldrunner::changeTheme ()
815 {
816  renderer->selectTheme ();
817 }
818 
819 void KGoldrunner::redrawEditToolbar ()
820 {
821  // Signalled by the scene after the theme or tile size has changed.
822  if (game->inEditMode()) {
823  setEditMenu (true);
824  }
825 }
826 
827 void KGoldrunner::saveProperties (KConfigGroup & /* config - unused */)
828 {
829  // The 'config' object points to the session managed
830  // config file. Anything you write here will be available
831  // later when this app is restored.
832 
833  kDebug() << "I am in KGoldrunner::saveProperties.";
834 }
835 
836 void KGoldrunner::readProperties (const KConfigGroup & /* config - unused */)
837 {
838  // The 'config' object points to the session managed
839  // config file. This function is automatically called whenever
840  // the app is being restored. Read in here whatever you wrote
841  // in 'saveProperties'
842 
843  kDebug() << "I am in KGoldrunner::readProperties.";
844 }
845 
846 void KGoldrunner::optionsConfigureKeys()
847 {
848  // First run the standard KDE dialog for shortcut key settings.
849  KShortcutsDialog::configure (actionCollection(),
850  KShortcutsEditor::LetterShortcutsAllowed, // Single letters OK.
851  this, // Parent widget.
852  true); // saveSettings value.
853 
854  gameFreeze (frozen); // Update the pause/resume text.
855 }
856 
857 bool KGoldrunner::getDirectories()
858 {
859  bool result = true;
860 
861  // WHERE THINGS ARE: In the KDE 3 environment (Release 3.1.1), application
862  // documentation and data files are in a directory structure given by
863  // $KDEDIRS (e.g. "/usr/local/kde" or "/opt/kde3/"). Application user data
864  // files are in a directory structure given by $KDEHOME ("$HOME/.kde").
865  // Within those two structures, the three sub-directories will typically be
866  // "share/doc/HTML/en/kgoldrunner/", "share/apps/kgoldrunner/system/" and
867  // "share/apps/kgoldrunner/user/". Note that it is necessary to have
868  // an extra path level ("system" or "user") after "kgoldrunner", otherwise
869  // all the KGoldrunner files have similar path names (after "apps") and
870  // KDE always locates directories in $KDEHOME and never the released games.
871 
872  // The directory strings are set by KDE at run time and might change in
873  // later releases, so use them with caution and only if something gets lost.
874 
875  KStandardDirs * dirs = new KStandardDirs();
876 
877  QString myDir = "kgoldrunner";
878 
879  // Find the KGoldrunner Users' Guide, English version (en).
880  systemHTMLDir = dirs->findResourceDir ("html", "en/" + myDir + '/');
881  if (systemHTMLDir.length() <= 0) {
882  KGrMessage::information (this, i18n ("Get Folders"),
883  i18n ("Cannot find documentation sub-folder 'en/%1/' "
884  "in area '%2' of the KDE folder ($KDEDIRS).",
885  myDir, dirs->resourceDirs ("html").join ( QLatin1String( ":" ))));
886  // result = false; // Don't abort if the doc is missing.
887  }
888  else
889  systemHTMLDir.append ("en/" + myDir + '/');
890 
891  // Find the system collections in a directory of the required KDE type.
892  systemDataDir = dirs->findResourceDir ("data", myDir + "/system/");
893  if (systemDataDir.length() <= 0) {
894  KGrMessage::information (this, i18n ("Get Folders"),
895  i18n ("Cannot find system games sub-folder '%1/system/' "
896  "in area '%2' of the KDE folder ($KDEDIRS).",
897  myDir, dirs->resourceDirs ("data").join ( QLatin1String( ":" ))));
898  result = false; // ABORT if the games data is missing.
899  }
900  else
901  systemDataDir.append (myDir + "/system/");
902 
903  // Locate and optionally create directories for user collections and levels.
904  bool create = true;
905  userDataDir = dirs->saveLocation ("data", myDir + "/user/", create);
906  if (userDataDir.length() <= 0) {
907  KGrMessage::information (this, i18n ("Get Folders"),
908  i18n ("Cannot find or create user games sub-folder '%1/user/' "
909  "in area '%2' of the KDE user area ($KDEHOME).",
910  myDir, dirs->resourceDirs ("data").join ( QLatin1String( ":" ))));
911  // result = false; // Don't abort if user area is missing.
912  }
913  else {
914  create = dirs->makeDir (userDataDir + "levels/");
915  if (! create) {
916  KGrMessage::information (this, i18n ("Get Folders"),
917  i18n ("Cannot find or create 'levels/' folder in "
918  "sub-folder '%1/user/' in the KDE user area ($KDEHOME).", myDir));
919  // result = false; // Don't abort if user area is missing.
920  }
921  }
922  delete dirs;
923  return (result);
924 }
925 
926 // This method is invoked when the main window is closed, whether by selecting
927 // "Quit" from the menu or by clicking the "X" at the top right of the window.
928 
929 // If we return true, game-edits were saved or abandoned or there was no editing
930 // in progress, so the main window will close. If we return false, the user has
931 // asked to go on editing, so the main window stays open.
932 
933 bool KGoldrunner::queryClose()
934 {
935  return (game->saveOK());
936 }
937 
938 /******************************************************************************/
939 /********************** MAKE A TOOLBAR FOR THE EDITOR **********************/
940 /******************************************************************************/
941 
942 void KGoldrunner::setupEditToolbarActions()
943 {
944  QSignalMapper * editToolbarMapper = new QSignalMapper (this);
945  connect (editToolbarMapper, SIGNAL (mapped(int)),
946  game, SLOT (editToolbarActions(int)));
947  tempMapper = editToolbarMapper;
948 
949  KAction * ed = editAction ("edit_hint", EDIT_HINT,
950  i18n ("Edit Name/Hint"),
951  i18n ("Edit level name or hint"),
952  i18n ("Edit text for the name or hint "
953  "of a level"));
954  ed->setIcon (KIcon ( QLatin1String( "games-hint" )));
955  ed->setIconText (i18n ("Name/Hint"));
956 
957  KToggleAction * free = editToolbarAction ("freebg", FREE,
958  i18n ("Erase"), i18n ("Space/Erase"),
959  i18n ("Paint empty squares or erase"),
960  i18n ("Erase objects or paint empty squares"));
961 
962  KToggleAction * edhero = editToolbarAction ("edherobg", HERO,
963  i18n("Hero"), i18n ("Hero"),
964  i18n ("Move hero"),
965  i18n ("Change the hero's starting position"));
966 
967  KToggleAction * edenemy = editToolbarAction ("edenemybg", ENEMY,
968  i18n ("Enemy"), i18n ("Enemy"),
969  i18n ("Paint enemies"),
970  i18n ("Paint enemies at their starting positions")
971  );
972 
973  KToggleAction * brick = editToolbarAction ("brickbg", BRICK,
974  i18n ("Brick"), i18n ("Brick"),
975  i18n ("Paint bricks (can dig)"),
976  i18n ("Paint bricks (diggable objects)"));
977 
978  KToggleAction* concrete = editToolbarAction ("concretebg", CONCRETE,
979  i18n ("Concrete"), i18n ("Concrete"),
980  i18n ("Paint concrete (cannot dig)"),
981  i18n ("Paint concrete objects (not diggable)"));
982 
983  KToggleAction * fbrick = editToolbarAction ("fbrickbg", FBRICK,
984  i18n ("Trap"), i18n ("Trap/False Brick"),
985  i18n ("Paint traps or false bricks "
986  "(can fall through)"),
987  i18n ("Paint traps or false bricks "
988  "(can fall through)"));
989 
990  KToggleAction * ladder = editToolbarAction ("ladderbg", LADDER,
991  i18n ("Ladder"), i18n ("Ladder"),
992  i18n ("Paint ladders"),
993  i18n ("Paint ladders (ways to go up or down)"));
994 
995  KToggleAction * hladder = editToolbarAction ("hladderbg", HLADDER,
996  i18n ("H Ladder"), i18n ("Hidden Ladder"),
997  i18n ("Paint hidden ladders"),
998  i18n ("Paint hidden ladders, which appear "
999  "when all the gold is gone"));
1000 
1001  KToggleAction * bar = editToolbarAction ("polebg", BAR,
1002  i18n ("Bar"), i18n ("Bar/Pole"),
1003  i18n ("Paint bars or poles"),
1004  i18n ("Paint bars or poles (can fall from these)")
1005  );
1006 
1007  KToggleAction * nugget = editToolbarAction ("nuggetbg", NUGGET,
1008  i18n ("Gold"), i18n ("Gold/Treasure"),
1009  i18n ("Paint gold (or other treasure)"),
1010  i18n ("Paint gold pieces (or other treasure)"));
1011 
1012  QActionGroup* editButtons = new QActionGroup (this);
1013  editButtons->setExclusive (true);
1014  editButtons->addAction (free);
1015  editButtons->addAction (edhero);
1016  editButtons->addAction (edenemy);
1017  editButtons->addAction (brick);
1018  editButtons->addAction (concrete);
1019  editButtons->addAction (fbrick);
1020  editButtons->addAction (ladder);
1021  editButtons->addAction (hladder);
1022  editButtons->addAction (bar);
1023  editButtons->addAction (nugget);
1024 
1025  brick->setChecked (true);
1026 }
1027 
1028 QSize KGoldrunner::sizeHint() const
1029 {
1030  return QSize (640, 600);
1031 }
1032 
1033 #include "kgoldrunner.moc"
KGoldrunner::~KGoldrunner
virtual ~KGoldrunner()
Default Destructor.
Definition: kgoldrunner.cpp:187
SOLVE
Definition: kgrglobals.h:154
QAction::setText
void setText(const QString &text)
ENEMY_0
Definition: kgrglobals.h:215
QString::append
QString & append(QChar ch)
BAR
const char BAR
Definition: kgrglobals.h:39
KGrRenderer::getPixmap
QPixmap getPixmap(const char picType)
Definition: kgrrenderer.cpp:234
KGoldrunner::setToggle
void setToggle(const char *actionName, const bool onOff)
Definition: kgoldrunner.cpp:758
DEMO
Definition: kgrglobals.h:154
QActionGroup
EDIT_GAME
Definition: kgrglobals.h:157
QWidget::keyReleaseEvent
virtual void keyReleaseEvent(QKeyEvent *event)
HINT
Definition: kgrglobals.h:153
REPLAY_LAST
Definition: kgrglobals.h:154
QAction::setChecked
void setChecked(bool)
kgrrenderer.h
HERO
const char HERO
Definition: kgrglobals.h:31
ENEMY_2
Definition: kgrglobals.h:215
ENEMY_1
Definition: kgrglobals.h:215
QList::at
const T & at(int i) const
KGrView::gameScene
KGrScene * gameScene() const
Definition: kgrview.h:37
S_POSNS
Definition: kgrglobals.h:214
KGrScene::tileSize
QSize tileSize() const
Get the current size of the squared region occupied by a single visual element (characters, ladders, bricks etc.).
Definition: kgrscene.h:121
KGrGame::inEditMode
bool inEditMode()
Definition: kgrgame.cpp:1146
QActionGroup::addAction
QAction * addAction(QAction *action)
DIG_LEFT
Definition: kgrglobals.h:175
S_HERO
Definition: kgrglobals.h:214
QKeyEvent::isAutoRepeat
bool isAutoRepeat() const
ACTION
#define ACTION(x)
Definition: kgoldrunner.cpp:61
CHAMPION_SPEED
Definition: kgrglobals.h:164
QAction::setToolTip
void setToolTip(const QString &tip)
QList::size
int size() const
LOAD
Definition: kgrglobals.h:152
QWidget::width
width
S_OBJ
Definition: kgrglobals.h:214
LAPTOP
Definition: kgrglobals.h:161
QWidget::setMinimumSize
void setMinimumSize(const QSize &)
CREATE_LEVEL
Definition: kgrglobals.h:156
LEFT
Definition: kgrglobals.h:174
QSignalMapper::setMapping
void setMapping(QObject *sender, int id)
BEGINNER_SPEED
Definition: kgrglobals.h:163
KGoldrunner::keyReleaseEvent
void keyReleaseEvent(QKeyEvent *event)
Definition: kgoldrunner.cpp:680
QList::append
void append(const T &value)
KGoldrunner::setAvail
void setAvail(const char *actionName, const bool onOff)
Definition: kgoldrunner.cpp:763
PLAY_STEPS
Definition: kgrglobals.h:166
KXmlGuiWindow
NUGGET
const char NUGGET
Definition: kgrglobals.h:37
KGoldrunner::KGoldrunner
KGoldrunner()
Default Constructor.
Definition: kgoldrunner.cpp:63
KGrScene::setPauseResumeText
void setPauseResumeText(const QString &msg)
Definition: kgrscene.cpp:309
KGoldrunner::redrawEditToolbar
void redrawEditToolbar()
Definition: kgoldrunner.cpp:819
BUG_FIX
Definition: kgrglobals.h:214
MOVE_LEVEL
Definition: kgrglobals.h:156
ENEMY_3
Definition: kgrglobals.h:215
KGrScene::setHasHintText
void setHasHintText(const QString &msg)
Definition: kgrscene.cpp:303
KGrMessage::information
static void information(QWidget *parent, const QString &caption, const QString &text, const QString &dontShowAgain=QString())
Definition: kgrdialog.cpp:306
KGoldrunner::queryClose
bool queryClose()
To save edits before closing.
Definition: kgoldrunner.cpp:933
MOUSE
Definition: kgrglobals.h:161
KGrGame::kbControl
void kbControl(const int dirn, const bool pressed=true)
Definition: kgrgame.cpp:1332
QString
QtConcurrent::map
QFuture< void > map(Sequence &sequence, MapFunction function)
LADDER
const char LADDER
Definition: kgrglobals.h:36
HLADDER
const char HLADDER
Definition: kgrglobals.h:35
KGrScene::showScore
void showScore(long score)
Definition: kgrscene.cpp:296
HIGH_SCORE
Definition: kgrglobals.h:152
HOLD_KEY
Definition: kgrglobals.h:162
LOGGING
Definition: kgrglobals.h:214
KGrScene::renderer
KGrRenderer * renderer() const
Get a pointer to the scene's renderer.
Definition: kgrscene.h:126
QStringList
QAction::setWhatsThis
void setWhatsThis(const QString &what)
NEW
Definition: kgrglobals.h:152
QKeyEvent::key
int key() const
STARTUP_DEMO
Definition: kgrglobals.h:160
QSize
REPLAY_ANY
Definition: kgrglobals.h:154
ENEMY
const char ENEMY
Definition: kgrglobals.h:29
QMetaObject::invokeMethod
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
QKeySequence::isEmpty
bool isEmpty() const
BRICK
const char BRICK
Definition: kgrglobals.h:33
KILL_HERO
Definition: kgrglobals.h:153
kgrscene.h
QKeyEvent
kgrview.h
UP
Definition: kgrglobals.h:174
EDIT_ANY
Definition: kgrglobals.h:156
DELETE_LEVEL
Definition: kgrglobals.h:157
kgoldrunner.h
QKeySequence::toString
QString toString(SequenceFormat format) const
FBRICK
const char FBRICK
Definition: kgrglobals.h:34
KEYBOARD
Definition: kgrglobals.h:161
QLatin1String
QKeySequence
QApplication::desktop
QDesktopWidget * desktop()
INC_SPEED
Definition: kgrglobals.h:165
KGoldrunner::readProperties
void readProperties(const KConfigGroup &)
This function is called when this app is restored.
Definition: kgoldrunner.cpp:836
NORMAL_SPEED
Definition: kgrglobals.h:163
ENEMY_4
Definition: kgrglobals.h:215
QAction
KGrView
Definition: kgrview.h:27
RIGHT
Definition: kgrglobals.h:174
QWidget::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
CREATE_GAME
Definition: kgrglobals.h:157
QString::length
int length() const
KGrScene::showLives
void showLives(long lives)
Definition: kgrscene.cpp:289
ENEMY_6
Definition: kgrglobals.h:215
KGrGame
Definition: kgrgame.h:45
DO_STEP
Definition: kgrglobals.h:214
KGoldrunner::saveProperties
void saveProperties(KConfigGroup &)
This function is called when it is time for the app to save its properties for session management pur...
Definition: kgoldrunner.cpp:827
PLAY_SOUNDS
Definition: kgrglobals.h:159
DEC_SPEED
Definition: kgrglobals.h:165
KGrGame::saveOK
bool saveOK()
Definition: kgrgame.cpp:1529
DIG_RIGHT
Definition: kgrglobals.h:175
NEXT_LEVEL
Definition: kgrglobals.h:152
ENEMY_5
Definition: kgrglobals.h:215
INSTANT_REPLAY
Definition: kgrglobals.h:154
SAVE_GAME
Definition: kgrglobals.h:152
QActionGroup::setExclusive
void setExclusive(bool)
kgrgame.h
KGoldrunner::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Definition: kgoldrunner.cpp:670
QSignalMapper
CONCRETE
const char CONCRETE
Definition: kgrglobals.h:32
STAND
Definition: kgrglobals.h:174
SAVE_EDITS
Definition: kgrglobals.h:156
KGrGame::initGameLists
bool initGameLists()
Definition: kgrgame.cpp:1911
QWidget::height
height
DOWN
Definition: kgrglobals.h:174
FREE
const char FREE
Definition: kgrglobals.h:28
PAUSE
Definition: kgrglobals.h:152
KGrRenderer::selectTheme
void selectTheme()
Definition: kgrrenderer.cpp:108
EDIT_HINT
const char EDIT_HINT
Definition: kgrglobals.h:45
CLICK_KEY
Definition: kgrglobals.h:162
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal