r24787 by craig - #16705: Related.. select the top leve item to enable buttons. Rename

scribus-commit scribus-commit at lists.scribus.net
Tue Dec 28 16:25:32 UTC 2021


Author: craig
Date: Tue Dec 28 16:25:31 2021
New Revision: 24787

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24787
Log:
#16705: Related.. select the top leve item to enable buttons. Rename
some variables to more generic names

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/colorsandfills.cpp
    trunk/Scribus/scribus/ui/colorsandfills.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24787&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Tue Dec 28 16:25:31 2021
@@ -9160,27 +9160,27 @@
 
 void ScribusMainWindow::manageColorsAndFills()
 {
-	ColorList edc;
-	QHash<QString, VGradient> *Gradients;
-	QHash<QString, ScPattern> *docPatterns;
+	ColorList colorlist;
+	QHash<QString, VGradient> *gradients;
+	QHash<QString, ScPattern> *patterns;
 	ScribusDoc* tmpDoc;
 	if (HaveDoc)
 	{
-		Gradients = &doc->docGradients;
-		edc = doc->PageColors;
-		docPatterns = &doc->docPatterns;
+		gradients = &doc->docGradients;
+		colorlist = doc->PageColors;
+		patterns = &doc->docPatterns;
 		tmpDoc = doc;
 	}
 	else
 	{
-		Gradients = &m_prefsManager.appPrefs.defaultGradients;
-		edc = m_prefsManager.colorSet();
-		docPatterns = &m_prefsManager.appPrefs.defaultPatterns;
+		gradients = &m_prefsManager.appPrefs.defaultGradients;
+		colorlist = m_prefsManager.colorSet();
+		patterns = &m_prefsManager.appPrefs.defaultPatterns;
 		tmpDoc = m_doc;
 		doc = m_doc;
 	}
 	m_undoManager->setUndoEnabled(false);
-	ColorsAndFillsDialog *dia = new ColorsAndFillsDialog(this, Gradients, edc, m_prefsManager.colorSetName(), docPatterns, tmpDoc, this);
+	ColorsAndFillsDialog *dia = new ColorsAndFillsDialog(this, gradients, colorlist, m_prefsManager.colorSetName(), patterns, tmpDoc, this);
 	if (dia->exec())
 	{
 		if (HaveDoc)

Modified: trunk/Scribus/scribus/ui/colorsandfills.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24787&path=/trunk/Scribus/scribus/ui/colorsandfills.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorsandfills.cpp	(original)
+++ trunk/Scribus/scribus/ui/colorsandfills.cpp	Tue Dec 28 16:25:31 2021
@@ -68,15 +68,15 @@
 #include "util_color.h"
 #include "util_formats.h"
 
-ColorsAndFillsDialog::ColorsAndFillsDialog(QWidget* parent, QHash<QString, VGradient> *docGradients, const ColorList& doco, const QString& docColSet, QHash<QString, ScPattern> *docPatterns, ScribusDoc *doc, ScribusMainWindow *scMW)
-	                : QDialog(parent),
-	                  m_doc(doc),
-	                  mainWin(scMW)
+ColorsAndFillsDialog::ColorsAndFillsDialog(QWidget* parent, QHash<QString, VGradient> *gradients, const ColorList& colorlist, const QString& docColSet, QHash<QString, ScPattern> *patterns, ScribusDoc *doc, ScribusMainWindow *scMW)
+	: QDialog(parent),
+	m_doc(doc),
+	mainWin(scMW)
 {
 	setupUi(this);
 	setModal(true);
 
-	m_colorList = doco;
+	m_colorList = colorlist;
 
 	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
 	dataTree->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -85,21 +85,21 @@
 	colorItems->setText(0, tr("Solid Colors"));
 	gradientItems = new QTreeWidgetItem(dataTree);
 	gradientItems->setText(0, tr("Gradients"));
-	for (QHash<QString, VGradient>::Iterator it = docGradients->begin(); it != docGradients->end(); ++it)
+	for (QHash<QString, VGradient>::Iterator it = gradients->begin(); it != gradients->end(); ++it)
 	{
 		dialogGradients.insert(it.key(), it.value());
 		origNames.insert(it.key(), it.key());
 	}
-	origGradients = docGradients->keys();
+	origGradients = gradients->keys();
 
 	patternItems = new QTreeWidgetItem(dataTree);
 	patternItems->setText(0, tr("Patterns"));
-	for (QHash<QString, ScPattern>::Iterator it = docPatterns->begin(); it != docPatterns->end(); ++it)
+	for (QHash<QString, ScPattern>::Iterator it = patterns->begin(); it != patterns->end(); ++it)
 	{
 		dialogPatterns.insert(it.key(), it.value());
 		origNamesPatterns.insert(it.key(), it.key());
 	}
-	origPatterns = docPatterns->keys();
+	origPatterns = patterns->keys();
 
 	csm.findPaletteLocations();
 	systemSwatches = LoadColSet->addTopLevelItem( tr("Scribus Swatches"));
@@ -147,6 +147,8 @@
 	dataTree->expandItem(gradientItems);
 	dataTree->expandItem(patternItems);
 	dataTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
+	dataTree->setCurrentItem(dataTree->topLevelItem(0));
+	itemSelected(dataTree->currentItem());
 	connect(dataTree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(itemSelected(QTreeWidgetItem*)));
 	connect(dataTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(selEditColor(QTreeWidgetItem*)));
 	connect(dataTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged()));

Modified: trunk/Scribus/scribus/ui/colorsandfills.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24787&path=/trunk/Scribus/scribus/ui/colorsandfills.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorsandfills.h	(original)
+++ trunk/Scribus/scribus/ui/colorsandfills.h	Tue Dec 28 16:25:31 2021
@@ -40,7 +40,7 @@
 	Q_OBJECT
 
 	public:
-		ColorsAndFillsDialog(QWidget* parent, QHash<QString, VGradient> *docGradients, const ColorList& doco, const QString& docColSet, QHash<QString, ScPattern> *docPatterns, ScribusDoc *doc, ScribusMainWindow* scMW);
+		ColorsAndFillsDialog(QWidget* parent, QHash<QString, VGradient> *docGradients, const ColorList& colorlist, const QString& docColSet, QHash<QString, ScPattern> *docPatterns, ScribusDoc *doc, ScribusMainWindow* scMW);
 		~ColorsAndFillsDialog() {}
 
 		/*! \brief Returns the name of the current/selected color set.




More information about the scribus-commit mailing list