summaryrefslogtreecommitdiff
path: root/noncore/games/mindbreaker/mindbreaker.cpp
Side-by-side diff
Diffstat (limited to 'noncore/games/mindbreaker/mindbreaker.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/mindbreaker/mindbreaker.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/mindbreaker/mindbreaker.cpp b/noncore/games/mindbreaker/mindbreaker.cpp
index 1a1d05d..7802e38 100644
--- a/noncore/games/mindbreaker/mindbreaker.cpp
+++ b/noncore/games/mindbreaker/mindbreaker.cpp
@@ -169,97 +169,97 @@ bool Peg::hit( const QPoint &p ) const
if (!normalPegs[pegtype]->valid(ix, iy))
return FALSE;
QRgb pixel = normalPegs[pegtype]->pixel(ix, iy);
return (qAlpha(pixel ) != 0);
}
inline bool Peg::placed() const
{
return isplaced;
}
inline int Peg::pegGo() const
{
return peg_go;
}
inline int Peg::pegPos() const
{
return peg_pos;
}
inline void Peg::setPegPos(int p)
{
peg_pos = p;
}
inline void Peg::setPlaced(bool p)
{
isplaced = p;
}
inline int Peg::type() const
{
return pegtype;
}
/* Load the main image, copy from it the pegs, the board, and the answer image
* and use these to create the tray, answer and board
*/
MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags )
: QMainWindow(parent, name, wFlags),
canvas(board_height, board_width)
{
MindBreakerBoard *m = new MindBreakerBoard(canvas, this);
setCentralWidget(m);
setToolBarsMovable( FALSE );
- QPEToolBar *tb = new QPEToolBar(this);
+ QToolBar *tb = new QToolBar(this);
tb->setHorizontalStretchable( TRUE );
QPixmap newicon = Resource::loadPixmap("new");
new QToolButton(newicon, tr("New Game"), 0,
m, SLOT(clear()), tb, "NewGame");
score = new QToolButton(tb);
score->setText("");
score->setMaximumHeight(20);
score->setUsesTextLabel(TRUE);
tb->setStretchableWidget(score);
connect(m, SIGNAL(scoreChanged(int, int)), this, SLOT(setScore(int, int)));
connect(score, SIGNAL(clicked()), m, SLOT(resetScore()));
int a, b;
m->getScore(&a, &b);
setScore(a,b);
}
void MindBreaker::setScore(int turns, int games)
{
double average;
double total_turns = turns;
double total_games = games;
if(total_games > 0)
average = total_turns / total_games;
else
average = 0.0;
score->setText(tr("win avg: %1 turns (%2 games)").arg(average).arg(games));
}
MindBreakerBoard::MindBreakerBoard( QCanvas &canv, QWidget *parent,
const char *name, int wFlags )
: QCanvasView(&canv, parent, name, wFlags)
{
int i, x, y;
struct timeval tv;
current_go = 0;
gettimeofday(&tv, 0);
srand(tv.tv_usec);
canvas()->setAdvancePeriod(500);