aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2023-01-13 16:16:00 -0300
committerGitHub <noreply@github.com>2023-01-13 16:16:00 -0300
commitb937d334362c0810ab59b3bc4660a2bbea31c7da (patch)
tree6c971fe381d661884864bfb0ddb5e6ed565eb569 /launcher/ui/dialogs
parentf7244fbf68febd2ea7543862dbcd69635ccb579b (diff)
parentff7878217d6a5bab7cd688bb2051ef212c8b6117 (diff)
downloadPrismLauncher-b937d334362c0810ab59b3bc4660a2bbea31c7da.tar.gz
PrismLauncher-b937d334362c0810ab59b3bc4660a2bbea31c7da.tar.bz2
PrismLauncher-b937d334362c0810ab59b3bc4660a2bbea31c7da.zip
Merge pull request #714 from redstrate/cmark
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r--launcher/ui/dialogs/AboutDialog.cpp6
-rw-r--r--launcher/ui/dialogs/ModUpdateDialog.cpp11
-rw-r--r--launcher/ui/dialogs/UpdateDialog.cpp5
3 files changed, 6 insertions, 16 deletions
diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp
index a36e4a3d..76e3d8ed 100644
--- a/launcher/ui/dialogs/AboutDialog.cpp
+++ b/launcher/ui/dialogs/AboutDialog.cpp
@@ -39,12 +39,11 @@
#include <QIcon>
#include "Application.h"
#include "BuildConfig.h"
+#include "Markdown.h"
#include <net/NetJob.h>
#include <qobject.h>
-#include "HoeDown.h"
-
namespace {
QString getLink(QString link, QString name) {
return QString("&lt;<a href='%1'>%2</a>&gt;").arg(link).arg(name);
@@ -114,10 +113,9 @@ QString getCreditsHtml()
QString getLicenseHtml()
{
- HoeDown hoedown;
QFile dataFile(":/documents/COPYING.md");
dataFile.open(QIODevice::ReadOnly);
- QString output = hoedown.process(dataFile.readAll());
+ QString output = markdownToHTML(dataFile.readAll());
return output;
}
diff --git a/launcher/ui/dialogs/ModUpdateDialog.cpp b/launcher/ui/dialogs/ModUpdateDialog.cpp
index cedd4a96..2704243e 100644
--- a/launcher/ui/dialogs/ModUpdateDialog.cpp
+++ b/launcher/ui/dialogs/ModUpdateDialog.cpp
@@ -7,6 +7,7 @@
#include "FileSystem.h"
#include "Json.h"
+#include "Markdown.h"
#include "tasks/ConcurrentTask.h"
@@ -17,7 +18,6 @@
#include "modplatform/flame/FlameCheckUpdate.h"
#include "modplatform/modrinth/ModrinthCheckUpdate.h"
-#include <HoeDown.h>
#include <QTextBrowser>
#include <QTreeWidgetItem>
@@ -369,14 +369,7 @@ void ModUpdateDialog::appendMod(CheckUpdateTask::UpdatableMod const& info)
QString text = info.changelog;
switch (info.provider) {
case ModPlatform::Provider::MODRINTH: {
- HoeDown h;
- // HoeDown bug?: \n aren't converted to <br>
- text = h.process(info.changelog.toUtf8());
-
- // Don't convert if there's an HTML tag right after (Qt rendering weirdness)
- text.remove(QRegularExpression("(\n+)(?=<)"));
- text.replace('\n', "<br>");
-
+ text = markdownToHTML(info.changelog.toUtf8());
break;
}
default:
diff --git a/launcher/ui/dialogs/UpdateDialog.cpp b/launcher/ui/dialogs/UpdateDialog.cpp
index 9e82531a..349d768f 100644
--- a/launcher/ui/dialogs/UpdateDialog.cpp
+++ b/launcher/ui/dialogs/UpdateDialog.cpp
@@ -41,7 +41,7 @@
#include <Json.h>
#include "BuildConfig.h"
-#include "HoeDown.h"
+#include "Markdown.h"
UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
{
@@ -89,8 +89,7 @@ void UpdateDialog::loadChangelog()
QString reprocessMarkdown(QByteArray markdown)
{
- HoeDown hoedown;
- QString output = hoedown.process(markdown);
+ QString output = markdownToHTML(markdown);
// HACK: easier than customizing hoedown
output.replace(QRegularExpression("GH-([0-9]+)"), "<a href=\"https://github.com/PrismLauncher/PrismLauncher/issues/\\1\">GH-\\1</a>");