r15498 by jghali - some simplifications thanks to QString chop() function

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 4 23:39:17 CEST 2010


Author: jghali
Date: Mon Oct  4 21:39:16 2010
New Revision: 15498

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15498
Log:
some simplifications thanks to QString chop() function

Modified:
    trunk/Scribus/scribus/gtaction.cpp
    trunk/Scribus/scribus/pluginmanager.cpp
    trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
    trunk/Scribus/scribus/ui/scrspinbox.cpp

Modified: trunk/Scribus/scribus/gtaction.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15498&path=/trunk/Scribus/scribus/gtaction.cpp
==============================================================================
--- trunk/Scribus/scribus/gtaction.cpp (original)
+++ trunk/Scribus/scribus/gtaction.cpp Mon Oct  4 21:39:16 2010
@@ -678,17 +678,17 @@
 			QString b = colors[2].left( ( colors[2].length() - 1 ) );
 			if( r.contains( "%" ) )
 			{
-				r = r.left( r.length() - 1 );
+				r.chop(1);
 				r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
 			}
 			if( g.contains( "%" ) )
 			{
-				g = g.left( g.length() - 1 );
+				g.chop(1);
 				g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
 			}
 			if( b.contains( "%" ) )
 			{
-				b = b.left( b.length() - 1 );
+				b.chop(1);
 				b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
 			}
 			c = QColor(r.toInt(), g.toInt(), b.toInt());

Modified: trunk/Scribus/scribus/pluginmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15498&path=/trunk/Scribus/scribus/pluginmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/pluginmanager.cpp (original)
+++ trunk/Scribus/scribus/pluginmanager.cpp Mon Oct  4 21:39:16 2010
@@ -129,7 +129,7 @@
 	if (baseName.startsWith("lib"))
 		baseName = baseName.remove(0,3);
 	if (baseName.endsWith(platformDllExtension()))
-		baseName = baseName.left(baseName.length() - 1 - platformDllExtension().length());
+		baseName.chop(1 + platformDllExtension().length());
 	// check name
 	for (int i = 0; i < (int)baseName.length(); i++)
 		if (! baseName[i].isLetterOrNumber() && baseName[i] != '_' )

Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15498&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Mon Oct  4 21:39:16 2010
@@ -1589,17 +1589,17 @@
 		QString b = colors[2].left( ( colors[2].length() - 1 ) );
 		if( r.contains( "%" ) )
 		{
-			r = r.left( r.length() - 1 );
+			r.chop(1);
 			r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
 		}
 		if( g.contains( "%" ) )
 		{
-			g = g.left( g.length() - 1 );
+			g.chop(1);
 			g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
 		}
 		if( b.contains( "%" ) )
 		{
-			b = b.left( b.length() - 1 );
+			b.chop(1);
 			b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
 		}
 		c = QColor(r.toInt(), g.toInt(), b.toInt());

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15498&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Mon Oct  4 21:39:16 2010
@@ -1981,10 +1981,10 @@
 {
 	QString s1 = s;
 	if (s1.endsWith( ";" ))
-		s1 = s1.left(s1.length() - 1);
+		s1.chop(1);
 	if (s1.endsWith( "%" ))
 	{
-		s1 = s1.left(s1.length() - 1);
+		s1.chop(1);
 		return ScCLocale::toDoubleC(s1) / 100.0;
 	}
 	else
@@ -2205,17 +2205,17 @@
 		QString b = colors[2].left( ( colors[2].length() - 1 ) );
 		if (r.contains( "%" ))
 		{
-			r = r.left( r.length() - 1 );
+			r.chop(1);
 			r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
 		}
 		if (g.contains( "%" ))
 		{
-			g = g.left( g.length() - 1 );
+			g.chop(1);
 			g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
 		}
 		if (b.contains( "%" ))
 		{
-			b = b.left( b.length() - 1 );
+			b.chop(1);
 			b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
 		}
 		c = QColor(r.toInt(), g.toInt(), b.toInt());
@@ -2283,22 +2283,22 @@
 			QString cs = colors[1], ms = colors[2], ys = colors[3], ks = colors[4];
 			if (cs.contains( "%" ))
 			{
-				cs = cs.left( cs.length() - 1 );
+				cs.chop(1);
 				cs = QString::number(ScCLocale::toDoubleC(cs) / 100);
 			}
 			if (ms.contains( "%" ))
 			{
-				ms = ms.left( ms.length() - 1 );
+				ms.chop(1);
 				ms = QString::number(ScCLocale::toDoubleC(ms) / 100);
 			}
 			if (ys.contains( "%" ))
 			{
-				ys = ys.left( ys.length() - 1 );
+				ys.chop(1);
 				ys = QString::number(ScCLocale::toDoubleC(ys) / 100);
 			}
 			if (ks.contains( "%" ))
 			{
-				ks = ks.left( ks.length() - 1 );
+				ks.chop(1);
 				ks = QString::number(ScCLocale::toDoubleC(ks) / 100);
 			}
 			double cv = ScCLocale::toDoubleC(cs);
@@ -2733,7 +2733,7 @@
 			QString temp = stop.attribute( "offset" );
 			if( temp.contains( '%' ) )
 			{
-				temp = temp.left( temp.length() - 1 );
+				temp.chop(1);
 				offset = ScCLocale::toDoubleC(temp) / 100.0;
 			}
 			else

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15498&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp Mon Oct  4 21:39:16 2010
@@ -130,7 +130,7 @@
 	else
 	{
 		if (userTemplatesDir.right(1) == "/")
-			userTemplatesDir = userTemplatesDir.left(userTemplatesDir.length() - 1);
+			userTemplatesDir.chop(1);
 		templatesDir = userTemplatesDir;
 	}
 	dirs->set("collect", templatesDir);

Modified: trunk/Scribus/scribus/ui/scrspinbox.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15498&path=/trunk/Scribus/scribus/ui/scrspinbox.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.cpp (original)
+++ trunk/Scribus/scribus/ui/scrspinbox.cpp Mon Oct  4 21:39:16 2010
@@ -157,7 +157,7 @@
 	ts = ts.trimmed();
 
 	if (ts.endsWith(su))
-		ts = ts.left(ts.length()-su.length());
+		ts.chop(su.length());
 	int pos = ts.length();
 	while (pos > 0)
 	{




More information about the scribus-commit mailing list