r18485 by craig - #10187: Add in page checking to preflight verifier and check for when the applied master page location (l, m, r) is different to the page's location

scribus-commit scribus-commit at lists.scribus.net
Sun Sep 22 18:46:39 UTC 2013


Author: craig
Date: Sun Sep 22 18:46:38 2013
New Revision: 18485

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18485
Log:
#10187: Add in page checking to preflight verifier and check for when the applied master page location (l,m,r) is different to the page's location

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/documentchecker.cpp
    trunk/Scribus/scribus/documentchecker.h
    trunk/Scribus/scribus/prefsstructs.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/scribusstructs.h
    trunk/Scribus/scribus/ui/checkDocument.cpp
    trunk/Scribus/scribus/ui/checkDocument.h

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Sun Sep 22 18:46:38 2013
@@ -912,10 +912,14 @@
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="extrasUpdateDocument";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
-
+	name="extrasUpdateDocument";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+	name="extrasTestQTQuick2_1";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	connect( (*scrActions)["extrasManageImages"], SIGNAL(triggered()), mainWindow, SLOT(StatusPic()) );
 	connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(triggered()), mainWindow, SLOT(generateTableOfContents()) );
 	connect( (*scrActions)["extrasUpdateDocument"], SIGNAL(triggered()), mainWindow, SLOT(updateDocument()) );
+	connect( (*scrActions)["extrasTestQTQuick2_1"], SIGNAL(triggered()), mainWindow, SLOT(testQTQuick2_1()) );
 }
 
 
@@ -1671,7 +1675,7 @@
 	(*scrActions)["extrasDeHyphenateText"]->setTexts( tr("Dehyphenate Text"));
 	(*scrActions)["extrasGenerateTableOfContents"]->setTexts( tr("&Generate Table Of Contents"));
 	(*scrActions)["extrasUpdateDocument"]->setTexts( tr("&Update Document"));
-
+	(*scrActions)["extrasTestQTQuick2_1"]->setTexts( tr("Test Qt Quick"));
 	//Windows Menu
 	(*scrActions)["windowsCascade"]->setText( tr("&Cascade"));
 	(*scrActions)["windowsTile"]->setText( tr("&Tile"));

Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Sun Sep 22 18:46:38 2013
@@ -49,7 +49,6 @@
 
 bool DocumentChecker::checkDocument(ScribusDoc *currDoc)
 {
-	QString chstr;
 	struct CheckerPrefs checkerSettings;
 	checkerSettings.ignoreErrors = currDoc->checkerProfiles()[currDoc->curCheckProfile()].ignoreErrors;
 	checkerSettings.autoCheck = currDoc->checkerProfiles()[currDoc->curCheckProfile()].autoCheck;
@@ -71,10 +70,57 @@
 	checkerSettings.checkDeviceColorsAndOutputIntent = currDoc->checkerProfiles()[currDoc->curCheckProfile()].checkDeviceColorsAndOutputIntent;
 	checkerSettings.checkFontNotEmbedded = currDoc->checkerProfiles()[currDoc->curCheckProfile()].checkFontNotEmbedded;
 	checkerSettings.checkFontIsOpenType = currDoc->checkerProfiles()[currDoc->curCheckProfile()].checkFontIsOpenType;
+	checkerSettings.checkOppositePageMaster = currDoc->checkerProfiles()[currDoc->curCheckProfile()].checkOppositePageMaster;
+	currDoc->pageErrors.clear();
 	currDoc->docItemErrors.clear();
 	currDoc->masterItemErrors.clear();
 	currDoc->docLayerErrors.clear();
-	errorCodes itemError;
+
+	checkPages(currDoc, checkerSettings);
+	checkLayers(currDoc, checkerSettings);
+	//update all marks references and check if that changes anything in doc
+	currDoc->setNotesChanged(currDoc->updateMarks(true));
+
+	checkItems(currDoc, checkerSettings);
+
+	return (currDoc->hasPreflightErrors());
+}
+
+void DocumentChecker::checkPages(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings)
+{
+	errorCodes pageError;
+	for (int i=0; i < currDoc->DocPages.count(); ++i )
+	{
+		pageError.clear();
+		PageLocation pageLoc=currDoc->locationOfPage(i);
+		int masterPageNumber = currDoc->MasterNames[currDoc->DocPages[i]->MPageNam];
+		int masterPageLocation=currDoc->MasterPages[masterPageNumber]->LeftPg;
+		bool error=0;
+		if (currDoc->pagePositioning() == singlePage)
+		{
+			if (!(pageLoc==LeftPage && masterPageLocation==0))
+				error=1;
+		}
+		else
+		{
+			if (pageLoc==LeftPage && masterPageLocation==1)
+				error=0;
+			else if (pageLoc==RightPage && masterPageLocation==0)
+				error=0;
+			else if (pageLoc==MiddlePage && masterPageLocation==2)
+				error=0;
+			else
+				error=1;
+		}
+		if (error)
+			pageError.insert(AppliedMasterDifferentSide,0);
+		if (pageError.count() != 0)
+			currDoc->pageErrors.insert(i, pageError);
+	}
+}
+
+void DocumentChecker::checkLayers(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings)
+{
 	errorCodes layerError;
 	int Lnr;
 	ScLayer ll;
@@ -99,9 +145,12 @@
 		if (layerError.count() != 0)
 			currDoc->docLayerErrors.insert(ll.ID, layerError);
 	}
