1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 #include "prefs_scrapbook.h"
9 #include "prefsstructs.h"
10 #include "scribusdoc.h"
11 
Prefs_Scrapbook(QWidget * parent,ScribusDoc * doc)12 Prefs_Scrapbook::Prefs_Scrapbook(QWidget* parent, ScribusDoc* doc)
13 	: Prefs_Pane(parent)
14 {
15 	setupUi(this);
16 	languageChange();
17 
18 	m_caption = tr("Scrapbook");
19 	m_icon = "scrap_16.png";
20 }
21 
22 Prefs_Scrapbook::~Prefs_Scrapbook() = default;
23 
languageChange()24 void Prefs_Scrapbook::languageChange()
25 {
26 	autoSendCopiedToScrapCheckBox->setToolTip( "<qt>" + tr( "This enables the scrapbook to be used an extension to the copy/paste buffers. Simply copying an object or grouped object will send this to the Scrapbook automatically." ) + "</qt>");
27 	keepCopiedAcrossSessionsCheckBox->setToolTip( "<qt>" + tr( "This enables copied items to be kept permanently in the scrapbook" ) + "</qt>" );
28 	writePreviewsCheckBox->setToolTip( "<qt>" + tr("Save generated scrapbook previews in the scrapbook directory") + "</qt>");
29 	itemCountKeptInScrapbookSpinBox->setToolTip( "<qt>" + tr("The minimum number is 1; the maximum is 100") + "</qt>");
30 }
31 
restoreDefaults(struct ApplicationPrefs * prefsData)32 void Prefs_Scrapbook::restoreDefaults(struct ApplicationPrefs *prefsData)
33 {
34 	autoSendCopiedToScrapCheckBox->setChecked(prefsData->scrapbookPrefs.doCopyToScrapbook);
35 	keepCopiedAcrossSessionsCheckBox->setChecked(prefsData->scrapbookPrefs.persistentScrapbook);
36 	writePreviewsCheckBox->setChecked(prefsData->scrapbookPrefs.writePreviews);
37 	itemCountKeptInScrapbookSpinBox->setValue(prefsData->scrapbookPrefs.numScrapbookCopies);
38 }
39 
saveGuiToPrefs(struct ApplicationPrefs * prefsData) const40 void Prefs_Scrapbook::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
41 {
42 	prefsData->scrapbookPrefs.doCopyToScrapbook=autoSendCopiedToScrapCheckBox->isChecked();
43 	prefsData->scrapbookPrefs.persistentScrapbook=keepCopiedAcrossSessionsCheckBox->isChecked();
44 	prefsData->scrapbookPrefs.writePreviews=writePreviewsCheckBox->isChecked();
45 	prefsData->scrapbookPrefs.numScrapbookCopies=itemCountKeptInScrapbookSpinBox->value();
46 }
47 
48