Skip to content

Commit

Permalink
-Push the change on the stack iff the user has changed the simulation…
Browse files Browse the repository at this point in the history
… parameters
  • Loading branch information
alash325 committed Mar 17, 2016
1 parent 45f5779 commit a3b1abd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion OMEdit/OMEditGUI/Editors/MetaModelEditor.h
Expand Up @@ -75,7 +75,6 @@ class MetaModelEditor : public BaseEditor
void updateSubModelParameters(QString name, QString startCommand, QString exactStepFlag);
bool createConnection(QString From, QString To, QString delay, QString alpha, QString zf, QString zfr, QString points);
void updateConnection(QString fromSubModel, QString toSubModel, QString points);
bool addSimulationParams(QString startTime, QString stopTime);
void updateSimulationParams(QString startTime, QString stopTime);
bool isSimulationParams();
QString getSimulationStartTime();
Expand Down
14 changes: 8 additions & 6 deletions OMEdit/OMEditGUI/TLM/TLMCoSimulationDialog.cpp
Expand Up @@ -403,7 +403,6 @@ MetaModelSimulationParamsDialog::MetaModelSimulationParamsDialog(GraphicsView *p
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(QString("%1 - %2 - %3").arg(Helper::applicationName).arg(Helper::simulationParams)
.arg(pGraphicsView->getModelWidget()->getLibraryTreeItem()->getNameStructure()));
setMinimumWidth(400);
mpGraphicsView = pGraphicsView;
mpLibraryTreeItem = mpGraphicsView->getModelWidget()->getModelWidgetContainer()->getCurrentModelWidget()->getLibraryTreeItem();
// Initialize simulation parameters
Expand Down Expand Up @@ -454,11 +453,14 @@ MetaModelSimulationParamsDialog::MetaModelSimulationParamsDialog(GraphicsView *p
void MetaModelSimulationParamsDialog::saveSimulationParams()
{
if (validateSimulationParams()) {
UpdateSimulationParamsCommand *pUpdateSimulationParamsCommand;
pUpdateSimulationParamsCommand = new UpdateSimulationParamsCommand(mpLibraryTreeItem, mOldStartTime, mpStartTimeTextBox->text()
, mOldStopTime, mpStopTimeTextBox->text());
mpLibraryTreeItem->getModelWidget()->getUndoStack()->push(pUpdateSimulationParamsCommand);
mpLibraryTreeItem->getModelWidget()->updateModelText();
// If user has changed the simulation parameters then push the change on the stack.
if(!mOldStartTime.compare(mpStartTimeTextBox->text())== 0 || !mOldStopTime.compare(mpStopTimeTextBox->text())== 0) {
UpdateSimulationParamsCommand *pUpdateSimulationParamsCommand;
pUpdateSimulationParamsCommand = new UpdateSimulationParamsCommand(mpLibraryTreeItem, mOldStartTime, mpStartTimeTextBox->text(),
mOldStopTime, mpStopTimeTextBox->text());
mpLibraryTreeItem->getModelWidget()->getUndoStack()->push(pUpdateSimulationParamsCommand);
mpLibraryTreeItem->getModelWidget()->updateModelText();
}
accept();
}
}
Expand Down

0 comments on commit a3b1abd

Please sign in to comment.