Mercurial > minori
diff src/gui/dialog/about.cc @ 108:2004b41d4a59
*: huge commit
1. WORKING LOCALIZATION + translation for Spanish and British English
2. idk like 2 changes for the dark theme :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 23:31:49 -0500 |
parents | 6d8da6e64d61 |
children | 649786bae914 |
line wrap: on
line diff
--- a/src/gui/dialog/about.cc Sun Nov 05 17:44:49 2023 -0500 +++ b/src/gui/dialog/about.cc Sun Nov 05 23:31:49 2023 -0500 @@ -1,6 +1,7 @@ #include "gui/dialog/about.h" #include "core/json.h" #include "core/version.h" +#include "core/session.h" #include "core/strings.h" #include "gui/widgets/text.h" #include "pugixml.hpp" @@ -9,13 +10,18 @@ #include <QTextBrowser> #include <QTextCharFormat> #include <QTextCursor> +#include <QCoreApplication> #include <curl/curl.h> +#ifdef WIN32 +#include "sys/win32/dark_theme.h" +#endif template <typename T, size_t N> constexpr size_t array_size(T (&)[N]) { return N; } +/* used for JSON for Modern C++ */ #define CONCAT_VERSION_NX(major, minor, patch) "v" #major "." #minor "." #patch #define CONCAT_VERSION(major, minor, patch) CONCAT_VERSION_NX(major, minor, patch) @@ -35,59 +41,76 @@ return data->version; } -/* I hate HTML so much... */ -static const QString html = QString( - "<body>" - " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> " MINORI_VERSION "</h2>" - " <p>" - " <strong>Author:</strong><br>" - " Paper (@mrpapersonic)" - " </p>" - " <p>" - " <strong>Third party components:</strong><br>" - "<a href=\"https://curl.se/\">libcurl v") + get_curl_version() + "</a>" - ", " - "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" - ", " - "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" - ", " - "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ " CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, - NLOHMANN_JSON_VERSION_MINOR, - NLOHMANN_JSON_VERSION_PATCH) "</a>" - ", " - "<a href=\"https://pugixml.org/\">pugixml v" + pugixml_version + "</a>" - ", " - "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" - " </p>" - "<span>" - "<strong>Special thanks:</strong>" - "</span>" - " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" - " <li><strong>Eren Okka</strong> for creating Taiga</li>" - " <li><strong>Alex Huszagh</strong> and <strong>Colin Duquesnoy</strong> for " - "creating BreezeStyleSheets, on which the dark theme in this program is " - "based off of</li>" - " <li><strong>Andy Brice</strong> for making " - " </ul>" - "</body>"; - AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) { setMinimumSize(641, 325); setWindowTitle(tr("About Minori")); setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); - QHBoxLayout* layout = new QHBoxLayout(this); - - QPalette pal = QPalette(); - pal.setColor(QPalette::Window, pal.color(QPalette::Base)); - setPalette(pal); setAutoFillBackground(true); - QTextBrowser* paragraph = new QTextBrowser(this); - paragraph->setOpenExternalLinks(true); - paragraph->setFrameShape(QFrame::NoFrame); - paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - paragraph->setHtml(html); + QHBoxLayout* layout = new QHBoxLayout(this); - layout->addWidget(paragraph); + /* we have to generate this on-the-fly for localization purposes */ + static const QString html = QString( + "<body>" + " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> " MINORI_VERSION "</h2>" + " <p>" + " <strong>" + QCoreApplication::tr("Author:") + "</strong><br>" + " Paper (@mrpapersonic)" + " </p>" + " <p>" + " <strong>" + QCoreApplication::tr("Third party components:") + "</strong><br>" + "<a href=\"https://curl.se/\">libcurl v") + get_curl_version() + "</a>" + ", " + "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" + ", " + "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" + ", " + "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ " CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, + NLOHMANN_JSON_VERSION_MINOR, + NLOHMANN_JSON_VERSION_PATCH) "</a>" + ", " + "<a href=\"https://pugixml.org/\">pugixml v" + pugixml_version + "</a>" + ", " + "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" + " </p>" + "<span>" + "<strong>" + QCoreApplication::tr("Special thanks:") + "</strong>" + "</span>" + " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" + " <li><strong>Eren Okka</strong> " + QCoreApplication::tr("for creating Taiga") + "</li>" + " <li><strong>Alex Huszagh</strong> " + QCoreApplication::tr("and") + " <strong>Colin Duquesnoy</strong> " + + QCoreApplication::tr("for creating BreezeStyleSheets, on which the dark theme in this program is " + "based off of") + "</li>" + " <li><strong>Andy Brice</strong> " + QCoreApplication::tr("for providing some sample code for " + "detecting dark mode on Windows and macOS") + "</li>" + " <li><strong>Manuel Wudka-Robles</strong> " + QCoreApplication::tr("for providing information on " + "getting open file descriptors on macOS") + "</li>" + " </ul>" + "</body>"; + + { + QPalette pal = QPalette(); + pal.setColor(QPalette::Window, pal.color(QPalette::Base)); + setPalette(pal); + } + + { + QTextBrowser* paragraph = new QTextBrowser(this); + paragraph->setOpenExternalLinks(true); + paragraph->setFrameShape(QFrame::NoFrame); + paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + paragraph->setHtml(html); + + layout->addWidget(paragraph); + } } + +void AboutWindow::showEvent(QShowEvent* event) { + QDialog::showEvent(event); +#ifdef WIN32 + win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); +#endif +} + +#include "gui/dialog/moc_about.cpp"