From: Serge Ziryukin Date: Wed, 14 Apr 2010 18:54:36 +0000 (+0300) Subject: help button with message box X-Git-Url: http://git.maemo.org/git/?p=colorflood;a=commitdiff_plain;h=2d27bd2bcce5e9fa03349f7096d3aa4055628f9a help button with message box --- diff --git a/colorflood/src/colorflood.qm b/colorflood/src/colorflood.qm index 5cecb2b..20a340c 100644 Binary files a/colorflood/src/colorflood.qm and b/colorflood/src/colorflood.qm differ diff --git a/colorflood/src/colorflood.ts b/colorflood/src/colorflood.ts index 2209401..86926d3 100644 --- a/colorflood/src/colorflood.ts +++ b/colorflood/src/colorflood.ts @@ -36,30 +36,42 @@ Window - + New game Новая игра - + + Help + Помощь + + + Fullscreen mode Полноэкранный режим - + Less cells Меньше клеток - + More cells Больше клеток - + Turns: %1/%2 number of turns Ходов: %1/%2 + + + The object of the game is to turn a board into one single color. Number of moves is limited. You start from top-left corner with one cell already flooded. +Good luck! + Цель игры - залить поле одним цветом. Количество ходов ограничено. Вы начинаете с верхнего левого угла с одной клеткой, которая уже залита. +Удачи! + diff --git a/colorflood/src/window.cpp b/colorflood/src/window.cpp index 4908440..2825369 100644 --- a/colorflood/src/window.cpp +++ b/colorflood/src/window.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "window.hpp" #include "colorbuttons.hpp" #include "field.hpp" @@ -51,13 +52,20 @@ Window::Window () QPushButton *newGame = new QPushButton(tr("New game"), this); QObject::connect(newGame, SIGNAL(pressed()), field, SLOT(randomize())); + QPushButton *help = new QPushButton(tr("Help"), this); + QObject::connect(help, SIGNAL(pressed()), this, SLOT(help())); + + QHBoxLayout *lowerLayout = new QHBoxLayout; + lowerLayout->addWidget(help); + lowerLayout->addWidget(newGame); + QVBoxLayout *vl = new QVBoxLayout; vl->addWidget(colorButtons); vl->setAlignment(colorButtons, Qt::AlignRight | Qt::AlignTop); vl->addWidget(turnsLabel); vl->setAlignment(turnsLabel, Qt::AlignRight | Qt::AlignBottom); - vl->addWidget(newGame); - vl->setAlignment(newGame, Qt::AlignRight | Qt::AlignTop); + vl->addLayout(lowerLayout); + vl->setAlignment(lowerLayout, Qt::AlignRight | Qt::AlignTop); QHBoxLayout *hl = new QHBoxLayout; hl->addWidget(field); @@ -151,3 +159,11 @@ void Window::colorScheme () action->setText(ColorScheme::getSchemeName( ColorScheme::getNextColorScheme())); } + +void Window::help () +{ + QMessageBox box; + box.setWindowTitle("Color Flood"); + box.setText(tr("The object of the game is to turn a board into one single color. Number of moves is limited. You start from top-left corner with one cell already flooded.\nGood luck!")); + box.exec(); +} diff --git a/colorflood/src/window.hpp b/colorflood/src/window.hpp index 9942a28..e52046b 100644 --- a/colorflood/src/window.hpp +++ b/colorflood/src/window.hpp @@ -34,6 +34,7 @@ private slots: void colorScheme (); void lessCells (); void moreCells (); + void help (); private: ColorButtons *colorButtons;