r24749 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 25 19:37:48 UTC 2021


Author: jghali
Date: Mon Oct 25 19:37:48 2021
New Revision: 24749

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24749
Log:
Code cleanup

Modified:
    trunk/Scribus/scribus/ui/preferencesdialog.cpp
    trunk/Scribus/scribus/ui/prefs_colormanagement.cpp
    trunk/Scribus/scribus/ui/prefs_colormanagement.h
    trunk/Scribus/scribus/ui/prefs_display.cpp
    trunk/Scribus/scribus/ui/prefs_display.h
    trunk/Scribus/scribus/ui/prefs_documentinformation.cpp
    trunk/Scribus/scribus/ui/prefs_documentinformation.h
    trunk/Scribus/scribus/ui/prefs_documentitemattributes.cpp
    trunk/Scribus/scribus/ui/prefs_documentitemattributes.h
    trunk/Scribus/scribus/ui/prefs_documentsections.cpp
    trunk/Scribus/scribus/ui/prefs_documentsections.h
    trunk/Scribus/scribus/ui/prefs_documentsetup.cpp
    trunk/Scribus/scribus/ui/prefs_documentsetup.h
    trunk/Scribus/scribus/ui/prefs_externaltools.cpp
    trunk/Scribus/scribus/ui/prefs_externaltools.h
    trunk/Scribus/scribus/ui/prefs_fonts.cpp
    trunk/Scribus/scribus/ui/prefs_fonts.h
    trunk/Scribus/scribus/ui/prefs_hyphenator.cpp
    trunk/Scribus/scribus/ui/prefs_hyphenator.h
    trunk/Scribus/scribus/ui/prefs_imagecache.cpp
    trunk/Scribus/scribus/ui/prefs_imagecache.h
    trunk/Scribus/scribus/ui/prefs_itemtools.cpp
    trunk/Scribus/scribus/ui/prefs_itemtools.h
    trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
    trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h
    trunk/Scribus/scribus/ui/prefs_miscellaneous.cpp
    trunk/Scribus/scribus/ui/prefs_operatortools.cpp
    trunk/Scribus/scribus/ui/prefs_pagesizes.cpp
    trunk/Scribus/scribus/ui/prefs_paths.cpp
    trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
    trunk/Scribus/scribus/ui/prefs_pdfexport.h
    trunk/Scribus/scribus/ui/prefs_plugins.cpp
    trunk/Scribus/scribus/ui/prefs_preflightverifier.cpp
    trunk/Scribus/scribus/ui/prefs_printer.cpp
    trunk/Scribus/scribus/ui/prefs_scrapbook.cpp
    trunk/Scribus/scribus/ui/prefs_spelling.cpp
    trunk/Scribus/scribus/ui/prefs_spelling.h
    trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp
    trunk/Scribus/scribus/ui/prefs_tableofcontents.h
    trunk/Scribus/scribus/ui/prefs_typography.cpp
    trunk/Scribus/scribus/ui/prefs_userinterface.cpp

Modified: trunk/Scribus/scribus/ui/preferencesdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/preferencesdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/preferencesdialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/preferencesdialog.cpp	Mon Oct 25 19:37:48 2021
@@ -320,7 +320,7 @@
 		languageChange();
 	}
 	else
-		QWidget::changeEvent(e);
+		QDialog::changeEvent(e);
 }
 
 void PreferencesDialog::languageChange()

Modified: trunk/Scribus/scribus/ui/prefs_colormanagement.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_colormanagement.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_colormanagement.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_colormanagement.cpp	Mon Oct 25 19:37:48 2021
@@ -4,6 +4,8 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
+
+#include <array>
 
 #include "prefs_colormanagement.h"
 #include "prefsstructs.h"
@@ -41,10 +43,6 @@
 	}
 }
 
-Prefs_ColorManagement::~Prefs_ColorManagement()
-{
-}
-
 void Prefs_ColorManagement::languageChange()
 {
 }
@@ -63,15 +61,14 @@
 	}
 	activateCMCheckBox->setChecked(prefsData->colorPrefs.DCMSset.CMSinUse);
 
-	QString tmp_mp[] = { tr("Perceptual"), tr("Relative Colorimetric"),
-		tr("Saturation"), tr("Absolute Colorimetric")};
-		size_t array = sizeof(tmp_mp) / sizeof(*tmp_mp);
+	std::array<QString, 4> tmp_mp = { tr("Perceptual"), tr("Relative Colorimetric"),
+	                                  tr("Saturation"), tr("Absolute Colorimetric") };
 	imageRenderingIntentComboBox->clear();
-	for (uint prop = 0; prop < array; ++prop)
+	for (uint prop = 0; prop < tmp_mp.size(); ++prop)
 		imageRenderingIntentComboBox->addItem(tmp_mp[prop]);
 	imageRenderingIntentComboBox->setCurrentIndex(prefsData->colorPrefs.DCMSset.DefaultIntentImages);
 	solidColorsRenderingIntentComboBox->clear();
-	for (uint prop = 0; prop < array; ++prop)
+	for (uint prop = 0; prop < tmp_mp.size(); ++prop)
 		solidColorsRenderingIntentComboBox->addItem(tmp_mp[prop]);
 	solidColorsRenderingIntentComboBox->setCurrentIndex(prefsData->colorPrefs.DCMSset.DefaultIntentColors);
 

Modified: trunk/Scribus/scribus/ui/prefs_colormanagement.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_colormanagement.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_colormanagement.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_colormanagement.h	Mon Oct 25 19:37:48 2021
@@ -22,7 +22,7 @@
 
 	public:
 		Prefs_ColorManagement(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_ColorManagement();
+		~Prefs_ColorManagement() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;

Modified: trunk/Scribus/scribus/ui/prefs_display.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_display.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_display.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_display.cpp	Mon Oct 25 19:37:48 2021
@@ -68,10 +68,6 @@
 	}
 }
 
-Prefs_Display::~Prefs_Display()
-{
-}
-
 void Prefs_Display::languageChange()
 {
 	pageFillColorButton->setToolTip( "<qt>" + tr( "Color for paper (onscreen)" ) + "</qt>");
@@ -111,7 +107,6 @@
 {
 	docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
 	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
-//	QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
 
 	showImagesCheckBox->setChecked(prefsData->guidesPrefs.showPic);
 	showControlCharsCheckBox->setChecked(prefsData->guidesPrefs.showControls);
@@ -267,7 +262,7 @@
 void Prefs_Display::restoreDisScale()
 {
 	disconnect(adjustDisplaySlider, SIGNAL(valueChanged(int)), this, SLOT(setDisScale()));
-	int dpi = qApp->desktop()->logicalDpiX();
+	int dpi = QApplication::desktop()->logicalDpiX();
 	if ((dpi < 60) || (dpi > 500))
 		dpi = 72;
 	displayScale = dpi / 72.0;

Modified: trunk/Scribus/scribus/ui/prefs_display.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_display.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_display.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_display.h	Mon Oct 25 19:37:48 2021
@@ -20,7 +20,7 @@
 
 	public:
 		Prefs_Display(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_Display();
+		~Prefs_Display() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;

Modified: trunk/Scribus/scribus/ui/prefs_documentinformation.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentinformation.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentinformation.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentinformation.cpp	Mon Oct 25 19:37:48 2021
@@ -20,10 +20,6 @@
 
 	m_caption = tr("Document Information");
 	m_icon = "documentinfo.png";
-}
-
-Prefs_DocumentInformation::~Prefs_DocumentInformation()
-{
 }
 
 void Prefs_DocumentInformation::languageChange()

Modified: trunk/Scribus/scribus/ui/prefs_documentinformation.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentinformation.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentinformation.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentinformation.h	Mon Oct 25 19:37:48 2021
@@ -20,7 +20,7 @@
 
 	public:
 		Prefs_DocumentInformation(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_DocumentInformation();
+		~Prefs_DocumentInformation() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;

Modified: trunk/Scribus/scribus/ui/prefs_documentitemattributes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentitemattributes.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentitemattributes.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentitemattributes.cpp	Mon Oct 25 19:37:48 2021
@@ -10,7 +10,7 @@
 #include "ui/prefs_documentitemattributes.h"
 #include "prefsstructs.h"
 
-Prefs_DocumentItemAttributes::Prefs_DocumentItemAttributes(QWidget* parent, ScribusDoc* doc)
+Prefs_DocumentItemAttributes::Prefs_DocumentItemAttributes(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -31,11 +31,6 @@
 	connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteEntry()));
 	connect(clearButton, SIGNAL(clicked()), this, SLOT(clearEntries()));
 	connect(copyButton, SIGNAL(clicked()), this, SLOT(copyEntry()));
-
-}
-
-Prefs_DocumentItemAttributes::~Prefs_DocumentItemAttributes()
-{
 }
 
 void Prefs_DocumentItemAttributes::languageChange()
@@ -45,13 +40,13 @@
 
 void Prefs_DocumentItemAttributes::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
-	localAttributes=prefsData->itemAttrPrefs.defaultItemAttributes;
+	localAttributes = prefsData->itemAttrPrefs.defaultItemAttributes;
 	updateTable();
 }
 
 void Prefs_DocumentItemAttributes::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
 {
-	prefsData->itemAttrPrefs.defaultItemAttributes=localAttributes;
+	prefsData->itemAttrPrefs.defaultItemAttributes = localAttributes;
 }
 
 void Prefs_DocumentItemAttributes::tableItemChanged( int row, int col )
@@ -59,47 +54,47 @@
 	switch (col)
 	{
 	case 0:
-		localAttributes[row].name=attributesTable->item(row, col)->text();
+		localAttributes[row].name = attributesTable->item(row, col)->text();
 		break;
 	case 1:
 		{
-			QComboBox* qcti=dynamic_cast<QComboBox*>(attributesTable->cellWidget(row,col));
-			if (qcti!=nullptr)
+			QComboBox* qcti = dynamic_cast<QComboBox*>(attributesTable->cellWidget(row,col));
+			if (qcti != nullptr)
 			{
-				int index=qcti->currentIndex();
-				if (index<typesData.count())
-					localAttributes[row].type=typesData[index];
+				int index = qcti->currentIndex();
+				if (index < typesData.count())
+					localAttributes[row].type = typesData[index];
 			}
 		}
 		break;
 	case 2:
-		localAttributes[row].value=attributesTable->item(row, col)->text();
+		localAttributes[row].value = attributesTable->item(row, col)->text();
 		break;
 	case 3:
-		localAttributes[row].parameter=attributesTable->item(row, col)->text();
+		localAttributes[row].parameter = attributesTable->item(row, col)->text();
 		break;
 	case 4:
 		{
-			QComboBox* qcti=dynamic_cast<QComboBox*>(attributesTable->cellWidget(row,col));
-			if (qcti!=nullptr)
+			QComboBox* qcti = dynamic_cast<QComboBox*>(attributesTable->cellWidget(row,col));
+			if (qcti != nullptr)
 			{
-				int index=qcti->currentIndex();
-				if (index<relationshipsData.count())
-					localAttributes[row].relationship=relationshipsData[index];
+				int index = qcti->currentIndex();
+				if (index < relationshipsData.count())
+					localAttributes[row].relationship = relationshipsData[index];
 			}
 		}
 		break;
 	case 5:
-		localAttributes[row].relationshipto=attributesTable->item(row, col)->text();
+		localAttributes[row].relationshipto = attributesTable->item(row, col)->text();
 		break;
 	case 6:
 		{
-			QComboBox* qcti=dynamic_cast<QComboBox*>(attributesTable->cellWidget(row,col));
-			if (qcti!=nullptr)
+			QComboBox* qcti = dynamic_cast<QComboBox*>(attributesTable->cellWidget(row,col));
+			if (qcti != nullptr)
 			{
-				int index=qcti->currentIndex();
-				if (index<autoAddToData.count())
-					localAttributes[row].autoaddto=autoAddToData[index];
+				int index = qcti->currentIndex();
+				if (index < autoAddToData.count())
+					localAttributes[row].autoaddto = autoAddToData[index];
 			}
 		}
 		break;
@@ -112,9 +107,9 @@
 void Prefs_DocumentItemAttributes::addEntry()
 {
 	ObjectAttribute blank;
-	blank.relationship="none";
-	blank.autoaddto="none";
-	blank.type="none";
+	blank.relationship = "none";
+	blank.autoaddto = "none";
+	blank.type = "none";
 	localAttributes.append(blank);
 	updateTable();
 }
@@ -139,8 +134,8 @@
 		int listIndex=typesData.indexOf(objAttr.type);
 		if (listIndex==-1)
 		{
-			objAttr.type="none";
-			listIndex=0;
+			objAttr.type = "none";
+			listIndex = 0;
 		}
 		item2->setCurrentIndex(listIndex);
 
@@ -156,11 +151,11 @@
 		QComboBox *item5 = new QComboBox();
 		item5->addItems(relationships);
 		attributesTable->setCellWidget(row, col++, item5);
-		int index=relationshipsData.indexOf(objAttr.relationship);
-		if (index==-1)
-		{
-			objAttr.relationship="none";
-			index=0;
+		int index = relationshipsData.indexOf(objAttr.relationship);
+		if (index == -1)
+		{
+			objAttr.relationship = "none";
+			index = 0;
 		}
 		item5->setCurrentIndex(index);
 		//Relationship to
@@ -170,16 +165,16 @@
 		QComboBox *item7 = new QComboBox();
 		item7->addItems(autoAddTo);
 		attributesTable->setCellWidget(row, col++, item7);
-		int index2=autoAddToData.indexOf(objAttr.autoaddto);
-		if (index2==-1)
-		{
-			objAttr.relationship="none";
-			index2=0;
+		int index2 = autoAddToData.indexOf(objAttr.autoaddto);
+		if (index2 == -1)
+		{
+			objAttr.relationship = "none";
+			index2 = 0;
 		}
 		item7->setCurrentIndex(index2);
 
-		QTableWidgetItem *t=attributesTable->verticalHeaderItem(row);
-		if (t!=nullptr)
+		QTableWidgetItem *t = attributesTable->verticalHeaderItem(row);
+		if (t != nullptr)
 			t->setText(QString("%1").arg(row));
 	}
 	deleteButton->setEnabled(localAttributes.count()!=0);
@@ -190,15 +185,15 @@
 
 void Prefs_DocumentItemAttributes::deleteEntry()
 {
-	int currRow=attributesTable->currentRow();
-	bool found=false;
+	int currRow = attributesTable->currentRow();
+	bool found = false;
 	ObjAttrVector::Iterator it;
-	int count=0;
+	int count = 0;
 	for (it = localAttributes.begin(); it!= localAttributes.end(); ++it)
 	{
-		if(count==currRow)
-		{
-			found=true;
+		if(count == currRow)
+		{
+			found = true;
 			break;
 		}
 		++count;
@@ -220,15 +215,15 @@
 
 void Prefs_DocumentItemAttributes::copyEntry()
 {
-	int currRow=attributesTable->currentRow();
-	bool found=false;
+	int currRow = attributesTable->currentRow();
+	bool found = false;
 	ObjAttrVector::Iterator it;
-	int count=0;
-	for (it = localAttributes.begin(); it!= localAttributes.end(); ++it)
-	{
-		if(count==currRow)
-		{
-			found=true;
+	int count = 0;
+	for (it = localAttributes.begin(); it != localAttributes.end(); ++it)
+	{
+		if(count == currRow)
+		{
+			found = true;
 			break;
 		}
 		++count;

Modified: trunk/Scribus/scribus/ui/prefs_documentitemattributes.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentitemattributes.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentitemattributes.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentitemattributes.h	Mon Oct 25 19:37:48 2021
@@ -19,7 +19,7 @@
 
 	public:
 		Prefs_DocumentItemAttributes(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_DocumentItemAttributes();
+		~Prefs_DocumentItemAttributes() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;

Modified: trunk/Scribus/scribus/ui/prefs_documentsections.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentsections.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsections.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentsections.cpp	Mon Oct 25 19:37:48 2021
@@ -18,7 +18,7 @@
 
 Prefs_DocumentSections::Prefs_DocumentSections(QWidget* parent, ScribusDoc* doc)
 	: Prefs_Pane(parent),
-	m_doc(doc), m_maxPageIndex(0)
+	  m_doc(doc)
 {
 	setupUi(this);
 	languageChange();
@@ -29,10 +29,6 @@
 	connect(sectionsTable, SIGNAL(cellChanged(int,int)), this, SLOT(tableItemChanged(int,int)));
 	connect(addButton, SIGNAL(clicked()), this, SLOT(addEntry()));
 	connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteEntry()));
-}
-
-Prefs_DocumentSections::~Prefs_DocumentSections()
-{
 }
 
 void Prefs_DocumentSections::languageChange()
@@ -148,7 +144,7 @@
 			break;
 		case 5:
 			{
-				NumFormatCombo* qcti = dynamic_cast<NumFormatCombo*>(sectionsTable->cellWidget(row,col));
+				auto* qcti = dynamic_cast<NumFormatCombo*>(sectionsTable->cellWidget(row,col));
 				if (qcti != nullptr)
 					m_localSections[row].type = qcti->currentFormat();
 			}
@@ -161,7 +157,7 @@
 			break;
 		case 8:
 			{
-				QString ch=sectionsTable->item(row, col)->text();
+				QString ch = sectionsTable->item(row, col)->text();
 				if (ch.length() > 0)
 					m_localSections[row].pageNumberFillChar = ch.at(0);
 				else

Modified: trunk/Scribus/scribus/ui/prefs_documentsections.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentsections.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsections.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentsections.h	Mon Oct 25 19:37:48 2021
@@ -21,7 +21,7 @@
 
 	public:
 		Prefs_DocumentSections(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_DocumentSections();
+		~Prefs_DocumentSections() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
@@ -31,8 +31,8 @@
 
 	protected:
 		DocumentSectionMap m_localSections;
-		ScribusDoc* m_doc;
-		uint m_maxPageIndex;
+		ScribusDoc* m_doc { nullptr };
+		uint m_maxPageIndex { 0 };
 		QStringList m_styles;
 		virtual void updateTable();
 

Modified: trunk/Scribus/scribus/ui/prefs_documentsetup.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentsetup.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsetup.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentsetup.cpp	Mon Oct 25 19:37:48 2021
@@ -1,134 +1,127 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#include <algorithm>
-
-#include <QButtonGroup>
-#include <QFileDialog>
-
-#include "ui/prefs_documentsetup.h"
-#include "commonstrings.h"
-#include "ui/newmarginwidget.h"
-#include "langmgr.h"
-#include "pagesize.h"
-#include "prefsfile.h"
-#include "prefsmanager.h"
-#include "prefsstructs.h"
-#include "undomanager.h"
-#include "units.h"
-#include "util.h"
-#include "util_text.h"
-
-Prefs_DocumentSetup::Prefs_DocumentSetup(QWidget* parent, ScribusDoc* doc)
-	: Prefs_Pane(parent),
-	m_doc(doc)
-{
-	setupUi(this);
-	
-	scrollArea->viewport()->setAutoFillBackground(false);
-	scrollArea->widget()->setAutoFillBackground(false);
-
-	m_caption = tr("Document Setup");
-	m_icon = "scribusdoc16.png";
-
-	unitRatio = 1.0;
-	pageW = pageH = 1.0;
-
-	if (!m_doc)
-	{
-		applySizesToAllPagesCheckBox->hide();
-		applySizesToAllMasterPagesCheckBox->hide();
-		applyMarginsToAllPagesCheckBox->hide();
-		applyMarginsToAllMasterPagesCheckBox->hide();
-		pageSizeLinkToolButton->hide(); //temp
-//		connect(pageSizeLinkToolButton, SIGNAL(clicked()), this, SLOT(emitSectionChange()));
-	}
-	else
-	{
-		pageSizeLinkToolButton->hide();
-		emergencyCheckBox->hide();
-	}
-
-	QStringList languageList;
-	LanguageManager::instance()->fillInstalledStringList(&languageList);
-	std::sort(languageList.begin(), languageList.end(), localeAwareLessThan);
-	languageComboBox->addItems( languageList );
-
-	pageLayoutButtonGroup->setId(singlePageRadioButton,0);
-	pageLayoutButtonGroup->setId(facingPagesRadioButton,1);
-	pageLayoutButtonGroup->setId(threeFoldRadioButton,2);
-	pageLayoutButtonGroup->setId(fourFoldRadioButton,3);
-	singlePageRadioButton->setChecked(true);
-	layoutFirstPageIsComboBox->clear();
-	layoutFirstPageIsComboBox->addItem(" ");
-	layoutFirstPageIsComboBox->setCurrentIndex(0);
-	layoutFirstPageIsComboBox->setEnabled(false);
-
-	pageWidthSpinBox->setMaximum(16777215);
-	pageHeightSpinBox->setMaximum(16777215);
-	languageChange();
-
-	connect(pageSizeComboBox, SIGNAL(activated(const QString &)), this, SLOT(setPageSize()));
-	connect(pageOrientationComboBox, SIGNAL(activated(int)), this, SLOT(setPageOrientation(int)));
-	connect(pageWidthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
-	connect(pageHeightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
-	connect(pageLayoutButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(pageLayoutChanged(int)));
-	connect(pageUnitsComboBox, SIGNAL(activated(int)), this, SLOT(unitChange()));
-	connect(undoCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotUndo(bool)));
-	connect(changeAutoDir, SIGNAL(clicked()), this, SLOT(changeAutoDocDir()));
-}
-
-Prefs_DocumentSetup::~Prefs_DocumentSetup()
-{
-}
-
-void Prefs_DocumentSetup::unitChange()
-{
-	pageWidthSpinBox->blockSignals(true);
-	pageHeightSpinBox->blockSignals(true);
-
-	int docUnitIndex = pageUnitsComboBox->currentIndex();
-	pageWidthSpinBox->setNewUnit(docUnitIndex);
-	pageHeightSpinBox->setNewUnit(docUnitIndex);
-	unitRatio = unitGetRatioFromIndex(docUnitIndex);
-	pageWidthSpinBox->setValue(pageW * unitRatio);
-	pageHeightSpinBox->setValue(pageH * unitRatio);
-	marginsWidget->setNewUnit(docUnitIndex);
-	marginsWidget->setPageHeight(pageH);
-	marginsWidget->setPageWidth(pageW);
-	bleedsWidget->setNewUnit(docUnitIndex);
-	bleedsWidget->setPageHeight(pageH);
-	bleedsWidget->setPageWidth(pageW);
-
-	pageWidthSpinBox->blockSignals(false);
-	pageHeightSpinBox->blockSignals(false);
-
-	emit prefsChangeUnits(docUnitIndex);
-}
-
-void Prefs_DocumentSetup::languageChange()
-{
-	int i=0;
-
-	i=pageOrientationComboBox->currentIndex();
-	pageOrientationComboBox->clear();
-	pageOrientationComboBox->addItem( tr( "Portrait" ) );
-	pageOrientationComboBox->addItem( tr( "Landscape" ) );
-	pageOrientationComboBox->setCurrentIndex(i<0?0:i);
-
-	i=pageUnitsComboBox->currentIndex();
-	pageUnitsComboBox->clear();
-	pageUnitsComboBox->addItems(unitGetTextUnitList());
-	pageUnitsComboBox->setCurrentIndex(i<0?0:i);
-
-	setupPageSets();
-
-	pageWidthSpinBox->setToolTip( "<qt>" + tr( "Width of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
-	pageHeightSpinBox->setToolTip( "<qt>" + tr( "Height of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
-	pageSizeComboBox->setToolTip( "<qt>" + tr( "Default page size, either a standard size or a custom size. More page sizes can be made visible by activating them in Preferences." ) + "</qt>" );
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#include <algorithm>
+
+#include <QButtonGroup>
+#include <QFileDialog>
+
+#include "ui/prefs_documentsetup.h"
+#include "commonstrings.h"
+#include "ui/newmarginwidget.h"
+#include "langmgr.h"
+#include "pagesize.h"
+#include "prefsfile.h"
+#include "prefsmanager.h"
+#include "prefsstructs.h"
+#include "undomanager.h"
+#include "units.h"
+#include "util.h"
+#include "util_text.h"
+
+Prefs_DocumentSetup::Prefs_DocumentSetup(QWidget* parent, ScribusDoc* doc)
+	: Prefs_Pane(parent),
+	  m_doc(doc)
+{
+	setupUi(this);
+	
+	scrollArea->viewport()->setAutoFillBackground(false);
+	scrollArea->widget()->setAutoFillBackground(false);
+
+	m_caption = tr("Document Setup");
+	m_icon = "scribusdoc16.png";
+
+	if (!m_doc)
+	{
+		applySizesToAllPagesCheckBox->hide();
+		applySizesToAllMasterPagesCheckBox->hide();
+		applyMarginsToAllPagesCheckBox->hide();
+		applyMarginsToAllMasterPagesCheckBox->hide();
+		pageSizeLinkToolButton->hide(); //temp
+//		connect(pageSizeLinkToolButton, SIGNAL(clicked()), this, SLOT(emitSectionChange()));
+	}
+	else
+	{
+		pageSizeLinkToolButton->hide();
+		emergencyCheckBox->hide();
+	}
+
+	QStringList languageList;
+	LanguageManager::instance()->fillInstalledStringList(&languageList);
+	std::sort(languageList.begin(), languageList.end(), localeAwareLessThan);
+	languageComboBox->addItems( languageList );
+
+	pageLayoutButtonGroup->setId(singlePageRadioButton,0);
+	pageLayoutButtonGroup->setId(facingPagesRadioButton,1);
+	pageLayoutButtonGroup->setId(threeFoldRadioButton,2);
+	pageLayoutButtonGroup->setId(fourFoldRadioButton,3);
+	singlePageRadioButton->setChecked(true);
+	layoutFirstPageIsComboBox->clear();
+	layoutFirstPageIsComboBox->addItem(" ");
+	layoutFirstPageIsComboBox->setCurrentIndex(0);
+	layoutFirstPageIsComboBox->setEnabled(false);
+
+	pageWidthSpinBox->setMaximum(16777215);
+	pageHeightSpinBox->setMaximum(16777215);
+	languageChange();
+
+	connect(pageSizeComboBox, SIGNAL(activated(const QString &)), this, SLOT(setPageSize()));
+	connect(pageOrientationComboBox, SIGNAL(activated(int)), this, SLOT(setPageOrientation(int)));
+	connect(pageWidthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
+	connect(pageHeightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
+	connect(pageLayoutButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(pageLayoutChanged(int)));
+	connect(pageUnitsComboBox, SIGNAL(activated(int)), this, SLOT(unitChange()));
+	connect(undoCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotUndo(bool)));
+	connect(changeAutoDir, SIGNAL(clicked()), this, SLOT(changeAutoDocDir()));
+}
+
+void Prefs_DocumentSetup::unitChange()
+{
+	pageWidthSpinBox->blockSignals(true);
+	pageHeightSpinBox->blockSignals(true);
+
+	int docUnitIndex = pageUnitsComboBox->currentIndex();
+	pageWidthSpinBox->setNewUnit(docUnitIndex);
+	pageHeightSpinBox->setNewUnit(docUnitIndex);
+	unitRatio = unitGetRatioFromIndex(docUnitIndex);
+	pageWidthSpinBox->setValue(pageW * unitRatio);
+	pageHeightSpinBox->setValue(pageH * unitRatio);
+	marginsWidget->setNewUnit(docUnitIndex);
+	marginsWidget->setPageHeight(pageH);
+	marginsWidget->setPageWidth(pageW);
+	bleedsWidget->setNewUnit(docUnitIndex);
+	bleedsWidget->setPageHeight(pageH);
+	bleedsWidget->setPageWidth(pageW);
+
+	pageWidthSpinBox->blockSignals(false);
+	pageHeightSpinBox->blockSignals(false);
+
+	emit prefsChangeUnits(docUnitIndex);
+}
+
+void Prefs_DocumentSetup::languageChange()
+{
+	int i=0;
+
+	i=pageOrientationComboBox->currentIndex();
+	pageOrientationComboBox->clear();
+	pageOrientationComboBox->addItem( tr( "Portrait" ) );
+	pageOrientationComboBox->addItem( tr( "Landscape" ) );
+	pageOrientationComboBox->setCurrentIndex(i<0?0:i);
+
+	i=pageUnitsComboBox->currentIndex();
+	pageUnitsComboBox->clear();
+	pageUnitsComboBox->addItems(unitGetTextUnitList());
+	pageUnitsComboBox->setCurrentIndex(i<0?0:i);
+
+	setupPageSets();
+
+	pageWidthSpinBox->setToolTip( "<qt>" + tr( "Width of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
+	pageHeightSpinBox->setToolTip( "<qt>" + tr( "Height of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
+	pageSizeComboBox->setToolTip( "<qt>" + tr( "Default page size, either a standard size or a custom size. More page sizes can be made visible by activating them in Preferences." ) + "</qt>" );
 	pageSizeLinkToolButton->setToolTip( "<qt>" + tr( "Enable or disable more page sizes by jumping to Page Size preferences" ) + "</qt>" );
 	pageOrientationComboBox->setToolTip( "<qt>" + tr( "Default orientation of document pages" ) + "</qt>" );
 	pageUnitsComboBox->setToolTip( "<qt>" + tr( "Default unit of measurement for document editing" ) + "</qt>" );
@@ -136,296 +129,296 @@
 	autosaveIntervalSpinBox->setToolTip( "<qt>" + tr( "Time period between saving automatically" ) + "</qt>" );
 	undoLengthSpinBox->setToolTip( "<qt>" + tr("Set the length of the action history in steps. If set to 0 infinite amount of actions will be stored.") + "</qt>");
 	applySizesToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing pages in the document" ) + "</qt>" );
-	applyMarginsToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing master pages in the document" ) + "</qt>" );
-	autosaveCountSpinBox->setToolTip("<qt>" + tr("Keep this many files during the editing session. Backup files will be removed when you close the document.") + "</qt>");
-}
-
-void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
-{
-	pageWidthSpinBox->blockSignals(true);
-	pageHeightSpinBox->blockSignals(true);
-	pageOrientationComboBox->blockSignals(true);
-	pageSizeComboBox->blockSignals(true);
-
-	setCurrentComboItem(languageComboBox, LanguageManager::instance()->getLangFromAbbrev(prefsData->docSetupPrefs.language, true));
-
-	unitRatio = unitGetRatioFromIndex(prefsData->docSetupPrefs.docUnitIndex);
-	setupPageSizes(prefsData);
-
-	pageOrientationComboBox->setCurrentIndex(prefsData->docSetupPrefs.pageOrientation);
-	pageUnitsComboBox->setCurrentIndex(prefsData->docSetupPrefs.docUnitIndex);
-	pageW = prefsData->docSetupPrefs.pageWidth;
-	pageH = prefsData->docSetupPrefs.pageHeight;
-	pageWidthSpinBox->setValue(pageW * unitRatio);
-	pageHeightSpinBox->setValue(pageH * unitRatio);
-	pageSets=prefsData->pageSets;
-	if (prefsData->docSetupPrefs.pagePositioning < 2)
-	{
-		threeFoldRadioButton->hide();
-		fourFoldRadioButton->hide();
-	}
-	switch (prefsData->docSetupPrefs.pagePositioning)
-	{
-		case 0:
-			singlePageRadioButton->setChecked(true);
-			break;
-		case 1:
-			facingPagesRadioButton->setChecked(true);
-			break;
-		case 2:
-			threeFoldRadioButton->setChecked(true);
-			break;
-		case 3:
-			fourFoldRadioButton->setChecked(true);
-			break;
-	}
-	setupPageSets();
-
-	layoutFirstPageIsComboBox->setCurrentIndex(prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage);
-
-	pageWidthSpinBox->blockSignals(false);
-	pageHeightSpinBox->blockSignals(false);
-	pageOrientationComboBox->blockSignals(false);
-	pageSizeComboBox->blockSignals(false);
-
-	marginsWidget->setup(prefsData->docSetupPrefs.margins, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::MarginWidgetFlags);
-	marginsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
-	marginsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-//	marginsWidget->setPageSize(prefsPageSizeName);
-	marginsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
-	bleedsWidget->setup(prefsData->docSetupPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
-	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
-	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
-//	bleedsWidget->setPageSize(prefsPageSizeName);
-	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
-	saveCompressedCheckBox->setChecked(prefsData->docSetupPrefs.saveCompressed);
-	emergencyCheckBox->setChecked(prefsData->miscPrefs.saveEmergencyFile);
-	autosaveCheckBox->setChecked( prefsData->docSetupPrefs.AutoSave );
-	autosaveIntervalSpinBox->setValue(prefsData->docSetupPrefs.AutoSaveTime / 1000 / 60);
-	autosaveCountSpinBox->setValue(prefsData->docSetupPrefs.AutoSaveCount);
-	autosaveKeepCheckBox->setChecked(prefsData->docSetupPrefs.AutoSaveKeep);
-	autosaveDocRadio->setChecked(prefsData->docSetupPrefs.AutoSaveLocation);
-	autosaveDirRadio->setChecked(!prefsData->docSetupPrefs.AutoSaveLocation);
-	autosaveDirEdit->setText(prefsData->docSetupPrefs.AutoSaveDir);
-	autosaveDirEdit->setEnabled(!prefsData->docSetupPrefs.AutoSaveLocation);
-	changeAutoDir->setEnabled(!prefsData->docSetupPrefs.AutoSaveLocation);
-	showAutosaveClockOnCanvasCheckBox->setChecked(prefsData->displayPrefs.showAutosaveClockOnCanvas);
-	undoCheckBox->setChecked(PrefsManager::instance().prefsFile->getContext("undo")->getBool("enabled", true));
-	int undoLength = UndoManager::instance()->getHistoryLength();
-	if (undoLength == -1)
-		undoLengthSpinBox->setEnabled(false);
-	else
-		undoLengthSpinBox->setValue(undoLength);
-	unitChange();
-}
-
-void Prefs_DocumentSetup::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
-{
-	prefsData->docSetupPrefs.language = LanguageManager::instance()->getAbbrevFromLang(languageComboBox->currentText(), false);
-	prefsData->docSetupPrefs.pageSize = prefsPageSizeName;
-	prefsData->docSetupPrefs.pageOrientation = pageOrientationComboBox->currentIndex();
-	prefsData->docSetupPrefs.docUnitIndex = pageUnitsComboBox->currentIndex();
-	prefsData->docSetupPrefs.pageWidth = pageW;
-	prefsData->docSetupPrefs.pageHeight = pageH;
-	prefsData->docSetupPrefs.pagePositioning = pageLayoutButtonGroup->checkedId();
-	prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage = layoutFirstPageIsComboBox->currentIndex();
-
-	prefsData->docSetupPrefs.margins = marginsWidget->margins();
-	prefsData->docSetupPrefs.bleeds = bleedsWidget->margins();
-	prefsData->docSetupPrefs.saveCompressed = saveCompressedCheckBox->isChecked();
-	prefsData->miscPrefs.saveEmergencyFile = emergencyCheckBox->isChecked();
-	prefsData->docSetupPrefs.AutoSave=autosaveCheckBox->isChecked();
-	prefsData->docSetupPrefs.AutoSaveTime = autosaveIntervalSpinBox->value() * 1000 * 60;
-	prefsData->docSetupPrefs.AutoSaveCount = autosaveCountSpinBox->value();
-	prefsData->docSetupPrefs.AutoSaveKeep = autosaveKeepCheckBox->isChecked();
-	prefsData->docSetupPrefs.AutoSaveLocation = autosaveDocRadio->isChecked();
-	prefsData->docSetupPrefs.AutoSaveDir = autosaveDirEdit->text();
-	prefsData->displayPrefs.showAutosaveClockOnCanvas=showAutosaveClockOnCanvasCheckBox->isChecked();
-	bool undoActive = undoCheckBox->isChecked();
-	if (!undoActive)
-		UndoManager::instance()->clearStack();
-	UndoManager::instance()->setUndoEnabled(undoActive);
-	UndoManager::instance()->setAllHistoryLengths(undoLengthSpinBox->value());
-	static PrefsContext *undoPrefs = PrefsManager::instance().prefsFile->getContext("undo");
-	undoPrefs->set("enabled", undoActive);
-}
-
-void Prefs_DocumentSetup::setupPageSets()
-{
-	int i = layoutFirstPageIsComboBox->currentIndex();
-	if (!layoutFirstPageIsComboBox->isEnabled())
-		i = -1;
-	int currIndex = pageLayoutButtonGroup->checkedId() < 0 ? 0 :pageLayoutButtonGroup->checkedId();
-	layoutFirstPageIsComboBox->clear();
-	if (currIndex > 0 && currIndex < pageSets.count())
-	{
-		const PageSet& pageSet = pageSets.at(currIndex);
-		const QStringList& pageNames = pageSet.pageNames;
-		layoutFirstPageIsComboBox->setEnabled(true);
-		for (const QString& pageName : pageNames)
-			layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(pageName));
-		int firstPageIndex = i < 0 ? pageSet.FirstPage : i;
-		firstPageIndex = qMax(0, qMin(firstPageIndex, pageSet.pageNames.count() - 1));
-		layoutFirstPageIsComboBox->setCurrentIndex(firstPageIndex);
-	}
-	else
-	{
-		layoutFirstPageIsComboBox->addItem(" ");
-		layoutFirstPageIsComboBox->setCurrentIndex(0);
-		layoutFirstPageIsComboBox->setEnabled(false);
-	}
-}
-
-void Prefs_DocumentSetup::setupPageSizes(struct ApplicationPrefs *prefsData)
-{
-	PageSize ps(prefsData->docSetupPrefs.pageSize);
-	QStringList insertList(ps.activeSizeList());
-	QStringList insertTrList(ps.activeSizeTRList());
-
-	prefsPageSizeName = prefsData->docSetupPrefs.pageSize;
-	if (prefsPageSizeName == CommonStrings::trCustomPageSize)
-		prefsPageSizeName = CommonStrings::customPageSize;
-	if ((prefsPageSizeName != CommonStrings::customPageSize) &&
-		(prefsPageSizeName != CommonStrings::trCustomPageSize) &&
-		(insertList.indexOf(prefsPageSizeName) == -1))
-	{
-		insertList << prefsPageSizeName;
-		insertTrList << prefsPageSizeName;
-	}
-
-	QMap<QString, QString> insertMap;
-	for (int i = 0; i < insertTrList.count(); ++i)
-	{
-		const QString& key = insertTrList.at(i);
-		insertMap[key] = insertList.at(i);
-	}
-	insertTrList.sort();
-
-	pageSizeComboBox->clear();
-	for (int i = 0; i < insertList.count(); ++i)
-	{
-		const QString& key = insertTrList.at(i);
-		pageSizeComboBox->addItem(key, insertMap[key]);
-	}
-	pageSizeComboBox->addItem(CommonStrings::trCustomPageSize, CommonStrings::customPageSize);
-
-	QString pageSizeName = CommonStrings::trCustomPageSize;
-	int index = pageSizeComboBox->findData(prefsPageSizeName);
-	if (index >= 0)
-		pageSizeName = pageSizeComboBox->itemText(index);
-	setCurrentComboItem(pageSizeComboBox, pageSizeName);
-	marginsWidget->setPageSize(prefsPageSizeName);
-	bleedsWidget->setPageSize(prefsPageSizeName);
-}
-
-void Prefs_DocumentSetup::pageLayoutChanged(int i)
-{
-	setupPageSets();
-	marginsWidget->setFacingPages(!(i == singlePage));
-	//layoutFirstPageIsComboBox->setCurrentIndex(pageSets[pageLayoutButtonGroup->checkedId()].FirstPage);
-}
-
-void Prefs_DocumentSetup::setPageWidth(double w)
-{
-	pageW = pageWidthSpinBox->value() / unitRatio;
-	marginsWidget->setPageWidth(pageW);
-	QString psText=pageSizeComboBox->currentText();
-	if (psText!=CommonStrings::trCustomPageSize && psText!=CommonStrings::customPageSize)
-		pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
-	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
-	if (newOrientation != pageOrientationComboBox->currentIndex())
-	{
-		pageOrientationComboBox->blockSignals(true);
-		pageOrientationComboBox->setCurrentIndex(newOrientation);
-		pageOrientationComboBox->blockSignals(false);
-	}
-}
-
-void Prefs_DocumentSetup::setPageHeight(double h)
-{
-	pageH = pageHeightSpinBox->value() / unitRatio;
-	marginsWidget->setPageHeight(pageH);
-	QString psText=pageSizeComboBox->currentText();
-	if (psText!=CommonStrings::trCustomPageSize && psText!=CommonStrings::customPageSize)
-		pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
-	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
-	if (newOrientation != pageOrientationComboBox->currentIndex())
-	{
-		pageOrientationComboBox->blockSignals(true);
-		pageOrientationComboBox->setCurrentIndex(newOrientation);
-		pageOrientationComboBox->blockSignals(false);
-	}
-}
-
-void Prefs_DocumentSetup::setPageOrientation(int orientation)
-{
-	setSize(pageSizeComboBox->currentText());
-	pageWidthSpinBox->blockSignals(true);
-	pageHeightSpinBox->blockSignals(true);
-	if ((orientation==0 && pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize) || orientation!=0)
-	{
-		double w = pageWidthSpinBox->value(), h = pageHeightSpinBox->value();
-		pageWidthSpinBox->setValue((orientation == portraitPage) ? qMin(w, h) : qMax(w, h));
-		pageHeightSpinBox->setValue((orientation == portraitPage) ? qMax(w, h) : qMin(w, h));
-	}
-	pageW = pageWidthSpinBox->value() / unitRatio;
-	pageH = pageHeightSpinBox->value() / unitRatio;
-	pageWidthSpinBox->blockSignals(false);
-	pageHeightSpinBox->blockSignals(false);
-}
-
-void Prefs_DocumentSetup::setPageSize()
-{
-	setPageOrientation(pageOrientationComboBox->currentIndex());
-}
-
-void Prefs_DocumentSetup::setSize(const QString &newSize)
-{
-	pageW = pageWidthSpinBox->value() / unitRatio;
-	pageH = pageHeightSpinBox->value() / unitRatio;
-	PageSize *ps2=new PageSize(newSize);
-
-	prefsPageSizeName=ps2->name();
-	if (newSize != CommonStrings::trCustomPageSize)
-	{
-		pageW = ps2->width();
-		pageH = ps2->height();
-	}
-	else
-		prefsPageSizeName = CommonStrings::customPageSize;
-	pageWidthSpinBox->blockSignals(true);
-	pageHeightSpinBox->blockSignals(true);
-	pageWidthSpinBox->setValue(pageW * unitRatio);
-	pageHeightSpinBox->setValue(pageH * unitRatio);
-	marginsWidget->setPageHeight(pageH);
-	marginsWidget->setPageWidth(pageW);
-	marginsWidget->setPageSize(newSize);
-	pageWidthSpinBox->blockSignals(false);
-	pageHeightSpinBox->blockSignals(false);
-	delete ps2;
-}
-
-void Prefs_DocumentSetup::slotUndo(bool isEnabled)
-{
-	undoLengthSpinBox->setEnabled(isEnabled);
-}
-
-void Prefs_DocumentSetup::getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins)
-{
-	resizePages=applySizesToAllPagesCheckBox->isChecked();
-	resizeMasterPages=applySizesToAllMasterPagesCheckBox->isChecked();
-	resizePageMargins=applyMarginsToAllPagesCheckBox->isChecked();
-	resizeMasterPageMargins=applyMarginsToAllMasterPagesCheckBox->isChecked();
-}
-
-void Prefs_DocumentSetup::changeAutoDocDir()
-{
-	QString s = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), autosaveDirEdit->text());
-	if (!s.isEmpty())
-		autosaveDirEdit->setText( QDir::toNativeSeparators(s) );
-}
-
-void Prefs_DocumentSetup::emitSectionChange()
-{
-	emit changeToOtherSection("Prefs_PageSizes");
-}
+	applyMarginsToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing master pages in the document" ) + "</qt>" );
+	autosaveCountSpinBox->setToolTip("<qt>" + tr("Keep this many files during the editing session. Backup files will be removed when you close the document.") + "</qt>");
+}
+
+void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
+{
+	pageWidthSpinBox->blockSignals(true);
+	pageHeightSpinBox->blockSignals(true);
+	pageOrientationComboBox->blockSignals(true);
+	pageSizeComboBox->blockSignals(true);
+
+	setCurrentComboItem(languageComboBox, LanguageManager::instance()->getLangFromAbbrev(prefsData->docSetupPrefs.language, true));
+
+	unitRatio = unitGetRatioFromIndex(prefsData->docSetupPrefs.docUnitIndex);
+	setupPageSizes(prefsData);
+
+	pageOrientationComboBox->setCurrentIndex(prefsData->docSetupPrefs.pageOrientation);
+	pageUnitsComboBox->setCurrentIndex(prefsData->docSetupPrefs.docUnitIndex);
+	pageW = prefsData->docSetupPrefs.pageWidth;
+	pageH = prefsData->docSetupPrefs.pageHeight;
+	pageWidthSpinBox->setValue(pageW * unitRatio);
+	pageHeightSpinBox->setValue(pageH * unitRatio);
+	pageSets=prefsData->pageSets;
+	if (prefsData->docSetupPrefs.pagePositioning < 2)
+	{
+		threeFoldRadioButton->hide();
+		fourFoldRadioButton->hide();
+	}
+	switch (prefsData->docSetupPrefs.pagePositioning)
+	{
+		case 0:
+			singlePageRadioButton->setChecked(true);
+			break;
+		case 1:
+			facingPagesRadioButton->setChecked(true);
+			break;
+		case 2:
+			threeFoldRadioButton->setChecked(true);
+			break;
+		case 3:
+			fourFoldRadioButton->setChecked(true);
+			break;
+	}
+	setupPageSets();
+
+	layoutFirstPageIsComboBox->setCurrentIndex(prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage);
+
+	pageWidthSpinBox->blockSignals(false);
+	pageHeightSpinBox->blockSignals(false);
+	pageOrientationComboBox->blockSignals(false);
+	pageSizeComboBox->blockSignals(false);
+
+	marginsWidget->setup(prefsData->docSetupPrefs.margins, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::MarginWidgetFlags);
+	marginsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+	marginsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+//	marginsWidget->setPageSize(prefsPageSizeName);
+	marginsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
+	bleedsWidget->setup(prefsData->docSetupPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
+	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+//	bleedsWidget->setPageSize(prefsPageSizeName);
+	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
+	saveCompressedCheckBox->setChecked(prefsData->docSetupPrefs.saveCompressed);
+	emergencyCheckBox->setChecked(prefsData->miscPrefs.saveEmergencyFile);
+	autosaveCheckBox->setChecked( prefsData->docSetupPrefs.AutoSave );
+	autosaveIntervalSpinBox->setValue(prefsData->docSetupPrefs.AutoSaveTime / 1000 / 60);
+	autosaveCountSpinBox->setValue(prefsData->docSetupPrefs.AutoSaveCount);
+	autosaveKeepCheckBox->setChecked(prefsData->docSetupPrefs.AutoSaveKeep);
+	autosaveDocRadio->setChecked(prefsData->docSetupPrefs.AutoSaveLocation);
+	autosaveDirRadio->setChecked(!prefsData->docSetupPrefs.AutoSaveLocation);
+	autosaveDirEdit->setText(prefsData->docSetupPrefs.AutoSaveDir);
+	autosaveDirEdit->setEnabled(!prefsData->docSetupPrefs.AutoSaveLocation);
+	changeAutoDir->setEnabled(!prefsData->docSetupPrefs.AutoSaveLocation);
+	showAutosaveClockOnCanvasCheckBox->setChecked(prefsData->displayPrefs.showAutosaveClockOnCanvas);
+	undoCheckBox->setChecked(PrefsManager::instance().prefsFile->getContext("undo")->getBool("enabled", true));
+	int undoLength = UndoManager::instance()->getHistoryLength();
+	if (undoLength == -1)
+		undoLengthSpinBox->setEnabled(false);
+	else
+		undoLengthSpinBox->setValue(undoLength);
+	unitChange();
+}
+
+void Prefs_DocumentSetup::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
+{
+	prefsData->docSetupPrefs.language = LanguageManager::instance()->getAbbrevFromLang(languageComboBox->currentText(), false);
+	prefsData->docSetupPrefs.pageSize = prefsPageSizeName;
+	prefsData->docSetupPrefs.pageOrientation = pageOrientationComboBox->currentIndex();
+	prefsData->docSetupPrefs.docUnitIndex = pageUnitsComboBox->currentIndex();
+	prefsData->docSetupPrefs.pageWidth = pageW;
+	prefsData->docSetupPrefs.pageHeight = pageH;
+	prefsData->docSetupPrefs.pagePositioning = pageLayoutButtonGroup->checkedId();
+	prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage = layoutFirstPageIsComboBox->currentIndex();
+
+	prefsData->docSetupPrefs.margins = marginsWidget->margins();
+	prefsData->docSetupPrefs.bleeds = bleedsWidget->margins();
+	prefsData->docSetupPrefs.saveCompressed = saveCompressedCheckBox->isChecked();
+	prefsData->miscPrefs.saveEmergencyFile = emergencyCheckBox->isChecked();
+	prefsData->docSetupPrefs.AutoSave=autosaveCheckBox->isChecked();
+	prefsData->docSetupPrefs.AutoSaveTime = autosaveIntervalSpinBox->value() * 1000 * 60;
+	prefsData->docSetupPrefs.AutoSaveCount = autosaveCountSpinBox->value();
+	prefsData->docSetupPrefs.AutoSaveKeep = autosaveKeepCheckBox->isChecked();
+	prefsData->docSetupPrefs.AutoSaveLocation = autosaveDocRadio->isChecked();
+	prefsData->docSetupPrefs.AutoSaveDir = autosaveDirEdit->text();
+	prefsData->displayPrefs.showAutosaveClockOnCanvas=showAutosaveClockOnCanvasCheckBox->isChecked();
+	bool undoActive = undoCheckBox->isChecked();
+	if (!undoActive)
+		UndoManager::instance()->clearStack();
+	UndoManager::instance()->setUndoEnabled(undoActive);
+	UndoManager::instance()->setAllHistoryLengths(undoLengthSpinBox->value());
+	static PrefsContext *undoPrefs = PrefsManager::instance().prefsFile->getContext("undo");
+	undoPrefs->set("enabled", undoActive);
+}
+
+void Prefs_DocumentSetup::setupPageSets()
+{
+	int i = layoutFirstPageIsComboBox->currentIndex();
+	if (!layoutFirstPageIsComboBox->isEnabled())
+		i = -1;
+	int currIndex = pageLayoutButtonGroup->checkedId() < 0 ? 0 :pageLayoutButtonGroup->checkedId();
+	layoutFirstPageIsComboBox->clear();
+	if (currIndex > 0 && currIndex < pageSets.count())
+	{
+		const PageSet& pageSet = pageSets.at(currIndex);
+		const QStringList& pageNames = pageSet.pageNames;
+		layoutFirstPageIsComboBox->setEnabled(true);
+		for (const QString& pageName : pageNames)
+			layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(pageName));
+		int firstPageIndex = i < 0 ? pageSet.FirstPage : i;
+		firstPageIndex = qMax(0, qMin(firstPageIndex, pageSet.pageNames.count() - 1));
+		layoutFirstPageIsComboBox->setCurrentIndex(firstPageIndex);
+	}
+	else
+	{
+		layoutFirstPageIsComboBox->addItem(" ");
+		layoutFirstPageIsComboBox->setCurrentIndex(0);
+		layoutFirstPageIsComboBox->setEnabled(false);
+	}
+}
+
+void Prefs_DocumentSetup::setupPageSizes(struct ApplicationPrefs *prefsData)
+{
+	PageSize ps(prefsData->docSetupPrefs.pageSize);
+	QStringList insertList(ps.activeSizeList());
+	QStringList insertTrList(ps.activeSizeTRList());
+
+	prefsPageSizeName = prefsData->docSetupPrefs.pageSize;
+	if (prefsPageSizeName == CommonStrings::trCustomPageSize)
+		prefsPageSizeName = CommonStrings::customPageSize;
+	if ((prefsPageSizeName != CommonStrings::customPageSize) &&
+		(prefsPageSizeName != CommonStrings::trCustomPageSize) &&
+		(insertList.indexOf(prefsPageSizeName) == -1))
+	{
+		insertList << prefsPageSizeName;
+		insertTrList << prefsPageSizeName;
+	}
+
+	QMap<QString, QString> insertMap;
+	for (int i = 0; i < insertTrList.count(); ++i)
+	{
+		const QString& key = insertTrList.at(i);
+		insertMap[key] = insertList.at(i);
+	}
+	insertTrList.sort();
+
+	pageSizeComboBox->clear();
+	for (int i = 0; i < insertList.count(); ++i)
+	{
+		const QString& key = insertTrList.at(i);
+		pageSizeComboBox->addItem(key, insertMap[key]);
+	}
+	pageSizeComboBox->addItem(CommonStrings::trCustomPageSize, CommonStrings::customPageSize);
+
+	QString pageSizeName = CommonStrings::trCustomPageSize;
+	int index = pageSizeComboBox->findData(prefsPageSizeName);
+	if (index >= 0)
+		pageSizeName = pageSizeComboBox->itemText(index);
+	setCurrentComboItem(pageSizeComboBox, pageSizeName);
+	marginsWidget->setPageSize(prefsPageSizeName);
+	bleedsWidget->setPageSize(prefsPageSizeName);
+}
+
+void Prefs_DocumentSetup::pageLayoutChanged(int i)
+{
+	setupPageSets();
+	marginsWidget->setFacingPages(i != singlePage);
+	//layoutFirstPageIsComboBox->setCurrentIndex(pageSets[pageLayoutButtonGroup->checkedId()].FirstPage);
+}
+
+void Prefs_DocumentSetup::setPageWidth(double w)
+{
+	pageW = pageWidthSpinBox->value() / unitRatio;
+	marginsWidget->setPageWidth(pageW);
+	QString psText=pageSizeComboBox->currentText();
+	if (psText!=CommonStrings::trCustomPageSize && psText!=CommonStrings::customPageSize)
+		pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
+	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
+	if (newOrientation != pageOrientationComboBox->currentIndex())
+	{
+		pageOrientationComboBox->blockSignals(true);
+		pageOrientationComboBox->setCurrentIndex(newOrientation);
+		pageOrientationComboBox->blockSignals(false);
+	}
+}
+
+void Prefs_DocumentSetup::setPageHeight(double h)
+{
+	pageH = pageHeightSpinBox->value() / unitRatio;
+	marginsWidget->setPageHeight(pageH);
+	QString psText=pageSizeComboBox->currentText();
+	if (psText!=CommonStrings::trCustomPageSize && psText!=CommonStrings::customPageSize)
+		pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
+	int newOrientation = (pageWidthSpinBox->value() > pageHeightSpinBox->value()) ? landscapePage : portraitPage;
+	if (newOrientation != pageOrientationComboBox->currentIndex())
+	{
+		pageOrientationComboBox->blockSignals(true);
+		pageOrientationComboBox->setCurrentIndex(newOrientation);
+		pageOrientationComboBox->blockSignals(false);
+	}
+}
+
+void Prefs_DocumentSetup::setPageOrientation(int orientation)
+{
+	setSize(pageSizeComboBox->currentText());
+	pageWidthSpinBox->blockSignals(true);
+	pageHeightSpinBox->blockSignals(true);
+	if ((orientation==0 && pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize) || orientation!=0)
+	{
+		double w = pageWidthSpinBox->value(), h = pageHeightSpinBox->value();
+		pageWidthSpinBox->setValue((orientation == portraitPage) ? qMin(w, h) : qMax(w, h));
+		pageHeightSpinBox->setValue((orientation == portraitPage) ? qMax(w, h) : qMin(w, h));
+	}
+	pageW = pageWidthSpinBox->value() / unitRatio;
+	pageH = pageHeightSpinBox->value() / unitRatio;
+	pageWidthSpinBox->blockSignals(false);
+	pageHeightSpinBox->blockSignals(false);
+}
+
+void Prefs_DocumentSetup::setPageSize()
+{
+	setPageOrientation(pageOrientationComboBox->currentIndex());
+}
+
+void Prefs_DocumentSetup::setSize(const QString &newSize)
+{
+	pageW = pageWidthSpinBox->value() / unitRatio;
+	pageH = pageHeightSpinBox->value() / unitRatio;
+
+	PageSize ps2(newSize);
+	prefsPageSizeName = ps2.name();
+	if (newSize != CommonStrings::trCustomPageSize)
+	{
+		pageW = ps2.width();
+		pageH = ps2.height();
+	}
+	else
+		prefsPageSizeName = CommonStrings::customPageSize;
+
+	pageWidthSpinBox->blockSignals(true);
+	pageHeightSpinBox->blockSignals(true);
+	pageWidthSpinBox->setValue(pageW * unitRatio);
+	pageHeightSpinBox->setValue(pageH * unitRatio);
+	marginsWidget->setPageHeight(pageH);
+	marginsWidget->setPageWidth(pageW);
+	marginsWidget->setPageSize(newSize);
+	pageWidthSpinBox->blockSignals(false);
+	pageHeightSpinBox->blockSignals(false);
+}
+
+void Prefs_DocumentSetup::slotUndo(bool isEnabled)
+{
+	undoLengthSpinBox->setEnabled(isEnabled);
+}
+
+void Prefs_DocumentSetup::getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins)
+{
+	resizePages=applySizesToAllPagesCheckBox->isChecked();
+	resizeMasterPages=applySizesToAllMasterPagesCheckBox->isChecked();
+	resizePageMargins=applyMarginsToAllPagesCheckBox->isChecked();
+	resizeMasterPageMargins=applyMarginsToAllMasterPagesCheckBox->isChecked();
+}
+
+void Prefs_DocumentSetup::changeAutoDocDir()
+{
+	QString s = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), autosaveDirEdit->text());
+	if (!s.isEmpty())
+		autosaveDirEdit->setText( QDir::toNativeSeparators(s) );
+}
+
+void Prefs_DocumentSetup::emitSectionChange()
+{
+	emit changeToOtherSection("Prefs_PageSizes");
+}

Modified: trunk/Scribus/scribus/ui/prefs_documentsetup.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_documentsetup.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsetup.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentsetup.h	Mon Oct 25 19:37:48 2021
@@ -21,7 +21,7 @@
 
 	public:
 		Prefs_DocumentSetup(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_DocumentSetup();
+		~Prefs_DocumentSetup() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
@@ -61,11 +61,11 @@
 
 	protected:
 		void setupPageSets();
-		ScribusDoc* m_doc;
+		ScribusDoc* m_doc { nullptr };
 
-		double unitRatio;
-		double pageW;
-		double pageH;
+		double unitRatio { 1.0 };
+		double pageW { 1.0 };
+		double pageH { 1.0 };
 		QString prefsPageSizeName;
 		QList<PageSet> pageSets;
 

Modified: trunk/Scribus/scribus/ui/prefs_externaltools.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_externaltools.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_externaltools.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_externaltools.cpp	Mon Oct 25 19:37:48 2021
@@ -20,7 +20,7 @@
 
 #include "prefs_externaltools.h"
 
-Prefs_ExternalTools::Prefs_ExternalTools(QWidget* parent, ScribusDoc* doc)
+Prefs_ExternalTools::Prefs_ExternalTools(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -41,15 +41,11 @@
 	connect(latexConfigDeleteButton, SIGNAL(clicked()), this, SLOT(deleteConfig()));
 	connect(latexEditorChangeButton, SIGNAL(clicked()), this, SLOT(changeLatexEditor()));
 	connect(latexConfigChangeCommandButton, SIGNAL(clicked()), this, SLOT(changeLatexPath()));
-
-}
-
-Prefs_ExternalTools::~Prefs_ExternalTools()
-{
 }
 
 void Prefs_ExternalTools::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_ExternalTools::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -192,46 +188,44 @@
 	}
 
 	//Scan for render frame render applications
-	for (int i=0; i < latexConfigsListWidget->count(); i++)
+	for (int i = 0; i < latexConfigsListWidget->count(); i++)
 	{
 		QString config(latexConfigsListWidget->item(i)->data(Qt::UserRole).toString());
+		if (config != "100_latex.xml")
+			continue;
+
 		QString oldCommand = commands[config];
-		if (config=="100_latex.xml")
-		{
-			if (!fileInPath(oldCommand))
-			{
-				QStringList pdflatexPaths;
+		if (fileInPath(oldCommand))
+			continue;
+
+		QStringList pdflatexPaths;
 #ifdef Q_OS_MAC
-				pdflatexPaths	<<"/opt/local/bin/pdflatex"
-								<<"/sw/bin/pdflatex"
-								<<"/usr/local/texlive/2009/bin/universal-darwin/pdflatex"
-								<<"/usr/local/texlive/2008/bin/universal-darwin/pdflatex";
+		pdflatexPaths	<<"/opt/local/bin/pdflatex"
+						<<"/sw/bin/pdflatex"
+						<<"/usr/local/texlive/2009/bin/universal-darwin/pdflatex"
+						<<"/usr/local/texlive/2008/bin/universal-darwin/pdflatex";
 #endif
 #ifdef Q_OS_LINUX
-				pdflatexPaths	<<"/usr/local/bin/pdflatex"
-								<<"/usr/bin/pdflatex";
+		pdflatexPaths	<<"/usr/local/bin/pdflatex"
+						<<"/usr/bin/pdflatex";
 #endif
-				QString parms(" --interaction nonstopmode");
-				for (int i = 0; i < pdflatexPaths.size(); ++i) //do nothing when we have no paths.. need some more from other OSes
-				{
-					QString cmd(pdflatexPaths.at(i));
-					QFileInfo fInfo(cmd);
-					if (fInfo.exists())
-					{
-						cmd.append(parms);
-						int ret = ScMessageBox::question(this, tr("LaTeX Command"),
-								tr("Scribus has found the following pdflatex command:\n%1\nDo you want to use this?").arg(cmd),
-								QMessageBox::Yes|QMessageBox::No,
-								QMessageBox::No,	// GUI default
-								QMessageBox::Yes);	// batch default
-						if (ret==QMessageBox::Yes)
-						{
-							commands[config]=cmd;
-							setConfigItemText(latexConfigsListWidget->item(i));
-						}
-					}
-				}
-			}
+		QString parms(" --interaction nonstopmode");
+		for (int i = 0; i < pdflatexPaths.size(); ++i) //do nothing when we have no paths.. need some more from other OSes
+		{
+			QString cmd(pdflatexPaths.at(i));
+			QFileInfo fInfo(cmd);
+			if (!fInfo.exists())
+				continue;
+			cmd.append(parms);
+			int ret = ScMessageBox::question(this, tr("LaTeX Command"),
+					tr("Scribus has found the following pdflatex command:\n%1\nDo you want to use this?").arg(cmd),
+					QMessageBox::Yes|QMessageBox::No,
+					QMessageBox::No,	// GUI default
+					QMessageBox::Yes);	// batch default
+			if (ret != QMessageBox::Yes)
+				continue;
+			commands[config] = cmd;
+			setConfigItemText(latexConfigsListWidget->item(i));
 		}
 	}
 }

Modified: trunk/Scribus/scribus/ui/prefs_externaltools.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_externaltools.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_externaltools.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_externaltools.h	Mon Oct 25 19:37:48 2021
@@ -19,7 +19,7 @@
 
 	public:
 		Prefs_ExternalTools(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_ExternalTools();
+		~Prefs_ExternalTools() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
@@ -30,6 +30,7 @@
 	protected:
 		void insertConfigItem(const QString& config, int row = -1);
 		void setConfigItemText(QListWidgetItem *item);
+
 		QMap<QString, QString> commands;
 
 	protected slots:

Modified: trunk/Scribus/scribus/ui/prefs_fonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_fonts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_fonts.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_fonts.cpp	Mon Oct 25 19:37:48 2021
@@ -47,9 +47,6 @@
 	m_icon = "16/preferences-desktop-font.png";
 
 	RList = PrefsManager::instance().appPrefs.fontPrefs.GFontSub;
-	UsedFonts.clear();
-	CurrentPath = "";
-	m_askBeforeSubstitute = true;
 
 	setMinimumSize(fontMetrics().horizontalAdvance( tr( "Available Fonts" )+ tr( "Font Substitutions" )+ tr( "Additional Paths" )+ tr( "Rejected Fonts" ))+180, 200);
 
@@ -118,95 +115,33 @@
 //fontSubstitutionsTableWidget
 }
 
-Prefs_Fonts::~Prefs_Fonts()
-{
-}
-
 void Prefs_Fonts::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_Fonts::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
-	// 	SCFonts* availFonts=&(PrefsManager::instance().appPrefs.AvailFonts);
 	m_availFonts = prefsData->fontPrefs.AvailFonts;
 	fontListTableView->setFonts(m_availFonts);
-	/*
-	DON'T REMOVE THIS COMMENTS, PLEASE! (Petr)
-	It's just a performance vs. functionality test.
-	availFonts->clear();
-	// FIXME: This is main performance issue. It's about 90% of all preference reads! - PV
-	availFonts->getFonts(HomeP); */
-	/* Are you wondering why this condition? See the comment at
-	line #102 (or somewhere near) as reference. Hint: PathList
-	is not initialized for example... - PV */
-/*	if (!DocAvail && !ScCore->primaryMainWindow()->HaveDoc)
-	{
-		for (uint a = 0; a < PathList->count(); ++a)
-		{
-			QString dir = ScPaths::separatorsToSlashes(PathList->text(a));
-			availFonts->addScalableFonts(dir +"/"); //, docc->DocName);
-			availFonts->updateFontMap();
-		}
-	} */
-// 	UsedFonts.clear();
-// 	fontFlags.clear();
-// 	fontList->clear();
-// 	SCFontsIterator it(*availFonts);
-// 	for ( ; it.hasNext(); it.next())
-// 	{
-// 		if (it.current().isNone())
-// 			continue;
-// 		fontSet foS;
-// 		QTreeWidgetItem *row = new QTreeWidgetItem(fontList);
-// 		row->setText(0, it.currentKey());
-
-// 		foS.FlagUse = it.current().usable();
-// 		row->setIcon(1, foS.FlagUse ? checkOn : checkOff);
-// 		if (foS.FlagUse)
-// 			UsedFonts.append(it.currentKey());
-
-// 		foS.FlagPS = it.current().embedPs();
-// 		row->setIcon(2, foS.FlagPS ? checkOn : checkOff);
-
-// 		foS.FlagSub = it.current().subset();
-// 		row->setIcon(3, foS.FlagSub ? checkOn : checkOff);
-
-// 		ScFace::FontType type = it.current().type();
-// 		foS.FlagOTF = (type == ScFace::OTF) ? true : false;
-// 		if (it.current().isReplacement())
-// 			row->setIcon(0, substFont);
-// 		else if (type == ScFace::TYPE1)
-// 			row->setIcon(0, psFont);
-// 		else if (type == ScFace::TTF)
-// 			row->setIcon(0, ttfFont);
-// 		else if (type == ScFace::OTF)
-// 			row->setIcon(0, otfFont);
-
-// 		foS.FlagNames = it.current().hasNames();
-// 		row->setText(4, it.current().fontPath());
-// 		fontFlags.insert(it.currentKey(), foS);
-// 	}
-// 	fontList->sortByColumn(0, Qt::AscendingOrder);
-// 	fontList->resizeColumnToContents(0);
-// 	fontList->resizeColumnToContents(4);
-// 	UsedFonts.sort();
+
 	FlagsRepl.clear();
 	fontSubstitutionsTableWidget->clearContents();
 	m_GFontSub = prefsData->fontPrefs.GFontSub;
-	int a = 0;
+
+	int i = 0;
 	for (auto itfsu = RList.begin(); itfsu != RList.end(); ++itfsu)
 	{
 		QTableWidgetItem* tWidgetItem = new QTableWidgetItem(itfsu.key());
 		tWidgetItem->setFlags(tWidgetItem->flags() & ~Qt::ItemIsEditable);
-		fontSubstitutionsTableWidget->setItem(a, 0, tWidgetItem);
+		fontSubstitutionsTableWidget->setItem(i, 0, tWidgetItem);
 		auto item = new QComboBox(fontSubstitutionsTableWidget);
-		fontSubstitutionsTableWidget->setCellWidget(a, 1, item);
+		fontSubstitutionsTableWidget->setCellWidget(i, 1, item);
 		item->setEditable(false);
 		item->addItem(itfsu.value());
 		setCurrentComboItem(item, itfsu.value());
 		FlagsRepl.append(item);
-		a++;
+		i++;
 	}
 	deleteSubstitutionButton->setEnabled(false);
 
@@ -254,21 +189,22 @@
 
 void Prefs_Fonts::updateFontList()
 {
-	UsedFonts.clear();
+	m_usedFonts.clear();
 	SCFontsIterator it(m_availFonts);
 	for ( ; it.hasNext() ; it.next())
 	{
 		if (m_availFonts[it.currentKey()].usable())
-			UsedFonts.append(it.currentKey());
-	}
-	UsedFonts.sort();
+			m_usedFonts.append(it.currentKey());
+	}
+	m_usedFonts.sort();
+
 	QString tmp;
 	for (int b = 0; b < FlagsRepl.count(); ++b)
 	{
 		tmp = FlagsRepl.at(b)->currentText();
 		FlagsRepl.at(b)->clear();
-		FlagsRepl.at(b)->addItems(UsedFonts);
-		if (UsedFonts.contains(tmp) != 0)
+		FlagsRepl.at(b)->addItems(m_usedFonts);
+		if (m_usedFonts.contains(tmp) != 0)
 			setCurrentComboItem(FlagsRepl.at(b), tmp);
 		else
 			FlagsRepl.at(b)->setCurrentIndex(0);
@@ -340,15 +276,15 @@
 		changeButton->setEnabled(true);
 		removeButton->setEnabled(true);
 	}
-	CurrentPath = c->text();
+	m_currentPath = c->text();
 }
 
 void Prefs_Fonts::AddPath()
 {
 	Q_ASSERT(m_doc==nullptr); // should never be called in doc-specific prefs
 	PrefsContext* dirs = PrefsManager::instance().prefsFile->getContext("dirs");
-	CurrentPath = dirs->get("fontprefs", ".");
-	QString s = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), CurrentPath);
+	m_currentPath = dirs->get("fontprefs", ".");
+	QString s = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), m_currentPath);
 	if (s.isEmpty())
 		return;
 
@@ -362,7 +298,7 @@
 	//writePaths();
 	changeButton->setEnabled(false);
 	removeButton->setEnabled(false);
-	CurrentPath = s;
+	m_currentPath = s;
 	QString dir(QDir::fromNativeSeparators(s2));
 	m_availFonts.addScalableFonts(dir +"/");
 	m_availFonts.updateFontMap();
@@ -375,7 +311,7 @@
 void Prefs_Fonts::ChangePath()
 {
 	Q_ASSERT(m_doc==nullptr); // should never be called in doc-specific prefs
-	QString s = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), CurrentPath);
+	QString s = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), m_currentPath);
 	if (s.isEmpty())
 		return;
 
@@ -396,7 +332,7 @@
 	}
 	pathListWidget->currentItem()->setText(s2);
 	//writePaths();
-	CurrentPath = s;
+	m_currentPath = s;
 	QString dir = QDir::fromNativeSeparators(s2);
 	m_availFonts.addScalableFonts(dir +"/");
 	m_availFonts.updateFontMap();
@@ -409,7 +345,7 @@
 void Prefs_Fonts::DelPath()
 {
 	Q_ASSERT(m_doc==nullptr); // should never be called in doc-specific prefs
-	QFile fx(PrefsManager::instance().preferencesLocation()+"/scribusfont13.rc");
+	QFile fx(PrefsManager::instance().preferencesLocation() + "/scribusfont13.rc");
 	if (!fx.open(QIODevice::WriteOnly))
 		return;
 
@@ -431,7 +367,7 @@
 			m_availFonts.remove(it.key());
 	}
 	m_availFonts.updateFontMap();
-	CurrentPath = "";
+	m_currentPath.clear();
 	updateFontList();
 	changeButton->setEnabled(false);
 	removeButton->setEnabled(false);

Modified: trunk/Scribus/scribus/ui/prefs_fonts.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_fonts.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_fonts.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_fonts.h	Mon Oct 25 19:37:48 2021
@@ -24,7 +24,7 @@
 
 	public:
 		Prefs_Fonts(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_Fonts();
+		~Prefs_Fonts() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
@@ -46,15 +46,15 @@
 		void updateFontList();
 		void updateRejectedFontList();
 
-		QMap<QString,QString> RList;
+		QMap<QString, QString> RList;
 		QList<QComboBox*> FlagsRepl;
 		//! List of font names of allowed fonts for substitutions
-		QStringList UsedFonts;
-		QString CurrentPath;
-		ScribusDoc* m_doc;
+		QStringList m_usedFonts;
+		QString m_currentPath;
+		ScribusDoc* m_doc { nullptr };
 
 		SCFonts m_availFonts; //! Fonts that Scribus has available to it, or the current document has available to use
-		bool m_askBeforeSubstitute; //! Request that the user confirms a font substitution or not
+		bool m_askBeforeSubstitute { true }; //! Request that the user confirms a font substitution or not
 		QMap<QString,QString> m_GFontSub;
 };
 

Modified: trunk/Scribus/scribus/ui/prefs_hyphenator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_hyphenator.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_hyphenator.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_hyphenator.cpp	Mon Oct 25 19:37:48 2021
@@ -24,7 +24,7 @@
 #include "util.h"
 #include "util_file.h"
 
-Prefs_Hyphenator::Prefs_Hyphenator(QWidget* parent, ScribusDoc* doc)
+Prefs_Hyphenator::Prefs_Hyphenator(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -51,10 +51,9 @@
 	connect(exceptionListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(enableExceptButtons()));
 }
 
-Prefs_Hyphenator::~Prefs_Hyphenator() = default;
-
 void Prefs_Hyphenator::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_Hyphenator::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -89,7 +88,7 @@
 {
 	bool ok;
 	QString text = QInputDialog::getText(this, tr("Ignore List"), tr("Add a new Entry"), QLineEdit::Normal, "", &ok);
-	if ((ok) && (!text.isEmpty()))
+	if (ok && !text.isEmpty())
 	{
 		if (ignoreListWidget->findItems(text, Qt::MatchExactly).count() == 0)
 			ignoreListWidget->addItem(text);
@@ -101,7 +100,7 @@
 {
 	bool ok;
 	QString text = QInputDialog::getText(this, tr("Ignore List"), tr("Edit Entry"), QLineEdit::Normal, ignoreListWidget->currentItem()->text(), &ok);
-	if ((ok) && (!text.isEmpty()))
+	if (ok && !text.isEmpty())
 	{
 		if (ignoreListWidget->findItems(text, Qt::MatchExactly).count() == 0)
 			ignoreListWidget->currentItem()->setText(text);
@@ -130,7 +129,7 @@
 {
 	bool ok;
 	QString text = QInputDialog::getText(this, tr("Exception List"), tr("Add a new Entry"), QLineEdit::Normal, "", &ok);
-	if ((ok) && (!text.isEmpty()))
+	if (ok && !text.isEmpty())
 	{
 		if (exceptionListWidget->findItems(text, Qt::MatchExactly).count() == 0)
 			exceptionListWidget->addItem(text);
@@ -142,7 +141,7 @@
 {
 	bool ok;
 	QString text = QInputDialog::getText(this, tr("Exception List"), tr("Edit Entry"), QLineEdit::Normal, exceptionListWidget->currentItem()->text(), &ok);
-	if ((ok) && (!text.isEmpty()))
+	if (ok && !text.isEmpty())
 	{
 		if (exceptionListWidget->findItems(text, Qt::MatchExactly).count() == 0)
 			exceptionListWidget->currentItem()->setText(text);

Modified: trunk/Scribus/scribus/ui/prefs_hyphenator.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_hyphenator.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_hyphenator.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_hyphenator.h	Mon Oct 25 19:37:48 2021
@@ -21,7 +21,7 @@
 
 	public:
 		Prefs_Hyphenator(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_Hyphenator();
+		~Prefs_Hyphenator() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
@@ -43,6 +43,7 @@
 		QString affixFileName(QStringList files);
 		QString dictFileName(QStringList files);
 		void setAvailDictsXMLFile(QString availDictsXMLDataFile);
+
 		QMap<QString, QString> dictionaryMap;
 		QStringList dictionaryPaths;
 

Modified: trunk/Scribus/scribus/ui/prefs_imagecache.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_imagecache.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_imagecache.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_imagecache.cpp	Mon Oct 25 19:37:48 2021
@@ -12,7 +12,7 @@
 #include "prefsstructs.h"
 #include "scribusdoc.h"
 
-Prefs_ImageCache::Prefs_ImageCache(QWidget* parent, ScribusDoc* doc)
+Prefs_ImageCache::Prefs_ImageCache(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -21,8 +21,6 @@
 	m_caption = tr("Image Cache");
 	m_icon = "16/image-x-generic.png";
 }
-
-Prefs_ImageCache::~Prefs_ImageCache() = default;
 
 void Prefs_ImageCache::languageChange()
 {

Modified: trunk/Scribus/scribus/ui/prefs_imagecache.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_imagecache.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_imagecache.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_imagecache.h	Mon Oct 25 19:37:48 2021
@@ -20,7 +20,7 @@
 
 	public:
 		Prefs_ImageCache(QWidget* parent, ScribusDoc* doc=nullptr);
-		~Prefs_ImageCache();
+		~Prefs_ImageCache() = default;
 
 		void restoreDefaults(struct ApplicationPrefs *prefsData) override;
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;

Modified: trunk/Scribus/scribus/ui/prefs_itemtools.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_itemtools.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_itemtools.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_itemtools.cpp	Mon Oct 25 19:37:48 2021
@@ -17,10 +17,8 @@
 #include "sampleitem.h"
 
 
-Prefs_ItemTools::Prefs_ItemTools(QWidget* parent, ScribusDoc* doc)
-	: Prefs_Pane(parent),
-	m_doc(nullptr),
-	showFontPreview(false)
+Prefs_ItemTools::Prefs_ItemTools(QWidget* parent, ScribusDoc* /*doc*/)
+	: Prefs_Pane(parent)
 {
 	setupUi(this);
 

Modified: trunk/Scribus/scribus/ui/prefs_itemtools.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_itemtools.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_itemtools.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_itemtools.h	Mon Oct 25 19:37:48 2021
@@ -39,8 +39,8 @@
 		void imageScalingTypeChange();
 
 	protected:
-		ScribusDoc* m_doc;
-		bool showFontPreview;
+		ScribusDoc* m_doc { nullptr };
+		bool showFontPreview { false };
 
 };
 

Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp	Mon Oct 25 19:37:48 2021
@@ -27,7 +27,7 @@
 #include "util.h"
 
 
-Prefs_KeyboardShortcuts::Prefs_KeyboardShortcuts(QWidget* parent, ScribusDoc* doc)
+Prefs_KeyboardShortcuts::Prefs_KeyboardShortcuts(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -36,8 +36,8 @@
 	m_caption = tr("Keyboard Shortcuts");
 	m_icon = "16/preferences-desktop-keyboard-shortcuts.png";
 
-	defMenus=ActionManager::defaultMenus();
-	defNonMenuActions=ActionManager::defaultNonMenuActions();
+	defMenus = ActionManager::defaultMenus();
+	defNonMenuActions = ActionManager::defaultNonMenuActions();
 
 	QVector< QPair<QString, QStringList> >::Iterator itnmenua = defNonMenuActions->begin();
 	PluginManager& pluginManager(PluginManager::instance());
@@ -87,6 +87,7 @@
 
 void Prefs_KeyboardShortcuts::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_KeyboardShortcuts::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -143,55 +144,55 @@
 void Prefs_KeyboardShortcuts::importKeySet(const QString& filename)
 {
 	searchTextLineEdit->clear();
-	QFileInfo fi = QFileInfo(filename);
-	if (fi.exists())
-	{
-		//import the file into qdomdoc
-		QDomDocument doc( "keymapentries" );
-		QFile file1( filename );
-		if ( !file1.open( QIODevice::ReadOnly ) )
-			return;
-		QTextStream ts(&file1);
-		ts.setCodec("UTF-8");
-		QString errorMsg;
-		int eline;
-		int ecol;
-		if ( !doc.setContent( ts.readAll(), &errorMsg, &eline, &ecol ))
-		{
-			qDebug("%s", QString("Could not open key set file: %1\nError:%2 at line: %3, row: %4").arg(filename, errorMsg).arg(eline).arg(ecol).toLatin1().constData());
-			file1.close();
-			return;
-		}
+
+	QFileInfo fi(filename);
+	if (!fi.exists())
+		return;
+
+	//import the file into qdomdoc
+	QDomDocument doc( "keymapentries" );
+	QFile file1( filename );
+	if ( !file1.open( QIODevice::ReadOnly ) )
+		return;
+	QTextStream ts(&file1);
+	ts.setCodec("UTF-8");
+	QString errorMsg;
+	int eline;
+	int ecol;
+	if ( !doc.setContent( ts.readAll(), &errorMsg, &eline, &ecol ))
+	{
+		qDebug("%s", QString("Could not open key set file: %1\nError:%2 at line: %3, row: %4").arg(filename, errorMsg).arg(eline).arg(ecol).toLatin1().constData());
 		file1.close();
-		//load the file now
-		QDomElement docElem = doc.documentElement();
-		if (docElem.tagName()=="shortcutset" && docElem.hasAttribute("name"))
-		{
-			QDomAttr keysetAttr = docElem.attributeNode( "name" );
-
-			//clear current menu entries
-			for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
-				it.value().keySequence = QKeySequence();
-
-			//load in new set
-			QDomNode n = docElem.firstChild();
-			while (!n.isNull())
+		return;
+	}
+	file1.close();
+
+	//load the file now
+	QDomElement docElem = doc.documentElement();
+	if (docElem.tagName() == "shortcutset" && docElem.hasAttribute("name"))
+	{
+		QDomAttr keysetAttr = docElem.attributeNode( "name" );
+
+		//clear current menu entries
+		for (QMap<QString,Keys>::Iterator it = keyMap.begin(); it != keyMap.end(); ++it)
+			it.value().keySequence = QKeySequence();
+
+		//load in new set
+		for (QDomNode n = docElem.firstChild(); !n.isNull(); n = n.nextSibling())
+		{
+			QDomElement e = n.toElement();
+			if (e.isNull())
+				continue;
+			if (e.hasAttribute("name") && e.hasAttribute("shortcut"))
 			{
-				QDomElement e = n.toElement(); // try to convert the node to an element.
-				if (!e.isNull())
-				{
-					if (e.hasAttribute("name")  && e.hasAttribute( "shortcut" ))
-					{
-						QDomAttr nameAttr = e.attributeNode( "name" );
-						QDomAttr shortcutAttr = e.attributeNode( "shortcut" );
-						if (keyMap.contains(nameAttr.value()))
-							keyMap[nameAttr.value()].keySequence=QKeySequence(shortcutAttr.value());
-					}
-				}
-				n = n.nextSibling();
+				QDomAttr nameAttr = e.attributeNode("name");
+				QDomAttr shortcutAttr = e.attributeNode("shortcut");
+				if (keyMap.contains(nameAttr.value()))
+					keyMap[nameAttr.value()].keySequence = QKeySequence(shortcutAttr.value());
 			}
 		}
 	}
+
 	insertActions();
 }
 
@@ -311,14 +312,17 @@
 
 void Prefs_KeyboardShortcuts::insertActions()
 {
+	bool first = true;
+	bool firstMenu = true;
+	QTreeWidgetItem* currLVI = nullptr;
+	QTreeWidgetItem* currMenuLVI = nullptr;
+	QTreeWidgetItem* prevLVI = nullptr;
+	QTreeWidgetItem* prevMenuLVI = nullptr;
+
 	lviToActionMap.clear();
 	lviToMenuMap.clear();
 	keyTable->clear();
-	bool first, firstMenu=true;
-	QTreeWidgetItem *currLVI = nullptr;
-	QTreeWidgetItem *currMenuLVI = nullptr;
-	QTreeWidgetItem *prevLVI = nullptr;
-	QTreeWidgetItem *prevMenuLVI = nullptr;
+
 	for (int i = 0; i < defMenus->count(); ++i)
 	{
 		const QPair<QString, QStringList> &actionStrings = defMenus->at(i);
@@ -335,9 +339,9 @@
 		currMenuLVI->setExpanded(true);
 		currMenuLVI->setFlags(Qt::ItemIsEnabled);
 		prevMenuLVI=currMenuLVI;
-		first=true;
-		currLVI=nullptr;
-		prevLVI=nullptr;
+		first = true;
+		currLVI = nullptr;
+		prevLVI = nullptr;
 		for (int j = 0; j < actionStrings.second.count(); ++j)
 		{
 			QString actionName = actionStrings.second.at(j);
@@ -379,10 +383,10 @@
 		currMenuLVI->setText(0, actionStrings.first);
 		currMenuLVI->setExpanded(true);
 		currMenuLVI->setFlags(Qt::ItemIsEnabled);
-		prevMenuLVI=currMenuLVI;
-		first=true;
-		currLVI=nullptr;
-		prevLVI=nullptr;
+		prevMenuLVI = currMenuLVI;
+		first = true;
+		currLVI = nullptr;
+		prevLVI = nullptr;
 		for (int j = 0; j < actionStrings.second.count(); ++j)
 		{
 			QString actionName = actionStrings.second.at(j);
@@ -396,16 +400,16 @@
 				continue;
 			if (first)
 			{
-				currLVI=new QTreeWidgetItem(currMenuLVI);
-				first=false;
+				currLVI = new QTreeWidgetItem(currMenuLVI);
+				first = false;
 			}
 			else
-				currLVI=new QTreeWidgetItem(currMenuLVI, prevLVI);
+				currLVI = new QTreeWidgetItem(currMenuLVI, prevLVI);
 			Q_CHECK_PTR(currLVI);
 			lviToActionMap.insert(currLVI, actionName);
 			currLVI->setText(0, actionKeys.cleanMenuText);
 			currLVI->setText(1, actionKeys.keySequence.toString(QKeySequence::NativeText));
-			prevLVI=currLVI;
+			prevLVI = currLVI;
 		}
 	}
 	keyTable->resizeColumnToContents(0);
@@ -475,94 +479,87 @@
 
 void Prefs_KeyboardShortcuts::keyPressEvent(QKeyEvent *k)
 {
-	if (setKeyButton->isChecked())
-	{
-		switch (k->key())
-		{
-			case Qt::Key_Meta:
-				keyCode |= Qt::META;
-				break;
-			case Qt::Key_Shift:
-				keyCode |= Qt::SHIFT;
-				break;
-			case Qt::Key_Alt:
-				keyCode |= Qt::ALT;
-				break;
-			case Qt::Key_Control:
-				keyCode |= Qt::CTRL;
-				break;
-			default:
-				keyCode |= k->key();
-				keyDisplay->setText(getTrKeyText(keyCode));
-				releaseKeyboard();
-				if (selectedLVI)
+	if (!setKeyButton->isChecked())
+		return;
+
+	switch (k->key())
+	{
+		case Qt::Key_Meta:
+			keyCode |= Qt::META;
+			break;
+		case Qt::Key_Shift:
+			keyCode |= Qt::SHIFT;
+			break;
+		case Qt::Key_Alt:
+			keyCode |= Qt::ALT;
+			break;
+		case Qt::Key_Control:
+			keyCode |= Qt::CTRL;
+			break;
+		default:
+			keyCode |= k->key();
+			keyDisplay->setText(getTrKeyText(keyCode));
+			releaseKeyboard();
+			if (selectedLVI)
+			{
+				QString actionName = lviToActionMap[selectedLVI];
+				if (checkKey(keyCode))
 				{
-					QString actionName = lviToActionMap[selectedLVI];
-					if (checkKey(keyCode))
-					{
-						ScMessageBox::information(this, CommonStrings::trWarning, tr("The %1 key sequence is already in use by \"%2\"").arg(getTrKeyText(keyCode),getAction(keyCode)));
-						selectedLVI->setText(1,keyMap[actionName].keySequence.toString(QKeySequence::NativeText));
-						keyDisplay->setText(keyMap[actionName].keySequence.toString(QKeySequence::NativeText));
-					}
-					else
-					{
-						QKeySequence newKeySequence(keyCode);
-						selectedLVI->setText(1, newKeySequence.toString(QKeySequence::NativeText));
-						keyMap[actionName].keySequence=newKeySequence;
-						userDef->setChecked(true);
-					}
+					ScMessageBox::information(this, CommonStrings::trWarning, tr("The %1 key sequence is already in use by \"%2\"").arg(getTrKeyText(keyCode),getAction(keyCode)));
+					selectedLVI->setText(1,keyMap[actionName].keySequence.toString(QKeySequence::NativeText));
+					keyDisplay->setText(keyMap[actionName].keySequence.toString(QKeySequence::NativeText));
 				}
-				setKeyButton->setChecked(false);
-		}
-	}
+				else
+				{
+					QKeySequence newKeySequence(keyCode);
+					selectedLVI->setText(1, newKeySequence.toString(QKeySequence::NativeText));
+					keyMap[actionName].keySequence=newKeySequence;
+					userDef->setChecked(true);
+				}
+			}
+			setKeyButton->setChecked(false);
+	}
+
 	if (setKeyButton->isChecked())
 		keyDisplay->setText(getTrKeyText(keyCode));
 }
 
 void Prefs_KeyboardShortcuts::keyReleaseEvent(QKeyEvent *k)
 {
-	if (setKeyButton->isChecked())
-	{
-		if (k->key() == Qt::Key_Meta)
-			keyCode &= ~Qt::META;
-		if (k->key() == Qt::Key_Shift)
-			keyCode &= ~Qt::SHIFT;
-		if (k->key() == Qt::Key_Alt)
-			keyCode &= ~Qt::ALT;
-		if (k->key() == Qt::Key_Control)
-			keyCode &= ~Qt::CTRL;
-		keyDisplay->setText(getTrKeyText(keyCode));
-	}
+	if (!setKeyButton->isChecked())
+		return;
+
+	if (k->key() == Qt::Key_Meta)
+		keyCode &= ~Qt::META;
+	if (k->key() == Qt::Key_Shift)
+		keyCode &= ~Qt::SHIFT;
+	if (k->key() == Qt::Key_Alt)
+		keyCode &= ~Qt::ALT;
+	if (k->key() == Qt::Key_Control)
+		keyCode &= ~Qt::CTRL;
+	keyDisplay->setText(getTrKeyText(keyCode));
 }
 
 QString Prefs_KeyboardShortcuts::getAction(int code)
 {
-	QString ret;
-	QKeySequence key = QKeySequence(code);
-	for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
+	QKeySequence key(code);
+	for (QMap<QString,Keys>::Iterator it = keyMap.begin(); it != keyMap.end(); ++it)
 	{
 		if (key.matches(it.value().keySequence) != QKeySequence::NoMatch)
-		{
-			ret = it->cleanMenuText;
-			break;
-		}
-	}
-	return ret;
+			return it->cleanMenuText;
+	}
+	return QString();
 }
 
 bool Prefs_KeyboardShortcuts::checkKey(int code)
 {
-	bool ret = false;
-	QKeySequence key = QKeySequence(code);
-	for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
+	QKeySequence key(code);
+	for (QMap<QString,Keys>::Iterator it = keyMap.begin(); it != keyMap.end(); ++it)
 	{
 		if (key.matches(it.value().keySequence) != QKeySequence::NoMatch)
-		{
-			ret = true;
-			break;
-		}
-	}
-	return ret;
+			return true;
+	}
+	return false;
 }
 
 void Prefs_KeyboardShortcuts::clearSearchString( )

Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h	Mon Oct 25 19:37:48 2021
@@ -50,8 +50,8 @@
 	QList<QTreeWidgetItem*> lviToMenuMap;
 	QVector< QPair<QString, QStringList> >* defMenus;
 	QVector< QPair<QString, QStringList> >* defNonMenuActions;
-	QTreeWidgetItem * selectedLVI;
-	int keyCode;
+	QTreeWidgetItem * selectedLVI { nullptr };
+	int keyCode { 0 };
 
 	void insertActions();
 	void importKeySet(const QString&);

Modified: trunk/Scribus/scribus/ui/prefs_miscellaneous.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_miscellaneous.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_miscellaneous.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_miscellaneous.cpp	Mon Oct 25 19:37:48 2021
@@ -9,7 +9,7 @@
 #include "prefsstructs.h"
 #include "scribusdoc.h"
 
-Prefs_Miscellaneous::Prefs_Miscellaneous(QWidget* parent, ScribusDoc* doc)
+Prefs_Miscellaneous::Prefs_Miscellaneous(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -23,6 +23,7 @@
 
 void Prefs_Miscellaneous::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_Miscellaneous::restoreDefaults(struct ApplicationPrefs *prefsData)

Modified: trunk/Scribus/scribus/ui/prefs_operatortools.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_operatortools.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_operatortools.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_operatortools.cpp	Mon Oct 25 19:37:48 2021
@@ -12,7 +12,7 @@
 
 #include "scribusdoc.h"
 
-Prefs_OperatorTools::Prefs_OperatorTools(QWidget* parent, ScribusDoc* doc)
+Prefs_OperatorTools::Prefs_OperatorTools(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);

Modified: trunk/Scribus/scribus/ui/prefs_pagesizes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_pagesizes.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_pagesizes.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_pagesizes.cpp	Mon Oct 25 19:37:48 2021
@@ -16,7 +16,7 @@
 #include "ui/prefs_pagesizes.h"
 
 
-Prefs_PageSizes::Prefs_PageSizes(QWidget* parent, ScribusDoc* doc)
+Prefs_PageSizes::Prefs_PageSizes(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -35,6 +35,7 @@
 
 void Prefs_PageSizes::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_PageSizes::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -47,7 +48,7 @@
 
 	for (int i = 0; i < activeSizeList.count(); ++i)
 	{
-		QListWidgetItem* lwi=new QListWidgetItem();
+		QListWidgetItem* lwi = new QListWidgetItem();
 		PageSize ps2(activeSizeList.at(i));
 		lwi->setText(ps2.nameTR());
 		lwi->setToolTip(QString("%1 x %2 %3").arg(ps2.originalWidth()).arg(ps2.originalHeight()).arg(ps2.originalUnit()));
@@ -58,7 +59,7 @@
 	{
 		if (!activeSizeList.contains(sizeList.at(i)))
 		{
-			QListWidgetItem* lwi=new QListWidgetItem();
+			QListWidgetItem* lwi = new QListWidgetItem();
 			PageSize ps2(sizeList.at(i));
 			lwi->setText(ps2.nameTR());
 			lwi->setToolTip(QString("%1 x %2 %3").arg(ps2.originalWidth()).arg(ps2.originalHeight()).arg(ps2.originalUnit()));

Modified: trunk/Scribus/scribus/ui/prefs_paths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_paths.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_paths.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_paths.cpp	Mon Oct 25 19:37:48 2021
@@ -12,7 +12,7 @@
 #include "prefsstructs.h"
 #include "scribusdoc.h"
 
-Prefs_Paths::Prefs_Paths(QWidget* parent, ScribusDoc* doc)
+Prefs_Paths::Prefs_Paths(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);

Modified: trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_pdfexport.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_pdfexport.cpp	Mon Oct 25 19:37:48 2021
@@ -4,6 +4,8 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
+
+#include <array>
 
 #include <QStandardItem>
 #include <QAbstractItemView>
@@ -22,9 +24,7 @@
 
 Prefs_PDFExport::Prefs_PDFExport(QWidget* parent, ScribusDoc* doc)
 	: Prefs_Pane(parent),
-	cmsEnabled(false),
-	m_doc(doc),
-	exportingPDF(false)
+	  m_doc(doc)
 {
 	setupUi(this);
 
@@ -119,12 +119,12 @@
 
 Prefs_PDFExport::~Prefs_PDFExport() = default;
 
-PDFOptions::PDFFontEmbedding Prefs_PDFExport::fontEmbeddingMode()
+PDFOptions::PDFFontEmbedding Prefs_PDFExport::fontEmbeddingMode() const
 {
 	return fontEmbeddingCombo->embeddingMode();
 }
 
-QStringList Prefs_PDFExport::fontsToEmbed()
+QStringList Prefs_PDFExport::fontsToEmbed() const
 {
 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
 	if (embeddingMode != PDFOptions::EmbedFonts)
@@ -136,7 +136,7 @@
 	return fonts;
 }
 
-QStringList Prefs_PDFExport::fontsToSubset()
+QStringList Prefs_PDFExport::fontsToSubset() const
 {
 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
 	if (embeddingMode != PDFOptions::EmbedFonts)
@@ -148,7 +148,7 @@
 	return fonts;
 }
 
-QStringList Prefs_PDFExport::fontsToOutline()
+QStringList Prefs_PDFExport::fontsToOutline() const
 {
 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
 	if (embeddingMode != PDFOptions::OutlineFonts)
@@ -249,11 +249,11 @@
 	int j=imageRenderingIntentComboBox->currentIndex();
 	solidColorRenderingIntentComboBox->clear();
 	imageRenderingIntentComboBox->clear();
-	QString tmp_ip[] = { tr("Perceptual"), tr("Relative Colorimetric"), tr("Saturation"), tr("Absolute Colorimetric")};
-	size_t ar_ip = sizeof(tmp_ip) / sizeof(*tmp_ip);
-	for (uint a = 0; a < ar_ip; ++a)
+	
+	std::array<QString, 4> tmp_ip = { tr("Perceptual"), tr("Relative Colorimetric"), tr("Saturation"), tr("Absolute Colorimetric")};
+	for (size_t a = 0; a < tmp_ip.size(); ++a)
 		solidColorRenderingIntentComboBox->addItem(tmp_ip[a]);
-	for (uint a = 0; a < ar_ip; ++a)
+	for (size_t a = 0; a < tmp_ip.size(); ++a)
 		imageRenderingIntentComboBox->addItem(tmp_ip[a]);
 	solidColorRenderingIntentComboBox->setCurrentIndex(i);
 	imageRenderingIntentComboBox->setCurrentIndex(j);
@@ -303,7 +303,7 @@
 	fontEmbeddingCombo->setEmbeddingMode(prefsData->pdfPrefs.FontEmbedding);
 	if (m_doc != nullptr && exportingPDF)
 	{
-		//	Build a list of all Fonts used in Annotations;
+		//	Build a list of all Fonts used in Annotations
 		int pageItOptions = PageItemIterator::IterateInGroups | PageItemIterator::IterateInDocItems | PageItemIterator::IterateInMasterItems | PageItemIterator::IterateInFrameItems;
 		for (PageItemIterator it(m_doc, pageItOptions); *it; ++it)
 		{
@@ -1034,11 +1034,9 @@
 	}
 	if (m_doc != nullptr && exportingPDF)
 	{
-//		EmbedFonts->setChecked(true);
 		EmbedAll();
 		enabledEffectsCheckBox->setChecked(false);
 		enabledEffectsCheckBox->setEnabled(false);
-//		EmbedFonts->setEnabled(false);
 		if (pdfx3InfoStringLineEdit->text().isEmpty())
 			emit noInfo();
 		else
@@ -1202,11 +1200,14 @@
 void Prefs_PDFExport::SetEffOpts(int nr)
 {
 	QStandardItem* si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(2));
-	if (si) si->setSelectable(false);
+	if (si)
+		si->setSelectable(false);
 	si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(3));
-	if (si) si->setSelectable(false);
+	if (si)
+		si->setSelectable(false);
 	si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(4));
-	if (si) si->setSelectable(false);
+	if (si)
+		si->setSelectable(false);
 	switch (nr)
 	{
 	case 0:
@@ -1237,14 +1238,17 @@
 		if (nr == 6)
 		{
 			si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(2));
-			if (si) si->setSelectable(true);
+			if (si)
+				si->setSelectable(true);
 			si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(3));
-			if (si) si->setSelectable(true);
+			if (si)
+				si->setSelectable(true);
 		}
 		else
 		{
 			si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(4));
-			if (si) si->setSelectable(true);
+			if (si)
+				si->setSelectable(true);
 		}
 		break;
 	case 5:

Modified: trunk/Scribus/scribus/ui/prefs_pdfexport.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_pdfexport.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_pdfexport.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_pdfexport.h	Mon Oct 25 19:37:48 2021
@@ -30,10 +30,10 @@
 		void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
 		void enableCMS(bool);
 
-		PDFOptions::PDFFontEmbedding fontEmbeddingMode();
-		QStringList fontsToEmbed();
-		QStringList fontsToSubset();
-		QStringList fontsToOutline();
+		PDFOptions::PDFFontEmbedding fontEmbeddingMode() const;
+		QStringList fontsToEmbed() const;
+		QStringList fontsToSubset() const;
+		QStringList fontsToOutline() const;
 
 	signals:
 		void noInfo();
@@ -80,9 +80,10 @@
 		void enablePDFXWidgets(bool);
 		void addPDFVersions(bool);
 		void enableEffects(bool);
-		bool cmsEnabled;
-		double unitRatio;
-		ScribusDoc* m_doc;
+
+		bool cmsEnabled { false };
+		double unitRatio { 1.0 };
+		ScribusDoc* m_doc { nullptr };
 		QString defaultSolidColorRGBProfile;
 		QString defaultPrinterProfile;
 		PDFOptions Opts;
@@ -90,7 +91,7 @@
 
 		QList<PDFPresentationData> EffVal;
 		SCFonts AllFonts;
-		bool exportingPDF;
+		bool exportingPDF { false };
 		QString SelLPIcolor;
 };
 

Modified: trunk/Scribus/scribus/ui/prefs_plugins.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_plugins.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_plugins.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_plugins.cpp	Mon Oct 25 19:37:48 2021
@@ -18,7 +18,7 @@
 
 #include "commonstrings.h"
 
-Prefs_Plugins::Prefs_Plugins(QWidget* parent, ScribusDoc* doc)
+Prefs_Plugins::Prefs_Plugins(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -39,7 +39,7 @@
 	ScPlugin* plugin;
 	ScActionPlugin* ixplug;
 	QString pName;
-	ScribusMainWindow* scMW=ScCore->primaryMainWindow();
+	ScribusMainWindow* scMW = ScCore->primaryMainWindow();
 	for (int i = 0; i < pluginNames.count(); ++i)
 	{
 		pName = pluginNames.at(i);
@@ -57,7 +57,7 @@
 			Q_ASSERT(ixplug);
 			ScActionPlugin::ActionInfo ai(ixplug->actionInfo());
 			// menu path
-			QString men = "";
+			QString men;
 			if (!ai.parentMenu.isEmpty())
 			{
 				if (scMW->scrMenuMgr->menuExists(ai.parentMenu))
@@ -65,7 +65,7 @@
 			}
 			if (scMW->scrMenuMgr->menuExists(ai.menu))
 			{
-				QMenu *m=scMW->scrMenuMgr->getLocalPopupMenu(ai.menu);
+				QMenu *m = scMW->scrMenuMgr->getLocalPopupMenu(ai.menu);
 				if (m)
 					men += m->title().remove(QRegExp("&(?!&)")) + " -> ";
 			}

Modified: trunk/Scribus/scribus/ui/prefs_preflightverifier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_preflightverifier.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_preflightverifier.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_preflightverifier.cpp	Mon Oct 25 19:37:48 2021
@@ -9,7 +9,7 @@
 #include "prefsstructs.h"
 #include "util.h"
 
-Prefs_PreflightVerifier::Prefs_PreflightVerifier(QWidget* parent, ScribusDoc* doc)
+Prefs_PreflightVerifier::Prefs_PreflightVerifier(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -47,6 +47,7 @@
 
 void Prefs_PreflightVerifier::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_PreflightVerifier::restoreDefaults(struct ApplicationPrefs *prefsData)

Modified: trunk/Scribus/scribus/ui/prefs_printer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_printer.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_printer.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_printer.cpp	Mon Oct 25 19:37:48 2021
@@ -14,7 +14,8 @@
 #include "util_printer.h"
 #include "units.h"
 
-Prefs_Printer::Prefs_Printer(QWidget* parent, ScribusDoc* doc) : Prefs_Pane(parent)
+Prefs_Printer::Prefs_Printer(QWidget* parent, ScribusDoc* /*doc*/)
+	         : Prefs_Pane(parent)
 {
 	setupUi(this);
 	languageChange();

Modified: trunk/Scribus/scribus/ui/prefs_scrapbook.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_scrapbook.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_scrapbook.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_scrapbook.cpp	Mon Oct 25 19:37:48 2021
@@ -9,7 +9,7 @@
 #include "prefsstructs.h"
 #include "scribusdoc.h"
 
-Prefs_Scrapbook::Prefs_Scrapbook(QWidget* parent, ScribusDoc* doc)
+Prefs_Scrapbook::Prefs_Scrapbook(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);

Modified: trunk/Scribus/scribus/ui/prefs_spelling.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_spelling.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.cpp	Mon Oct 25 19:37:48 2021
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "util_file.h"
 
-Prefs_Spelling::Prefs_Spelling(QWidget* parent, ScribusDoc* doc)
+Prefs_Spelling::Prefs_Spelling(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);
@@ -50,6 +50,7 @@
 
 void Prefs_Spelling::languageChange()
 {
+	// No need to do anything here, the UI language cannot change while prefs dialog is opened
 }
 
 void Prefs_Spelling::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -165,60 +166,7 @@
 void Prefs_Spelling::downloadSpellDictsFinished()
 {
 	disconnect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadDictListFinished()));
-/*
-	//qDebug()<<"Downloads All Finished";
-	QString userDictDir(ScPaths::getUserDictDir(true));
-	// List all downloaded files in order to handle identical
-	// affix files while reducing potential errors related to
-	// disk space
-	QStringList allFileList;
-	foreach(DictData d, downloadList)
-	{
-		allFileList += d.files.split(";", Qt::SkipEmptyParts);
-	}
-	// Move downloaded files to destination
-	foreach(DictData d, downloadList)
-	{
-		QString basename = QFileInfo(d.url).fileName();
-		QString filename = downloadLocation+basename;
-		QStringList files = d.files.split(";", Qt::SkipEmptyParts);
-		QString affixFile = affixFileName(files);
-		QString dictFile  = dictFileName(files);
-		//qDebug()<<filename;
-		if (d.filetype=="zip")
-		{
-			//qDebug()<<"zip data found"<<filename;
-			ScZipHandler* fun = new ScZipHandler();
-			if (fun->open(filename))
-			{
-				foreach (QString s, files)
-				{
-					//qDebug()<<"Unzipping"<<userDictDir+s;
-					fun->extract(s, userDictDir);
-					allFileList.removeOne(s);
-				}
-			}
-			delete fun;
-		}
-		if (d.filetype=="plain")
-		{
-			foreach (QString s, files)
-			{
-				//qDebug()<<"plain data found"<<downloadLocation<<userDictDir<<s;
-				QString dstName = s;
-				if (dstName == affixFile)
-					dstName = QFileInfo(downloadLocation+dictFile).baseName() + ".aff";
-				allFileList.removeOne(s);
-				if (allFileList.contains(s))
-				{
-					copyFile(downloadLocation+s, userDictDir+dstName);
-					continue;
-				}
-				moveFile(downloadLocation+s, userDictDir+dstName);
-			}
-		}
-	}
-*/
+
 	updateDictList();
 	downloadProgressBar->setValue(0);
 	downloadProgressBar->setVisible(false);
@@ -256,37 +204,35 @@
 	}
 	dictList.clear();
 	QDomElement docElem = doc.documentElement();
-	QDomNode n = docElem.firstChild();
-	while (!n.isNull())
+	for (QDomNode n = docElem.firstChild(); !n.isNull(); n = n.nextSibling())
 	{
 		QDomElement e = n.toElement();
-		if (!e.isNull())
+		if (e.isNull())
+			continue;
+
+		if (e.tagName() != "dictionary")
+			continue;
+
+		if (e.hasAttribute("type") && e.hasAttribute("filetype"))
 		{
-			if (e.tagName()=="dictionary")
+			if (e.attribute("type") == "spell")
 			{
-				if (e.hasAttribute("type") && e.hasAttribute("filetype"))
-				{
-					if (e.attribute("type")=="spell")
-					{
-						struct DownloadItem d;
-						d.desc=e.attribute("description");
-						d.download=false;
-						d.files=e.attribute("files");
-						d.url=e.attribute("URL");
-						d.version=e.attribute("version");
-						d.lang=e.attribute("language");
-						d.license=e.attribute("license");
-						d.filetype=e.attribute("filetype");
-						QUrl url(d.url);
-						if (url.isValid() && !url.isEmpty() && !url.host().isEmpty())
-							dictList.append(d);
-						//else
-						//	qDebug()<<"hysettings : availDicts : invalid URL"<<d.url;
-					}
-				}
+				struct DownloadItem d;
+				d.desc = e.attribute("description");
+				d.download = false;
+				d.files = e.attribute("files");
+				d.url = e.attribute("URL");
+				d.version = e.attribute("version");
+				d.lang = e.attribute("language");
+				d.license = e.attribute("license");
+				d.filetype = e.attribute("filetype");
+				QUrl url(d.url);
+				if (url.isValid() && !url.isEmpty() && !url.host().isEmpty())
+					dictList.append(d);
+				//else
+				//	qDebug()<<"hysettings : availDicts : invalid URL"<<d.url;
 			}
 		}
-		n = n.nextSibling();
 	}
 	availDictTableWidget->clear();
 	if(dictList.isEmpty())
@@ -296,7 +242,7 @@
 	}
 	availDictTableWidget->setRowCount(dictList.count());
 	availDictTableWidget->setColumnCount(4);
-	int row=0;
+	int row = 0;
 	foreach(DownloadItem d, dictList)
 	{
 		int column=0;
@@ -323,7 +269,7 @@
 	spellDownloadButton->setEnabled(true);
 }
 
-QString Prefs_Spelling::affixFileName(const QStringList& files)
+QString Prefs_Spelling::affixFileName(const QStringList& files) const
 {
 	for (int i = 0; i < files.count(); ++i)
 	{
@@ -334,7 +280,7 @@
 	return QString();
 }
 
-QString Prefs_Spelling::dictFileName(const QStringList& files)
+QString Prefs_Spelling::dictFileName(const QStringList& files) const
 {
 	for (int i = 0; i < files.count(); ++i)
 	{

Modified: trunk/Scribus/scribus/ui/prefs_spelling.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_spelling.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.h	Mon Oct 25 19:37:48 2021
@@ -38,9 +38,10 @@
 		void updateProgressBar();
 
 	protected:
-		QString affixFileName(const QStringList& files);
-		QString dictFileName(const QStringList& files);
+		QString affixFileName(const QStringList& files) const;
+		QString dictFileName(const QStringList& files) const;
 		void setAvailDictsXMLFile(const QString& availDictsXMLDataFile);
+
 		QMap<QString, QString> dictionaryMap;
 		QStringList dictionaryPaths;
 		QString downloadLocation;

Modified: trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp	Mon Oct 25 19:37:48 2021
@@ -17,7 +17,7 @@
 
 Prefs_TableOfContents::Prefs_TableOfContents(QWidget* parent, ScribusDoc* doc)
 	: Prefs_Pane(parent),
-	m_Doc(doc)
+	  m_Doc(doc)
 {
 	setupUi(this);
 	languageChange();
@@ -48,7 +48,6 @@
 	itemListNonPrintingCheckBox->setEnabled(false);
 
 	setCurrentComboItem(itemNumberPlacementComboBox, trStrPNEnd);
-	numSelected = 999;
 }
 
 Prefs_TableOfContents::~Prefs_TableOfContents() = default;

Modified: trunk/Scribus/scribus/ui/prefs_tableofcontents.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_tableofcontents.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_tableofcontents.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_tableofcontents.h	Mon Oct 25 19:37:48 2021
@@ -52,7 +52,7 @@
 		virtual void nonPrintingFramesSelected( bool showNonPrinting );
 
 	protected:
-		int numSelected;
+		int numSelected { 999 };
 		QString strPNNotShown;
 		QString strPNEnd;
 		QString strPNBeginning;
@@ -60,7 +60,7 @@
 		QString trStrPNEnd;
 		QString trStrPNBeginning;
 		ToCSetupVector localToCSetupVector;
-		ScribusDoc* m_Doc;
+		ScribusDoc* m_Doc { nullptr };
 		QString selectedTOCAttrName;
 		QStringList paragraphStyleList;
 

Modified: trunk/Scribus/scribus/ui/prefs_typography.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_typography.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_typography.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_typography.cpp	Mon Oct 25 19:37:48 2021
@@ -9,7 +9,7 @@
 #include "prefsstructs.h"
 #include "scribusdoc.h"
 
-Prefs_Typography::Prefs_Typography(QWidget* parent, ScribusDoc* doc)
+Prefs_Typography::Prefs_Typography(QWidget* parent, ScribusDoc* /*doc*/)
 	: Prefs_Pane(parent)
 {
 	setupUi(this);

Modified: trunk/Scribus/scribus/ui/prefs_userinterface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24749&path=/trunk/Scribus/scribus/ui/prefs_userinterface.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterface.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_userinterface.cpp	Mon Oct 25 19:37:48 2021
@@ -1,63 +1,63 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-#include <QColorDialog>
-#include <QFontDialog>
-#include <QPixmap>
-#include <QStyleFactory>
-
-#include "iconmanager.h"
-#include "langmgr.h"
-#include "prefs_userinterface.h"
-#include "prefsstructs.h"
-#include "scribusapp.h"
-#include "scribusdoc.h"
-#include "util.h"
-#include "util_text.h"
-
-Prefs_UserInterface::Prefs_UserInterface(QWidget* parent, ScribusDoc* doc)
-	: Prefs_Pane(parent)
-{
-	setupUi(this);
-	languageChange();
-	m_caption = tr("User Interface");
-	m_icon = "scribus16.png";
-
-	// qt styles
-	QStringList styleList = QStyleFactory::keys();
-	themeComboBox->addItem("");
-	themeComboBox->addItems(styleList);
-	QStringList iconSetList;
-	iconSetList = IconManager::instance().nameList(ScQApp->currGUILanguage());
-	iconSetComboBox->addItems(iconSetList);
-
-	QStringList languageList;
-	LanguageManager::instance()->fillInstalledGUIStringList(&languageList);
-	if (languageList.isEmpty())
-	{
-		QString currentGUILang = ScQApp->currGUILanguage();
-		if (!currentGUILang.isEmpty())
-			languageList << LanguageManager::instance()->getLangFromAbbrev(currentGUILang);
-		else
-			languageList << LanguageManager::instance()->getLangFromAbbrev("en_GB");
-	}
-	std::sort(languageList.begin(), languageList.end(), localeAwareLessThan);
-	languageComboBox->addItems(languageList);
-
-	numberFormatComboBox->addItem(tr("Use System Format"),"System");
-	numberFormatComboBox->addItem(tr("Use Interface Language Format"),"Language");
-
-	connect(languageComboBox, SIGNAL(activated(const QString &)), this, SLOT(setSelectedGUILang(const QString &)));
-	connect(storyEditorFontPushButton, SIGNAL(clicked()), this, SLOT(changeStoryEditorFont()));
-}
-
-Prefs_UserInterface::~Prefs_UserInterface() = default;
-
-void Prefs_UserInterface::languageChange()
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+
+#include <QColorDialog>
+#include <QFontDialog>
+#include <QPixmap>
+#include <QStyleFactory>
+
+#include "iconmanager.h"
+#include "langmgr.h"
+#include "prefs_userinterface.h"
+#include "prefsstructs.h"
+#include "scribusapp.h"
+#include "scribusdoc.h"
+#include "util.h"
+#include "util_text.h"
+
+Prefs_UserInterface::Prefs_UserInterface(QWidget* parent, ScribusDoc* /*doc*/)
+	: Prefs_Pane(parent)
+{
+	setupUi(this);
+	languageChange();
+	m_caption = tr("User Interface");
+	m_icon = "scribus16.png";
+
+	// qt styles
+	QStringList styleList = QStyleFactory::keys();
+	themeComboBox->addItem("");
+	themeComboBox->addItems(styleList);
+	QStringList iconSetList;
+	iconSetList = IconManager::instance().nameList(ScQApp->currGUILanguage());
+	iconSetComboBox->addItems(iconSetList);
+
+	QStringList languageList;
+	LanguageManager::instance()->fillInstalledGUIStringList(&languageList);
+	if (languageList.isEmpty())
+	{
+		QString currentGUILang = ScQApp->currGUILanguage();
+		if (!currentGUILang.isEmpty())
+			languageList << LanguageManager::instance()->getLangFromAbbrev(currentGUILang);
+		else
+			languageList << LanguageManager::instance()->getLangFromAbbrev("en_GB");
+	}
+	std::sort(languageList.begin(), languageList.end(), localeAwareLessThan);
+	languageComboBox->addItems(languageList);
+
+	numberFormatComboBox->addItem(tr("Use System Format"),"System");
+	numberFormatComboBox->addItem(tr("Use Interface Language Format"),"Language");
+
+	connect(languageComboBox, SIGNAL(activated(const QString &)), this, SLOT(setSelectedGUILang(const QString &)));
+	connect(storyEditorFontPushButton, SIGNAL(clicked()), this, SLOT(changeStoryEditorFont()));
+}
+
+Prefs_UserInterface::~Prefs_UserInterface() = default;
+
+void Prefs_UserInterface::languageChange()
 {
 	themeComboBox->setToolTip( "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>");
 	iconSetComboBox->setToolTip( "<qt>" + tr( "Choose the default icon set" ) + "</qt>");
@@ -65,82 +65,82 @@
 	recentDocumentsSpinBox->setToolTip( "<qt>" + tr( "Number of recently edited documents to show in the File menu" ) + "</qt>");
 	languageComboBox->setToolTip( "<qt>" + tr( "Select your default language for Scribus to run with. Leave this blank to choose based on environment variables. You can still override this by passing a command line option when starting Scribus." )+"</qt>");
 	numberFormatComboBox->setToolTip( "<qt>" + tr( "Use either the system or selected language related definition for number formats for decimals for numbers in the interface" ) + "</qt>");
-	fontSizeMenuSpinBox->setToolTip( "<qt>" + tr( "Default font size for the menus and windows" ) + "</qt>");
-	fontSizePaletteSpinBox->setToolTip( "<qt>" + tr( "Default font size for the tool windows" ) + "</qt>");
-	resizeMoveDelaySpinBox->setToolTip( "<qt>" + tr( "Time before resize or move starts allows for a slight delay between when you click and the operation happens to avoid unintended moves. This can be helpful when dealing with mouse sensitivity settings or accessibility issues related to ergonomic mice, touch pads or moveability of the wrists and hands." ) + "</qt>");
-	wheelJumpSpinBox->setToolTip( "<qt>" + tr( "Number of lines Scribus will scroll for each \"notch\" of the mouse wheel" ) + "</qt>");
-	//showSplashCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>");
-	//showStartupDialogCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>");
-	storyEditorUseSmartSelectionCheckBox->setToolTip( "<qt>" + tr( "The default behavior when double-clicking on a word is to select the word and the first following space. Smart selection will select only the word, without the following space." ) + "</qt>");
-}
-
-void Prefs_UserInterface::restoreDefaults(struct ApplicationPrefs *prefsData)
-{
-	selectedGUILang = prefsData->uiPrefs.language;
-	if (selectedGUILang.isEmpty())
-		selectedGUILang = ScQApp->currGUILanguage();
-	QString langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
-	if (languageComboBox->findText(langString) < 0)
-	{
-		selectedGUILang = ScQApp->currGUILanguage();
-		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
-	}
-	if (languageComboBox->findText(langString) < 0)
-	{
-		selectedGUILang = "en_GB";
-		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
-	}
-	setCurrentComboItem(languageComboBox, langString);
-	numberFormatComboBox->setCurrentIndex(prefsData->uiPrefs.userPreferredLocale == "System" ? 0 : 1);
-	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
-	setCurrentComboItem(iconSetComboBox, prefsData->uiPrefs.iconSet);
-	fontSizeMenuSpinBox->setValue( prefsData->uiPrefs.applicationFontSize );
-	fontSizePaletteSpinBox->setValue( prefsData->uiPrefs.paletteFontSize);
-	wheelJumpSpinBox->setValue( prefsData->uiPrefs.wheelJump );
-	resizeMoveDelaySpinBox->setValue(prefsData->uiPrefs.mouseMoveTimeout);
-	recentDocumentsSpinBox->setValue( prefsData->uiPrefs.recentDocCount );
-	showStartupDialogCheckBox->setChecked(prefsData->uiPrefs.showStartupDialog);
-	useTabsForDocumentsCheckBox->setChecked(prefsData->uiPrefs.useTabs);
-	showSplashCheckBox->setChecked(prefsData->uiPrefs.showSplashOnStartup);
-	useSmallWidgetsCheckBox->setChecked(prefsData->uiPrefs.useSmallWidgets);
-
-	storyEditorUseSmartSelectionCheckBox->setChecked(prefsData->storyEditorPrefs.smartTextSelection);
-	seFont.fromString(prefsData->storyEditorPrefs.guiFont);
-	storyEditorFontPushButton->setText(seFont.family());
-}
-
-void Prefs_UserInterface::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
-{
-	prefsData->uiPrefs.language = selectedGUILang;
-	prefsData->uiPrefs.userPreferredLocale = numberFormatComboBox->currentData().toString();
-	prefsData->uiPrefs.style = themeComboBox->currentText();
-	prefsData->uiPrefs.iconSet = IconManager::instance().baseNameForTranslation(iconSetComboBox->currentText());
-	prefsData->uiPrefs.applicationFontSize = fontSizeMenuSpinBox->value();
-	prefsData->uiPrefs.paletteFontSize = fontSizePaletteSpinBox->value();
-	prefsData->uiPrefs.wheelJump = wheelJumpSpinBox->value();
-	prefsData->uiPrefs.mouseMoveTimeout = resizeMoveDelaySpinBox->value();
-	prefsData->uiPrefs.recentDocCount = recentDocumentsSpinBox->value();
-	prefsData->uiPrefs.showStartupDialog = showStartupDialogCheckBox->isChecked();
-	prefsData->uiPrefs.useTabs = useTabsForDocumentsCheckBox->isChecked();
-	prefsData->uiPrefs.showSplashOnStartup = showSplashCheckBox->isChecked();
-	prefsData->uiPrefs.useSmallWidgets = useSmallWidgetsCheckBox->isChecked();
-
-	prefsData->storyEditorPrefs.guiFont = seFont.toString();
-	prefsData->storyEditorPrefs.smartTextSelection = storyEditorUseSmartSelectionCheckBox->isChecked();
-}
-
-void Prefs_UserInterface::setSelectedGUILang(const QString &newLang)
-{
-	selectedGUILang = LanguageManager::instance()->getAbbrevFromLang(newLang);
-}
-
-void Prefs_UserInterface::changeStoryEditorFont()
-{
-	bool ok;
-	QFont newFont(QFontDialog::getFont( &ok, seFont, this ));
-	if (!ok)
-		return;
-	seFont = newFont;
-	storyEditorFontPushButton->setText(seFont.family());
-}
-
+	fontSizeMenuSpinBox->setToolTip( "<qt>" + tr( "Default font size for the menus and windows" ) + "</qt>");
+	fontSizePaletteSpinBox->setToolTip( "<qt>" + tr( "Default font size for the tool windows" ) + "</qt>");
+	resizeMoveDelaySpinBox->setToolTip( "<qt>" + tr( "Time before resize or move starts allows for a slight delay between when you click and the operation happens to avoid unintended moves. This can be helpful when dealing with mouse sensitivity settings or accessibility issues related to ergonomic mice, touch pads or moveability of the wrists and hands." ) + "</qt>");
+	wheelJumpSpinBox->setToolTip( "<qt>" + tr( "Number of lines Scribus will scroll for each \"notch\" of the mouse wheel" ) + "</qt>");
+	//showSplashCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>");
+	//showStartupDialogCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>");
+	storyEditorUseSmartSelectionCheckBox->setToolTip( "<qt>" + tr( "The default behavior when double-clicking on a word is to select the word and the first following space. Smart selection will select only the word, without the following space." ) + "</qt>");
+}
+
+void Prefs_UserInterface::restoreDefaults(struct ApplicationPrefs *prefsData)
+{
+	selectedGUILang = prefsData->uiPrefs.language;
+	if (selectedGUILang.isEmpty())
+		selectedGUILang = ScQApp->currGUILanguage();
+	QString langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
+	if (languageComboBox->findText(langString) < 0)
+	{
+		selectedGUILang = ScQApp->currGUILanguage();
+		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
+	}
+	if (languageComboBox->findText(langString) < 0)
+	{
+		selectedGUILang = "en_GB";
+		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
+	}
+	setCurrentComboItem(languageComboBox, langString);
+	numberFormatComboBox->setCurrentIndex(prefsData->uiPrefs.userPreferredLocale == "System" ? 0 : 1);
+	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
+	setCurrentComboItem(iconSetComboBox, prefsData->uiPrefs.iconSet);
+	fontSizeMenuSpinBox->setValue( prefsData->uiPrefs.applicationFontSize );
+	fontSizePaletteSpinBox->setValue( prefsData->uiPrefs.paletteFontSize);
+	wheelJumpSpinBox->setValue( prefsData->uiPrefs.wheelJump );
+	resizeMoveDelaySpinBox->setValue(prefsData->uiPrefs.mouseMoveTimeout);
+	recentDocumentsSpinBox->setValue( prefsData->uiPrefs.recentDocCount );
+	showStartupDialogCheckBox->setChecked(prefsData->uiPrefs.showStartupDialog);
+	useTabsForDocumentsCheckBox->setChecked(prefsData->uiPrefs.useTabs);
+	showSplashCheckBox->setChecked(prefsData->uiPrefs.showSplashOnStartup);
+	useSmallWidgetsCheckBox->setChecked(prefsData->uiPrefs.useSmallWidgets);
+
+	storyEditorUseSmartSelectionCheckBox->setChecked(prefsData->storyEditorPrefs.smartTextSelection);
+	seFont.fromString(prefsData->storyEditorPrefs.guiFont);
+	storyEditorFontPushButton->setText(seFont.family());
+}
+
+void Prefs_UserInterface::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
+{
+	prefsData->uiPrefs.language = selectedGUILang;
+	prefsData->uiPrefs.userPreferredLocale = numberFormatComboBox->currentData().toString();
+	prefsData->uiPrefs.style = themeComboBox->currentText();
+	prefsData->uiPrefs.iconSet = IconManager::instance().baseNameForTranslation(iconSetComboBox->currentText());
+	prefsData->uiPrefs.applicationFontSize = fontSizeMenuSpinBox->value();
+	prefsData->uiPrefs.paletteFontSize = fontSizePaletteSpinBox->value();
+	prefsData->uiPrefs.wheelJump = wheelJumpSpinBox->value();
+	prefsData->uiPrefs.mouseMoveTimeout = resizeMoveDelaySpinBox->value();
+	prefsData->uiPrefs.recentDocCount = recentDocumentsSpinBox->value();
+	prefsData->uiPrefs.showStartupDialog = showStartupDialogCheckBox->isChecked();
+	prefsData->uiPrefs.useTabs = useTabsForDocumentsCheckBox->isChecked();
+	prefsData->uiPrefs.showSplashOnStartup = showSplashCheckBox->isChecked();
+	prefsData->uiPrefs.useSmallWidgets = useSmallWidgetsCheckBox->isChecked();
+
+	prefsData->storyEditorPrefs.guiFont = seFont.toString();
+	prefsData->storyEditorPrefs.smartTextSelection = storyEditorUseSmartSelectionCheckBox->isChecked();
+}
+
+void Prefs_UserInterface::setSelectedGUILang(const QString &newLang)
+{
+	selectedGUILang = LanguageManager::instance()->getAbbrevFromLang(newLang);
+}
+
+void Prefs_UserInterface::changeStoryEditorFont()
+{
+	bool ok;
+	QFont newFont(QFontDialog::getFont( &ok, seFont, this ));
+	if (!ok)
+		return;
+	seFont = newFont;
+	storyEditorFontPushButton->setText(seFont.family());
+}
+




More information about the scribus-commit mailing list