r20082 by jghali - simplify a bit the code of ScribusDoc::getUsedFonts()

scribus-commit scribus-commit at lists.scribus.net
Thu May 14 01:19:59 UTC 2015


Author: jghali
Date: Thu May 14 01:19:59 2015
New Revision: 20082

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20082
Log:
simplify a bit the code of ScribusDoc::getUsedFonts()

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20082&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu May 14 01:19:59 2015
@@ -4418,31 +4418,17 @@
 
 void ScribusDoc::getUsedFonts(QMap<QString, QMap<uint, FPointArray> > & Really)
 {
-	QList<PageItem*> allItems;
+	QList<PageItem*>  allItems;
+	QList<PageItem*>* itemLists[] = { &MasterItems, &DocItems };
 	PageItem* it = NULL;
 	uint counter = 0;
 	for (uint lc = 0; lc < 2; ++lc)
 	{
-		switch (lc)
-		{
-			case 0:
-				counter = MasterItems.count();
-				break;
-			case 1:
-				counter = DocItems.count();
-				break;
-		}
+		QList<PageItem*>* itemList = itemLists[lc];
+		counter = itemList->count();
 		for (uint d = 0; d < counter; ++d)
 		{
-			switch (lc)
-			{
-				case 0:
-					it = MasterItems.at(d);
-					break;
-				case 1:
-					it = DocItems.at(d);
-					break;
-			}
+			it = itemList->at(d);
 			if (it->isGroup())
 				allItems = it->asGroupFrame()->getItemList();
 			else




More information about the scribus-commit mailing list