r19398 by jghali - remove unnecessarily long if() blocks

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 2 16:13:18 UTC 2014


Author: jghali
Date: Sat Aug  2 16:13:18 2014
New Revision: 19398

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19398
Log:
remove unnecessarily long if() blocks

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

Modified: trunk/Scribus/scribus/ui/colorcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19398&path=/trunk/Scribus/scribus/ui/colorcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorcombo.cpp (original)
+++ trunk/Scribus/scribus/ui/colorcombo.cpp Sat Aug  2 16:13:18 2014
@@ -44,41 +44,41 @@
 
 QString ColorCombo::currentColor() const
 {
-		return currentText();
+	return currentText();
 }
 
 void ColorCombo::updateBox(ColorList& list, ColorCombo::PixmapType pixType , bool insertNone)
 {
 	ColorListBox* clb = dynamic_cast<ColorListBox*>(view());
-	if ( clb )
+	if (!clb)
+		return;
+
+	clb->clear();
+	if ( insertNone )
 	{
-		clb->clear();
-		if ( insertNone )
-		{
-			clb->addItem(CommonStrings::tr_NoneColor);
-			clb->item(0)->setData(Qt::UserRole, CommonStrings::None);
-		}
-		if ( pixType == ColorCombo::fancyPixmaps )
-			clb->insertItems(list, ColorListBox::fancyPixmap);
-		else if ( pixType == ColorCombo::widePixmaps )
-			clb->insertItems(list, ColorListBox::widePixmap);
-		else if ( pixType == ColorCombo::smallPixmaps )
-			clb->insertItems(list, ColorListBox::smallPixmap);
+		clb->addItem(CommonStrings::tr_NoneColor);
+		clb->item(0)->setData(Qt::UserRole, CommonStrings::None);
 	}
+	if ( pixType == ColorCombo::fancyPixmaps )
+		clb->insertItems(list, ColorListBox::fancyPixmap);
+	else if ( pixType == ColorCombo::widePixmaps )
+		clb->insertItems(list, ColorListBox::widePixmap);
+	else if ( pixType == ColorCombo::smallPixmaps )
+		clb->insertItems(list, ColorListBox::smallPixmap);
 }
 
 void ColorCombo::insertItems(ColorList& list, ColorCombo::PixmapType pixType)
 {
 	ColorListBox* clb = dynamic_cast<ColorListBox*>(view());
-	if ( clb )
-	{
-		if ( pixType == ColorCombo::fancyPixmaps )
-			clb->insertItems(list, ColorListBox::fancyPixmap);
-		else if ( pixType == ColorCombo::widePixmaps )
-			clb->insertItems(list, ColorListBox::widePixmap);
-		else if ( pixType == ColorCombo::smallPixmaps )
-			clb->insertItems(list, ColorListBox::smallPixmap);
-	}
+	if (!clb)
+		return;
+
+	if ( pixType == ColorCombo::fancyPixmaps )
+		clb->insertItems(list, ColorListBox::fancyPixmap);
+	else if ( pixType == ColorCombo::widePixmaps )
+		clb->insertItems(list, ColorListBox::widePixmap);
+	else if ( pixType == ColorCombo::smallPixmaps )
+		clb->insertItems(list, ColorListBox::smallPixmap);
 }
 
 void ColorCombo::insertSmallItem( const ScColor& col, ScribusDoc* doc, const QString& colName )




More information about the scribus-commit mailing list