r23006 by craig - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Fri Jun 7 21:28:40 UTC 2019


Author: craig
Date: Fri Jun  7 21:28:40 2019
New Revision: 23006

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

Modified:
    trunk/Scribus/scribus/ui/effectsdialog.cpp

Modified: trunk/Scribus/scribus/ui/effectsdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23006&path=/trunk/Scribus/scribus/ui/effectsdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/effectsdialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/effectsdialog.cpp	Fri Jun  7 21:28:40 2019
@@ -57,13 +57,13 @@
 	cms.setUseEmbeddedProfile(m_item->UseEmbedded);
 	cms.allowSoftProofing(true);
 	m_image.loadPicture(m_item->Pfile, m_item->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, 72, &mode);
-	int ix = m_image.width();
-	int iy = m_image.height();
+	int iw = m_image.width();
+	int ih = m_image.height();
 	m_imageScale = 1.0;
-	if ((ix > 220) || (iy > 220))
+	if ((iw > 220) || (ih > 220))
 	{
-		double sx = ix / 220.0;
-		double sy = iy / 220.0;
+		double sx = iw / 220.0;
+		double sy = ih / 220.0;
 		if (sy < sx)
 			m_image.createLowRes(sx);
 		else
@@ -517,88 +517,88 @@
 	usedEffects->setMinimumSize(fontMetrics().width( tr( "Available Effects" ))+40, 180);
 	usedEffects->clear();
 	m_effectValMap.clear();
-	for (int a = 0; a < effectsList.count(); ++a)
+	for (int i = 0; i < effectsList.count(); ++i)
 	{
-		if (effectsList.at(a).effectCode == ScImage::EF_INVERT)
+		if (effectsList.at(i).effectCode == ScImage::EF_INVERT)
 		{
 			usedEffects->addItem( tr("Invert"));
 			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), "");
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_GRAYSCALE)
+		if (effectsList.at(i).effectCode == ScImage::EF_GRAYSCALE)
 		{
 			usedEffects->addItem( tr("Grayscale"));
 			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), "");
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_COLORIZE)
+		if (effectsList.at(i).effectCode == ScImage::EF_COLORIZE)
 		{
 			usedEffects->addItem( tr("Colorize"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
 			setItemSelectable(availableEffects, 2, false);
 			setItemSelectable(availableEffects, 3, false);
 			setItemSelectable(availableEffects, 4, false);
 			setItemSelectable(availableEffects, 5, false);
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_BRIGHTNESS)
+		if (effectsList.at(i).effectCode == ScImage::EF_BRIGHTNESS)
 		{
 			usedEffects->addItem( tr("Brightness"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
-		}
-		if (effectsList.at(a).effectCode == ScImage::EF_CONTRAST)
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
+		}
+		if (effectsList.at(i).effectCode == ScImage::EF_CONTRAST)
 		{
 			usedEffects->addItem( tr("Contrast"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
-		}
-		if (effectsList.at(a).effectCode == ScImage::EF_SHARPEN)
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
+		}
+		if (effectsList.at(i).effectCode == ScImage::EF_SHARPEN)
 		{
 			usedEffects->addItem( tr("Sharpen"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
-		}
-		if (effectsList.at(a).effectCode == ScImage::EF_BLUR)
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
+		}
+		if (effectsList.at(i).effectCode == ScImage::EF_BLUR)
 		{
 			usedEffects->addItem( tr("Blur"));
-			QString tmpstr = effectsList.at(a).effectParameters;
+			QString tmpstr = effectsList.at(i).effectParameters;
 			double radius;
 			ScTextStream fp(&tmpstr, QIODevice::ReadOnly);
 			fp >> radius; // has to be read from stream, as two numbers are stored in effectParameters
 			blRadius->setValue(radius / m_imageScale);
 			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), QString("%1 1.0").arg(radius / m_imageScale));
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_SOLARIZE)
+		if (effectsList.at(i).effectCode == ScImage::EF_SOLARIZE)
 		{
 			usedEffects->addItem( tr("Posterize"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
-		}
-		if (effectsList.at(a).effectCode == ScImage::EF_DUOTONE)
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
+		}
+		if (effectsList.at(i).effectCode == ScImage::EF_DUOTONE)
 		{
 			usedEffects->addItem( tr("Duotone"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
 			setItemSelectable(availableEffects, 2, false);
 			setItemSelectable(availableEffects, 3, false);
 			setItemSelectable(availableEffects, 4, false);
 			setItemSelectable(availableEffects, 5, false);
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_TRITONE)
+		if (effectsList.at(i).effectCode == ScImage::EF_TRITONE)
 		{
 			usedEffects->addItem( tr("Tritone"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
 			setItemSelectable(availableEffects, 2, false);
 			setItemSelectable(availableEffects, 3, false);
 			setItemSelectable(availableEffects, 4, false);
 			setItemSelectable(availableEffects, 5, false);
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_QUADTONE)
+		if (effectsList.at(i).effectCode == ScImage::EF_QUADTONE)
 		{
 			usedEffects->addItem( tr("Quadtone"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
 			setItemSelectable(availableEffects, 2, false);
 			setItemSelectable(availableEffects, 3, false);
 			setItemSelectable(availableEffects, 4, false);
 			setItemSelectable(availableEffects, 5, false);
 		}
-		if (effectsList.at(a).effectCode == ScImage::EF_GRADUATE)
+		if (effectsList.at(i).effectCode == ScImage::EF_GRADUATE)
 		{
 			usedEffects->addItem( tr("Curves"));
-			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(a).effectParameters);
+			m_effectValMap.insert(usedEffects->item(usedEffects->count()-1), effectsList.at(i).effectParameters);
 		}
 	}
 	layout8->addWidget( usedEffects );
@@ -1052,7 +1052,7 @@
 			FPointArray curve;
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1066,7 +1066,7 @@
 			CurveD1->setLinear(lin);
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1117,7 +1117,7 @@
 			FPointArray curve;
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1131,7 +1131,7 @@
 			CurveT1->setLinear(lin);
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1144,7 +1144,7 @@
 			CurveT2->setLinear(lin);
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1205,7 +1205,7 @@
 			FPointArray curve;
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1219,7 +1219,7 @@
 			CurveQ1->setLinear(lin);
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1232,7 +1232,7 @@
 			CurveQ2->setLinear(lin);
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1245,7 +1245,7 @@
 			CurveQc3->setLinear(lin);
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1357,7 +1357,7 @@
 			FPointArray curve;
 			curve.resize(0);
 			fp >> numVals;
-			for (int nv = 0; nv < numVals; nv++)
+			for (int i = 0; i < numVals; i++)
 			{
 				fp >> s;
 				xval = ScCLocale::toDoubleC(s);
@@ -1412,8 +1412,7 @@
 	{
 		if (currentOptions->text() == tr("Colorize"))
 		{
-			QString efval = "";
-			efval = colData->currentText();
+			QString efval = colData->currentText();
 			QString tmp;
 			tmp.setNum(shade->getValue());
 			efval += "\n"+tmp;
@@ -1433,7 +1432,7 @@
 		}
 		if (currentOptions->text() == tr("Sharpen"))
 		{
-			QString efval = "";
+			QString efval;
 			QString tmp;
 			tmp.setNum(shRadius->value());
 			efval += tmp;
@@ -1443,7 +1442,7 @@
 		}
 		if (currentOptions->text() == tr("Blur"))
 		{
-			QString efval = "";
+			QString efval;
 			QString tmp;
 			if (!final)
 				tmp.setNum(blRadius->value());
@@ -1462,8 +1461,7 @@
 		}
 		if (currentOptions->text() == tr("Duotone"))
 		{
-			QString efval = "";
-			efval = colData1->currentText()+"\n";
+			QString efval = colData1->currentText()+"\n";
 			efval += colData2->currentText()+"\n";
 			QString tmp;
 			tmp.setNum(shade1->getValue());
@@ -1473,9 +1471,9 @@
 			FPointArray Vals = CurveD1->cDisplay->getCurve();
 			tmp.setNum(Vals.size());
 			efval += " "+tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (CurveD1->cDisplay->isLinear())
@@ -1485,9 +1483,9 @@
 			Vals = CurveD2->cDisplay->getCurve();
 			tmp.setNum(Vals.size());
 			efval += " "+tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (CurveD2->cDisplay->isLinear())
@@ -1549,8 +1547,7 @@
 		}
 		if (currentOptions->text() == tr("Quadtone"))
 		{
-			QString efval = "";
-			efval = colDataq1->currentText()+"\n";
+			QString efval = colDataq1->currentText()+"\n";
 			efval += colDataq2->currentText()+"\n";
 			efval += colDataqc3->currentText()+"\n";
 			efval += colDataq4->currentText()+"\n";
@@ -1566,9 +1563,9 @@
 			FPointArray Vals = CurveQ1->cDisplay->getCurve();
 			tmp.setNum(Vals.size());
 			efval += " "+tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (CurveQ1->cDisplay->isLinear())
@@ -1578,9 +1575,9 @@
 			Vals = CurveQ2->cDisplay->getCurve();
 			tmp.setNum(Vals.size());
 			efval += " "+tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (CurveQ2->cDisplay->isLinear())
@@ -1590,9 +1587,9 @@
 			Vals = CurveQc3->cDisplay->getCurve();
 			tmp.setNum(Vals.size());
 			efval += " "+tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (CurveQc3->cDisplay->isLinear())
@@ -1602,9 +1599,9 @@
 			Vals = CurveQ4->cDisplay->getCurve();
 			tmp.setNum(Vals.size());
 			efval += " "+tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (CurveQ4->cDisplay->isLinear())
@@ -1615,14 +1612,14 @@
 		}
 		if (currentOptions->text() == tr("Curves"))
 		{
-			QString efval = "";
+			QString efval;
 			FPointArray Vals = Kdisplay->cDisplay->getCurve();
 			QString tmp;
 			tmp.setNum(Vals.size());
 			efval += tmp;
-			for (int p = 0; p < Vals.size(); p++)
-			{
-				const FPoint& pv = Vals.point(p);
+			for (int i = 0; i < Vals.size(); i++)
+			{
+				const FPoint& pv = Vals.point(i);
 				efval += QString(" %1 %2").arg(pv.x()).arg(pv.y());
 			}
 			if (Kdisplay->cDisplay->isLinear())




More information about the scribus-commit mailing list