include only used headers
[colorflood] / colorflood / src / window.cpp
1 /*
2   Copyright 2010 Serge Ziryukin <ftrvxmtrx@gmail.com>
3
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.
7
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.
12 */
13
14 #include <QPushButton>
15 #include <QHBoxLayout>
16 #include "window.hpp"
17 #include "field.hpp"
18
19 Window::Window ()
20     : QWidget()
21 {
22     setWindowTitle(tr("Color Flood"));
23
24     //setWindowState(windowState() | Qt::WindowFullScreen);
25
26     QPushButton *button = new QPushButton("randomize", this);
27     field = new Field(this);
28
29     QObject::connect(button, SIGNAL(pressed()), this, SLOT(randomize()));
30
31     QHBoxLayout *layout = new QHBoxLayout;
32     layout->addWidget(button);
33     layout->setAlignment(button, Qt::AlignLeft);
34     layout->addWidget(field);
35     layout->setAlignment(field, Qt::AlignRight);
36     setLayout(layout);
37 }
38
39 void Window::randomize ()
40 {
41     field->randomize();
42 }