author | imm <imm> | 2002-09-21 12:24:59 (UTC) |
---|---|---|
committer | imm <imm> | 2002-09-21 12:24:59 (UTC) |
commit | 99d546ce72f40e28b04f09201d92d58294401591 (patch) (side-by-side diff) | |
tree | 4589ba17c622a114efb4811334e0adce02cedeca | |
parent | 279f025b03efdade9c211dd9441eec0c2a91ad94 (diff) | |
download | opie-99d546ce72f40e28b04f09201d92d58294401591.zip opie-99d546ce72f40e28b04f09201d92d58294401591.tar.gz opie-99d546ce72f40e28b04f09201d92d58294401591.tar.bz2 |
center widget
-rw-r--r-- | noncore/games/kpacman/kpacman.cpp | 23 | ||||
-rw-r--r-- | noncore/games/kpacman/kpacman.h | 18 | ||||
-rw-r--r-- | noncore/games/kpacman/kpacmanwidget.cpp | 9 | ||||
-rw-r--r-- | noncore/games/kpacman/referee.cpp | 4 | ||||
-rw-r--r-- | noncore/games/kpacman/score.cpp | 61 |
5 files changed, 14 insertions, 101 deletions
diff --git a/noncore/games/kpacman/kpacman.cpp b/noncore/games/kpacman/kpacman.cpp index 7df6ef0..d9d2d69 100644 --- a/noncore/games/kpacman/kpacman.cpp +++ b/noncore/games/kpacman/kpacman.cpp @@ -28,9 +28,11 @@ Kpacman::Kpacman(QWidget *parent, const char *name) - view = new KpacmanWidget( this, QString(name)+"widget"); + m_view = new QWidget( this, "m_view" ); + m_view->setBackgroundColor( black ); + m_layout = new QGridLayout( m_view ); + m_layout->setMargin( 7 ); -#ifndef QWS - setFixedSize(view->width(), view->height()); -#else - setCaption( "Kpacman" ); -#endif + view = new KpacmanWidget( this, QString(name)+"widget"); + m_layout->addWidget( view, 0, 0 ); + + setCaption( "KPacman" ); @@ -65,10 +67,3 @@ Kpacman::Kpacman(QWidget *parent, const char *name) -#ifndef QWS - menuBar->show(); - view->show(); - setMenu(menuBar); - setView(view); -#else - setCentralWidget( view ); -#endif + setCentralWidget( m_view ); } diff --git a/noncore/games/kpacman/kpacman.h b/noncore/games/kpacman/kpacman.h index d7de9de..2c1de70 100644 --- a/noncore/games/kpacman/kpacman.h +++ b/noncore/games/kpacman/kpacman.h @@ -9,12 +9,4 @@ -#if defined( KDE2_PORT ) -#include <kapp.h> -#include <klocale.h> -#include <ktmainwindow.h> -#include <kmenubar.h> -#elif defined( QPE_PORT ) #include <qmainwindow.h> class QMenuBar; -#endif - #include <qregexp.h> @@ -27,9 +19,4 @@ class QMenuBar; #include <qfileinf.h> +#include <qlayout.h> -#if defined( KDE2_PORT ) -#include <referee.h> -#include <status.h> -#include <score.h> -#include <keys.h> -#elif defined( QPE_PORT ) #include "referee.h" @@ -38,3 +25,2 @@ class QMenuBar; #include "keys.h" -#endif @@ -73,2 +59,4 @@ private: + QGridLayout *m_layout; + QWidget *m_view; KMenuBar *_menuBar; diff --git a/noncore/games/kpacman/kpacmanwidget.cpp b/noncore/games/kpacman/kpacmanwidget.cpp index 215dcda..feb782c 100644 --- a/noncore/games/kpacman/kpacmanwidget.cpp +++ b/noncore/games/kpacman/kpacmanwidget.cpp @@ -35,7 +35,3 @@ KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name) -#ifndef QWS - setFixedSize(referee->width(), bitfont->height()*3 + referee->height() + status->height()); -#else setBackgroundColor( black ); -#endif } @@ -140,7 +136,2 @@ void KpacmanWidget::setScheme(int Scheme, int Mode) -#ifndef QWS - setFixedSize(referee->width(), - bitfont->height()*3 + referee->height() + status->height()); -#endif - score->repaint(FALSE); diff --git a/noncore/games/kpacman/referee.cpp b/noncore/games/kpacman/referee.cpp index 70916f0..81f331b 100644 --- a/noncore/games/kpacman/referee.cpp +++ b/noncore/games/kpacman/referee.cpp @@ -733,6 +733,6 @@ void Referee::keyPressEvent( QKeyEvent *k ) else if ( !gameState.testBit(Playing) && - key == Key_Up || + ( key == Key_Up || key == Key_Down || key == Key_Right || - key == Key_Left ) + key == Key_Left )) play(); diff --git a/noncore/games/kpacman/score.cpp b/noncore/games/kpacman/score.cpp index 17dbf0a..b3ff3d9 100644 --- a/noncore/games/kpacman/score.cpp +++ b/noncore/games/kpacman/score.cpp @@ -480,30 +480,2 @@ void Score::write() { -#ifndef QWS - if (!highscoreFile.exists() && highscoreFile.name() == systemHighscoreFileInfo.filePath()) - KMessageBox::information(0, - tr("You're going to create the highscore-file\n" - "'%1'\n" - "for your maschine, that should be used systemwide.\n" - "\n" - "To grant access to the other users, set the appropriate rights (a+w)\n" - "on that file or ask your systemadministator for that favor.\n" - "\n" - "To use a different directory or filename for the highscores," - "specify them in the configfile (kpacmanrc:highscoreFilePath)." - ).arg(systemHighscoreFileInfo.filePath())); - - if (highscoreFile.name() == privateHighscoreFileInfo.filePath()) - KMessageBox::information(0, - tr("You're using a private highscore-file, that's mostly because of\n" - "missing write-access to the systemwide file\n" - "'%1' .\n" - "\n" - "Ask your systemadministrator for granting you access to that file,\n" - "by setting the appropriate rights (a+w) on it.\n" - "\n" - "To use a different directory or filename for the highscores," - "specify them in the configfile (kpacmanrc:highscoreFilePath)." - ).arg(systemHighscoreFileInfo.filePath()), - QString::null, "PrivateHighscore"); -#endif if (highscoreFile.open(IO_WriteOnly)) { @@ -607,35 +579,2 @@ QFileInfo Score::locateHighscoreFilePath() { -#ifndef QWS - QFileInfo systemHighscoreDirPath; - QStringList systemHighscoreDirs; - - // Schreibfähige "private" highscore-Datei ermitteln für den fallback. - privateHighscoreFileInfo.setFile(KGlobal::dirs()->saveLocation("appdata")+highscoreName); - - // FilePath aus der Konfigurationsdatei benutzen - systemHighscoreFileInfo.setFile(cfg->readEntry("HighscoreFilePath")); - - // Kein Wert aus der Konfiguration erhalten, dann die "system"-Datei suchen. - if (systemHighscoreFileInfo.filePath().isEmpty()) - systemHighscoreDirs = KGlobal::dirs()->resourceDirs("appdata"); - else - systemHighscoreDirs = QStringList(systemHighscoreFileInfo.filePath()); - - for (QStringList::Iterator i = systemHighscoreDirs.begin(); i != systemHighscoreDirs.end(); ++i) { - - systemHighscoreFileInfo.setFile(*i); - if (systemHighscoreFileInfo.fileName().isEmpty()) - systemHighscoreFileInfo.setFile(systemHighscoreFileInfo.dirPath()+"/"+highscoreName); - - // privateHighscoreFileInfo für die "system" Suche ignorieren - if (systemHighscoreFileInfo.filePath() != privateHighscoreFileInfo.filePath()) - if (!systemHighscoreFileInfo.exists()) { - systemHighscoreDirPath.setFile(systemHighscoreFileInfo.dirPath()); - if (systemHighscoreDirPath.exists() && systemHighscoreDirPath.isWritable()) - return systemHighscoreFileInfo; - } else - if (systemHighscoreFileInfo.isWritable()) - return systemHighscoreFileInfo; - } -#endif return privateHighscoreFileInfo; |