Mercurial > minori
annotate src/gui/dialog/about.cc @ 319:d928ec7b6a0d
services/kitsu: implement GetAnimeList()
it finally works!
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 17:52:26 -0400 |
parents | 3b355fa948c7 |
children | e9d040e2045f |
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/Neargye/semver\">semver v" + | |
80 Strings::ToQString(semver_version.to_string()) + | |
81 "</a>" | |
292 | 82 ", " |
83 "<a href=\"http://juliastrings.github.io/utf8proc/\">utf8proc v" + | |
84 Strings::ToQString(utf8proc_version()) + | |
85 "</a>" | |
258 | 86 ", parts of " |
87 "<a href=\"https://github.com/erengy/anisthesia\">Anisthesia</a>" | |
88 " </p>" | |
89 "<span>" | |
90 "<strong>" + | |
91 tr("Special thanks:") + | |
92 "</strong>" | |
93 "</span>" | |
94 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
95 " <li><strong>Eren Okka</strong> " + | |
292 | 96 tr("for creating <a href=\"https://taiga.moe/\">Taiga</a>") + |
258 | 97 "</li>" |
98 " <li><strong>Alex Huszagh</strong> " + | |
99 tr("and") + " <strong>Colin Duquesnoy</strong> " + | |
100 tr("for creating BreezeStyleSheets, on which the dark theme in this program is " | |
101 "based off of") + | |
102 "</li>" | |
103 " <li><strong>Andy Brice</strong> " + | |
104 tr("for providing some sample code for " | |
105 "detecting dark mode on Windows and macOS") + | |
106 "</li>" | |
107 " <li><strong>Manuel Wudka-Robles</strong> " + | |
108 tr("for providing information on " | |
109 "getting open file descriptors on macOS") + | |
110 "</li>" | |
111 " </ul>" | |
112 "</body>"; | |
108 | 113 |
294 | 114 setBackgroundRole(QPalette::Base); |
108 | 115 |
116 { | |
117 QTextBrowser* paragraph = new QTextBrowser(this); | |
118 paragraph->setOpenExternalLinks(true); | |
119 paragraph->setFrameShape(QFrame::NoFrame); | |
120 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
121 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
122 paragraph->setHtml(html); | |
123 | |
124 layout->addWidget(paragraph); | |
125 } | |
51 | 126 } |
108 | 127 |
128 void AboutWindow::showEvent(QShowEvent* event) { | |
129 QDialog::showEvent(event); | |
130 #ifdef WIN32 | |
131 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
132 #endif | |
133 } |