r14823 by cbradney - #6019: Make Story Editor settings available in the new Preferences window

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 25 22:30:33 CET 2010


Revision: 14823
Author: cbradney
Date: 2010-02-25T21:24:20.747042Z
Commit message: #6019: Make Story Editor settings available in the new Preferences window

Changeset: 
M  /trunk/Scribus/scribus/prefsmanager.cpp
M  /trunk/Scribus/scribus/ui/prefs_userinterface.cpp
M  /trunk/Scribus/scribus/prefsstructs.h
M  /trunk/Scribus/scribus/ui/prefs_userinterface.h
M  /trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
M  /trunk/Scribus/scribus/ui/storyeditor.cpp

Diffs:
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 14822)
+++ scribus/prefsmanager.cpp	(revision 14823)
@@ -369,7 +369,8 @@
 	appPrefs.extToolPrefs.gs_AntiAliasText = true;
 	appPrefs.extToolPrefs.gs_exe = getGSDefaultExeName();
 	appPrefs.extToolPrefs.gs_Resolution = 72;
-	appPrefs.storyEditorPrefs.guiFontColor = QColor(Qt::white);
+	appPrefs.storyEditorPrefs.guiFontColorBackground = QColor(Qt::white);
+	appPrefs.storyEditorPrefs.smartTextSelection=false;
 	appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = "";
 	appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = "";
 	appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = "";
@@ -1273,8 +1274,6 @@
 	dc.setAttribute("ScratchTop", appPrefs.displayPrefs.scratch.Top);
 	dc.setAttribute("GapHorizontal", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapHorizontal));
 	dc.setAttribute("GapVertical", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapVertical));
-	dc.setAttribute("STECOLOR", appPrefs.storyEditorPrefs.guiFontColor.name());
-	dc.setAttribute("STEFONT", appPrefs.storyEditorPrefs.guiFont);
 	dc.setAttribute("STYLEPREVIEW", static_cast<int>(appPrefs.miscPrefs.haveStylePreview));
 	dc.setAttribute("UI_SHOWSTARTUPDIALOG", static_cast<int>(appPrefs.uiPrefs.showStartupDialog));
 	dc.setAttribute("UI_SHOWSPLASHSCREEN", static_cast<int>(appPrefs.uiPrefs.showSplashOnStartup));
@@ -1284,6 +1283,11 @@
 	dc.setAttribute("showMouseCoordinates", static_cast<int>(appPrefs.displayPrefs.showMouseCoordinates));
 	dc.setAttribute("stickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools));
 	elem.appendChild(dc);
+	QDomElement deSE=docu.createElement("StoryEditor");
+	deSE.setAttribute("Font",appPrefs.storyEditorPrefs.guiFont);
+	deSE.setAttribute("FontColorBackground",appPrefs.storyEditorPrefs.guiFontColorBackground.name());
+	deSE.setAttribute("SmartTextSelection",static_cast<int>(appPrefs.storyEditorPrefs.smartTextSelection));
+	elem.appendChild(deSE);
 	QDomElement dc1=docu.createElement("GRID");
 	dc1.setAttribute("MINOR",ScCLocale::toQStringC(appPrefs.guidesPrefs.minorGridSpacing));
 	dc1.setAttribute("MAJOR",ScCLocale::toQStringC(appPrefs.guidesPrefs.majorGridSpacing));
@@ -1873,14 +1877,16 @@
 			appPrefs.displayPrefs.scratch.Top    = ScCLocale::toDoubleC(dc.attribute("ScratchTop"), 20.0);
 			appPrefs.displayPrefs.pageGapHorizontal  = ScCLocale::toDoubleC(dc.attribute("GapHorizontal"), 0.0);
 			appPrefs.displayPrefs.pageGapVertical    = ScCLocale::toDoubleC(dc.attribute("GapVertical"), 40.0);
-			if (dc.hasAttribute("STECOLOR"))
-				appPrefs.storyEditorPrefs.guiFontColor = QColor(dc.attribute("STECOLOR"));
-			if (dc.hasAttribute("STEFONT"))
-				appPrefs.storyEditorPrefs.guiFont = dc.attribute("STEFONT");
 			appPrefs.displayPrefs.showToolTips = static_cast<bool>(dc.attribute("ToolTips", "1").toInt());
 			appPrefs.displayPrefs.showMouseCoordinates = static_cast<bool>(dc.attribute("showMouseCoordinates", "1").toInt());
 			appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("stickyTools", "0").toInt());
 		}