-
-	//update all marks references and check if that changes anything in doc
-	currDoc->setNotesChanged(currDoc->updateMarks(true));
+}
+
+void DocumentChecker::checkItems(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings)
+{
+	QString chstr;
+	errorCodes itemError;
 
 	QList<PageItem*> allItems;
 	uint masterItemsCount = currDoc->MasterItems.count();
@@ -685,5 +734,4 @@
 		}
 		allItems.clear();
 	}
-	return ((currDoc->docItemErrors.count() != 0) || (currDoc->masterItemErrors.count() != 0) || (currDoc->docLayerErrors.count() != 0));
 }

Modified: trunk/Scribus/scribus/documentchecker.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/documentchecker.h
==============================================================================
--- trunk/Scribus/scribus/documentchecker.h (original)
+++ trunk/Scribus/scribus/documentchecker.h Sun Sep 22 18:46:38 2013
@@ -39,6 +39,9 @@
 
 		//! Check the passed document for errors, return true on error found
 		static bool checkDocument(ScribusDoc *currDoc);
+		static void checkPages(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings);
+		static void checkLayers(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings);
+		static void checkItems(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings);
 };
 
 #endif

Modified: trunk/Scribus/scribus/prefsstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/prefsstructs.h
==============================================================================
--- trunk/Scribus/scribus/prefsstructs.h (original)
+++ trunk/Scribus/scribus/prefsstructs.h Sun Sep 22 18:46:38 2013
@@ -52,6 +52,7 @@
 	bool checkFontNotEmbedded; // embedded PDF might use fonts without embedding
 	bool checkFontIsOpenType; // embedded PDF might use OpenType font program (only allowed in PDF/X-4 and PDF 1.6)
 	bool checkPartFilledImageFrames;
+	bool checkOppositePageMaster;
 };
 
 typedef QMap<QString, CheckerPrefs> CheckerPrefsList;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Sep 22 18:46:38 2013
@@ -50,6 +50,7 @@
 #include <QMouseEvent>
 #include <QPixmap>
 #include <QProgressBar>
+#include <QQuickView>
 #include <QRegExp>
 #include <QStyleFactory>
 #include <QTableWidget>
@@ -1045,6 +1046,7 @@
 	scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras", false);
 	scrMenuMgr->addMenuItem(scrActions["extrasUpdateDocument"], "Extras", false);
 	scrMenuMgr->addMenuItem(scrActions["itemUpdateMarks"], "Extras", true);
+	scrMenuMgr->addMenuItem(scrActions["extrasTestQTQuick2_1"], "Extras", true);
 	connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow()));
 
 	//Window menu
@@ -11575,3 +11577,22 @@
 	scrMenuMgr->setMenuEnabled("Extras", !doc->drawAsPreview);
 	HaveNewSel(-1);
 }
+
+#include <QHBoxLayout>
+void ScribusMainWindow::testQTQuick2_1()
+{
+	qDebug()<<"Testing Qt Quick 2.0";
+
+	QQuickView qqv;
+
+
+	QDialog d(this);
+	QHBoxLayout *layout = new QHBoxLayout(&d);
+	QWidget *container = createWindowContainer(&qqv, this);
+	d.setMinimumSize(300, 200);
+	d.setMaximumSize(300, 200);
+	d.setFocusPolicy(Qt::TabFocus);
+	qqv.setSource(QUrl::fromLocalFile("//Users/craig/scribus/PostTrunk/Scribus/scribus/ui/qtq_test1.qml"));
+	layout->addWidget(container);
+	d.exec();
+}

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sun Sep 22 18:46:38 2013
@@ -539,6 +539,7 @@
 	//connected to signal emited by actions when "Update Marks" menu item is triggered
 	void slotUpdateMarks();
 	bool editMarkDlg(Mark *mrk, PageItem_TextFrame* currItem = NULL);
+	void testQTQuick2_1();
 
 signals:
 	void AppModeChanged(int oldMode, int newMode);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Sep 22 18:46:38 2013
@@ -263,6 +263,7 @@
 	DoDrawing(true),
 	OpenNodes(),
 	CurTimer(0),
+	pageErrors(),
 	docLayerErrors(),
 	docItemErrors(),
 	masterItemErrors(),
