r24539 by jghali - Code cleanup and refactoring

scribus-commit scribus-commit at lists.scribus.net
Tue Mar 2 11:38:41 UTC 2021


Author: jghali
Date: Tue Mar  2 11:38:41 2021
New Revision: 24539

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24539
Log:
Code cleanup and refactoring

Modified:
    trunk/Scribus/scribus/ui/smpstylewidget.cpp
    trunk/Scribus/scribus/ui/smtabruler.cpp
    trunk/Scribus/scribus/ui/smtabruler.h
    trunk/Scribus/scribus/ui/smtextstyles.cpp

Modified: trunk/Scribus/scribus/ui/smpstylewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24539&path=/trunk/Scribus/scribus/ui/smpstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.cpp	(original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.cpp	Tue Mar  2 11:38:41 2021
@@ -113,9 +113,9 @@
 {
 	retranslateUi(this);
 	alignment->languageChange();
-	tabList->first_->setToolTip( tr("First Line Indent"));
-	tabList->left_->setToolTip(  tr("Left Indent"));
-	tabList->right_->setToolTip( tr("Right Indent"));
+	tabList->firstLineSpin->setToolTip( tr("First Line Indent"));
+	tabList->leftIndentSpin->setToolTip(  tr("Left Indent"));
+	tabList->rightIndentSpin->setToolTip( tr("Right Indent"));
 
 	int  oldLineSpacingModeIndex = lineSpacingMode->currentIndex();
 	bool lineSpacingModeBlocked = lineSpacingMode->blockSignals(true);
@@ -938,7 +938,7 @@
 	if (l < -3800.0)
 	{
 		tabList->setLeftIndentValue(0.0);
-		tabList->left_->clear();
+		tabList->leftIndentSpin->clear();
 	}
 	else
 		tabList->setLeftIndentValue(l * unitRatio);
@@ -956,7 +956,7 @@
 	if (l < -3800.0)
 	{
 		tabList->setFirstLineValue(0.0);
-		tabList->first_->clear();
+		tabList->firstLineSpin->clear();
 	}
 	else
 		tabList->setFirstLineValue(l * unitRatio);
@@ -974,7 +974,7 @@
 	if (l < -3800.0)
 	{
 		tabList->setRightIndentData(0.0);
-		tabList->right_->clear();
+		tabList->rightIndentSpin->clear();
 	}
 	else
 		tabList->setRightIndentValue(l * unitRatio);

Modified: trunk/Scribus/scribus/ui/smtabruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24539&path=/trunk/Scribus/scribus/ui/smtabruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtabruler.cpp	(original)
+++ trunk/Scribus/scribus/ui/smtabruler.cpp	Tue Mar  2 11:38:41 2021
@@ -5,6 +5,7 @@
 for which a new license (GPL+exception) is in place.
 */
 #include <QToolButton>
+#include <QSignalBlocker>
 
 #include "smtabruler.h"
 #include "smscrspinbox.h"
@@ -23,35 +24,35 @@
 	f.setBold(true);
 	m_parentButton->setFont(f);
 	connect(m_parentButton, SIGNAL(clicked()), this, SLOT(pbClicked()));
-	first_ = new SMScrSpinBox(-3000, 4000, this, dEin);
-	Q_CHECK_PTR(first_);
-	left_ = new SMScrSpinBox(0, 4000, this, dEin);
-	Q_CHECK_PTR(left_);
-	right_ = new SMScrSpinBox(0, 4000, this, dEin);
-	Q_CHECK_PTR(right_);
+	firstLineSpin = new SMScrSpinBox(-3000, 4000, this, dEin);
+	Q_CHECK_PTR(firstLineSpin);
+	leftIndentSpin = new SMScrSpinBox(0, 4000, this, dEin);
+	Q_CHECK_PTR(leftIndentSpin);
+	rightIndentSpin = new SMScrSpinBox(0, 4000, this, dEin);
+	Q_CHECK_PTR(rightIndentSpin);
 
 	indentLayout->removeWidget(firstLineData);
 	firstLineData->hide();
-	indentLayout->insertWidget(1, first_);
-	first_->show();
+	indentLayout->insertWidget(1, firstLineSpin);
+	firstLineSpin->show();
 
 	layout4->removeWidget(leftIndentData);
 	leftIndentData->hide();
-	layout4->insertWidget(1, left_);
-	left_->show();
+	layout4->insertWidget(1, leftIndentSpin);
+	leftIndentSpin->show();
 
 	indentLayout->removeWidget(rightIndentData);
 	rightIndentData->hide();
-	indentLayout->insertWidget(3, right_);
-	right_->show();
+	indentLayout->insertWidget(3, rightIndentSpin);
+	rightIndentSpin->show();
 
 	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
 	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
 	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
 
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	connect(firstLineSpin, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
+	connect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
+	connect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::unitChange(int unitIndex)
@@ -60,19 +61,19 @@
 	Tabruler::setTabs(ruler->tabValues, unitIndex);
 	Tabruler::repaint();
 
-	first_->blockSignals(true);
-	left_->blockSignals(true);
-	right_->blockSignals(true);
+	firstLineSpin->blockSignals(true);
+	leftIndentSpin->blockSignals(true);
+	rightIndentSpin->blockSignals(true);
 	tabData->blockSignals(true);
 
-	first_->setNewUnit(unitIndex);
-	left_->setNewUnit(unitIndex);
-	right_->setNewUnit(unitIndex);
+	firstLineSpin->setNewUnit(unitIndex);
+	leftIndentSpin->setNewUnit(unitIndex);
+	rightIndentSpin->setNewUnit(unitIndex);
 	tabData->setNewUnit(unitIndex);
 
-	first_->blockSignals(false);
-	left_->blockSignals(false);
-	right_->blockSignals(false);
+	firstLineSpin->blockSignals(false);
+	leftIndentSpin->blockSignals(false);
+	rightIndentSpin->blockSignals(false);
 	tabData->blockSignals(false);
 
 	m_unitIndex = unitIndex;
@@ -87,9 +88,9 @@
 	m_parentButton->hide();
 	Tabruler::setTabs(Tabs, unitIndex);
 	Tabruler::repaint();
-	first_->setNewUnit(unitIndex);
-	left_->setNewUnit(unitIndex);
-	right_->setNewUnit(unitIndex);
+	firstLineSpin->setNewUnit(unitIndex);
+	leftIndentSpin->setNewUnit(unitIndex);
+	rightIndentSpin->setNewUnit(unitIndex);
 	tabData->setNewUnit(unitIndex);
 }
 
@@ -105,9 +106,9 @@
 		m_parentButton->show();
 	Tabruler::setTabs(Tabs, unitIndex);
 	Tabruler::repaint();
-	first_->setNewUnit(unitIndex);
-	left_->setNewUnit(unitIndex);
-	right_->setNewUnit(unitIndex);
+	firstLineSpin->setNewUnit(unitIndex);
+	leftIndentSpin->setNewUnit(unitIndex);
+	rightIndentSpin->setNewUnit(unitIndex);
 	tabData->setNewUnit(unitIndex);
 
 	connect(this, SIGNAL(tabsChanged()), this, SLOT(slotTabsChanged()));
@@ -117,151 +118,121 @@
 void SMTabruler::setParentTabs(const QList<ParagraphStyle::TabRecord>& Tabs)
 {
 	m_hasParent = true;
-	m_pTabs = Tabs;
+	m_parentTabs = Tabs;
 }
 
 void SMTabruler::setFirstLineValue(double t)
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
-	first_->setValue(t);
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
+	firstLineSpin->setValue(t);
 	firstLineData->setValue(t);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::setFirstLineValue(double t, bool isParentValue)
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
 	m_isSetupFirst = true;
-	first_->setValue(t, isParentValue);
+	firstLineSpin->setValue(t, isParentValue);
 	firstLineData->setValue(t);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::setParentFirstLine(double t)
 {
-	first_->setParentValue(t);
+	firstLineSpin->setParentValue(t);
 }
 
 void SMTabruler::setLeftIndentValue(double t)
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
-	left_->setValue(t);
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
+	leftIndentSpin->setValue(t);
 	leftIndentData->setValue(t);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::setLeftIndentValue(double t, bool isParentValue)
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
 	m_isSetupLeft = true;
-	left_->setValue(t, isParentValue);
+	leftIndentSpin->setValue(t, isParentValue);
 	leftIndentData->setValue(t);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::setParentLeftIndent(double t)
 {
-	left_->setParentValue(t);
+	leftIndentSpin->setParentValue(t);
 }
 
 void SMTabruler::setRightIndentValue(double t)
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
-	right_->setValue(t);
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
+	rightIndentSpin->setValue(t);
 	rightIndentData->setValue(t);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::setRightIndentValue(double t, bool isParentValue)
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
 	m_isSetupRight = true;
-	right_->setValue(t, isParentValue);
+	rightIndentSpin->setValue(t, isParentValue);
 	rightIndentData->setValue(t);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::setParentRightIndent(double t)
 {
-	right_->setParentValue(t);
+	rightIndentSpin->setParentValue(t);
 }
 
 bool SMTabruler::useParentTabs()
@@ -269,7 +240,7 @@
 	bool ret = m_useParentTabs;
 	if (ret && m_hasParent)
 	{
-		setTabs(m_pTabs, m_unitIndex, true);
+		setTabs(m_parentTabs, m_unitIndex, true);
 		Tabruler::repaint();
 		m_parentButton->hide();
 	}
@@ -283,17 +254,17 @@
 
 bool SMTabruler::useParentFirstLine()
 {
-	return first_->useParentValue();
+	return firstLineSpin->useParentValue();
 }
 
 bool SMTabruler::useParentLeftIndent()
 {
-	return left_->useParentValue();
+	return leftIndentSpin->useParentValue();
 }
 
 bool SMTabruler::useParentRightIndent()
 {
-	return right_->useParentValue();
+	return rightIndentSpin->useParentValue();
 }
 
 void SMTabruler::slotTabsChanged()
@@ -316,111 +287,99 @@
 
 void SMTabruler::leftDataChanged()
 {
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
 	double a, b, value;
 	int c;
 	leftIndentData->getValues(&a, &b, &c, &value);
 	if (m_hasParent && !m_isSetupLeft)
-		left_->setValue(value, false);
+		leftIndentSpin->setValue(value, false);
 	else if (!m_hasParent)
-		left_->setValue(value);
+		leftIndentSpin->setValue(value);
 
 	m_isSetupLeft = false;
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::rightDataChanged()
 {
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
 	double a, b, value;
 	int c;
 	rightIndentData->getValues(&a, &b, &c, &value);
 	if (m_hasParent && !m_isSetupRight)
-		right_->setValue(value, false);
+		rightIndentSpin->setValue(value, false);
 	else if (!m_hasParent)
-		right_->setValue(value);
+		rightIndentSpin->setValue(value);
 
 	m_isSetupRight = false;
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::firstDataChanged()
 {
-	disconnect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	disconnect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	disconnect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
+	QSignalBlocker firstLineSpinBlocker(firstLineSpin);
+	QSignalBlocker rightIndentSpinBlocker(rightIndentSpin);
+	QSignalBlocker leftIndentSpinBlocker(leftIndentSpin);
+
 	double a, b, value;
 	int c;
 	firstLineData->getValues(&a, &b, &c, &value);
 	if (m_hasParent && !m_isSetupFirst)
-		first_->setValue(value, false);
+		firstLineSpin->setValue(value, false);
 	else if (!m_hasParent)
-		first_->setValue(value);
+		firstLineSpin->setValue(value);
 
 	m_isSetupFirst = false;
-	connect(first_, SIGNAL(valueChanged(double)), this, SLOT(firstValueChanged()));
-	connect(right_, SIGNAL(valueChanged(double)), this, SLOT(rightValueChanged()));
-	connect(left_, SIGNAL(valueChanged(double)), this, SLOT(leftValueChanged()));
 }
 
 void SMTabruler::firstValueChanged()
 {
-//	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-//	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-//	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	double a, b, value;
-	int c;
-	first_->getValues(&a, &b, &c, &value);
+//	QSignalBlocker firstLineDataBlocker(firstLineData);
+//	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+//	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+
+	double a, b, value;
+	int c;
+	firstLineSpin->getValues(&a, &b, &c, &value);
 	setFirstLineData(value / m_docUnitRatio);
 	setFirstLine();
 	setLeftIndent();
 	setRightIndent();
 	m_isSetupFirst = true;
-//	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-//	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-//	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
 }
 
 void SMTabruler::leftValueChanged()
 {
-//	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-//	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	double a, b, value;
-	int c;
-	left_->getValues(&a, &b, &c, &value);
+//	QSignalBlocker firstLineDataBlocker(firstLineData);
+//	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+
+	double a, b, value;
+	int c;
+	leftIndentSpin->getValues(&a, &b, &c, &value);
 	setLeftIndentData(value / m_docUnitRatio);
 	setLeftIndent();
 //	setFirstLine();
 	setRightIndent();
 	m_isSetupLeft = true;
-//	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-//	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
 }
 
 void SMTabruler::rightValueChanged()
 {
-	disconnect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	disconnect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	disconnect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-	double a, b, value;
-	int c;
-	right_->getValues(&a, &b, &c, &value);
+	QSignalBlocker firstLineDataBlocker(firstLineData);
+	QSignalBlocker rightIndentDataBlocker(rightIndentData);
+	QSignalBlocker leftIndentDataBlocker(leftIndentData);
+
+	double a, b, value;
+	int c;
+	rightIndentSpin->getValues(&a, &b, &c, &value);
 	setRightIndentData(value / m_docUnitRatio);
 	setLeftIndent();
 	setFirstLine();
 	setRightIndent();
 	m_isSetupRight = true;
-	connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(firstDataChanged()));
-	connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(rightDataChanged()));
-	connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(leftDataChanged()));
-}
+}

