summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrius ┼átikonas <[email protected]>2017-06-12 15:05:15 +0200
committerAndrius ┼átikonas <[email protected]>2017-06-12 15:05:15 +0200
commit7d2268c2b3186f824209bb3e6bf5e8ef62ceeb49 (patch)
tree3bbb2c2ebd3b935ed5d18acf8627c52db821271e
parentcf28b6c4dd41fdf1b9e42059fb188101a9c69e25 (diff)
convert to new connect api
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/kgoldrunner.cpp45
-rw-r--r--src/kgoldrunner.h1
-rw-r--r--src/kgrdialog.cpp4
-rw-r--r--src/kgrlevelplayer.cpp47
-rw-r--r--src/kgrselector.cpp4
6 files changed, 40 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f77ec45..10c8124 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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})
diff --git a/src/kgoldrunner.cpp b/src/kgoldrunner.cpp
index e016a4f..9f832e6 100644
--- a/src/kgoldrunner.cpp
+++ b/src/kgoldrunner.cpp
@@ -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,
diff --git a/src/kgoldrunner.h b/src/kgoldrunner.h
index 5432a94..9786c7d 100644
--- a/src/kgoldrunner.h
+++ b/src/kgoldrunner.h
@@ -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();
diff --git a/src/kgrdialog.cpp b/src/kgrdialog.cpp
index 3e0327e..ced9a3c 100644
--- a/src/kgrdialog.cpp
+++ b/src/kgrdialog.cpp
@@ -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;
diff --git a/src/kgrlevelplayer.cpp b/src/kgrlevelplayer.cpp
index bb555f5..4af017b 100644
--- a/src/kgrlevelplayer.cpp
+++ b/src/kgrlevelplayer.cpp
@@ -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.
diff --git a/src/kgrselector.cpp b/src/kgrselector.cpp
index 3ba24d8..bf569aa 100644
--- a/src/kgrselector.cpp
+++ b/src/kgrselector.cpp
@@ -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);