Added pref option to disable the FreeCAD logo in the FCStd file thumbnail

This commit is contained in:
Yorik van Havre
2017-06-16 00:25:42 -03:00
parent 07fd41f4fc
commit d28bae3f52
3 changed files with 27 additions and 4 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>500</width>
<height>593</height>
<height>685</height>
</rect>
</property>
<property name="windowTitle">
@@ -283,7 +283,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
@@ -338,6 +338,22 @@
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="Gui::PrefCheckBox" name="prefAddLogo">
<property name="text">
<string>Add the FreeCAD logo to the generated thumbnail</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>AddThumbnailLogo</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Document</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -69,6 +69,7 @@ void DlgSettingsDocumentImp::saveSettings()
prefSaveTransaction->onSave();
prefDiscardTransaction->onSave();
prefSaveThumbnail->onSave();
prefAddLogo->onSave();
prefSaveBackupFiles->onSave();
prefCountBackupFiles->onSave();
prefDuplicateLabel->onSave();
@@ -97,6 +98,7 @@ void DlgSettingsDocumentImp::loadSettings()
prefSaveTransaction->onRestore();
prefDiscardTransaction->onRestore();
prefSaveThumbnail->onRestore();
prefAddLogo->onRestore();
prefSaveBackupFiles->onRestore();
prefCountBackupFiles->onRestore();
prefDuplicateLabel->onRestore();

View File

@@ -106,8 +106,13 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const
}
QPixmap px = Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str());
if (!img.isNull())
px = BitmapFactory().merge(QPixmap::fromImage(img),px,BitmapFactoryInst::BottomRight);
if (!img.isNull()) {
if (App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Document")->GetBool("AddThumbnailLogo",true))
px = BitmapFactory().merge(QPixmap::fromImage(img),px,BitmapFactoryInst::BottomRight);
else
px = QPixmap::fromImage(img);
}
if (!px.isNull()) {
// according to specification add some meta-information to the image