Modified: trunk/Scribus/scribus/ui/smtabruler.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24539&path=/trunk/Scribus/scribus/ui/smtabruler.h
==============================================================================
--- trunk/Scribus/scribus/ui/smtabruler.h	(original)
+++ trunk/Scribus/scribus/ui/smtabruler.h	Tue Mar  2 11:38:41 2021
@@ -46,12 +46,12 @@
 	bool useParentLeftIndent();
 	bool useParentRightIndent();
 
-	SMScrSpinBox *first_;
-	SMScrSpinBox *left_;
-	SMScrSpinBox *right_;
+	SMScrSpinBox *firstLineSpin { nullptr };
+	SMScrSpinBox *leftIndentSpin { nullptr };
+	SMScrSpinBox *rightIndentSpin { nullptr };
 
 private:
-	QList<ParagraphStyle::TabRecord> m_pTabs;
+	QList<ParagraphStyle::TabRecord> m_parentTabs;
 	int  m_unitIndex = 0;
 	QToolButton *m_parentButton = nullptr;
 	bool m_hasParent = false;

Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24539&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp	(original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp	Tue Mar  2 11:38:41 2021
@@ -538,9 +538,9 @@
 
 	connect(m_pwidget->tabList, SIGNAL(tabsChanged()), this, SLOT(slotTabRuler()));
 	connect(m_pwidget->tabList, SIGNAL(mouseReleased()), this, SLOT(slotTabRuler()));
-	connect(m_pwidget->tabList->left_, SIGNAL(valueChanged(double)), this, SLOT(slotLeftIndent()));
-	connect(m_pwidget->tabList->right_, SIGNAL(valueChanged(double)), this, SLOT(slotRightIndent()));
-	connect(m_pwidget->tabList->first_, SIGNAL(valueChanged(double)), this, SLOT(slotFirstLine()));
+	connect(m_pwidget->tabList->leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(slotLeftIndent()));
+	connect(m_pwidget->tabList->rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(slotRightIndent()));
+	connect(m_pwidget->tabList->firstLineSpin, SIGNAL(valueChanged(double)), this, SLOT(slotFirstLine()));
 
 	connect(m_pwidget->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParentChanged(const QString&)));
 	connect(m_pwidget->backColor_, SIGNAL(activated(const QString&)), this, SLOT(slotBackPColor()));
