r22578 by jghali - more refactoring for image manager

scribus-commit scribus-commit at lists.scribus.net
Wed Jun 6 10:58:29 UTC 2018


Author: jghali
Date: Wed Jun  6 10:58:29 2018
New Revision: 22578

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22578
Log:
more refactoring for image manager

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

Modified: trunk/Scribus/scribus/ui/picstatus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22578&path=/trunk/Scribus/scribus/ui/picstatus.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/picstatus.cpp	(original)
+++ trunk/Scribus/scribus/ui/picstatus.cpp	Wed Jun  6 10:58:29 2018
@@ -235,29 +235,30 @@
 {
 	QListWidgetItem *firstItem = 0;
 	QMap<int, PicItem*> sorted;
+
 	int num = imageViewArea->count();
-	if (num != 0)
-	{
-		firstItem = imageViewArea->currentItem();
-		for (int a = num-1; a > -1; --a)
-		{
-			QListWidgetItem *ite = imageViewArea->takeItem(a);
-			PicItem *item = (PicItem*)ite;
-			sorted.insertMulti(item->PageItemObject->OwnPage, item);
-		}
-		int counter = 0;
-		foreach (int i, sorted.uniqueKeys())
-		{
-			foreach (PicItem* val, sorted.values(i))
-			{
-				imageViewArea->insertItem(counter, val);
-				counter++;
-			}
-		}
-		imageViewArea->setCurrentItem(firstItem);
-		imageSelected(firstItem);
-		sortOrder = 1;
-	}
+	if (num == 0)
+		return;
+
+	firstItem = imageViewArea->currentItem();
+	for (int a = num-1; a > -1; --a)
+	{
+		QListWidgetItem *ite = imageViewArea->takeItem(a);
+		PicItem *item = (PicItem*)ite;
+		sorted.insertMulti(item->PageItemObject->OwnPage, item);
+	}
+	int counter = 0;
+	foreach (int i, sorted.uniqueKeys())
+	{
+		foreach (PicItem* val, sorted.values(i))
+		{
+			imageViewArea->insertItem(counter, val);
+			counter++;
+		}
+	}
+	imageViewArea->setCurrentItem(firstItem);
+	imageSelected(firstItem);
+	sortOrder = 1;
 }
 
 void PicStatus::slotRightClick()
@@ -410,11 +411,10 @@
 
 void PicStatus::visiblePic()
 {
-	if (currItem != nullptr)
-	{
-		currItem->setImageVisible(isVisibleCheck->isChecked());
-		emit refreshItem(currItem);
-	}
+	if (currItem == nullptr)
+		return;
+	currItem->setImageVisible(isVisibleCheck->isChecked());
+	emit refreshItem(currItem);
 }
 
 void PicStatus::GotoPic()
@@ -537,9 +537,8 @@
 
 void PicStatus::doEditImage()
 {
-	if (currItem != nullptr)
-	{
-		SelectPic();
-		ScCore->primaryMainWindow()->callImageEditor();
-	}
-}
+	if (currItem == nullptr)
+		return;
+	SelectPic();
+	ScCore->primaryMainWindow()->callImageEditor();
+}




More information about the scribus-commit mailing list