r24513 by jghali - #16479 follow-up: remove support for setting story editor background color and let story editor follow current theme

scribus-commit scribus-commit at lists.scribus.net
Sat Feb 20 17:49:27 UTC 2021


Author: jghali
Date: Sat Feb 20 17:49:27 2021
New Revision: 24513

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24513
Log:
#16479 follow-up: remove support for setting story editor background color and let story editor follow current theme

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

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Sat Feb 20 17:49:27 2021
@@ -392,9 +392,9 @@
 	appPrefs.extToolPrefs.gs_exe = getGSDefaultExeName();
 	appPrefs.extToolPrefs.gs_Resolution = 72;
 
-	// Do not override default text background color in story editor unless user has explicitly modified it.
-	// To do that, we initialize text background color to an invalid color and test its validity in the code. 
-	appPrefs.storyEditorPrefs.guiFontColorBackground = QColor() /*qApp->palette().color(QPalette::Active, QPalette::Base)*/;
+	// Keep SE background color for now, we still load this value and save it in prefs
+	// so as not to break prefs for user also using older versions of Scribus
+	appPrefs.storyEditorPrefs.guiFontColorBackground = QColor();
 	appPrefs.storyEditorPrefs.smartTextSelection = false;
 
 	appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.clear();

Modified: trunk/Scribus/scribus/prefsstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/prefsstructs.h
==============================================================================
--- trunk/Scribus/scribus/prefsstructs.h	(original)
+++ trunk/Scribus/scribus/prefsstructs.h	Sat Feb 20 17:49:27 2021
@@ -401,7 +401,7 @@
 
 struct StoryEditorPrefs
 {
-	QColor guiFontColorBackground; //! Color of the background for text used in the Story Editor window
+	QColor guiFontColorBackground; //! Legacy, kept for now so as to not break prefs for users using older Scribus versions
 	QString guiFont; //! Font of the text used in the Story Editor window
 	bool smartTextSelection; //! Use smart text selection (relates to spacing mostly)
 };

Modified: trunk/Scribus/scribus/ui/prefs_userinterface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/ui/prefs_userinterface.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterface.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_userinterface.cpp	Sat Feb 20 17:49:27 2021
@@ -53,7 +53,6 @@
 
 	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() = default;
@@ -108,18 +107,11 @@
 	storyEditorUseSmartSelectionCheckBox->setChecked(prefsData->storyEditorPrefs.smartTextSelection);
 	seFont.fromString(prefsData->storyEditorPrefs.guiFont);
 	storyEditorFontPushButton->setText(seFont.family());
-	QPixmap pm(100, 30);
-	QColor backgroundColor = prefsData->storyEditorPrefs.guiFontColorBackground;
-	if (!backgroundColor.isValid())
-		backgroundColor = this->palette().color(QPalette::Active, QPalette::Base);
-	pm.fill(backgroundColor);
-	seFontColor = prefsData->storyEditorPrefs.guiFontColorBackground;
-	storyEditorFontColorPushButton->setIcon(pm);
 }
 
 void Prefs_UserInterface::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
 {
-	prefsData->uiPrefs.language=selectedGUILang;
+	prefsData->uiPrefs.language = selectedGUILang;
 	prefsData->uiPrefs.userPreferredLocale = numberFormatComboBox->currentData().toString();
 	prefsData->uiPrefs.style = themeComboBox->currentText();
 	prefsData->uiPrefs.iconSet = IconManager::instance().baseNameForTranslation(iconSetComboBox->currentText());
@@ -134,34 +126,13 @@
 	prefsData->uiPrefs.useSmallWidgets = useSmallWidgetsCheckBox->isChecked();
 
 	prefsData->storyEditorPrefs.guiFont = seFont.toString();
-	if (seFontColor.isValid())
-		prefsData->storyEditorPrefs.guiFontColorBackground = seFontColor;
 	prefsData->storyEditorPrefs.smartTextSelection = storyEditorUseSmartSelectionCheckBox->isChecked();
 }
-
 
 void Prefs_UserInterface::setSelectedGUILang(const QString &newLang)
 {
 	selectedGUILang = LanguageManager::instance()->getAbbrevFromLang(newLang);
 }
-
-
-void Prefs_UserInterface::changeStoryEditorFontColor()
-{
-	QColor fontBkgndColor = seFontColor;
-	if (!fontBkgndColor.isValid())
-		fontBkgndColor = this->palette().color(QPalette::Active, QPalette::Base);
-
-	QColor newColor(QColorDialog::getColor(fontBkgndColor, this));
-	if (!newColor.isValid())
-		return;
-
-	QPixmap pm(100, 30);
-	pm.fill(newColor);
-	seFontColor = newColor;
-	storyEditorFontColorPushButton->setIcon(pm);
-}
-
 
 void Prefs_UserInterface::changeStoryEditorFont()
 {

Modified: trunk/Scribus/scribus/ui/prefs_userinterface.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/ui/prefs_userinterface.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterface.h	(original)
+++ trunk/Scribus/scribus/ui/prefs_userinterface.h	Sat Feb 20 17:49:27 2021
@@ -34,13 +34,11 @@
 
 	protected:
 		QString selectedGUILang;
-		QColor seFontColor;
 		QFont seFont;
 
 	private slots:
 		void setSelectedGUILang( const QString &newLang );
 		void changeStoryEditorFont();
-		void changeStoryEditorFontColor();
 };
 
 #endif // PREFS_USERINTERFACE_H

