comparison src/gui/dialog/about.cc @ 339:eac06513db86

dialog/about: add licenses button otherwise we wouldn't be complying with most of the libraries and external software we use
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 14:02:11 -0400
parents 92f63cf29faa
children 8d45d892be88
comparison
equal deleted inserted replaced
338:f63dfa309380 339:eac06513db86
1 #include "gui/dialog/about.h" 1 #include "gui/dialog/about.h"
2 #include "gui/dialog/licenses.h"
2 #include "core/json.h" 3 #include "core/json.h"
3 #include "core/session.h" 4 #include "core/session.h"
4 #include "core/strings.h" 5 #include "core/strings.h"
5 #include "gui/widgets/text.h" 6 #include "gui/widgets/text.h"
6 7
14 #include <QFont> 15 #include <QFont>
15 #include <QHBoxLayout> 16 #include <QHBoxLayout>
16 #include <QTextBrowser> 17 #include <QTextBrowser>
17 #include <QTextCharFormat> 18 #include <QTextCharFormat>
18 #include <QTextCursor> 19 #include <QTextCursor>
20 #include <QPushButton>
19 21
20 #include <curl/curl.h> 22 #include <curl/curl.h>
21 #ifdef WIN32 23 #ifdef WIN32
22 # include "sys/win32/dark_theme.h" 24 # include "sys/win32/dark_theme.h"
23 #endif 25 #endif
68 setMinimumSize(641, 325); 70 setMinimumSize(641, 325);
69 setWindowTitle(tr("About Minori")); 71 setWindowTitle(tr("About Minori"));
70 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); 72 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
71 setAutoFillBackground(true); 73 setAutoFillBackground(true);
72 74
73 QHBoxLayout* layout = new QHBoxLayout(this); 75 QVBoxLayout* layout = new QVBoxLayout(this);
74 76
75 std::string html = fmt::format(about_template, session.version.to_string(), get_curl_version(), fugue_icons_version.to_string(), json_version.to_string(), pugixml_version.to_string(), semver_version.to_string(), utf8proc_version(), fmt_version.to_string()); 77 std::string html = fmt::format(about_template, session.version.to_string(), get_curl_version(), fugue_icons_version.to_string(), json_version.to_string(), pugixml_version.to_string(), semver_version.to_string(), utf8proc_version(), fmt_version.to_string());
76 78
77 setBackgroundRole(QPalette::Base); 79 setBackgroundRole(QPalette::Base);
78 80
84 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 86 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
85 paragraph->setHtml(Strings::ToQString(html)); 87 paragraph->setHtml(Strings::ToQString(html));
86 88
87 layout->addWidget(paragraph); 89 layout->addWidget(paragraph);
88 } 90 }
91
92 {
93 QPushButton *license = new QPushButton("&Licenses", this);
94 layout->addWidget(license, Qt::AlignRight);
95 connect(license, &QPushButton::clicked, this, []{
96 LicensesWindow dialog;
97 dialog.exec();
98 });
99 }
89 } 100 }
90 101
91 void AboutWindow::showEvent(QShowEvent* event) { 102 void AboutWindow::showEvent(QShowEvent* event) {
92 QDialog::showEvent(event); 103 QDialog::showEvent(event);
93 #ifdef WIN32 104 #ifdef WIN32