r16828 by jghali - print dialog : some refactoring to make code a bit more readable

scribus-commit scribus-commit at lists.scribus.net
Tue Sep 13 22:52:27 UTC 2011


Author: jghali
Date: Tue Sep 13 22:52:27 2011
New Revision: 16828

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16828
Log:
print dialog : some refactoring to make code a bit more readable

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

Modified: trunk/Scribus/scribus/ui/printdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16828&path=/trunk/Scribus/scribus/ui/printdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/printdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/printdialog.cpp Tue Sep 13 22:52:27 2011
@@ -200,54 +200,47 @@
 	QMap<QString,CupsOptions::OpData>::Iterator it;
 	for (it = cdia->KeyToText.begin(); it != cdia->KeyToText.end(); ++it)
 	{
-		if (cdia->KeyToDefault[it.key()] != cdia->FlagsOpt.at(it.value().Cnum)->currentText())
+		if (cdia->KeyToDefault[it.key()] == cdia->FlagsOpt.at(it.value().Cnum)->currentText())
+			continue;
+
+		if (it.value().KeyW == "mirror")
+			PrinterOpts += " -o mirror";
+		else if (it.value().KeyW == "page-set")
 		{
-			if (it.value().KeyW == "mirror")
-				PrinterOpts += " -o mirror";
+			PrinterOpts += " -o " + it.value().KeyW + "=";
+			if (cdia->FlagsOpt.at(it.value().Cnum)->currentIndex() == 1)
+				PrinterOpts += "even";
 			else
+				PrinterOpts += "odd";
+		}
+		else if (it.value().KeyW == "number-up")
+		{
+			PrinterOpts += " -o " + it.value().KeyW + "=";
+			switch (cdia->FlagsOpt.at(it.value().Cnum)->currentIndex())
 			{
-				if (it.value().KeyW == "page-set")
-				{
-					PrinterOpts += " -o "+it.value().KeyW+"=";
-					if (cdia->FlagsOpt.at(it.value().Cnum)->currentIndex() == 1)
-						PrinterOpts += "even";
-					else
-						PrinterOpts += "odd";
-				}
-				else
-				{
-					if (it.value().KeyW == "number-up")
-					{
-						PrinterOpts += " -o "+it.value().KeyW+"=";
-						switch (cdia->FlagsOpt.at(it.value().Cnum)->currentIndex())
-						{
-							case 1:
-								PrinterOpts += "2";
-								break;
-							case 2:
-								PrinterOpts += "4";
-								break;
-							case 3:
-								PrinterOpts += "6";
-								break;
-							case 4:
-								PrinterOpts += "9";
-								break;
-							case 5:
-								PrinterOpts += "16";
-								break;
-						}
-					}
-					else
-					{
-						if (it.value().KeyW == "orientation")
-							PrinterOpts += " -o landscape";
-						else
-							PrinterOpts += " -o " +
-									it.value().KeyW+"="+cdia->FlagsOpt.at(it.value().Cnum)->currentText();
-					}
-				}
+				case 1:
+					PrinterOpts += "2";
+					break;
+				case 2:
+					PrinterOpts += "4";
+					break;
+				case 3:
+					PrinterOpts += "6";
+					break;
+				case 4:
+					PrinterOpts += "9";
+					break;
+				case 5:
+					PrinterOpts += "16";
+					break;
 			}
+		}
+		else if (it.value().KeyW == "orientation")
+			PrinterOpts += " -o landscape";
+		else
+		{
+			PrinterOpts += " -o " +
+				it.value().KeyW+"="+cdia->FlagsOpt.at(it.value().Cnum)->currentText();
 		}
 	}
 #endif




More information about the scribus-commit mailing list