Skip to content

Commit

Permalink
ticket:5274 Added a button to open the transformational debugger dire…
Browse files Browse the repository at this point in the history
…ctly
  • Loading branch information
adeas31 committed Feb 8, 2019
1 parent 51d7b1e commit b09a4f0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 24 additions & 2 deletions OMEdit/OMEditGUI/Simulation/SimulationOutputWidget.cpp
Expand Up @@ -205,6 +205,10 @@ SimulationOutputWidget::SimulationOutputWidget(SimulationOptions simulationOptio
mpCancelButton = new QPushButton(tr("Cancel Compilation"));
mpCancelButton->setEnabled(false);
connect(mpCancelButton, SIGNAL(clicked()), SLOT(cancelCompilationOrSimulation()));
mpOpenTransformationalDebuggerButton = new QToolButton;
mpOpenTransformationalDebuggerButton->setIcon(QIcon(":/Resources/icons/equational-debugger.svg"));
mpOpenTransformationalDebuggerButton->setToolTip(tr("Open Transformational Debugger"));
connect(mpOpenTransformationalDebuggerButton, SIGNAL(clicked()), SLOT(openTransformationalDebugger()));
mpProgressBar = new QProgressBar;
mpProgressBar->setAlignment(Qt::AlignHCenter);
// Generated Files tab widget
Expand Down Expand Up @@ -348,10 +352,11 @@ SimulationOutputWidget::SimulationOutputWidget(SimulationOptions simulationOptio
// layout
QGridLayout *pMainLayout = new QGridLayout;
pMainLayout->setContentsMargins(5, 5, 5, 5);
pMainLayout->addWidget(mpProgressLabel, 0, 0, 1, 2);
pMainLayout->addWidget(mpProgressLabel, 0, 0, 1, 3);
pMainLayout->addWidget(mpProgressBar, 1, 0);
pMainLayout->addWidget(mpCancelButton, 1, 1);
pMainLayout->addWidget(mpGeneratedFilesTabWidget, 2, 0, 1, 2);
pMainLayout->addWidget(mpOpenTransformationalDebuggerButton, 1, 2);
pMainLayout->addWidget(mpGeneratedFilesTabWidget, 2, 0, 1, 3);
setLayout(pMainLayout);
// create the ArchivedSimulationItem
mpArchivedSimulationItem = new ArchivedSimulationItem(mSimulationOptions, this);
Expand Down Expand Up @@ -714,6 +719,23 @@ void SimulationOutputWidget::cancelCompilationOrSimulation()
}
}

/*!
* \brief SimulationOutputWidget::openTransformationalDebugger
* Slot activated when mpOpenTransformationalDebuggerButton clicked SIGNAL is raised.\n
* Opens the transformational debugger.
*/
void SimulationOutputWidget::openTransformationalDebugger()
{
QString fileName = QString("%1/%2_info.json").arg(mSimulationOptions.getWorkingDirectory(), mSimulationOptions.getOutputFileName());
/* open the model_info.json file */
if (QFileInfo(fileName).exists()) {
MainWindow::instance()->showTransformationsWidget(fileName);
} else {
QMessageBox::critical(this, QString("%1 - %2").arg(Helper::applicationName, Helper::error),
GUIMessages::getMessage(GUIMessages::FILE_NOT_FOUND).arg(fileName), Helper::ok);
}
}

/*!
* \brief SimulationOutputWidget::openTransformationBrowser
* Slot activated when a link is clicked from simulation output.\n
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/Simulation/SimulationOutputWidget.h
Expand Up @@ -98,6 +98,7 @@ class SimulationOutputWidget : public QWidget
Label *mpProgressLabel;
QProgressBar *mpProgressBar;
QPushButton *mpCancelButton;
QToolButton *mpOpenTransformationalDebuggerButton;
QTabWidget *mpGeneratedFilesTabWidget;
QList<QString> mGeneratedFilesList;
QList<QString> mGeneratedAlgLoopFilesList;
Expand All @@ -124,6 +125,7 @@ public slots:
void writeSimulationOutput(QString output, StringHandler::SimulationMessageType type, bool textFormat);
void simulationProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void cancelCompilationOrSimulation();
void openTransformationalDebugger();
void openTransformationBrowser(QUrl url);
protected:
virtual void keyPressEvent(QKeyEvent *event);
Expand Down

0 comments on commit b09a4f0

Please sign in to comment.