Skip to content

Commit

Permalink
Updated the documentation paths
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Apr 28, 2020
1 parent 7820bc2 commit 43c8902
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 60 deletions.
27 changes: 9 additions & 18 deletions OMEdit/OMEditLIB/MainWindow.cpp
Expand Up @@ -2693,11 +2693,9 @@ void MainWindow::runOMSensPlugin()
*/
void MainWindow::openUsersGuide()
{
QUrl usersGuidePath (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/share/doc/omc/index.html"));
QUrl usersGuidePath (QString("file:///%1/share/doc/omc/OpenModelicaUsersGuide/index.html").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(usersGuidePath)) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica,
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(usersGuidePath.toString()),
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(usersGuidePath.toString()),
Helper::scriptingKind, Helper::errorLevel));
}
}
Expand All @@ -2709,11 +2707,9 @@ void MainWindow::openUsersGuide()
*/
void MainWindow::openUsersGuidePdf()
{
QUrl usersGuidePath (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/share/doc/omc/OpenModelicaUsersGuide-latest.pdf"));
QUrl usersGuidePath (QString("file:///%1/share/doc/omc/OpenModelicaUsersGuide-latest.pdf").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(usersGuidePath)) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica,
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(usersGuidePath.toString()),
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(usersGuidePath.toString()),
Helper::scriptingKind, Helper::errorLevel));
}
}
Expand All @@ -2725,11 +2721,9 @@ void MainWindow::openUsersGuidePdf()
*/
void MainWindow::openSystemDocumentation()
{
QUrl systemDocumentationPath (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/share/doc/omc/OpenModelicaSystem.pdf"));
QUrl systemDocumentationPath (QString("file:///%1/share/doc/omc/SystemDocumentation/OpenModelicaSystem.pdf").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(systemDocumentationPath)) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica,
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(systemDocumentationPath.toString()),
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(systemDocumentationPath.toString()),
Helper::scriptingKind, Helper::errorLevel));
}
}
Expand Down Expand Up @@ -2782,13 +2776,10 @@ void MainWindow::openOMSimulatorUsersGuide()
*/
void MainWindow::openOpenModelicaTLMSimulatorDocumentation()
{
QUrl openModelicaTLMSimulatorDocumentation (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/OMTLMSimulator/Documentation/OMTLMSimulator.pdf"));
QUrl openModelicaTLMSimulatorDocumentation (QString("file:///%1/OMTLMSimulator/Documentation/OMTLMSimulator.pdf").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(openModelicaTLMSimulatorDocumentation)) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica,
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE)
.arg(openModelicaTLMSimulatorDocumentation.toString()),
Helper::scriptingKind, Helper::errorLevel));
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE)
.arg(openModelicaTLMSimulatorDocumentation.toString()), Helper::scriptingKind, Helper::errorLevel));
}
}

Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditLIB/OMC/OMCProxy.cpp
Expand Up @@ -251,7 +251,7 @@ bool OMCProxy::initializeOMC(threadData_t *threadData)
// get OpenModelica version
Helper::OpenModelicaVersion = getVersion();
// set OpenModelicaHome variable
Helper::OpenModelicaHome = mpOMCInterface->getInstallationDirectoryPath();
Helper::OpenModelicaHome = mpOMCInterface->getInstallationDirectoryPath().replace("\\", "/");
#ifdef WIN32
MMC_TRY_TOP_INTERNAL()
omc_Main_setWindowsPaths(threadData, mmc_mk_scon(Helper::OpenModelicaHome.toUtf8().constData()));
Expand Down
16 changes: 7 additions & 9 deletions OMEdit/OMEditLIB/Simulation/SimulationDialog.cpp
Expand Up @@ -2165,11 +2165,10 @@ void SimulationDialog::enableDasslIdaOptions(QString method)
*/
void SimulationDialog::showIntegrationHelp()
{
QUrl integrationAlgorithmsPath (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/share/doc/omc/simulationflags.html#integration-methods"));
QUrl integrationAlgorithmsPath (QString("file:///%1/share/doc/omc/OpenModelicaUsersGuide/simulationflags.html#integration-methods").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(integrationAlgorithmsPath)) {
QString errorMessage = GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(integrationAlgorithmsPath.toString());
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, errorMessage, Helper::scriptingKind, Helper::errorLevel));
QMessageBox::critical(this, QString("%1 - %2").arg(Helper::applicationName, Helper::error),
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(integrationAlgorithmsPath.toString()), Helper::ok);
}
}

