Commit 80eb2502 authored by Laurent Montel's avatar Laurent Montel 😁

convert to new connect api

parent 462b9a10
......@@ -199,8 +199,8 @@ KGrECDialog::KGrECDialog (int action, int gameIndex,
mle->setPlainText ("");
}
connect (ecKGrB, SIGNAL (clicked()), this, SLOT (ecSetKGr()));
connect (ecTradB, SIGNAL (clicked()), this, SLOT (ecSetTrad()));
connect(ecKGrB, &QRadioButton::clicked, this, &KGrECDialog::ecSetKGr);
connect(ecTradB, &QRadioButton::clicked, this, &KGrECDialog::ecSetTrad);
}
KGrECDialog::~KGrECDialog()
......@@ -291,8 +291,7 @@ KGrLGDialog::KGrLGDialog (QFile * savedGames,
lgList-> setItemSelected (lgList->currentItem(), true);
lgHighlight = 0;
connect (lgList, SIGNAL (itemClicked(QListWidgetItem*)),
this, SLOT (lgSelect(QListWidgetItem*)));
connect(lgList, &QListWidget::itemClicked, this, &KGrLGDialog::lgSelect);
}
void KGrLGDialog::lgSelect (QListWidgetItem * item)
......
......@@ -50,14 +50,13 @@ KGrEditor::KGrEditor (KGrView * theView,
// Connect and start the timer.
timer = new QTimer (this);
connect (timer, SIGNAL (timeout()), this, SLOT (tick()));
connect(timer, &QTimer::timeout, this, &KGrEditor::tick);
timer->start (TickTime); // TickTime def in kgrglobals.h.
// Connect edit-mode slots to signals from "view".
connect (view, SIGNAL (mouseClick(int)), SLOT (doEdit(int)));
connect (view, SIGNAL (mouseLetGo(int)), SLOT (endEdit(int)));
connect (this, SIGNAL (getMousePos(int&,int&)),
scene, SLOT (getMousePos(int&,int&)));
connect(view, &KGrView::mouseClick, this, &KGrEditor::doEdit);
connect(view, &KGrView::mouseLetGo, this, &KGrEditor::endEdit);
connect(this, &KGrEditor::getMousePos, scene, &KGrScene::getMousePos);
}
KGrEditor::~KGrEditor()
......@@ -626,7 +625,7 @@ int KGrEditor::selectLevel (int action, int requestedLevel, int & requestedGame)
KGrSLDialog * sl = new KGrSLDialog (action, requestedLevel, requestedGame,
gameList, systemDataDir, userDataDir,
view);
connect (sl, SIGNAL (editNameAndHint()), this, SLOT (editNameAndHint()));
connect(sl, &KGrSLDialog::editNameAndHint, this, &KGrEditor::editNameAndHint);
bool selected = sl->selectLevel (selectedGame, selectedLevel);
delete sl;
......@@ -736,8 +735,8 @@ void KGrEditor::showEditLevel()
disconnect (view, SIGNAL (mouseLetGo(int)), 0, 0);
// Connect edit-mode slots to signals from "view".
connect (view, SIGNAL (mouseClick(int)), SLOT (doEdit(int)));
connect (view, SIGNAL (mouseLetGo(int)), SLOT (endEdit(int)));
connect(view, &KGrView::mouseClick, this, &KGrEditor::doEdit);
connect(view, &KGrView::mouseLetGo, this, &KGrEditor::endEdit);
}
bool KGrEditor::reNumberLevels (int cIndex, int first, int last, int inc)
......
......@@ -112,7 +112,7 @@ KGrGame::KGrGame (KGrView * theView,
gameFrozen = false;
dyingTimer = new QTimer (this);
connect (dyingTimer, SIGNAL (timeout()), SLOT (finalBreath()));
connect(dyingTimer, &QTimer::timeout, this, &KGrGame::finalBreath);
// Initialise random number generator.
randomGen = new KRandomSequence (time (0));
......@@ -699,10 +699,10 @@ void KGrGame::quickStartDialog()
logo->setPixmap (kapp->windowIcon().pixmap (240));
logo->setAlignment (Qt::AlignTop | Qt::AlignHCenter);
connect (qs, SIGNAL (okClicked()), this, SLOT (quickStartPlay()));
connect (qs, SIGNAL (user1Clicked()), this, SLOT (quickStartNewGame()));
connect (qs, SIGNAL (user2Clicked()), this, SLOT (quickStartUseMenu()));
connect (qs, SIGNAL (cancelClicked()), this, SLOT (quickStartQuit()));
connect(qs, &KDialog::okClicked, this, &KGrGame::quickStartPlay);
connect(qs, &KDialog::user1Clicked, this, &KGrGame::quickStartNewGame);
connect(qs, &KDialog::user2Clicked, this, &KGrGame::quickStartUseMenu);
connect(qs, &KDialog::cancelClicked, this, &KGrGame::quickStartQuit);
qs->show();
}
......@@ -886,11 +886,9 @@ void KGrGame::setupLevelPlayer()
// Use queued connections here, to ensure that levelPlayer has finished
// executing and can be deleted when control goes to the relevant slot.
connect (levelPlayer, SIGNAL (endLevel(int)),
this, SLOT (endLevel(int)), Qt::QueuedConnection);
connect(levelPlayer, &KGrLevelPlayer::endLevel, this, &KGrGame::endLevel, Qt::QueuedConnection);
if (playback) {
connect (levelPlayer, SIGNAL (interruptDemo()),
this, SLOT (interruptDemo()), Qt::QueuedConnection);
connect(levelPlayer, &KGrLevelPlayer::interruptDemo, this, &KGrGame::interruptDemo, Qt::QueuedConnection);
}
}
......@@ -1024,14 +1022,14 @@ void KGrGame::herosDead()
void KGrGame::finalBreath()
{
dbk << "Connecting fadeFinished()";
connect (scene, SIGNAL (fadeFinished()), this, SLOT (repeatLevel()));
connect(scene, &KGrScene::fadeFinished, this, &KGrGame::repeatLevel);
dbk << "Calling scene->fadeOut()";
scene->fadeIn (false);
}
void KGrGame::repeatLevel()
{
disconnect (scene, SIGNAL (fadeFinished()), this, SLOT (repeatLevel()));
disconnect(scene, &KGrScene::fadeFinished, this, &KGrGame::repeatLevel);
scene->goToBlack();
// Avoid re-starting if the player selected edit before the time was up.
......@@ -1051,14 +1049,14 @@ void KGrGame::levelCompleted()
playSound (CompletedSound);
dbk << "Connecting fadeFinished()";
connect (scene, SIGNAL (fadeFinished()), this, SLOT (goUpOneLevel()));
connect(scene, &KGrScene::fadeFinished, this, &KGrGame::goUpOneLevel);
dbk << "Calling scene->fadeOut()";
scene->fadeIn (false);
}
void KGrGame::goUpOneLevel()
{
disconnect (scene, SIGNAL (fadeFinished()), this, SLOT (goUpOneLevel()));
disconnect(scene, &KGrScene::fadeFinished, this, &KGrGame::goUpOneLevel);
scene->goToBlack();
lives++; // Level completed: gain another life.
......@@ -1661,8 +1659,8 @@ void KGrGame::checkHighScore()
OK-> setShortcut (Qt::Key_Return);
hsnUser-> setFocus(); // Set the keyboard input on.
connect (hsnUser, SIGNAL (returnPressed()), hsn, SLOT (accept()));
connect (OK, SIGNAL (clicked()), hsn, SLOT (accept()));
connect(hsnUser, &QLineEdit::returnPressed, hsn, &QDialog::accept);
connect(OK, &QPushButton::clicked, hsn, &QDialog::accept);
// Run the dialog to get the player's name. Use "-" if nothing is entered.
hsn->exec();
......@@ -1888,7 +1886,7 @@ void KGrGame::showHighScores()
// hs-> move (p.x() + 50, p.y() + 50);
// Start up the dialog box.
connect (OK, SIGNAL (clicked()), hs, SLOT (accept()));
connect(OK, &QPushButton::clicked, hs, &QDialog::accept);
hs-> exec();
delete hs;
......
......@@ -71,8 +71,7 @@ KGrRenderer::KGrRenderer (KGrScene * scene)
m_actorsRenderer->setFrameBaseIndex (1);
// Match the Actors SVG theme to the Set theme, whenever the theme changes.
connect (m_setProvider, SIGNAL(currentThemeChanged(const KgTheme*)),
this, SLOT(currentThemeChanged(const KgTheme*)));
connect(m_setProvider, &KgThemeProvider::currentThemeChanged, this, &KGrRenderer::currentThemeChanged);
// Match the starting SVG theme for the Actors to the one for the Set.
matchThemes (m_setProvider->currentTheme());
......
......@@ -94,10 +94,8 @@ KGrScene::KGrScene (KGrView * view)
m_fadingTimeLine->setCurveShape (QTimeLine::EaseOutCurve);
m_fadingTimeLine->setUpdateInterval (50);
connect (m_fadingTimeLine, SIGNAL (valueChanged(qreal)),
this, SLOT (drawSpotlight(qreal)));
connect (m_fadingTimeLine, SIGNAL (finished()),
this, SIGNAL (fadeFinished()));
connect(m_fadingTimeLine, &QTimeLine::valueChanged, this, &KGrScene::drawSpotlight);
connect(m_fadingTimeLine, &QTimeLine::finished, this, &KGrScene::fadeFinished);
}
KGrScene::~KGrScene()
......
......@@ -307,29 +307,27 @@ void KGrSLDialog::setupWidgets()
slPaintLevel();
thumbNail->show();
connect (games, SIGNAL (itemSelectionChanged()), this, SLOT (slGame()));
connect(games, &QTreeWidget::itemSelectionChanged, this, &KGrSLDialog::slGame);
connect (display, SIGNAL (valueChanged(QString)),
this, SLOT (slUpdate(QString)));
connect(display, static_cast<void (KIntSpinBox::*)(const QString &)>(&KIntSpinBox::valueChanged), this, &KGrSLDialog::slUpdate);
connect (number, SIGNAL(valueChanged(int)), this, SLOT(slShowLevel(int)));
connect(number, &QScrollBar::valueChanged, this, &KGrSLDialog::slShowLevel);
// Only enable name and hint dialog here if saving a new or edited level.
// At other times the name and hint have not been loaded or initialised yet.
if ((slAction == SL_CREATE) || (slAction == SL_SAVE)) {
// Signal editNameAndHint() relays the click to a KGrEditor connection.
connect (levelNH, SIGNAL (clicked()),
this, SIGNAL (editNameAndHint()));
connect(levelNH, &QPushButton::clicked, this, &KGrSLDialog::editNameAndHint);
}
else {
levelNH->setEnabled (false);
levelNH->hide();
}
connect (games, SIGNAL(itemSelectionChanged()), this, SLOT(slPaintLevel()));
connect (number, SIGNAL (sliderReleased()), this, SLOT (slPaintLevel()));
connect(games, &QTreeWidget::itemSelectionChanged, this, &KGrSLDialog::slPaintLevel);
connect(number, &QScrollBar::sliderReleased, this, &KGrSLDialog::slPaintLevel);
connect (this, SIGNAL (helpClicked()), this, SLOT (slotHelp()));
connect(this, &KGrSLDialog::helpClicked, this, &KGrSLDialog::slotHelp);
}
/******************************************************************************/
......
......@@ -30,7 +30,7 @@ KGrTimer::KGrTimer (QObject * parent, int pTickTime, float pScale)
expectedTime (0)
{
setScale (pScale);
connect (ticker, SIGNAL (timeout()), this, SLOT (internalSlot()));
connect(ticker, &QTimer::timeout, this, &KGrTimer::internalSlot);
ticker->start (tickTime);
t.start();
}
......
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