Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x05andfe committed Apr 11, 2006
1 parent ffe0f3c commit a540fb5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
20 changes: 10 additions & 10 deletions OMShell/QWinMosh.vcproj
Expand Up @@ -249,6 +249,15 @@
Name="Generated Files"
Filter="moc;h;cpp"
UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}">
<File
RelativePath=".\generatedfiles\release\moc_omc_communicator.cpp">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath=".\generatedfiles\debug\moc_omc_communicator.cpp">
<FileConfiguration
Expand All @@ -266,7 +275,7 @@
</FileConfiguration>
</File>
<File
RelativePath=".\generatedfiles\release\moc_omc_communicator.cpp">
RelativePath=".\GeneratedFiles\release\moc_oms.cpp">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
Expand All @@ -290,15 +299,6 @@
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\GeneratedFiles\release\moc_oms.cpp">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath=".\GeneratedFiles\qrc_oms.cpp">
</File>
Expand Down
46 changes: 27 additions & 19 deletions OMShell/oms.cpp
Expand Up @@ -256,6 +256,9 @@ OMS::OMS( QWidget* parent )
createMenu();
createToolbar();

connect( this, SIGNAL( emitQuit() ),
qApp, SLOT( quit() ));

// start server
startServer();

Expand All @@ -265,9 +268,6 @@ OMS::OMS( QWidget* parent )
setWindowIcon( QIcon(":/Resources/OMS.bmp") );
statusBar()->showMessage( tr("Ready") );

connect( this, SIGNAL( emitQuit() ),
qApp, SLOT( quit() ));

// sett start message
cursor_.insertText( "OpenModelica 1.3.2\n", textFormat_ );
cursor_.insertText( "Copyright 2002-2006, PELAB, Linkoping University\n\n", textFormat_ );
Expand Down Expand Up @@ -627,6 +627,7 @@ void OMS::returnPressed()
// send command to OMC
if( delegate_ )
{
eval:
// 2006-02-02 AF, Added try-catch
try
{
Expand Down Expand Up @@ -668,7 +669,14 @@ void OMS::returnPressed()
else
{
QTextCursor cursor = moshError_->textCursor();
cursor.insertText("[ERROR] No OMC serer started\n" );

if( startServer() )
{
cursor.insertText("[ERROR] No OMC serer started - restarted OMC\n" );
goto eval;
}
else
cursor.insertText("[ERROR] No OMC serer started - unable to restart OMC\n" );
}

// add new command line
Expand Down Expand Up @@ -924,17 +932,20 @@ void OMS::exit()
// check if omc is running, if so: ask if it is ok that omc also closes.
try
{
delegate_->closeConnection();
delegate_->reconnect();

int result = QMessageBox::question( 0, tr("Close OMC"),
"OK to quit running OpenModelica Compiler process at exit?\n(Answer No if other OMShell/OMNotebook/Graphic editor is still running)",
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No );
if( delegate_ )
{
delegate_->closeConnection();
delegate_->reconnect();

int result = QMessageBox::question( 0, tr("Close OMC"),
"OK to quit running OpenModelica Compiler process at exit?\n(Answer No if other OMShell/OMNotebook/Graphic editor is still running)",
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No );

if( result == QMessageBox::Yes )
{
stopServer();
if( result == QMessageBox::Yes )
{
stopServer();
}
}
}
catch(exception e)
Expand Down Expand Up @@ -1049,21 +1060,18 @@ bool OMS::startServer()
{
if( !IAEX::OmcInteractiveEnvironment::startOMC() )
{
QMessageBox::critical( 0, "OMC Error", "Was unable to start OMC, therefore OMShell will close." );
exit();
QMessageBox::critical( 0, "OMC Error", "Was unable to start OMC, therefore OMShell will not work correctly." );
}
else
{
// 2006-03-14 AF, wait before trying to reconnect,
// give OMC time to start up
SleeperThread::msleep( 1000 );

delegate_ = new IAEX::OmcInteractiveEnvironment();
omcNowStarted = true;
}
}

if( omcNowStarted )
delegate_ = new IAEX::OmcInteractiveEnvironment();
}

return omcNowStarted;
Expand Down

0 comments on commit a540fb5

Please sign in to comment.