<context>
<name>Field</name>
<message>
- <location filename="field.cpp" line="268"/>
+ <location filename="field.cpp" line="262"/>
<source>You won!</source>
<extracomment>win message</extracomment>
<translation type="unfinished">Вы победили!</translation>
</message>
<message>
- <location filename="field.cpp" line="274"/>
+ <location filename="field.cpp" line="268"/>
<source>You lost!</source>
<extracomment>fail message</extracomment>
<translation type="unfinished">Вы проиграли!</translation>
<context>
<name>Window</name>
<message>
- <location filename="window.cpp" line="73"/>
+ <location filename="window.cpp" line="52"/>
+ <source>Toggle fullscreen</source>
+ <translation type="unfinished">Полноэкранный режим</translation>
+ </message>
+ <message>
+ <location filename="window.cpp" line="54"/>
+ <source>New game</source>
+ <oldsource>New Game</oldsource>
+ <translation type="unfinished">Новая игра</translation>
+ </message>
+ <message>
+ <location filename="window.cpp" line="84"/>
<source><font size="24">Turns: %1/%2</font></source>
<extracomment>number of turns</extracomment>
<translation type="unfinished"><font size="24">Шагов: %1/%2</font></translation>
tryFloodRecurse(brush, x, y + 1);
}
-void Field::mousePressEvent (QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- randomize();
-}
-
void Field::paintEvent (QPaintEvent *event)
{
QPainter painter;
static const int numRects[NUM_SIZES];
static const int numTurns[NUM_SIZES];
- void randomize ();
static int getRectSize (FieldSize size);
void tryFloodRecurse (quint8 brush, int x, int y);
void floodNeighbours (quint8 brush, int x, int y);
bool finished;
protected:
- void mousePressEvent (QMouseEvent *event);
void paintEvent (QPaintEvent *event);
signals:
void turnsChanged (int turns);
public slots:
+ void randomize ();
void flood (int colorIndex);
};
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
+#include <QSettings>
#include "window.hpp"
#include "colorbuttons.hpp"
#include "field.hpp"
setWindowTitle("Color Flood");
setWindowIcon(QIcon(":/images/icon_48x48.png"));
-#if defined(Q_WS_HILDON) || defined(Q_WS_MAEMO_5)
- setWindowState(windowState() | Qt::WindowFullScreen);
-#else
- setFixedSize(800, 480);
-#endif
-
//new FullScreenExitButton(this);
int turns;
updateTurns(turns);
+ QHBoxLayout *secondary = new QHBoxLayout;
+ QPushButton *toggleFS = new QPushButton(QIcon("/usr/share/icons/hicolor/64x64/hildon/general_fullsize.png"), tr("Toggle fullscreen"), this);
+ QObject::connect(toggleFS, SIGNAL(pressed()), this, SLOT(toggleFullscreen()));
+ QPushButton *newGame = new QPushButton(tr("New game"), this);
+ QObject::connect(newGame, SIGNAL(pressed()), field, SLOT(randomize()));
+
+ secondary->addWidget(newGame);
+ secondary->addWidget(toggleFS);
+
QVBoxLayout *vl = new QVBoxLayout;
vl->addWidget(colorButtons);
vl->setAlignment(colorButtons, Qt::AlignRight | Qt::AlignTop);
vl->addWidget(turnsLabel);
vl->setAlignment(turnsLabel, Qt::AlignRight | Qt::AlignTop);
+ vl->addLayout(secondary);
+ vl->setAlignment(secondary, Qt::AlignRight | Qt::AlignBottom);
QHBoxLayout *hl = new QHBoxLayout;
hl->addWidget(field);
hl->addLayout(vl);
setLayout(hl);
+
+ QSettings settings;
+
+ if (settings.value("fullscreen", true).toBool())
+ showFullScreen();
}
void Window::updateTurns (int turns)
.arg(turns)
.arg(field->getNumTurnsOfSize(field->getSize())));
}
+
+void Window::toggleFullscreen ()
+{
+ bool isFullscreen = windowState() & Qt::WindowFullScreen;
+
+ QSettings settings;
+ settings.setValue("fullscreen", !isFullscreen);
+
+ if (isFullscreen)
+ showNormal();
+ else
+ showFullScreen();
+}
private slots:
void updateTurns (int turns);
+ void toggleFullscreen ();
private:
ColorButtons *colorButtons;