From c808fa8732c96ff84b83c99a93710ebb53483bab Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Mon, 18 Nov 2019 10:41:08 +0100 Subject: [PATCH] ui: Show Sourcetrail license on top in licenses window * updated versions and license files of some 3rd party libraries --- .../3rd_party_licenses/license_clang.txt | 2 +- .../license/3rd_party_licenses/license_qt.txt | 10 ++ cmake/licenses.cmake | 12 ++- cmake/licenses.h.in | 10 +- src/lib_gui/CMakeLists.txt | 4 +- src/lib_gui/qt/window/QtAboutLicense.cpp | 65 ------------ src/lib_gui/qt/window/QtLicenseWindow.cpp | 99 +++++++++++++++++++ .../{QtAboutLicense.h => QtLicenseWindow.h} | 10 +- src/lib_gui/qt/window/QtMainWindow.cpp | 6 +- 9 files changed, 133 insertions(+), 85 deletions(-) delete mode 100644 src/lib_gui/qt/window/QtAboutLicense.cpp create mode 100644 src/lib_gui/qt/window/QtLicenseWindow.cpp rename src/lib_gui/qt/window/{QtAboutLicense.h => QtLicenseWindow.h} (61%) diff --git a/bin/app/data/license/3rd_party_licenses/license_clang.txt b/bin/app/data/license/3rd_party_licenses/license_clang.txt index bdd1addc..7da22581 100644 --- a/bin/app/data/license/3rd_party_licenses/license_clang.txt +++ b/bin/app/data/license/3rd_party_licenses/license_clang.txt @@ -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: diff --git a/bin/app/data/license/3rd_party_licenses/license_qt.txt b/bin/app/data/license/3rd_party_licenses/license_qt.txt index c7e36280..da8fb45a 100644 --- a/bin/app/data/license/3rd_party_licenses/license_qt.txt +++ b/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 ---------------- diff --git a/cmake/licenses.cmake b/cmake/licenses.cmake index 353f6aac..696db62f 100644 --- a/cmake/licenses.cmake +++ b/cmake/licenses.cmake @@ -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") diff --git a/cmake/licenses.h.in b/cmake/licenses.h.in index 3e5d8305..45345dfc 100644 --- a/cmake/licenses.h.in +++ b/cmake/licenses.h.in @@ -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) @@ -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@ }; diff --git a/src/lib_gui/CMakeLists.txt b/src/lib_gui/CMakeLists.txt index 3d3b5f71..7c6af071 100644 --- a/src/lib_gui/CMakeLists.txt +++ b/src/lib_gui/CMakeLists.txt @@ -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 diff --git a/src/lib_gui/qt/window/QtAboutLicense.cpp b/src/lib_gui/qt/window/QtAboutLicense.cpp deleted file mode 100644 index e90824dd..00000000 --- a/src/lib_gui/qt/window/QtAboutLicense.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "QtAboutLicense.h" - -#include -#include - -#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("%1") - .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); -} diff --git a/src/lib_gui/qt/window/QtLicenseWindow.cpp b/src/lib_gui/qt/window/QtLicenseWindow.cpp new file mode 100644 index 00000000..2a9f8ad1 --- /dev/null +++ b/src/lib_gui/qt/window/QtLicenseWindow.cpp @@ -0,0 +1,99 @@ +#include "QtLicenseWindow.h" + +#include +#include + +#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("%1") + .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( + "Copyrights and Licenses for Third Party Software Distributed with Sourcetrail:
" + "Sourcetaril contains code written by the following third parties that have
" + "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("%1") + .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); +} diff --git a/src/lib_gui/qt/window/QtAboutLicense.h b/src/lib_gui/qt/window/QtLicenseWindow.h similarity index 61% rename from src/lib_gui/qt/window/QtAboutLicense.h rename to src/lib_gui/qt/window/QtLicenseWindow.h index 2381a908..c8ea0d9c 100644 --- a/src/lib_gui/qt/window/QtAboutLicense.h +++ b/src/lib_gui/qt/window/QtLicenseWindow.h @@ -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 diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index aece5c02..79f110fa 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -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(); + QtLicenseWindow* licenseWindow = createWindow(); 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();