View Issue Details

IDProjectCategoryView StatusLast Update
0015553ScribusUser Interfacepublic2024-10-23 18:42
Reporterale Assigned Tonitramr  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.5.svn 
Target Version1.7.0Fixed in Version1.7.0.svn 
Summary0015553: [Patch] Indigo UI: Store the text palette's tab status in the preferences
DescriptionNow that we have a content palette that can be left open on the right side, I've felt the need of opening the text "tabs" I mostly need and find them open the next time I start Scribus.

Patch will follow soon.

Probably, it would be better to reduce the number of tabs and make the slimmer... but that's for a next step...
Tagspatch
PatchNo

Relationships

child of 0015914 closednitramr Indigo UI: Store the content / properties palette's panel collapsing status in the preferences 

Activities

ale

2019-01-24 21:06

manager   ~0045857

here the patch:
tabs-expanded.diff (5,636 bytes)   
diff --git a/scribus/ui/propertiespalette_text.cpp b/scribus/ui/propertiespalette_text.cpp
index 3e67a647d..b46b2d486 100644
--- a/scribus/ui/propertiespalette_text.cpp
+++ b/scribus/ui/propertiespalette_text.cpp
@@ -23,6 +23,9 @@ for which a new license (GPL+exception) is in place.
 #include "pageitem.h"
 #include "pageitem_table.h"
 #include "pageitem_textframe.h"
+#include "prefscontext.h"
+#include "prefsfile.h"
+#include "prefsmanager.h"
 #include "propertiespalette_utils.h"
 #include "propertywidget_advanced.h"
 #include "propertywidget_distance.h"
@@ -105,6 +108,8 @@ PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(paren
 	pathTextWidgets = new PropertyWidget_PathText(textTree);
 	pathTextItem = textTree->addItem(pathTextWidgets, tr("Path Text Properties"));

+	readPreferences();
+
 	languageChange();
 
	connect(lineSpacing   , SIGNAL(valueChanged(double)), this, SLOT(handleLineSpacing()));
@@ -125,6 +130,70 @@ PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(paren
 
 	m_haveItem = false;
 	setEnabled(false);
+	connect(textTree, &ScTreeWidget::currentChanged2, this, &PropertiesPalette_Text::writePreferencesExpandStatus);
+}
+
+void PropertiesPalette_Text::readPreferences()
+{
+	palettePrefs = PrefsManager::instance()->prefsFile->getContext("TextPalette");
+
+	textTree->setItemExpanded(colorWidgetsItem,
+		palettePrefs->getBool("colorsExpanded", false));
+
+	textTree->setItemExpanded(flopItem,
+		palettePrefs->getBool("firstLineExpanded", false));
+
+	textTree->setItemExpanded(orphanItem,
+		palettePrefs->getBool("orphansExpanded", false));
+
+	textTree->setItemExpanded(parEffectItem,
+		palettePrefs->getBool("paragraphEffectsExpanded", false));
+
+	textTree->setItemExpanded(distanceItem,
+		palettePrefs->getBool("columnsExpanded", false));
+
+	textTree->setItemExpanded(optMarginsItem,
+		palettePrefs->getBool("opticalMarginsExpanded", false));
+
+	textTree->setItemExpanded(hyphenationWidgetItem,
+		palettePrefs->getBool("hyphenationExpanded", false));
+
+	textTree->setItemExpanded(advancedWidgetsItem,
+		palettePrefs->getBool("advancedExpanded", false));
+
+	textTree->setItemExpanded(fontfeaturesWidgetItem,
+		palettePrefs->getBool("fontFeaturesExpanded", false));
+
+	textTree->setItemExpanded(pathTextItem,
+		palettePrefs->getBool("pathTextExpanded", false));
+}
+
+void PropertiesPalette_Text::writePreferencesExpandStatus(int item)
+{
+	palettePrefs = PrefsManager::instance()->prefsFile->getContext("TextPalette");
+
+	bool expanded{textTree->isItemExpanded(item)};
+
+	if (item == colorWidgetsItem)
+		palettePrefs->set("colorsExpanded", expanded);
+	else if (item == flopItem)
+		palettePrefs->set("firstLineExpanded", expanded);
+	else if (item == orphanItem)
+		palettePrefs->set("orphansExpanded", expanded);
+	else if (item == parEffectItem)
+		palettePrefs->set("paragraphEffectsExpanded", expanded);
+	else if (item == distanceItem)
+		palettePrefs->set("columnsExpanded", expanded);
+	else if (item == optMarginsItem)
+		palettePrefs->set("opticalMarginsExpanded", expanded);
+	else if (item == hyphenationWidgetItem)
+		palettePrefs->set("hyphenationExpanded", expanded);
+	else if (item == advancedWidgetsItem)
+		palettePrefs->set("advancedExpanded", expanded);
+	else if (item == fontfeaturesWidgetItem)
+		palettePrefs->set("fontFeaturesExpanded", expanded);
+	else if (item == pathTextItem)
+		palettePrefs->set("pathTextExpanded", expanded);
 }
 
 void PropertiesPalette_Text::setMainWindow(ScribusMainWindow* mw)
diff --git a/scribus/ui/propertiespalette_text.h b/scribus/ui/propertiespalette_text.h
index 7d78d60f9..3d623fda6 100644
--- a/scribus/ui/propertiespalette_text.h
+++ b/scribus/ui/propertiespalette_text.h
@@ -16,6 +16,7 @@ for which a new license (GPL+exception) is in place.
 #include "scguardedptr.h"
 #include "sctextstruct.h"
 
+class PrefsContext;
 class PageItem;
 class PropertyWidget_Advanced;
 class PropertyWidget_Distance;
@@ -62,6 +63,8 @@ protected:
 
 private:
 	PageItem* currentItemFromSelection();
+	void readPreferences();
+	PrefsContext* palettePrefs;
 	
 public slots:
 	void setMainWindow(ScribusMainWindow *mw);
@@ -114,6 +117,8 @@ private slots:
 	void doClearCStyle();
 	void doClearPStyle();
 
+	void writePreferencesExpandStatus(int item);
+
 protected:
 	PropertyWidget_Advanced* advancedWidgets;
 	PropertyWidget_Distance* distanceWidgets;
diff --git a/scribus/ui/sctreewidget.cpp b/scribus/ui/sctreewidget.cpp
index 175df5ae0..bce8a207a 100644
--- a/scribus/ui/sctreewidget.cpp
+++ b/scribus/ui/sctreewidget.cpp
@@ -168,6 +168,20 @@ QWidget* ScTreeWidget::widget(int index)
 	return itemWidget(child, 0);
 }
 