Modified: trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui	(original)
+++ trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui	Sat Feb 20 17:49:27 2021
@@ -11,24 +11,24 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string notr="true">Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <property name="leftMargin">
-    <number>0</number>
-   </property>
-   <property name="topMargin">
-    <number>0</number>
-   </property>
-   <property name="rightMargin">
-    <number>0</number>
-   </property>
-   <property name="bottomMargin">
-    <number>0</number>
-   </property>
-   <item>
-    <widget class="QLabel" name="titleLabel">
-     <property name="font">
+   <string notr="true">Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="titleLabel">
+     <property name="font">
       <font>
        <pointsize>14</pointsize>
        <weight>75</weight>
@@ -313,21 +313,7 @@
            </property>
           </widget>
          </item>
-         <item row="1" column="0">
-          <widget class="QLabel" name="storyEditorFontColorLabel">
-           <property name="text">
-            <string>Background Color:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="1">
-          <widget class="QPushButton" name="storyEditorFontColorPushButton">
-           <property name="text">
-            <string/>
-           </property>
-          </widget>
-         </item>
-         <item row="2" column="1">
+         <item row="1" column="1">
           <widget class="QCheckBox" name="storyEditorUseSmartSelectionCheckBox">
            <property name="text">
             <string>Use Smart Text Selection</string>
@@ -463,7 +449,6 @@
   <tabstop>fontSizeMenuSpinBox</tabstop>
   <tabstop>fontSizePaletteSpinBox</tabstop>
   <tabstop>storyEditorFontPushButton</tabstop>
-  <tabstop>storyEditorFontColorPushButton</tabstop>
   <tabstop>storyEditorUseSmartSelectionCheckBox</tabstop>
   <tabstop>resizeMoveDelaySpinBox</tabstop>
   <tabstop>wheelJumpSpinBox</tabstop>

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp	Sat Feb 20 17:49:27 2021
@@ -1718,13 +1718,11 @@
 	connect(seActions["insertSampleText"], SIGNAL(triggered()), this, SLOT(insertSampleText()));
 
 	//Settings Menu
-	seActions.insert("settingsBackground", new ScrAction("", QKeySequence(), this));
 	seActions.insert("settingsDisplayFont", new ScrAction("", QKeySequence(), this));
 	seActions.insert("settingsSmartTextSelection", new ScrAction("", QKeySequence(), this));
 	seActions["settingsSmartTextSelection"]->setChecked(m_smartSelection);
 	seActions["settingsSmartTextSelection"]->setToggleAction(true);
 
-	connect( seActions["settingsBackground"], SIGNAL(triggered()), this, SLOT(setBackPref()) );
 	connect( seActions["settingsDisplayFont"], SIGNAL(triggered()), this, SLOT(setFontPref()) );
 	connect( seActions["settingsSmartTextSelection"], SIGNAL(toggled(bool)), this, SLOT(setSmart(bool)) );
 
@@ -1838,7 +1836,6 @@
 	seMenuMgr->addMenuItemString("insertSampleText", "Insert");
 
 	seMenuMgr->createMenu("Settings", tr("&Settings"));
-	seMenuMgr->addMenuItemString("settingsBackground", "Settings");
 	seMenuMgr->addMenuItemString("settingsDisplayFont", "Settings");
 //	seMenuMgr->addMenuItemString("settingsSmartTextSelection", "Settings");
 
@@ -2000,15 +1997,6 @@
 	QFont fo;
 	fo.fromString(prefsManager.appPrefs.storyEditorPrefs.guiFont);
 	Editor->setFont(fo);
-	QColor newColor(prefsManager.appPrefs.storyEditorPrefs.guiFontColorBackground);
-	if (newColor.isValid())
-	{
-		QPalette pal;
-		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());
 }
@@ -2066,7 +2054,6 @@
 
 	//Settings Menu
 	seMenuMgr->setText("Settings", tr("&Settings"));
-	seActions["settingsBackground"]->setTexts( tr("&Background..."));
 	seActions["settingsDisplayFont"]->setTexts( tr("&Display Font..."));
 	seActions["settingsSmartTextSelection"]->setTexts( tr("&Smart Text Selection"));
 
@@ -2294,22 +2281,6 @@
 		}
 	}
 	return QMainWindow::eventFilter(ob, ev);
-}
-
-void StoryEditor::setBackPref()
-{
-	m_blockUpdate = true;
-	QColor newColor(QColorDialog::getColor(Editor->palette().color(QPalette::Base), this));
-	if (newColor.isValid())
-	{
-		QPalette pal;
-		pal.setColor(QPalette::Active, QPalette::Base, newColor);
-		pal.setColor(QPalette::Inactive, QPalette::Base, newColor);
-		pal.setColor(QPalette::Disabled, QPalette::Base, newColor);
-		Editor->setPalette(pal);
-		prefsManager.appPrefs.storyEditorPrefs.guiFontColorBackground = newColor;
-	}
-	m_blockUpdate = false;
 }
 
 void StoryEditor::setFontPref()

Modified: trunk/Scribus/scribus/ui/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24513&path=/trunk/Scribus/scribus/ui/storyeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.h	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.h	Sat Feb 20 17:49:27 2021
@@ -459,7 +459,6 @@
 	int m_result { QDialog::Rejected };
 
 protected slots:
-	void setBackPref();
 	void setFontPref();
 	void newTxScale();
 	void newTxScaleV();




More information about the scribus-commit mailing list