+		if (dc.tagName()=="StoryEditor")
+		{
+			appPrefs.storyEditorPrefs.guiFont  = dc.attribute("Font","");
+			appPrefs.storyEditorPrefs.guiFontColorBackground  = QColor(dc.attribute("FontColorBackground", "#FFFFFF"));
+			appPrefs.storyEditorPrefs.smartTextSelection = static_cast<bool>(dc.attribute("SmartTextSelection", "0").toInt());
+		}
 		if (dc.tagName()=="GRID")
 		{
 			appPrefs.guidesPrefs.minorGridSpacing  = ScCLocale::toDoubleC(dc.attribute("MINOR"), 20.0);
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(revision 14822)
+++ scribus/prefsstructs.h	(revision 14823)
@@ -327,8 +327,9 @@
 
 struct StoryEditorPrefs
 {
-	QColor guiFontColor; //! Color of the text used in the Story Editor window
+	QColor guiFontColorBackground; //! Color of the background for text used in the Story Editor window
 	QString guiFont; //! Font of the text used in the Story Editor window
+	bool smartTextSelection; //! Use smart text selection (relates to spacing mostly)
 };
 
 struct PrintPreviewPrefs
Index: scribus/ui/prefs_userinterface.h
===================================================================
--- scribus/ui/prefs_userinterface.h	(revision 14822)
+++ scribus/ui/prefs_userinterface.h	(revision 14823)
@@ -8,6 +8,10 @@
 #ifndef PREFS_USERINTERFACE_H
 #define PREFS_USERINTERFACE_H
 
+#include <QColor>
+#include <QFont>
+#include <QString>
+
 #include "ui_prefs_userinterfacebase.h"
 #include "prefs_pane.h"
 #include "scribusapi.h"
@@ -27,10 +31,13 @@
 
 	protected:
 		QString selectedGUILang;
+		QColor seFontColor;
+		QFont seFont;
 
 	private slots:
 		void setSelectedGUILang( const QString &newLang );
-
+		void changeStoryEditorFont();
+		void changeStoryEditorFontColor();
 };
 
 #endif // PREFS_USERINTERFACE_H
Index: scribus/ui/storyeditor.cpp
===================================================================
--- scribus/ui/storyeditor.cpp	(revision 14822)
+++ scribus/ui/storyeditor.cpp	(revision 14823)
@@ -1658,8 +1658,7 @@
 	seActions.insert("settingsBackground", new ScrAction("", QKeySequence(), this));
 	seActions.insert("settingsDisplayFont", new ScrAction("", QKeySequence(), this));
 	seActions.insert("settingsSmartTextSelection", new ScrAction("", QKeySequence(), this));
-	smartSelection = false;
-	seActions["settingsSmartTextSelection"]->setChecked(false);
+	seActions["settingsSmartTextSelection"]->setChecked(smartSelection);
 	seActions["settingsSmartTextSelection"]->setToggleAction(true);
 
 	connect( seActions["settingsBackground"], SIGNAL(triggered()), this, SLOT(setBackPref()) );
@@ -1780,6 +1779,7 @@
 {
 	unicodeCharActionNames.clear();
 	seActions.clear();
+	smartSelection=prefsManager->appPrefs.storyEditorPrefs.smartTextSelection;
 	initActions();
 	ActionManager::initUnicodeActions(&seActions, this, &unicodeCharActionNames);
 	seActions["unicodeSmartHyphen"]->setEnabled(false);//CB TODO doesnt work in SE yet.
@@ -1913,6 +1913,12 @@
 	QFont fo;
 	fo.fromString(prefsManager->appPrefs.storyEditorPrefs.guiFont);
 	Editor->setFont(fo);
+	QPalette pal;
+	QColor newColor(prefsManager->appPrefs.storyEditorPrefs.guiFontColorBackground);
+	pal.setColor(QPalette::Active, QPalette::Base, newColor);
+	pal.setColor(QPalette::Inactive, QPalette::Base, newColor);
+	pal.setColor(QPalette::Disabled, QPalette::Base, newColor);
+	Editor->setPalette(pal);
 	EditorBar->setFrameStyle(Editor->frameStyle());
 	EditorBar->setLineWidth(Editor->lineWidth());
 	EditorBar->editor = Editor;
@@ -2196,7 +2202,7 @@
 		pal.setColor(QPalette::Inactive, QPalette::Base, newColor);
 		pal.setColor(QPalette::Disabled, QPalette::Base, newColor);
 		Editor->setPalette(pal);
-		prefsManager->appPrefs.storyEditorPrefs.guiFontColor = newColor;
+		prefsManager->appPrefs.storyEditorPrefs.guiFontColorBackground = newColor;
 	}
 	blockUpdate = false;
 }
Index: scribus/ui/prefs_userinterface.cpp
===================================================================
--- scribus/ui/prefs_userinterface.cpp	(revision 14822)
+++ scribus/ui/prefs_userinterface.cpp	(revision 14823)
@@ -5,6 +5,9 @@
 for which a new license (GPL+exception) is in place.
 */
 
+#include <QColorDialog>
+#include <QFontDialog>
+#include <QPixmap>
 #include <QStyleFactory>
 
 #include "langmgr.h"
@@ -31,7 +34,8 @@
 		themeComboBox->addItem(styleList[i]);
 
 	connect(languageComboBox, SIGNAL(activated(const QString &)), this, SLOT(setSelectedGUILang(const QString &)));
-
+	connect(storyEditorFontPushButton, SIGNAL(clicked()), this, SLOT(changeStoryEditorFont()));
+	connect(storyEditorFontColorPushButton, SIGNAL(clicked()), this, SLOT(changeStoryEditorFontColor()));
 }
 
 Prefs_UserInterface::~Prefs_UserInterface()
