Commit 7d2268c2 authored by Andrius Štikonas's avatar Andrius Štikonas

convert to new connect api

parent cf28b6c4
......@@ -2,7 +2,7 @@ project(kgoldrunner)
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (QT_MIN_VERSION "5.7.0")
set (KF5_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.23.0")
find_package(ECM 1.7.0 REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
......
......@@ -136,19 +136,17 @@ KGoldrunner::KGoldrunner()
gameFreeze (false);
// Connect the game actions to the menu and toolbar displays.
connect (game, SIGNAL (quitGame()), SLOT (close()));
connect (game, SIGNAL (setEditMenu(bool)), SLOT (setEditMenu(bool)));
connect (game, SIGNAL (showLives(long)), scene, SLOT (showLives(long)));
connect (game, SIGNAL (showScore(long)), scene, SLOT (showScore(long)));
connect (game, SIGNAL (hintAvailable(bool)), SLOT (adjustHintAction(bool)));
connect (game, SIGNAL (gameFreeze(bool)), SLOT (gameFreeze(bool)));
connect (game, &KGrGame::quitGame, this, &KGoldrunner::close);
connect (game, &KGrGame::setEditMenu, this, &KGoldrunner::setEditMenu);
connect (game, &KGrGame::showLives, scene, &KGrScene::showLives);
connect (game, &KGrGame::showScore, scene, &KGrScene::showScore);
connect (game, &KGrGame::hintAvailable, this, &KGoldrunner::adjustHintAction);
connect (game, &KGrGame::gameFreeze, this, &KGoldrunner::gameFreeze);
connect (game, SIGNAL (setAvail(const char*,bool)),
SLOT (setAvail(const char*,bool)));
connect (game, SIGNAL (setToggle(const char*,bool)),
SLOT (setToggle(const char*,bool)));
connect (game, &KGrGame::setAvail, this, &KGoldrunner::setAvail);
connect (game, &KGrGame::setToggle, this, &KGoldrunner::setToggle);
connect (scene, SIGNAL (redrawEditToolbar()), SLOT (redrawEditToolbar()));
connect (scene, &KGrScene::redrawEditToolbar, this, &KGoldrunner::redrawEditToolbar);
// Apply the saved mainwindow settings, if any, and ask the mainwindow
// to automatically save settings if changed: window size, toolbar
......@@ -193,7 +191,7 @@ void KGoldrunner::setupActions()
/**************************************************************************/
QSignalMapper * gameMapper = new QSignalMapper (this);
connect (gameMapper, SIGNAL (mapped(int)), game, SLOT (gameActions(int)));
connect (gameMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), game, &KGrGame::gameActions);
tempMapper = gameMapper;
// New Game...
......@@ -309,7 +307,7 @@ void KGoldrunner::setupActions()
/**************************************************************************/
QSignalMapper * editMapper = new QSignalMapper (this);
connect (editMapper, SIGNAL (mapped(int)), game, SLOT (editActions(int)));
connect (editMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), game, &KGrGame::editActions);
tempMapper = editMapper;
// Create a Level
......@@ -379,16 +377,16 @@ void KGoldrunner::setupActions()
themes->setToolTip (i18n ("Change the graphics theme..."));
themes->setWhatsThis (i18n ("Alter the visual appearance of the runners "
"and background scene..."));
connect (themes, SIGNAL (triggered(bool)), this, SLOT (changeTheme()));
connect (themes, &QAction::triggered, this, &KGoldrunner::changeTheme);
// Show/Exit Full Screen Mode
KToggleFullScreenAction * fullScreen = KStandardAction::fullScreen
(this, SLOT (viewFullScreen(bool)), this, this);
(this, &KGoldrunner::viewFullScreen, this, this);
actionCollection()->addAction (fullScreen->objectName(), fullScreen);
// Other settings are handled by KGrGame.
QSignalMapper * settingMapper = new QSignalMapper (this);
connect (settingMapper, SIGNAL (mapped(int)), game, SLOT (settings(int)));
connect (settingMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), game, &KGrGame::settings);
tempMapper = settingMapper;
#ifdef KGAUDIO_BACKEND_OPENAL
......@@ -566,7 +564,7 @@ void KGoldrunner::setupActions()
return;
QSignalMapper * dbgMapper = new QSignalMapper (this);
connect (dbgMapper, SIGNAL (mapped(int)), game, SLOT(dbgControl(int)));
connect (dbgMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), game, &KGrGame::dbgControl);
tempMapper = dbgMapper;
keyControl ("do_step", i18n ("Do a Step"), Qt::Key_Period, DO_STEP);
......@@ -599,7 +597,7 @@ QAction * KGoldrunner::gameAction (const QString & name,
if (! key.isEmpty()) {
actionCollection()->setDefaultShortcut(ga, key);
}
connect (ga, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
connect (ga, &QAction::triggered, tempMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
tempMapper->setMapping (ga, code);
return ga;
}
......@@ -614,7 +612,7 @@ QAction * KGoldrunner::editAction (const QString & name,
ed->setText (text);
ed->setToolTip (toolTip);
ed->setWhatsThis (whatsThis);
connect (ed, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
connect (ed, &QAction::triggered, tempMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
tempMapper->setMapping (ed, code);
return ed;
}
......@@ -629,7 +627,7 @@ KToggleAction * KGoldrunner::settingAction (const QString & name,
actionCollection()->addAction (name, s);
s->setToolTip (toolTip);
s->setWhatsThis (whatsThis);
connect (s, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
connect (s, &QAction::triggered, tempMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
tempMapper->setMapping (s, code);
return s;
}
......@@ -647,7 +645,7 @@ KToggleAction * KGoldrunner::editToolbarAction (const QString & name,
ed->setIconText (shortText);
ed->setToolTip (toolTip);
ed->setWhatsThis (whatsThis);
connect (ed, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
connect (ed, &QAction::triggered, tempMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
tempMapper->setMapping (ed, mapCode);
return ed;
}
......@@ -668,7 +666,7 @@ void KGoldrunner::keyControl (const QString & name, const QString & text,
return;
}
connect (a, SIGNAL (triggered(bool)), tempMapper, SLOT (map()));
connect (a, &QAction::triggered, tempMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
tempMapper->setMapping (a, code);
addAction (a);
}
......@@ -943,8 +941,7 @@ bool KGoldrunner::queryClose()
void KGoldrunner::setupEditToolbarActions()
{
QSignalMapper * editToolbarMapper = new QSignalMapper (this);
connect (editToolbarMapper, SIGNAL (mapped(int)),
game, SLOT (editToolbarActions(int)));
connect (editToolbarMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), game, &KGrGame::editToolbarActions);
tempMapper = editToolbarMapper;
QAction * ed = editAction ("edit_hint", EDIT_HINT,
......
......@@ -58,7 +58,6 @@ public:
*/
bool startedOK() {return (startupOK);}
public slots:
void setToggle (const char * actionName, const bool onOff);
void setAvail (const char * actionName, const bool onOff);
void redrawEditToolbar();
......
......@@ -260,8 +260,8 @@ KGrLGDialog::KGrLGDialog (QFile * savedGames,
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, &QDialogButtonBox::accepted, this, &KGrLGDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KGrLGDialog::reject);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
int margin = 0;
......
......@@ -129,18 +129,12 @@ void KGrLevelPlayer::init (KGrView * view,
grid->calculateAccess (rules->runThruHole());
// Connect to code that paints grid cells and start-positions of sprites.
connect (this, SIGNAL (paintCell(int,int,char)),
view->gameScene(), SLOT (paintCell(int,int,char)));
connect (this, SIGNAL (makeSprite(char,int,int)),
view->gameScene(), SLOT (makeSprite(char,int,int)));
connect (this, &KGrLevelPlayer::paintCell, view->gameScene(), &KGrScene::paintCell);
connect (this, &KGrLevelPlayer::makeSprite, view->gameScene(), &KGrScene::makeSprite);
// Connect to the mouse-positioning code in the graphics.
connect (this, SIGNAL (getMousePos(int&,int&)),
view->gameScene(), SLOT (getMousePos(int&,int&)));
connect (this, SIGNAL (setMousePos(int,int)),
view->gameScene(), SLOT (setMousePos(int,int)));
connect (this, &KGrLevelPlayer::getMousePos, view->gameScene(), &KGrScene::getMousePos);
connect (this, &KGrLevelPlayer::setMousePos, view->gameScene(), &KGrScene::setMousePos);
// Show the layout of this level in the view (KGrCanvas).
int wall = ConcreteWall;
......@@ -218,23 +212,16 @@ void KGrLevelPlayer::init (KGrView * view,
}
// Connect the hero's and enemies' efforts to the graphics.
connect (this, SIGNAL (gotGold(int,int,int,bool,bool)),
view->gameScene(), SLOT (gotGold(int,int,int,bool,bool)));
connect (this, &KGrLevelPlayer::gotGold, view->gameScene(), &KGrScene::gotGold);
// Connect mouse-clicks from KGrCanvas to digging slot.
connect (view, SIGNAL (mouseClick(int)), SLOT (doDig(int)));
// Connect mouse-clicks from KGrView to digging slot.
connect (view, &KGrView::mouseClick, this, &KGrLevelPlayer::doDig);
// Connect the hero and enemies (if any) to the animation code.
connect (hero, SIGNAL (startAnimation (int, bool, int, int,
int, Direction, AnimationType)),
view->gameScene(), SLOT (startAnimation (int, bool, int, int,
int, Direction, AnimationType)));
connect (hero, &KGrHero::startAnimation, view->gameScene(), &KGrScene::startAnimation);
for (KGrEnemy * enemy : qAsConst(enemies)) {
connect (enemy, SIGNAL (startAnimation (int, bool, int, int,
int, Direction, AnimationType)),
view->gameScene(), SLOT (startAnimation (int, bool, int, int,
int, Direction, AnimationType)));
connect (enemy, &KGrEnemy::startAnimation, view->gameScene(), &KGrScene::startAnimation);
}
// Connect the scoring.
......@@ -250,17 +237,12 @@ void KGrLevelPlayer::init (KGrView * view,
game, SLOT (playSound(int,bool)));
// Connect the level player to the animation code (for use with dug bricks).
connect (this, SIGNAL (startAnimation (int, bool, int, int,
int, Direction, AnimationType)),
view->gameScene(), SLOT (startAnimation (int, bool, int, int,
int, Direction, AnimationType)));
connect (this, &KGrLevelPlayer::startAnimation, view->gameScene(), &KGrScene::startAnimation);
connect (this, SIGNAL (deleteSprite(int)),
view->gameScene(), SLOT (deleteSprite(int)));
connect (this, &KGrLevelPlayer::deleteSprite, view->gameScene(), &KGrScene::deleteSprite);
// Connect the grid to the view, to show hidden ladders when the time comes.
connect (grid, SIGNAL (showHiddenLadders(QList<int>,int)),
view->gameScene(), SLOT (showHiddenLadders(QList<int>,int)));
connect (grid, &KGrLevelGrid::showHiddenLadders, view->gameScene(), &KGrScene::showHiddenLadders);
// Connect and start the timer. The tick() slot emits signal animation(),
// so there is just one time-source for the model and the view.
......@@ -270,9 +252,8 @@ void KGrLevelPlayer::init (KGrView * view,
timer->pause(); // Pause is ON as level starts.
}
connect (timer, SIGNAL (tick(bool,int)), this, SLOT (tick(bool,int)));
connect (this, SIGNAL (animation(bool)),
view->gameScene(), SLOT (animate(bool)));
connect (timer, &KGrTimer::tick, this, &KGrLevelPlayer::tick);
connect (this, &KGrLevelPlayer::animation, view->gameScene(), &KGrScene::animate);
if (! playback) {
// Allow some time to view the level before starting a replay.
......
......@@ -132,8 +132,8 @@ void KGrSLDialog::setupWidgets()
setWindowTitle (i18n ("Select Game"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
QVBoxLayout *buttonLayout = new QVBoxLayout;
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, &QDialogButtonBox::accepted, this, &KGrSLDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KGrSLDialog::reject);
buttonLayout->addWidget(buttonBox);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
layout->addWidget(buttonBox);
......
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