@@ -378,6 +379,7 @@
 	DoDrawing(true),
 	OpenNodes(),
 	CurTimer(0),
+	pageErrors(),
 	docLayerErrors(),
 	docItemErrors(),
 	masterItemErrors(),
@@ -16798,6 +16800,16 @@
 	it->invalid = true;
 }
 
+bool ScribusDoc::hasPreflightErrors()
+{
+	return (
+			(pageErrors.count() != 0) ||
+			(docItemErrors.count() != 0) ||
+			(masterItemErrors.count() != 0) ||
+			(docLayerErrors.count() != 0)
+			);
+}
+
 void ScribusDoc::itemResizeToMargin(PageItem* item, int direction)
 {
 	//FIX ME: for now avoid for rotated items

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sun Sep 22 18:46:38 2013
@@ -1180,6 +1180,7 @@
 	int addToInlineFrames(PageItem *item);
 	void removeInlineFrame(int fIndex);
 	void checkItemForFrames(PageItem *it, int fIndex);
+	bool hasPreflightErrors();
 
 protected:
 	void addSymbols();
@@ -1348,6 +1349,7 @@
 	};
 	QList<OpenNodesList> OpenNodes;
 	QTimer *CurTimer;
+	QMap<int, errorCodes> pageErrors;
 	QMap<int, errorCodes> docLayerErrors;
 	QMap<PageItem*, errorCodes> docItemErrors;
 	QMap<PageItem*, errorCodes> masterItemErrors;

Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Sun Sep 22 18:46:38 2013
@@ -278,7 +278,8 @@
 	EmbeddedFontIsOpenType=16,
 	OffConflictLayers=17,
 	PartFilledImageFrame= 18,
-	MarksChanged = 19
+	MarksChanged = 19,
+	AppliedMasterDifferentSide = 20
 } PreflightError;
 
 typedef QMap<PreflightError, int> errorCodes;

Modified: trunk/Scribus/scribus/ui/checkDocument.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/ui/checkDocument.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/checkDocument.cpp (original)
+++ trunk/Scribus/scribus/ui/checkDocument.cpp Sun Sep 22 18:46:38 2013
@@ -202,7 +202,6 @@
 		case MissingGlyph:
 			item->setText(COLUMN_PROBLEM, missingGlyph);
 			item->setIcon(COLUMN_ITEM, graveError );
-// 			globalGraveError = true;
 			pageGraveError = true;
 			itemError = true;
 			break;
@@ -224,7 +223,6 @@
 			{
 				item->setText(COLUMN_PROBLEM, missingImg);
 				item->setIcon(COLUMN_ITEM, graveError );
-// 				globalGraveError = true;
 				pageGraveError = true;
 			}
 			break;
@@ -251,7 +249,6 @@
 		case Transparency:
 			item->setText(COLUMN_PROBLEM, transpar);
 			item->setIcon(COLUMN_ITEM, graveError );
-// 			globalGraveError = true;
 			pageGraveError = true;
 			itemError = true;
 			break;
@@ -266,12 +263,10 @@
 		case ImageIsGIF:
 			item->setText(COLUMN_PROBLEM, isGIF);
 			item->setIcon(COLUMN_ITEM, onlyWarning);
-			//errorText->setToolTip( isGIFtoolTip);
 			break;
 		case WrongFontInAnnotation:
 			item->setText(COLUMN_PROBLEM, WrongFont);
 			item->setIcon(COLUMN_ITEM, graveError );
-// 			globalGraveError = true;
 			pageGraveError = true;
 			itemError = true;
 			break;
@@ -295,14 +290,6 @@
 		item->setText(COLUMN_LAYER, layer->Name);
 		item->setData(COLUMN_LAYER, Qt::DecorationRole, layer->markerColor);
 	}
-// 	if (pageItem->asTextFrame())
-// 	{
-// 		int l = pageItem->itemText.length();
-// 		// preview of the text
-// 		item->setText(COLUMN_INFO, pageItem->itemText.text(0, l > 20 ? 20 : l));
-// 	}
-// 	else if (pageItem->asImageFrame())
-// 		item->setText(COLUMN_INFO, pageItem->externalFile());
 }
 
 void CheckDocument::buildErrorList(ScribusDoc *doc)
@@ -324,10 +311,7 @@
 	for (it = doc->checkerProfiles().begin(); it != itend ; ++it)
 		curCheckProfile->addItem(it.key());
 	setCurrentComboItem(curCheckProfile, doc->curCheckProfile());
