author | zecke <zecke> | 2003-05-14 12:08:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-14 12:08:54 (UTC) |
commit | c480b91a5afe1f259287c3c4173ec02f2b4854cb (patch) (unidiff) | |
tree | ffe59a2fc544f6067fd96065d94a877188f1ef88 /noncore/games/kpacman/kpacman.cpp | |
parent | 415a300230e10e29660b2af26a23798fd0b12e03 (diff) | |
download | opie-c480b91a5afe1f259287c3c4173ec02f2b4854cb.zip opie-c480b91a5afe1f259287c3c4173ec02f2b4854cb.tar.gz opie-c480b91a5afe1f259287c3c4173ec02f2b4854cb.tar.bz2 |
patch by Scott Bronson
kill the duplicated config.cpp and config.h file
add proper default values so that kpacman actually works
out of the box
Config wanted to read kpacman.conf but this file did only exist
globally
Diffstat (limited to 'noncore/games/kpacman/kpacman.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/kpacman/kpacman.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/noncore/games/kpacman/kpacman.cpp b/noncore/games/kpacman/kpacman.cpp index aee8eea..812e9ea 100644 --- a/noncore/games/kpacman/kpacman.cpp +++ b/noncore/games/kpacman/kpacman.cpp | |||
@@ -1,22 +1,22 @@ | |||
1 | 1 | ||
2 | #include "portable.h" | 2 | #include "portable.h" |
3 | 3 | ||
4 | #if defined( KDE2_PORT ) | 4 | #if defined( KDE2_PORT ) |
5 | #include <kpacman.h> | 5 | #include <kpacman.h> |
6 | #include <kpacman.moc> | 6 | #include <kpacman.moc> |
7 | #include <kcolordlg.h> | 7 | #include <kcolordlg.h> |
8 | #elif defined( QPE_PORT ) | 8 | #elif defined( QPE_PORT ) |
9 | #include <qmenubar.h> | 9 | #include <qmenubar.h> |
10 | #include "config.h" | 10 | #include <qpe/config.h> |
11 | #include <qapplication.h> | 11 | #include <qapplication.h> |
12 | #include "kpacman.h" | 12 | #include "kpacman.h" |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <qkeycode.h> | 15 | #include <qkeycode.h> |
16 | #include <qcolor.h> | 16 | #include <qcolor.h> |
17 | #include <qstring.h> | 17 | #include <qstring.h> |
18 | #include <qpopmenu.h> | 18 | #include <qpopmenu.h> |
19 | #include <qmsgbox.h> | 19 | #include <qmsgbox.h> |
20 | 20 | ||
21 | Kpacman::Kpacman(QWidget *parent, const char *name) | 21 | Kpacman::Kpacman(QWidget *parent, const char *name) |
22 | : KTMainWindow(parent, name) | 22 | : KTMainWindow(parent, name) |
@@ -61,29 +61,30 @@ Kpacman::Kpacman(QWidget *parent, const char *name) | |||
61 | hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE); | 61 | hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE); |
62 | APP_CONFIG_END( cfg ); | 62 | APP_CONFIG_END( cfg ); |
63 | 63 | ||
64 | toggleFocusOutPause(); | 64 | toggleFocusOutPause(); |
65 | toggleFocusInContinue(); | 65 | toggleFocusInContinue(); |
66 | toggleHideMouseCursor(); | 66 | toggleHideMouseCursor(); |
67 | 67 | ||
68 | setCentralWidget( m_view ); | 68 | setCentralWidget( m_view ); |
69 | } | 69 | } |
70 | 70 | ||
71 | Kpacman::~Kpacman() | 71 | Kpacman::~Kpacman() |
72 | { | 72 | { |
73 | APP_CONFIG_BEGIN( cfg ); | 73 | /* APP_CONFIG_BEGIN( cfg ); |
74 | cfg->writeEntry("FocusOutPause", focusOutPause); | 74 | cfg->writeEntry("FocusOutPause", focusOutPause); |
75 | cfg->writeEntry("FocusInContinue", focusInContinue); | 75 | cfg->writeEntry("FocusInContinue", focusInContinue); |
76 | cfg->writeEntry("HideMouseCursor", hideMouseCursor); | 76 | cfg->writeEntry("HideMouseCursor", hideMouseCursor); |
77 | APP_CONFIG_END( cfg ); | 77 | APP_CONFIG_END( cfg ); |
78 | */ | ||
78 | delete _menuBar; | 79 | delete _menuBar; |
79 | } | 80 | } |
80 | 81 | ||
81 | void Kpacman::menu() | 82 | void Kpacman::menu() |
82 | { | 83 | { |
83 | gamePopup = new QPopupMenu(); | 84 | gamePopup = new QPopupMenu(); |
84 | CHECK_PTR( gamePopup ); | 85 | CHECK_PTR( gamePopup ); |
85 | newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2); | 86 | newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2); |
86 | pauseID = gamePopup->insertItem(tr("&Pause"), | 87 | pauseID = gamePopup->insertItem(tr("&Pause"), |
87 | this, SLOT(pauseKpacman()), Key_F3); | 88 | this, SLOT(pauseKpacman()), Key_F3); |
88 | hofID = gamePopup->insertItem(tr("&Hall of fame"), | 89 | hofID = gamePopup->insertItem(tr("&Hall of fame"), |
89 | this, SLOT(toggleHallOfFame()), Key_F4); | 90 | this, SLOT(toggleHallOfFame()), Key_F4); |
@@ -134,36 +135,38 @@ void Kpacman::menu() | |||
134 | //CHECK_PTR( _menuBar ); | 135 | //CHECK_PTR( _menuBar ); |
135 | //_menuBar->insertItem(tr("&Game"), gamePopup); | 136 | //_menuBar->insertItem(tr("&Game"), gamePopup); |
136 | //_menuBar->insertItem(tr("&Options"), optionsPopup); | 137 | //_menuBar->insertItem(tr("&Options"), optionsPopup); |
137 | //_menuBar->insertSeparator(); | 138 | //_menuBar->insertSeparator(); |
138 | #ifndef QPE_PORT | 139 | #ifndef QPE_PORT |
139 | _menuBar->insertItem(tr("&Help"), helpPopup); | 140 | _menuBar->insertItem(tr("&Help"), helpPopup); |
140 | #endif | 141 | #endif |
141 | } | 142 | } |
142 | 143 | ||
143 | int Kpacman::lookupSchemes() | 144 | int Kpacman::lookupSchemes() |
144 | { | 145 | { |
145 | APP_CONFIG_BEGIN( cfg ); | 146 | APP_CONFIG_BEGIN( cfg ); |
146 | int ModeCount = cfg->readNumEntry("ModeCount", -1); | 147 | int ModeCount = cfg->readNumEntry("ModeCount", 0); |
147 | int Mode = cfg->readNumEntry("Mode", -1); | 148 | int Mode = cfg->readNumEntry("Mode", 0); |
148 | int SchemeCount = cfg->readNumEntry("SchemeCount"); | 149 | int SchemeCount = cfg->readNumEntry("SchemeCount", 0); |
149 | int Scheme = cfg->readNumEntry("Scheme", -1); | 150 | int Scheme = cfg->readNumEntry("Scheme", 0); |
150 | 151 | ||
152 | /* | ||
151 | if (SchemeCount == 0 || Scheme == -1) { | 153 | if (SchemeCount == 0 || Scheme == -1) { |
152 | QMessageBox::warning(this, tr("Configuration Error"), | 154 | QMessageBox::warning(this, tr("Configuration Error"), |
153 | tr("There are no schemes defined,\n" | 155 | tr("There are no schemes defined,\n" |
154 | "or no scheme is selected.")); | 156 | "or no scheme is selected.")); |
155 | APP_CONFIG_END( cfg ); | 157 | APP_CONFIG_END( cfg ); |
156 | return 0; | 158 | return 0; |
157 | } | 159 | } |
160 | */ | ||
158 | 161 | ||
159 | connect(modesPopup, SIGNAL(activated(int)), this, SLOT(schemeChecked(int))); | 162 | connect(modesPopup, SIGNAL(activated(int)), this, SLOT(schemeChecked(int))); |
160 | modeID.resize(ModeCount > 0 ? ModeCount : 0); | 163 | modeID.resize(ModeCount > 0 ? ModeCount : 0); |
161 | 164 | ||
162 | if (!schemesPopup->isEmpty()) | 165 | if (!schemesPopup->isEmpty()) |
163 | schemesPopup->clear(); | 166 | schemesPopup->clear(); |
164 | 167 | ||
165 | SAVE_CONFIG_GROUP( cfg, oldgroup ); | 168 | SAVE_CONFIG_GROUP( cfg, oldgroup ); |
166 | 169 | ||
167 | QString ModeGroup; | 170 | QString ModeGroup; |
168 | QString ModeName; | 171 | QString ModeName; |
169 | 172 | ||
@@ -340,25 +343,26 @@ void Kpacman::schemeChecked(int id) | |||
340 | for (uint s = 0; s < schemeID.size(); s++) { | 343 | for (uint s = 0; s < schemeID.size(); s++) { |
341 | if (schemeID[s] == id) { | 344 | if (schemeID[s] == id) { |
342 | scheme = s; | 345 | scheme = s; |
343 | mode = schemeMode[s]; | 346 | mode = schemeMode[s]; |
344 | } | 347 | } |
345 | if (schemeMode[s] == -1) { | 348 | if (schemeMode[s] == -1) { |
346 | modesPopup->setItemChecked(schemeID[s], schemeID[s] == id); | 349 | modesPopup->setItemChecked(schemeID[s], schemeID[s] == id); |
347 | } else { | 350 | } else { |
348 | modesPopup->setItemChecked(modeID[schemeMode[s]], schemeMode[s] == mode); | 351 | modesPopup->setItemChecked(modeID[schemeMode[s]], schemeMode[s] == mode); |
349 | schemesPopup->at(schemeMode[s])->setItemChecked(schemeID[s], schemeID[s] == id); | 352 | schemesPopup->at(schemeMode[s])->setItemChecked(schemeID[s], schemeID[s] == id); |
350 | } | 353 | } |
351 | } | 354 | } |
352 | 355 | /* | |
353 | APP_CONFIG_BEGIN( cfg ); | 356 | APP_CONFIG_BEGIN( cfg ); |
354 | cfg->writeEntry("Scheme", scheme); | 357 | cfg->writeEntry("Scheme", scheme); |
355 | cfg->writeEntry("Mode", mode); | 358 | cfg->writeEntry("Mode", mode); |
356 | APP_CONFIG_END( cfg ); | 359 | APP_CONFIG_END( cfg ); |
360 | */ | ||
357 | 361 | ||
358 | view->setScheme(scheme, mode); | 362 | view->setScheme(scheme, mode); |
359 | view->updateGeometry(); | 363 | view->updateGeometry(); |
360 | updateGeometry(); | 364 | updateGeometry(); |
361 | update(); | 365 | update(); |
362 | repaint(TRUE); | 366 | repaint(TRUE); |
363 | show(); | 367 | show(); |
364 | } | 368 | } |