+ fix inconsistencies between license note and url

This commit is contained in:
wmayer 2015-09-08 19:17:36 +02:00
parent f1b21bf01d
commit bd94486c7e
4 changed files with 31 additions and 17 deletions

View File

@ -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");

View File

@ -235,9 +235,6 @@
</item>
<item>
<widget class="Gui::PrefSpinBox" name="prefAutoSaveTimeout">
<property name="text" stdset="0">
<string>15 min</string>
</property>
<property name="suffix">
<string notr="true"> min</string>
</property>
@ -517,7 +514,7 @@
<string>An URL where the user can find more details about the license</string>
</property>
<property name="text">
<string>http://en.wikipedia.org/wiki/All_rights_reserved</string>
<string notr="true">http://en.wikipedia.org/wiki/All_rights_reserved</string>
</property>
<property name="readOnly">
<bool>false</bool>

View File

@ -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;
}
}

View File

@ -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