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

convert to new connect api

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