diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-16 01:59:08 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-16 01:59:08 +0300 |
commit | a3ffa6455021b69bd1940b65fefb3b6177c96730 (patch) | |
tree | e20fd8cbafcbd2fae5f29b199b04d34a379b9513 /launcher/ui/pages | |
parent | 37fb52aada16fa8533ecee3932e10fcbee0ca1d5 (diff) | |
download | PrismLauncher-a3ffa6455021b69bd1940b65fefb3b6177c96730.tar.gz PrismLauncher-a3ffa6455021b69bd1940b65fefb3b6177c96730.tar.bz2 PrismLauncher-a3ffa6455021b69bd1940b65fefb3b6177c96730.zip |
Upgraded pack changelog
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r-- | launcher/ui/pages/instance/ManagedPackPage.cpp | 16 | ||||
-rw-r--r-- | launcher/ui/pages/instance/ManagedPackPage.ui | 12 |
2 files changed, 27 insertions, 1 deletions
diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index 0fc0c986..0443baf1 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -3,6 +3,9 @@ // SPDX-License-Identifier: GPL-3.0-only #include "ManagedPackPage.h" +#include <QDesktopServices> +#include <QUrl> +#include <QUrlQuery> #include "ui_ManagedPackPage.h" #include <QListView> @@ -103,6 +106,19 @@ ManagedPackPage::ManagedPackPage(BaseInstance* inst, InstanceWindow* instance_wi // Pretend we're opening the page again openedImpl(); }); + + connect(ui->changelogTextBrowser, &QTextBrowser::anchorClicked, this, [](const QUrl url) { + if (url.scheme().isEmpty()) { + auto querry = + QUrlQuery(url.query()).queryItemValue("remoteUrl", QUrl::FullyDecoded); // curseforge workaround for linkout?remoteUrl= + auto decoded = QUrl::fromPercentEncoding(querry.toUtf8()); + auto newUrl = QUrl(decoded); + if (newUrl.isValid() && (newUrl.scheme() == "http" || newUrl.scheme() == "https")) + QDesktopServices ::openUrl(newUrl); + return; + } + QDesktopServices::openUrl(url); + }); } ManagedPackPage::~ManagedPackPage() diff --git a/launcher/ui/pages/instance/ManagedPackPage.ui b/launcher/ui/pages/instance/ManagedPackPage.ui index bbe44a94..05e91bbc 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.ui +++ b/launcher/ui/pages/instance/ManagedPackPage.ui @@ -168,10 +168,13 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> - <widget class="QTextBrowser" name="changelogTextBrowser"> + <widget class="ProjectDescriptionPage" name="changelogTextBrowser"> <property name="placeholderText"> <string>No changelog available for this version!</string> </property> + <property name="openLinks"> + <bool>false</bool> + </property> </widget> </item> </layout> @@ -188,6 +191,13 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>ProjectDescriptionPage</class> + <extends>QTextBrowser</extends> + <header>ui/widgets/ProjectDescriptionPage.h</header> + </customwidget> + </customwidgets> <resources/> <connections/> </ui> |