0ee555493592b7e2748afe93f1ef1bb3f8223e61
[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     QVector<QBrush> brushes;
26
27 #if 1
28     // standart color scheme
29     brushes << QBrush(QColor(0x00, 0x00, 0xff)); // blue
30     brushes << QBrush(QColor(0xff, 0x00, 0x00)); // red
31     brushes << QBrush(QColor(0x00, 0xff, 0x00)); // green
32     brushes << QBrush(QColor(0xff, 0xff, 0x00)); // yellow
33     brushes << QBrush(QColor(0xff, 0x00, 0xff)); // magenta
34     brushes << QBrush(QColor(0x80, 0x00, 0x80)); // purple
35 #else
36     // color-blind color scheme
37     brushes << QBrush(QColor(0x00, 0x00, 0x00));
38     brushes << QBrush(QColor(0x31, 0x31, 0x31), Qt::Dense1Pattern);
39     brushes << QBrush(QColor(0x62, 0x62, 0x62), Qt::Dense3Pattern);
40     brushes << QBrush(QColor(0x93, 0x93, 0x93), Qt::CrossPattern);
41     brushes << QBrush(QColor(0xc4, 0xc4, 0xc4));
42     brushes << QBrush(QColor(0xff, 0xff, 0xff));
43 #endif
44
45     field = new Field(this, brushes, Field::SIZE_LARGE);
46
47     QHBoxLayout *layout = new QHBoxLayout;
48     layout->addWidget(field);
49     layout->setAlignment(field, Qt::AlignRight);
50     setLayout(layout);
51 }