Use shared SVG renderers.
[sloppygui.git] / src / promotiondlg.h
blobe5c3dacc0543b584866a648121dd300b5e51b89c
1 /*
2 This file is part of SloppyGUI.
4 SloppyGUI 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, either version 3 of the License, or
7 (at your option) any later version.
9 SloppyGUI is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with SloppyGUI. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef PROMOTIONDLG_H
19 #define PROMOTIONDLG_H
21 #include <QDialog>
23 #include "chessboard/chessboard.h"
25 class QRadioButton;
26 class QSignalMapper;
28 /**
29 * PromotionDialog provides an UI for chess piece promotion.
31 class PromotionDialog : public QDialog
33 Q_OBJECT
35 public:
36 /**
37 * Creates a new promotion dialog.
38 * @param parent Dialog's parent widget.
39 * @param f Dialog's window flags.
41 PromotionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
42 /**
43 * Returns the user selected promotion type.
44 * The promotion type this method returns is always valid even if
45 * the user cancelled the dialog. By default the promotion type
46 * is queen.
47 * @return User selected promotion type. Always valid even if dialog
48 * was cancelled.
50 Chessboard::ChessPiece promotionType() const;
52 private slots:
53 void selectPromotionType(int type);
55 private:
56 Chessboard::ChessPiece m_promotionType;
57 QRadioButton* m_queenRadio;
58 QRadioButton* m_knightRadio;
59 QRadioButton* m_rookRadio;
60 QRadioButton* m_bishopRadio;
61 QSignalMapper* m_signalMapper;
65 #endif // PROMOTIONDLG_H