Skip to content

Commit

Permalink
Merge pull request #7 from Be-ing/qjsengine_migration
Browse files Browse the repository at this point in the history
use function pointers for Qt connections in ControllerEngine
  • Loading branch information
ferranpujolcamins authored Dec 29, 2018
2 parents b845529 + 191ce6f commit bb885fb
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/controllers/engine/controllerengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ bool ControllerEngine::loadScriptFiles(const QList<QString>& scriptPaths,
}
}

connect(&m_scriptWatcher, SIGNAL(fileChanged(QString)),
this, SLOT(scriptHasChanged(QString)));
connect(&m_scriptWatcher, &QFileSystemWatcher::fileChanged,
this, &ControllerEngine::scriptHasChanged);

emit(initialized());

Expand All @@ -248,8 +248,8 @@ bool ControllerEngine::loadScriptFiles(const QList<QString>& scriptPaths,
// Slot to run when a script file has changed
void ControllerEngine::scriptHasChanged(const QString& scriptFilename) {
Q_UNUSED(scriptFilename);
disconnect(&m_scriptWatcher, SIGNAL(fileChanged(QString)),
this, SLOT(scriptHasChanged(QString)));
disconnect(&m_scriptWatcher, &QFileSystemWatcher::fileChanged,
this, &ControllerEngine::scriptHasChanged);
reloadScripts();
}

Expand Down Expand Up @@ -402,8 +402,8 @@ void ControllerEngine::scriptErrorDialog(const QString& detailedError) {
if (ErrorDialogHandler::instance()->requestErrorDialog(props)) {
m_bDisplayingExceptionDialog = true;
// Enable custom handling of the dialog buttons
connect(ErrorDialogHandler::instance(), SIGNAL(stdButtonClicked(QString, QMessageBox::StandardButton)),
this, SLOT(errorDialogButton(QString, QMessageBox::StandardButton)));
connect(ErrorDialogHandler::instance(), &ErrorDialogHandler::stdButtonClicked,
this, &ControllerEngine::errorDialogButton);
}
}

Expand All @@ -417,10 +417,8 @@ void ControllerEngine::errorDialogButton(const QString& key, QMessageBox::Standa

m_bDisplayingExceptionDialog = false;
// Something was clicked, so disable this signal now
disconnect(ErrorDialogHandler::instance(),
SIGNAL(stdButtonClicked(QString, QMessageBox::StandardButton)),
this,
SLOT(errorDialogButton(QString, QMessageBox::StandardButton)));
disconnect(ErrorDialogHandler::instance(), &ErrorDialogHandler::stdButtonClicked,
this, &ControllerEngine::errorDialogButton);

if (button == QMessageBox::Retry) {
reloadScripts();
Expand Down

0 comments on commit bb885fb

Please sign in to comment.