Expand Down Expand Up @@ -2252,11 +2251,10 @@ void SimulationDialog::browseDataReconciliationInputFile()
*/
void SimulationDialog::showSimulationFlagsHelp()
{
QUrl integrationAlgorithmsPath (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/share/doc/omc/simulationflags.html"));
if (!QDesktopServices::openUrl(integrationAlgorithmsPath)) {
QString errorMessage = GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(integrationAlgorithmsPath.toString());
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, errorMessage, Helper::scriptingKind, Helper::errorLevel));
QUrl simulationflagsPath (QString("file:///%1/share/doc/omc/OpenModelicaUsersGuide/simulationflags.html").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(simulationflagsPath)) {
QMessageBox::critical(this, QString("%1 - %2").arg(Helper::applicationName, Helper::error),
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(simulationflagsPath.toString()), Helper::ok);
}
}

Expand Down
3 changes: 1 addition & 2 deletions OMEdit/OMEditLIB/Simulation/TranslationFlagsWidget.cpp
Expand Up @@ -246,8 +246,7 @@ void TranslationFlagsWidget::updateIndexReductionToolTip(int index)
*/
void TranslationFlagsWidget::showTranslationFlagsHelp()
{
QUrl omcHelpTextPath (QString("file:///").append(QString(Helper::OpenModelicaHome).replace("\\", "/"))
.append("/share/doc/omc/omchelptext.html"));
QUrl omcHelpTextPath (QString("file:///%1/share/doc/omc/OpenModelicaUsersGuide/omchelptext.html").arg(Helper::OpenModelicaHome));
if (!QDesktopServices::openUrl(omcHelpTextPath)) {
QMessageBox::critical(this, QString("%1 - %2").arg(Helper::applicationName, Helper::error),
GUIMessages::getMessage(GUIMessages::UNABLE_TO_OPEN_FILE).arg(omcHelpTextPath.toString()), Helper::ok);
Expand Down
Expand Up @@ -32,7 +32,7 @@
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#include "Test.h"
#include "BrowseMSL.h"
#include "Util.h"
#include "OMEditApplication.h"
#include "MainWindow.h"
Expand All @@ -43,13 +43,13 @@ extern "C" {
#include "meta/meta_modelica.h"
}

OMEDITTEST_MAIN(Test)
OMEDITTEST_MAIN(BrowseMSL)

/*!
* \brief Test::electricalAnalogBasic
* Browses the Modelica.Electrical.Analog.Basic
*/
void Test::electricalAnalogBasic()
void BrowseMSL::electricalAnalogBasic()
{
if (!Util::expandLibraryTreeItemParentHierarchy(MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Electrical.Analog.Basic"))) {
QFAIL("Expanding to Modelica.Electrical.Analog.Basic failed.");
Expand All @@ -61,7 +61,7 @@ void Test::electricalAnalogBasic()
* \brief Test::mediaAir
* Browses the Modelica.Media.Air
*/
void Test::mediaAir()
void BrowseMSL::mediaAir()
{
OMEDITTEST_SKIP("Enable this testcase by removing this line once the ticket#5669 (https://trac.openmodelica.org/OpenModelica/ticket/5669) is fixed.");
if (!Util::expandLibraryTreeItemParentHierarchy(MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Media.Air"))) {
Expand Down
Expand Up @@ -32,12 +32,12 @@
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#ifndef TESTGUI_H
#define TESTGUI_H
#ifndef BROWSEMSL_H
#define BROWSEMSL_H

#include <QObject>

class Test: public QObject
class BrowseMSL: public QObject
{
Q_OBJECT

Expand All @@ -46,4 +46,4 @@ private slots:
void mediaAir();
};

#endif // TESTGUI_H
#endif // BROWSEMSL_H
4 changes: 2 additions & 2 deletions OMEdit/Testsuite/BrowseMSL/BrowseMSL.pro
Expand Up @@ -33,7 +33,7 @@ include(../Common/Testsuite.pri)
TARGET = BrowseMSL

SOURCES += ../Common/Util.cpp \
Test.cpp
BrowseMSL.cpp

HEADERS += ../Common/Util.h \
Test.h
BrowseMSL.h
Expand Up @@ -32,7 +32,7 @@
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#include "Test.h"
#include "Diagram.h"
#include "Util.h"
#include "OMEditApplication.h"
#include "MainWindow.h"
Expand All @@ -43,13 +43,13 @@ extern "C" {
#include "meta/meta_modelica.h"
}

OMEDITTEST_MAIN(Test)
OMEDITTEST_MAIN(Diagram)

/*!
* \brief Test::chuaCircuit
* Browses to Modelica.Electrical.Analog.Examples.ChuaCircuit and loads it diagram view.
*/
void Test::chuaCircuit()
void Diagram::chuaCircuit()
{
LibraryTreeItem *pLibraryTreeItem = MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Electrical.Analog.Examples.ChuaCircuit");
if (!pLibraryTreeItem) {
Expand Down
Expand Up @@ -32,17 +32,17 @@
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#ifndef TESTGUI_H
#define TESTGUI_H
#ifndef DIAGRAM_H
#define DIAGRAM_H

#include <QObject>

class Test: public QObject
class Diagram: public QObject
{
Q_OBJECT

private slots:
void chuaCircuit();
};

#endif // TESTGUI_H
#endif // DIAGRAM_H
4 changes: 2 additions & 2 deletions OMEdit/Testsuite/Diagram/Diagram.pro
Expand Up @@ -33,7 +33,7 @@ include(../Common/Testsuite.pri)
TARGET = Diagram

SOURCES += ../Common/Util.cpp \
Test.cpp
Diagram.cpp

HEADERS += ../Common/Util.h \
Test.h
Diagram.h
2 changes: 1 addition & 1 deletion OMEdit/Testsuite/RunOMEditTestsuite.sh
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

testcases=( "BrowseMSL" "Diagram" "Transformation" )
testcases=( "BrowseMSL" "Diagram" "Transformation")
OMEditTestResults="$PWD/OMEditTestResult"

for i in "${testcases[@]}"
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/Testsuite/Transformation/Transformation.pro
Expand Up @@ -33,7 +33,7 @@ include(../Common/Testsuite.pri)
TARGET = Transformation

SOURCES += ../Common/Util.cpp \
Test.cpp
TransformationTest.cpp

HEADERS += ../Common/Util.h \
Test.h
TransformationTest.h
Expand Up @@ -32,7 +32,7 @@
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#include "Test.h"
#include "TransformationTest.h"
#include "Util.h"
#include "OMEditApplication.h"
#include "Component/Transformation.h"
Expand All @@ -42,17 +42,17 @@ extern "C" {
#include "meta/meta_modelica.h"
}

OMEDITTEST_MAIN(Test)
OMEDITTEST_MAIN(TransformationTest)

void Test::wrongPlacementAnnotation()
void TransformationTest::wrongPlacementAnnotation()
{
QString placementAnnotationString = "{Placement(true,-,{{-140.0, 40.0}, {-100.0, 80.0}},-,-,-,)}";

Transformation transformation;
transformation.parseTransformationString(placementAnnotationString, 200, 200);
}

void Test::correctPlacementAnnotation()
void TransformationTest::correctPlacementAnnotation()
{
QString placementAnnotationString = "{Placement(true,-75.0,38.0,-25.0,-25.0,25.0,25.0,270.0,-,-,-,-,-,-,)}";

Expand Down
Expand Up @@ -32,12 +32,12 @@
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#ifndef TESTGUI_H
#define TESTGUI_H
#ifndef TRANSFORMATIONTEST_H
#define TRANSFORMATIONTEST_H

#include <QObject>

class Test: public QObject
class TransformationTest: public QObject
{
Q_OBJECT

Expand All @@ -46,4 +46,4 @@ private slots:
void correctPlacementAnnotation();
};

#endif // TESTGUI_H
#endif // TRANSFORMATIONTEST_H

0 comments on commit 43c8902

Please sign in to comment.