From 9bf90a2f5d975f3cc6f2e8537532ab24b7de070c Mon Sep 17 00:00:00 2001 From: "joaquin.f.fernandez" Date: Wed, 26 Oct 2022 10:42:48 -0300 Subject: [PATCH] Update connect statements in gui. --- src/gui/mmomegui.cpp | 28 ++++++++++++++-------------- src/gui/modeleditor.h | 6 +----- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/gui/mmomegui.cpp b/src/gui/mmomegui.cpp index ff4f4650..b51e8ca9 100644 --- a/src/gui/mmomegui.cpp +++ b/src/gui/mmomegui.cpp @@ -145,7 +145,7 @@ void MmomeGui::on_action_Save_As_triggered() void MmomeGui::on_actionSettings_triggered() { _settingsDlg = new SettingsDlg(this); - connect(_settingsDlg, SIGNAL(finished(int)), this, SLOT(settingsDlgClosed())); + connect(_settingsDlg, &SettingsDlg::finished, this, &MmomeGui::settingsDlgClosed); enableActions(false); _settingsDlg->show(); } @@ -162,7 +162,7 @@ void MmomeGui::on_actionImport_triggered() modelsDir.cd(sbmlfi.baseName()); _compiler_msg->setPlainText(_compiler_msg->toPlainText() + QString("\nImport SBML model: ") + fileName); _proc = new QProcess(this); - connect(_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(importFinished(int, QProcess::ExitStatus))); + connect(_proc, QOverload::of(&QProcess::finished), this, &MmomeGui::importFinished); _sbmlFile = modelsDir.absolutePath() + SLASH + sbmlfi.baseName() + ".mo"; QStringList args; args << "-o " + _sbmlFile; @@ -187,8 +187,8 @@ void MmomeGui::editModel(QString name) QMdiSubWindow *sw = new QMdiSubWindow(this, Qt::CustomizeWindowHint); sw->setWidget(Editor::instance(this, name)); mdiArea->addSubWindow(sw); - connect(Editor::instance(), SIGNAL(done(QString, QString)), this, SLOT(done(QString, QString))); - connect(Editor::instance(), SIGNAL(clean(int)), this, SLOT(cleanBuildDir(int))); + connect(Editor::instance(), &ModelEditor::done, this, &MmomeGui::done); + connect(Editor::instance(), &ModelEditor::clean, this, &MmomeGui::cleanBuildDir); connect(action_Save, &QAction::triggered, this, []() { Editor::instance()->save(); }); connect(actionSa_ve_All, &QAction::triggered, Editor::instance(), &ModelEditor::saveAll); Editor::instance()->setWindowState(Qt::WindowMaximized); @@ -275,7 +275,7 @@ void MmomeGui::run(QString name) _compiler_msg->setPlainText(_compiler_msg->toPlainText() + QString("\nCreating/cleaning directory: ") + outputDir.absolutePath()); on_actionClear_Log_triggered(); _proc = new QProcess(this); - connect(_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(run_finished(int, QProcess::ExitStatus))); + connect(_proc, QOverload::of(&QProcess::finished), this, &MmomeGui::run_finished); QStringList args; args << name; if (Editor::instance()->isParallel()) { @@ -290,7 +290,7 @@ void MmomeGui::run(QString name) } else { args << QString("false"); } - connect(_proc, SIGNAL(readyReadStandardError()), this, SLOT(simulation_message())); + connect(_proc, &QProcess::readyReadStandardError, this, &MmomeGui::simulation_message); _timeInterval = Editor::instance()->stopTime().toDouble() - Editor::instance()->startTime().toDouble(); _sim_progress->setMaximum(100); _sim_progress->reset(); @@ -396,8 +396,8 @@ void MmomeGui::on_actionRun_triggered() } _compiler_msg->clear(); _runDlg = new RunDlg(this); - connect(_runDlg, SIGNAL(accepted()), this, SLOT(runDlgClose())); - connect(_runDlg, SIGNAL(rejected()), this, SLOT(runDlgRejected())); + connect(_runDlg, &RunDlg::accepted, this, &MmomeGui::runDlgClose); + connect(_runDlg, &RunDlg::rejected, this, &MmomeGui::runDlgRejected); _runDlg->setStartTime(Editor::instance()->startTime()); _runDlg->setStopTime(Editor::instance()->stopTime()); _runDlg->setTolerance(Editor::instance()->tolerance()); @@ -531,7 +531,7 @@ bool MmomeGui::compile(bool dbg) } QString flags = _utils->appFlag(FLG_FLAGS); _proc = new QProcess(this); - connect(_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(comp_finished(int, QProcess::ExitStatus))); + connect(_proc, QOverload::of(&QProcess::finished), this, &MmomeGui::comp_finished); QStringList args; QString set; if (_settings_only) { @@ -666,7 +666,7 @@ void MmomeGui::comp_finished(int exitCode, QProcess::ExitStatus exitStatus) QString build = _utils->appCommand(CMD_BUILD); delete _proc; _proc = new QProcess(this); - connect(_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(make_finished(int, QProcess::ExitStatus))); + connect(_proc, QOverload::of(&QProcess::finished), this, &MmomeGui::make_finished); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("MMOC_BUILD", QDir(_utils->appDir(MMOC_BUILD)).absolutePath()); env.insert("MMOC_BIN", QDir(_utils->appDir(MMOC_BIN)).absolutePath()); @@ -723,7 +723,7 @@ void MmomeGui::on_actionLog_triggered() } QString logCmd = _utils->appCommand(CMD_LOG); _log = new QProcess(this); - connect(_log, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(log_finished(int, QProcess::ExitStatus))); + connect(_log, QOverload::of(&QProcess::finished), this, &MmomeGui::log_finished); QStringList args; args << name; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); @@ -772,12 +772,12 @@ void MmomeGui::createActions() for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); - connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFiles())); + connect(recentFileActs[i], &QAction::triggered, this, &MmomeGui::openRecentFiles); } exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); - connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); + connect(exitAct, &QAction::triggered, qApp, &QApplication::closeAllWindows); separatorAct = menu_File->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) menu_File->addAction(recentFileActs[i]); separatorAct->setVisible(false); @@ -911,7 +911,7 @@ void MmomeGui::on_actionGraphics_triggered() return; } _plot = new QProcess(this); - connect(_plot, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(plot_finished(int, QProcess::ExitStatus))); + connect(_plot, QOverload::of(&QProcess::finished), this, &MmomeGui::plot_finished); QStringList args; if (plotOptions.isEmpty()) { plotOptions = "-persist"; diff --git a/src/gui/modeleditor.h b/src/gui/modeleditor.h index de825caf..13b2f963 100644 --- a/src/gui/modeleditor.h +++ b/src/gui/modeleditor.h @@ -17,8 +17,7 @@ ******************************************************************************/ -#ifndef MODELEDITOR_H_ -#define MODELEDITOR_H_ +#pragma once #include #include @@ -128,7 +127,6 @@ class ModelEditor : public QDialog, public Ui::ModelEditorForm { void saveAll(void); void saveAs(QString name = QString()); - protected: void reject(){}; @@ -199,5 +197,3 @@ class ModelEditor : public QDialog, public Ui::ModelEditorForm { Utils *_utils; MmoHighlighter *_hl; }; - -#endif /* MODELEDITOR_H_ */