Skip to content

Commit

Permalink
Browse button for external TLM start scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
robbr48 authored and adeas31 committed Sep 4, 2019
1 parent a1c86e5 commit d20fefb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion OMEdit/OMEdit/OMEditGUI/OMS/ModelDialog.cpp
Expand Up @@ -285,6 +285,9 @@ AddSubModelDialog::AddSubModelDialog(GraphicsView *pGraphicsView)
// start script
mpStartScriptLabel = new Label(Helper::startScript);
mpStartScriptTextBox = new QLineEdit;
mpBrowseStartScriptButton = new QPushButton(Helper::browse);
mpBrowseStartScriptButton->setAutoDefault(false);
connect(mpBrowseStartScriptButton, SIGNAL(clicked()), SLOT(browseStartScript()));
// buttons
mpOkButton = new QPushButton(Helper::ok);
mpOkButton->setAutoDefault(true);
Expand All @@ -308,7 +311,8 @@ AddSubModelDialog::AddSubModelDialog(GraphicsView *pGraphicsView)
pMainLayout->addWidget(mpBrowsePathButton, 3, 2);
if(mpGraphicsView->getModelWidget()->getLibraryTreeItem()->isTLMSystem()) {
pMainLayout->addWidget(mpStartScriptLabel, 4, 0);
pMainLayout->addWidget(mpStartScriptTextBox, 4, 1, 1, 2);
pMainLayout->addWidget(mpStartScriptTextBox, 4, 1);
pMainLayout->addWidget(mpBrowseStartScriptButton,4,2);
}
pMainLayout->addWidget(mpButtonBox, 5, 0, 1, 3, Qt::AlignRight);
setLayout(pMainLayout);
Expand All @@ -329,6 +333,16 @@ void AddSubModelDialog::browseSubModelPath()
NULL, fileTypes, NULL));
}

/*!
* \brief AddSubModelDialog::browseStartScript
* Slot activated when mpBrowseSubModelPathButton clicked signal is raised.\n
* Allows the user to select the start script path
*/
void AddSubModelDialog::browseStartScript()
{
mpStartScriptTextBox->setText(StringHandler::getOpenFileName(this, QString("%1 - %2").arg(Helper::applicationName, Helper::chooseFile)));
}

/*!
* \brief AddSubModelDialog::addSubModel
* Adds a submodel to the OMSimulator model.
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEdit/OMEditGUI/OMS/ModelDialog.h
Expand Up @@ -111,11 +111,13 @@ class AddSubModelDialog : public QDialog
QPushButton *mpBrowsePathButton;
Label *mpStartScriptLabel;
QLineEdit *mpStartScriptTextBox;
QPushButton *mpBrowseStartScriptButton;
QPushButton *mpOkButton;
QPushButton *mpCancelButton;
QDialogButtonBox *mpButtonBox;
private slots:
void browseSubModelPath();
void browseStartScript();
void addSubModel();
};

Expand Down

0 comments on commit d20fefb

Please sign in to comment.