Skip to content

Commit

Permalink
- Updated the version number.
Browse files Browse the repository at this point in the history
- Fixed the temp path issue.
- other minor fixes.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9921 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Sep 24, 2011
1 parent e8d6f21 commit 77b3dfb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 46 deletions.
16 changes: 6 additions & 10 deletions OMEdit/OMEditGUI/OMCProxy.cpp
Expand Up @@ -113,10 +113,6 @@ void OMCProxy::getPreviousCommand()
{
mCurrentCommandIndex += 1;
}
// mpExpressionTextBox->setText(mCommandsList.at(mCommandsList.count() - 1));
// QString tempCommand = mCommandsList.at(mCommandsList.count() - 1);
// mCommandsList.insert(0, tempCommand);
// mCommandsList.removeLast();
}

void OMCProxy::getNextCommand()
Expand All @@ -133,10 +129,6 @@ void OMCProxy::getNextCommand()
{
mCurrentCommandIndex -= 1;
}
// mpExpressionTextBox->setText(mCommandsList.at(0));
// QString tempCommand = mCommandsList.at(0);
// mCommandsList.append(tempCommand);
// mCommandsList.removeFirst();
}

void OMCProxy::addExpressionInCommandMap(QString expression, QString result)
Expand Down Expand Up @@ -169,8 +161,8 @@ bool OMCProxy::startServer()
const char *omhome = getenv("OPENMODELICAHOME");
QString omcPath;
#ifdef WIN32
//if (!omhome)
//throw std::runtime_error(GUIMessages::getMessage(GUIMessages::OPEN_MODELICA_HOME_NOT_FOUND).toLocal8Bit());
if (!omhome)
throw std::runtime_error(GUIMessages::getMessage(GUIMessages::OPEN_MODELICA_HOME_NOT_FOUND).toStdString());
omcPath = QString( omhome ) + "/bin/omc.exe";
#else /* unix */
omcPath = (omhome ? QString(omhome)+"/bin/omc" : QString(CONFIG_DEFAULT_OPENMODELICAHOME) + "/bin/omc");
Expand Down Expand Up @@ -261,8 +253,12 @@ bool OMCProxy::startServer()
QString tmpPath = getResult()+"/OpenModelica/OMEdit/";
tmpPath.remove("\"");
if (!QDir().exists(tmpPath))
{
if (QDir().mkpath(tmpPath))
changeDirectory(tmpPath);
}
else
changeDirectory(tmpPath);
// set the OpenModelicaLibrary variable.
sendCommand("getModelicaPath()");
Helper::OpenModelicaLibrary = StringHandler::removeFirstLastQuotes(getResult());
Expand Down
9 changes: 5 additions & 4 deletions OMEdit/OMEditGUI/main.cpp
Expand Up @@ -53,6 +53,10 @@ int main(int argc, char *argv[])
splashScreen.show();

MainWindow mainwindow(&splashScreen);
if (mainwindow.mExitApplication) { // if there is some issue in running the application.
a.quit();
exit(1);
}
// if user has requested to open the file by passing it in argument then,
if (a.arguments().size() > 1)
{
Expand All @@ -75,8 +79,5 @@ int main(int argc, char *argv[])
mainwindow.show();
// hide the splash screen
splashScreen.finish(&mainwindow);
if (mainwindow.mExitApplication) // if there is some issue in running the application.
return 1;
else
return a.exec();
return a.exec();
}
40 changes: 8 additions & 32 deletions OMEdit/OMEditGUI/mainwindow.cpp
Expand Up @@ -53,6 +53,8 @@ MainWindow::MainWindow(SplashScreen *splashScreen, QWidget *parent)
// Create the OMCProxy object.
splashScreen->showMessage("Connecting to " + Helper::applicationName +" Server", Qt::AlignRight, Qt::white);
mpOMCProxy = new OMCProxy(this);
if (mExitApplication)
return;
splashScreen->showMessage("Reading Settings", Qt::AlignRight, Qt::white);
mpOptionsWidget = new OptionsWidget(this);

Expand Down Expand Up @@ -91,24 +93,12 @@ MainWindow::MainWindow(SplashScreen *splashScreen, QWidget *parent)
messagedock->setWidget(mpMessageWidget);
addDockWidget(Qt::BottomDockWidgetArea, messagedock);
mpMessageWidget->printGUIMessage("OMEdit, " + Helper::applicationVersion);
// If there is some problem connecting to omc server then quit
if (!mExitApplication)
mpMessageWidget->printGUIMessage("OpenModelica, Version: " + mpOMCProxy->getVersion());

mpMessageWidget->printGUIMessage("OpenModelica, Version: " + mpOMCProxy->getVersion());
// load library
mpLibrary = new LibraryWidget(this);
// Set the annotations version to 3.x
if (!mExitApplication)
{
//mpOMCProxy->setAnnotationVersion(OMCProxy::ANNOTATION_VERSION3X);
}
// Loads and adds the OM Standard Library into the Library Widget.
splashScreen->showMessage("Loading Modelica Standard Library", Qt::AlignRight, Qt::white);
// If there is an error while starting OMC then dont load the MSL
if (!mExitApplication)
{
mpLibrary->mpLibraryTree->addModelicaStandardLibrary();
}

mpLibrary->mpLibraryTree->addModelicaStandardLibrary();
//Create a dock for the search MSL
searchMSLdock = new QDockWidget(tr(" Search MSL"), this);
searchMSLdock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
Expand All @@ -117,56 +107,47 @@ MainWindow::MainWindow(SplashScreen *splashScreen, QWidget *parent)
addDockWidget(Qt::LeftDockWidgetArea, searchMSLdock);
connect(searchMSLdock, SIGNAL(visibilityChanged(bool)), SLOT(focusMSLSearch(bool)));
searchMSLdock->hide();

//Create a dock for the componentslibrary
libdock = new QDockWidget(tr(" Components"), this);
libdock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
libdock->setWidget(mpLibrary);
addDockWidget(Qt::LeftDockWidgetArea, libdock);

//create a dock for the model browser
modelBrowserdock = new QDockWidget(tr("Model Browser"), this);
modelBrowserdock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
mpModelBrowser = new ModelBrowserWidget(this);
modelBrowserdock->setWidget(mpModelBrowser);
addDockWidget(Qt::LeftDockWidgetArea, modelBrowserdock);

//Set dock widget corner owner
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);

// Create simulation widget.
mpSimulationWidget = new SimulationWidget(this);

// create the plot container widget
mpPlotWindowContainer = new PlotWindowContainer(this);

// create the interactive simulation widget
mpInteractiveSimualtionTabWidget = new InteractiveSimulationTabWidget(this);

// plot dock
plotdock = new QDockWidget(tr(" Plot Variables"), this);
plotdock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
plotdock->setContentsMargins(0, 1, 1, 1);
mpPlotWidget = new PlotWidget(this);
plotdock->setWidget(mpPlotWidget);
addDockWidget(Qt::RightDockWidgetArea, plotdock);
plotdock->hide();

// plot dock
documentationdock = new QDockWidget(tr(" Documentation"), this);
documentationdock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
documentationdock->setContentsMargins(0, 1, 1, 1);
mpDocumentationWidget = new DocumentationWidget(this);
documentationdock->setWidget(mpDocumentationWidget);
addDockWidget(Qt::RightDockWidgetArea, documentationdock);
documentationdock->hide();

//Create Actions, Toolbar and Menus
splashScreen->showMessage("Creating Components", Qt::AlignRight, Qt::white);
// this->setDragMode(QGraphicsView::RubberBandDrag);
this->setAcceptDrops(true);
this->createActions();
this->createToolbars();
this->createMenus();

//Create the main tab container, need at least one tab
mpProjectTabs = new ProjectTabWidget(this);
mpProjectTabs->setObjectName("projectTabs");
Expand All @@ -179,10 +160,8 @@ MainWindow::MainWindow(SplashScreen *splashScreen, QWidget *parent)
mpBackButton->hide();

mpCentralwidget->setLayout(mpCentralgrid);

//Set the centralwidget
this->setCentralWidget(mpCentralwidget);

//Create the Statusbar
mpStatusBar = new QStatusBar();
mpStatusBar->setObjectName("statusBar");
Expand All @@ -193,13 +172,10 @@ MainWindow::MainWindow(SplashScreen *splashScreen, QWidget *parent)
mpProgressBar->setVisible(false);
mpStatusBar->addPermanentWidget(mpProgressBar);
this->setStatusBar(mpStatusBar);

// mpComponentBrowser = new ComponentBrowserWidget(this);

// Create a New Project Widget
mpModelCreator = new ModelCreator(this);

connect(this, SIGNAL(fileOpen(QString)), mpProjectTabs, SLOT(openFile(QString)));
connect(this, SIGNAL(fileOpen(QString)), mpProjectTabs, SLOT(openFile(QString)));
QMetaObject::connectSlotsByName(this);
}

Expand Down

0 comments on commit 77b3dfb

Please sign in to comment.