Use Q_SIGNALS/Q_SLOTS/Q_EMIT instead of signals/slots/emit

GIT_SILENT
parent ede919a4
......@@ -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)
......
......@@ -41,7 +41,7 @@ public:
QColor foreground() const;
QColor border() const;
signals:
Q_SIGNALS:
void placeHolder();
};
......
......@@ -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:
......
......@@ -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()
......
......@@ -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();
......
......@@ -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()
......
......@@ -60,9 +60,9 @@ public:
*/
int lowestSkill();
signals:
Q_SIGNALS:
public slots:
public Q_SLOTS:
private:
int m_lowestSkill;
......
......@@ -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();
}
......@@ -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();
......
......@@ -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));
}
......@@ -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.
......
......@@ -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
*/
......
......@@ -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));
}
......
......@@ -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:
......
......@@ -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);
......
......@@ -136,7 +136,7 @@ void StartGameDialog::loadChipImages()
void StartGameDialog::slotAccepted()
{
emit startGame();
Q_EMIT startGame();
accept();
}
......
......@@ -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
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment