Skip to content

Commit

Permalink
- Try to fix Windows build.
Browse files Browse the repository at this point in the history
- Converted few more API calls in OMEdit to use scripting API.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24462 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Feb 6, 2015
1 parent e1fc90c commit b9a3354
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
38 changes: 13 additions & 25 deletions OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -1552,22 +1552,21 @@ QStringList OMCProxy::getComponentAnnotations(QString className)
*/
QString OMCProxy::getDocumentationAnnotation(QString className)
{
QString expression = "getDocumentationAnnotation(" + className + ")";
sendCommand(expression, true, className);
QStringList docsList = StringHandler::unparseStrings(getResult());
QList<QString> docsList = mpOMCInterface->getDocumentationAnnotation(className);
// get the class comment and show it as the first line on the documentation page.
QString doc = getClassComment(className);
if (!doc.isEmpty()) doc.prepend("<h4>").append("</h4>");
doc.prepend(QString("<h2>").append(className).append("</h2>"));
for (int ele = 0 ; ele < docsList.size() ; ele++)
{
for (int ele = 0 ; ele < docsList.size() ; ele++) {
QString docElement = docsList[ele];
if (docElement.isEmpty())
if (docElement.isEmpty()) {
continue;
if (ele == 0) // info section
}
if (ele == 0) { // info section
doc += "<p style=\"font-size:12px;\"><strong><u>Information</u></strong></p>";
else if (ele == 1) // revisions section
} else if (ele == 1) { // revisions section
doc += "<p style=\"font-size:12px;\"><strong><u>Revisions</u></strong></p>";
}
int i,j;
/*
* Documentation may have the form
Expand Down Expand Up @@ -1610,8 +1609,7 @@ QString OMCProxy::getDocumentationAnnotation(QString className)
*/
QString OMCProxy::getClassComment(QString className)
{
sendCommand("getClassComment(" + className + ")", true, className);
return StringHandler::unparse(getResult());
return mpOMCInterface->getClassComment(className);
}

/*!
Expand All @@ -1621,18 +1619,7 @@ QString OMCProxy::getClassComment(QString className)
*/
QString OMCProxy::changeDirectory(QString directory)
{
if (directory.isEmpty())
{
sendCommand("cd()");
}
else
{
directory = directory.replace("\\", "/");
sendCommand("cd(\"" + directory + "\")");
}
QString result = StringHandler::unparse(getResult());
printMessagesStringInternal();
return result;
return mpOMCInterface->cd(directory);
}

/*!
Expand All @@ -1641,10 +1628,11 @@ QString OMCProxy::changeDirectory(QString directory)
\param version - the version of the library.
\return true on success
*/
bool OMCProxy::loadModel(QString library, QString version)
bool OMCProxy::loadModel(QString className, QString priorityVersion, bool notify, QString languageStandard, bool requireExactVersion)
{
sendCommand("loadModel(" + library + ",{\"" + version + "\"})");
bool result = StringHandler::unparseBool(getResult());
QList<QString> priorityVersionList;
priorityVersionList << priorityVersion;
bool result = mpOMCInterface->loadModel(className, priorityVersionList, notify, languageStandard, requireExactVersion);
printMessagesStringInternal();
return result;
}
Expand Down
5 changes: 3 additions & 2 deletions OMEdit/OMEditGUI/OMC/OMCProxy.h
Expand Up @@ -158,8 +158,9 @@ class OMCProxy : public QObject
QStringList getComponentAnnotations(QString className);
QString getDocumentationAnnotation(QString className);
QString getClassComment(QString className);
QString changeDirectory(QString directory = QString());
bool loadModel(QString library, QString version = QString("default"));
QString changeDirectory(QString directory = QString(""));
bool loadModel(QString className, QString priorityVersion = QString("default"), bool notify = false, QString languageStandard = QString(""),
bool requireExactVersion = false);
bool loadFile(QString fileName, QString encoding = Helper::utf8);
bool loadString(QString value, QString fileName, bool checkError = true);
bool parseFile(QString fileName, QString encoding = Helper::utf8);
Expand Down

0 comments on commit b9a3354

Please sign in to comment.