r17295 by jghali - more code cleanups

scribus-commit scribus-commit at lists.scribus.net
Sat Feb 11 18:49:50 UTC 2012


Author: jghali
Date: Sat Feb 11 18:49:50 2012
New Revision: 17295

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17295
Log:
more code cleanups

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/scpainter.cpp
    trunk/Scribus/scribus/scpainterex_cairo.cpp
    trunk/Scribus/scribus/scribusstructs.h
    trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
    trunk/Scribus/scribus/ui/shortcutwidget.cpp
    trunk/Scribus/scribus/util_math.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Sat Feb 11 18:49:50 2012
@@ -7512,10 +7512,10 @@
 	{
 		QString ShName = ResNam+QString::number(ResCount);
 		ResCount++;
-		Transpar[ShName] = writeGState("/ca "+FToStr(TransVec[TransVec.count()-1])+"\n/SMask /None\n/AIS false\n/OPM 1\n");
+		Transpar[ShName] = writeGState("/ca "+FToStr(TransVec.last())+"\n/SMask /None\n/AIS false\n/OPM 1\n");
 		tmp += "/"+ShName+" gs\n";
 	}
-	tmp += putColor(colorNames[colorNames.count()-1], colorShades[colorShades.count()-1], true);
+	tmp += putColor(colorNames.last(), colorShades.last(), true);
 	tmp += SetClipPath(c);
 	tmp += "h\n";
 	tmp += FToStr(c->GrControl1.x())+" "+FToStr(-c->GrControl1.y())+" m\n";
@@ -10343,7 +10343,7 @@
 					PutDoc("   /F "+QString::number(threadObj + 1)+" 0 R\n");
 					PutDoc(">>\nendobj\n");
 					Beads[0].Prev = fir + Beads.count()-1;
