Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Games
KReversi
Commits
5a1c9286
Commit
5a1c9286
authored
Feb 04, 2020
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port deprecated signals
parent
bc8b149c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
startgamedialog.cpp
startgamedialog.cpp
+25
-18
startgamedialog.h
startgamedialog.h
+3
-3
No files found.
startgamedialog.cpp
View file @
5a1c9286
...
...
@@ -84,11 +84,11 @@ StartGameDialog::StartGameDialog(QWidget *parent, KgThemeProvider *provider) :
}
}
connect
(
ui
->
blackTypeGroup
,
static_cast
<
void
(
QButtonGroup
::*
)(
int
)
>
(
&
QButtonGroup
::
buttonClicked
),
this
,
&
StartGameDialog
::
slotUpdateBlack
);
connect
(
ui
->
whiteTypeGroup
,
static_cast
<
void
(
QButtonGroup
::*
)(
int
)
>
(
&
QButtonGroup
::
buttonClicked
),
this
,
&
StartGameDialog
::
slotUpdateWhite
);
connect
(
ui
->
blackTypeGroup
,
static_cast
<
void
(
QButtonGroup
::*
)(
QAbstractButton
*
)
>
(
&
QButtonGroup
::
buttonClicked
),
this
,
&
StartGameDialog
::
slotUpdateBlack
);
connect
(
ui
->
whiteTypeGroup
,
static_cast
<
void
(
QButtonGroup
::*
)(
QAbstractButton
*
)
>
(
&
QButtonGroup
::
buttonClicked
),
this
,
&
StartGameDialog
::
slotUpdateWhite
);
slotUpdateBlack
(
GameStartInformation
::
Human
);
slotUpdateWhite
(
GameStartInformation
::
AI
);
slotUpdateBlack
(
ui
->
blackTypeGroup
->
button
(
GameStartInformation
::
Human
)
)
;
slotUpdateWhite
(
ui
->
whiteTypeGroup
->
button
(
GameStartInformation
::
AI
)
)
;
}
StartGameDialog
::~
StartGameDialog
()
...
...
@@ -160,22 +160,29 @@ void StartGameDialog::setChipsPrefix(ChipsPrefix prefix)
}
void
StartGameDialog
::
slotUpdateBlack
(
int
clickedId
)
void
StartGameDialog
::
slotUpdateBlack
(
QAbstractButton
*
button
)
{
ui
->
blackSkill
->
setEnabled
(
clickedId
==
GameStartInformation
::
AI
);
ui
->
blackName
->
setEnabled
(
clickedId
==
GameStartInformation
::
Human
);
if
(
clickedId
==
GameStartInformation
::
Human
)
ui
->
blackName
->
setText
(
m_user
.
loginName
());
else
ui
->
blackName
->
setText
(
i18n
(
"Computer"
));
if
(
button
)
{
const
int
clickedId
=
ui
->
blackTypeGroup
->
id
(
button
);
ui
->
blackSkill
->
setEnabled
(
clickedId
==
GameStartInformation
::
AI
);
ui
->
blackName
->
setEnabled
(
clickedId
==
GameStartInformation
::
Human
);
if
(
clickedId
==
GameStartInformation
::
Human
)
ui
->
blackName
->
setText
(
m_user
.
loginName
());
else
ui
->
blackName
->
setText
(
i18n
(
"Computer"
));
}
}
void
StartGameDialog
::
slotUpdateWhite
(
int
clickedId
)
void
StartGameDialog
::
slotUpdateWhite
(
QAbstractButton
*
button
)
{
ui
->
whiteSkill
->
setEnabled
(
clickedId
==
GameStartInformation
::
AI
);
ui
->
whiteName
->
setEnabled
(
clickedId
==
GameStartInformation
::
Human
);
if
(
clickedId
==
GameStartInformation
::
Human
)
ui
->
whiteName
->
setText
(
m_user
.
loginName
());
else
ui
->
whiteName
->
setText
(
i18n
(
"Computer"
));
if
(
button
)
{
const
int
clickedId
=
ui
->
whiteTypeGroup
->
id
(
button
);
ui
->
whiteSkill
->
setEnabled
(
clickedId
==
GameStartInformation
::
AI
);
ui
->
whiteName
->
setEnabled
(
clickedId
==
GameStartInformation
::
Human
);
if
(
clickedId
==
GameStartInformation
::
Human
)
ui
->
whiteName
->
setText
(
m_user
.
loginName
());
else
ui
->
whiteName
->
setText
(
i18n
(
"Computer"
));
}
}
startgamedialog.h
View file @
5a1c9286
...
...
@@ -30,7 +30,7 @@
#include <QDialog>
#include <KUser>
#include <KgThemeProvider>
class
QAbstractButton
;
namespace
Ui
{
class
StartGameDialog
;
...
...
@@ -67,12 +67,12 @@ private slots:
/**
* Handles "User changed player type for black player" event
*/
void
slotUpdateBlack
(
int
clickedId
);
void
slotUpdateBlack
(
QAbstractButton
*
button
);
/**
* Handles "User changed player type for white player" event
*/
void
slotUpdateWhite
(
int
clickedId
);
void
slotUpdateWhite
(
QAbstractButton
*
button
);
void
slotAccepted
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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