Skip to content

Commit

Permalink
Changed the checkModel dialog to textbox.
Browse files Browse the repository at this point in the history
Changed the usermanual path for unix users.
Removed the extra omc instance used for library loading.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7118 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Nov 19, 2010
1 parent b7290ea commit ae489aa
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 30 deletions.
10 changes: 5 additions & 5 deletions OMEdit/OMEditGUI/Component.cpp
Expand Up @@ -217,12 +217,12 @@ Component::~Component()
delete shape;

// delete the list of all components
foreach(Component *component, mpComponentsList)
delete component;
// foreach(Component *component, mpComponentsList)
// delete component;

// delete the list of all inherited components
foreach(Component *component, mpInheritanceList)
delete component;
// // delete the list of all inherited components
// foreach(Component *component, mpInheritanceList)
// delete component;
}

//! Parses the result of getIconAnnotation command.
Expand Down
18 changes: 12 additions & 6 deletions OMEdit/OMEditGUI/LibraryWidget.cpp
Expand Up @@ -335,6 +335,7 @@ LibraryTree::LibraryTree(LibraryWidget *pParent)
connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(expandLib(QTreeWidgetItem*)));
connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(collapseLib(QTreeWidgetItem*)));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(showComponent(QTreeWidgetItem*,int)));
}

LibraryTree::~LibraryTree()
Expand Down Expand Up @@ -563,10 +564,19 @@ void LibraryTree::showContextMenu(QPoint point)
}
}

void LibraryTree::showComponent(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column);
mpParentLibraryWidget->mSelectedLibraryNode = item;
showComponent();
}

void LibraryTree::showComponent()
{
ProjectTabWidget *pProjectTabs = mpParentLibraryWidget->mpParentMainWindow->mpProjectTabs;
setCursor(Qt::WaitCursor);
pProjectTabs->addDiagramViewTab(mpParentLibraryWidget->mSelectedLibraryNode, 0);
unsetCursor();
}

void LibraryTree::viewDocumentation()
Expand All @@ -587,9 +597,9 @@ void LibraryTree::checkLibraryModel()
void LibraryTree::loadingLibraryComponent(QTreeWidgetItem *treeNode, QString className)
{
QString result;
result = mpParentLibraryWidget->mpLibraryLoaderOMCProxy->getIconAnnotation(className);
result = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getIconAnnotation(className);
LibraryComponent *libComponent = new LibraryComponent(result, className,
mpParentLibraryWidget->mpLibraryLoaderOMCProxy);
mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy);

treeNode->setIcon(0, QIcon(libComponent->getComponentPixmap(Helper::iconSize)));
mpParentLibraryWidget->addComponentObject(libComponent);
Expand Down Expand Up @@ -660,10 +670,6 @@ LibraryWidget::LibraryWidget(MainWindow *parent)
mpGrid->setContentsMargins(0, 0, 0, 0);
mpGrid->addWidget(mpLibraryTabs);

// create an OMC Instance for library loading thread
mpLibraryLoaderOMCProxy = new OMCProxy(mpParentMainWindow, false);
mpLibraryLoaderOMCProxy->loadStandardLibrary();

setLayout(mpGrid);
}

Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/LibraryWidget.h
Expand Up @@ -138,6 +138,7 @@ private slots:
void expandLib(QTreeWidgetItem *item);
void collapseLib(QTreeWidgetItem *item);
void showContextMenu(QPoint point);
void showComponent(QTreeWidgetItem *item, int column);
void showComponent();
void viewDocumentation();
void checkLibraryModel();
Expand All @@ -153,7 +154,6 @@ class LibraryWidget : public QWidget
LibraryTree *mpLibraryTree;
ModelicaTree *mpModelicaTree;
QTabWidget *mpLibraryTabs;
OMCProxy *mpLibraryLoaderOMCProxy;
//Member functions
LibraryWidget(MainWindow *parent = 0);
~LibraryWidget();
Expand Down
3 changes: 2 additions & 1 deletion OMEdit/OMEditGUI/ModelWidget.cpp
Expand Up @@ -597,7 +597,8 @@ CheckModelWidget::CheckModelWidget(QString name, QString nameStructure, MainWind
setMinimumSize(300, 100);
setModal(true);

mpCheckResultLabel = new QLabel(tr(""));
mpCheckResultLabel = new QTextEdit(tr(""));
mpCheckResultLabel->setReadOnly(true);
mpCheckResultLabel->setText(StringHandler::removeFirstLastQuotes(
mpParentMainWindow->mpOMCProxy->checkModel(mNameStructure)));
// Create the button
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/ModelWidget.h
Expand Up @@ -161,7 +161,7 @@ class CheckModelWidget : public QDialog
private:
QString mName;
QString mNameStructure;
QLabel *mpCheckResultLabel;
QTextEdit *mpCheckResultLabel;
QPushButton *mpOkButton;
};

Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/ModelicaEditor.cpp
Expand Up @@ -37,6 +37,8 @@ ModelicaEditor::ModelicaEditor(ProjectTab *pParent)
: QTextEdit(pParent)
{
mpParentProjectTab = pParent;
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
connect(this, SIGNAL(focusOut()), mpParentProjectTab, SLOT(ModelicaEditorTextChanged()));
}

