Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KReversi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Games
KReversi
Commits
d2549f90
Commit
d2549f90
authored
Sep 14, 2020
by
Friedrich W. H. Kossebau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Q_SIGNALS/Q_SLOTS/Q_EMIT instead of signals/slots/emit
GIT_SILENT
parent
ede919a4
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
45 additions
and
44 deletions
+45
-44
CMakeLists.txt
CMakeLists.txt
+1
-0
colorscheme.h
colorscheme.h
+1
-1
kexthighscore_gui.h
kexthighscore_gui.h
+7
-7
kexthighscore_tab.cpp
kexthighscore_tab.cpp
+3
-3
kexthighscore_tab.h
kexthighscore_tab.h
+3
-3
kreversicomputerplayer.cpp
kreversicomputerplayer.cpp
+2
-2
kreversicomputerplayer.h
kreversicomputerplayer.h
+2
-2
kreversigame.cpp
kreversigame.cpp
+10
-10
kreversigame.h
kreversigame.h
+2
-2
kreversihumanplayer.cpp
kreversihumanplayer.cpp
+2
-2
kreversihumanplayer.h
kreversihumanplayer.h
+2
-2
kreversiplayer.h
kreversiplayer.h
+2
-2
kreversiview.cpp
kreversiview.cpp
+1
-1
kreversiview.h
kreversiview.h
+3
-3
mainwindow.h
mainwindow.h
+1
-1
startgamedialog.cpp
startgamedialog.cpp
+1
-1
startgamedialog.h
startgamedialog.h
+2
-2
No files found.
CMakeLists.txt
View file @
d2549f90
...
...
@@ -41,6 +41,7 @@ add_definitions(
# -DQT_NO_CAST_FROM_BYTEARRAY
-DQT_NO_URL_CAST_FROM_STRING
-DQT_USE_QSTRINGBUILDER
-DQT_NO_KEYWORDS
)
if
(
${
KF5Config_VERSION
}
STRGREATER
"5.56.0"
)
add_definitions
(
-DQT_NO_FOREACH
)
...
...
colorscheme.h
View file @
d2549f90
...
...
@@ -41,7 +41,7 @@ public:
QColor
foreground
()
const
;
QColor
border
()
const
;
signals
:
Q_SIGNALS
:
void
placeHolder
();
};
...
...
kexthighscore_gui.h
View file @
d2549f90
...
...
@@ -90,15 +90,15 @@ class HighscoresWidget : public QWidget
void
load
(
int
rank
);
signals
:
Q_SIGNALS
:
void
tabChanged
(
int
i
);
public
slots
:
public
Q_SLOTS
:
void
changeTab
(
int
i
);
private
slots
:
private
Q_SLOTS
:
void
showURL
(
const
QString
&
);
void
tabChanged
()
{
emit
tabChanged
(
_tw
->
currentIndex
());
}
void
tabChanged
()
{
Q_EMIT
tabChanged
(
_tw
->
currentIndex
());
}
private:
QTabWidget
*
_tw
=
nullptr
;
...
...
@@ -116,7 +116,7 @@ class HighscoresDialog : public KPageDialog
public:
HighscoresDialog
(
int
rank
,
QWidget
*
parent
);
private
slots
:
private
Q_SLOTS
:
void
slotUser1
();
void
slotUser2
();
void
tabChanged
(
int
i
)
{
_tab
=
i
;
}
...
...
@@ -166,7 +166,7 @@ class ConfigDialog : public QDialog
bool
hasBeenSaved
()
const
{
return
_saved
;
}
private
slots
:
private
Q_SLOTS
:
void
modifiedSlot
();
void
removeSlot
();
void
accept
()
override
;
...
...
@@ -197,7 +197,7 @@ class AskNameDialog : public QDialog
QString
name
()
const
{
return
_edit
->
text
();
}
bool
dontAskAgain
()
const
{
return
_checkbox
->
isChecked
();
}
private
slots
:
private
Q_SLOTS
:
void
nameChanged
(
QDialogButtonBox
*
box
);
private:
...
...
kexthighscore_tab.cpp
View file @
d2549f90
...
...
@@ -51,9 +51,9 @@ PlayersCombo::PlayersCombo(QWidget *parent)
void
PlayersCombo
::
activatedSlot
(
int
i
)
{
const
PlayerInfos
&
p
=
internal
->
playerInfos
();
if
(
i
==
(
int
)
p
.
nbEntries
()
)
emit
allSelected
();
else
if
(
i
==
(
int
)
p
.
nbEntries
()
+
1
)
emit
noneSelected
();
else
emit
playerSelected
(
i
);
if
(
i
==
(
int
)
p
.
nbEntries
()
)
Q_EMIT
allSelected
();
else
if
(
i
==
(
int
)
p
.
nbEntries
()
+
1
)
Q_EMIT
noneSelected
();
else
Q_EMIT
playerSelected
(
i
);
}
void
PlayersCombo
::
load
()
...
...
kexthighscore_tab.h
View file @
d2549f90
...
...
@@ -39,12 +39,12 @@ class PlayersCombo : public QComboBox
void
load
();
signals
:
Q_SIGNALS
:
void
playerSelected
(
uint
i
);
void
allSelected
();
void
noneSelected
();
private
slots
:
private
Q_SLOTS
:
void
activatedSlot
(
int
i
);
};
...
...
@@ -57,7 +57,7 @@ class AdditionalTab : public QWidget
virtual
void
load
();
private
slots
:
private
Q_SLOTS
:
void
playerSelected
(
uint
i
)
{
display
(
i
)
;
}
void
allSelected
();
...
...
kreversicomputerplayer.cpp
View file @
d2549f90
...
...
@@ -39,7 +39,7 @@ void KReversiComputerPlayer::prepare(KReversiGame *game)
m_game
=
game
;
m_state
=
WAITING
;
emit
ready
();
Q_EMIT
ready
();
}
void
KReversiComputerPlayer
::
takeTurn
()
...
...
@@ -48,7 +48,7 @@ void KReversiComputerPlayer::takeTurn()
KReversiMove
move
=
m_engine
->
computeMove
(
*
m_game
,
true
);
move
.
color
=
m_color
;
m_state
=
WAITING
;
emit
makeMove
(
move
);
Q_EMIT
makeMove
(
move
);
}
void
KReversiComputerPlayer
::
skipTurn
()
...
...
kreversicomputerplayer.h
View file @
d2549f90
...
...
@@ -60,9 +60,9 @@ public:
*/
int
lowestSkill
();
signals
:
Q_SIGNALS
:
public
slots
:
public
Q_SLOTS
:
private:
int
m_lowestSkill
;
...
...
kreversigame.cpp
View file @
d2549f90
...
...
@@ -96,32 +96,32 @@ void KReversiGame::makeMove(KReversiMove move)
turnChips
(
move
);
m_delayTimer
.
singleShot
(
m_delay
*
(
qMax
(
1
,
m_changedChips
.
count
()
-
1
)),
this
,
&
KReversiGame
::
onDelayTimer
);
emit
boardChanged
();
Q_EMIT
boardChanged
();
}
void
KReversiGame
::
startNextTurn
()
{
m_curPlayer
=
Utils
::
opponentColorFor
(
m_lastPlayer
);
emit
moveFinished
();
// previous move has just finished
Q_EMIT
moveFinished
();
// previous move has just finished
if
(
!
isGameOver
())
{
if
(
isAnyPlayerMovePossible
(
m_curPlayer
))
{
if
(
m_curPlayer
==
White
)
emit
whitePlayerTurn
();
Q_EMIT
whitePlayerTurn
();
else
emit
blackPlayerTurn
();
Q_EMIT
blackPlayerTurn
();
}
else
{
if
(
m_curPlayer
==
White
)
emit
whitePlayerCantMove
();
Q_EMIT
whitePlayerCantMove
();
else
emit
blackPlayerCantMove
();
Q_EMIT
blackPlayerCantMove
();
m_lastPlayer
=
m_curPlayer
;
startNextTurn
();
}
}
else
{
//Game is over
emit
gameOver
();
Q_EMIT
gameOver
();
}
}
...
...
@@ -168,7 +168,7 @@ int KReversiGame::undo()
else
m_changedChips
.
clear
();
emit
boardChanged
();
Q_EMIT
boardChanged
();
kickCurrentPlayer
();
return
movesUndone
;
...
...
@@ -389,8 +389,8 @@ ChipColor KReversiGame::chipColorAt(KReversiPos pos) const
void
KReversiGame
::
kickCurrentPlayer
()
{
if
(
m_curPlayer
==
White
)
emit
whitePlayerTurn
();
Q_EMIT
whitePlayerTurn
();
else
emit
blackPlayerTurn
();
Q_EMIT
blackPlayerTurn
();
}
kreversigame.h
View file @
d2549f90
...
...
@@ -128,7 +128,7 @@ public:
* @return Is hint allowed for current player
*/
bool
isHintAllowed
()
const
;
private
slots
:
private
Q_SLOTS
:
/**
* Starts next player's turn.
*/
...
...
@@ -156,7 +156,7 @@ private slots:
*/
void
whiteReady
();
signals
:
Q_SIGNALS
:
void
gameOver
();
void
boardChanged
();
void
moveFinished
();
...
...
kreversihumanplayer.cpp
View file @
d2549f90
...
...
@@ -34,7 +34,7 @@ void KReversiHumanPlayer::prepare(KReversiGame* game)
m_game
=
game
;
m_state
=
WAITING
;
emit
ready
();
Q_EMIT
ready
();
}
void
KReversiHumanPlayer
::
takeTurn
()
...
...
@@ -60,5 +60,5 @@ void KReversiHumanPlayer::onUICellClick(KReversiPos pos)
}
m_state
=
WAITING
;
emit
makeMove
(
KReversiMove
(
m_color
,
pos
));
Q_EMIT
makeMove
(
KReversiMove
(
m_color
,
pos
));
}
kreversihumanplayer.h
View file @
d2549f90
...
...
@@ -48,9 +48,9 @@ public:
void
skipTurn
()
override
;
void
gameOver
()
override
;
signals
:
Q_SIGNALS
:
public
slots
:
public
Q_SLOTS
:
/**
* Using it to get information from UI.
* @param move Move that player has made.
...
...
kreversiplayer.h
View file @
d2549f90
...
...
@@ -97,7 +97,7 @@ public:
*/
int
getUndoCount
();
public
slots
:
public
Q_SLOTS
:
/**
* Triggered by KReversiGame before game starts
* Implementation should assign @p game to m_game
...
...
@@ -121,7 +121,7 @@ public slots:
*/
virtual
void
gameOver
()
=
0
;
signals
:
Q_SIGNALS
:
/**
* Player emit it when want to notify about his move
*/
...
...
kreversiview.cpp
View file @
d2549f90
...
...
@@ -229,7 +229,7 @@ void KReversiView::onPlayerMove(int row, int col)
if
(
!
m_game
)
return
;
emit
userMove
(
KReversiPos
(
row
,
col
));
Q_EMIT
userMove
(
KReversiPos
(
row
,
col
));
}
...
...
kreversiview.h
View file @
d2549f90
...
...
@@ -73,7 +73,7 @@ public:
*/
void
setAnimationSpeed
(
int
speed
);
public
slots
:
public
Q_SLOTS
:
/**
* This will make view visually mark the last made move
*
...
...
@@ -95,7 +95,7 @@ public slots:
*/
void
slotHint
();
private
slots
:
private
Q_SLOTS
:
/**
* Triggered on user click on board, connected to QML signal
*
...
...
@@ -111,7 +111,7 @@ private slots:
void
gameOver
();
void
whitePlayerCantMove
();
void
blackPlayerCantMove
();
signals
:
Q_SIGNALS
:
void
userMove
(
KReversiPos
);
private:
...
...
mainwindow.h
View file @
d2549f90
...
...
@@ -50,7 +50,7 @@ class KReversiMainWindow : public KXmlGuiWindow
public:
explicit
KReversiMainWindow
(
QWidget
*
parent
=
nullptr
,
bool
startDemo
=
false
);
~
KReversiMainWindow
();
public
slots
:
public
Q_SLOTS
:
void
slotNewGame
();
void
levelChanged
();
void
slotAnimSpeedChanged
(
int
);
...
...
startgamedialog.cpp
View file @
d2549f90
...
...
@@ -136,7 +136,7 @@ void StartGameDialog::loadChipImages()
void
StartGameDialog
::
slotAccepted
()
{
emit
startGame
();
Q_EMIT
startGame
();
accept
();
}
...
...
startgamedialog.h
View file @
d2549f90
...
...
@@ -57,13 +57,13 @@ public:
*/
void
setChipsPrefix
(
ChipsPrefix
prefix
);
signals
:
Q_SIGNALS
:
/**
* Emitted when user has finished entering information
*/
void
startGame
();
private
slots
:
private
Q_SLOTS
:
/**
* Handles "User changed player type for black player" event
*/
...
...
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