Skip to content

Commit

Permalink
Load the mo file as MetaModelica when loaded via "Load External Model…
Browse files Browse the repository at this point in the history
…(s)"
  • Loading branch information
adeas31 committed Apr 7, 2017
1 parent 767d9c6 commit c74c1a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -1377,7 +1377,7 @@ void MainWindow::loadExternalModels()
pMessageBox->setStandardButtons(QMessageBox::Ok);
pMessageBox->exec();
} else {
mpLibraryWidget->openFile(file, Helper::utf8, false);
mpLibraryWidget->openFile(file, Helper::utf8, false, false, true);
}
}
mpStatusBar->clearMessage();
Expand Down
5 changes: 3 additions & 2 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -3408,8 +3408,9 @@ LibraryWidget::LibraryWidget(QWidget *pParent)
* \param encoding
* \param showProgress
* \param checkFileExists
* \param loadExternalModel
*/
void LibraryWidget::openFile(QString fileName, QString encoding, bool showProgress, bool checkFileExists)
void LibraryWidget::openFile(QString fileName, QString encoding, bool showProgress, bool checkFileExists, bool loadExternalModel)
{
/* if the file doesn't exist then remove it from the recent files list. */
QFileInfo fileInfo(fileName);
Expand All @@ -3431,7 +3432,7 @@ void LibraryWidget::openFile(QString fileName, QString encoding, bool showProgre
return;
}
}
if (fileInfo.suffix().compare("mo") == 0) {
if (fileInfo.suffix().compare("mo") == 0 && !loadExternalModel) {
openModelicaFile(fileName, encoding, showProgress);
} else if (fileInfo.isDir()) {
openDirectory(fileInfo, showProgress);
Expand Down
3 changes: 2 additions & 1 deletion OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.h
Expand Up @@ -389,7 +389,8 @@ class LibraryWidget : public QWidget
LibraryTreeModel* getLibraryTreeModel() {return mpLibraryTreeModel;}
LibraryTreeProxyModel* getLibraryTreeProxyModel() {return mpLibraryTreeProxyModel;}
LibraryTreeView* getLibraryTreeView() {return mpLibraryTreeView;}
void openFile(QString fileName, QString encoding = Helper::utf8, bool showProgress = true, bool checkFileExists = false);
void openFile(QString fileName, QString encoding = Helper::utf8, bool showProgress = true, bool checkFileExists = false,
bool loadExternalModel = false);
void openModelicaFile(QString fileName, QString encoding = Helper::utf8, bool showProgress = true);
void openCompositeModelOrTextFile(QFileInfo fileInfo, bool showProgress = true);
void openDirectory(QFileInfo fileInfo, bool showProgress = true);
Expand Down

0 comments on commit c74c1a1

Please sign in to comment.