Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into oms
Browse files Browse the repository at this point in the history
  • Loading branch information
Adeel Asghar committed May 15, 2018
2 parents b0383b2 + da1155a commit 57f144b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
30 changes: 20 additions & 10 deletions OMEdit/OMEditGUI/Modeling/ModelicaClassDialog.cpp
Expand Up @@ -748,16 +748,6 @@ DuplicateClassDialog::DuplicateClassDialog(bool saveAs, LibraryTreeItem *pLibrar
connect(mpPathBrowseButton, SIGNAL(clicked()), SLOT(browsePath()));
// save contents in one file
mpSaveContentsInOneFileCheckBox = new QCheckBox(Helper::saveContentsInOneFile);
if (mpLibraryTreeItem->getRestriction() == StringHandler::Package) {
mpSaveContentsInOneFileCheckBox->setVisible(true);
if (mpLibraryTreeItem->getSaveContentsType() == LibraryTreeItem::SaveInOneFile) {
mpSaveContentsInOneFileCheckBox->setChecked(true);
} else {
mpSaveContentsInOneFileCheckBox->setChecked(false);
}
} else {
mpSaveContentsInOneFileCheckBox->setVisible(false);
}
// Create the buttons
mpOkButton = new QPushButton(Helper::ok);
mpOkButton->setAutoDefault(true);
Expand Down Expand Up @@ -798,6 +788,26 @@ void DuplicateClassDialog::setSaveContentsTypeAsFolderStructure(LibraryTreeItem
}
}

/*!
* \brief DuplicateClassDialog::exec
* Reimplementation of QDialog::exec
* \return
*/
int DuplicateClassDialog::exec()
{
if (mpLibraryTreeItem->getRestriction() == StringHandler::Package) {
mpSaveContentsInOneFileCheckBox->setVisible(true);
if (mpLibraryTreeItem->getSaveContentsType() == LibraryTreeItem::SaveInOneFile) {
mpSaveContentsInOneFileCheckBox->setChecked(true);
} else {
mpSaveContentsInOneFileCheckBox->setChecked(false);
}
} else {
mpSaveContentsInOneFileCheckBox->setVisible(false);
}
return QDialog::exec();
}

void DuplicateClassDialog::browsePath()
{
LibraryBrowseDialog *pLibraryBrowseDialog = new LibraryBrowseDialog(tr("Select Path"), mpPathTextBox, MainWindow::instance()->getLibraryWidget());
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Modeling/ModelicaClassDialog.h
Expand Up @@ -172,6 +172,7 @@ class DuplicateClassDialog : public QDialog

void setSaveContentsTypeAsFolderStructure(LibraryTreeItem *pLibraryTreeItem);
public slots:
int exec();
void browsePath();
void duplicateClass();
};
Expand Down
13 changes: 13 additions & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -2170,6 +2170,19 @@ bool OMCProxy::translateModel(QString className, QString simualtionParameters)
return res;
}

/*!
* \brief OMCProxy::readSimulationResultSize
* Reads the simulation result size.
* \param fileName
* \return
*/
int OMCProxy::readSimulationResultSize(QString fileName)
{
int size = mpOMCInterface->readSimulationResultSize(fileName);
getErrorString();
return size;
}

/*!
* \brief OMCProxy::readSimulationResultVars
* Reads the simulation result variables from the result file.
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.h
Expand Up @@ -199,6 +199,7 @@ class OMCProxy : public QObject
bool simulate(QString className, QString simualtionParameters);
bool buildModel(QString className, QString simualtionParameters);
bool translateModel(QString className, QString simualtionParameters);
int readSimulationResultSize(QString fileName);
QStringList readSimulationResultVars(QString fileName);
bool closeSimulationResultFile();
QString checkModel(QString className);
Expand Down
6 changes: 5 additions & 1 deletion OMEdit/OMEditGUI/Simulation/SimulationDialog.cpp
Expand Up @@ -1694,8 +1694,12 @@ void SimulationDialog::simulationProcessFinished(SimulationOptions simulationOpt
// read the result file
QFileInfo resultFileInfo(QString(workingDirectory).append("/").append(simulationOptions.getResultFileName()));
QRegExp regExp("\\b(mat|plt|csv)\\b");
/* ticket:4935 Check the simulation result size via readSimulationResultSize
* If the result size is zero then don't switch to the plotting view.
*/
if (regExp.indexIn(simulationOptions.getResultFileName()) != -1 &&
resultFileInfo.exists() && resultFileLastModifiedDateTime <= resultFileInfo.lastModified()) {
resultFileInfo.exists() && resultFileLastModifiedDateTime <= resultFileInfo.lastModified() &&
MainWindow::instance()->getOMCProxy()->readSimulationResultSize(resultFileInfo.absoluteFilePath()) > 0) {
VariablesWidget *pVariablesWidget = MainWindow::instance()->getVariablesWidget();
OMCProxy *pOMCProxy = MainWindow::instance()->getOMCProxy();
QStringList list = pOMCProxy->readSimulationResultVars(resultFileInfo.absoluteFilePath());
Expand Down

0 comments on commit 57f144b

Please sign in to comment.