Mercurial > minori
annotate src/gui/dialog/about.cc @ 106:c8c72278f6fd
*: #if -> #ifdef, remove outdated comments in sys/win32/dark_theme.cc
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Sun, 05 Nov 2023 04:01:58 -0500 |
| parents | 6d8da6e64d61 |
| children | 2004b41d4a59 |
| rev | line source |
|---|---|
| 51 | 1 #include "gui/dialog/about.h" |
| 2 #include "core/json.h" | |
| 63 | 3 #include "core/version.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" |
| 51 | 7 #include <QFont> |
| 8 #include <QHBoxLayout> | |
| 63 | 9 #include <QTextBrowser> |
| 10 #include <QTextCharFormat> | |
| 11 #include <QTextCursor> | |
| 12 #include <curl/curl.h> | |
| 51 | 13 |
| 104 | 14 template <typename T, size_t N> |
| 15 constexpr size_t array_size(T (&)[N]) { | |
| 16 return N; | |
| 17 } | |
| 51 | 18 |
| 104 | 19 #define CONCAT_VERSION_NX(major, minor, patch) "v" #major "." #minor "." #patch |
| 63 | 20 #define CONCAT_VERSION(major, minor, patch) CONCAT_VERSION_NX(major, minor, patch) |
| 51 | 21 |
| 104 | 22 /* Ahhh, my dumb little hack to get this to be constexpr :) */ |
| 23 static constexpr const char pugixml_version[] = { | |
| 24 PUGIXML_VERSION / 1000 % 10 + '0', /* Major */ | |
| 25 '.', | |
| 26 PUGIXML_VERSION / 100 % 10 + '0', /* Minor */ | |
| 27 PUGIXML_VERSION / 10 % 10 + '0', | |
| 28 '.', | |
| 29 PUGIXML_VERSION % 10 + '0', /* Patch */ | |
| 30 '\0' | |
| 31 }; | |
| 51 | 32 |
| 104 | 33 const char* get_curl_version() { |
| 34 const curl_version_info_data* data = curl_version_info(CURLVERSION_NOW); | |
| 35 return data->version; | |
| 36 } | |
| 51 | 37 |
| 104 | 38 /* I hate HTML so much... */ |
| 39 static const QString html = QString( | |
| 40 "<body>" | |
| 41 " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> " MINORI_VERSION "</h2>" | |
| 42 " <p>" | |
| 43 " <strong>Author:</strong><br>" | |
| 44 " Paper (@mrpapersonic)" | |
| 45 " </p>" | |
| 46 " <p>" | |
| 47 " <strong>Third party components:</strong><br>" | |
| 48 "<a href=\"https://curl.se/\">libcurl v") + get_curl_version() + "</a>" | |
| 49 ", " | |
| 50 "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" | |
| 51 ", " | |
| 52 "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" | |
| 53 ", " | |
| 54 "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ " CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, | |
| 55 NLOHMANN_JSON_VERSION_MINOR, | |
| 56 NLOHMANN_JSON_VERSION_PATCH) "</a>" | |
| 57 ", " | |
| 58 "<a href=\"https://pugixml.org/\">pugixml v" + pugixml_version + "</a>" | |
| 59 ", " | |
| 60 "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" | |
| 61 " </p>" | |
| 62 "<span>" | |
| 63 "<strong>Special thanks:</strong>" | |
| 64 "</span>" | |
| 65 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
| 66 " <li><strong>Eren Okka</strong> for creating Taiga</li>" | |
| 67 " <li><strong>Alex Huszagh</strong> and <strong>Colin Duquesnoy</strong> for " | |
| 68 "creating BreezeStyleSheets, on which the dark theme in this program is " | |
| 69 "based off of</li>" | |
|
105
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents:
104
diff
changeset
|
70 " <li><strong>Andy Brice</strong> for making " |
| 104 | 71 " </ul>" |
| 72 "</body>"; | |
| 51 | 73 |
| 74 AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) { | |
| 104 | 75 setMinimumSize(641, 325); |
| 51 | 76 setWindowTitle(tr("About Minori")); |
| 77 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | |
| 64 | 78 QHBoxLayout* layout = new QHBoxLayout(this); |
| 51 | 79 |
| 80 QPalette pal = QPalette(); | |
| 81 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); | |
| 82 setPalette(pal); | |
| 83 setAutoFillBackground(true); | |
| 84 | |
| 85 QTextBrowser* paragraph = new QTextBrowser(this); | |
| 86 paragraph->setOpenExternalLinks(true); | |
|
52
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
87 paragraph->setFrameShape(QFrame::NoFrame); |
|
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
88 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
89 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 104 | 90 paragraph->setHtml(html); |
| 91 | |
| 64 | 92 layout->addWidget(paragraph); |
| 51 | 93 } |