Expand Down
25 changes: 18 additions & 7 deletions OMEdit/OMEditGUI/ProjectTabWidget.cpp
Expand Up @@ -1148,8 +1148,6 @@ ProjectTabWidget::ProjectTabWidget(MainWindow *parent)
connect(mpParentMainWindow->zoomInAction, SIGNAL(triggered()),this,SLOT(zoomIn()));
connect(mpParentMainWindow->zoomOutAction, SIGNAL(triggered()),this,SLOT(zoomOut()));
connect(mpParentMainWindow->mpLibrary->mpModelicaTree, SIGNAL(nodeDeleted()), SLOT(updateTabIndexes()));
connect(mpParentMainWindow->mpLibrary->mpLibraryTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
SLOT(addDiagramViewTab(QTreeWidgetItem*,int)));
}

ProjectTabWidget::~ProjectTabWidget()
Expand Down Expand Up @@ -1298,14 +1296,12 @@ void ProjectTabWidget::addDiagramViewTab(QTreeWidgetItem *item, int column)
newTab->mModelNameStructure = treeNode->mNameStructure;
newTab->mTabPosition = addTab(newTab, StringHandler::getLastWordAfterDot(treeNode->mNameStructure));

mpParentMainWindow->setCursor(Qt::WaitCursor);
Component *diagram;
QString result = mpParentMainWindow->mpOMCProxy->getDiagramAnnotation(treeNode->toolTip(0));
diagram = new Component(result, newTab->mModelNameStructure, newTab->mModelNameStructure,
QPointF (0,0), StringHandler::DIAGRAM, false, mpParentMainWindow->mpOMCProxy,
newTab->mpDiagramGraphicsView);
setCurrentWidget(newTab);
mpParentMainWindow->unsetCursor();
}

//! Saves current project.
Expand Down Expand Up @@ -1563,7 +1559,12 @@ void ProjectTabWidget::resetZoom()
{
ProjectTab *pCurrentTab = getCurrentTab();
if (pCurrentTab)
pCurrentTab->mpGraphicsView->resetZoom();
{
if (pCurrentTab->mpGraphicsView->isVisible())
pCurrentTab->mpGraphicsView->resetZoom();
else if (pCurrentTab->mpDiagramGraphicsView->isVisible())
pCurrentTab->mpDiagramGraphicsView->resetZoom();
}
}

//! Tells the current tab to increase its zoom factor.
Expand All @@ -1573,7 +1574,12 @@ void ProjectTabWidget::zoomIn()
{
ProjectTab *pCurrentTab = getCurrentTab();
if (pCurrentTab)
pCurrentTab->mpGraphicsView->zoomIn();
{
if (pCurrentTab->mpGraphicsView->isVisible())
pCurrentTab->mpGraphicsView->zoomIn();
else if (pCurrentTab->mpDiagramGraphicsView->isVisible())
pCurrentTab->mpDiagramGraphicsView->zoomIn();
}
}

//! Tells the current tab to decrease its zoom factor.
Expand All @@ -1583,7 +1589,12 @@ void ProjectTabWidget::zoomOut()
{
ProjectTab *pCurrentTab = getCurrentTab();
if (pCurrentTab)
pCurrentTab->mpGraphicsView->zoomOut();
{
if (pCurrentTab->mpGraphicsView->isVisible())
pCurrentTab->mpGraphicsView->zoomOut();
else if (pCurrentTab->mpDiagramGraphicsView->isVisible())
pCurrentTab->mpDiagramGraphicsView->zoomOut();
}
}

void ProjectTabWidget::updateTabIndexes()
Expand Down
21 changes: 12 additions & 9 deletions OMEdit/OMEditGUI/mainwindow.cpp
Expand Up @@ -174,9 +174,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
// Close the OMC Connection
this->mpOMCProxy->stopServer();
delete mpOMCProxy;
// Close the Library Loader OMC Connection
this->mpLibrary->mpLibraryLoaderOMCProxy->stopServer();
delete this->mpLibrary->mpLibraryLoaderOMCProxy;
event->accept();
}
else
Expand Down Expand Up @@ -424,11 +421,6 @@ void MainWindow::createToolbars()
// editToolBar->addAction(copyAction);
// editToolBar->addAction(pasteAction);

simulationToolBar = addToolBar(tr("Simulation"));
simulationToolBar->setAllowedAreas(Qt::TopToolBarArea);
simulationToolBar->addAction(simulationAction);
simulationToolBar->addAction(plotAction);

viewToolBar = addToolBar(tr("View Toolbar"));
viewToolBar->setAllowedAreas(Qt::TopToolBarArea);
viewToolBar->addAction(gridLinesAction);
Expand All @@ -438,6 +430,11 @@ void MainWindow::createToolbars()
viewToolBar->addAction(zoomOutAction);
viewToolBar->addSeparator();
viewToolBar->addAction(checkModelAction);

simulationToolBar = addToolBar(tr("Simulation"));
simulationToolBar->setAllowedAreas(Qt::TopToolBarArea);
simulationToolBar->addAction(simulationAction);
simulationToolBar->addAction(plotAction);
}

//! Open Simulation Window
Expand Down Expand Up @@ -553,8 +550,14 @@ void MainWindow::checkModel()

void MainWindow::openUserManual()
{
QString userManualPath = QString(Helper::OpenModelicaHome.replace("\\", "/"))
QString userManualPath;
#ifdef WIN32
userManualPath = QString(Helper::OpenModelicaHome.replace("\\", "/"))
.append("/share/omedit/OMEdit-UserManual.pdf");
#else
userManualPath = QString(Helper::OpenModelicaHome.replace("\\", "/"))
.append("/share/doc/omedit/OMEdit-UserManual.pdf");
#endif
QDesktopServices::openUrl(userManualPath);
}

Expand Down

0 comments on commit ae489aa

Please sign in to comment.