Skip to content
Extraits de code Groupes Projets
Vérifiée Valider fba769bf rédigé par Kubat's avatar Kubat
Parcourir les fichiers

UI: Add used licences in about window

parent 5305ec66
Branches
Aucune étiquette associée trouvée
1 requête de fusion!10UI improvements
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <QEvent> #include <QEvent>
#include <QMouseEvent> #include <QMouseEvent>
#include <QApplication> #include <QApplication>
#include <QTextEdit>
using namespace Vivy; using namespace Vivy;
...@@ -50,6 +51,29 @@ public: ...@@ -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 // Construct the AboutWindow
AboutWindow::AboutWindow(QWidget *parent) noexcept AboutWindow::AboutWindow(QWidget *parent) noexcept
: Window(QIcon(":icons/vivy.png"), "Vivy - About", parent) : Window(QIcon(":icons/vivy.png"), "Vivy - About", parent)
...@@ -64,8 +88,18 @@ AboutWindow::AboutWindow(QWidget *parent) noexcept ...@@ -64,8 +88,18 @@ AboutWindow::AboutWindow(QWidget *parent) noexcept
panels->addTab(new SimpleLabel(panels, aboutContent), "About"); panels->addTab(new SimpleLabel(panels, aboutContent), "About");
panels->addTab(new SimpleLabel(panels, libContent), "Libraries"); 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); setCentralWidget(panels);
resize(300, 400); setMinimumWidth(800);
setMinimumHeight(600);
} }
void void
......
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 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: This license is copied below, and is also available with a FAQ at:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter