From 31b2c7d2436442850caa2e70bae2bd6462600d16 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Mon, 9 Apr 2018 17:11:07 +0200 Subject: [PATCH] ui: show version of 3rd party dependencies in ui dialog --- cmake/licenses.cmake | 24 ++++++++++++------------ cmake/licenses.h.in | 7 +++++-- src/lib_gui/qt/window/QtAboutLicense.cpp | 11 +++++++++-- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/cmake/licenses.cmake b/cmake/licenses.cmake index 5af4b322..72610316 100644 --- a/cmake/licenses.cmake +++ b/cmake/licenses.cmake @@ -14,22 +14,22 @@ function(ReadLicense licenseFile licenseVariable) set(LICENSES "${LICENSES}${var}${tempVariable}\"\;" PARENT_SCOPE) endfunction(ReadLicense) -function(AddLicense licenseName licenseURL licenseFile) - ReadLicense(${licenseFile} ${licenseName}_license) +function(AddLicense softwareName softwareVersion softwareURL licenseFile) + ReadLicense(${licenseFile} ${softwareName}_license) set(LICENSES ${LICENSES} PARENT_SCOPE) - set(LICENSE_ARRAY "${LICENSE_ARRAY}\n\tThirdPartyLicense(\"${licenseName}\", \"${licenseURL}\", ${licenseName}_license)," PARENT_SCOPE) + set(LICENSE_ARRAY "${LICENSE_ARRAY}\n\tThirdPartyLicense(\"${softwareName}\", \"${softwareVersion}\", \"${softwareURL}\", ${softwareName}_license)," PARENT_SCOPE) endfunction(AddLicense) -AddLicense("Boost" "http://www.boost.org" "${LICENSEFOLDER}/license_boost.txt") -AddLicense("Botan" "http://botan.randombit.net/" "${LICENSEFOLDER}/license_botan.txt") -AddLicense("Clang" "http://clang.llvm.org/" "${LICENSEFOLDER}/license_clang.txt") -AddLicense("CppSQLite" "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("Gradle" "https://github.com/gradle/gradle" "${LICENSEFOLDER}/license_gradle.txt") -AddLicense("OpenSSL" "https://www.openssl.org/" "${LICENSEFOLDER}/license_openssl.txt") -AddLicense("Qt" "http://qt.io" "${LICENSEFOLDER}/license_qt.txt") -AddLicense("TinyXML" "http://www.grinninglizard.com/tinyxml2/" "${LICENSEFOLDER}/license_tinyxml.txt") +AddLicense("Boost" "1.64" "http://www.boost.org" "${LICENSEFOLDER}/license_boost.txt") +AddLicense("Botan" "2.1.0" "http://botan.randombit.net/" "${LICENSEFOLDER}/license_botan.txt") +AddLicense("Clang" "6.0" "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("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("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 11fd4af6..3e5d8305 100644 --- a/cmake/licenses.h.in +++ b/cmake/licenses.h.in @@ -5,24 +5,27 @@ struct ThirdPartyLicense { const char* name; + const char* version; const char* url; const char* license; ThirdPartyLicense() : name(0) + , version(0) , url(0) , license(0) {} - ThirdPartyLicense(const char* name, const char* url, const char* license) + ThirdPartyLicense(const char* name, const char* version, const char* url, const char* license) : name(name) + , version(version) , url(url) , license(license) {} bool isEmpty() const { - return (name == 0 && url == 0 && license == 0); + return (name == 0 && version == 0 && url == 0 && license == 0); } }; diff --git a/src/lib_gui/qt/window/QtAboutLicense.cpp b/src/lib_gui/qt/window/QtAboutLicense.cpp index 714dcd8c..a29f881a 100644 --- a/src/lib_gui/qt/window/QtAboutLicense.cpp +++ b/src/lib_gui/qt/window/QtAboutLicense.cpp @@ -23,7 +23,14 @@ void QtAboutLicense::populateWindow(QWidget* widget) for (ThirdPartyLicense license : licenses3rdParties) { QLabel* licenseName = new QLabel(); - licenseName->setText( QString::fromLatin1(license.name)); + 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); @@ -31,7 +38,7 @@ void QtAboutLicense::populateWindow(QWidget* widget) layout->addWidget(licenseName); QLabel* licenseURL = new QLabel(); - licenseURL->setText(QString::fromLatin1("(Website)") + licenseURL->setText(QString::fromLatin1("%1") .arg(QString::fromLatin1(license.url))); licenseURL->setOpenExternalLinks(true); layout->addWidget(licenseURL);