Skip to content

Commit

Permalink
Added the user manual and about OMEdit in the OMEdit menu.
Browse files Browse the repository at this point in the history
Created a doc folder and added the documentation files in it.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7099 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Nov 18, 2010
1 parent ad219ab commit d80f5a8
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 22 deletions.
14 changes: 7 additions & 7 deletions OMEdit/OMEditGUI/IconProperties.cpp
Expand Up @@ -434,18 +434,18 @@ void IconAttributes::updateIconAttributes()

OMCProxy *pOMCProxy = pCurrentTab->mpParentProjectTabWidget->mpParentMainWindow->mpOMCProxy;
MessageWidget *pMessageWidget = pCurrentTab->mpParentProjectTabWidget->mpParentMainWindow->mpMessageWidget;
// update the component comment
if (!pOMCProxy->setComponentComment(modelName, componentName, mpCommentTextBox->text().trimmed()))
{
pMessageWidget->printGUIErrorMessage(QString(GUIMessages::getMessage(GUIMessages::COMMENT_SAVE_ERROR))
.arg(pOMCProxy->getErrorString()));
}

// update component attributes
if (!pOMCProxy->setComponentProperties(modelName, componentName, isFinal, mIsFlow, isProtected, isReplaceAble,
variability, isInner, isOuter, causality))
{
pMessageWidget->printGUIErrorMessage(QString(GUIMessages::getMessage(GUIMessages::ATTRIBUTES_SAVE_ERROR))
.arg(pOMCProxy->getErrorString()));
}
// update the component comment
if (!pOMCProxy->setComponentComment(modelName, componentName, mpCommentTextBox->text().trimmed()))
{
pMessageWidget->printGUIErrorMessage(QString(GUIMessages::getMessage(GUIMessages::COMMENT_SAVE_ERROR))
.arg(pOMCProxy->getErrorString()));
}
accept();
}
24 changes: 19 additions & 5 deletions OMEdit/OMEditGUI/ProjectTabWidget.cpp
Expand Up @@ -1561,23 +1561,29 @@ void ProjectTabWidget::openModel()
//! @see zoomOut()
void ProjectTabWidget::resetZoom()
{
this->getCurrentTab()->mpGraphicsView->resetZoom();
ProjectTab *pCurrentTab = getCurrentTab();
if (pCurrentTab)
pCurrentTab->mpGraphicsView->resetZoom();
}

//! Tells the current tab to increase its zoom factor.
//! @see resetZoom()
//! @see zoomOut()
void ProjectTabWidget::zoomIn()
{
this->getCurrentTab()->mpGraphicsView->zoomIn();
ProjectTab *pCurrentTab = getCurrentTab();
if (pCurrentTab)
pCurrentTab->mpGraphicsView->zoomIn();
}

//! Tells the current tab to decrease its zoom factor.
//! @see resetZoom()
//! @see zoomIn()
void ProjectTabWidget::zoomOut()
{
this->getCurrentTab()->mpGraphicsView->zoomOut();
ProjectTab *pCurrentTab = getCurrentTab();
if (pCurrentTab)
pCurrentTab->mpGraphicsView->zoomOut();
}

void ProjectTabWidget::updateTabIndexes()
Expand All @@ -1592,7 +1598,11 @@ void ProjectTabWidget::enableProjectToolbar()
{
if (!mToolBarEnabled)
{
mpParentMainWindow->viewToolBar->setEnabled(true);
mpParentMainWindow->gridLinesAction->setEnabled(true);
mpParentMainWindow->resetZoomAction->setEnabled(true);
mpParentMainWindow->zoomInAction->setEnabled(true);
mpParentMainWindow->zoomOutAction->setEnabled(true);
mpParentMainWindow->checkModelAction->setEnabled(true);
mToolBarEnabled = true;
}
}
Expand All @@ -1601,7 +1611,11 @@ void ProjectTabWidget::disableProjectToolbar()
{
if (mToolBarEnabled and (count() == 0))
{
mpParentMainWindow->viewToolBar->setEnabled(false);
mpParentMainWindow->gridLinesAction->setEnabled(false);
mpParentMainWindow->resetZoomAction->setEnabled(false);
mpParentMainWindow->zoomInAction->setEnabled(false);
mpParentMainWindow->zoomOutAction->setEnabled(false);
mpParentMainWindow->checkModelAction->setEnabled(false);
mToolBarEnabled = false;
}
}
63 changes: 53 additions & 10 deletions OMEdit/OMEditGUI/mainwindow.cpp
Expand Up @@ -286,6 +286,14 @@ void MainWindow::createActions()
documentationAction = documentationdock->toggleViewAction();
documentationAction->setIcon(QIcon(":/Resources/icons/plot.png"));
documentationAction->setText(tr("View Documentation"));

userManualAction = new QAction(tr("User Manual"), this);
userManualAction->setStatusTip(tr("Open the User Manual"));
connect(userManualAction, SIGNAL(triggered()), SLOT(openUserManual()));

aboutAction = new QAction(tr("About OMEdit"), this);
aboutAction->setStatusTip(tr("Information about OMEdit"));
connect(aboutAction, SIGNAL(triggered()), SLOT(openAbout()));
}

//! Creates the menus
Expand Down Expand Up @@ -317,6 +325,9 @@ void MainWindow::createMenus()
menuTools = new QMenu(menubar);
menuTools->setTitle("&Tools");

menuHelp = new QMenu(menubar);
menuHelp->setTitle("&Help");

this->setMenuBar(menubar);

//Add the actionbuttons to the menues
Expand Down Expand Up @@ -351,25 +362,31 @@ void MainWindow::createMenus()
menuView->addAction(libAction);
menuView->addAction(messageAction);
menuView->addAction(fileToolBar->toggleViewAction());
menuView->addAction(editToolBar->toggleViewAction());
menuView->addAction(documentationAction);
//menuView->addAction(editToolBar->toggleViewAction());
//menuView->addAction(documentationAction);
menuView->addSeparator();
menuView->addAction(gridLinesAction);
menuView->addAction(resetZoomAction);
menuView->addAction(zoomInAction);
menuView->addAction(zoomOutAction);
menuView->addSeparator();
menuView->addAction(checkModelAction);

menuSimulation->addAction(simulationAction);
menuSimulation->addAction(plotAction);

menuTools->addAction(omcLoggerAction);
menuTools->addAction(openOMShellAction);

menuHelp->addAction(userManualAction);
menuHelp->addAction(aboutAction);

menubar->addAction(menuFile->menuAction());
menubar->addAction(menuEdit->menuAction());
menubar->addAction(menuView->menuAction());
menubar->addAction(menuSimulation->menuAction());
menubar->addAction(menuTools->menuAction());
menubar->addAction(menuHelp->menuAction());
}

//! Creates the toolbars
Expand Down Expand Up @@ -399,13 +416,13 @@ void MainWindow::createToolbars()
fileToolBar->addAction(saveAsAction);
//fileToolBar->addAction(saveAllAction);

editToolBar = addToolBar(tr("Clipboard Toolbar"));
editToolBar->setAllowedAreas(Qt::TopToolBarArea);
// editToolBar = addToolBar(tr("Clipboard Toolbar"));
// editToolBar->setAllowedAreas(Qt::TopToolBarArea);
//editToolBar->addAction(undoAction);
//editToolBar->addAction(redoAction);
editToolBar->addAction(cutAction);
editToolBar->addAction(copyAction);
editToolBar->addAction(pasteAction);
// editToolBar->addAction(cutAction);
// editToolBar->addAction(copyAction);
// editToolBar->addAction(pasteAction);

simulationToolBar = addToolBar(tr("Simulation"));
simulationToolBar->setAllowedAreas(Qt::TopToolBarArea);
Expand Down Expand Up @@ -478,7 +495,7 @@ void MainWindow::openOMShell()

if (omShellPath.isEmpty())
{
QMessageBox::warning( this, "Error", GUIMessages::getMessage(GUIMessages::OPEN_MODELICA_HOME_NOT_FOUND), "OK" );
QMessageBox::warning( this, "Error", GUIMessages::getMessage(GUIMessages::OPEN_MODELICA_HOME_NOT_FOUND), "OK");
return;
}

Expand Down Expand Up @@ -528,16 +545,42 @@ void MainWindow::checkModel()
ProjectTab *pCurrentTab = mpProjectTabs->getCurrentTab();
if (pCurrentTab)
{
CheckModelWidget *widget = new CheckModelWidget(pCurrentTab->mModelName, pCurrentTab->mModelNameStructure, this);
CheckModelWidget *widget = new CheckModelWidget(pCurrentTab->mModelName, pCurrentTab->mModelNameStructure,
this);
widget->show();
}
}

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

void MainWindow::openAbout()
{
const char* dateStr = __DATE__; // "Mmm dd yyyy", so dateStr+7 = "yyyy"
QString OMCVersion = mpOMCProxy->getVersion();
QString aboutText = QString("OMEdit - ").append(Helper::applicationIntroText).append(" ")
.append(Helper::applicationVersion).append(" Copyright ").append(dateStr + 7)
.append(" Link").append(QChar(246, 0)).append("ping University.\n")
.append("Distributed under OSMC-PL and GPL, see www.openmodelica.org.\n\n")
.append("Connected to OpenModelica ").append(OMCVersion).append("\n")
.append("Created by Syed Adeel Asghar and Sonia Tariq as part of their final thesis.\n\n")
.append("Supervisor: Dr. Mohsen Torabzadeh-Tari\n")
.append("Advisor: Martin Sj").append(QChar(246, 0)).append("lund\n")
.append("Examiner: Prof. Peter Fritzson\n\n")
.append("Special Thanks to Adrian Pop for helping in OMC related issues.");

QMessageBox::about(this, QString("About ").append(Helper::applicationName), aboutText);
}

void MainWindow::disableMainWindow(bool disable)
{
menubar->setDisabled(disable);
fileToolBar->setDisabled(disable);
editToolBar->setDisabled(disable);
//editToolBar->setDisabled(disable);
simulationToolBar->setDisabled(disable);
viewToolBar->setDisabled(disable);
mpLibrary->setDisabled(disable);
Expand Down
5 changes: 5 additions & 0 deletions OMEdit/OMEditGUI/mainwindow.h
Expand Up @@ -101,6 +101,7 @@ class MainWindow : public QMainWindow
QMenu *menuView;
QMenu *menuTools;
QMenu *menuSimulation;
QMenu *menuHelp;
MessageWidget *mpMessageWidget;
QStatusBar *statusBar;
QPushButton *mpBackButton;
Expand Down Expand Up @@ -132,6 +133,8 @@ class MainWindow : public QMainWindow
QAction *simulationAction;
QAction *plotAction;
QAction *documentationAction;
QAction *userManualAction;
QAction *aboutAction;

QToolBar *fileToolBar;
QToolBar *editToolBar;
Expand All @@ -155,6 +158,8 @@ private slots:
void openNewPackage();
void openOMShell();
void checkModel();
void openUserManual();
void openAbout();
public slots:
void disableMainWindow(bool disable);
private:
Expand Down

0 comments on commit d80f5a8

Please sign in to comment.