a189dcff00c3d9f3aed24442c09d84cd30dea533
[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 <QtGui>
15 #include "window.hpp"
16 #include "field.hpp"
17
18 Window::Window ()
19     : QWidget()
20 {
21     setWindowTitle(tr("Color Flood"));
22
23     //setWindowState(windowState() | Qt::WindowFullScreen);
24
25     QPushButton *button = new QPushButton("randomize", this);
26     field = new Field(this);
27
28     QObject::connect(button, SIGNAL(pressed()), this, SLOT(randomize()));
29
30     QHBoxLayout *layout = new QHBoxLayout;
31     layout->addWidget(button);
32     layout->setAlignment(button, Qt::AlignLeft);
33     layout->addWidget(field);
34     layout->setAlignment(field, Qt::AlignRight);
35     setLayout(layout);
36 }
37
38 void Window::randomize ()
39 {
40     field->randomize();
41 }