summaryrefslogtreecommitdiff
path: root/noncore
authorimm <imm>2002-08-31 22:59:38 (UTC)
committer imm <imm>2002-08-31 22:59:38 (UTC)
commit277ec30e2807c7bd6bdc9efdb086e9c72c3741e9 (patch) (side-by-side diff)
tree399c6bd30dbc766688fea389a96988ac85e30ac7 /noncore
parentaf1fb861d849575d9c10d33f0a49423fc2b4d976 (diff)
downloadopie-277ec30e2807c7bd6bdc9efdb086e9c72c3741e9.zip
opie-277ec30e2807c7bd6bdc9efdb086e9c72c3741e9.tar.gz
opie-277ec30e2807c7bd6bdc9efdb086e9c72c3741e9.tar.bz2
remove credits
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/buzzword/buzzword.cpp7
-rw-r--r--noncore/games/buzzword/buzzword.h1
2 files changed, 0 insertions, 8 deletions
diff --git a/noncore/games/buzzword/buzzword.cpp b/noncore/games/buzzword/buzzword.cpp
index 324b5bd..b870a59 100644
--- a/noncore/games/buzzword/buzzword.cpp
+++ b/noncore/games/buzzword/buzzword.cpp
@@ -30,98 +30,96 @@
#include <qdir.h>
#include <math.h>
#include <stdlib.h>
#include <qpe/qpeapplication.h>
#include "buzzword.h"
BuzzLabel::BuzzLabel( QWidget *parent, const char *name )
: QLabel( parent, name )
{
}
void BuzzLabel::mousePressEvent(QMouseEvent *e)
{
if(e->button() == LeftButton)
{
emit clicked();
}
}
BuzzItem::BuzzItem( int row, int column, QString text, QWidget *parent, const char *name )
: QVBox( parent, name ), _row(row), _column(column)
{
setFrameStyle( QFrame::Panel | QFrame::Raised );
setLineWidth( 1 );
label = new BuzzLabel(this, "label");
label->setText(text);
label->setAlignment( int( QLabel::AlignCenter ) );
connect( label, SIGNAL(clicked()), this, SLOT(flip()) );
}
void BuzzItem::flip()
{
setLineWidth( 1 );
label->setBackgroundColor(label->colorGroup().highlight());
emit clicked(_row, _column);
}
BuzzWord::BuzzWord() : QMainWindow(0)
{
setCaption(tr("buZzword"));
menu = menuBar();
game = new QPopupMenu;
game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N );
- game->insertSeparator();
- game->insertItem(tr("&About"), this, SLOT(about()));
menu->insertItem( tr("&Game"), game );
gridVal = 4;
grid = NULL;
gameOver = false;
newGame();
}
void BuzzWord::drawGrid()
{
QStringList l;
QString path = QPEApplication::qpeDir()+"share/buzzword/";
QFile f( path + "buzzwords" );
if ( !f.open( IO_ReadOnly ) )
return;
QTextStream t( &f );
while (!t.atEnd())
{
l << t.readLine();
}
f.close();
grid = new QGrid(gridVal, this);
grid->setFixedSize(240,240);
for( int c = 0 ; c < gridVal ; c++ )
{
for( int r = 0 ; r < gridVal ; r++ )
{
uint pos = rand() % l. count();
QString word = QStringList::split(" ", l[pos]).join("\n");
BuzzItem* bi = new BuzzItem( c, r, word, grid );
connect( bi, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)) );
map[c][r] = 0;
l.remove( l.at( pos ));
}
}
}
void BuzzWord::clicked(int row, int column)
{
if ( ! gameOver )
@@ -130,60 +128,55 @@ void BuzzWord::clicked(int row, int column)
int columnTotal = 0;
map[column][row] = 1;
for( int c = 0 ; c < gridVal ; c++ )
{
for( int r = 0 ; r < gridVal ; r++ )
{
if ( map[c][r] == 1 )
rowTotal++;
if ( rowTotal == 4 )
{
bingo();
}
}
rowTotal = 0;
}
for( int r = 0 ; r < gridVal ; r++ )
{
for( int c = 0 ; c < gridVal ; c++ )
{
if ( map[c][r] == 1 )
columnTotal++;
if ( columnTotal == 4 )
{
bingo();
}
}
columnTotal = 0;
}
if ( map[0][0] && map[1][1] && map[2][2] && map[3][3] )
bingo();
if ( map[0][3] && map[1][2] && map[2][1] && map[3][0] )
bingo();
}
}
void BuzzWord::bingo()
{
gameOver = true;
QMessageBox::information( this, "BUZZWORD", tr("<h1><b>BINGO !</b></h1>"));
}
-void BuzzWord::about()
-{
- QMessageBox::information( this, "About", "buZzword 1.0\n(c) 2002 Martin Imobersteg\n\nThis program is distributed\nunder the terms of the GPL v2." );
-}
-
void BuzzWord::newGame()
{
gameOver = false;
delete grid;
drawGrid();
setCentralWidget(grid);
}
diff --git a/noncore/games/buzzword/buzzword.h b/noncore/games/buzzword/buzzword.h
index 2e00563..37dd5b4 100644
--- a/noncore/games/buzzword/buzzword.h
+++ b/noncore/games/buzzword/buzzword.h
@@ -35,55 +35,54 @@ public:
protected:
virtual void mousePressEvent(QMouseEvent *e);
signals:
void clicked();
};
class BuzzItem : public QVBox
{
Q_OBJECT
public:
BuzzItem( int row, int column, QString text, QWidget *parent=0, const char *name=0 );
private:
QLabel* label;
int _row;
int _column;
public slots:
void flip();
signals:
void clicked(int row,int column);
};
class BuzzWord : public QMainWindow
{
Q_OBJECT
public:
BuzzWord();
private:
void drawGrid();
void bingo();
QString getWord();
QMenuBar *menu;
QPopupMenu *game;
QGrid *grid;
int gridVal;
int map[4][4];
bool gameOver;
public slots:
- void about();
void newGame();
void clicked(int row, int column);
};
#endif