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