From bd94486c7e274206dd7ce84e5f275c1f51e18c92 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 8 Sep 2015 19:17:36 +0200 Subject: [PATCH] + fix inconsistencies between license note and url --- src/App/Document.cpp | 17 +++++++++++++++-- src/Gui/DlgSettingsDocument.ui | 5 +---- src/Gui/DlgSettingsDocumentImp.cpp | 6 +++++- src/Gui/DlgSettingsDocumentImp.h | 20 ++++++++++---------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index a146f997b..c539fdc32 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -636,39 +636,52 @@ Document::Document(void) int licenseId = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Document")->GetInt("prefLicenseType",0); std::string license; + std::string licenseUrl; switch (licenseId) { case 0: license = "All rights reserved"; + licenseUrl = "http://en.wikipedia.org/wiki/All_rights_reserved"; break; case 1: license = "CreativeCommons Attribution"; + licenseUrl = "http://creativecommons.org/licenses/by/4.0/"; break; case 2: license = "CreativeCommons Attribution-ShareAlike"; + licenseUrl = "http://creativecommons.org/licenses/by-sa/4.0/"; break; case 3: license = "CreativeCommons Attribution-NoDerivatives"; + licenseUrl = "http://creativecommons.org/licenses/by-nd/4.0/"; break; case 4: license = "CreativeCommons Attribution-NonCommercial"; + licenseUrl = "http://creativecommons.org/licenses/by-nc/4.0/"; break; case 5: license = "CreativeCommons Attribution-NonCommercial-ShareAlike"; + licenseUrl = "http://creativecommons.org/licenses/by-nc-sa/4.0/"; break; case 6: license = "CreativeCommons Attribution-NonCommercial-NoDerivatives"; + licenseUrl = "http://creativecommons.org/licenses/by-nc-nd/4.0/"; break; case 7: license = "Public Domain"; + licenseUrl = "http://en.wikipedia.org/wiki/Public_domain"; break; case 8: license = "FreeArt"; + licenseUrl = "http://artlibre.org/licence/lal"; break; default: license = "Other"; + break; } - std::string licenseUrl = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/Document")->GetASCII("prefLicenseUrl","http://en.wikipedia.org/wiki/All_rights_reserved"); + + licenseUrl = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Document")->GetASCII("prefLicenseUrl", licenseUrl.c_str()); + ADD_PROPERTY_TYPE(License,(license.c_str()),0,Prop_None,"License string of the Item"); ADD_PROPERTY_TYPE(LicenseURL,(licenseUrl.c_str()),0,Prop_None,"URL to the license text/contract"); diff --git a/src/Gui/DlgSettingsDocument.ui b/src/Gui/DlgSettingsDocument.ui index a6e573825..c340757e0 100644 --- a/src/Gui/DlgSettingsDocument.ui +++ b/src/Gui/DlgSettingsDocument.ui @@ -235,9 +235,6 @@ - - 15 min - min @@ -517,7 +514,7 @@ An URL where the user can find more details about the license - http://en.wikipedia.org/wiki/All_rights_reserved + http://en.wikipedia.org/wiki/All_rights_reserved false diff --git a/src/Gui/DlgSettingsDocumentImp.cpp b/src/Gui/DlgSettingsDocumentImp.cpp index f2fb90450..81c074ade 100644 --- a/src/Gui/DlgSettingsDocumentImp.cpp +++ b/src/Gui/DlgSettingsDocumentImp.cpp @@ -128,6 +128,8 @@ void DlgSettingsDocumentImp::changeEvent(QEvent *e) */ void DlgSettingsDocumentImp::onLicenseTypeChanged(int index) { + prefLicenseUrl->setReadOnly(true); + switch (index) { case 0: prefLicenseUrl->setText(QString::fromAscii("http://en.wikipedia.org/wiki/All_rights_reserved")); @@ -157,7 +159,9 @@ void DlgSettingsDocumentImp::onLicenseTypeChanged(int index) prefLicenseUrl->setText(QString::fromAscii("http://artlibre.org/licence/lal")); break; default: - prefLicenseUrl->setText(QString::fromAscii("")); + prefLicenseUrl->clear(); + prefLicenseUrl->setReadOnly(false); + break; } } diff --git a/src/Gui/DlgSettingsDocumentImp.h b/src/Gui/DlgSettingsDocumentImp.h index a962f6426..9f174f968 100644 --- a/src/Gui/DlgSettingsDocumentImp.h +++ b/src/Gui/DlgSettingsDocumentImp.h @@ -32,25 +32,25 @@ namespace Dialog { /** * The DlgSettingsDocumentImp class implements a preference page to change settings - * for the Inventor viewer. + * for the document. * \author Jürgen Riegel */ - class DlgSettingsDocumentImp : public PreferencePage, public Ui_DlgSettingsDocument -{ - Q_OBJECT +class DlgSettingsDocumentImp : public PreferencePage, public Ui_DlgSettingsDocument +{ + Q_OBJECT public: - DlgSettingsDocumentImp( QWidget* parent = 0 ); - ~DlgSettingsDocumentImp(); + DlgSettingsDocumentImp( QWidget* parent = 0 ); + ~DlgSettingsDocumentImp(); + + void saveSettings(); + void loadSettings(); - void saveSettings(); - void loadSettings(); - protected Q_SLOTS: void onLicenseTypeChanged(int index); protected: - void changeEvent(QEvent *e); + void changeEvent(QEvent *e); }; } // namespace Dialog