r23644 by jghali - Refactor ScribusMainWindow::loadPage()

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 23 18:48:25 UTC 2020


Author: jghali
Date: Thu Apr 23 18:48:25 2020
New Revision: 23644

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23644
Log:
Refactor ScribusMainWindow::loadPage()

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23644&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Thu Apr 23 18:48:25 2020
@@ -3466,52 +3466,51 @@
 
 bool ScribusMainWindow::loadPage(const QString& fileName, int Nr, bool Mpa, const QString& renamedPageName)
 {
-	bool ret = false;
-	if (!fileName.isEmpty())
-	{
-		FileLoader *fl = new FileLoader(fileName);
-		if (fl->testFile() == -1)
-		{
-			delete fl;
-			return false;
-		}
-		doc->setLoading(true);
-		int oldItemsCount = doc->Items->count();
-		if (!fl->loadPage(doc, Nr, Mpa, renamedPageName))
-		{
-			delete fl;
-			doc->setLoading(false);
-			return false;
-		}
+	if (fileName.isEmpty())
+		return false;
+
+	FileLoader *fl = new FileLoader(fileName);
+	if (fl->testFile() == -1)
+	{
 		delete fl;
-		if (ScCore->haveCMS() && doc->cmsSettings().CMSinUse)
-		{
-			recalcColors();
-			doc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK);
-		}
-		int docItemsCount=doc->Items->count();
-		for (int i = oldItemsCount; i < docItemsCount; ++i)
-		{
-			PageItem *ite = doc->Items->at(i);
-			if ((ite->asTextFrame()) && (ite->isBookmark))
-				AddBookMark(ite);
-		}
-		propertiesPalette->updateColorList();
-		contentPalette->updateColorList();
-		emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate);
-		symbolPalette->updateSymbolList();
-		slotDocCh();
-		rebuildLayersList();
-		updateLayerMenu();
-		layerPalette->rebuildList();
+		return false;
+	}
+	doc->setLoading(true);
+	int oldItemsCount = doc->Items->count();
+	if (!fl->loadPage(doc, Nr, Mpa, renamedPageName))
+	{
+		delete fl;
 		doc->setLoading(false);
-		ret = true;
-	}
+		return false;
+	}
+	delete fl;
+	if (ScCore->haveCMS() && doc->cmsSettings().CMSinUse)
+	{
+		recalcColors();
+		doc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK);
+	}
+	int docItemsCount=doc->Items->count();
+	for (int i = oldItemsCount; i < docItemsCount; ++i)
+	{
+		PageItem *ite = doc->Items->at(i);
+		if ((ite->asTextFrame()) && (ite->isBookmark))
+			AddBookMark(ite);
+	}
+	propertiesPalette->updateColorList();
+	contentPalette->updateColorList();
+	emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate);
+	symbolPalette->updateSymbolList();
+	slotDocCh();
+	rebuildLayersList();
+	updateLayerMenu();
+	layerPalette->rebuildList();
+	doc->setLoading(false);
+
 	if (!Mpa)
 		pagePalette->rebuild();
 	view->reformPages();
 	view->DrawNew();
-	return ret;
+	return true;
 }
 
 bool ScribusMainWindow::loadDoc(const QString& fileName)




More information about the scribus-commit mailing list