diff --git a/src/UI/AboutWindow.cc b/src/UI/AboutWindow.cc index 9b03d6895adc88b8400654fb4f21fab41ecee4d6..568eb3fce59c10b72d8ba08d49953ece3481e642 100644 --- a/src/UI/AboutWindow.cc +++ b/src/UI/AboutWindow.cc @@ -9,6 +9,7 @@ #include <QEvent> #include <QMouseEvent> #include <QApplication> +#include <QTextEdit> using namespace Vivy; @@ -50,6 +51,29 @@ public: } }; +// Simple QLabel for licences +class LicenceLabel : public QTextEdit { +public: + explicit LicenceLabel(QWidget *parent, const QString &url) + : QTextEdit(parent) + { + QFile content(url); + if (!content.open(QIODevice::ReadOnly | QIODevice::Text)) + throw std::runtime_error("Failed to open file that should be accessible"); + setText(content.readAll()); + setTextInteractionFlags(Qt::NoTextInteraction); + setAlignment(Qt::AlignJustify | Qt::AlignTop); + setAcceptRichText(true); + setReadOnly(true); + setAutoFormatting(QTextEdit::AutoAll); + + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + setFont(vivyApp->getApplicationFont(VivyApplication::Font::Monospace)); + setFrameStyle(QFrame::NoFrame); + } +}; + // Construct the AboutWindow AboutWindow::AboutWindow(QWidget *parent) noexcept : Window(QIcon(":icons/vivy.png"), "Vivy - About", parent) @@ -64,8 +88,18 @@ AboutWindow::AboutWindow(QWidget *parent) noexcept panels->addTab(new SimpleLabel(panels, aboutContent), "About"); panels->addTab(new SimpleLabel(panels, libContent), "Libraries"); + QTabWidget *licences = new QTabWidget(panels); + licences->setTabPosition(QTabWidget::TabPosition::West); + licences->addTab(new LicenceLabel(licences, ":licence/MIT"), "MIT"); + licences->addTab(new LicenceLabel(licences, ":licence/LGPL-V2.0"), "LGPL-V2.0"); + licences->addTab(new LicenceLabel(licences, ":licence/LGPL-V2.1"), "LGPL-V2.1"); + licences->addTab(new LicenceLabel(licences, ":licence/LGPL-V3"), "LGPL-V3"); + licences->addTab(new LicenceLabel(licences, ":licence/OFL-1.1"), "OFL-1.1"); + panels->addTab(licences, "Licences"); + setCentralWidget(panels); - resize(300, 400); + setMinimumWidth(800); + setMinimumHeight(600); } void diff --git a/utils/rsc/licence/OFL-1.1 b/utils/rsc/licence/OFL-1.1 index 805e0b38b5cfbf78c7269d42ef7096699eec6559..3dd1a290c6ab1b97e018eb1c58364f8e8d1c18b9 100644 --- a/utils/rsc/licence/OFL-1.1 +++ b/utils/rsc/licence/OFL-1.1 @@ -1,4 +1,4 @@ -Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode) +Copyright (c) year, authors This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: