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