X-Git-Url: http://git.maemo.org/git/?p=colorflood;a=blobdiff_plain;f=colorflood%2Fsrc%2Ffield.cpp;h=44e32591b14251e38313624bf5010d95a65dbbfc;hp=6348d8f4dbf532e79c2872503343712b5e8fa948;hb=9b18c910c4298b3f2a3667bd6fa16ca7231dfc04;hpb=4cacdbdfa626074f692dc67a49b960fbd4244150 diff --git a/colorflood/src/field.cpp b/colorflood/src/field.cpp index 6348d8f..44e3259 100644 --- a/colorflood/src/field.cpp +++ b/colorflood/src/field.cpp @@ -189,12 +189,6 @@ void Field::floodNeighbours (quint8 brush, int x, int y) tryFloodRecurse(brush, x, y + 1); } -void Field::mousePressEvent (QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - randomize(); -} - void Field::paintEvent (QPaintEvent *event) { QPainter painter; @@ -243,7 +237,7 @@ void Field::flood (int colorIndex) } } - update(); + repaint(); bool allFlooded = true; @@ -259,20 +253,26 @@ void Field::flood (int colorIndex) } } + QString msg; + if (allFlooded) { finished = true; - - QMessageBox box; - box.setText(tr("You won!")); - box.exec(); + /*: win message */ + msg = tr("You won!"); } else if (getNumTurnsOfSize(size) == turns) { finished = true; + /*: fail message */ + msg = tr("You lost!"); + } + if (finished) + { QMessageBox box; - box.setText(tr("You lost!")); + box.setText(msg); box.exec(); + randomize(); } }