Skip to content

Commit

Permalink
Merge 1b1c3e5 into 2c5063e
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed May 23, 2019
2 parents 2c5063e + 1b1c3e5 commit 4056c3c
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 60 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Expand Up @@ -244,6 +244,7 @@ get_target_property(QMAKE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
set(QMAKE_COMMAND ${QMAKE} -Wnone)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

Expand Down Expand Up @@ -477,6 +478,11 @@ else()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(LINK_FLAGS_PROPERTIES "-stdlib=libc++")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie")
# Note: needed so that the OpenCOR binary doesn't get considered as a
# shared library file on Ubuntu when using Nautilus (see
# https://stackoverflow.com/a/45332687)...
endif()
endif()

Expand Down Expand Up @@ -791,13 +797,11 @@ if(ENABLE_TESTS)
configure_file(${CMAKE_SOURCE_DIR}/src/tests/res/tests.qrc.in
${TESTS_QRC_FILENAME})

qt5_add_resources(RUNTESTS_SOURCES_RCS ${TESTS_QRC_FILENAME})

add_executable(${RUNTESTS_NAME}
src/tests/src/main.cpp
src/tests/src/testsutils.cpp

${RUNTESTS_SOURCES_RCS}
${TESTS_QRC_FILENAME}
)

set_target_properties(${RUNTESTS_NAME} PROPERTIES
Expand Down Expand Up @@ -974,8 +978,6 @@ build_documentation(developer)

# Build the GUI version of OpenCOR

qt5_add_resources(SOURCES_RCS ${RESOURCES})

if(APPLE)
list(APPEND SOURCES
src/misc/macos.mm
Expand All @@ -984,7 +986,7 @@ endif()

add_executable(${CMAKE_PROJECT_NAME} WIN32 MACOSX_BUNDLE
${SOURCES}
${SOURCES_RCS}
${RESOURCES}
)

add_definitions(-D${CMAKE_PROJECT_NAME}_MAIN)
Expand Down Expand Up @@ -1014,13 +1016,11 @@ endforeach()
# command), so now we use '_' instead...

if(WIN32)
qt5_add_resources(WINDOWS_CLI_SOURCES_RCS ${WINDOWS_CLI_RESOURCES})

set(WINDOWS_CLI_PROJECT_NAME ${CMAKE_PROJECT_NAME}_com)

add_executable(${WINDOWS_CLI_PROJECT_NAME}
${WINDOWS_CLI_SOURCES}
${WINDOWS_CLI_SOURCES_RCS}
${WINDOWS_CLI_RESOURCES}
)

target_compile_definitions(${WINDOWS_CLI_PROJECT_NAME}
Expand Down
16 changes: 5 additions & 11 deletions cmake/common.cmake
Expand Up @@ -113,9 +113,9 @@ macro(build_documentation DOCUMENTATION_NAME)
${PROJECT_BUILD_DIR}/doc/${DOCUMENTATION_NAME}
)

# Make ourselves depend on our Python and PythonPackages plugins
# Make our project build target depend on our local target

add_dependencies(${DOCUMENTATION_BUILD} PythonPlugin PythonPackagesPlugin)
add_dependencies(${PROJECT_BUILD_TARGET} ${DOCUMENTATION_BUILD})
endif()
endmacro()

Expand Down Expand Up @@ -215,13 +215,9 @@ macro(add_plugin PLUGIN_NAME)

# Generate and add the different files needed by the plugin

if(NOT "${RESOURCES}" STREQUAL "")
qt5_add_resources(SOURCES_RCS ${RESOURCES})
endif()

add_library(${PROJECT_NAME} SHARED
${ARG_SOURCES}
${SOURCES_RCS}
${RESOURCES}
)

set_target_properties(${PROJECT_NAME} PROPERTIES
Expand Down Expand Up @@ -440,16 +436,14 @@ macro(add_plugin PLUGIN_NAME)
LINK_FLAGS_PROPERTIES "${LINK_FLAGS_PROPERTIES}")
endif()

qt5_add_resources(TEST_SOURCES_RCS ${TESTS_QRC_FILENAME})

add_executable(${TEST_NAME}
../../../tests/src/testsutils.cpp

${ARG_SOURCES}
${SOURCES_RCS}
${RESOURCES}

${TEST_SOURCE}
${TEST_SOURCES_RCS}
${TESTS_QRC_FILENAME}
)

set_target_properties(${TEST_NAME} PROPERTIES
Expand Down
4 changes: 3 additions & 1 deletion doc/downloads/index.js
Expand Up @@ -37,7 +37,9 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>Simulation support:</strong> allow a remote SED-ML file to be run headless (see issue <a href=\"https://github.com/opencor/opencor/issues/2085\">#2085</a>)." },
{ "change": "<strong>General:</strong> fixed an issue with <a href=\"https://www.qt.io/\">Qt</a> not being able to find its platform plugin anymore (see issue <a href=\"https://github.com/opencor/opencor/issues/2089\">#2089</a>)." },
{ "change": "<strong>Simulation support:</strong> allow a remote <a href=\"https://sed-ml.github.io/\">SED-ML</a> file to be run headless (see issue <a href=\"https://github.com/opencor/opencor/issues/2085\">#2085</a>)." },
{ "change": "<strong>Help window:</strong> fixed and issue with a blank page being shown rather than the documentation itself (see issue <a href=\"https://github.com/opencor/opencor/issues/2099\">#2099</a>)." },
{ "change": "<strong>Third-party libraries:</strong> fixed an issue with <a href=\"https://libgit2.github.com/\">libgit2</a> referencing two different copies of <a href=\"https://zlib.net/\">zlib</a> (see issue <a href=\"https://github.com/opencor/opencor/issues/2088\">#2088</a>)." }
]
},
Expand Down
8 changes: 8 additions & 0 deletions src/main.cpp
Expand Up @@ -113,6 +113,10 @@ int main(int pArgC, char *pArgV[])
// Run the CLI version of OpenCOR, if possible/needed

if (tryCliVersion) {
// Initialise the plugins path

OpenCOR::initPluginsPath(pArgC, pArgV);

// Create and initialise the CLI version of OpenCOR

auto cliApp = new OpenCOR::CliApplication(pArgC, pArgV);
Expand All @@ -137,6 +141,10 @@ int main(int pArgC, char *pArgV[])
// the GUI version of OpenCOR this time...
}

// Initialise the plugins path

OpenCOR::initPluginsPath(pArgC, pArgV);

// Create the GUI version of OpenCOR, after making sure that, on Windows,
// OpenCOR can handle scaled HiDPI screens

Expand Down
79 changes: 46 additions & 33 deletions src/misc/cliutils.cpp
Expand Up @@ -93,41 +93,19 @@ void initQtMessagePattern()

//==============================================================================

void initApplication(QString *pAppDate)
void initPluginsPath(int pArgC, char *pArgV[]) // NOLINT(hicpp-avoid-c-arrays, modernize-avoid-c-arrays)
{
// Use the system's proxy settings

QNetworkProxyFactory::setUseSystemConfiguration(true);

// Ignore SSL-related warnings
// Note #1: this is to address an issue with QSslSocket not being able to
// resolve some methods...
// Note #2: see issue #516 for more information...

qputenv("QT_LOGGING_RULES", "qt.network.ssl.warning=false");

// Set the organisation and application names of our application

qApp->setOrganizationName("Physiome");
qApp->setApplicationName("OpenCOR");

// Retrieve and set the version of the application

QString versionData;

readFile(":/app_versiondate", versionData);

QStringList versionDataList = versionData.split(eolString());

qApp->setApplicationVersion(versionDataList.first());

if (pAppDate != nullptr) {
*pAppDate = versionDataList.last();
}

// Initialise the plugins path

QFileInfo appFileInfo = QCoreApplication::applicationFilePath();
// Note: a user might have set the OpenCOR path in his/her PATH environment
// variable, so that s/he could then start OpenCOR from the command
// line by simply typing OpenCOR (see issue #1688). However, in that
// case, pArgV[0] won't contain the full path to OpenCOR, just its
// basename. So, we need to use a temporary QCoreApplication object to
// determine the full path to OpenCOR and, as a result, to its plugins
// directory, thus making it possible to run OpenCOR (and load its
// various plugins)...

QFileInfo appFileInfo = QCoreApplication(pArgC, pArgV).applicationFilePath(); // NOLINT(readability-static-accessed-through-instance)
QString appDir;

#ifdef Q_OS_WIN
Expand Down Expand Up @@ -170,6 +148,41 @@ void initApplication(QString *pAppDate)

//==============================================================================

void initApplication(QString *pAppDate)
{
// Use the system's proxy settings

QNetworkProxyFactory::setUseSystemConfiguration(true);

// Ignore SSL-related warnings
// Note #1: this is to address an issue with QSslSocket not being able to
// resolve some methods...
// Note #2: see issue #516 for more information...

qputenv("QT_LOGGING_RULES", "qt.network.ssl.warning=false");

// Set the organisation and application names of our application

qApp->setOrganizationName("Physiome");
qApp->setApplicationName("OpenCOR");

// Retrieve and set the version of the application

QString versionData;

readFile(":/app_versiondate", versionData);

QStringList versionDataList = versionData.split(eolString());

qApp->setApplicationVersion(versionDataList.first());

if (pAppDate != nullptr) {
*pAppDate = versionDataList.last();
}
}

//==============================================================================

QString applicationDescription(bool pGuiMode)
{
// Return the application description
Expand Down
2 changes: 1 addition & 1 deletion src/misc/cliutils.h
Expand Up @@ -71,7 +71,7 @@ private slots:
//==============================================================================

void initQtMessagePattern();

void initPluginsPath(int pArgC, char *pArgV[]);
void initApplication(QString *pAppDate = nullptr);

QString applicationDescription(bool pGuiMode = true);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/support/COMBINESupport/i18n/COMBINESupport_fr.ts
Expand Up @@ -35,8 +35,8 @@
<translation>le manifeste n&apos;est pas un fichier OMEX valide</translation>
</message>
<message>
<source>&lt;strong&gt;%1&lt;/strong&gt; could not be found</source>
<translation>&lt;strong&gt;%1&lt;/strong&gt; n&apos;a pas pu être trouvé</translation>
<source>&apos;%1&apos; could not be found</source>
<translation>&apos;%1&apos; n&apos;a pas pu être trouvé</translation>
</message>
<message>
<source>no reference to the COMBINE archive itself could be found</source>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/support/COMBINESupport/src/combinearchive.cpp
Expand Up @@ -424,7 +424,7 @@ bool CombineArchive::isValid()

if (!QFile::exists(fileName)) {
mIssues << CombineArchiveIssue(CombineArchiveIssue::Type::Error,
tr("<strong>%1</strong> could not be found").arg(location));
tr("'%1' could not be found").arg(location));

mFiles.clear();

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/support/COMBINESupport/tests/tests.cpp
Expand Up @@ -228,7 +228,7 @@ void Tests::loadingErrorTests()
QVERIFY(!combineArchive.isValid());
QVERIFY(combineArchive.issues().count() == 1);
QCOMPARE(combineArchive.issues().first().message(),
QString("<strong>nonexistentfile.txt</strong> could not be found"));
QString("'nonexistentfile.txt' could not be found"));

// Try to load a COMBINE archive which manifest doesn't reference the
// COMBINE archive itself
Expand Down
6 changes: 5 additions & 1 deletion src/windows/main.cpp
Expand Up @@ -54,11 +54,15 @@ int main(int pArgC, char *pArgV[])

OpenCOR::initQtMessagePattern();

// Initialise the plugins path

OpenCOR::initPluginsPath(pArgC, pArgV);

// Create our application

auto cliApp = new OpenCOR::CliApplication(pArgC, pArgV);

// Some general initialisations
// Initialise our application

OpenCOR::initApplication();

Expand Down

0 comments on commit 4056c3c

Please sign in to comment.