Added patch to all setHtml calls

Signed-off-by: SabrePenguin <lknofczynski@gmail.com>
This commit is contained in:
SabrePenguin
2024-04-30 23:43:36 -04:00
parent e3d64608b9
commit b9c010ffb2
12 changed files with 33 additions and 18 deletions
+3 -2
View File
@@ -39,6 +39,7 @@
#include "BuildConfig.h" #include "BuildConfig.h"
#include "Markdown.h" #include "Markdown.h"
#include "ui_AboutDialog.h" #include "ui_AboutDialog.h"
#include "StringUtils.h"
#include <net/NetJob.h> #include <net/NetJob.h>
#include <qobject.h> #include <qobject.h>
@@ -139,10 +140,10 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDia
setWindowTitle(tr("About %1").arg(launcherName)); setWindowTitle(tr("About %1").arg(launcherName));
QString chtml = getCreditsHtml(); QString chtml = getCreditsHtml();
ui->creditsText->setHtml(chtml); ui->creditsText->setHtml(StringUtils::htmlListPatch(chtml));
QString lhtml = getLicenseHtml(); QString lhtml = getLicenseHtml();
ui->licenseText->setHtml(lhtml); ui->licenseText->setHtml(StringUtils::htmlListPatch(lhtml));
ui->urlLabel->setOpenExternalLinks(true); ui->urlLabel->setOpenExternalLinks(true);
@@ -26,6 +26,7 @@
#include "minecraft/mod/ModFolderModel.h" #include "minecraft/mod/ModFolderModel.h"
#include "modplatform/helpers/ExportToModList.h" #include "modplatform/helpers/ExportToModList.h"
#include "ui_ExportToModListDialog.h" #include "ui_ExportToModListDialog.h"
#include "StringUtils.h"
#include <QFileDialog> #include <QFileDialog>
#include <QFileSystemModel> #include <QFileSystemModel>
@@ -143,10 +144,10 @@ void ExportToModListDialog::triggerImp()
case ExportToModList::CUSTOM: case ExportToModList::CUSTOM:
return; return;
case ExportToModList::HTML: case ExportToModList::HTML:
ui->resultText->setHtml(txt); ui->resultText->setHtml(StringUtils::htmlListPatch(txt));
break; break;
case ExportToModList::MARKDOWN: case ExportToModList::MARKDOWN:
ui->resultText->setHtml(markdownToHTML(txt)); ui->resultText->setHtml(StringUtils::htmlListPatch(markdownToHTML(txt)));
break; break;
case ExportToModList::PLAINTXT: case ExportToModList::PLAINTXT:
break; break;
+2 -1
View File
@@ -7,6 +7,7 @@
#include "modplatform/ModIndex.h" #include "modplatform/ModIndex.h"
#include "modplatform/flame/FlameAPI.h" #include "modplatform/flame/FlameAPI.h"
#include "ui_ReviewMessageBox.h" #include "ui_ReviewMessageBox.h"
#include "StringUtils.h"
#include "Markdown.h" #include "Markdown.h"
@@ -473,7 +474,7 @@ void ModUpdateDialog::appendMod(CheckUpdateTask::UpdatableMod const& info, QStri
break; break;
} }
changelog_area->setHtml(text); changelog_area->setHtml(StringUtils::htmlListPatch(text));
changelog_area->setOpenExternalLinks(true); changelog_area->setOpenExternalLinks(true);
changelog_area->setLineWrapMode(QTextBrowser::LineWrapMode::WidgetWidth); changelog_area->setLineWrapMode(QTextBrowser::LineWrapMode::WidgetWidth);
changelog_area->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded); changelog_area->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded);
@@ -26,6 +26,7 @@
#include "BuildConfig.h" #include "BuildConfig.h"
#include "Markdown.h" #include "Markdown.h"
#include "ui_UpdateAvailableDialog.h" #include "ui_UpdateAvailableDialog.h"
#include "StringUtils.h"
UpdateAvailableDialog::UpdateAvailableDialog(const QString& currentVersion, UpdateAvailableDialog::UpdateAvailableDialog(const QString& currentVersion,
const QString& availableVersion, const QString& availableVersion,
@@ -43,7 +44,7 @@ UpdateAvailableDialog::UpdateAvailableDialog(const QString& currentVersion,
ui->icon->setPixmap(APPLICATION->getThemedIcon("checkupdate").pixmap(64)); ui->icon->setPixmap(APPLICATION->getThemedIcon("checkupdate").pixmap(64));
auto releaseNotesHtml = markdownToHTML(releaseNotes); auto releaseNotesHtml = markdownToHTML(releaseNotes);
ui->releaseNotes->setHtml(releaseNotesHtml); ui->releaseNotes->setHtml(StringUtils::htmlListPatch(releaseNotesHtml));
ui->releaseNotes->setOpenExternalLinks(true); ui->releaseNotes->setOpenExternalLinks(true);
connect(ui->skipButton, &QPushButton::clicked, this, [this]() { connect(ui->skipButton, &QPushButton::clicked, this, [this]() {
@@ -20,6 +20,7 @@
#include "InstanceTask.h" #include "InstanceTask.h"
#include "Json.h" #include "Json.h"
#include "Markdown.h" #include "Markdown.h"
#include "StringUtils.h"
#include "modplatform/modrinth/ModrinthPackManifest.h" #include "modplatform/modrinth/ModrinthPackManifest.h"
@@ -332,7 +333,7 @@ void ModrinthManagedPackPage::suggestVersion()
} }
auto version = m_pack.versions.at(index); auto version = m_pack.versions.at(index);
ui->changelogTextBrowser->setHtml(markdownToHTML(version.changelog.toUtf8())); ui->changelogTextBrowser->setHtml(StringUtils::htmlListPatch(markdownToHTML(version.changelog.toUtf8())));
ManagedPackPage::suggestVersion(); ManagedPackPage::suggestVersion();
} }
@@ -420,7 +421,7 @@ void FlameManagedPackPage::parseManagedPack()
"Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!" "Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!"
"</h4>"); "</h4>");
ui->changelogTextBrowser->setHtml(message); ui->changelogTextBrowser->setHtml(StringUtils::htmlListPatch(message));
return; return;
} }
@@ -502,7 +503,8 @@ void FlameManagedPackPage::suggestVersion()
} }
auto version = m_pack.versions.at(index); auto version = m_pack.versions.at(index);
ui->changelogTextBrowser->setHtml(m_api.getModFileChangelog(m_inst->getManagedPackID().toInt(), version.fileId)); ui->changelogTextBrowser->setHtml(StringUtils::htmlListPatch(
m_api.getModFileChangelog(m_inst->getManagedPackID().toInt(), version.fileId)));
ManagedPackPage::suggestVersion(); ManagedPackPage::suggestVersion();
} }
@@ -45,6 +45,7 @@
#include "Markdown.h" #include "Markdown.h"
#include "StringUtils.h"
#include "ui/dialogs/ResourceDownloadDialog.h" #include "ui/dialogs/ResourceDownloadDialog.h"
#include "ui/pages/modplatform/ResourceModel.h" #include "ui/pages/modplatform/ResourceModel.h"
#include "ui/widgets/ProjectItem.h" #include "ui/widgets/ProjectItem.h"
@@ -234,8 +235,8 @@ void ResourcePage::updateUi()
text += "<hr>"; text += "<hr>";
m_ui->packDescription->setHtml( m_ui->packDescription->setHtml(StringUtils::htmlListPatch(
text + (current_pack->extraData.body.isEmpty() ? current_pack->description : markdownToHTML(current_pack->extraData.body))); text + (current_pack->extraData.body.isEmpty() ? current_pack->description : markdownToHTML(current_pack->extraData.body))));
m_ui->packDescription->flush(); m_ui->packDescription->flush();
} }
@@ -39,6 +39,7 @@
#include "ui_AtlPage.h" #include "ui_AtlPage.h"
#include "BuildConfig.h" #include "BuildConfig.h"
#include "StringUtils.h"
#include "AtlUserInteractionSupportImpl.h" #include "AtlUserInteractionSupportImpl.h"
#include "modplatform/atlauncher/ATLPackInstallTask.h" #include "modplatform/atlauncher/ATLPackInstallTask.h"
@@ -144,7 +145,7 @@ void AtlPage::onSelectionChanged(QModelIndex first, [[maybe_unused]] QModelIndex
selected = filterModel->data(first, Qt::UserRole).value<ATLauncher::IndexedPack>(); selected = filterModel->data(first, Qt::UserRole).value<ATLauncher::IndexedPack>();
ui->packDescription->setHtml(selected.description.replace("\n", "<br>")); ui->packDescription->setHtml(StringUtils::htmlListPatch(selected.description.replace("\n", "<br>")));
for (const auto& version : selected.versions) { for (const auto& version : selected.versions) {
ui->versionSelectionBox->addItem(version.version); ui->versionSelectionBox->addItem(version.version);
@@ -46,6 +46,7 @@
#include "modplatform/flame/FlameAPI.h" #include "modplatform/flame/FlameAPI.h"
#include "ui/dialogs/NewInstanceDialog.h" #include "ui/dialogs/NewInstanceDialog.h"
#include "ui/widgets/ProjectItem.h" #include "ui/widgets/ProjectItem.h"
#include "StringUtils.h"
#include "net/ApiDownload.h" #include "net/ApiDownload.h"
@@ -292,6 +293,6 @@ void FlamePage::updateUi()
text += "<hr>"; text += "<hr>";
text += api.getModDescription(current.addonId).toUtf8(); text += api.getModDescription(current.addonId).toUtf8();
ui->packDescription->setHtml(text + current.description); ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description));
ui->packDescription->flush(); ui->packDescription->flush();
} }
@@ -37,6 +37,7 @@
#include "Page.h" #include "Page.h"
#include "ui/widgets/ProjectItem.h" #include "ui/widgets/ProjectItem.h"
#include "ui_Page.h" #include "ui_Page.h"
#include "StringUtils.h"
#include <QInputDialog> #include <QInputDialog>
@@ -260,8 +261,10 @@ void Page::onPackSelectionChanged(Modpack* pack)
{ {
ui->versionSelectionBox->clear(); ui->versionSelectionBox->clear();
if (pack) { if (pack) {
currentModpackInfo->setHtml("Pack by <b>" + pack->author + "</b>" + "<br>Minecraft " + pack->mcVersion + "<br>" + "<br>" + currentModpackInfo->setHtml(StringUtils::htmlListPatch(
pack->description + "<ul><li>" + pack->mods.replace(";", "</li><li>") + "</li></ul>"); "Pack by <b>" + pack->author + "</b>" + "<br>Minecraft " + pack->mcVersion +
"<br>" + "<br>" +
pack->description + "<ul><li>" + pack->mods.replace(";", "</li><li>") + "</li></ul>"));
bool currentAdded = false; bool currentAdded = false;
for (int i = 0; i < pack->oldVersions.size(); i++) { for (int i = 0; i < pack->oldVersions.size(); i++) {
@@ -44,6 +44,7 @@
#include "InstanceImportTask.h" #include "InstanceImportTask.h"
#include "Json.h" #include "Json.h"
#include "Markdown.h" #include "Markdown.h"
#include "StringUtils.h"
#include "ui/widgets/ProjectItem.h" #include "ui/widgets/ProjectItem.h"
@@ -304,7 +305,7 @@ void ModrinthPage::updateUI()
text += markdownToHTML(current.extra.body.toUtf8()); text += markdownToHTML(current.extra.body.toUtf8());
ui->packDescription->setHtml(text + current.description); ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description));
ui->packDescription->flush(); ui->packDescription->flush();
} }
@@ -47,6 +47,7 @@
#include "TechnicModel.h" #include "TechnicModel.h"
#include "modplatform/technic/SingleZipPackInstallTask.h" #include "modplatform/technic/SingleZipPackInstallTask.h"
#include "modplatform/technic/SolderPackInstallTask.h" #include "modplatform/technic/SolderPackInstallTask.h"
#include "StringUtils.h"
#include "Application.h" #include "Application.h"
#include "modplatform/technic/SolderPackManifest.h" #include "modplatform/technic/SolderPackManifest.h"
@@ -233,7 +234,7 @@ void TechnicPage::metadataLoaded()
text += "<br><br>"; text += "<br><br>";
ui->packDescription->setHtml(text + current.description); ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description));
// Strip trailing forward-slashes from Solder URL's // Strip trailing forward-slashes from Solder URL's
if (current.isSolder) { if (current.isSolder) {
@@ -26,6 +26,7 @@
#include <QTextBrowser> #include <QTextBrowser>
#include "Markdown.h" #include "Markdown.h"
#include "StringUtils.h"
SelectReleaseDialog::SelectReleaseDialog(const Version& current_version, const QList<GitHubRelease>& releases, QWidget* parent) SelectReleaseDialog::SelectReleaseDialog(const Version& current_version, const QList<GitHubRelease>& releases, QWidget* parent)
: QDialog(parent), m_releases(releases), m_currentVersion(current_version), ui(new Ui::SelectReleaseDialog) : QDialog(parent), m_releases(releases), m_currentVersion(current_version), ui(new Ui::SelectReleaseDialog)
@@ -96,7 +97,7 @@ void SelectReleaseDialog::selectionChanged(QTreeWidgetItem* current, QTreeWidget
QString body = markdownToHTML(release.body.toUtf8()); QString body = markdownToHTML(release.body.toUtf8());
m_selectedRelease = release; m_selectedRelease = release;
ui->changelogTextBrowser->setHtml(body); ui->changelogTextBrowser->setHtml(StringUtils::htmlListPatch(body));
} }
SelectReleaseAssetDialog::SelectReleaseAssetDialog(const QList<GitHubReleaseAsset>& assets, QWidget* parent) SelectReleaseAssetDialog::SelectReleaseAssetDialog(const QList<GitHubReleaseAsset>& assets, QWidget* parent)