refactor: move help URL into buildconfig

This commit is contained in:
Sefa Eyeoglu 2022-03-06 11:31:50 +01:00
parent b162351ff4
commit 6545d250e8
No known key found for this signature in database
GPG Key ID: C10411294912A422
4 changed files with 9 additions and 1 deletions

View File

@ -48,6 +48,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y")
######## Set URLs ######## ######## Set URLs ########
set(Launcher_NEWS_RSS_URL "https://polymc.github.io/feed/feed.xml" CACHE STRING "URL to fetch PolyMC's news RSS feed from.") set(Launcher_NEWS_RSS_URL "https://polymc.github.io/feed/feed.xml" CACHE STRING "URL to fetch PolyMC's news RSS feed from.")
set(Launcher_NEWS_OPEN_URL "https://polymc.github.io/news/" CACHE STRING "URL that gets opened when the user clicks 'More News'") set(Launcher_NEWS_OPEN_URL "https://polymc.github.io/news/" CACHE STRING "URL that gets opened when the user clicks 'More News'")
set(Launcher_HELP_URL "https://polymc.org/wiki/%1" CACHE STRING "URL (with arg %1 to be substituted with page-id) that gets opened when the user requests help")
######## Set version numbers ######## ######## Set version numbers ########
set(Launcher_VERSION_MAJOR 1) set(Launcher_VERSION_MAJOR 1)

View File

@ -50,6 +50,7 @@ Config::Config()
VERSION_STR = "@Launcher_VERSION_STRING@"; VERSION_STR = "@Launcher_VERSION_STRING@";
NEWS_RSS_URL = "@Launcher_NEWS_RSS_URL@"; NEWS_RSS_URL = "@Launcher_NEWS_RSS_URL@";
NEWS_OPEN_URL = "@Launcher_NEWS_OPEN_URL@"; NEWS_OPEN_URL = "@Launcher_NEWS_OPEN_URL@";
HELP_URL = "@Launcher_HELP_URL@";
IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@"; IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@";
MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@"; MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@";
META_URL = "@Launcher_META_URL@"; META_URL = "@Launcher_META_URL@";

View File

@ -73,6 +73,11 @@ public:
*/ */
QString NEWS_OPEN_URL; QString NEWS_OPEN_URL;
/**
* URL (with arg %1 to be substituted with page-id) that gets opened when the user requests help
*/
QString HELP_URL;
/** /**
* Client ID you can get from Imgur when you register an application * Client ID you can get from Imgur when you register an application
*/ */

View File

@ -14,6 +14,7 @@
*/ */
#include "PageContainer.h" #include "PageContainer.h"
#include "BuildConfig.h"
#include "PageContainer_p.h" #include "PageContainer_p.h"
#include <QStackedLayout> #include <QStackedLayout>
@ -207,7 +208,7 @@ void PageContainer::help()
QString pageId = m_currentPage->helpPage(); QString pageId = m_currentPage->helpPage();
if (pageId.isEmpty()) if (pageId.isEmpty())
return; return;
DesktopServices::openUrl(QUrl("https://polymc.org/wiki/" + pageId)); DesktopServices::openUrl(QUrl(BuildConfig.HELP_URL.arg(pageId)));
} }
} }