Skip to content

Commit

Permalink
+ fix inconsistencies between license note and url
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 8, 2015
1 parent f1b21bf commit bd94486
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
17 changes: 15 additions & 2 deletions src/App/Document.cpp
Expand Up @@ -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");

Expand Down
5 changes: 1 addition & 4 deletions src/Gui/DlgSettingsDocument.ui
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 5 additions & 1 deletion src/Gui/DlgSettingsDocumentImp.cpp
Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/Gui/DlgSettingsDocumentImp.h
Expand Up @@ -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
Expand Down

0 comments on commit bd94486

Please sign in to comment.