r25050 by craig - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 23 20:28:46 UTC 2022


Author: craig
Date: Wed Mar 23 20:28:46 2022
New Revision: 25050

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

Modified:
    trunk/Scribus/scribus/canvasmode_edit.cpp
    trunk/Scribus/scribus/fonts/scfontmetrics.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
    trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
    trunk/Scribus/scribus/plugins/short-words/parse.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
    trunk/Scribus/scribus/ui/shadebutton.cpp
    trunk/Scribus/scribus/ui/shadebutton.h
    trunk/Scribus/scribus/ui/smshadebutton.h

Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp	Wed Mar 23 20:28:46 2022
@@ -952,7 +952,7 @@
 	double grabRadius = m_doc->guidesPrefs().grabRadius / m_canvas->scale();
 	int MxpS = static_cast<int>(mousePointDoc.x());
 	int MypS = static_cast<int>(mousePointDoc.y());
-	QRectF mpo(Mxp - grabRadius, Myp - grabRadius, grabRadius * 2, grabRadius * 2);
+	//QRectF mpo(Mxp - grabRadius, Myp - grabRadius, grabRadius * 2, grabRadius * 2);
 
 	m_doc->nodeEdit.deselect();
 	if (!m_doc->masterPageMode())

Modified: trunk/Scribus/scribus/fonts/scfontmetrics.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/fonts/scfontmetrics.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scfontmetrics.cpp	(original)
+++ trunk/Scribus/scribus/fonts/scfontmetrics.cpp	Wed Mar 23 20:28:46 2022
@@ -84,7 +84,7 @@
 	for (int i = 0; i < face->num_charmaps; i++)
 	{
 		FT_CharMap charmap = face->charmaps[i];
-		qDebug() << "Checking cmap " << i << "(" << charmap->platform_id << "," << charmap->encoding_id << "," << FT_Get_CMap_Language_ID(charmap) << ") format " << FT_Get_CMap_Format(charmap);
+//		qDebug() << "Checking cmap " << i << "(" << charmap->platform_id << "," << charmap->encoding_id << "," << FT_Get_CMap_Language_ID(charmap) << ") format " << FT_Get_CMap_Format(charmap);
 		if (charmap->encoding == FT_ENCODING_UNICODE)
 		{
 			FT_Set_Charmap(face, face->charmaps[i]);
@@ -96,19 +96,19 @@
 				countUnicode++;
 				charcode = FT_Get_Next_Char(face, charcode, &gindex);
 			}
-			qDebug() << "found Unicode enc for" << face->family_name << face->style_name  << "as map" << chmapUnicode << "with" << countUnicode << "glyphs";
+//			qDebug() << "found Unicode enc for" << face->family_name << face->style_name  << "as map" << chmapUnicode << "with" << countUnicode << "glyphs";
 		}
 		if (charmap->encoding == FT_ENCODING_ADOBE_CUSTOM)
 		{
 			chmapCustom = i;
 			foundEncoding = true;
 			retVal = 1;
-			qDebug() << "found Custom enc for" << face->family_name << face->style_name;
+//			qDebug() << "found Custom enc for" << face->family_name << face->style_name;
 			break;
 		}
 		if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
 		{
-			qDebug() << "found Symbol enc for" << face->family_name << face->style_name;
+//			qDebug() << "found Symbol enc for" << face->family_name << face->style_name;
 
 			chmapCustom = i;
 			foundEncoding = true;
@@ -119,19 +119,19 @@
 	int mapToSet = defaultchmap;
 	if (chmapUnicode >= 0 && countUnicode >= face->num_glyphs-1)
 	{
-		qDebug() << "using Unicode enc for" << face->family_name << face->style_name;
+//		qDebug() << "using Unicode enc for" << face->family_name << face->style_name;
 		mapToSet = chmapUnicode;
 		retVal = 0;
 	}
 	else if (foundEncoding)
 	{
-		qDebug() << "using special enc for" << face->family_name << face->style_name;
+//		qDebug() << "using special enc for" << face->family_name << face->style_name;
 		mapToSet = chmapCustom;
 	}
 	else
 	{
-		qDebug() << "using default enc for" << face->family_name << face->style_name;
-		mapToSet = defaultchmap;
+//		qDebug() << "using default enc for" << face->family_name << face->style_name;
+//		mapToSet = defaultchmap;
 		retVal = 0;
 	}
 

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	Wed Mar 23 20:28:46 2022
@@ -1039,7 +1039,7 @@
 {
 	uchar len, tmp;
 	uint adj;
-	QString ret = "";
+	QString ret;
 	s >> len;
 	if (len == 0)
 	{

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Wed Mar 23 20:28:46 2022
@@ -3084,7 +3084,7 @@
 		SetQColor(&fontColor, itemText.defaultStyle().charStyle().fillColor(), itemText.defaultStyle().charStyle().fillShade());
 		double fontSize = itemText.defaultStyle().charStyle().fontSize() / 10.0;
 		ScFace font = itemText.defaultStyle().charStyle().font();
-		QString bmUtf16("");
+		QString bmUtf16;
 		QString cc;
 		if (!((itemText.length() == 1) && (itemText.text(0, 1) == QChar(13))))
 		{

Modified: trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp	Wed Mar 23 20:28:46 2022
@@ -224,15 +224,13 @@
 		}
 		else
 		{
-			int di, n;
 			unsigned int temp_c = c;
 			// c--> temp_c //tomy 2001.11.13 
 			temp_c = (temp_c << 8) ;
 			temp_c = temp_c + m_buf->buf[ i++ ];
-			di = (temp_c & 0x3FFF) >> COUNT_BITS;
-			for (n = (temp_c & ((1 << COUNT_BITS) - 1)) + 3; n-- && j < BUFFER_SIZE; ++j )
+			int di = (temp_c & 0x3FFF) >> COUNT_BITS;
+			for (int n = (temp_c & ((1 << COUNT_BITS) - 1)) + 3; n-- && j < BUFFER_SIZE; ++j )
 				m_new_buf->buf[ j ] = m_new_buf->buf[ j - di ];
-			temp_c = 0;
 		}
 	}
 	//UT_ASSERT(j <= BUFFER_SIZE);

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp	Wed Mar 23 20:28:46 2022
@@ -3065,7 +3065,7 @@
 		item->itemText.insertChars(posC, data);
 		item->itemText.applyStyle(posC, newStyle);
 		item->itemText.applyCharStyle(posC, data.length(), nstyle);
-		posC = item->itemText.length();
+//		posC = item->itemText.length();
 	}
 }
 

Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp	Wed Mar 23 20:28:46 2022
@@ -3504,13 +3504,13 @@
 		else
 			gap = dStyle.stroke_dash_distance;
 		int dots1 = dStyle.stroke_dash_dots1;
