add tab about license information of 3rd party libraries

This commit is contained in:
wmayer
2018-02-11 11:40:09 +01:00
parent 52fa10d9ac
commit 18bc9ff35e
4 changed files with 3470 additions and 7 deletions

View File

@@ -7,21 +7,27 @@ add_subdirectory(Main)
add_subdirectory(Mod)
add_subdirectory(Ext)
if(BUILD_GUI)
add_subdirectory(Gui)
configure_file(Doc/freecad.qhc ${CMAKE_BINARY_DIR}/doc/freecad.qhc COPYONLY)
configure_file(Doc/freecad.qch ${CMAKE_BINARY_DIR}/doc/freecad.qch COPYONLY)
add_subdirectory(Gui)
configure_file(Doc/freecad.qhc ${CMAKE_BINARY_DIR}/doc/freecad.qhc COPYONLY)
configure_file(Doc/freecad.qch ${CMAKE_BINARY_DIR}/doc/freecad.qch COPYONLY)
endif(BUILD_GUI)
if(BUILD_TEMPLATE)
add_subdirectory(Tools/_TEMPLATE_)
add_subdirectory(Tools/_TEMPLATE_)
endif(BUILD_TEMPLATE)
configure_file(Doc/ThirdPartyLibraries.html
${CMAKE_BINARY_DIR}/doc/ThirdPartyLibraries.html COPYONLY)
add_subdirectory(Doc)
if(FREECAD_MAINTAINERS_BUILD AND WIN32)
#add_subdirectory(WindowsInstaller)
#add_subdirectory(WindowsInstaller)
endif(FREECAD_MAINTAINERS_BUILD AND WIN32)
INSTALL(FILES Doc/freecad.qhc Doc/freecad.qch
INSTALL(FILES
Doc/freecad.qhc
Doc/freecad.qch
Doc/ThirdPartyLibraries.html
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)

File diff suppressed because it is too large Load Diff

View File

@@ -25,10 +25,12 @@
#ifndef _PreComp_
# include <QApplication>
# include <QClipboard>
# include <QDesktopServices>
# include <QDialogButtonBox>
# include <QLocale>
# include <QMutex>
# include <QProcess>
# include <QTextBrowser>
# include <QProcess>
# include <QSysInfo>
# include <QTextStream>
# include <QWaitCondition>
@@ -40,6 +42,8 @@
#endif
#include <LibraryVersions.h>
#include <zlib.h>
#include <boost/version.hpp>
#include "Splashscreen.h"
#include "ui_AboutApplication.h"
@@ -260,6 +264,7 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent)
// }
ui->tabWidget->setCurrentIndex(0); // always start on the About tab
setupLabels();
showLicenseInformation();
}
/**
@@ -507,6 +512,197 @@ void AboutDialog::setupLabels()
}
}
class AboutDialog::LibraryInfo {
public:
QString name;
QString version;
QString href;
QString url;
};
void AboutDialog::showLicenseInformation()
{
QWidget *tab_license = new QWidget();
tab_license->setObjectName(QString::fromLatin1("tab_license"));
ui->tabWidget->addTab(tab_license, tr("Libraries"));
QVBoxLayout* hlayout = new QVBoxLayout(tab_license);
QTextBrowser* textField = new QTextBrowser(tab_license);
textField->setOpenExternalLinks(false);
textField->setOpenLinks(false);
hlayout->addWidget(textField);
QList<LibraryInfo> libInfo;
LibraryInfo li;
QString baseurl = QString::fromLatin1("file:///%1/ThirdPartyLibraries.html")
.arg(QString::fromUtf8(App::Application::getHelpDir().c_str()));
//FIXME: Put all needed information into LibraryVersions.h
//
// Boost
li.name = QLatin1String("Boost");
li.href = baseurl + QLatin1String("#_TocBoost");
li.url = QLatin1String("http://www.boost.org");
li.version = QLatin1String(BOOST_LIB_VERSION);
libInfo << li;
// Coin3D
li.name = QLatin1String("Coin3D");
li.href = baseurl + QLatin1String("#_TocCoin3D");
li.url = QLatin1String("https://bitbucket.org/Coin3D/coin/");
li.version = QLatin1String(COIN_VERSION);
libInfo << li;
// Eigen3
li.name = QLatin1String("Eigen3");
li.href = baseurl + QLatin1String("#_TocEigen3");
li.url = QLatin1String("http://eigen.tuxfamily.org/");
li.version.clear();
libInfo << li;
// FreeType
li.name = QLatin1String("FreeType");
li.href = baseurl + QLatin1String("#_TocFreeType");
li.url = QLatin1String("http://freetype.org");
li.version.clear();
libInfo << li;
// KDL
li.name = QLatin1String("KDL");
li.href = baseurl + QLatin1String("#_TocKDL");
li.url = QLatin1String("http://www.orocos.org/kdl");
li.version.clear();
libInfo << li;
// libarea
li.name = QLatin1String("libarea");
li.href = baseurl + QLatin1String("#_TocLibArea");
li.url = QLatin1String("https://github.com/danielfalck/libarea");
li.version.clear();
libInfo << li;
// OCCT
li.name = QLatin1String("Open CASCADE Technology");
li.href = baseurl + QLatin1String("#_TocOCCT");
li.url = QLatin1String("http://www.opencascade.com");
li.version = QLatin1String(OCC_VERSION_STRING_EXT);
libInfo << li;
// pcl
li.name = QLatin1String("Point Cloud Library");
li.href = baseurl + QLatin1String("#_TocPcl");
li.url = QLatin1String("http://www.pointclouds.org");
li.version.clear();
libInfo << li;
// PyCXX
li.name = QLatin1String("PyCXX");
li.href = baseurl + QLatin1String("#_TocPyCXX");
li.url = QLatin1String("http://cxx.sourceforge.net");
li.version.clear();
libInfo << li;
// Python
li.name = QLatin1String("Python");
li.href = baseurl + QLatin1String("#_TocPython");
li.url = QLatin1String("http://www.python.org");
li.version = QLatin1String(PY_VERSION);
libInfo << li;
// PySide
li.name = QLatin1String("PySide");
li.href = baseurl + QLatin1String("#_TocPySide");
li.url = QLatin1String("http://www.pyside.org");
li.version.clear();
libInfo << li;
// Qt
li.name = QLatin1String("Qt");
li.href = baseurl + QLatin1String("#_TocQt");
li.url = QLatin1String("http://www.qt.io");
li.version = QLatin1String(QT_VERSION_STR);
libInfo << li;
// Salome SMESH
li.name = QLatin1String("Salome SMESH");
li.href = baseurl + QLatin1String("#_TocSalomeSMESH");
li.url = QLatin1String("http://salome-platform.org");
li.version.clear();
libInfo << li;
// Shiboken
li.name = QLatin1String("Shiboken");
li.href = baseurl + QLatin1String("#_TocPySide");
li.url = QLatin1String("http://www.pyside.org");
li.version.clear();
libInfo << li;
// vtk
li.name = QLatin1String("vtk");
li.href = baseurl + QLatin1String("#_TocVtk");
li.url = QLatin1String("https://www.vtk.org");
li.version.clear();
libInfo << li;
// Xerces-C
li.name = QLatin1String("Xerces-C");
li.href = baseurl + QLatin1String("#_TocXercesC");
li.url = QLatin1String("https://xerces.apache.org/xerces-c");
li.version.clear();
libInfo << li;
// Zipios++
li.name = QLatin1String("Zipios++");
li.href = baseurl + QLatin1String("#_TocZipios");
li.url = QLatin1String("http://zipios.sourceforge.net");
li.version.clear();
libInfo << li;
// zlib
li.name = QLatin1String("zlib");
li.href = baseurl + QLatin1String("#_TocZlib");
li.url = QLatin1String("http://zlib.net");
li.version = QLatin1String(ZLIB_VERSION);
libInfo << li;
QString msg = tr("This software uses open source components whose copyright and other "
"proprietary rights belong to their respective owners:");
QString html;
QTextStream out(&html);
out << "<html><head/><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">"
<< "<p>" << msg << "<br/></p>\n<ul>\n";
for (QList<LibraryInfo>::iterator it = libInfo.begin(); it != libInfo.end(); ++it) {
out << "<li><p>" << it->name << " " << it->version << "</p>"
"<p><a href=\"" << it->href << "\">" << it->url
<< "</a><br/></p></li>\n";
}
out << "</ul>\n</body>\n</html>";
textField->setHtml(html);
connect(textField, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkActivated(QUrl)));
}
void AboutDialog::linkActivated(const QUrl& link)
{
//#if defined(Q_OS_WIN) && QT_VERSION < 0x050602
LicenseView* licenseView = new LicenseView();
licenseView->setAttribute(Qt::WA_DeleteOnClose);
licenseView->show();
QString title = tr("License");
QString fragment = link.fragment();
if (fragment.startsWith(QLatin1String("_Toc"))) {
QString prefix = fragment.mid(4);
title = QString::fromLatin1("%1 %2").arg(prefix).arg(title);
}
licenseView->setWindowTitle(title);
getMainWindow()->addWindow(licenseView);
licenseView->setSource(link);
//#else
// QDesktopServices::openUrl(link);
//#endif
}
void AboutDialog::on_copyButton_clicked()
{
QString data;
@@ -563,4 +759,26 @@ void AboutDialog::on_copyButton_clicked()
cb->setText(data);
}
// ----------------------------------------------------------------------------
/* TRANSLATOR Gui::LicenseView */
LicenseView::LicenseView(QWidget* parent)
: MDIView(0,parent,0)
{
browser = new QTextBrowser(this);
browser->setOpenExternalLinks(true);
browser->setOpenLinks(true);
setCentralWidget(browser);
}
LicenseView::~LicenseView()
{
}
void LicenseView::setSource(const QUrl& url)
{
browser->setSource(url);
}
#include "moc_Splashscreen.cpp"

View File

@@ -26,6 +26,8 @@
#include <QSplashScreen>
#include <QDialog>
#include <QTextBrowser>
#include <Gui/MDIView.h>
namespace Gui {
@@ -68,6 +70,23 @@ private:
static AboutDialogFactory* factory;
};
class GuiExport LicenseView : public Gui::MDIView
{
Q_OBJECT
public:
LicenseView(QWidget* parent=0);
virtual ~LicenseView();
void setSource(const QUrl & url);
const char *getName(void) const {
return "LicenseView";
}
private:
QTextBrowser* browser;
};
/** This widget provides the "About dialog" of an application.
* This shows the current version, the build number and date.
* \author Werner Mayer
@@ -82,12 +101,15 @@ public:
protected:
void setupLabels();
void showLicenseInformation();
protected Q_SLOTS:
virtual void on_copyButton_clicked();
void linkActivated(const QUrl& link);
private:
Ui_AboutApplication* ui;
class LibraryInfo;
};
} // namespace Dialog