Skip to content

Commit

Permalink
ticket:4806 pass correct library name to loadModel
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Apr 23, 2018
1 parent 072b5c8 commit a31e907
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -1442,27 +1442,28 @@ void MainWindow::loadSystemLibrary()
QAction *pAction = qobject_cast<QAction*>(sender());
if (pAction) {
/* check if library is already loaded. */
QString library = pAction->data().toString();
LibraryTreeModel *pLibraryTreeModel = mpLibraryWidget->getLibraryTreeModel();
if (pLibraryTreeModel->findLibraryTreeItemOneLevel(pAction->text())) {
if (pLibraryTreeModel->findLibraryTreeItemOneLevel(library)) {
QMessageBox *pMessageBox = new QMessageBox(this);
pMessageBox->setWindowTitle(QString(Helper::applicationName).append(" - ").append(Helper::information));
pMessageBox->setIcon(QMessageBox::Information);
pMessageBox->setAttribute(Qt::WA_DeleteOnClose);
pMessageBox->setText(QString(GUIMessages::getMessage(GUIMessages::UNABLE_TO_LOAD_FILE).arg(pAction->text())));
pMessageBox->setText(QString(GUIMessages::getMessage(GUIMessages::UNABLE_TO_LOAD_FILE).arg(library)));
pMessageBox->setInformativeText(QString(GUIMessages::getMessage(GUIMessages::REDEFINING_EXISTING_CLASSES))
.arg(pAction->text()).append("\n")
.append(GUIMessages::getMessage(GUIMessages::DELETE_AND_LOAD).arg(pAction->text())));
.arg(library).append("\n")
.append(GUIMessages::getMessage(GUIMessages::DELETE_AND_LOAD).arg(library)));
pMessageBox->setStandardButtons(QMessageBox::Ok);
pMessageBox->exec();
} else { /* if library is not loaded then load it. */
mpProgressBar->setRange(0, 0);
showProgressBar();
mpStatusBar->showMessage(QString(Helper::loading).append(": ").append(pAction->text()));
mpStatusBar->showMessage(QString(Helper::loading).append(": ").append(library));

if (pAction->text().compare("OpenModelica") == 0) {
pLibraryTreeModel->createLibraryTreeItem(pAction->text(), pLibraryTreeModel->getRootLibraryTreeItem(), true, true, true);
if (library.compare("OpenModelica") == 0) {
pLibraryTreeModel->createLibraryTreeItem(library, pLibraryTreeModel->getRootLibraryTreeItem(), true, true, true);
pLibraryTreeModel->checkIfAnyNonExistingClassLoaded();
} else if (mpOMCProxy->loadModel(pAction->text())) {
} else if (mpOMCProxy->loadModel(library)) {
mpLibraryWidget->getLibraryTreeModel()->loadDependentLibraries(mpOMCProxy->getClassNames());
}
mpStatusBar->clearMessage();
Expand Down Expand Up @@ -3296,6 +3297,7 @@ void MainWindow::createMenus()
libraries.sort();
for (int i = 0; i < libraries.size(); ++i) {
QAction *pAction = new QAction(libraries[i], this);
pAction->setData(libraries[i]);
if (libraries[i].compare("Modelica") == 0) {
pAction->setShortcut(QKeySequence("Ctrl+m"));
}
Expand Down

0 comments on commit a31e907

Please sign in to comment.