-		double dots1len = item->lineWidth();
+		double dots1len;
 		if (dStyle.stroke_dash_dots1_length < 0)
 			dots1len = item->lineWidth();
 		else
 			dots1len = dStyle.stroke_dash_dots1_length;
 		int dots2 = dStyle.stroke_dash_dots2;
-		double dots2len = item->lineWidth();
+		double dots2len;
 		if (dStyle.stroke_dash_dots2_length < 0)
 			dots2len = item->lineWidth();
 		else

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	Wed Mar 23 20:28:46 2022
@@ -314,7 +314,6 @@
 bool PdfPlug::convert(const QString& fn)
 {
 	bool firstPg = true;
-	int currentLayer = m_Doc->activeLayer();
 	int baseLayer = m_Doc->activeLayer();
 	m_importedColors.clear();
 	if (m_progressDialog)
@@ -514,6 +513,7 @@
 					if (ocg && ocg->hasOCGs())
 					{
 						QString actL(m_Doc->activeLayerName());
+						int currentLayer;
 						for (int i = 0; i < ocgGroups.count(); i++)
 						{
 							OptionalContentGroup *oc = ocgGroups[i];

Modified: trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp	Wed Mar 23 20:28:46 2022
@@ -710,7 +710,7 @@
 		if (magic != "VCLMTF")
 			return false;
 		recordCount = 0;
-		qint64 posi = ds.device()->pos();
+		qint64 posi;
 		SvmHeader head;
 		ds >> head.versionCompat.version;
 		ds >> head.versionCompat.length;

Modified: trunk/Scribus/scribus/plugins/short-words/parse.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/plugins/short-words/parse.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/short-words/parse.cpp	(original)
+++ trunk/Scribus/scribus/plugins/short-words/parse.cpp	Wed Mar 23 20:28:46 2022
@@ -40,6 +40,10 @@
 
 void SWParse::parseItem(PageItem *aFrame)
 {
+	// just textframes processed
+	if (!aFrame->isTextFrame())
+		return;
+
 	// the content of the frame - text itself
 	QString content;
 	int changes = 0;
@@ -51,10 +55,6 @@
 	QRegularExpression rx(" ");
 	// cfg
 	SWConfig *cfg = new SWConfig();
-
-	// just textframes processed
-	if (!aFrame->isTextFrame())
-		return;
 
 	// an ugly hack to get the language code from the item language property
 	if (lang.isEmpty())

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Wed Mar 23 20:28:46 2022
@@ -5,11 +5,11 @@
 for which a new license (GPL+exception) is in place.
 */
 /***************************************************************************
-                          pslib.cpp  -  description
-                             -------------------
-    begin                : Sat May 26 2001
-    copyright            : (C) 2001 by Franz Schmid
-    email                : Franz.Schmid at altmuehlnet.de
+						  pslib.cpp  -  description
+							 -------------------
+	begin                : Sat May 26 2001
+	copyright            : (C) 2001 by Franz Schmid
+	email                : Franz.Schmid at altmuehlnet.de
  ***************************************************************************/
 
 /***************************************************************************
@@ -69,7 +69,6 @@
 {
 	public:
 	PSPainter(ScribusDoc* Doc, uint argh, ScPage* page, bool master, PSLib* ps):
-		m_Doc(Doc),
 		m_argh(argh),
 		m_page(page),
 		m_master(master),
@@ -83,7 +82,6 @@
 	void drawObject(PageItem* item) override;
 
 	private:
-		ScribusDoc* m_Doc {nullptr};
 		uint m_argh;
 		ScPage* m_page {nullptr};
 		bool m_master;
@@ -450,7 +448,7 @@
 
 	ScASCII85EncodeFilter asciiEncode(&spoolStream);
 	ScFlateEncodeFilter   flateEncode(&asciiEncode);
-	if (!flateEncode.openFilter()) 
+	if (!flateEncode.openFilter())
 		return false;
 
 	for (int i = 0; i < pixels; ++i)
@@ -643,7 +641,7 @@
 		grayCalc += "              oldsetgray} bind def\n";
 		PutStream(grayCalc);
 	}
-		
+
 	Optimization optim = m_optimization;
 	m_optimization = OptimizeSize;
 	QStringList patterns = m_Doc->getPatternDependencyList(m_Doc->getUsedPatterns());
@@ -746,7 +744,7 @@
 			}
 			if (errorOccured) break;
 		}
-	}	
+	}
 	PutStream("%%EndSetup\n");
 
 	return (!errorOccured);
@@ -805,7 +803,7 @@
 	}
 	PutStream("Scribusdict begin\n");
 	if ((m_outputFormat == OutputPS) && (Options.setDevParam))
-  	{
+	{
 		if (pg->orientation() == 0)
 			PutStream("<< /PageSize [ " + ToStr(maxBoxX) + " " + ToStr(maxBoxY) + " ]\n");
 		else
@@ -890,7 +888,7 @@
 			PutStream(ToStr(maxBoxX - markDelta) + " " + ToStr(maxBoxY - Options.bleeds.top() - markOffs) + " m\n");
 			PutStream(ToStr(maxBoxX - markDelta - Options.markLength) + " " + ToStr(maxBoxY - Options.bleeds.top() - markOffs) + " li\n");
 			PutStream("st\n");
- 			PutStream(ToStr(maxBoxX - bleedRight - markOffs) + " " +  ToStr(maxBoxY - markDelta) + " m\n");
+			PutStream(ToStr(maxBoxX - bleedRight - markOffs) + " " +  ToStr(maxBoxY - markDelta) + " m\n");
 			PutStream(ToStr(maxBoxX - bleedRight - markOffs) + " " +  ToStr(maxBoxY - markDelta - Options.markLength)  + " li\n");
 			PutStream("st\n");
 		}
@@ -1706,7 +1704,7 @@
 		}
 		errorOccured = !PS_begin_doc(0.0, 0.0, maxWidth, maxHeight, pageNs.size() * pagemult);
 	}
-	
+
 	sepac = 0;
 	uint aa = 0;
 	uint a;
@@ -1799,7 +1797,7 @@
 		return 1;
 	if (abortExport)
 		return 2; //CB Lets leave 1 for general error condition
-	return 0; 
+	return 0;
 }
 
 bool PSLib::ProcessItem(ScPage* page, PageItem* item, uint PNr, bool master, bool embedded, bool useTemplate)

Modified: trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp	(original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp	Wed Mar 23 20:28:46 2022
@@ -652,20 +652,14 @@
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
-	double x, y, gx, gy, gh, gw, base;
 	QTransform ma;
-	x = xposSpin->value() / m_unitRatio;
-	y = yposSpin->value() / m_unitRatio;
-	base = 0;
-	x += m_doc->rulerXoffset;
-	y += m_doc->rulerYoffset;
+	double x = (xposSpin->value() / m_unitRatio) + m_doc->rulerXoffset;
+	double base = 0.0;
 	if (m_doc->guidesPrefs().rulerMode)
-	{
 		x += m_doc->currentPage()->xOffset();
-		y += m_doc->currentPage()->yOffset();
-	}
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
+		double gx, gy, gh, gw;
 		m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 		int bp = basePointWidget->checkedId();
 		if ((bp == 0) || (bp == 3))
@@ -722,20 +716,14 @@
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
-	double x, y, gx, gy, gh, gw, base;
 	QTransform ma;
-	x = xposSpin->value() / m_unitRatio;
-	y = yposSpin->value() / m_unitRatio;
-	base = 0;
-	x += m_doc->rulerXoffset;
-	y += m_doc->rulerYoffset;
+	double y = (yposSpin->value() / m_unitRatio) + m_doc->rulerYoffset;
+	double base = 0;
 	if (m_doc->guidesPrefs().rulerMode)
-	{
-		x += m_doc->currentPage()->xOffset();
 		y += m_doc->currentPage()->yOffset();
-	}
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
+		double gx, gy, gh, gw;
 		m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 		int bp = basePointWidget->checkedId();
 		if ((bp == 0) || (bp == 1))
@@ -792,15 +780,15 @@
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 	
-	double x, y, w, h, gx, gy, gh, gw;
-	x = xposSpin->value() / m_unitRatio;
-	y = yposSpin->value() / m_unitRatio;
-	w = widthSpin->value() / m_unitRatio;
-	h = heightSpin->value() / m_unitRatio;
+	double x = xposSpin->value() / m_unitRatio;
+	double y = yposSpin->value() / m_unitRatio;
+	double w = widthSpin->value() / m_unitRatio;
+	double h = heightSpin->value() / m_unitRatio;
 	double oldW = (m_item->width()  != 0.0) ? m_item->width()  : 1.0;
 	double oldH = (m_item->height() != 0.0) ? m_item->height() : 1.0;
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
+		double gx, gy, gh, gw;
 		if (!m_userActionOn)
 			m_ScMW->view->startGroupTransaction();
 		m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
@@ -874,15 +862,15 @@
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
-	double x,y,w,h, gx, gy, gh, gw;
-	x = xposSpin->value() / m_unitRatio;
-	y = yposSpin->value() / m_unitRatio;
-	w = widthSpin->value() / m_unitRatio;
-	h = heightSpin->value() / m_unitRatio;
+	double x = xposSpin->value() / m_unitRatio;
+	double y = yposSpin->value() / m_unitRatio;
+	double w = widthSpin->value() / m_unitRatio;
+	double h = heightSpin->value() / m_unitRatio;
 	double oldW = (m_item->width()  != 0.0) ? m_item->width()  : 1.0;
 	double oldH = (m_item->height() != 0.0) ? m_item->height() : 1.0;
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
+		double gx, gy, gh, gw;
 		if (!m_userActionOn)
 			m_ScMW->view->startGroupTransaction();
 		m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
@@ -955,13 +943,13 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	double gx, gy, gh, gw;
 	if (m_haveDoc && m_haveItem)
 	{
 		if (!m_userActionOn)
 			m_ScMW->view->startGroupTransaction(Um::Rotate, "", Um::IRotate);
 		if (m_doc->m_Selection->isMultipleSelection())
 		{
+			double gx, gy, gh, gw;
 			m_doc->rotateGroup((rotationSpin->value() - m_oldRotation)*(-1), m_ScMW->view->RCenter);
 			m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 			showXY(gx, gy);
@@ -1016,15 +1004,16 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	double inX, inY, gx, gy, gh, gw;
-	inX = 0;
-	inY = 0;
+
+	double inX = 0;
+	double inY = 0;
 	if (m_haveDoc && m_haveItem)
 	{
 		m_haveItem = false;
 		m_doc->setRotationMode(m);
 		if (m_doc->m_Selection->isMultipleSelection())
 		{
+			double gx, gy, gh, gw;
 			m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 			if (m == 0)
 			{
@@ -1068,12 +1057,11 @@
 		}
 		else
 		{
-			double b, h, r;
 			QTransform ma;
 			FPoint n;
-			b = m_item->width();
-			h = m_item->height();
-			r = m_item->rotation();
+			double b = m_item->width();
+			double h = m_item->height();
+			double r = m_item->rotation();
 			ma.translate(m_item->xPos(), m_item->yPos());
 			ma.rotate(r);
 			int bp = basePointWidget->checkedId();

Modified: trunk/Scribus/scribus/ui/shadebutton.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/ui/shadebutton.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/shadebutton.cpp	(original)
+++ trunk/Scribus/scribus/ui/shadebutton.cpp	Wed Mar 23 20:28:46 2022
@@ -14,8 +14,8 @@
 	size_t array = sizeof(tmp) / sizeof(*tmp);
 	FillSh = new QMenu();
 	FillSh->addAction( tr("Other..."))->setCheckable(true);
-	for (uint a = 0; a < array; ++a)
-		FillSh->addAction(tmp[a])->setCheckable(true);
+	for (uint i = 0; i < array; ++i)
+		FillSh->addAction(tmp[i])->setCheckable(true);
 	setMenu(FillSh);
 	setPopupMode(QToolButton::InstantPopup);
 	setText("100 %");
@@ -25,30 +25,24 @@
 
 void ShadeButton::setShade(QAction *act)
 {
-	bool ok = false;
-	int a;
-	int c;
-	int b = 100;
-	for (a = 0; a < FillSh->actions().count(); ++a)
-	{
-		FillSh->actions().at(a)->setChecked(false);
-	}
+	for (int i = 0; i < FillSh->actions().count(); ++i)
+		FillSh->actions().at(i)->setChecked(false);
 	act->setChecked(true);
 	QList<QAction*> actList = FillSh->actions();
-	c = actList.indexOf(act);
+	int b = 100;
+	int c = actList.indexOf(act);
 	if (c < 0)
 		return;
 	if (c > 0)
 		b = (c-1) * 10;
-
 	if (b > 100)
 		return; // no need for > 100%, fix needed by SM, Riku
-	
 	if (c == 0)
 	{
 		Query dia(this, "New", 1, tr("&Shade:"), tr("Shade"));
 		if (dia.exec())
 		{
+			bool ok = false;
 			c = dia.getEditText().toInt(&ok);
 			if (ok)
 				b = qMax(qMin(c, 100),0);
@@ -65,17 +59,15 @@
 int ShadeButton::getValue()
 {
 	int l = text().length();
-	QString tx = text().remove(l-2,2);
+	QString tx(text().remove(l-2, 2));
 	return tx.toInt();
 }
 
 void ShadeButton::setValue(int val)
 {
 	QList<QAction*> fillActions = FillSh->actions();
-	for (int a = 0; a < fillActions.count(); ++a)
-	{
-		fillActions[a]->setChecked(false);
-	}
+	for (int i = 0; i < fillActions.count(); ++i)
+		fillActions[i]->setChecked(false);
 	if ((val % 10) == 0)
 		fillActions[val / 10 + 1]->setChecked(true);
 	else

Modified: trunk/Scribus/scribus/ui/shadebutton.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/ui/shadebutton.h
==============================================================================
--- trunk/Scribus/scribus/ui/shadebutton.h	(original)
+++ trunk/Scribus/scribus/ui/shadebutton.h	Wed Mar 23 20:28:46 2022
@@ -13,18 +13,19 @@
 
 class SCRIBUS_API ShadeButton : public QToolButton
 {
+	Q_OBJECT
 
-Q_OBJECT
+	public:
+		ShadeButton(QWidget* parent);
+		~ShadeButton() {};
+		int getValue();
+		void setValue(int val);
 
-public:
-	ShadeButton(QWidget* parent);
-	~ShadeButton() {};
-	QMenu *FillSh;
-	int getValue();
-	void setValue(int val);
+	protected:
+		QMenu *FillSh;
 
-private slots:
-	virtual void setShade(QAction *act);
+	private slots:
+		virtual void setShade(QAction *act);
 };
 #endif
 

Modified: trunk/Scribus/scribus/ui/smshadebutton.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25050&path=/trunk/Scribus/scribus/ui/smshadebutton.h
==============================================================================
--- trunk/Scribus/scribus/ui/smshadebutton.h	(original)
+++ trunk/Scribus/scribus/ui/smshadebutton.h	Wed Mar 23 20:28:46 2022
@@ -15,7 +15,7 @@
 	Q_OBJECT
 public:
 	SMShadeButton(QWidget *parent);
-	~SMShadeButton() {};
+	~SMShadeButton() = default;
 
 	void setValue(int i);
 	void setValue(int i, bool isParentValue);
@@ -24,9 +24,9 @@
 	bool useParentValue();
 
 private:
-	bool   m_hasParent = false;
-	bool   m_useParentValue = false;
-	int    m_pValue = 0;
+	bool m_hasParent { false };
+	bool m_useParentValue { false };
+	int  m_pValue { 0 };
 
 	QString useParentValueText() const;
 	void setFont(bool wantBold);




More information about the scribus-commit mailing list