Use Q_EMIT instead of emi

GIT_SILENT
parent f5357c98
......@@ -40,6 +40,10 @@ include(KDECMakeSettings)
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
add_definitions(
-DQT_NO_KEYWORDS
)
if (${KF5Config_VERSION} STRGREATER "5.56.0")
add_definitions(-DQT_NO_FOREACH)
MESSAGE(STATUS "compile without foreach")
......
......@@ -875,7 +875,7 @@ void KGrEditor::doEdit (int button)
// Mouse button down: start making changes.
int i, j;
emit getMousePos (i, j);
Q_EMIT getMousePos (i, j);
qCDebug(KGOLDRUNNER_LOG) << "Button" << button << "at" << i << j;
switch (button) {
......@@ -906,7 +906,7 @@ void KGrEditor::tick()
if (paintEditObj || paintAltObj) {
int i, j;
emit getMousePos (i, j);
Q_EMIT getMousePos (i, j);
// Check if the mouse has moved.
if ((i != oldI) || (j != oldJ)) {
......@@ -926,7 +926,7 @@ void KGrEditor::endEdit (int button)
// Mouse button released: finish making changes.
int i, j;
emit getMousePos (i, j);
Q_EMIT getMousePos (i, j);
switch (button) {
case Qt::LeftButton:
......
......@@ -276,7 +276,7 @@ void KGrGame::editActions (const int action)
// If there is no editor running, start one.
freeze (ProgramPause, true);
editor = new KGrEditor (view, systemDataDir, userDataDir, gameList);
emit setEditMenu (true); // Enable edit menu items and toolbar.
Q_EMIT setEditMenu (true); // Enable edit menu items and toolbar.
}
switch (action) {
......@@ -314,12 +314,12 @@ void KGrGame::editActions (const int action)
scene->deleteAllSprites();
}
emit showLives (0);
emit showScore (0);
Q_EMIT showLives (0);
Q_EMIT showScore (0);
}
else {
// Edit failed or was cancelled, so close the editor.
emit setEditMenu (false); // Disable edit menu items and toolbar.
Q_EMIT setEditMenu (false); // Disable edit menu items and toolbar.
delete editor;
editor = nullptr;
}
......@@ -464,17 +464,17 @@ void KGrGame::initGame()
// Set control-mode, hold-key option (for when K/B is used) and game-speed.
settings (gameGroup.readEntry ("ControlMode", (int) MOUSE));
emit setToggle (((controlMode == MOUSE) ? "mouse_mode" :
Q_EMIT setToggle (((controlMode == MOUSE) ? "mouse_mode" :
((controlMode == KEYBOARD) ? "keyboard_mode" :
"laptop_mode")), true);
holdKeyOption = gameGroup.readEntry ("HoldKeyOption", (int) CLICK_KEY);
emit setToggle (((holdKeyOption == CLICK_KEY) ? "click_key" :
Q_EMIT setToggle (((holdKeyOption == CLICK_KEY) ? "click_key" :
"hold_key"), true);
int speedLevel = gameGroup.readEntry ("SpeedLevel", (int) NORMAL_SPEED);
settings (speedLevel);
emit setToggle ((speedLevel == NORMAL_SPEED) ? "normal_speed" :
Q_EMIT setToggle ((speedLevel == NORMAL_SPEED) ? "normal_speed" :
((speedLevel == BEGINNER_SPEED) ? "beginner_speed" :
"champion_speed"), true);
timeScale = gameGroup.readEntry ("ActualSpeed", 10);
......@@ -487,11 +487,11 @@ void KGrGame::initGame()
loadSounds();
effects->setMuted (false);
}
emit setToggle ("options_sounds", soundOn);
Q_EMIT setToggle ("options_sounds", soundOn);
stepsOn = gameGroup.readEntry ("StepSounds", false);
//qCDebug(KGOLDRUNNER_LOG) << "StepSounds" << stepsOn;
emit setToggle ("options_steps", stepsOn);
Q_EMIT setToggle ("options_steps", stepsOn);
#endif
dbk1 << "Owner" << gameList.at (gameIndex)->owner
......@@ -507,7 +507,7 @@ void KGrGame::initGame()
newGame (level, gameIndex);
quickStartDialog();
}
emit setToggle ("options_demo", startupDemo);
Q_EMIT setToggle ("options_demo", startupDemo);
// Allow a short break, to display the graphics, then use the demo delay-time
// or the reaction-time to the quick-start dialog to do some more rendering.
......@@ -656,9 +656,9 @@ void KGrGame::startInstantReplay()
// Redisplay the starting score and lives.
lives = recording->lives;
emit showLives (lives);
Q_EMIT showLives (lives);
score = recording->score;
emit showScore (score);
Q_EMIT showScore (score);
// Restart the level in playback mode.
setPlayback (true);
......@@ -801,7 +801,7 @@ void KGrGame::quickStartUseMenu()
void KGrGame::quickStartQuit()
{
emit quitGame();
Q_EMIT quitGame();
}
/******************************************************************************/
......@@ -882,8 +882,8 @@ void KGrGame::newGame (const int lev, const int newGameIndex)
score = 0;
startScore = 0;
emit showLives (lives);
emit showScore (score);
Q_EMIT showLives (lives);
Q_EMIT showScore (score);
playLevel (owner, prefix, level, NewLevel);
}
......@@ -893,7 +893,7 @@ bool KGrGame::playLevel (const Owner fileOwner, const QString & prefix,
{
// If the game-editor is active, terminate it.
if (editor) {
emit setEditMenu (false); // Disable edit menu items and toolbar.
Q_EMIT setEditMenu (false); // Disable edit menu items and toolbar.
delete editor;
editor = nullptr;
}
......@@ -914,9 +914,9 @@ bool KGrGame::playLevel (const Owner fileOwner, const QString & prefix,
else if (playback) {
// Set up and display the starting score and lives.
lives = recording->lives;
emit showLives (lives);
Q_EMIT showLives (lives);
score = recording->score;
emit showScore (score);
Q_EMIT showScore (score);
}
scene->setLevel (levelNo); // Switch and render background if reqd.
......@@ -930,7 +930,7 @@ bool KGrGame::playLevel (const Owner fileOwner, const QString & prefix,
levelHint = recording->hint;
// Indicate on the menus whether there is a hint for this level.
emit hintAvailable (levelHint.length() > 0);
Q_EMIT hintAvailable (levelHint.length() > 0);
// Re-draw the playfield frame, level title and figures.
scene->setTitle (getTitle());
......@@ -964,7 +964,7 @@ void KGrGame::setupLevelPlayer()
void KGrGame::incScore (const int n)
{
score = score + n; // SCORING: trap enemy 75, kill enemy 75,
emit showScore (score); // collect gold 250, complete the level 1500.
Q_EMIT showScore (score); // collect gold 250, complete the level 1500.
}
void KGrGame::playSound (const int n, const bool onOff)
......@@ -1052,7 +1052,7 @@ void KGrGame::herosDead()
// Lose a life.
if ((--lives > 0) || playback) {
// Demo mode or still some life left.
emit showLives (lives);
Q_EMIT showLives (lives);
// Freeze the animation and let the player see what happened.
freeze (ProgramPause, true);
......@@ -1063,7 +1063,7 @@ void KGrGame::herosDead()
}
else {
// Game over.
emit showLives (lives);
Q_EMIT showLives (lives);
freeze (ProgramPause, true);
playSound (GameOverSound);
......@@ -1135,7 +1135,7 @@ void KGrGame::goUpOneLevel()
scene->goToBlack();
lives++; // Level completed: gain another life.
emit showLives (lives);
Q_EMIT showLives (lives);
incScore (1500);
if (playback) {
......@@ -1169,8 +1169,8 @@ void KGrGame::setControlMode (const int mode)
{
// Enable/disable keyboard-mode options.
bool enableDisable = (mode == KEYBOARD);
emit setAvail ("click_key", enableDisable);
emit setAvail ("hold_key", enableDisable);
Q_EMIT setAvail ("click_key", enableDisable);
Q_EMIT setAvail ("hold_key", enableDisable);
controlMode = mode;
if (levelPlayer && (! playback)) {
......@@ -1291,7 +1291,7 @@ void KGrGame::freeze (const bool userAction, const bool on_off)
}
else {
// The user is freezing or unfreezing the game. Do visual feedback.
emit gameFreeze (on_off);
Q_EMIT gameFreeze (on_off);
}
gameFrozen = on_off;
......@@ -1355,21 +1355,21 @@ void KGrGame::setPlayback (const bool onOff)
if (playback != onOff) {
// Disable high scores, kill hero and some settings during demo/replay.
bool enableDisable = (! onOff);
emit setAvail ("game_highscores", enableDisable);
emit setAvail ("kill_hero", enableDisable);
Q_EMIT setAvail ("game_highscores", enableDisable);
Q_EMIT setAvail ("kill_hero", enableDisable);
emit setAvail ("mouse_mode", enableDisable);
emit setAvail ("keyboard_mode", enableDisable);
emit setAvail ("laptop_mode", enableDisable);
Q_EMIT setAvail ("mouse_mode", enableDisable);
Q_EMIT setAvail ("keyboard_mode", enableDisable);
Q_EMIT setAvail ("laptop_mode", enableDisable);
emit setAvail ("click_key", enableDisable);
emit setAvail ("hold_key", enableDisable);
Q_EMIT setAvail ("click_key", enableDisable);
Q_EMIT setAvail ("hold_key", enableDisable);
emit setAvail ("normal_speed", enableDisable);
emit setAvail ("beginner_speed", enableDisable);
emit setAvail ("champion_speed", enableDisable);
emit setAvail ("increase_speed", enableDisable);
emit setAvail ("decrease_speed", enableDisable);
Q_EMIT setAvail ("normal_speed", enableDisable);
Q_EMIT setAvail ("beginner_speed", enableDisable);
Q_EMIT setAvail ("champion_speed", enableDisable);
Q_EMIT setAvail ("increase_speed", enableDisable);
Q_EMIT setAvail ("decrease_speed", enableDisable);
}
scene->showReplayMessage (onOff);
playback = onOff;
......@@ -1436,7 +1436,7 @@ void KGrGame::kbControl (const int dirn, const bool pressed)
case KMessageBox::Ok:
case KMessageBox::Continue:
settings (KEYBOARD);
emit setToggle ("keyboard_mode", true); // Adjust Settings menu.
Q_EMIT setToggle ("keyboard_mode", true); // Adjust Settings menu.
break;
case KMessageBox::No:
case KMessageBox::Cancel:
......@@ -1598,9 +1598,9 @@ void KGrGame::loadGame (const int game, const int lev)
newGame (lev, game); // Re-start the selected game.
showTutorialMessages (level);
lives = loadedData.mid (32, 3).toLong(); // Update the lives.
emit showLives (lives);
Q_EMIT showLives (lives);
score = loadedData.mid (36, 7).toLong(); // Update the score.
emit showScore (score);
Q_EMIT showScore (score);
}
bool KGrGame::saveOK()
......
......@@ -201,7 +201,7 @@ void KGrLevelGrid::placeHiddenLadders()
int j = offset / width;
changeCellAt (i, j, LADDER);
}
emit showHiddenLadders (hiddenLadders, width);
Q_EMIT showHiddenLadders (hiddenLadders, width);
hiddenLadders.clear();
}
......
......@@ -156,18 +156,18 @@ void KGrLevelPlayer::init (KGrView * view,
// If the hero is here, leave the tile empty.
if (type == HERO) {
emit paintCell (i, j, FREE);
Q_EMIT paintCell (i, j, FREE);
}
// If an enemy is here, count him and leave the tile empty.
else if (type == ENEMY) {
enemyCount++;
emit paintCell (i, j, FREE);
Q_EMIT paintCell (i, j, FREE);
}
// Or, just paint this tile.
else {
emit paintCell (i, j, type);
Q_EMIT paintCell (i, j, type);
}
}
}
......@@ -184,12 +184,12 @@ void KGrLevelPlayer::init (KGrView * view,
if (hero == nullptr) {
targetI = i;
targetJ = j;
heroId = emit makeSprite (HERO, i, j);
heroId = Q_EMIT makeSprite (HERO, i, j);
hero = new KGrHero (this, grid, i, j, heroId, rules);
hero->setNuggets (nuggets);
hero->setDigWhileFalling (recording->digWhileFalling);
if ((controlMode == MOUSE) || (controlMode == LAPTOP)) {
emit setMousePos (targetI, targetJ);
Q_EMIT setMousePos (targetI, targetJ);
}
grid->changeCellAt (i, j, FREE); // Hero now a sprite.
}
......@@ -203,7 +203,7 @@ void KGrLevelPlayer::init (KGrView * view,
char type = grid->cellType (i, j);
if (type == ENEMY) {
KGrEnemy * enemy;
int id = emit makeSprite (ENEMY, i, j);
int id = Q_EMIT makeSprite (ENEMY, i, j);
enemy = new KGrEnemy (this, grid, i, j, id, rules);
enemies.append (enemy);
grid->changeCellAt (i, j, FREE); // Enemy now a sprite.
......@@ -270,8 +270,8 @@ void KGrLevelPlayer::startDigging (Direction diggingDirection)
grid->changeCellAt (digI, digJ, HOLE);
// Start the brick-opening animation (non-repeating).
int id = emit makeSprite (BRICK, digI, digJ);
emit startAnimation (id, false, digI, digJ,
int id = Q_EMIT makeSprite (BRICK, digI, digJ);
Q_EMIT startAnimation (id, false, digI, digJ,
(digOpeningCycles * digCycleTime), STAND, OPEN_BRICK);
DugBrick * thisBrick = new DugBrick;
......@@ -295,7 +295,7 @@ void KGrLevelPlayer::processDugBricks (const int scaledTime)
dugBrick->cycleTimeLeft += digCycleTime;
if (--dugBrick->countdown == digClosingCycles) {
// Start the brick-closing animation (non-repeating).
emit startAnimation (dugBrick->id, false,
Q_EMIT startAnimation (dugBrick->id, false,
dugBrick->digI, dugBrick->digJ,
(digClosingCycles * digCycleTime),
STAND, CLOSE_BRICK);
......@@ -306,7 +306,7 @@ void KGrLevelPlayer::processDugBricks (const int scaledTime)
}
if (dugBrick->countdown <= 0) {
// Dispose of the dug brick and remove it from the list.
emit deleteSprite (dugBrick->id);
Q_EMIT deleteSprite (dugBrick->id);
delete dugBrick;
iterator.remove();
}
......@@ -317,7 +317,7 @@ void KGrLevelPlayer::processDugBricks (const int scaledTime)
void KGrLevelPlayer::prepareToPlay()
{
if ((controlMode == MOUSE) || (controlMode == LAPTOP)) {
emit setMousePos (targetI, targetJ);
Q_EMIT setMousePos (targetI, targetJ);
}
playState = Ready;
}
......@@ -705,7 +705,7 @@ void KGrLevelPlayer::unstackEnemy (const int spriteId,
void KGrLevelPlayer::tick (bool missed, int scaledTime)
{
int i, j;
emit getMousePos (i, j);
Q_EMIT getMousePos (i, j);
if (i == -2) {
return; // The KGoldRunner window is inactive.
}
......@@ -762,7 +762,7 @@ void KGrLevelPlayer::tick (bool missed, int scaledTime)
timer->pause();
// Queued connection ensures KGrGame slot runs AFTER return from here.
emit endLevel (status);
Q_EMIT endLevel (status);
//qCDebug(KGOLDRUNNER_LOG) << "END OF LEVEL";
return;
}
......@@ -771,7 +771,7 @@ void KGrLevelPlayer::tick (bool missed, int scaledTime)
enemy->run (scaledTime);
}
emit animation (missed);
Q_EMIT animation (missed);
}
int KGrLevelPlayer::runnerGotGold (const int spriteId,
......@@ -790,7 +790,7 @@ int KGrLevelPlayer::runnerGotGold (const int spriteId,
if (! lost) {
grid->gotGold (i, j, hasGold); // Record pickup/drop on grid.
}
emit gotGold (spriteId, i, j, hasGold, lost); // Erase/show gold on screen.
Q_EMIT gotGold (spriteId, i, j, hasGold, lost); // Erase/show gold on screen.
// If hero got gold, score, maybe show hidden ladders, maybe end the level.
if ((spriteId == heroId) || lost) {
......@@ -905,7 +905,7 @@ bool KGrLevelPlayer::doRecordedMove()
if ((code == END_CODE) || (code == 0)) {
dbe2 "T %04d recIndex %03d PLAY - END of recording\n",
T, recIndex);
emit endLevel (UNEXPECTED_END);
Q_EMIT endLevel (UNEXPECTED_END);
return false;
}
......@@ -1000,7 +1000,7 @@ bool KGrLevelPlayer::doRecordedMove()
if (code == (ACTION_CODE + KILL_HERO)) {
dbe2 "T %04d recIndex %03d PLAY kill-hero code %d\n",
T, recIndex, code);
emit endLevel (DEAD);
Q_EMIT endLevel (DEAD);
return false;
}
}
......@@ -1104,7 +1104,7 @@ void KGrLevelPlayer::interruptPlayback()
// End debug stuff.
playback = false;
emit interruptDemo();
Q_EMIT interruptDemo();
// dbk << "INTERRUPT - emit interruptDemo();";
}
......@@ -1114,7 +1114,7 @@ void KGrLevelPlayer::killHero()
// Record that KILL_HERO is how the level ended.
record (1, ACTION_CODE + KILL_HERO);
emit endLevel (DEAD);
Q_EMIT endLevel (DEAD);
//qCDebug(KGOLDRUNNER_LOG) << "END OF LEVEL";
}
}
......
......@@ -255,7 +255,7 @@ HeroStatus KGrHero::run (const int scaledTime)
int step = ((currAnimation == RUN_R) || (currAnimation == RUN_L)) ?
StepSound : ClimbSound;
if ((s == EndCell) || (step == ClimbSound)) {
emit soundSignal (step);
Q_EMIT soundSignal (step);
}
}
......@@ -268,12 +268,12 @@ HeroStatus KGrHero::run (const int scaledTime)
if (cellType == NUGGET) {
nuggets = levelPlayer->runnerGotGold (spriteId, gridI, gridJ, true);
emit incScore (250); // Add to the human player's score.
Q_EMIT incScore (250); // Add to the human player's score.
if (nuggets > 0) {
emit soundSignal (GoldSound);
Q_EMIT soundSignal (GoldSound);
}
else {
emit soundSignal (LadderSound);
Q_EMIT soundSignal (LadderSound);
}
}
......@@ -282,7 +282,7 @@ HeroStatus KGrHero::run (const int scaledTime)
bool newFallingState = setNextMovement (HERO, cellType, nextDirection,
nextAnimation, interval);
if (newFallingState != falling) {
emit soundSignal (FallSound, newFallingState); // Start/stop falling.
Q_EMIT soundSignal (FallSound, newFallingState); // Start/stop falling.
falling = newFallingState;
}
timeLeft += interval;
......@@ -301,7 +301,7 @@ HeroStatus KGrHero::run (const int scaledTime)
deltaY = movement [nextDirection][Y];
// Start the running animation (repeating).
emit startAnimation (spriteId, true, gridI, gridJ,
Q_EMIT startAnimation (spriteId, true, gridI, gridJ,
(interval * pointsPerCell * TickTime) / scaledTime,
nextDirection, nextAnimation);
currAnimation = nextAnimation;
......@@ -366,13 +366,13 @@ bool KGrHero::dig (const Direction diggingDirection, int & i, int & j)
<< "dirn" << currDirection << "brick at" << i << j
<< "heroMoves" << ((int) OK) << "canStand" << canStand
<< "enemyUnder" << enemyUnder;
emit invalidDig(); // Issue warning re dig while falling.
Q_EMIT invalidDig(); // Issue warning re dig while falling.
result = false;
}
}
}
if (result) {
emit soundSignal (DigSound);
Q_EMIT soundSignal (DigSound);
}
return result; // Tell the levelPlayer whether & where to open a hole.
......@@ -422,7 +422,7 @@ void KGrEnemy::run (const int scaledTime)
// Die if a brick has closed over us.
if (s == CaughtInBrick) {
releaseCell (gridI + deltaX, gridJ + deltaY);
emit incScore (75); // Killed: add to the player's score.
Q_EMIT incScore (75); // Killed: add to the player's score.
dbe1 "T %05lld id %02d Died in brick at [%02d,%02d]\n",
t.elapsed(), spriteId, gridI, gridJ);
dieAndReappear(); // Move to a new (gridI, gridJ).
......@@ -437,7 +437,7 @@ void KGrEnemy::run (const int scaledTime)
t.elapsed(), spriteId, gridI, gridJ+1);
grid->changeCellAt (gridI, gridJ + 1, USEDHOLE);
dropGold();
emit incScore (75); // Trapped: add to the player's score.
Q_EMIT incScore (75); // Trapped: add to the player's score.
return;
}
......@@ -535,7 +535,7 @@ void KGrEnemy::run (const int scaledTime)
}
// Start the running animation (repeating).
emit startAnimation (spriteId, true, gridI, gridJ,
Q_EMIT startAnimation (spriteId, true, gridI, gridJ,
(interval * pointsPerCell * TickTime) / scaledTime,
nextDirection, nextAnimation);
currAnimation = nextAnimation;
......
......@@ -204,7 +204,7 @@ void KGrScene::redrawScene ()
if (redrawToolbar) {
m_toolbarTileSize = m_tileSize; // If game is in edit mode, KGoldrunner
emit redrawEditToolbar(); // object redraws the editToolbar.
Q_EMIT redrawEditToolbar(); // object redraws the editToolbar.
}
}
......
......@@ -55,7 +55,7 @@ void KGrTimer::step()
{
tickCount++;
expectedTime = expectedTime + tickTime;
emit tick (false, scaledTime);
Q_EMIT tick (false, scaledTime);
}
void KGrTimer::internalSlot()
......@@ -70,7 +70,7 @@ void KGrTimer::internalSlot()
while (timeOnClock > (expectedTime + halfTick)) {
tickCount++;
expectedTime = expectedTime + tickTime;
emit tick ((timeOnClock >= (expectedTime + tickTime)), scaledTime);
Q_EMIT tick ((timeOnClock >= (expectedTime + tickTime)), scaledTime);
}
}
......
......@@ -44,17 +44,17 @@ void KGrView::resizeEvent (QResizeEvent *)
void KGrView::mousePressEvent (QMouseEvent * mouseEvent)
{
emit mouseClick (mouseEvent->button());
Q_EMIT mouseClick (mouseEvent->button());
}
void KGrView::mouseDoubleClickEvent (QMouseEvent * mouseEvent)
{
emit mouseClick (mouseEvent->button());
Q_EMIT mouseClick (mouseEvent->button());
}
void KGrView::mouseReleaseEvent (QMouseEvent * mouseEvent)
{
emit mouseLetGo (mouseEvent->button());
Q_EMIT mouseLetGo (mouseEvent->button());
}
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