-					Beads[Beads.count()-1].Next = fir;
+					Beads.last().Next = fir;
 				}
 				for (int beac = 0; beac < Beads.count(); ++beac)
 				{

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp Sat Feb 11 18:49:50 2012
@@ -1544,7 +1544,7 @@
 		QStringList da2 = Cdata.split(" ", QString::SkipEmptyParts);
 		if (da2.count() == 0)
 			return;
-		command = da2[da2.count()-1];
+		command = da2.last();
 /* Start Path construction commands */
 		if (command == "m")
 		{
@@ -1658,7 +1658,7 @@
 				}
 				else
 				{
-					ite = m_Doc->Items->at(m_Doc->Items->count()-1);
+					ite = m_Doc->Items->last();
 					ite->PoLine.setMarker();
 					Coords.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
 					ite->PoLine.putPoints(ite->PoLine.size(), Coords.size(), Coords);
@@ -1681,7 +1681,7 @@
 			if (m_Doc->Items->count() > 0)
 			{
 				WasU = false;
-				ite = m_Doc->Items->at(m_Doc->Items->count()-1);
+				ite = m_Doc->Items->last();
 				FPoint wh = getMaxClipF(&ite->PoLine);
 				ite->setWidthHeight(wh.x(),wh.y());
 				m_Doc->AdjustItemSize(ite);
@@ -1908,7 +1908,7 @@
 			if (itemRendered)
 			{
 				gradientMode = false;
-				ite = m_Doc->Items->at(m_Doc->Items->count()-1);
+				ite = m_Doc->Items->last();
 				ite->fill_gradient = m_gradients[currentGradientName];
 				ite->setGradient(currentGradientName);
 				if (ite->fill_gradient.type() == 0)
@@ -2633,7 +2633,7 @@
 	{
 		Cdata = da[a];
 		QStringList da2 = Cdata.split(" ", QString::SkipEmptyParts);
-		command = da2[da2.count()-1];
+		command = da2.last();
 		if (command == "Bd")
 		{
 			QString tmpS = Cdata;
@@ -2944,7 +2944,7 @@
 	QString Cdata = "";
 	QStringList da;
 	getCommands(cumulated, da);
-	Cdata = da[da.count()-1];
+	Cdata = da.last();
 	ScTextStream gVals(&Cdata, QIODevice::ReadOnly);
 	gVals >> m1 >> m2 >> m3 >> m4 >> m5 >> m6 >> x1 >> y1 >> x2 >> y2 >> w >> h >> bits >> type >> alpha >> dummy >> bin;
 //	qDebug() << QString("Matrix: %1 %2 %3 %4 %5 %6").arg(m1).arg(m2).arg(m3).arg(m4).arg(m5).arg(m6);

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Sat Feb 11 18:49:50 2012
@@ -328,7 +328,7 @@
 	getPenState(state);
 	if ((m_Elements->count() != 0) && (output == Coords))			// Path is the same as in last fill
 	{
-		PageItem* ite = m_Elements->at(m_Elements->count()-1);
+		PageItem* ite = m_Elements->last();
 		ite->setLineColor(CurrColorStroke);
 		ite->setLineShade(shade);
 		ite->setLineEnd(PLineEnd);

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp (original)
+++ trunk/Scribus/scribus/scpainter.cpp Sat Feb 11 18:49:50 2012
@@ -1067,16 +1067,16 @@
 				qStopColor.setAlphaF(colorStops[offset]->opacity);
 				qStopColors.append(qStopColor);
 			}
-			qStopColors[qStopColors.count()-1].getRgbF(&r, &g, &b, &a);
+			qStopColors.last().getRgbF(&r, &g, &b, &a);
 			QPointF centerP = QPointF(gradControlP5.x(), gradControlP5.y());
 			QLineF edge1 = QLineF(centerP, QPointF(p1x, p1y));
 			QLineF edge2 = QLineF(centerP, QPointF(p2x, p2y));
 			QLineF edge3 = QLineF(centerP, QPointF(p3x, p3y));
 			QLineF edge4 = QLineF(centerP, QPointF(p4x, p4y));
-			QPointF p1 = edge1.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-			QPointF p2 = edge2.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-			QPointF p3 = edge3.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-			QPointF p4 = edge4.pointAt(colorStops[colorStops.count()-1]->rampPoint);
+			QPointF p1 = edge1.pointAt(colorStops.last()->rampPoint);
+			QPointF p2 = edge2.pointAt(colorStops.last()->rampPoint);
+			QPointF p3 = edge3.pointAt(colorStops.last()->rampPoint);
+			QPointF p4 = edge4.pointAt(colorStops.last()->rampPoint);
 			cairo_set_source_rgba(cr, r, g, b, a);
 			cairo_paint_with_alpha(cr, 1.0);
 			cairo_set_operator(cr, CAIRO_OPERATOR_DEST_OUT);

Modified: trunk/Scribus/scribus/scpainterex_cairo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/scpainterex_cairo.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainterex_cairo.cpp (original)
+++ trunk/Scribus/scribus/scpainterex_cairo.cpp Sat Feb 11 18:49:50 2012
@@ -830,7 +830,7 @@
 		qStopColor.setAlphaF(colorStops[offset]->opacity);
 		qStopColors.append(qStopColor);
 	}
-	qStopColors[qStopColors.count()-1].getRgbF(&r, &g, &b, &a);
+	qStopColors.last().getRgbF(&r, &g, &b, &a);
 	QPointF centerP = QPointF(m_gradControlP5.x(), m_gradControlP5.y());
 	QLineF edge1 = QLineF(centerP, QPointF(p1x, p1y));
 	QLineF edge2 = QLineF(centerP, QPointF(p2x, p2y));

Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Sat Feb 11 18:49:50 2012
@@ -25,14 +25,15 @@
 #include <vector>
 
 #include "scribusapi.h"
-#include "colormgmt/sccolormgmtstructs.h"
+
+#include "annotation.h"
+#include "fpointarray.h"
+#include "pageitem.h"
+#include "scfonts.h"
 #include "scimagestructs.h"
 #include "sctextstruct.h"
-#include "scfonts.h"
-#include "fpointarray.h"
 #include "vgradient.h"
-#include "annotation.h"
-#include "pageitem.h"
+#include "colormgmt/sccolormgmtstructs.h"
 
 extern bool SCRIBUS_API compareDouble(double, double);
 

Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp Sat Feb 11 18:49:50 2012
@@ -471,7 +471,7 @@
 			tl = keyDisplay->text().split("+", QString::SkipEmptyParts);
 			if (tl.count() > 0)
 			{
-				Part4 = tl[tl.count()-1];
+				Part4 = tl.last();
 				if (Part4 == tr("Alt") || Part4 == tr("Ctrl") || Part4 == tr("Shift") || Part4 == tr("Meta"))
 					Part4 = "";
 			}
@@ -531,7 +531,7 @@
 			tl = keyDisplay->text().split("+", QString::SkipEmptyParts);
 			if (tl.count() > 0)
 			{
-				Part4 = tl[tl.count()-1];
+				Part4 = tl.last();
 				if (Part4 == tr("Alt") || Part4 == tr("Ctrl") || Part4 == tr("Shift") || Part4 == tr("Meta"))
 					Part4 = "";
 			}

Modified: trunk/Scribus/scribus/ui/shortcutwidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/ui/shortcutwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/shortcutwidget.cpp (original)
+++ trunk/Scribus/scribus/ui/shortcutwidget.cpp Sat Feb 11 18:49:50 2012
@@ -65,7 +65,7 @@
 		if (!keyDisplay->text().isEmpty())
 		{
 			tl = keyDisplay->text().split("+", QString::SkipEmptyParts);
-			Part4 = tl[tl.count()-1];
+			Part4 = tl.last();
 			if (Part4 == tr("Alt") || Part4 == tr("Ctrl") || Part4 == tr("Shift") || Part4 == tr("Meta"))
 				Part4 = "";
 		}
@@ -112,7 +112,7 @@
 		{
 			QStringList tl;
 			tl = keyDisplay->text().split("+", QString::SkipEmptyParts);
-			Part4 = tl[tl.count()-1];
+			Part4 = tl.last();
 			if (Part4 == tr("Alt") || Part4 == tr("Ctrl") || Part4 == tr("Shift") || Part4 == tr("Meta"))
 				Part4 = "";
 		}

Modified: trunk/Scribus/scribus/util_math.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17295&path=/trunk/Scribus/scribus/util_math.cpp
==============================================================================
--- trunk/Scribus/scribus/util_math.cpp (original)
+++ trunk/Scribus/scribus/util_math.cpp Sat Feb 11 18:49:50 2012
@@ -137,15 +137,15 @@
 		myc1 = oline.pointAt(factor3).y();
 		// inner control point
 		sc = seg * (cornerPoints.count()-1) + 180.0 + rota;
-		mxc2 = sin((sc - 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints[cornerPoints.count()-1].x();
-		myc2 = cos((sc - 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints[cornerPoints.count()-1].y();
-		pts.cubicTo(QPointF(mxc1, myc1), QPointF(mxc2, myc2), cornerPoints[cornerPoints.count()-1]);
+		mxc2 = sin((sc - 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints.last().x();
+		myc2 = cos((sc - 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints.last().y();
+		pts.cubicTo(QPointF(mxc1, myc1), QPointF(mxc2, myc2), cornerPoints.last());
 		oline = QLineF(cornerPoints[0], cornerPoints[cornerPoints.count()-2]);
 		mxc1 = oline.pointAt(factor3).x();
 		myc1 = oline.pointAt(factor3).y();
 		// inner control point
-		mxc2 = sin((sc + 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints[cornerPoints.count()-1].x();
-		myc2 = cos((sc + 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints[cornerPoints.count()-1].y();
+		mxc2 = sin((sc + 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints.last().x();
+		myc2 = cos((sc + 90.0) / 180.0 * M_PI) * (trueLength * factor2) + cornerPoints.last().y();
 		pts.cubicTo(QPointF(mxc2, myc2), QPointF(mxc1, myc1), cornerPoints[0]);
 		pts.closeSubpath();
 	}




More information about the scribus-commit mailing list