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
cc7e1b99
Commit
cc7e1b99
authored
Jul 10, 2013
by
Denis Kuplyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatted source code.
GIT_SILENT
parent
f1ba7270
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
14 deletions
+12
-14
kreversiview.cpp
kreversiview.cpp
+11
-13
mainwindow.cpp
mainwindow.cpp
+1
-1
No files found.
kreversiview.cpp
View file @
cc7e1b99
...
...
@@ -46,18 +46,17 @@ void KReversiView::setGame(KReversiGame *game)
// disconnect signals from previous game if it exists,
// we are not interested in them anymore
if
(
m_game
)
{
disconnect
(
m_game
,
SIGNAL
(
boardChanged
()),
this
,
SLOT
(
updateBoard
())
);
disconnect
(
m_game
,
SIGNAL
(
moveFinished
()),
this
,
SLOT
(
slotGameMoveFinished
())
);
disconnect
(
m_game
,
SIGNAL
(
gameOver
()),
this
,
SLOT
(
slotGameOver
())
);
disconnect
(
m_game
,
SIGNAL
(
computerCantMove
()),
this
,
SLOT
(
slotComputerCantMove
())
);
disconnect
(
m_game
,
SIGNAL
(
playerCantMove
()),
this
,
SLOT
(
slotPlayerCantMove
())
);
disconnect
(
m_game
,
SIGNAL
(
boardChanged
()),
this
,
SLOT
(
updateBoard
()));
disconnect
(
m_game
,
SIGNAL
(
moveFinished
()),
this
,
SLOT
(
slotGameMoveFinished
()));
disconnect
(
m_game
,
SIGNAL
(
gameOver
()),
this
,
SLOT
(
slotGameOver
()));
disconnect
(
m_game
,
SIGNAL
(
computerCantMove
()),
this
,
SLOT
(
slotComputerCantMove
()));
disconnect
(
m_game
,
SIGNAL
(
playerCantMove
()),
this
,
SLOT
(
slotPlayerCantMove
()));
delete
m_game
;
}
m_game
=
game
;
if
(
m_game
)
{
if
(
m_game
)
{
connect
(
m_game
,
SIGNAL
(
boardChanged
()),
this
,
SLOT
(
updateBoard
()));
connect
(
m_game
,
SIGNAL
(
moveFinished
()),
this
,
SLOT
(
slotGameMoveFinished
()));
connect
(
m_game
,
SIGNAL
(
gameOver
()),
this
,
SLOT
(
slotGameOver
()));
...
...
@@ -193,8 +192,7 @@ void KReversiView::setShowLegalMoves(bool show)
void
KReversiView
::
slotHint
()
{
if
(
!
m_game
)
{
if
(
!
m_game
)
{
m_hint
=
KReversiPos
();
return
;
}
...
...
@@ -252,16 +250,16 @@ void KReversiView::slotGameOver()
void
KReversiView
::
slotComputerCantMove
()
{
QMetaObject
::
invokeMethod
(
m_qml_root
,
"showPopup"
,
Q_ARG
(
QVariant
,
i18n
(
"Computer can not move. It is your turn again."
)));
Q_ARG
(
QVariant
,
i18n
(
"Computer can not move. It is your turn again."
)));
}
void
KReversiView
::
slotPlayerCantMove
()
{
QMetaObject
::
invokeMethod
(
m_qml_root
,
"showPopup"
,
Q_ARG
(
QVariant
,
i18n
(
"You can not perform any move. Computer takes next turn now."
)));
Q_ARG
(
QVariant
,
i18n
(
"You can not perform any move. Computer takes next turn now."
)));
}
void
KReversiView
::
slotOnDelay
()
...
...
mainwindow.cpp
View file @
cc7e1b99
...
...
@@ -258,7 +258,7 @@ void KReversiMainWindow::slotNewGame()
QString
chipsPrefix
=
Preferences
::
useColoredChips
()
?
QLatin1String
(
"chip_color"
)
:
QLatin1String
(
"chip_bw"
);
m_view
=
new
KReversiView
(
m_game
,
this
);
setCentralWidget
(
m_view
);
m_view
->
setAnimationSpeed
(
Preferences
::
animationSpeed
()
);
m_view
->
setAnimationSpeed
(
Preferences
::
animationSpeed
());
connect
(
m_view
,
SIGNAL
(
moveFinished
()),
SLOT
(
slotMoveFinished
()));
}
else
{
m_view
->
setGame
(
m_game
);
...
...
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