startgamedialog.h 2.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*******************************************************************
 *
 * Copyright 2013 Denis Kuplyakov <dener.kup@gmail.com>
 *
 * This file is part of the KDE project "KReversi"
 *
 * KReversi is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * KReversi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with KReversi; see the file COPYING.  If not, write to
 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 ********************************************************************/
23

Denis Kuplyakov's avatar
Denis Kuplyakov committed
24 25 26
#ifndef STARTGAMEDIALOG_H
#define STARTGAMEDIALOG_H

27 28
#include "gamestartinformation.h"
#include "commondefs.h"
Denis Kuplyakov's avatar
Denis Kuplyakov committed
29

Laurent Montel's avatar
Laurent Montel committed
30
#include <QDialog>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
31 32
#include <KUser>
#include <KgThemeProvider>
Laurent Montel's avatar
Laurent Montel committed
33
class QAbstractButton;
Denis Kuplyakov's avatar
Denis Kuplyakov committed
34 35 36
namespace Ui
{
class StartGameDialog;
37 38
}

39 40 41 42
/**
 * Dialog used to gather information about new game.
 * @see GameStartInformation
 */
Laurent Montel's avatar
Laurent Montel committed
43
class StartGameDialog : public QDialog
44 45 46 47
{
    Q_OBJECT

public:
48
    explicit StartGameDialog(QWidget *parent, KgThemeProvider *provider);
49 50
    ~StartGameDialog();

51 52 53
    /**
     * @return collected GameStartInformation
     */
54
    GameStartInformation createGameStartInformation() const;
55 56 57
    /**
     * Sets chips color according to @p prefix
     */
58
    void setChipsPrefix(ChipsPrefix prefix);
59

60
Q_SIGNALS:
61 62 63
    /**
     * Emitted when user has finished entering information
     */
64 65
    void startGame();

66
private Q_SLOTS:
67 68 69
    /**
     * Handles "User changed player type for black player" event
     */
Laurent Montel's avatar
Laurent Montel committed
70
    void slotUpdateBlack(QAbstractButton *button);
71 72 73 74

    /**
     * Handles "User changed player type for white player" event
     */
Laurent Montel's avatar
Laurent Montel committed
75
    void slotUpdateWhite(QAbstractButton *button);
76

Laurent Montel's avatar
Laurent Montel committed
77
    void slotAccepted();
Denis Kuplyakov's avatar
Denis Kuplyakov committed
78 79

private:
80 81 82 83 84 85 86
    /**
     * Updates chip images
     */
    void loadChipImages();
    /**
     * Encapsulates UI
     */
87
    Ui::StartGameDialog *ui;
88 89 90
    /**
     * Main dialog widget
     */
91
    QWidget *m_contents;
92 93 94
    /**
     * Needed to get username
     */
95
    KUser m_user;
96 97 98
    /**
     * Used to draw chip
     */
99
    KgThemeProvider *m_provider;
100 101 102
    /**
     * Sets chip's color to use
     */
103
    ChipsPrefix m_chipsPrefix;
104 105 106
};

#endif // STARTGAMEDIALOG_H