diff --git a/src/Gui/DlgProjectInformation.ui b/src/Gui/DlgProjectInformation.ui
index 5ee4276d0..36014bc5f 100644
--- a/src/Gui/DlgProjectInformation.ui
+++ b/src/Gui/DlgProjectInformation.ui
@@ -32,19 +32,6 @@
6
- -
-
-
- Last &modification date:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- lineEditLastModDate
-
-
-
-
@@ -71,19 +58,6 @@
- -
-
-
- Commen&t:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- textEditComment
-
-
-
-
@@ -202,6 +176,19 @@
+ -
+
+
+ Last &modification date:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ lineEditLastModDate
+
+
+
-
@@ -238,6 +225,56 @@
+ -
+
+
+ License information:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ -
+
+
+ License URL
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ Open in browser
+
+
+
+
+
+ -
+
+
+ Commen&t:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ textEditComment
+
+
+
-
@@ -257,43 +294,6 @@
- -
-
-
- License information:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- License URL
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
-
- Open in browser
-
-
-
-
-
diff --git a/src/Gui/DlgProjectInformationImp.cpp b/src/Gui/DlgProjectInformationImp.cpp
index b0b47ebec..273bf9d90 100644
--- a/src/Gui/DlgProjectInformationImp.cpp
+++ b/src/Gui/DlgProjectInformationImp.cpp
@@ -29,6 +29,9 @@
#include "DlgProjectInformationImp.h"
#include "ui_DlgProjectInformation.h"
#include "Document.h"
+
+#include
+#include
#include
#include
@@ -55,7 +58,34 @@ DlgProjectInformationImp::DlgProjectInformationImp(App::Document* doc, QWidget*
ui->lineEditLastMod->setText(QString::fromUtf8(doc->LastModifiedBy.getValue()));
ui->lineEditLastModDate->setText(QString::fromUtf8(doc->LastModifiedDate.getValue()));
ui->lineEditCompany->setText(QString::fromUtf8(doc->Company.getValue()));
- ui->lineEditLicense->setText(QString::fromUtf8(doc->License.getValue()));
+
+ QList rawLicenses; rawLicenses
+ << "All rights reserved"
+ << "CreativeCommons Attribution"
+ << "CreativeCommons Attribution-ShareAlike"
+ << "CreativeCommons Attribution-NoDerivatives"
+ << "CreativeCommons Attribution-NonCommercial"
+ << "CreativeCommons Attribution-NonCommercial-ShareAlike"
+ << "CreativeCommons Attribution-NonCommercial-NoDerivatives"
+ << "Public Domain"
+ << "FreeArt"
+ << "Other";
+ for (QList::iterator it = rawLicenses.begin(); it != rawLicenses.end(); ++it) {
+ QString text = QApplication::translate("Gui::Dialog::DlgSettingsDocument", it->constData());
+ ui->comboLicense->addItem(text, *it);
+ }
+
+ int index = ui->comboLicense->findData(QByteArray(doc->License.getValue()));
+ if (index >= 0) {
+ ui->comboLicense->setCurrentIndex(index);
+ }
+ else {
+ index = ui->comboLicense->count();
+ QString text = QString::fromUtf8(doc->License.getValue());
+ ui->comboLicense->addItem(text);
+ ui->comboLicense->setCurrentIndex(index);
+ }
+
ui->lineEditLicenseURL->setText(QString::fromUtf8(doc->LicenseURL.getValue()));
// When saving the text to XML the newlines get lost. So we store also the newlines as '\n'.
@@ -65,6 +95,7 @@ DlgProjectInformationImp::DlgProjectInformationImp(App::Document* doc, QWidget*
QString text = lines.join(QLatin1String("\n"));
ui->textEditComment->setPlainText( text );
connect(ui->pushButtonOpenURL, SIGNAL(clicked()),this, SLOT(open_url()));
+ connect(ui->comboLicense, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseTypeChanged(int)));
}
/**
@@ -84,10 +115,13 @@ void DlgProjectInformationImp::accept()
_doc->CreatedBy.setValue(ui->lineEditCreator->text().toUtf8());
_doc->LastModifiedBy.setValue(ui->lineEditCreator->text().toUtf8());
_doc->Company.setValue(ui->lineEditCompany->text().toUtf8());
- _doc->License.setValue(ui->lineEditLicense->text().toUtf8());
+ QByteArray license = ui->comboLicense->itemData(ui->comboLicense->currentIndex()).toByteArray();
+ if (license.isEmpty())
+ license = ui->comboLicense->itemText(ui->comboLicense->currentIndex()).toUtf8();
+ _doc->License.setValue(license);
_doc->LicenseURL.setValue(ui->lineEditLicenseURL->text().toUtf8());
- // Replace newline escape sequence trough '\\n' string
+ // Replace newline escape sequence through '\\n' string
QStringList lines = ui->textEditComment->toPlainText().split
(QLatin1String("\n"), QString::KeepEmptyParts);
QString text = lines.join(QLatin1String("\\n"));
@@ -96,6 +130,42 @@ void DlgProjectInformationImp::accept()
QDialog::accept();
}
+void DlgProjectInformationImp::onLicenseTypeChanged(int index)
+{
+ switch (index) {
+ case 0:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://en.wikipedia.org/wiki/All_rights_reserved"));
+ break;
+ case 1:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://creativecommons.org/licenses/by/4.0/"));
+ break;
+ case 2:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://creativecommons.org/licenses/by-sa/4.0/"));
+ break;
+ case 3:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://creativecommons.org/licenses/by-nd/4.0/"));
+ break;
+ case 4:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://creativecommons.org/licenses/by-nc/4.0/"));
+ break;
+ case 5:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://creativecommons.org/licenses/by-nc-sa/4.0/"));
+ break;
+ case 6:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://creativecommons.org/licenses/by-nc-nd/4.0/"));
+ break;
+ case 7:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://en.wikipedia.org/wiki/Public_domain"));
+ break;
+ case 8:
+ ui->lineEditLicenseURL->setText(QString::fromAscii("http://artlibre.org/licence/lal"));
+ break;
+ default:
+ ui->lineEditLicenseURL->setText(QString::fromUtf8(_doc->LicenseURL.getValue()));
+ break;
+ }
+}
+
/**
* Opens the text in the LicenseURL property in external browser.
*/
diff --git a/src/Gui/DlgProjectInformationImp.h b/src/Gui/DlgProjectInformationImp.h
index cbcd1d398..016ea8ae7 100644
--- a/src/Gui/DlgProjectInformationImp.h
+++ b/src/Gui/DlgProjectInformationImp.h
@@ -46,6 +46,7 @@ public:
private Q_SLOTS:
void open_url();
+ void onLicenseTypeChanged(int index);
private:
App::Document* _doc;