2 Copyright 2010 Serge Ziryukin <ftrvxmtrx@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
14 #include <QPushButton>
15 #include <QVBoxLayout>
16 #include <QHBoxLayout>
19 #include "colorbuttons.hpp"
21 //#include "fullscreenexitbutton.hpp"
26 setWindowTitle("Color Flood");
27 setWindowIcon(QIcon(":/images/icon_48x48.png"));
29 #if defined(Q_WS_HILDON) || defined(Q_WS_MAEMO_5)
30 setWindowState(windowState() | Qt::WindowFullScreen);
32 setFixedSize(800, 480);
35 //new FullScreenExitButton(this);
38 field = new Field(this, &turns);
39 colorButtons = new ColorButtons(this);
41 QObject::connect(colorButtons,
46 turnsLabel = new QLabel(this);
47 turnsLabel->setAlignment(Qt::AlignRight);
49 QObject::connect(field,
50 SIGNAL(turnsChanged(int)),
52 SLOT(updateTurns(int)));
56 QVBoxLayout *vl = new QVBoxLayout;
57 vl->addWidget(colorButtons);
58 vl->setAlignment(colorButtons, Qt::AlignRight | Qt::AlignTop);
59 vl->addWidget(turnsLabel);
60 vl->setAlignment(turnsLabel, Qt::AlignRight | Qt::AlignTop);
62 QHBoxLayout *hl = new QHBoxLayout;
64 hl->setAlignment(field, Qt::AlignLeft);
70 void Window::updateTurns (int turns)
72 /*: number of turns */
73 turnsLabel->setText(tr("<font size=\"24\">Turns: %1/%2</font>")
75 .arg(field->getNumTurnsOfSize(field->getSize())));