summaryrefslogtreecommitdiff
authorzecke <zecke>2003-01-22 14:52:17 (UTC)
committer zecke <zecke>2003-01-22 14:52:17 (UTC)
commit36fab41fa6b38b9f3aa5ecd74b750eaf739beb16 (patch) (side-by-side diff)
tree44c886f9d6673b8d0ac1c446fa9cbcabad6d9bb3
parentaa611367a06617e9ad12bd6787ce255a5965f695 (diff)
downloadopie-36fab41fa6b38b9f3aa5ecd74b750eaf739beb16.zip
opie-36fab41fa6b38b9f3aa5ecd74b750eaf739beb16.tar.gz
opie-36fab41fa6b38b9f3aa5ecd74b750eaf739beb16.tar.bz2
make it build with Qt/X11
for running one need to copy the kpacman.conf from share/kpacman to ~/Settings
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kpacman/kpacman.cpp4
-rw-r--r--noncore/games/kpacman/kpacmanwidget.cpp5
-rw-r--r--noncore/games/kpacman/portable.h5
-rw-r--r--noncore/games/kpacman/status.cpp1
4 files changed, 8 insertions, 7 deletions
diff --git a/noncore/games/kpacman/kpacman.cpp b/noncore/games/kpacman/kpacman.cpp
index d9d2d69..aee8eea 100644
--- a/noncore/games/kpacman/kpacman.cpp
+++ b/noncore/games/kpacman/kpacman.cpp
@@ -94,69 +94,69 @@ void Kpacman::menu()
optionsPopup = new QPopupMenu();
CHECK_PTR(optionsPopup);
modesPopup = new QPopupMenu();
CHECK_PTR(modesPopup);
hideMouseCursorID = optionsPopup->insertItem(tr("&Hide Mousecursor"),
this, SLOT(toggleHideMouseCursor()),
CTRL+Key_H);
optionsPopup->insertSeparator();
if (lookupSchemes() > 0) {
optionsPopup->insertItem(tr("&Select graphic scheme"), modesPopup);
optionsPopup->insertSeparator();
}
focusOutPauseID = optionsPopup->insertItem(tr("&Pause in Background"),
this, SLOT(toggleFocusOutPause()));
focusInContinueID = optionsPopup->insertItem(tr("&Continue in Foreground"),
this, SLOT(toggleFocusInContinue()));
optionsPopup->insertSeparator();
optionsPopup->insertItem(tr("Change &keys..."), this, SLOT(confKeys()));
-#ifndef QWS
+#ifndef QPE_PORT
QString aboutText = tr("@PACKAGE@ - @VERSION@\n\n"
"Joerg Thoennissen (joe@dsite.de)\n\n"
"A pacman game for the KDE Desktop\n\n"
"The program based on the source of ksnake\n"
"by Michel Filippi (mfilippi@sade.rhein-main.de).\n"
"The design was strongly influenced by the pacman\n"
"(c) 1980 MIDWAY MFG.CO.\n\n"
"I like to thank my girlfriend Elke Krueers for\n"
"the last 10 years of her friendship.\n");
aboutText.replace(QRegExp("@PACKAGE@"), PACKAGE);
aboutText.replace(QRegExp("@VERSION@"), VERSION);
QPopupMenu *helpPopup = helpMenu(aboutText, FALSE);
#endif
//_menuBar = new KMenuBar(this);
//CHECK_PTR( _menuBar );
//_menuBar->insertItem(tr("&Game"), gamePopup);
//_menuBar->insertItem(tr("&Options"), optionsPopup);
//_menuBar->insertSeparator();
-#ifndef QWS
+#ifndef QPE_PORT
_menuBar->insertItem(tr("&Help"), helpPopup);
#endif
}
int Kpacman::lookupSchemes()
{
APP_CONFIG_BEGIN( cfg );
int ModeCount = cfg->readNumEntry("ModeCount", -1);
int Mode = cfg->readNumEntry("Mode", -1);
int SchemeCount = cfg->readNumEntry("SchemeCount");
int Scheme = cfg->readNumEntry("Scheme", -1);
if (SchemeCount == 0 || Scheme == -1) {
QMessageBox::warning(this, tr("Configuration Error"),
tr("There are no schemes defined,\n"
"or no scheme is selected."));
APP_CONFIG_END( cfg );
return 0;
}
connect(modesPopup, SIGNAL(activated(int)), this, SLOT(schemeChecked(int)));
modeID.resize(ModeCount > 0 ? ModeCount : 0);
if (!schemesPopup->isEmpty())
diff --git a/noncore/games/kpacman/kpacmanwidget.cpp b/noncore/games/kpacman/kpacmanwidget.cpp
index feb782c..cf2aed9 100644
--- a/noncore/games/kpacman/kpacmanwidget.cpp
+++ b/noncore/games/kpacman/kpacmanwidget.cpp
@@ -2,48 +2,51 @@
#include "portable.h"
#if defined( KDE2_PORT )
#include <kapp.h>
#include <kconfig.h>
#include <kstddirs.h>
#include <kpacmanwidget.h>
#include <kpacmanwidget.moc>
#elif defined( QPE_PORT )
#include <qpe/qpeapplication.h>
#include "config.h"
#include "kpacmanwidget.h"
#endif
#include <qmessagebox.h>
#include "bitfont.h"
#include "score.h"
#include "referee.h"
#include "status.h"
KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name)
: QWidget( parent, name )
{
+ score = 0l;
+ referee = 0l;
+ status = 0l;
bitfont = NULL;
fontName = "";
scheme = mode = -1;
confScheme();
score = new Score(this, name, scheme, mode, bitfont);
referee = new Referee( this, name, scheme, mode, bitfont);
status = new Status(this, name, scheme, mode);
setBackgroundColor( black );
}
KpacmanWidget::~KpacmanWidget()
{
}
void KpacmanWidget::confMisc(bool defGroup)
{
APP_CONFIG_BEGIN( cfg );
//KStandardDirs *dirs = KGlobal::dirs();
QString findPath;
if (defGroup || cfg->hasKey("Font")) {
@@ -120,34 +123,36 @@ void KpacmanWidget::confScheme()
}
RESTORE_CONFIG_GROUP( cfg, oldgroup );
APP_CONFIG_END( cfg );
}
void KpacmanWidget::setScheme(int Scheme, int Mode)
{
mode = Mode;
scheme = Scheme;
confScheme();
score->setScheme(Scheme, Mode, bitfont);
referee->setScheme(Scheme, Mode, bitfont);
status->setScheme(Scheme, Mode);
score->repaint(FALSE);
referee->repaint(FALSE);
status->repaint(FALSE);
}
void KpacmanWidget::resizeEvent( QResizeEvent * )
{
+ qWarning("Resize");
referee->setGeometry(0, bitfont->height()*3, referee->width(), referee->height());
referee->setBackgroundColor(BLACK);
+ if(!status ) return;
status->setGeometry(0, bitfont->height()*3+referee->height(), referee->width(),
status->height());
status->setBackgroundColor(BLACK);
score->setGeometry(0, 0, referee->width(), bitfont->height()*3+referee->height()+status->height());
score->setBackgroundColor(BLACK);
}
diff --git a/noncore/games/kpacman/portable.h b/noncore/games/kpacman/portable.h
index ff0912b..b087be5 100644
--- a/noncore/games/kpacman/portable.h
+++ b/noncore/games/kpacman/portable.h
@@ -1,51 +1,46 @@
/***************************************************************************
portable.h - various bits that ease porting kpacman to other platforms.
Currently KDE2 and Qtopia ports exist.
-------------------
begin : Mon Mar 18 12:35:24 EET 2002
copyright : (C) 2002 by Catalin Climov
email : catalin@climov.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PORTABLE_H
#define PORTABLE_H
-#ifdef QWS
#define QPE_PORT
-#else
-#define KDE2_PORT
-#define KDE_PORT
-#endif
#if defined( KDE2_PORT )
#define APP kapp
#define APP_CONFIG_BEGIN( cfgname ) KConfig cfgname = kapp->config()
#define APP_CONFIG_END( cfgname ) cfgname->sync()
#define SAVE_CONFIG_GROUP( cfgname, groupname ) QString groupname = configname->group()
#define RESTORE_CONFIG_GROUP( cfgname, groupname ) configname->setGroup( groupname )
#define FIND_APP_DATA( dataname ) KGlobal::dirs()->findResource( "appdata", dataname )
#elif defined( QPE_PORT )
#define i18n( x ) x
#define KTMainWindow QMainWindow
#define KMenuBar QMenuBar
#define KAccel QAccel
#define APP qApp
#define APP_CONFIG_BEGIN( cfgname ) Config* cfgname = new Config("kpacman"); cfgname->setGroup("Default");
#define APP_CONFIG_END( cfgname ) delete cfgname
#define SAVE_CONFIG_GROUP( cfgname, groupname )
#define RESTORE_CONFIG_GROUP( cfgname, groupname ) cfgname->setGroup("Default")
diff --git a/noncore/games/kpacman/status.cpp b/noncore/games/kpacman/status.cpp
index 3453d37..1ef910d 100644
--- a/noncore/games/kpacman/status.cpp
+++ b/noncore/games/kpacman/status.cpp
@@ -1,48 +1,49 @@
#include "portable.h"
#if defined( KDE2_PORT )
#include <kapp.h>
#include <klocale.h>
#include <kstddirs.h>
#include <status.h>
#include <status.moc>
#elif defined( QPE_PORT )
#include <qpe/qpeapplication.h>
#include "config.h"
#include "status.h"
#endif
#include <qpixmap.h>
#include <qbitmap.h>
#include <qstring.h>
#include <qmsgbox.h>
#include <qfileinfo.h>
Status::Status( QWidget *parent, const char *name, int Scheme, int Mode ) :
QWidget( parent, name )
{
+ qWarning("Status::Status");
actualLifes = 0;
actualLevel = 0;
lifesPix = NULL;
levelPix = NULL;
scheme = Scheme;
mode = Mode;
level = 0;
confScheme();
}
QList<QPixmap> *Status::loadPixmap(QWidget *parent, QString pixmapName,
QList<QPixmap> *pixmaps)
{
if (pixmaps == NULL) {
pixmaps = new QList<QPixmap>;
pixmaps->setAutoDelete(TRUE);
}
if (!pixmaps->isEmpty())
pixmaps->clear();