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);
48 QObject::connect(field,
49 SIGNAL(turnsChanged(int)),
51 SLOT(updateTurns(int)));
55 QVBoxLayout *vl = new QVBoxLayout;
56 vl->addWidget(colorButtons);
57 vl->setAlignment(colorButtons, Qt::AlignRight | Qt::AlignTop);
58 vl->addWidget(turnsLabel);
59 vl->setAlignment(turnsLabel, Qt::AlignRight | Qt::AlignTop);
61 QHBoxLayout *hl = new QHBoxLayout;
63 hl->setAlignment(field, Qt::AlignLeft);
69 void Window::updateTurns (int turns)
71 /*: number of turns */
72 turnsLabel->setText(tr("Turns: %1/%2")
74 .arg(field->getNumTurnsOfSize(field->getSize())));