Mercurial > minori
annotate src/gui/dialog/about.cc @ 311:fb0f6b5050ff
linux: add required blank svg icon (???)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 11 Jun 2024 13:08:41 -0400 |
parents | 99cbc51433e4 |
children | 3b355fa948c7 |
rev | line source |
---|---|
51 | 1 #include "gui/dialog/about.h" |
2 #include "core/json.h" | |
108 | 3 #include "core/session.h" |
104 | 4 #include "core/strings.h" |
63 | 5 #include "gui/widgets/text.h" |
292 | 6 |
55
d10b6c6b432e
add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
52
diff
changeset
|
7 #include "pugixml.hpp" |
258 | 8 |
292 | 9 #include "utf8proc.h" |
10 | |
258 | 11 #include <QCoreApplication> |
51 | 12 #include <QFont> |
13 #include <QHBoxLayout> | |
63 | 14 #include <QTextBrowser> |
15 #include <QTextCharFormat> | |
16 #include <QTextCursor> | |
258 | 17 |
63 | 18 #include <curl/curl.h> |
108 | 19 #ifdef WIN32 |
258 | 20 # include "sys/win32/dark_theme.h" |
108 | 21 #endif |
51 | 22 |
258 | 23 template<typename T, size_t N> |
104 | 24 constexpr size_t array_size(T (&)[N]) { |
25 return N; | |
26 } | |
51 | 27 |
258 | 28 static constexpr semver::version pugixml_version{PUGIXML_VERSION / 1000 % 10, PUGIXML_VERSION / 10 % 100, |
29 PUGIXML_VERSION % 10}; | |
30 static constexpr semver::version json_version{NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, | |
31 NLOHMANN_JSON_VERSION_PATCH}; | |
255 | 32 static constexpr semver::version semver_version{SEMVER_VERSION_MAJOR, SEMVER_VERSION_MINOR, SEMVER_VERSION_PATCH}; |
51 | 33 |
104 | 34 const char* get_curl_version() { |
35 const curl_version_info_data* data = curl_version_info(CURLVERSION_NOW); | |
36 return data->version; | |
37 } | |
51 | 38 |
39 AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) { | |
104 | 40 setMinimumSize(641, 325); |
51 | 41 setWindowTitle(tr("About Minori")); |
42 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | |
43 setAutoFillBackground(true); | |
44 | |
108 | 45 QHBoxLayout* layout = new QHBoxLayout(this); |
104 | 46 |
108 | 47 /* we have to generate this on-the-fly for localization purposes */ |
258 | 48 const QString html = |
49 QString("<body>" | |
50 " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> v" + | |
51 Strings::ToQString(session.version.to_string()) + | |
52 "</h2>" | |
53 " <p>" | |
54 " <strong>" + | |
55 tr("Author:") + | |
56 "</strong><br>" | |
57 " Paper (@mrpapersonic)" | |
58 " </p>" | |
59 " <p>" | |
60 " <strong>" + | |
61 tr("Third party components:") + | |
62 "</strong><br>" | |
63 "<a href=\"https://curl.se/\">libcurl v") + | |
64 get_curl_version() + | |
65 "</a>" | |
66 ", " | |
67 "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" | |
68 ", " | |
69 "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" | |
70 ", " | |
71 "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ v" + | |
72 Strings::ToQString(json_version.to_string()) + | |
73 "</a>" | |
74 ", " | |
75 "<a href=\"https://pugixml.org/\">pugixml v" + | |
76 Strings::ToQString(pugixml_version.to_string()) + | |
77 "</a>" | |
78 ", " | |
79 "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" | |
80 ", " | |
81 "<a href=\"https://github.com/Neargye/semver\">semver v" + | |
82 Strings::ToQString(semver_version.to_string()) + | |
83 "</a>" | |
292 | 84 ", " |
85 "<a href=\"http://juliastrings.github.io/utf8proc/\">utf8proc v" + | |
86 Strings::ToQString(utf8proc_version()) + | |
87 "</a>" | |
258 | 88 ", parts of " |
89 "<a href=\"https://github.com/erengy/anisthesia\">Anisthesia</a>" | |
90 " </p>" | |
91 "<span>" | |
92 "<strong>" + | |
93 tr("Special thanks:") + | |
94 "</strong>" | |
95 "</span>" | |
96 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
97 " <li><strong>Eren Okka</strong> " + | |
292 | 98 tr("for creating <a href=\"https://taiga.moe/\">Taiga</a>") + |
258 | 99 "</li>" |
100 " <li><strong>Alex Huszagh</strong> " + | |
101 tr("and") + " <strong>Colin Duquesnoy</strong> " + | |
102 tr("for creating BreezeStyleSheets, on which the dark theme in this program is " | |
103 "based off of") + | |
104 "</li>" | |
105 " <li><strong>Andy Brice</strong> " + | |
106 tr("for providing some sample code for " | |
107 "detecting dark mode on Windows and macOS") + | |
108 "</li>" | |
109 " <li><strong>Manuel Wudka-Robles</strong> " + | |
110 tr("for providing information on " | |
111 "getting open file descriptors on macOS") + | |
112 "</li>" | |
113 " </ul>" | |
114 "</body>"; | |
108 | 115 |
294 | 116 setBackgroundRole(QPalette::Base); |
108 | 117 |
118 { | |
119 QTextBrowser* paragraph = new QTextBrowser(this); | |
120 paragraph->setOpenExternalLinks(true); | |
121 paragraph->setFrameShape(QFrame::NoFrame); | |
122 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
123 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
124 paragraph->setHtml(html); | |
125 | |
126 layout->addWidget(paragraph); | |
127 } | |
51 | 128 } |
108 | 129 |
130 void AboutWindow::showEvent(QShowEvent* event) { | |
131 QDialog::showEvent(event); | |
132 #ifdef WIN32 | |
133 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
134 #endif | |
135 } |