Move credits to a HTML resource

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-10-25 14:34:42 +01:00
parent 3c5431176b
commit 21a8ac530a
3 changed files with 47 additions and 70 deletions

View File

@@ -45,80 +45,15 @@
#include <qobject.h>
namespace {
QString getLink(QString link, QString name)
{
return QString("&lt;<a href='%1'>%2</a>&gt;").arg(link).arg(name);
}
QString getWebsite(QString link)
{
return getLink(link, QObject::tr("Website"));
}
QString getGitHub(QString username)
{
return getLink("https://github.com/" + username, "GitHub");
}
// Credits
// This is a hack, but I can't think of a better way to do this easily without screwing with QTextDocument...
QString getCreditsHtml()
{
QString output;
QTextStream stream(&output);
#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
stream.setCodec(QTextCodec::codecForName("UTF-8"));
#endif
stream << "<center>\n";
QFile dataFile(":/documents/credits.html");
dataFile.open(QIODevice::ReadOnly);
//: %1 is the name of the launcher, determined at build time, e.g. "Prism Launcher Developers"
stream << "<h3>" << QObject::tr("%1 Developers", "About Credits").arg(BuildConfig.LAUNCHER_DISPLAYNAME) << "</h3>\n";
stream << QString("<p>Sefa Eyeoglu (Scrumplex) %1</p>\n").arg(getWebsite("https://scrumplex.net"));
stream << QString("<p>d-513 %1</p>\n").arg(getGitHub("d-513"));
stream << QString("<p>txtsd %1</p>\n").arg(getWebsite("https://ihavea.quest"));
stream << QString("<p>timoreo %1</p>\n").arg(getGitHub("timoreo22"));
stream << QString("<p>ZekeZ %1</p>\n").arg(getGitHub("ZekeZDev"));
stream << QString("<p>cozyGalvinism %1</p>\n").arg(getGitHub("cozyGalvinism"));
stream << QString("<p>DioEgizio %1</p>\n").arg(getGitHub("DioEgizio"));
stream << QString("<p>flowln %1</p>\n").arg(getGitHub("flowln"));
stream << QString("<p>ViRb3 %1</p>\n").arg(getGitHub("ViRb3"));
stream << QString("<p>Rachel Powers (Ryex) %1</p>\n").arg(getGitHub("Ryex"));
stream << QString("<p>TayouVR %1</p>\n").arg(getGitHub("TayouVR"));
stream << QString("<p>TheKodeToad %1</p>\n").arg(getGitHub("TheKodeToad"));
stream << QString("<p>getchoo %1</p>\n").arg(getGitHub("getchoo"));
stream << QString("<p>Alexandru Tripon (Trial97) %1</p>\n").arg(getGitHub("Trial97"));
stream << "<br />\n";
QString fileContent = QString::fromUtf8(dataFile.readAll());
// TODO: possibly retrieve from git history at build time?
//: %1 is the name of the launcher, determined at build time, e.g. "Prism Launcher Developers"
stream << "<h3>" << QObject::tr("%1 Developers", "About Credits").arg("MultiMC") << "</h3>\n";
stream << "<p>Andrew Okin &lt;<a href='mailto:forkk@forkk.net'>forkk@forkk.net</a>&gt;</p>\n";
stream << QString("<p>Petr Mrázek &lt;<a href='mailto:peterix@gmail.com'>peterix@gmail.com</a>&gt;</p>\n");
stream << "<p>Sky Welch &lt;<a href='mailto:multimc@bunnies.io'>multimc@bunnies.io</a>&gt;</p>\n";
stream << "<p>Jan (02JanDal) &lt;<a href='mailto:02jandal@gmail.com'>02jandal@gmail.com</a>&gt;</p>\n";
stream << "<p>RoboSky &lt;<a href='https://twitter.com/RoboSky_'>@RoboSky_</a>&gt;</p>\n";
stream << "<br />\n";
stream << "<h3>" << QObject::tr("With thanks to", "About Credits") << "</h3>\n";
stream << QString("<p>Boba %1</p>\n").arg(getWebsite("https://bobaonline.neocities.org/"));
stream << QString("<p>AutiOne %1</p>\n").arg(getWebsite("https://auti.one/"));
stream << QString("<p>Fulmine %1</p>\n").arg(getWebsite("https://fulmine.xyz/"));
stream << QString("<p>ely %1</p>\n").arg(getGitHub("elyrodso"));
stream << QString("<p>gon sawa %1</p>\n").arg(getGitHub("gonsawa"));
stream << QString("<p>Pankakes</p>\n");
stream << QString("<p>tobimori %1</p>\n").arg(getGitHub("tobimori"));
stream << "<p>Orochimarufan &lt;<a href='mailto:orochimarufan.x3@gmail.com'>orochimarufan.x3@gmail.com</a>&gt;</p>\n";
stream << "<p>TakSuyu &lt;<a href='mailto:taksuyu@gmail.com'>taksuyu@gmail.com</a>&gt;</p>\n";
stream << "<p>Kilobyte &lt;<a href='mailto:stiepen22@gmx.de'>stiepen22@gmx.de</a>&gt;</p>\n";
stream << "<p>Rootbear75 &lt;<a href='https://twitter.com/rootbear75'>@rootbear75</a>&gt;</p>\n";
stream << "<p>Zeker Zhayard &lt;<a href='https://twitter.com/zeker_zhayard'>@Zeker_Zhayard</a>&gt;</p>\n";
stream << "<p>Everyone who helped establish our branding!</p>\n";
stream
<< "<p>And everyone else who <a href='https://github.com/PrismLauncher/PrismLauncher/graphs/contributors'>contributed</a>!</p>\n";
stream << "<br />\n";
stream << "</center>\n";
return output;
return fileContent.arg(QObject::tr("%1 Developers").arg(BuildConfig.LAUNCHER_DISPLAYNAME), QObject::tr("MultiMC Developers"),
QObject::tr("With special thanks to"));
}
QString getLicenseHtml()