1/*******************************************************************
2 *
3 * Copyright 2013 Denis Kuplyakov <dener.kup@gmail.com>
4 *
5 * This file is part of the KDE project "KReversi"
6 *
7 * KReversi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * KReversi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with KReversi; see the file COPYING. If not, write to
19 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 ********************************************************************/
23
24#ifndef STARTGAMEDIALOG_H
25#define STARTGAMEDIALOG_H
26
27#include <gamestartinformation.h>
28#include <commondefs.h>
29
30#include <KDialog>
31#include <KUser>
32#include <KgThemeProvider>
33
34namespace Ui
35{
36class StartGameDialog;
37}
38
39/**
40 * Dialog used to gather information about new game.
41 * @see GameStartInformation
42 */
43class StartGameDialog : public KDialog
44{
45 Q_OBJECT
46
47public:
48 explicit StartGameDialog(QWidget *parent, KgThemeProvider *provider);
49 ~StartGameDialog();
50
51 /**
52 * @return collected GameStartInformation
53 */
54 GameStartInformation createGameStartInformation() const;
55 /**
56 * Sets chips color according to @p prefix
57 */
58 void setChipsPrefix(ChipsPrefix prefix);
59
60signals:
61 /**
62 * Emitted when user has finished entering information
63 */
64 void startGame();
65
66private slots:
67 /**
68 * Handles "User changed player type for black player" event
69 */
70 void slotUpdateBlack(int clickedId);
71
72 /**
73 * Handles "User changed player type for white player" event
74 */
75 void slotUpdateWhite(int clickedId);
76
77 /**
78 * Handles dialog button click
79 */
80 void slotButtonClicked(int button);
81
82private:
83 /**
84 * Updates chip images
85 */
86 void loadChipImages();
87 /**
88 * Encapsulates UI
89 */
90 Ui::StartGameDialog *ui;
91 /**
92 * Main dialog widget
93 */
94 QWidget *m_contents;
95 /**
96 * Needed to get username
97 */
98 KUser m_user;
99 /**
100 * Used to draw chip
101 */
102 KgThemeProvider *m_provider;
103 /**
104 * Sets chip's color to use
105 */
106 ChipsPrefix m_chipsPrefix;
107};
108
109#endif // STARTGAMEDIALOG_H
110