Mercurial > minori
annotate src/gui/dialog/about.cc @ 286:53e3c015a973
anime: initial cross-service support
currently the Kitsu and MAL services don't work when chosen in the
GUI. This is because they haven't been implemented yet :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 08 May 2024 16:44:27 -0400 |
parents | 862d0d8619f6 |
children | ac1451035c85 |
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" |
55
d10b6c6b432e
add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
52
diff
changeset
|
6 #include "pugixml.hpp" |
258 | 7 |
8 #include <QCoreApplication> | |
51 | 9 #include <QFont> |
10 #include <QHBoxLayout> | |
63 | 11 #include <QTextBrowser> |
12 #include <QTextCharFormat> | |
13 #include <QTextCursor> | |
258 | 14 |
63 | 15 #include <curl/curl.h> |
108 | 16 #ifdef WIN32 |
258 | 17 # include "sys/win32/dark_theme.h" |
108 | 18 #endif |
51 | 19 |
258 | 20 template<typename T, size_t N> |
104 | 21 constexpr size_t array_size(T (&)[N]) { |
22 return N; | |
23 } | |
51 | 24 |
258 | 25 static constexpr semver::version pugixml_version{PUGIXML_VERSION / 1000 % 10, PUGIXML_VERSION / 10 % 100, |
26 PUGIXML_VERSION % 10}; | |
27 static constexpr semver::version json_version{NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, | |
28 NLOHMANN_JSON_VERSION_PATCH}; | |
255 | 29 static constexpr semver::version semver_version{SEMVER_VERSION_MAJOR, SEMVER_VERSION_MINOR, SEMVER_VERSION_PATCH}; |
51 | 30 |
104 | 31 const char* get_curl_version() { |
32 const curl_version_info_data* data = curl_version_info(CURLVERSION_NOW); | |
33 return data->version; | |
34 } | |
51 | 35 |
36 AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) { | |
104 | 37 setMinimumSize(641, 325); |
51 | 38 setWindowTitle(tr("About Minori")); |
39 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | |
40 setAutoFillBackground(true); | |
41 | |
108 | 42 QHBoxLayout* layout = new QHBoxLayout(this); |
104 | 43 |
108 | 44 /* we have to generate this on-the-fly for localization purposes */ |
258 | 45 const QString html = |
46 QString("<body>" | |
47 " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> v" + | |
48 Strings::ToQString(session.version.to_string()) + | |
49 "</h2>" | |
50 " <p>" | |
51 " <strong>" + | |
52 tr("Author:") + | |
53 "</strong><br>" | |
54 " Paper (@mrpapersonic)" | |
55 " </p>" | |
56 " <p>" | |
57 " <strong>" + | |
58 tr("Third party components:") + | |
59 "</strong><br>" | |
60 "<a href=\"https://curl.se/\">libcurl v") + | |
61 get_curl_version() + | |
62 "</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++ v" + | |
69 Strings::ToQString(json_version.to_string()) + | |
70 "</a>" | |
71 ", " | |
72 "<a href=\"https://pugixml.org/\">pugixml v" + | |
73 Strings::ToQString(pugixml_version.to_string()) + | |
74 "</a>" | |
75 ", " | |
76 "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" | |
77 ", " | |
78 "<a href=\"https://github.com/Neargye/semver\">semver v" + | |
79 Strings::ToQString(semver_version.to_string()) + | |
80 "</a>" | |
81 ", parts of " | |
82 "<a href=\"https://github.com/erengy/anisthesia\">Anisthesia</a>" | |
83 " </p>" | |
84 "<span>" | |
85 "<strong>" + | |
86 tr("Special thanks:") + | |
87 "</strong>" | |
88 "</span>" | |
89 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
90 " <li><strong>Eren Okka</strong> " + | |
91 tr("for creating Taiga") + | |
92 "</li>" | |
93 " <li><strong>Alex Huszagh</strong> " + | |
94 tr("and") + " <strong>Colin Duquesnoy</strong> " + | |
95 tr("for creating BreezeStyleSheets, on which the dark theme in this program is " | |
96 "based off of") + | |
97 "</li>" | |
98 " <li><strong>Andy Brice</strong> " + | |
99 tr("for providing some sample code for " | |
100 "detecting dark mode on Windows and macOS") + | |
101 "</li>" | |
102 " <li><strong>Manuel Wudka-Robles</strong> " + | |
103 tr("for providing information on " | |
104 "getting open file descriptors on macOS") + | |
105 "</li>" | |
106 " </ul>" | |
107 "</body>"; | |
108 | 108 |
109 { | |
110 QPalette pal = QPalette(); | |
111 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); | |
112 setPalette(pal); | |
113 } | |
114 | |
115 { | |
116 QTextBrowser* paragraph = new QTextBrowser(this); | |
117 paragraph->setOpenExternalLinks(true); | |
118 paragraph->setFrameShape(QFrame::NoFrame); | |
119 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
120 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
121 paragraph->setHtml(html); | |
122 | |
123 layout->addWidget(paragraph); | |
124 } | |
51 | 125 } |
108 | 126 |
127 void AboutWindow::showEvent(QShowEvent* event) { | |
128 QDialog::showEvent(event); | |
129 #ifdef WIN32 | |
130 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
131 #endif | |
132 } |