r22812 by jghali - Some preparatory work to link checker profile used by preflight and PDF version selected in PDF export dialog

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 20 21:17:36 UTC 2019


Author: jghali
Date: Sun Jan 20 21:17:36 2019
New Revision: 22812

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22812
Log:
Some preparatory work to link checker profile used by preflight and PDF version selected in PDF export dialog

Modified:
    trunk/Scribus/scribus/documentchecker.cpp
    trunk/Scribus/scribus/documentchecker.h
    trunk/Scribus/scribus/ui/checkDocument.cpp
    trunk/Scribus/scribus/ui/checkDocument.h

Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22812&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp	(original)
+++ trunk/Scribus/scribus/documentchecker.cpp	Sun Jan 20 21:17:36 2019
@@ -77,8 +77,20 @@
 
 bool DocumentChecker::checkDocument(ScribusDoc *currDoc)
 {
+	const auto& checkerProfiles = currDoc->checkerProfiles();
+	if (!checkerProfiles.contains(currDoc->curCheckProfile()))
+		return false;
+	return checkDocument(currDoc, currDoc->curCheckProfile());
+}
+
+bool DocumentChecker::checkDocument(ScribusDoc *currDoc, const QString& checkerProfile)
+{
+	const auto& checkerProfiles = currDoc->checkerProfiles();
+	if (!checkerProfiles.contains(checkerProfile))
+		return false;
+
 	struct CheckerPrefs checkerSettings;
-	checkerSettings=currDoc->checkerProfiles()[currDoc->curCheckProfile()];
+	checkerSettings = checkerProfiles[checkerProfile];
 	currDoc->pageErrors.clear();
 	currDoc->docItemErrors.clear();
 	currDoc->masterItemErrors.clear();

Modified: trunk/Scribus/scribus/documentchecker.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22812&path=/trunk/Scribus/scribus/documentchecker.h
==============================================================================
--- trunk/Scribus/scribus/documentchecker.h	(original)
+++ trunk/Scribus/scribus/documentchecker.h	Sun Jan 20 21:17:36 2019
@@ -39,6 +39,7 @@
 
 		//! Check the passed document for errors, return true on error found
 		static bool checkDocument(ScribusDoc *currDoc);
+		static bool checkDocument(ScribusDoc *currDoc, const QString& checkerProfile);
 		static void checkPages(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings);
 		static void checkLayers(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings);
 		static void checkItems(ScribusDoc *currDoc, struct CheckerPrefs checkerSettings);

Modified: trunk/Scribus/scribus/ui/checkDocument.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22812&path=/trunk/Scribus/scribus/ui/checkDocument.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/checkDocument.cpp	(original)
+++ trunk/Scribus/scribus/ui/checkDocument.cpp	Sun Jan 20 21:17:36 2019
@@ -19,7 +19,9 @@
 #include <QTreeWidgetItem>
 #include <QVBoxLayout>
 
+#include "commonstrings.h"
 #include "documentchecker.h"
+#include "pdfoptions.h"
 #include "prefsmanager.h"
 #include "sccombobox.h"
 #include "scpage.h"
@@ -93,7 +95,6 @@
 	connect(curCheckProfile, SIGNAL(activated(const QString&)), this, SLOT(newScan(const QString&)));
 	connect(reScan, SIGNAL(clicked()), this, SLOT(doReScan()));
 }
-
 
 void CheckDocument::changeEvent(QEvent *e)
 {
@@ -146,6 +147,40 @@
 	warnMap.insert(PV_LAYER_PRINTVIS_MISMATCH,	qMakePair(tr("Print/Visible mismatch"),									tr("This layer uses transparency, only an issue if using older printing profiles. You may safely ignore this when using modern printing methods, or exporting to PDF version greater than 1.4.")));
 }
 
+QString CheckDocument::bestCheckerProfileForCheckMode(const QString& defaultProfile)
+{
+	QString bestProfile = bestCheckerProfileForCheckMode(this->checkMode, defaultProfile);
+	return bestProfile;
+}
+
+QString CheckDocument::bestCheckerProfileForCheckMode(CheckMode mode, const QString& defaultProfile)
+{
+	QString bestProfile = defaultProfile;
+
+	if (mode == CheckDocument::checkPDF)
+	{
+		PDFOptions::PDFVersion pdfVersion = m_Doc->pdfOptions().Version;
+		if (pdfVersion == PDFOptions::PDFVersion_13)
+			bestProfile = CommonStrings::PDF_1_3;
+		else if (pdfVersion == PDFOptions::PDFVersion_14)
+			bestProfile = CommonStrings::PDF_1_4;
+		else if (pdfVersion == PDFOptions::PDFVersion_15)
+			bestProfile = CommonStrings::PDF_1_5;
+		else if (pdfVersion == PDFOptions::PDFVersion_X1a)
+			bestProfile = CommonStrings::PDF_X1a;
+		else if (pdfVersion == PDFOptions::PDFVersion_X3)
+			bestProfile = CommonStrings::PDF_X3;
+		else if (pdfVersion == PDFOptions::PDFVersion_X4)
+			bestProfile = CommonStrings::PDF_X4;
+	}
+	else if (mode == CheckDocument::checkEPS)
+		bestProfile = CommonStrings::PostScript;
+
+	const auto& checkerProfiles = m_Doc->checkerProfiles();
+	if (checkerProfiles.contains(bestProfile))
+		return bestProfile;
+	return defaultProfile;
+}
 
 void CheckDocument::setDoc(ScribusDoc *doc)
 {

Modified: trunk/Scribus/scribus/ui/checkDocument.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22812&path=/trunk/Scribus/scribus/ui/checkDocument.h
==============================================================================
--- trunk/Scribus/scribus/ui/checkDocument.h	(original)
+++ trunk/Scribus/scribus/ui/checkDocument.h	Sun Jan 20 21:17:36 2019
@@ -70,6 +70,15 @@
 
 	//! \brief Current state of P.V.
 	CheckMode checkMode;
+
+	/*! \brief Best checker profile best suited for current check mode
+	           (PDF, EPS, PS, ...)
+	*/
+	QString bestCheckerProfileForCheckMode(const QString& defaultProfile);
+
+	/*! \brief Best checker profile best suited for specific check mode
+	*/
+	QString bestCheckerProfileForCheckMode(CheckMode mode, const QString& defaultProfile);
 
 public slots:
 	/*! \brief Called when is selected a new item in error list.




More information about the scribus-commit mailing list