ui: Show Sourcetrail license on top in licenses window
* updated versions and license files of some 3rd party libraries
This commit is contained in:
@@ -247,8 +247,6 @@ add_files(
|
||||
|
||||
qt/window/QtAbout.cpp
|
||||
qt/window/QtAbout.h
|
||||
qt/window/QtAboutLicense.cpp
|
||||
qt/window/QtAboutLicense.h
|
||||
qt/window/QtBookmarkBrowser.cpp
|
||||
qt/window/QtBookmarkBrowser.h
|
||||
qt/window/QtBookmarkCreator.cpp
|
||||
@@ -265,6 +263,8 @@ add_files(
|
||||
qt/window/QtKeyboardShortcuts.h
|
||||
qt/window/QtKnownProgressDialog.cpp
|
||||
qt/window/QtKnownProgressDialog.h
|
||||
qt/window/QtLicenseWindow.cpp
|
||||
qt/window/QtLicenseWindow.h
|
||||
qt/window/QtMainWindow.cpp
|
||||
qt/window/QtMainWindow.h
|
||||
qt/window/QtPathListDialog.cpp
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "QtAboutLicense.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "licenses.h"
|
||||
|
||||
QtAboutLicense::QtAboutLicense(QWidget *parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
setScrollAble(true);
|
||||
}
|
||||
|
||||
QSize QtAboutLicense::sizeHint() const
|
||||
{
|
||||
return QSize(600, 600);
|
||||
}
|
||||
|
||||
void QtAboutLicense::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
|
||||
for (ThirdPartyLicense license : licenses3rdParties)
|
||||
{
|
||||
QLabel* licenseName = new QLabel();
|
||||
licenseName->setText(
|
||||
QString::fromLatin1(license.name) +
|
||||
QString::fromLatin1(
|
||||
std::string(license.version).empty() ?
|
||||
"" :
|
||||
(std::string(" (v") + license.version + ")").c_str()
|
||||
)
|
||||
);
|
||||
QFont _font = licenseName->font();
|
||||
_font.setPixelSize(36);
|
||||
_font.setBold(true);
|
||||
licenseName->setFont(_font);
|
||||
layout->addWidget(licenseName);
|
||||
|
||||
QLabel* licenseURL = new QLabel();
|
||||
licenseURL->setText(QString::fromLatin1("<a href=\"%1\">%1</a>")
|
||||
.arg(QString::fromLatin1(license.url)));
|
||||
licenseURL->setOpenExternalLinks(true);
|
||||
layout->addWidget(licenseURL);
|
||||
|
||||
QLabel* licenseText = new QLabel();
|
||||
licenseText->setFixedWidth(450);
|
||||
licenseText->setWordWrap(true);
|
||||
licenseText->setText(QString::fromLatin1(license.license));
|
||||
layout->addWidget(licenseText);
|
||||
|
||||
layout->addSpacing(50);
|
||||
}
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtAboutLicense::windowReady()
|
||||
{
|
||||
updateTitle("3rd Party Licenses");
|
||||
updateCloseButton("Close");
|
||||
|
||||
setNextVisible(false);
|
||||
setPreviousVisible(false);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
#include "QtLicenseWindow.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "licenses.h"
|
||||
|
||||
QtLicenseWindow::QtLicenseWindow(QWidget *parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
setScrollAble(true);
|
||||
}
|
||||
|
||||
QSize QtLicenseWindow::sizeHint() const
|
||||
{
|
||||
return QSize(650, 600);
|
||||
}
|
||||
|
||||
void QtLicenseWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
|
||||
QLabel* licenseName = new QLabel();
|
||||
licenseName->setText(
|
||||
QString::fromLatin1(licenseApp.name) +
|
||||
QString::fromLatin1(
|
||||
std::string(licenseApp.version).empty() ?
|
||||
"" :
|
||||
(std::string(" (v") + licenseApp.version + ")").c_str()
|
||||
)
|
||||
);
|
||||
QFont _font = licenseName->font();
|
||||
_font.setPixelSize(36);
|
||||
_font.setBold(true);
|
||||
licenseName->setFont(_font);
|
||||
layout->addWidget(licenseName);
|
||||
|
||||
QLabel* licenseURL = new QLabel();
|
||||
licenseURL->setText(QString::fromLatin1("<a href=\"%1\">%1</a>")
|
||||
.arg(QString::fromLatin1(licenseApp.url)));
|
||||
licenseURL->setOpenExternalLinks(true);
|
||||
layout->addWidget(licenseURL);
|
||||
|
||||
QLabel* licenseText = new QLabel();
|
||||
licenseText->setFixedWidth(550);
|
||||
licenseText->setWordWrap(true);
|
||||
licenseText->setText(QString::fromLatin1(licenseApp.license));
|
||||
layout->addWidget(licenseText);
|
||||
|
||||
layout->addSpacing(30);
|
||||
|
||||
QLabel* header3rdParties = new QLabel(
|
||||
"<b>Copyrights and Licenses for Third Party Software Distributed with Sourcetrail:</b><br />"
|
||||
"Sourcetaril contains code written by the following third parties that have <br />"
|
||||
"additional or alternate copyrights, licenses, and/or restrictions:");
|
||||
layout->addWidget(header3rdParties);
|
||||
|
||||
layout->addSpacing(30);
|
||||
|
||||
for (LicenseInfo license : licenses3rdParties)
|
||||
{
|
||||
QLabel* licenseName = new QLabel();
|
||||
licenseName->setText(
|
||||
QString::fromLatin1(license.name) +
|
||||
QString::fromLatin1(
|
||||
std::string(license.version).empty() ?
|
||||
"" :
|
||||
(std::string(" (v") + license.version + ")").c_str()
|
||||
)
|
||||
);
|
||||
licenseName->setFont(_font);
|
||||
layout->addWidget(licenseName);
|
||||
|
||||
QLabel* licenseURL = new QLabel();
|
||||
licenseURL->setText(QString::fromLatin1("<a href=\"%1\">%1</a>")
|
||||
.arg(QString::fromLatin1(license.url)));
|
||||
licenseURL->setOpenExternalLinks(true);
|
||||
layout->addWidget(licenseURL);
|
||||
|
||||
QLabel* licenseText = new QLabel();
|
||||
licenseText->setFixedWidth(550);
|
||||
licenseText->setWordWrap(true);
|
||||
licenseText->setText(QString::fromLatin1(license.license));
|
||||
layout->addWidget(licenseText);
|
||||
|
||||
layout->addSpacing(30);
|
||||
}
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtLicenseWindow::windowReady()
|
||||
{
|
||||
updateTitle("License");
|
||||
updateCloseButton("Close");
|
||||
|
||||
setNextVisible(false);
|
||||
setPreviousVisible(false);
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef QT_ABOUT_LICENSE_H
|
||||
#define QT_ABOUT_LICENSE_H
|
||||
#ifndef QT_LICENSE_WINDOW_H
|
||||
#define QT_LICENSE_WINDOW_H
|
||||
|
||||
#include "QtWindow.h"
|
||||
|
||||
class QtAboutLicense
|
||||
class QtLicenseWindow
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtAboutLicense(QWidget* parent = 0);
|
||||
QtLicenseWindow(QWidget* parent = 0);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
protected:
|
||||
@@ -17,4 +17,4 @@ protected:
|
||||
virtual void windowReady() override;
|
||||
};
|
||||
|
||||
#endif // QT_ABOUT_LICENSE_H
|
||||
#endif // QT_LICENSE_WINDOW_H
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "QtViewWidgetWrapper.h"
|
||||
#include "QtProjectWizard.h"
|
||||
#include "QtAbout.h"
|
||||
#include "QtAboutLicense.h"
|
||||
#include "QtKeyboardShortcuts.h"
|
||||
#include "QtLicenseWindow.h"
|
||||
#include "QtPreferencesWindow.h"
|
||||
#include "QtStartScreen.h"
|
||||
#include "ApplicationSettings.h"
|
||||
@@ -524,7 +524,7 @@ void QtMainWindow::showBugtracker()
|
||||
|
||||
void QtMainWindow::showLicenses()
|
||||
{
|
||||
QtAboutLicense* licenseWindow = createWindow<QtAboutLicense>();
|
||||
QtLicenseWindow* licenseWindow = createWindow<QtLicenseWindow>();
|
||||
licenseWindow->setup();
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ void QtMainWindow::setupHelpMenu()
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
menu->addAction(tr("3rd Party Licenses"), this, &QtMainWindow::showLicenses);
|
||||
menu->addAction(tr("License"), this, &QtMainWindow::showLicenses);
|
||||
menu->addAction(tr("&About Sourcetrail"), this, &QtMainWindow::about);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
Reference in New Issue
Block a user