Skip to content

Commit

Permalink
- write command log before sending the command.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10284 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Nov 3, 2011
1 parent e3c8d66 commit 7642931
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
18 changes: 15 additions & 3 deletions OMEdit/OMEditGUI/OMCProxy.cpp
Expand Up @@ -162,15 +162,25 @@ QString OMCProxy::getExpression()
return mExpression;
}

//! Writes the commands and their response to the omeditcommands.log file.
//! Writes the commands to the omeditcommands.log file.
void OMCProxy::writeCommandLog(QString expression)
{
if (mCommandsLogFileTextStream.device())
{
mCommandsLogFileTextStream << expression;
mCommandsLogFileTextStream << "\n";
mCommandsLogFileTextStream.flush();
}
}

//! Writes the command response to the omeditcommands.log file.
void OMCProxy::writeCommandResponseLog()
{
if (mCommandsLogFileTextStream.device())
{
mCommandsLogFileTextStream << getResult();
mCommandsLogFileTextStream << "\n\n";
mCommandsLogFileTextStream.flush();
}
}

Expand Down Expand Up @@ -316,6 +326,8 @@ void OMCProxy::sendCommand(const QString expression)
mpParentMainWindow->mExitApplication = true;
return;
}
// write command to the commands log.
writeCommandLog(expression);
// Send command to server
try
{
Expand All @@ -327,13 +339,13 @@ void OMCProxy::sendCommand(const QString expression)
while (future.isRunning())
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
future.waitForFinished();
writeCommandLog(expression);
writeCommandResponseLog();
logOMCMessages(expression);
}
else
{
mResult = QString::fromLocal8Bit(mOMC->sendExpression(getExpression().toLocal8Bit()));
writeCommandLog(expression);
writeCommandResponseLog();
logOMCMessages(expression);
}
}
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/OMCProxy.h
Expand Up @@ -75,6 +75,7 @@ class OMCProxy : public QObject
void setExpression(QString expression);
QString getExpression();
void writeCommandLog(QString expression);
void writeCommandResponseLog();

MainWindow *mpParentMainWindow;
enum mModelicaAnnotationVersion {ANNOTATION_VERSION2X, ANNOTATION_VERSION3X};
Expand Down

0 comments on commit 7642931

Please sign in to comment.