Merge branch 'launcher_help_version' into 'master'

Open matching version of documentation for Launcher Help

See merge request OpenMW/openmw!3909
fix-osga-rotate-wildly
psi29a 10 months ago
commit 231b5753e4

@ -89,7 +89,7 @@ set(OPENMW_VERSION_COMMITDATE "")
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}") set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
set(OPENMW_DOC_BASEURL "https://openmw.readthedocs.io/en/stable/") set(OPENMW_DOC_BASEURL "https://openmw.readthedocs.io/en/")
set(GIT_CHECKOUT FALSE) set(GIT_CHECKOUT FALSE)
if(EXISTS ${PROJECT_SOURCE_DIR}/.git) if(EXISTS ${PROJECT_SOURCE_DIR}/.git)

@ -29,6 +29,7 @@ if (GIT_CHECKOUT)
-DOPENMW_LUA_API_REVISION=${OPENMW_LUA_API_REVISION} -DOPENMW_LUA_API_REVISION=${OPENMW_LUA_API_REVISION}
-DOPENMW_POSTPROCESSING_API_REVISION=${OPENMW_POSTPROCESSING_API_REVISION} -DOPENMW_POSTPROCESSING_API_REVISION=${OPENMW_POSTPROCESSING_API_REVISION}
-DOPENMW_VERSION=${OPENMW_VERSION} -DOPENMW_VERSION=${OPENMW_VERSION}
-DOPENMW_DOC_BASEURL=${OPENMW_DOC_BASEURL}
-DMACROSFILE=${CMAKE_SOURCE_DIR}/cmake/OpenMWMacros.cmake -DMACROSFILE=${CMAKE_SOURCE_DIR}/cmake/OpenMWMacros.cmake
"-DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}" "-DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}"
-Dgenerator_is_multi_config_var=${multi_config} -Dgenerator_is_multi_config_var=${multi_config}
@ -617,7 +618,6 @@ endif()
if (USE_QT) if (USE_QT)
add_library(components_qt STATIC ${COMPONENT_QT_FILES} ${ESM_UI_HDR}) add_library(components_qt STATIC ${COMPONENT_QT_FILES} ${ESM_UI_HDR})
target_link_libraries(components_qt components Qt::Widgets Qt::Core) target_link_libraries(components_qt components Qt::Widgets Qt::Core)
target_compile_definitions(components_qt PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
if (BUILD_LAUNCHER OR BUILD_WIZARD) if (BUILD_LAUNCHER OR BUILD_WIZARD)
add_dependencies(components_qt qm-files) add_dependencies(components_qt qm-files)
@ -657,6 +657,7 @@ endif()
set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE) set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE)
target_compile_definitions(components PUBLIC BT_USE_DOUBLE_PRECISION) target_compile_definitions(components PUBLIC BT_USE_DOUBLE_PRECISION)
target_compile_definitions(components PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
if(OSG_STATIC) if(OSG_STATIC)
unset(_osg_plugins_static_files) unset(_osg_plugins_static_files)

@ -4,9 +4,12 @@
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <components/version/version.hpp>
void Misc::HelpViewer::openHelp(const char* url) void Misc::HelpViewer::openHelp(const char* url)
{ {
QString link{ OPENMW_DOC_BASEURL }; std::string_view docsUrl = Version::getDocumentationUrl();
QString link = QString::fromUtf8(docsUrl.data(), docsUrl.size());
link.append(url); link.append(url);
QDesktopServices::openUrl(QUrl(link)); QDesktopServices::openUrl(QUrl(link));
} }

@ -52,4 +52,11 @@ namespace Version
return getVersion() == version && getCommitHash() == commitHash && getTagHash() == tagHash; return getVersion() == version && getCommitHash() == commitHash && getTagHash() == tagHash;
} }
std::string_view getDocumentationUrl()
{
if constexpr (std::string_view("@OPENMW_VERSION_COMMITHASH@") == "@OPENMW_VERSION_TAGHASH@")
return OPENMW_DOC_BASEURL "openmw-@OPENMW_VERSION_MAJOR@.@OPENMW_VERSION_MINOR@.@OPENMW_VERSION_RELEASE@/";
else
return OPENMW_DOC_BASEURL "latest/";
}
} }

@ -17,6 +17,8 @@ namespace Version
std::string getOpenmwVersionDescription(); std::string getOpenmwVersionDescription();
bool checkResourcesVersion(const std::filesystem::path& resourcePath); bool checkResourcesVersion(const std::filesystem::path& resourcePath);
std::string_view getDocumentationUrl();
} }
#endif // VERSION_HPP #endif // VERSION_HPP

Loading…
Cancel
Save