Mercurial > minori
annotate src/gui/dialog/about.cc @ 235:593108b3d555
dep/animia: x11: finalize xcb conversion
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Tue, 16 Jan 2024 15:22:29 -0500 |
| parents | 7ca56c4ac0bc |
| children | 4d461ef7d424 |
| 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" |
| 51 | 7 #include <QFont> |
| 8 #include <QHBoxLayout> | |
| 63 | 9 #include <QTextBrowser> |
| 10 #include <QTextCharFormat> | |
| 11 #include <QTextCursor> | |
| 108 | 12 #include <QCoreApplication> |
| 63 | 13 #include <curl/curl.h> |
| 108 | 14 #ifdef WIN32 |
| 15 #include "sys/win32/dark_theme.h" | |
| 16 #endif | |
| 51 | 17 |
| 104 | 18 template <typename T, size_t N> |
| 19 constexpr size_t array_size(T (&)[N]) { | |
| 20 return N; | |
| 21 } | |
| 51 | 22 |
| 104 | 23 /* Ahhh, my dumb little hack to get this to be constexpr :) */ |
| 24 static constexpr const char pugixml_version[] = { | |
| 25 PUGIXML_VERSION / 1000 % 10 + '0', /* Major */ | |
| 26 '.', | |
| 27 PUGIXML_VERSION / 100 % 10 + '0', /* Minor */ | |
| 28 PUGIXML_VERSION / 10 % 10 + '0', | |
| 29 '.', | |
| 30 PUGIXML_VERSION % 10 + '0', /* Patch */ | |
| 31 '\0' | |
| 32 }; | |
| 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 */ |
| 189 | 48 const QString html = QString( |
| 108 | 49 "<body>" |
|
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
189
diff
changeset
|
50 " <h2 style=\"font-weight: normal;\"><strong>Minori</strong> v" + Strings::ToQString(session.version.to_string()) + "</h2>" |
| 108 | 51 " <p>" |
|
224
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
52 " <strong>" + tr("Author:") + "</strong><br>" |
| 108 | 53 " Paper (@mrpapersonic)" |
| 54 " </p>" | |
| 55 " <p>" | |
|
224
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
56 " <strong>" + tr("Third party components:") + "</strong><br>" |
| 108 | 57 "<a href=\"https://curl.se/\">libcurl v") + get_curl_version() + "</a>" |
| 58 ", " | |
| 59 "<a href=\"https://p.yusukekamiyamane.com/\">Fugue Icons v3.5.6</a>" | |
| 60 ", " | |
| 61 "<a href=\"https://github.com/erengy/anitomy\">Anitomy</a>" | |
| 62 ", " | |
| 189 | 63 "<a href=\"https://github.com/nlohmann/json\">JSON for Modern C++ v" + QString::number(NLOHMANN_JSON_VERSION_MAJOR) + "." + |
| 64 QString::number(NLOHMANN_JSON_VERSION_MINOR) + "." + | |
| 65 QString::number(NLOHMANN_JSON_VERSION_PATCH) + "</a>" | |
| 108 | 66 ", " |
| 67 "<a href=\"https://pugixml.org/\">pugixml v" + pugixml_version + "</a>" | |
| 68 ", " | |
| 69 "<a href=\"https://github.com/pulzed/mINI\">mINI v0.9.14</a>" | |
| 70 " </p>" | |
| 71 "<span>" | |
|
224
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
72 "<strong>" + tr("Special thanks:") + "</strong>" |
| 108 | 73 "</span>" |
| 74 " <ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 15px; margin-right: 0px; -qt-list-indent:0;\">" | |
|
224
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
75 " <li><strong>Eren Okka</strong> " + tr("for creating Taiga") + "</li>" |
|
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
76 " <li><strong>Alex Huszagh</strong> " + tr("and") + " <strong>Colin Duquesnoy</strong> " + |
|
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
77 tr("for creating BreezeStyleSheets, on which the dark theme in this program is " |
| 108 | 78 "based off of") + "</li>" |
|
224
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
79 " <li><strong>Andy Brice</strong> " + tr("for providing some sample code for " |
| 108 | 80 "detecting dark mode on Windows and macOS") + "</li>" |
|
224
7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
81 " <li><strong>Manuel Wudka-Robles</strong> " + tr("for providing information on " |
| 108 | 82 "getting open file descriptors on macOS") + "</li>" |
| 83 " </ul>" | |
| 84 "</body>"; | |
| 85 | |
| 86 { | |
| 87 QPalette pal = QPalette(); | |
| 88 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); | |
| 89 setPalette(pal); | |
| 90 } | |
| 91 | |
| 92 { | |
| 93 QTextBrowser* paragraph = new QTextBrowser(this); | |
| 94 paragraph->setOpenExternalLinks(true); | |
| 95 paragraph->setFrameShape(QFrame::NoFrame); | |
| 96 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 97 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 98 paragraph->setHtml(html); | |
| 99 | |
| 100 layout->addWidget(paragraph); | |
| 101 } | |
| 51 | 102 } |
| 108 | 103 |
| 104 void AboutWindow::showEvent(QShowEvent* event) { | |
| 105 QDialog::showEvent(event); | |
| 106 #ifdef WIN32 | |
| 107 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
| 108 #endif | |
| 109 } | |
| 110 | |
| 111 #include "gui/dialog/moc_about.cpp" |