@@ -67,6 +71,14 @@
 	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());
+	QPixmap pm(100, 30);
+	pm.fill(prefsData->storyEditorPrefs.guiFontColorBackground);
+	seFontColor = prefsData->storyEditorPrefs.guiFontColorBackground;
+	storyEditorFontColorPushButton->setIcon(pm);
 }
 
 void Prefs_UserInterface::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
@@ -82,6 +94,10 @@
 	prefsData->uiPrefs.useTabs=useTabsForDocumentsCheckBox->isChecked();
 	prefsData->uiPrefs.showSplashOnStartup=showSplashCheckBox->isChecked();
 	prefsData->uiPrefs.useSmallWidgets=useSmallWidgetsCheckBox->isChecked();
+
+	prefsData->storyEditorPrefs.guiFont=seFont.toString();
+	prefsData->storyEditorPrefs.guiFontColorBackground=seFontColor;
+	prefsData->storyEditorPrefs.smartTextSelection=storyEditorUseSmartSelectionCheckBox->isChecked();
 }
 
 
@@ -90,3 +106,26 @@
 	selectedGUILang = LanguageManager::instance()->getAbbrevFromLang(newLang);
 }
 
+
+void Prefs_UserInterface::changeStoryEditorFontColor()
+{
+	QColor newColor(QColorDialog::getColor(seFontColor, this));
+	if (newColor.isValid())
+	{
+		QPixmap pm(100, 30);
+		pm.fill(newColor);
+		seFontColor = newColor;
+		storyEditorFontColorPushButton->setIcon(pm);
+	}
+}
+
+void Prefs_UserInterface::changeStoryEditorFont()
+{
+	bool ok;
+	QFont newFont(QFontDialog::getFont( &ok, seFont, this ));
+	if (ok)
+	{
+		seFont = newFont;
+		storyEditorFontPushButton->setText(seFont.family());
+	}
+}
Index: scribus/ui/prefs_userinterfacebase.ui
===================================================================
--- scribus/ui/prefs_userinterfacebase.ui	(revision 14822)
+++ scribus/ui/prefs_userinterfacebase.ui	(revision 14823)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>811</width>
-    <height>714</height>
+    <width>808</width>
+    <height>468</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -36,20 +36,15 @@
     </widget>
    </item>
    <item>
-    <widget class="QScrollArea" name="scrollArea">
-     <property name="widgetResizable">
-      <bool>true</bool>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>0</number>
      </property>
-     <widget class="QWidget" name="scrollAreaWidgetContents">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>783</width>
-        <height>643</height>
-       </rect>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout">
+     <widget class="QWidget" name="tab_3">
+      <attribute name="title">
+       <string>Main Window</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
        <item>
         <widget class="QLabel" name="label">
          <property name="font">
@@ -286,43 +281,81 @@
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
          <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
-           <height>20</height>
+           <height>40</height>
           </size>
          </property>
         </spacer>
        </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_4">
+      <attribute name="title">
+       <string>Story Editor</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_5">
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_11">
-         <item>
-          <widget class="QLabel" name="label_4">
-           <property name="font">
-            <font>
-             <pointsize>13</pointsize>
-             <weight>75</weight>
-             <bold>true</bold>
-            </font>
+        <layout class="QFormLayout" name="formLayout_3">
+         <item row="0" column="0">
+          <widget class="QLabel" name="storyEditorFontLabel">
+           <property name="text">
+            <string>Font:</string>
            </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QPushButton" name="storyEditorFontPushButton">
            <property name="text">
-            <string>Interactivity</string>
+            <string/>
            </property>
           </widget>
          </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="storyEditorFontColorLabel">
+           <property name="text">
+            <string>Font Color:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QPushButton" name="storyEditorFontColorPushButton">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>
-        <widget class="Line" name="line_4">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+        <widget class="QCheckBox" name="storyEditorUseSmartSelectionCheckBox">
+         <property name="text">
+          <string>Use Smart Text Selection</string>
          </property>
         </widget>
        </item>
        <item>
+        <spacer name="verticalSpacer_5">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>251</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab">
+      <attribute name="title">
+       <string>Interactivity</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
         <layout class="QHBoxLayout" name="horizontalLayout_5">
          <item>
           <widget class="QLabel" name="resizeMoveDelayLabel">
@@ -394,39 +427,22 @@
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
          <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
-           <height>20</height>
+           <height>266</height>
           </size>
          </property>
         </spacer>
        </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_5">
+      <attribute name="title">
+       <string>Start Up</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
        <item>
-        <widget class="QLabel" name="label_3">
-         <property name="font">
-          <font>
-           <pointsize>13</pointsize>
-           <weight>75</weight>
-           <bold>true</bold>
-          </font>
-         </property>
-         <property name="text">
-          <string>Startup</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="Line" name="line_3">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-        </widget>
-       </item>
-       <item>
         <widget class="QCheckBox" name="showSplashCheckBox">
          <property name="text">
           <string>Show Splashscreen</string>
@@ -448,7 +464,7 @@
          <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
-           <height>263</height>
+           <height>296</height>
           </size>
          </property>
         </spacer>




More information about the scribus-commit mailing list