@@ -638,9 +638,9 @@
 	disconnect(m_pwidget->keepWithNext, SIGNAL(stateChanged(int)), this, SLOT(handleKeepWithNext()));
 
 	disconnect(m_pwidget->tabList, SIGNAL(tabsChanged()), this, SLOT(slotTabRuler()));
-	disconnect(m_pwidget->tabList->left_, SIGNAL(valueChanged(double)), this, SLOT(slotLeftIndent()));
-	disconnect(m_pwidget->tabList->right_, SIGNAL(valueChanged(double)), this, SLOT(slotRightIndent()));
-	disconnect(m_pwidget->tabList->first_, SIGNAL(valueChanged(double)), this, SLOT(slotFirstLine()));
+	disconnect(m_pwidget->tabList->leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(slotLeftIndent()));
+	disconnect(m_pwidget->tabList->rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(slotRightIndent()));
+	disconnect(m_pwidget->tabList->firstLineSpin, SIGNAL(valueChanged(double)), this, SLOT(slotFirstLine()));
 	disconnect(m_pwidget->backColor_, SIGNAL(activated(const QString&)), this, SLOT(slotBackPColor()));
 	disconnect(m_pwidget->backShade_, SIGNAL(clicked()), this, SLOT(slotBackPShade()));
 
@@ -1039,8 +1039,10 @@
 void SMParagraphStyle::slotNumFormat(int)
 {
 	if (m_pwidget->numFormatCombo->useParentFormat())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumFormat();
+	}
 	else
 	{
 		NumFormat numFormat = m_pwidget->numFormatCombo->currentFormat();
@@ -1054,13 +1056,15 @@
 void SMParagraphStyle::slotNumLevel(int level)
 {
 	if (m_pwidget->numLevelSpin->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumLevel();
-	else
-		for (int i = 0; i < m_selection.count(); ++i)
-		{
-			m_selection[i]->setNumLevel(level-1);
-		}
+	}
+	else
+	{
+		for (int i = 0; i < m_selection.count(); ++i)
+			m_selection[i]->setNumLevel(level - 1);
+	}
 	
 	if (level == 0)
 		slotNumHigher(false);
@@ -1087,11 +1091,15 @@
 void SMParagraphStyle::slotNumStart(int start)
 {
 	if (m_pwidget->numStartSpin->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumStart();
-	else
+	}
+	else
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setNumStart(start);
+	}
 
 	slotSelectionDirty();
 }
@@ -1101,11 +1109,15 @@
 	int restartRange = m_pwidget->numRestartCombo->itemData(restart).toInt();
 
 	if (m_pwidget->numRestartCombo->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumRestart();
-	else
+	}
+	else
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setNumRestart(restartRange);
+	}
 
 	slotSelectionDirty();
 }
