/
qttictactoemenudialog.cpp
80 lines (64 loc) · 1.9 KB
/
qttictactoemenudialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "qttictactoemenudialog.h"
#include <cassert>
#include <boost/make_shared.hpp>
#include <QApplication>
#include <QDesktopWidget>
#include "qtaboutdialog.h"
//#include "qtcanvas.h"
//#include "qtcanvasdialog.h"
#include "qttictactoecanvas.h"
#include "qttictactoegamedialog.h"
#include "qttictactoewidget.h"
#include "tictactoemenudialog.h"
#include "tictactoeai.h"
#include "ui_qttictactoemenudialog.h"
ribi::tictactoe::QtTicTacToeMenuDialog::QtTicTacToeMenuDialog(QWidget *parent) :
QtHideAndShowDialog(parent),
ui(new Ui::QtTicTacToeMenuDialog)
{
ui->setupUi(this);
}
ribi::tictactoe::QtTicTacToeMenuDialog::~QtTicTacToeMenuDialog() noexcept
{
delete ui;
}
void ribi::tictactoe::QtTicTacToeMenuDialog::on_button_start_clicked()
{
const boost::shared_ptr<Ai> player1;
const boost::shared_ptr<Ai> player2;
QtTicTacToeGameDialog d(player1,player2);
this->ShowChild(&d);
}
void ribi::tictactoe::QtTicTacToeMenuDialog::on_button_about_clicked()
{
About a = TicTacToeMenuDialog().GetAbout();
a.AddLibrary("QtTicTacToeWidget version: " + tictactoe::QtTicTacToeWidget::GetVersion());
QtAboutDialog d(a);
//d.setStyleSheet(styleSheet());
this->ShowChild(&d);
}
void ribi::tictactoe::QtTicTacToeMenuDialog::on_button_quit_clicked()
{
close();
}
#ifdef SUPPORT_RETRO_VERSION_OF_TICTACTOE_AGAIN_20150918
void ribi::tictactoe::QtTicTacToeMenuDialog::on_button_start_old_school_clicked()
{
QtCanvas * const qtcanvas {
new QtTicTacToeCanvas
};
boost::scoped_ptr<QtCanvasDialog> d {
new QtCanvasDialog(qtcanvas)
};
{
//Put the dialog in the screen center
const QRect screen = QApplication::desktop()->screenGeometry();
d->setGeometry(
0,0,102,102);
d->move( screen.center() - this->rect().center() );
}
d->setWindowTitle("TicTacToe");
ShowChild(d.get());
//canvas will be deleted by QtCanvasDialog
}
#endif // SUPPORT_RETRO_VERSION_OF_TICTACTOE_AGAIN_20150918