+void ScTreeWidget::setItemExpanded(int index, bool expanded)
+{
+	if ((index < 0) || (index >= topLevelItemCount()))
+		return;
+	topLevelItem(index)->setExpanded(expanded);
+}
+
+bool ScTreeWidget::isItemExpanded(int index)
+{
+	if ((index < 0) || (index >= topLevelItemCount()))
+		return false;
+	topLevelItem(index)->isExpanded();
+}
+
 void ScTreeWidget::setItemEnabled(int index, bool enable)
 {
 	if ((index < 0) || (index >= topLevelItemCount()))
diff --git a/scribus/ui/sctreewidget.h b/scribus/ui/sctreewidget.h
index 823673a6a..3dd8f64a0 100644
--- a/scribus/ui/sctreewidget.h
+++ b/scribus/ui/sctreewidget.h
@@ -55,6 +55,8 @@ public:
 	void setToolBoxMode(bool enable);
 	int addItem(QWidget* widget, const QString& title);
 	QWidget* widget(int index);
+	void setItemExpanded(int index, bool enable);
+	bool isItemExpanded(int index);
 	void setItemEnabled(int index, bool enable);
 	bool isItemEnabled(int index);
 	void setCurrentIndex(int index);
tabs-expanded.diff (5,636 bytes)   

Issue History

Date Modified Username Field Change
2019-01-24 20:20 ale New Issue
2019-01-24 21:06 ale File Added: tabs-expanded.diff
2019-01-24 21:06 ale Note Added: 0045857
2019-01-24 21:07 ale Tag Attached: patch
2019-01-24 21:07 ale Summary Store the text palette's tab status in the preferences => [Patch] Store the text palette's tab status in the preferences
2019-11-05 07:42 ale Summary [Patch] Store the text palette's tab status in the preferences => [Patch] Inidgo UI: Store the text palette's tab status in the preferences
2019-11-05 07:43 ale Summary [Patch] Inidgo UI: Store the text palette's tab status in the preferences => [Patch] Indigo UI: Store the text palette's tab status in the preferences
2019-11-05 07:49 ale Relationship added child of 0015914
2024-10-22 14:47 nitramr Assigned To => nitramr
2024-10-22 14:47 nitramr Status new => resolved
2024-10-22 14:47 nitramr Resolution open => fixed
2024-10-22 14:47 nitramr Fixed in Version => 1.7.0.svn
2024-10-22 14:47 nitramr Target Version => 1.7.0
2024-10-23 18:42 cbradney Status resolved => closed