summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/zsame/ZSameWidget.cpp8
-rw-r--r--noncore/games/zsame/config.in2
-rw-r--r--noncore/games/zsame/opie-zsame.control2
-rw-r--r--noncore/games/zsame/zsame.pro2
4 files changed, 7 insertions, 7 deletions
diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp
index 45a877f..3c58c93 100644
--- a/noncore/games/zsame/ZSameWidget.cpp
+++ b/noncore/games/zsame/ZSameWidget.cpp
@@ -1,227 +1,227 @@
1/* Yo Emacs, this is -*- C++ -*- */ 1/* Yo Emacs, this is -*- C++ -*- */
2/* 2/*
3 * ksame 0.4 - simple Game 3 * ksame 0.4 - simple Game
4 * Copyright (C) 1997,1998 Marcus Kreutzberger 4 * Copyright (C) 1997,1998 Marcus Kreutzberger
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * 19 *
20 */ 20 */
21 21
22#include <stdio.h> 22#include <stdio.h>
23 23
24#include <opie2/oapplicationfactory.h>
25
26#include <qpe/resource.h>
27
24#include <qtoolbar.h> 28#include <qtoolbar.h>
25#include <qmenubar.h> 29#include <qmenubar.h>
26
27#include <qapplication.h> 30#include <qapplication.h>
28#include <qaction.h> 31#include <qaction.h>
29#include <qmessagebox.h> 32#include <qmessagebox.h>
30 33
31#include <qpe/resource.h>
32#include <opie/oapplicationfactory.h>
33#include <kapplication.h> 34#include <kapplication.h>
34 35
35
36#include "ZSameWidget.h" 36#include "ZSameWidget.h"
37 37
38static int default_colors=3; 38static int default_colors=3;
39 39
40#define i18n tr 40#define i18n tr
41 41
42 42
43OPIE_EXPORT_APP( OApplicationFactory<ZSameWidget> ) 43OPIE_EXPORT_APP( OApplicationFactory<ZSameWidget> )
44 44
45 45
46 46
47ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl ) 47ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl )
48 : QMainWindow( parent, name, fl ) 48 : QMainWindow( parent, name, fl )
49{ 49{
50 setCaption(tr("ZSame")); 50 setCaption(tr("ZSame"));
51 51
52 setToolBarsMovable( false ); 52 setToolBarsMovable( false );
53 QToolBar* con = new QToolBar( this ); 53 QToolBar* con = new QToolBar( this );
54 con->setHorizontalStretchable( true ); 54 con->setHorizontalStretchable( true );
55 QMenuBar* mb = new QMenuBar( con ); 55 QMenuBar* mb = new QMenuBar( con );
56 QToolBar* tb = new QToolBar( this ); 56 QToolBar* tb = new QToolBar( this );
57 57
58 QPopupMenu* fileMenu = new QPopupMenu( this ); 58 QPopupMenu* fileMenu = new QPopupMenu( this );
59 59
60 QAction* a = new QAction(tr("New Game"), Resource::loadIconSet("new") , 60 QAction* a = new QAction(tr("New Game"), Resource::loadIconSet("new") ,
61 QString::null, 0, this, "new_icon"); 61 QString::null, 0, this, "new_icon");
62 a->addTo( fileMenu ); 62 a->addTo( fileMenu );
63 a->addTo( tb ); 63 a->addTo( tb );
64 connect(a, SIGNAL(activated()), this, SLOT(m_new())); 64 connect(a, SIGNAL(activated()), this, SLOT(m_new()));
65 65
66 a = new QAction(tr("Restart This Board"), Resource::loadIconSet("redo"), 66 a = new QAction(tr("Restart This Board"), Resource::loadIconSet("redo"),
67 QString::null, 0, this, "restart_board" ); 67 QString::null, 0, this, "restart_board" );
68 a->addTo( fileMenu ); 68 a->addTo( fileMenu );
69 connect( a, SIGNAL(activated()), this, SLOT(m_restart())); 69 connect( a, SIGNAL(activated()), this, SLOT(m_restart()));
70 restart = a; 70 restart = a;
71 71
72 a = new QAction( tr("Undo"), Resource::loadIconSet("undo"), 72 a = new QAction( tr("Undo"), Resource::loadIconSet("undo"),
73 QString::null, 0, this, "undo_action" ); 73 QString::null, 0, this, "undo_action" );
74 a->addTo( fileMenu ); 74 a->addTo( fileMenu );
75 a->addTo( tb ); 75 a->addTo( tb );
76 connect( a, SIGNAL(activated()), this, SLOT(m_undo())); 76 connect( a, SIGNAL(activated()), this, SLOT(m_undo()));
77 77
78 a = new QAction(tr("Quit"), Resource::loadIconSet("quit_icon"), 78 a = new QAction(tr("Quit"), Resource::loadIconSet("quit_icon"),
79 QString::null, 0, this, "quit_action"); 79 QString::null, 0, this, "quit_action");
80 a->addTo( fileMenu ); 80 a->addTo( fileMenu );
81 a->addTo( tb ); 81 a->addTo( tb );
82 connect(a, SIGNAL(activated()), this, SLOT(m_quit())); 82 connect(a, SIGNAL(activated()), this, SLOT(m_quit()));
83 83
84 mb->insertItem(tr("Game" ), fileMenu ); 84 mb->insertItem(tr("Game" ), fileMenu );
85 85
86 int foo[2]; 86 int foo[2];
87 desktop_widget(foo); 87 desktop_widget(foo);
88 stone = new StoneWidget(this,foo[0],foo[1]); 88 stone = new StoneWidget(this,foo[0],foo[1]);
89 89
90 connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover())); 90 connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover()));
91 91
92 connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int))); 92 connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int)));
93 connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int))); 93 connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int)));
94 connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int))); 94 connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int)));
95 connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int))); 95 connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int)));
96 connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int))); 96 connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int)));
97 97
98 connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged())); 98 connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged()));
99 99
100 sizeChanged(); 100 sizeChanged();
101 setCentralWidget(stone); 101 setCentralWidget(stone);
102 102
103 103
104 setScore(0); 104 setScore(0);
105} 105}
106 106
107ZSameWidget::~ZSameWidget() { 107ZSameWidget::~ZSameWidget() {
108 108
109} 109}
110 110
111void ZSameWidget::readProperties(Config *conf) { 111void ZSameWidget::readProperties(Config *conf) {
112/* 112/*
113 Q_ASSERT(conf); 113 Q_ASSERT(conf);
114 stone->readProperties(conf); 114 stone->readProperties(conf);
115*/ 115*/
116} 116}
117 117
118void ZSameWidget::saveProperties(Config *conf) { 118void ZSameWidget::saveProperties(Config *conf) {
119/* 119/*
120 Q_ASSERT(conf); 120 Q_ASSERT(conf);
121 stone->saveProperties(conf); 121 stone->saveProperties(conf);
122 conf->sync(); 122 conf->sync();
123*/ 123*/
124} 124}
125 125
126void ZSameWidget::sizeChanged() { 126void ZSameWidget::sizeChanged() {
127 //stone->setFixedSize(stone->sizeHint()); 127 //stone->setFixedSize(stone->sizeHint());
128} 128}
129 129
130void ZSameWidget::newGame(unsigned int board,int colors) { 130void ZSameWidget::newGame(unsigned int board,int colors) {
131 while (board>=1000000) board-=1000000; 131 while (board>=1000000) board-=1000000;
132 // kdDebug() << "newgame board " << board << " colors " << colors << endl; 132 // kdDebug() << "newgame board " << board << " colors " << colors << endl;
133 stone->newGame(board,colors); 133 stone->newGame(board,colors);
134 setScore(0); 134 setScore(0);
135} 135}
136 136
137bool ZSameWidget::confirmAbort() { 137bool ZSameWidget::confirmAbort() {
138 return stone->isGameover() || 138 return stone->isGameover() ||
139 stone->isOriginalBoard() || 139 stone->isOriginalBoard() ||
140 (QMessageBox::warning(this, i18n("Resign"), i18n("<qt>Do you want to resign?</qt>"), 140 (QMessageBox::warning(this, i18n("Resign"), i18n("<qt>Do you want to resign?</qt>"),
141 QMessageBox::Yes, 141 QMessageBox::Yes,
142 QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes ); 142 QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes );
143} 143}
144 144
145void ZSameWidget::m_new() { 145void ZSameWidget::m_new() {
146 if (confirmAbort()) 146 if (confirmAbort())
147 newGame(_random(),default_colors); 147 newGame(_random(),default_colors);
148 148
149} 149}
150 150
151void ZSameWidget::m_restart() { 151void ZSameWidget::m_restart() {
152 if (confirmAbort()) 152 if (confirmAbort())
153 newGame(stone->board(),default_colors); 153 newGame(stone->board(),default_colors);
154} 154}
155 155
156void ZSameWidget::m_load() { 156void ZSameWidget::m_load() {
157// kdDebug() << "menu load not supported" << endl; 157// kdDebug() << "menu load not supported" << endl;
158} 158}
159 159
160void ZSameWidget::m_save() { 160void ZSameWidget::m_save() {
161// kdDebug() << "menu save not supported" << endl; 161// kdDebug() << "menu save not supported" << endl;
162} 162}
163 163
164void ZSameWidget::m_undo() { 164void ZSameWidget::m_undo() {
165 //Q_ASSERT(stone); 165 //Q_ASSERT(stone);
166 stone->undo(); 166 stone->undo();
167} 167}
168 168
169 169
170void ZSameWidget::m_showhs() { 170void ZSameWidget::m_showhs() {
171/* Q_ASSERT(stone); 171/* Q_ASSERT(stone);
172 stone->unmark(); 172 stone->unmark();
173 KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); 173 KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this);
174 d.addField(Board, i18n("Board"), "Board"); 174 d.addField(Board, i18n("Board"), "Board");
175 d.exec(); 175 d.exec();
176*/ 176*/
177} 177}
178 178
179void ZSameWidget::m_quit() { 179void ZSameWidget::m_quit() {
180// Q_ASSERT(stone); 180// Q_ASSERT(stone);
181 stone->unmark(); 181 stone->unmark();
182 qApp->quit(); 182 qApp->quit();
183// delete this; 183// delete this;
184} 184}
185 185
186void ZSameWidget::m_tglboard() { 186void ZSameWidget::m_tglboard() {
187 //kdDebug() << "toggled" << endl; 187 //kdDebug() << "toggled" << endl;
188} 188}
189 189
190 190
191void ZSameWidget::setColors(int colors) { 191void ZSameWidget::setColors(int colors) {
192 //status->changeItem(i18n("%1 Colors").arg(colors),1); 192 //status->changeItem(i18n("%1 Colors").arg(colors),1);
193} 193}
194 194
195void ZSameWidget::setBoard(int board) { 195void ZSameWidget::setBoard(int board) {
196 //status->changeItem(i18n("Board: %1").arg(board, 6), 2); 196 //status->changeItem(i18n("Board: %1").arg(board, 6), 2);
197} 197}
198 198
199void ZSameWidget::setMarked(int m) { 199void ZSameWidget::setMarked(int m) {
200// status->changeItem(i18n("Marked: %1").arg(m, 6),3); 200// status->changeItem(i18n("Marked: %1").arg(m, 6),3);
201} 201}
202 202
203void ZSameWidget::stonesRemoved(int,int) { 203void ZSameWidget::stonesRemoved(int,int) {
204 //KNotifyClient::event("stones removed", 204 //KNotifyClient::event("stones removed",
205 // i18n("%1 stones removed.").arg(stone->marked())); 205 // i18n("%1 stones removed.").arg(stone->marked()));
206} 206}
207 207
208void ZSameWidget::setScore(int score) { 208void ZSameWidget::setScore(int score) {
209// status->changeItem(i18n("Score: %1").arg(score, 6),4); 209// status->changeItem(i18n("Score: %1").arg(score, 6),4);
210// undo->setEnabled(stone->undoPossible()); 210// undo->setEnabled(stone->undoPossible());
211// restart->setEnabled(!stone->isOriginalBoard()); 211// restart->setEnabled(!stone->isOriginalBoard());
212} 212}
213 213
214void ZSameWidget::gameover() { 214void ZSameWidget::gameover() {
215// kdDebug() << "GameOver" << endl; 215// kdDebug() << "GameOver" << endl;
216 if (stone->hasBonus()) { 216 if (stone->hasBonus()) {
217 QMessageBox::information(this,i18n("Game won"), 217 QMessageBox::information(this,i18n("Game won"),
218 i18n("<qt>You even removed the last stone, great job! " 218 i18n("<qt>You even removed the last stone, great job! "
219 "This gave you a score of %1 in total.</qt>").arg(stone->score())); 219 "This gave you a score of %1 in total.</qt>").arg(stone->score()));
220 } else { 220 } else {
221 QMessageBox::information(this,i18n("Game over"), 221 QMessageBox::information(this,i18n("Game over"),
222 i18n("<qt>There are no more removeable stones. " 222 i18n("<qt>There are no more removeable stones. "
223 "You got a score of %1 in total.</qt>").arg(stone->score())); 223 "You got a score of %1 in total.</qt>").arg(stone->score()));
224 } 224 }
225 stone->unmark(); 225 stone->unmark();
226} 226}
227 227
diff --git a/noncore/games/zsame/config.in b/noncore/games/zsame/config.in
index cd3e1a1..7774594 100644
--- a/noncore/games/zsame/config.in
+++ b/noncore/games/zsame/config.in
@@ -1,4 +1,4 @@
1 config ZSAME 1 config ZSAME
2 boolean "opie-zsame (a SameGame clone)" 2 boolean "opie-zsame (a SameGame clone)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/games/zsame/opie-zsame.control b/noncore/games/zsame/opie-zsame.control
index d9d5009..4a4b940 100644
--- a/noncore/games/zsame/opie-zsame.control
+++ b/noncore/games/zsame/opie-zsame.control
@@ -1,10 +1,10 @@
1Package: opie-zsame 1Package: opie-zsame
2Files: plugins/application/libzsame.so* bin/zsame apps/Games/zsame.desktop pics/zsame 2Files: plugins/application/libzsame.so* bin/zsame apps/Games/zsame.desktop pics/zsame
3Priority: optional 3Priority: optional
4Section: opie/games 4Section: opie/games
5Maintainer: Holger 'Zecke' Freyther <zecke@handhelds.org> 5Maintainer: Holger 'Zecke' Freyther <zecke@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal, libopiecore2
8Description: ZSame 8Description: ZSame
9 A game for the Opie environment. 9 A game for the Opie environment.
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/games/zsame/zsame.pro b/noncore/games/zsame/zsame.pro
index 17fba91..ac1b5be 100644
--- a/noncore/games/zsame/zsame.pro
+++ b/noncore/games/zsame/zsame.pro
@@ -1,17 +1,17 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2 2
3 3
4TARGET = zsame 4TARGET = zsame
5 5
6HEADERS = StoneField.h StoneWidget.h ZSameWidget.h dropin/krandomsequence.h 6HEADERS = StoneField.h StoneWidget.h ZSameWidget.h dropin/krandomsequence.h
7SOURCES = StoneField.cpp StoneWidget.cpp ZSameWidget.cpp dropin/krandomsequence.cpp 7SOURCES = StoneField.cpp StoneWidget.cpp ZSameWidget.cpp dropin/krandomsequence.cpp
8 8
9 9
10INCLUDEPATH += $(OPIEDIR)/include dropin 10INCLUDEPATH += $(OPIEDIR)/include dropin
11DEPENDPATH += $(OPIEDIR)/include 11DEPENDPATH += $(OPIEDIR)/include
12 12
13 13
14# we now also include opie 14# we now also include opie
15LIBS += -lqpe 15LIBS += -lqpe -lopiecore2
16 16
17include ( $(OPIEDIR)/include.pro ) 17include ( $(OPIEDIR)/include.pro )