Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
ui: Show Sourcetrail license on top in licenses window
Browse files Browse the repository at this point in the history
* updated versions and license files of some 3rd party libraries
  • Loading branch information
egraether committed Nov 18, 2019
1 parent fdbb79b commit c808fa8
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 85 deletions.
2 changes: 1 addition & 1 deletion bin/app/data/license/3rd_party_licenses/license_clang.txt
Expand Up @@ -4,7 +4,7 @@ LLVM Release License
University of Illinois/NCSA
Open Source License

Copyright (c) 2007-2018 University of Illinois at Urbana-Champaign.
Copyright (c) 2007-2019 University of Illinois at Urbana-Champaign.
All rights reserved.

Developed by:
Expand Down
10 changes: 10 additions & 0 deletions bin/app/data/license/3rd_party_licenses/license_qt.txt
@@ -1,3 +1,13 @@
GENERAL
-------

Qt is available under a commercial license with various pricing models and packages that meet a variety of needs. Commercial Qt license keeps your code proprietary where only you can control and monetize on your end product’s development, user experience and distribution. You also get great perks like additional functionality, productivity enhancing tools, world-class support and a close strategic relationship with The Qt Company to make sure your product and development goals are met.

Qt has been created under the belief of open development and providing freedom and choice to developers. To support that, The Qt Company also licenses Qt under open source licenses, where most of the functionality is available under LGPLv3. It should be noted that the tools as well as some add-on components are available only under GPLv3. In order to preserve the true meaning of open development and uphold the spirit of free software, it is imperative that the rules and regulations of open source licenses are followed. If you use Qt under open-source licenses, you need to make sure that you comply with all the licenses of the components you use.

Qt also contains some 3rd party components that are available under different open-source licenses. Please refer to the documentation for more details on 3rd party licenses used in Qt.


GPLv3 and LGPLv3
----------------

Expand Down
12 changes: 7 additions & 5 deletions cmake/licenses.cmake
Expand Up @@ -17,18 +17,20 @@ endfunction(ReadLicense)
function(AddLicense softwareName softwareVersion softwareURL licenseFile)
ReadLicense(${licenseFile} ${softwareName}_license)
set(LICENSES ${LICENSES} PARENT_SCOPE)
set(LICENSE_ARRAY "${LICENSE_ARRAY}\n\tThirdPartyLicense(\"${softwareName}\", \"${softwareVersion}\", \"${softwareURL}\", ${softwareName}_license)," PARENT_SCOPE)
set(LICENSE_ARRAY "${LICENSE_ARRAY}\n\tLicenseInfo(\"${softwareName}\", \"${softwareVersion}\", \"${softwareURL}\", ${softwareName}_license)," PARENT_SCOPE)
endfunction(AddLicense)

ReadLicense(${CMAKE_SOURCE_DIR}/LICENSE.txt Sourcetrail_license)
set(LICENSE_APP "LicenseInfo(\"Sourcetrail\", \"${VERSION_STRING}\", \"https://www.sourcetrail.com\", Sourcetrail_license)")

AddLicense("Boost" "1.64" "http://www.boost.org" "${LICENSEFOLDER}/license_boost.txt")
AddLicense("Boost" "1.68" "http://www.boost.org" "${LICENSEFOLDER}/license_boost.txt")
AddLicense("catch" "2.5.0" "https://github.com/catchorg/Catch2" "${LICENSEFOLDER}/license_catch.txt")
AddLicense("Clang" "7.0.0" "http://clang.llvm.org/" "${LICENSEFOLDER}/license_clang.txt")
AddLicense("Clang" "8.0.1" "http://clang.llvm.org/" "${LICENSEFOLDER}/license_clang.txt")
AddLicense("CppSQLite" "3.2" "http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite" "${LICENSEFOLDER}/license_cpp_sqlite.txt")
AddLicense("Eclipse" "" "https://github.com/eclipse/eclipse.jdt.core" "${LICENSEFOLDER}/license_eclipse.txt")
AddLicense("EclipseJDT" "" "https://github.com/eclipse/eclipse.jdt.core" "${LICENSEFOLDER}/license_eclipse.txt")
AddLicense("Gradle" "4.2" "https://github.com/gradle/gradle" "${LICENSEFOLDER}/license_gradle.txt")
AddLicense("OpenSSL" "" "https://www.openssl.org/" "${LICENSEFOLDER}/license_openssl.txt")
AddLicense("Qt" "5.10.1" "http://qt.io" "${LICENSEFOLDER}/license_qt.txt")
AddLicense("Qt" "5.12.6" "http://qt.io" "${LICENSEFOLDER}/license_qt.txt")
AddLicense("TinyXML" "2.0" "https://sourceforge.net/projects/tinyxml/" "${LICENSEFOLDER}/license_tinyxml.txt")

set(LICENSE_ARRAY "${LICENSE_ARRAY}\n")
Expand Down
10 changes: 6 additions & 4 deletions cmake/licenses.h.in
Expand Up @@ -3,20 +3,20 @@

// This File(licenses.h) is generated with CMake

struct ThirdPartyLicense {
struct LicenseInfo {
const char* name;
const char* version;
const char* url;
const char* license;

ThirdPartyLicense()
LicenseInfo()
: name(0)
, version(0)
, url(0)
, license(0)
{}

ThirdPartyLicense(const char* name, const char* version, const char* url, const char* license)
LicenseInfo(const char* name, const char* version, const char* url, const char* license)
: name(name)
, version(version)
, url(url)
Expand All @@ -32,7 +32,9 @@ struct ThirdPartyLicense {
// License Textfiles
@LICENSES@

static const ThirdPartyLicense licenses3rdParties[] = {
static const LicenseInfo licenseApp = @LICENSE_APP@;

static const LicenseInfo licenses3rdParties[] = {
@LICENSE_ARRAY@
};

Expand Down
4 changes: 2 additions & 2 deletions src/lib_gui/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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
Expand Down
65 changes: 0 additions & 65 deletions src/lib_gui/qt/window/QtAboutLicense.cpp

This file was deleted.

99 changes: 99 additions & 0 deletions src/lib_gui/qt/window/QtLicenseWindow.cpp
@@ -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:
Expand All @@ -17,4 +17,4 @@ class QtAboutLicense
virtual void windowReady() override;
};

#endif // QT_ABOUT_LICENSE_H
#endif // QT_LICENSE_WINDOW_H
6 changes: 3 additions & 3 deletions src/lib_gui/qt/window/QtMainWindow.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -524,7 +524,7 @@ void QtMainWindow::showBugtracker()

void QtMainWindow::showLicenses()
{
QtAboutLicense* licenseWindow = createWindow<QtAboutLicense>();
QtLicenseWindow* licenseWindow = createWindow<QtLicenseWindow>();
licenseWindow->setup();
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c808fa8

Please sign in to comment.