Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
107:49c8d1976869 | 108:2004b41d4a59 |
---|---|
1 #include "gui/dialog/about.h" | 1 #include "gui/dialog/about.h" |
2 #include "core/json.h" | 2 #include "core/json.h" |
3 #include "core/version.h" | 3 #include "core/version.h" |
4 #include "core/session.h" | |
4 #include "core/strings.h" | 5 #include "core/strings.h" |
5 #include "gui/widgets/text.h" | 6 #include "gui/widgets/text.h" |
6 #include "pugixml.hpp" | 7 #include "pugixml.hpp" |
7 #include <QFont> | 8 #include <QFont> |
8 #include <QHBoxLayout> | 9 #include <QHBoxLayout> |
9 #include <QTextBrowser> | 10 #include <QTextBrowser> |
10 #include <QTextCharFormat> | 11 #include <QTextCharFormat> |
11 #include <QTextCursor> | 12 #include <QTextCursor> |
13 #include <QCoreApplication> | |
12 #include <curl/curl.h> | 14 #include <curl/curl.h> |
15 #ifdef WIN32 | |
16 #include "sys/win32/dark_theme.h" | |
17 #endif | |
13 | 18 |
14 template <typename T, size_t N> | 19 template <typename T, size_t N> |
15 constexpr size_t array_size(T (&)[N]) { | 20 constexpr size_t array_size(T (&)[N]) { |
16 return N; | 21 return N; |
17 } | 22 } |
18 | 23 |
24 /* used for JSON for Modern C++ */ | |
19 #define CONCAT_VERSION_NX(major, minor, patch) "v" #major "." #minor "." #patch | 25 #define CONCAT_VERSION_NX(major, minor, patch) "v" #major "." #minor "." #patch |
20 #define CONCAT_VERSION(major, minor, patch) CONCAT_VERSION_NX(major, minor, patch) | 26 #define CONCAT_VERSION(major, minor, patch) CONCAT_VERSION_NX(major, minor, patch) |
21 | 27 |
22 /* Ahhh, my dumb little hack to get this to be constexpr :) */ | 28 /* Ahhh, my dumb little hack to get this to be constexpr :) */ |
23 static constexpr const char pugixml_version[] = { | 29 static constexpr const char pugixml_version[] = { |
33 const char* get_curl_version() { | 39 const char* get_curl_version() { |
34 const curl_version_info_data* data = curl_version_info(CURLVERSION_NOW); | 40 const curl_version_info_data* data = curl_version_info(CURLVERSION_NOW); |
35 return data->version; | 41 return data->version; |
36 } | 42 } |
37 | 43 |
38 /* I hate HTML so much... */ | |
39 static const QString html = QString( | |
40 "<body>" | |
41 " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> " MINORI_VERSION "</h2>" | |
42 " <p>" | |
43 " <strong>Author:</strong><br>" | |
44 " Paper (@mrpapersonic)" | |
45 " </p>" | |
46 " <p>" | |
47 " <strong>Third party components:</strong><br>" | |
48 "<a href=\"https://curl.se/\">libcurl v") + get_curl_version() + "</a>" | |
49 ", " | |
50 "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" | |
51 ", " | |
52 "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" | |
53 ", " | |
54 "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ " CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, | |
55 NLOHMANN_JSON_VERSION_MINOR, | |
56 NLOHMANN_JSON_VERSION_PATCH) "</a>" | |
57 ", " | |
58 "<a href=\"https://pugixml.org/\">pugixml v" + pugixml_version + "</a>" | |
59 ", " | |
60 "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" | |
61 " </p>" | |
62 "<span>" | |
63 "<strong>Special thanks:</strong>" | |
64 "</span>" | |
65 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
66 " <li><strong>Eren Okka</strong> for creating Taiga</li>" | |
67 " <li><strong>Alex Huszagh</strong> and <strong>Colin Duquesnoy</strong> for " | |
68 "creating BreezeStyleSheets, on which the dark theme in this program is " | |
69 "based off of</li>" | |
70 " <li><strong>Andy Brice</strong> for making " | |
71 " </ul>" | |
72 "</body>"; | |
73 | |
74 AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) { | 44 AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) { |
75 setMinimumSize(641, 325); | 45 setMinimumSize(641, 325); |
76 setWindowTitle(tr("About Minori")); | 46 setWindowTitle(tr("About Minori")); |
77 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | 47 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); |
48 setAutoFillBackground(true); | |
49 | |
78 QHBoxLayout* layout = new QHBoxLayout(this); | 50 QHBoxLayout* layout = new QHBoxLayout(this); |
79 | 51 |
80 QPalette pal = QPalette(); | 52 /* we have to generate this on-the-fly for localization purposes */ |
81 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); | 53 static const QString html = QString( |
82 setPalette(pal); | 54 "<body>" |
83 setAutoFillBackground(true); | 55 " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> " MINORI_VERSION "</h2>" |
56 " <p>" | |
57 " <strong>" + QCoreApplication::tr("Author:") + "</strong><br>" | |
58 " Paper (@mrpapersonic)" | |
59 " </p>" | |
60 " <p>" | |
61 " <strong>" + QCoreApplication::tr("Third party components:") + "</strong><br>" | |
62 "<a href=\"https://curl.se/\">libcurl v") + get_curl_version() + "</a>" | |
63 ", " | |
64 "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" | |
65 ", " | |
66 "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" | |
67 ", " | |
68 "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ " CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, | |
69 NLOHMANN_JSON_VERSION_MINOR, | |
70 NLOHMANN_JSON_VERSION_PATCH) "</a>" | |
71 ", " | |
72 "<a href=\"https://pugixml.org/\">pugixml v" + pugixml_version + "</a>" | |
73 ", " | |
74 "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" | |
75 " </p>" | |
76 "<span>" | |
77 "<strong>" + QCoreApplication::tr("Special thanks:") + "</strong>" | |
78 "</span>" | |
79 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
80 " <li><strong>Eren Okka</strong> " + QCoreApplication::tr("for creating Taiga") + "</li>" | |
81 " <li><strong>Alex Huszagh</strong> " + QCoreApplication::tr("and") + " <strong>Colin Duquesnoy</strong> " + | |
82 QCoreApplication::tr("for creating BreezeStyleSheets, on which the dark theme in this program is " | |
83 "based off of") + "</li>" | |
84 " <li><strong>Andy Brice</strong> " + QCoreApplication::tr("for providing some sample code for " | |
85 "detecting dark mode on Windows and macOS") + "</li>" | |
86 " <li><strong>Manuel Wudka-Robles</strong> " + QCoreApplication::tr("for providing information on " | |
87 "getting open file descriptors on macOS") + "</li>" | |
88 " </ul>" | |
89 "</body>"; | |
84 | 90 |
85 QTextBrowser* paragraph = new QTextBrowser(this); | 91 { |
86 paragraph->setOpenExternalLinks(true); | 92 QPalette pal = QPalette(); |
87 paragraph->setFrameShape(QFrame::NoFrame); | 93 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); |
88 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 94 setPalette(pal); |
89 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 95 } |
90 paragraph->setHtml(html); | |
91 | 96 |
92 layout->addWidget(paragraph); | 97 { |
98 QTextBrowser* paragraph = new QTextBrowser(this); | |
99 paragraph->setOpenExternalLinks(true); | |
100 paragraph->setFrameShape(QFrame::NoFrame); | |
101 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
102 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
103 paragraph->setHtml(html); | |
104 | |
105 layout->addWidget(paragraph); | |
106 } | |
93 } | 107 } |
108 | |
109 void AboutWindow::showEvent(QShowEvent* event) { | |
110 QDialog::showEvent(event); | |
111 #ifdef WIN32 | |
112 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
113 #endif | |
114 } | |
115 | |
116 #include "gui/dialog/moc_about.cpp" |