Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
KReversi
Commits
95b658f6
Commit
95b658f6
authored
Jan 09, 2015
by
Laurent Montel
Browse files
Port to QDialog
parent
0e95246b
Changes
2
Hide whitespace changes
Inline
Side-by-side
startgamedialog.cpp
View file @
95b658f6
...
...
@@ -33,25 +33,37 @@
#include
<QPainter>
#include
<QGraphicsDropShadowEffect>
#include
<KConfigGroup>
#include
<QDialogButtonBox>
#include
<QPushButton>
#include
<QVBoxLayout>
StartGameDialog
::
StartGameDialog
(
QWidget
*
parent
,
KgThemeProvider
*
provider
)
:
K
Dialog
(
parent
),
Q
Dialog
(
parent
),
ui
(
new
Ui
::
StartGameDialog
),
m_provider
(
provider
),
m_chipsPrefix
(
BlackWhite
)
{
setModal
(
true
);
setFixedSize
(
width
(),
height
());
setCaption
(
i18n
(
"New game"
));
setButtons
(
Ok
|
Close
);
setButtonText
(
Ok
,
i18n
(
"Start game"
));
setButtonToolTip
(
Ok
,
i18n
(
"Let's start playing!"
));
setButtonText
(
Close
,
i18n
(
"Quit"
));
setButtonToolTip
(
Close
,
i18n
(
"Quit KReversi"
));
setWindowTitle
(
i18n
(
"New game"
));
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Close
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
setLayout
(
mainLayout
);
QPushButton
*
okButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
okButton
->
setDefault
(
true
);
okButton
->
setShortcut
(
Qt
::
CTRL
|
Qt
::
Key_Return
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
slotAccepted
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
reject
()));
okButton
->
setText
(
i18n
(
"Start game"
));
okButton
->
setToolTip
(
i18n
(
"Let's start playing!"
));
buttonBox
->
button
(
QDialogButtonBox
::
Close
)
->
setText
(
i18n
(
"Quit"
));
buttonBox
->
button
(
QDialogButtonBox
::
Close
)
->
setToolTip
(
i18n
(
"Quit KReversi"
));
m_contents
=
new
QWidget
(
this
);
setMainWidget
(
m_contents
);
mainLayout
->
addWidget
(
m_contents
);
mainLayout
->
addWidget
(
buttonBox
);
ui
->
setupUi
(
m_contents
);
loadChipImages
();
...
...
@@ -128,11 +140,10 @@ void StartGameDialog::loadChipImages()
ui
->
whiteLabel
->
setGraphicsEffect
(
whiteShadow
);
}
void
StartGameDialog
::
slot
ButtonClicked
(
int
button
)
void
StartGameDialog
::
slot
Accepted
(
)
{
if
(
button
==
KDialog
::
Ok
)
emit
startGame
();
KDialog
::
slotButtonClicked
(
button
);
emit
startGame
();
accept
();
}
GameStartInformation
StartGameDialog
::
createGameStartInformation
()
const
...
...
startgamedialog.h
View file @
95b658f6
...
...
@@ -27,7 +27,7 @@
#include
<gamestartinformation.h>
#include
<commondefs.h>
#include
<
K
Dialog>
#include
<
Q
Dialog>
#include
<KUser>
#include
<KgThemeProvider>
...
...
@@ -40,7 +40,7 @@ class StartGameDialog;
* Dialog used to gather information about new game.
* @see GameStartInformation
*/
class
StartGameDialog
:
public
K
Dialog
class
StartGameDialog
:
public
Q
Dialog
{
Q_OBJECT
...
...
@@ -74,10 +74,7 @@ private slots:
*/
void
slotUpdateWhite
(
int
clickedId
);
/**
* Handles dialog button click
*/
void
slotButtonClicked
(
int
button
);
void
slotAccepted
();
private:
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment