r13870 by cbradney - Prefs Rewrite: Rename UI prefs tab variables and change attribute names written to scribus150.rc

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 26 05:41:34 CEST 2009


Revision: 13870
Author: cbradney
Date: 2009-08-15T22:21:00.712651Z
Commit message: Prefs Rewrite: Rename UI prefs tab variables and change attribute names written to scribus150.rc

Changeset: 
M  /trunk/Scribus/scribus/ui/prefs.cpp
M  /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M  /trunk/Scribus/scribus/latexhelpers.cpp
M  /trunk/Scribus/scribus/ui/preferencesdialog.h
M  /trunk/Scribus/scribus/scribusview.cpp
M  /trunk/Scribus/scribus/ui/newfile.cpp
M  /trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
M  /trunk/Scribus/scribus/prefsmanager.cpp
M  /trunk/Scribus/scribus/scribus.cpp
M  /trunk/Scribus/scribus/scribusview.h
M  /trunk/Scribus/scribus/prefsstructs.h
M  /trunk/Scribus/scribus/ui/scrpalettebase.cpp
M  /trunk/Scribus/scribus/prefsmanager.h
M  /trunk/Scribus/scribus/ui/prefs_documentsetup.h
M  /trunk/Scribus/scribus/ui/tabgeneral.cpp
M  /trunk/Scribus/scribus/scribuscore.cpp
M  /trunk/Scribus/scribus/plugins/scriptplugin/pconsole.cpp

Diffs:
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp	(revision 13869)
+++ scribus/scribuscore.cpp	(revision 13870)
@@ -132,7 +132,7 @@
 	}
 	else
 	{
-		if (PrefsManager::instance()->appPrefs.showStartupDialog)
+		if (PrefsManager::instance()->appPrefs.ui_ShowStartupDialog)
 			scribus->startUpDialog();
 		else
 			scribus->setFocus();
Index: scribus/scribusview.h
===================================================================
--- scribus/scribusview.h	(revision 13869)
+++ scribus/scribusview.h	(revision 13870)
@@ -483,7 +483,7 @@
 
 inline bool ScribusView::moveTimerElapsed()
 {
-	return (m_moveTimer.elapsed() > Prefs->moveTimeout);
+	return (m_moveTimer.elapsed() > Prefs->ui_MouseMoveTimeout);
 }
 
 
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 13869)
+++ scribus/prefsmanager.cpp	(revision 13870)
@@ -183,7 +183,7 @@
 	}
 	*/
 
-	appPrefs.Wheelval = 40;
+	appPrefs.ui_WheelJump = 40;
 	/** Set Default window position and size to sane default values which should work on every screen */
 //	appPrefs.mainWinSettings.xPosition = 0;
 //	appPrefs.mainWinSettings.yPosition = 0;
@@ -228,11 +228,11 @@
 	appPrefs.typographicSettings.valueStrikeThruWidth = -1;
 	appPrefs.typographicSettings.valueBaseGrid = 14.4;
 	appPrefs.typographicSettings.offsetBaseGrid = 0.0;
-	appPrefs.GUI = "";
+	appPrefs.ui_Theme = "";
 	appPrefs.grayscaleIcons = false; // can be a little slower on startup.. but its a nice effect to play with
 	appPrefs.showToolTips = true;
 	appPrefs.showMouseCoordinates = true;
-	appPrefs.moveTimeout = 150;
+	appPrefs.ui_MouseMoveTimeout = 150;
 	appPrefs.stickyTools = false;
 	//FIXME
 	//Black here causes issues when a colour set is loaded without "Black" in it.
@@ -294,7 +294,7 @@
 	appPrefs.GCRMode = false;
 	appPrefs.RecentDocs.clear();
 	appPrefs.RecentScrapbooks.clear();
-	appPrefs.RecentDCount = 5;
+	appPrefs.ui_RecentDocCount = 5;
 	appPrefs.doCopyToScrapbook = true;
 	appPrefs.persistentScrapbook = false;
 	appPrefs.numScrapbookCopies = 10;
@@ -420,8 +420,8 @@
 	// lorem ipsum defaults
 	appPrefs.useStandardLI = false;
 	appPrefs.paragraphsLI = 10;
-	appPrefs.showStartupDialog = true;
-	appPrefs.useSmallWidgets = false;
+	appPrefs.ui_ShowStartupDialog = true;
+	appPrefs.ui_UseSmallWidgets = false;
 	initDefaultCheckerPrefs(&appPrefs.checkerProfiles);
 	appPrefs.curCheckProfile = CommonStrings::PostScript;
 	appPrefs.PDF_Options.Thumbnails = false;
@@ -519,9 +519,9 @@
 
 void PrefsManager::initDefaultGUIFont(const QFont& guiFont)
 {
-	appPrefs.AppFontSize = guiFont.pointSize();
+	appPrefs.ui_ApplicationFontSize = guiFont.pointSize();
 	appPrefs.STEfont = guiFont.toString();
-	appPrefs.PaletteFontSize = appPrefs.AppFontSize;
+	appPrefs.ui_PaletteFontSize = appPrefs.ui_ApplicationFontSize;
 }
 
 void PrefsManager::initArrowStyles()
@@ -885,7 +885,7 @@
 {
 	mw->setDefaultPrinter(appPrefs.PrinterName, appPrefs.PrinterFile, appPrefs.PrinterCommand);
 
-	uint max = qMin(appPrefs.RecentDCount, appPrefs.RecentDocs.count());
+	uint max = qMin(appPrefs.ui_RecentDocCount, appPrefs.RecentDocs.count());
 	for (uint m = 0; m < max; ++m)
 	{
 		QFileInfo fd(appPrefs.RecentDocs[m]);
@@ -921,7 +921,7 @@
 		PrefsContext* userprefsContext = prefsFile->getContext("user_preferences");
 		if (userprefsContext)
 		{
-			appPrefs.guiLanguage = userprefsContext->get("gui_language","");
+			appPrefs.ui_Language = userprefsContext->get("gui_language","");
 			appPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate","").toAscii());
             //continue here...
             //Prefs."blah blah" =...
@@ -951,7 +951,7 @@
 	appPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized();
 	appPrefs.mainWinState = ScCore->primaryMainWindow()->saveState();
 	appPrefs.RecentDocs.clear();
-	uint max = qMin(appPrefs.RecentDCount, ScCore->primaryMainWindow()->RecentDocs.count());
+	uint max = qMin(appPrefs.ui_RecentDocCount, ScCore->primaryMainWindow()->RecentDocs.count());
 	for (uint m = 0; m < max; ++m)
 	{
 		appPrefs.RecentDocs.append(ScCore->primaryMainWindow()->RecentDocs[m]);
@@ -975,7 +975,7 @@
 		PrefsContext* userprefsContext = prefsFile->getContext("user_preferences");
 		if (userprefsContext)
 		{
-			userprefsContext->set("gui_language", appPrefs.guiLanguage);
+			userprefsContext->set("gui_language", appPrefs.ui_Language);
 			userprefsContext->set("mainwinstate", QString::fromAscii(appPrefs.mainWinState.toBase64()));
             //continue here...
             //Prefs."blah blah" =...
@@ -1019,9 +1019,9 @@
 	appPrefs.DocDir = dirname;
 }
 
-int PrefsManager::mouseWheelValue() const
+int PrefsManager::mouseWheelJump() const
 {
-	return appPrefs.Wheelval;
+	return appPrefs.ui_WheelJump;
 }
 
 //Changed to return false when we have no fonts
@@ -1033,7 +1033,7 @@
 
 void PrefsManager::setShowStartupDialog(const bool showDialog)
 {
-	appPrefs.showStartupDialog=showDialog;
+	appPrefs.ui_ShowStartupDialog=showDialog;
 }
 
 const ColorList& PrefsManager::colorSet()
@@ -1188,29 +1188,29 @@
 	return appPrefs.DisScale;
 }
 
-const QString& PrefsManager::guiLanguage() const
+const QString& PrefsManager::uiLanguage() const
 {
-	return appPrefs.guiLanguage;
+	return appPrefs.ui_Language;
 }
 
 const QString& PrefsManager::guiStyle() const
 {
-	return appPrefs.GUI;
+	return appPrefs.ui_Theme;
 }
 
 const QString& PrefsManager::guiSystemStyle() const
 {
-	return appPrefs.GUIsystem;
+	return appPrefs.ui_SystemTheme;
 }
 
 const int& PrefsManager::guiFontSize() const
 {
-	return appPrefs.AppFontSize;
+	return appPrefs.ui_ApplicationFontSize;
 }
 
 const int& PrefsManager::paletteFontSize() const
 {
-	return appPrefs.PaletteFontSize;
+	return appPrefs.ui_PaletteFontSize;
 }
 
 bool PrefsManager::showPageShadow() const
@@ -1226,14 +1226,14 @@
 	QDomElement elem=docu.documentElement();
 	elem.setAttribute("VERSION","1.3.5");
 	QDomElement dc=docu.createElement("GUI");
-	dc.setAttribute("STILT",appPrefs.GUI);
-	dc.setAttribute("RAD",appPrefs.Wheelval);
-	dc.setAttribute("MOVT", appPrefs.moveTimeout);
-	dc.setAttribute("APF",appPrefs.AppFontSize);
-	dc.setAttribute("PFS",appPrefs.PaletteFontSize);
+	dc.setAttribute("UI_THEME",appPrefs.ui_Theme);
+	dc.setAttribute("UI_WHEELJUMP",appPrefs.ui_WheelJump);
+	dc.setAttribute("UI_MOUSEMOVETIMEOUT", appPrefs.ui_MouseMoveTimeout);
+	dc.setAttribute("UI_APPLICATIONFONTSIZE",appPrefs.ui_ApplicationFontSize);
+	dc.setAttribute("UI_PALETTEFONTSIZE",appPrefs.ui_PaletteFontSize);
 	dc.setAttribute("GRAB",appPrefs.guidesSettings.grabRad);
 	dc.setAttribute("UNIT",appPrefs.docUnitIndex);
-	dc.setAttribute("RCD", appPrefs.RecentDCount);
+	dc.setAttribute("UI_RECENTDOCCOUNT", appPrefs.ui_RecentDocCount);
 	dc.setAttribute("DOC", appPrefs.DocDir);
 	dc.setAttribute("PROFILES", appPrefs.ProfileDir);
 	dc.setAttribute("SCRIPTS", appPrefs.ScriptDir);
@@ -1259,8 +1259,8 @@
 	dc.setAttribute("STECOLOR", appPrefs.STEcolor.name());
 	dc.setAttribute("STEFONT", appPrefs.STEfont);
 	dc.setAttribute("STYLEPREVIEW", static_cast<int>(appPrefs.haveStylePreview));
-	dc.setAttribute("StartUp", static_cast<int>(appPrefs.showStartupDialog));
-	dc.setAttribute("UseSmallWidgets", static_cast<int>(appPrefs.useSmallWidgets));
+	dc.setAttribute("UI_SHOWSTARTUPDIALOG", static_cast<int>(appPrefs.ui_ShowStartupDialog));
+	dc.setAttribute("UI_USESMALLWIDGETS", static_cast<int>(appPrefs.ui_UseSmallWidgets));
 	dc.setAttribute("ToolTips", static_cast<int>(appPrefs.showToolTips));
 	dc.setAttribute("showMouseCoordinates", static_cast<int>(appPrefs.showMouseCoordinates));
 	dc.setAttribute("stickyTools", static_cast<int>(appPrefs.stickyTools));
@@ -1756,14 +1756,32 @@
 		QDomElement dc=DOC.toElement();
 		if (dc.tagName()=="GUI")
 		{
-			appPrefs.GUI = dc.attribute("STILT","Default");
-			appPrefs.Wheelval = dc.attribute("RAD").toInt();
-			appPrefs.moveTimeout = dc.attribute("MOVT", "150").toInt();
+			if (dc.hasAttribute("STILT"))
+				appPrefs.ui_Theme = dc.attribute("STILT");
+			else
+				appPrefs.ui_Theme = dc.attribute("UI_THEME","Default");
+			if (dc.hasAttribute("RAD"))
+				appPrefs.ui_WheelJump = dc.attribute("RAD").toInt();
+			else
+				appPrefs.ui_WheelJump = dc.attribute("UI_WHEELJUMP").toInt();
+			if (dc.hasAttribute("MOVT"))
+				appPrefs.ui_MouseMoveTimeout = dc.attribute("MOVT").toInt();
+			else
+				appPrefs.ui_MouseMoveTimeout = dc.attribute("UI_MOUSEMOVETIMEOUT", "150").toInt();
 			appPrefs.guidesSettings.grabRad = dc.attribute("GRAB", "4").toInt();
 			appPrefs.docUnitIndex = dc.attribute("UNIT", "0").toInt();
-			appPrefs.AppFontSize = dc.attribute("APF", "12").toInt();
-			appPrefs.PaletteFontSize = dc.attribute("PFS", "10").toInt();
-			appPrefs.RecentDCount = dc.attribute("RCD","5").toUInt();
+			if (dc.hasAttribute("APF"))
+				appPrefs.ui_ApplicationFontSize = dc.attribute("APF").toInt();
+			else
+				appPrefs.ui_ApplicationFontSize = dc.attribute("UI_APPLICATIONFONTSIZE", "12").toInt();
+			if (dc.hasAttribute("PFS"))
+				appPrefs.ui_PaletteFontSize = dc.attribute("PFS").toInt();
+			else
+				appPrefs.ui_PaletteFontSize = dc.attribute("UI_PALETTEFONTSIZE", "10").toInt();
+			if (dc.hasAttribute("RCD"))
+				appPrefs.ui_RecentDocCount = dc.attribute("RCD").toInt();
+			else
+				appPrefs.ui_RecentDocCount = dc.attribute("UI_RECENTDOCCOUNT","5").toUInt();
 			appPrefs.DocDir = dc.attribute("DOC","");
 			appPrefs.ProfileDir = dc.attribute("PROFILES","");
 			appPrefs.ScriptDir = dc.attribute("SCRIPTS","");
@@ -1781,8 +1799,14 @@
 			appPrefs.guidesSettings.showBleed = static_cast<bool>(dc.attribute("showBleed", "1").toInt());
 			appPrefs.guidesSettings.rulerMode = static_cast<bool>(dc.attribute("rulerMode", "1").toInt());
 			appPrefs.haveStylePreview = static_cast<bool>(dc.attribute("STYLEPREVIEW", "1").toInt());
-			appPrefs.showStartupDialog = static_cast<bool>(dc.attribute("StartUp", "1").toInt());
-			appPrefs.useSmallWidgets = static_cast<bool>(dc.attribute("UseSmallWidgets", "0").toInt());
+			if (dc.hasAttribute("StartUp"))
+				appPrefs.ui_ShowStartupDialog = dc.attribute("StartUp").toInt();
+			else
+				appPrefs.ui_ShowStartupDialog = static_cast<bool>(dc.attribute("UI_SHOWSTARTUPDIALOG", "1").toInt());
+			if (dc.hasAttribute("UseSmallWidgets"))
+				appPrefs.ui_UseSmallWidgets = dc.attribute("UseSmallWidgets").toInt();
+			else
+				appPrefs.ui_UseSmallWidgets = static_cast<bool>(dc.attribute("UI_USESMALLWIDGETS", "0").toInt());
 			appPrefs.scratch.Bottom = ScCLocale::toDoubleC(dc.attribute("ScratchBottom"), 20.0);
 			appPrefs.scratch.Left   = ScCLocale::toDoubleC(dc.attribute("ScratchLeft"), 100.0);
 			appPrefs.scratch.Right  = ScCLocale::toDoubleC(dc.attribute("ScratchRight"), 100.0);
@@ -2355,16 +2379,16 @@
 		DOC=DOC.nextSibling();
 	}
 	appPrefs.DColors.ensureBlackAndWhite();
-	appPrefs.GUIsystem = qApp->style()->objectName();
-	if (appPrefs.GUI.length() > 0)
+	appPrefs.ui_SystemTheme = qApp->style()->objectName();
+	if (appPrefs.ui_Theme.length() > 0)
 	{
-		qApp->setStyle(QStyleFactory::create(appPrefs.GUI));
+		qApp->setStyle(QStyleFactory::create(appPrefs.ui_Theme));
 		// Plain wrong, a style may set a palette different from the standard palette
 		// Eg : Windows XP and Windows Vista styles
 		// qApp->setPalette(qApp->style()->standardPalette());
 	}
 	QFont apf = qApp->font();
-	apf.setPointSize(appPrefs.AppFontSize);
+	apf.setPointSize(appPrefs.ui_ApplicationFontSize);
 	qApp->setFont(apf);
 	return true;
 }
Index: scribus/prefsmanager.h
===================================================================
--- scribus/prefsmanager.h	(revision 13869)
+++ scribus/prefsmanager.h	(revision 13870)
@@ -142,11 +142,11 @@
 	//! \brief Get the users preferred document directory
 	const QString documentDir();
 	void setDocumentDir(const QString& dirname);
-	int mouseWheelValue() const;
+	int mouseWheelJump() const;
 	//! \brief Get the user set display scale
 	double displayScale() const;
 	//! \brief Get the GUI language from preferences
-	const QString& guiLanguage() const;
+	const QString& uiLanguage() const;
 	//! \brief Get the GUI style from preferences
 	const QString& guiStyle() const;
 	const QString& guiSystemStyle() const;
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(revision 13869)
+++ scribus/prefsstructs.h	(revision 13870)
@@ -153,14 +153,44 @@
 
 struct ApplicationPrefs
 {
+	//User Interface
+	int ui_MouseMoveTimeout; //! Mouse move timeout for move/resize operations
+	int ui_WheelJump; //! Distance to jump with mouse wheel scrolling
+	int ui_ApplicationFontSize; //! Font size to use in the application, apart from pßalettes
+	int ui_PaletteFontSize; //! Fotn size to use in the palettes
+	QString ui_Theme; 	//! Currently used QStyle name
+	int ui_RecentDocCount; //! Number of recent documents to remember
+	QString ui_Language; //! Language of the user interface
+	bool ui_UseSmallWidgets; //! Use small widgets in the palettes
+	bool ui_ShowStartupDialog; //! Whether to show the startup dialog or not
+	//Paths
+	//Document Setup
+	//Guides
+	//Typography
+	//Item Tools
+	//Operators Tools
+	//Hyphenator
+	//Fonts
+	//Printer
+	//ColorManagement
+	//PDF Export
+	//Document Item Attributes
+	//Tables of Contents
+	//Keyboard Shortcuts
+	//Scrapbook
+	//Display
+	//External Tools
+	//Miscellaneous
+	//Plugins
+	//Short Words
+	//Scripter
+
+
 	SCFonts AvailFonts;
 	QList<ArrowDesc> arrowStyles;
 	QList<PageSet> pageSets;
 	ColorList DColors;
-	int moveTimeout;
-	int Wheelval;
-	int AppFontSize;
-	int PaletteFontSize;
+
 	bool showPageShadow;
 	QColor DpapColor;
 	QColor DFrameColor;
@@ -171,10 +201,7 @@
 	QColor DFrameAnnotationColor;
 	QColor DPageBorderColor;
 	QColor DControlCharColor;
-	//! Currently used QStyle name
-	QString GUI;
-	//! System default QStyle name for current instance
-	QString GUIsystem;
+
 	guidesPrefs guidesSettings;
 	typoPrefs typographicSettings;
 	toolPrefs toolSettings;
@@ -198,7 +225,7 @@
 	int numScrapbookCopies;
 	bool doCopyToScrapbook;
 	bool persistentScrapbook;
-	int RecentDCount;
+
 	CMSData DCMSset;
 	QMap<QString,Keys> KeyActions;
 	QString PrinterName;
@@ -216,7 +243,7 @@
 	QString Language;
 	QHash<QString, QString> specialWords;
 	QSet<QString> ignoredWords;
-	QString guiLanguage;
+
 	bool Automatic;
 	bool AutoCheck;
 	QString DocDir;
@@ -258,10 +285,6 @@
 	MarginStruct scratch;
 	double GapHorizontal;
 	double GapVertical;
-/*	double ScratchLeft;
-	double ScratchRight;
-	double ScratchTop;
-	double ScratchBottom;*/
 	bool askBeforeSubstituite;
 	bool haveStylePreview;
 	bool showToolTips;
@@ -269,10 +292,13 @@
 	// lorem ipsum
 	bool useStandardLI;
 	int paragraphsLI;
-	bool showStartupDialog;
-	bool useSmallWidgets; // space savy widgets in palettes - PV
+
+
 	bool stickyTools;
 	bool grayscaleIcons;
+	//TODO : Remove these no longer used items
+	//! System default QStyle name for current instance, seemingly unused
+	QString ui_SystemTheme;
 };
 
 #endif
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 13869)
+++ scribus/scribusview.cpp	(revision 13870)
@@ -4675,7 +4675,7 @@
 	else
 	{
 		int dX=0,dY=0;
-		int moveBy=(w->delta() < 0) ? Prefs->Wheelval : -Prefs->Wheelval;
+		int moveBy=(w->delta() < 0) ? Prefs->ui_WheelJump : -Prefs->ui_WheelJump;
 		if ((w->orientation() != Qt::Vertical) || ( w->modifiers() == Qt::ShiftModifier ))
 			dX = moveBy;
 		else
Index: scribus/ui/preferencesdialog.h
===================================================================
--- scribus/ui/preferencesdialog.h	(revision 13869)
+++ scribus/ui/preferencesdialog.h	(revision 13870)
@@ -38,7 +38,10 @@
 #include "ui/prefs_pdfexport.h"
 #include "ui/prefs_documentitemattributes.h"
 
+class PrefsManager;
+class ScribusMainWindow;
 
+
 /*! \brief The Scribus Preferences Dialog
 */
 class SCRIBUS_API PreferencesDialog : public QDialog, Ui::PreferencesDialog
@@ -60,6 +63,7 @@
 		int addItem(QString name, QPixmap icon, QWidget *tab);
 		void setupListWidget();
 		void arrangeIcons();
+		void initPreferenceValues();
 
 		Prefs_ColorManagement *prefs_ColorManagement;
 		Prefs_UserInterface *prefs_UserInterface;
@@ -86,6 +90,10 @@
 
 		QMap<QListWidgetItem*, int> stackWidgetMap;
 		int counter;
+		double unitRatio;
+		int docUnitIndex;
+		ScribusMainWindow* mainWin;
+		PrefsManager* prefsManager;
 };
 
 #endif
Index: scribus/ui/prefs.cpp
===================================================================
--- scribus/ui/prefs.cpp	(revision 13869)
+++ scribus/ui/prefs.cpp	(revision 13870)
@@ -343,20 +343,20 @@
 {
 	double prefsUnitRatio = unitGetRatioFromIndex(tabDocument->unitCombo->currentIndex());
 
-	prefsManager->appPrefs.AppFontSize = tabGeneral->GFsize->value();
-	prefsManager->appPrefs.PaletteFontSize = tabGeneral->GTFsize->value();
+	prefsManager->appPrefs.ui_ApplicationFontSize = tabGeneral->GFsize->value();
+	prefsManager->appPrefs.ui_PaletteFontSize = tabGeneral->GTFsize->value();
 	ScQApp->neverSplash(!tabGeneral->showSplashCheckBox->isChecked());
-	prefsManager->appPrefs.showStartupDialog = tabGeneral->startUpDialog->isChecked();
-	prefsManager->appPrefs.Wheelval = tabGeneral->wheelJumpSpin->value();
-	prefsManager->appPrefs.moveTimeout = tabGeneral->spinTimeout->value();
-	prefsManager->appPrefs.RecentDCount = tabGeneral->recentDocs->value();
+	prefsManager->appPrefs.ui_ShowStartupDialog = tabGeneral->startUpDialog->isChecked();
+	prefsManager->appPrefs.ui_WheelJump = tabGeneral->wheelJumpSpin->value();
+	prefsManager->appPrefs.ui_MouseMoveTimeout = tabGeneral->spinTimeout->value();
+	prefsManager->appPrefs.ui_RecentDocCount = tabGeneral->recentDocs->value();
 	prefsManager->appPrefs.DocDir = QDir::fromNativeSeparators( tabGeneral->Docs->text() );
 	prefsManager->appPrefs.ProfileDir = QDir::fromNativeSeparators( tabGeneral->ProPfad->text() );
 	prefsManager->appPrefs.ScriptDir = QDir::fromNativeSeparators( tabGeneral->ScriptPfad->text() );
 	prefsManager->appPrefs.documentTemplatesDir = QDir::fromNativeSeparators( tabGeneral->DocumentTemplateDir->text() );
-	prefsManager->appPrefs.guiLanguage=tabGeneral->selectedGUILang;
-	prefsManager->appPrefs.GUI = tabGeneral->GUICombo->currentText();
-	prefsManager->appPrefs.useSmallWidgets = tabGeneral->useSmallWidgetsCheck->isChecked();
+	prefsManager->appPrefs.ui_Language=tabGeneral->selectedGUILang;
+	prefsManager->appPrefs.ui_Theme = tabGeneral->GUICombo->currentText();
+	prefsManager->appPrefs.ui_UseSmallWidgets = tabGeneral->useSmallWidgetsCheck->isChecked();
 
 //	prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapHorizontal = tabView->gapHorizontal->value() / prefsUnitRatio;
 //	prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapBelow = tabView->gapVertical->value() / prefsUnitRatio;
Index: scribus/ui/newfile.cpp
===================================================================
--- scribus/ui/newfile.cpp	(revision 13869)
+++ scribus/ui/newfile.cpp	(revision 13870)
@@ -128,7 +128,7 @@
 	if (startUp)
 	{
 		startUpDialog = new QCheckBox( tr( "Do not show this dialog again" ), this );
-		startUpDialog->setChecked(!prefsManager->appPrefs.showStartupDialog);
+		startUpDialog->setChecked(!prefsManager->appPrefs.ui_ShowStartupDialog);
 		Layout1->addWidget( startUpDialog );
 	}
 	QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
@@ -398,7 +398,7 @@
 	recentDocLayout->setSpacing(5);
 	recentDocListBox = new QListWidget(recentDocFrame);
 	recentDocLayout->addWidget(recentDocListBox);
-	uint max = qMin(prefsManager->appPrefs.RecentDCount, recentDocList.count());
+	uint max = qMin(prefsManager->appPrefs.ui_RecentDocCount, recentDocList.count());
 	for (uint m = 0; m < max; ++m)
 		recentDocListBox->addItem( QDir::convertSeparators(recentDocList[m]) );
 }
Index: scribus/ui/prefs_documentsetup.h
===================================================================
--- scribus/ui/prefs_documentsetup.h	(revision 13869)
+++ scribus/ui/prefs_documentsetup.h	(revision 13870)
@@ -18,6 +18,8 @@
 	public:
 		Prefs_DocumentSetup(QWidget* parent=0);
 		~Prefs_DocumentSetup();
+
+//		setValues();
 };
 
 #endif // PREFS_DOCUMENTSETUP_H
Index: scribus/ui/tabgeneral.cpp
===================================================================
--- scribus/ui/tabgeneral.cpp	(revision 13869)
+++ scribus/ui/tabgeneral.cpp	(revision 13870)
@@ -71,21 +71,21 @@
 
 void TabGeneral::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
-	selectedGUILang = prefsData->guiLanguage;
+	selectedGUILang = prefsData->ui_Language;
 	setCurrentComboItem(guiLangCombo, LanguageManager::instance()->getLangFromAbbrev(selectedGUILang));
-	setCurrentComboItem(GUICombo, prefsData->GUI);
-	GFsize->setValue( prefsData->AppFontSize );
-	GTFsize->setValue( prefsData->PaletteFontSize); // temp solution
-	wheelJumpSpin->setValue( prefsData->Wheelval );
-	spinTimeout->setValue(prefsData->moveTimeout);
-	recentDocs->setValue( prefsData->RecentDCount );
+	setCurrentComboItem(GUICombo, prefsData->ui_Theme);
+	GFsize->setValue( prefsData->ui_ApplicationFontSize );
+	GTFsize->setValue( prefsData->ui_PaletteFontSize); // temp solution
+	wheelJumpSpin->setValue( prefsData->ui_WheelJump );
+	spinTimeout->setValue(prefsData->ui_MouseMoveTimeout);
+	recentDocs->setValue( prefsData->ui_RecentDocCount );
 	Docs->setText(QDir::convertSeparators(prefsData->DocDir));
 	ProPfad->setText(QDir::convertSeparators(prefsData->ProfileDir));
 	ScriptPfad->setText(QDir::convertSeparators(prefsData->ScriptDir));
 	DocumentTemplateDir->setText(QDir::convertSeparators(prefsData->documentTemplatesDir));
-	startUpDialog->setChecked(prefsData->showStartupDialog);
+	startUpDialog->setChecked(prefsData->ui_ShowStartupDialog);
 	showSplashCheckBox->setChecked( !ScQApp->neverSplashExists() );
-	useSmallWidgetsCheck->setChecked(prefsData->useSmallWidgets);
+	useSmallWidgetsCheck->setChecked(prefsData->ui_UseSmallWidgets);
 }
 
 void TabGeneral::setSelectedGUILang( const QString &newLang )
Index: scribus/ui/scrpalettebase.cpp
===================================================================
--- scribus/ui/scrpalettebase.cpp	(revision 13869)
+++ scribus/ui/scrpalettebase.cpp	(revision 13870)
@@ -53,7 +53,7 @@
 	prefsContextName(QString::null),
 	visibleOnStartup(false)
 {
-	if (PrefsManager::instance()->appPrefs.useSmallWidgets)
+	if (PrefsManager::instance()->appPrefs.ui_UseSmallWidgets)
 	{
 		setStyleSheet("	QToolButton { margin: 0px; padding: 0px; font-size: 10px; } \
 						QToolButton:pressed { padding-top: 2px; padding-left: 2px } \
@@ -119,7 +119,7 @@
 void ScrPaletteBase::setFontSize()
 {
 	QFont newfont(font());
-	newfont.setPointSize(PrefsManager::instance()->appPrefs.PaletteFontSize);
+	newfont.setPointSize(PrefsManager::instance()->appPrefs.ui_PaletteFontSize);
 	setFont(newfont);
 }
 
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp	(revision 13869)
+++ scribus/ui/preferencesdialog.cpp	(revision 13870)
@@ -14,10 +14,11 @@
 #include "preferencesdialog.h"
 
 #include "commonstrings.h"
+#include "prefsmanager.h"
+#include "scribus.h"
+#include "units.h"
 #include "util_icon.h"
 
-
-
 PreferencesDialog::PreferencesDialog( QWidget* parent )
 	: QDialog(parent),
 	counter(0)
@@ -79,6 +80,8 @@
 	connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
 	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
 	connect(preferencesTypeList, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
+
+	initPreferenceValues();
 }
 
 PreferencesDialog::~PreferencesDialog()
@@ -107,6 +110,7 @@
 
 int PreferencesDialog::addItem(QString name, QPixmap icon, QWidget *tab)
 {
+	//TODO: Can we avoid using this name and duplicating strings by getting it from the tab UIs
 	QListWidgetItem* newItem = new QListWidgetItem(icon, name, preferencesTypeList);
 	newItem->setTextAlignment(Qt::AlignHCenter);
 	prefsStackWidget->addWidget(tab);
@@ -139,6 +143,7 @@
 
 void PreferencesDialog::languageChange()
 {
+	setWindowTitle( tr( "Preferences" ) );
 }
 
 void PreferencesDialog::arrangeIcons()
@@ -184,3 +189,12 @@
 		startY += ir.height()+5;
 	}*/
 }
+
+void PreferencesDialog::initPreferenceValues()
+{
+	prefsManager=PrefsManager::instance();
+	ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
+	mainWin = (ScribusMainWindow*)parent();
+	docUnitIndex = prefsData->docUnitIndex;
+	unitRatio = unitGetRatioFromIndex(docUnitIndex);
+}
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 13869)
+++ scribus/scribus.cpp	(revision 13870)
@@ -627,7 +627,7 @@
 	scrMenuMgr->addMenuSeparator("File");
 	scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File");
 	scrMenuMgr->addMenuItem(scrActions["filePreferences"], "File");
-//	scrMenuMgr->addMenuItem(scrActions["filePreferences150"], "File");
+	scrMenuMgr->addMenuItem(scrActions["filePreferences150"], "File");
 	scrMenuMgr->addMenuSeparator("File");
 	scrMenuMgr->addMenuItem(scrActions["filePrint"], "File");
 	scrMenuMgr->addMenuItem(scrActions["PrintPreview"], "File");
@@ -1366,7 +1366,7 @@
 		if ((doc->appMode != modeEdit) && (doc->m_Selection->count() == 0))
 		{
 			int pg;
-			int wheelVal = prefsManager->mouseWheelValue();
+			int wheelVal = prefsManager->mouseWheelJump();
 			if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
 				wheelVal = qMax(qRound(wheelVal / 10.0), 1);
 			switch (kk)
@@ -1381,7 +1381,7 @@
 				break;
 			case Qt::Key_PageUp:
 				if (doc->masterPageMode())
-					view->scrollBy(0, -prefsManager->mouseWheelValue());
+					view->scrollBy(0, -prefsManager->mouseWheelJump());
 				else
 				{
 					pg = doc->currentPageNumber();
@@ -1397,7 +1397,7 @@
 				break;
 			case Qt::Key_PageDown:
 				if (doc->masterPageMode())
-					view->scrollBy(0, prefsManager->mouseWheelValue());
+					view->scrollBy(0, prefsManager->mouseWheelJump());
 				else
 				{
 					pg = doc->currentPageNumber();
@@ -3426,7 +3426,7 @@
 		scrMenuMgr->removeMenuItem((*it), recentFileMenuName);
 
 	scrRecentFileActions.clear();
-	uint max = qMin(prefsManager->appPrefs.RecentDCount, RecentDocs.count());
+	uint max = qMin(prefsManager->appPrefs.ui_RecentDocCount, RecentDocs.count());
 	QString strippedName, localName;
 	for (uint m = 0; m < max; ++m)
 	{
@@ -7589,10 +7589,10 @@
 void ScribusMainWindow::prefsOrg(Preferences *dia)
 {
 	//reset the appMode so we restore our tools shortcuts
-	QString oldGUILanguage = prefsManager->guiLanguage();
-	QString oldGUIStyle    = prefsManager->guiStyle();
+	QString oldUILanguage = prefsManager->uiLanguage();
+	QString oldUIStyle    = prefsManager->guiStyle();
 	bool oldShowPageShadow = prefsManager->showPageShadow();
-	int oldGUIFontSize     = prefsManager->guiFontSize();
+	int oldUIFontSize     = prefsManager->guiFontSize();
 	double oldDisplayScale = prefsManager->displayScale();
 	int oldImageQuality = prefsManager->applicationPrefs()->toolSettings.lowResType;
 
@@ -7601,25 +7601,25 @@
 	DocDir = prefsManager->documentDir();
 //		scrapbookPalette->rebuildView();
 //		scrapbookPalette->AdjustMenu();
-	QString newGUILanguage = prefsManager->guiLanguage();
-	if (oldGUILanguage != newGUILanguage || ScQApp->currGUILanguage()!=newGUILanguage)
-		ScQApp->changeGUILanguage(newGUILanguage);
-	QString newGUIStyle = prefsManager->guiStyle();
-	if (oldGUIStyle != newGUIStyle)
+	QString newUILanguage = prefsManager->uiLanguage();
+	if (oldUILanguage != newUILanguage || ScQApp->currGUILanguage()!=newUILanguage)
+		ScQApp->changeGUILanguage(newUILanguage);
+	QString newUIStyle = prefsManager->guiStyle();
+	if (oldUIStyle != newUIStyle)
 	{
-		if (newGUIStyle.isEmpty())
+		if (newUIStyle.isEmpty())
 			qApp->setStyle(prefsManager->guiSystemStyle());
 		else
-			qApp->setStyle(QStyleFactory::create(newGUIStyle));
+			qApp->setStyle(QStyleFactory::create(newUIStyle));
 		// Plain wrong, a style may set a palette different from the standard palette
 		// Eg : Windows XP and Windows Vista styles
 		// qApp->setPalette(qApp->style()->standardPalette());
 	}
-	int newGUIFontSize = prefsManager->guiFontSize();
-	if (oldGUIFontSize != newGUIFontSize)
+	int newUIFontSize = prefsManager->guiFontSize();
+	if (oldUIFontSize != newUIFontSize)
 	{
 		QFont apf = qApp->font();
-		apf.setPointSize(prefsManager->appPrefs.AppFontSize);
+		apf.setPointSize(prefsManager->appPrefs.ui_ApplicationFontSize);
 		qApp->setFont(apf);
 	}
 	propertiesPalette->Fonts->RebuildList(0);
Index: scribus/plugins/scriptplugin/pconsole.cpp
===================================================================
--- scribus/plugins/scriptplugin/pconsole.cpp	(revision 13869)
+++ scribus/plugins/scriptplugin/pconsole.cpp	(revision 13870)
@@ -87,7 +87,7 @@
 {
 	QFont font = QFont("Fixed");
 	font.setStyleHint(QFont::TypeWriter);
-	font.setPointSize(PrefsManager::instance()->appPrefs.AppFontSize);
+	font.setPointSize(PrefsManager::instance()->appPrefs.ui_ApplicationFontSize);
 	commandEdit->setFont(font);	
 	outputEdit->setFont(font);
 }
Index: scribus/plugins/scriptplugin/scriptercore.cpp
===================================================================
--- scribus/plugins/scriptplugin/scriptercore.cpp	(revision 13869)
+++ scribus/plugins/scriptplugin/scriptercore.cpp	(revision 13870)
@@ -112,7 +112,7 @@
 		menuMgr->removeMenuItem((*it), "RecentScripts");
 
 	scrRecentScriptActions.clear();
-	uint max = qMin(PrefsManager::instance()->appPrefs.RecentDCount, RecentScripts.count());
+	uint max = qMin(PrefsManager::instance()->appPrefs.ui_RecentDocCount, RecentScripts.count());
 	for (uint m = 0; m < max; ++m)
 	{
 		QString strippedName=RecentScripts[m];
@@ -129,7 +129,7 @@
 	scrRecentScriptActions.clear();
 	if (SavedRecentScripts.count() != 0)
 	{
-		uint max = qMin(PrefsManager::instance()->appPrefs.RecentDCount, SavedRecentScripts.count());
+		uint max = qMin(PrefsManager::instance()->appPrefs.ui_RecentDocCount, SavedRecentScripts.count());
 		for (uint m = 0; m < max; ++m)
 		{
 			QFileInfo fd(SavedRecentScripts[m]);
Index: scribus/latexhelpers.cpp
===================================================================
--- scribus/latexhelpers.cpp	(revision 13869)
+++ scribus/latexhelpers.cpp	(revision 13870)
@@ -286,7 +286,7 @@
 
 QString I18nXmlStreamReader::readI18nText(bool unindent)
 {
-	QString language = PrefsManager::instance()->guiLanguage();
+	QString language = PrefsManager::instance()->uiLanguage();
 	QString result;
 	int matchquality = 0;
 	bool i18n = false;




More information about the scribus-commit mailing list