-
-	if ((doc->docItemErrors.count() == 0)
-		 && (doc->masterItemErrors.count() == 0)
-		 && (doc->docLayerErrors.count() == 0)
+	if (!doc->hasPreflightErrors()
 	    //this flag is used by documentchecker as indicator for marks change after updating
 		&& !doc->notesChanged())
 	{
@@ -503,7 +487,26 @@
 				page = new QTreeWidgetItem( reportDisplay);
 				pageMap.insert(page, doc->DocPages.at(aPage));
 			}
-// 			pagep = page;
+
+			QMap<int, errorCodes>::Iterator pageErrorsIt;
+			for (pageErrorsIt = doc->pageErrors.begin();
+				 pageErrorsIt != doc->pageErrors.end();
+				 ++pageErrorsIt)
+			{
+				if (pageErrorsIt.key() == aPage)
+				{
+					if (page==NULL)
+					{
+						page = new QTreeWidgetItem( reportDisplay);
+						pageMap.insert(page, doc->DocPages.at(aPage));
+					}
+					QTreeWidgetItem * errorText = new QTreeWidgetItem(page);
+					errorText->setText(COLUMN_PROBLEM, appliedMasterDifferentSide);
+					errorText->setIcon(COLUMN_ITEM, onlyWarning );
+					page->setExpanded( true );
+				}
+			}
+
 			QMap<PageItem*, errorCodes>::Iterator docItemErrorsIt;
 			for (docItemErrorsIt = doc->docItemErrors.begin();
 				 docItemErrorsIt != doc->docItemErrors.end();
@@ -572,7 +575,6 @@
 		for (freeItemsErrorsIt = doc->docItemErrors.begin(); freeItemsErrorsIt != doc->docItemErrors.end(); ++freeItemsErrorsIt)
 		{
 			if (doc->OnPage(freeItemsErrorsIt.key()) == -1)
-		//	if (freeItemsErrorsIt.key()->OwnPage == -1)
 			{
 				hasfreeItems = true;
 				break;
@@ -583,11 +585,9 @@
 			bool hasError = false;
 			bool pageGraveError = false;
 			QTreeWidgetItem * freeItem = new QTreeWidgetItem( reportDisplay);//, pagep );
-// 			pagep = page;
 			for (freeItemsErrorsIt = doc->docItemErrors.begin(); freeItemsErrorsIt != doc->docItemErrors.end(); ++freeItemsErrorsIt)
 			{
 				if (doc->OnPage(freeItemsErrorsIt.key()) == -1)
-			//	if (freeItemsErrorsIt.key()->OwnPage == -1)
 				{
 					hasError = true;
 					QTreeWidgetItem * object = new QTreeWidgetItem(freeItem);
@@ -631,19 +631,12 @@
 		}
 		// END of FREE ITEMS
 
-// 		if (globalGraveError)
-// 			documentItem->setIcon(COLUMN_ITEM, graveError );
-// 		else
-// 			documentItem->setIcon(COLUMN_ITEM, onlyWarning );
-// 		documentItem->setText(COLUMN_PROBLEM, tr( "Problems found" ) );
-// 		documentItem->setExpanded( true );
 		ignoreErrors->setText( tr("&Ignore Errors"));
 	}
 
 	reportDisplay->resizeColumnToContents(COLUMN_ITEM);
 	reportDisplay->resizeColumnToContents(COLUMN_PROBLEM);
 	reportDisplay->resizeColumnToContents(COLUMN_LAYER);
-// 	reportDisplay->resizeColumnToContents(COLUMN_INFO);
 	connect(curCheckProfile, SIGNAL(activated(const QString&)), this, SLOT(newScan(const QString&)));
 	connect(reportDisplay, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotSelect(QTreeWidgetItem*)));
 }
@@ -690,7 +683,8 @@
 	partFilledImageFrame = tr("Image dimension is smaller than its frame");
 	notCMYKOrSpot = tr("Object colorspace is not CMYK or spot");
 	fontNotEmbedded =  tr("Imported document contains non embedded fonts");
-	//isGIFtoolTip = "<qt>" + tr("GIF images are not reccomended for print. See the online docs for more info") + "</qt>";
+	//isGIFtoolTip = "<qt>" + tr("GIF images are not recommended for print. See the online docs for more info") + "</qt>";
+	appliedMasterDifferentSide = tr("Applied master page has different page destination (left, middle, right side)");
 }
 
 void CheckDocument::setIgnoreEnabled(bool state)

Modified: trunk/Scribus/scribus/ui/checkDocument.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18485&path=/trunk/Scribus/scribus/ui/checkDocument.h
==============================================================================
--- trunk/Scribus/scribus/ui/checkDocument.h (original)
+++ trunk/Scribus/scribus/ui/checkDocument.h Sun Sep 22 18:46:38 2013
@@ -140,6 +140,7 @@
 	QString partFilledImageFrame;
 	QString notCMYKOrSpot;
 	QString fontNotEmbedded;
+	QString appliedMasterDifferentSide;
 
 	//! \brief Flag if is ignore button shown. true = hidden, false = shown.
 	bool noButton;




More information about the scribus-commit mailing list