@@ -1113,8 +1125,10 @@
 void SMParagraphStyle::slotNumOther(bool isOn)
 {
 	if (m_pwidget->numRestartOtherBox->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumOther();
+	}
 	else 
 	{
 		for (int i = 0; i < m_selection.count(); ++i)
@@ -1127,8 +1141,10 @@
 void SMParagraphStyle::slotNumHigher(bool isOn)
 {
 	if (m_pwidget->numRestartHigherBox->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumHigher();
+	}
 	else 
 	{
 		for (int i = 0; i < m_selection.count(); ++i)
@@ -1142,8 +1158,10 @@
 void SMParagraphStyle::handleKeepLinesStart()
 {
 	if (m_pwidget->keepLinesStart->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetKeepLinesStart();
+	}
 	else 
 	{
 		int value = m_pwidget->keepLinesStart->value();
@@ -1157,8 +1175,10 @@
 void SMParagraphStyle::handleKeepLinesEnd()
 {
 	if (m_pwidget->keepLinesEnd->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetKeepLinesEnd();
+	}
 	else 
 	{
 		int value = m_pwidget->keepLinesEnd->value();
@@ -1172,8 +1192,10 @@
 void SMParagraphStyle::handleKeepTogether()
 {
 	if (m_pwidget->keepTogether->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetKeepTogether();
+	}
 	else 
 	{
 		bool value = m_pwidget->keepTogether->isChecked();
@@ -1187,8 +1209,10 @@
 void SMParagraphStyle::handleKeepWithNext()
 {
 	if (m_pwidget->keepWithNext->useParentValue())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetKeepWithNext();
+	}
 	else 
 	{
 		bool value = m_pwidget->keepWithNext->isChecked();
@@ -1219,14 +1243,16 @@
 void SMParagraphStyle::slotLeftIndent()
 {
 	if (m_pwidget->tabList->useParentLeftIndent())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetLeftMargin();
+	}
 	else 
 	{
 		double a, b, value;
 		int c;
 
-		m_pwidget->tabList->left_->getValues(&a, &b, &c, &value);
+		m_pwidget->tabList->leftIndentSpin->getValues(&a, &b, &c, &value);
 		value = value / m_unitRatio;
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setLeftMargin(value);
@@ -1238,14 +1264,16 @@
 void SMParagraphStyle::slotRightIndent()
 {
 	if (m_pwidget->tabList->useParentRightIndent())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetRightMargin();
+	}
 	else 
 	{
 		double a, b, value;
 		int c;
 
-		m_pwidget->tabList->right_->getValues(&a, &b, &c, &value);
+		m_pwidget->tabList->rightIndentSpin->getValues(&a, &b, &c, &value);
 		value = value / m_unitRatio;
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setRightMargin(value);
@@ -1257,14 +1285,16 @@
 void SMParagraphStyle::slotFirstLine()
 {
 	if (m_pwidget->tabList->useParentFirstLine())
+	{
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetFirstIndent();
+	}
 	else 
 	{
 		double a, b, value;
 		int c;
 		
-		m_pwidget->tabList->first_->getValues(&a, &b, &c, &value);
+		m_pwidget->tabList->firstLineSpin->getValues(&a, &b, &c, &value);
 		value = value / m_unitRatio;
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setFirstIndent(value);




More information about the scribus-commit mailing list