r23377 by craig - Some code cleanup

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 25 20:54:11 UTC 2019


Author: craig
Date: Mon Nov 25 20:54:11 2019
New Revision: 23377

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23377
Log:
Some code cleanup

Modified:
    trunk/Scribus/scribus/canvasmode_rotate.cpp
    trunk/Scribus/scribus/fonts/scface.h
    trunk/Scribus/scribus/fonts/scface_ttf.cpp
    trunk/Scribus/scribus/fonts/sfnt.cpp
    trunk/Scribus/scribus/fonts/sfnt.h
    trunk/Scribus/scribus/iconmanager.cpp
    trunk/Scribus/scribus/langdef.cpp
    trunk/Scribus/scribus/langdef.h
    trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
    trunk/Scribus/scribus/plugins/import/pages/importpages.h
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
    trunk/Scribus/scribus/plugins/import/pm/importpm.cpp
    trunk/Scribus/scribus/plugins/import/pub/importpub.cpp

Modified: trunk/Scribus/scribus/canvasmode_rotate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/canvasmode_rotate.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_rotate.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_rotate.cpp	Mon Nov 25 20:54:11 2019
@@ -204,8 +204,6 @@
 	const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
 	m_canvasPressCoord = mousePointDoc;
 	
-	double Rxp = 0,  Ryp = 0;
-	PageItem *currItem;
 	m_canvas->PaintSizeRect(QRect());
 //	QRect tx;
 	QTransform pm;
@@ -216,9 +214,9 @@
 	m->accept();
 	m_view->registerMousePress(m->globalPos());
 	QRect mpo(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
-	Rxp  = m_doc->ApplyGridF(m_canvasPressCoord).x();
+	double Rxp = m_doc->ApplyGridF(m_canvasPressCoord).x();
 	m_canvasPressCoord.setX( qRound(Rxp) );
-	Ryp  = m_doc->ApplyGridF(m_canvasPressCoord).y();
+	double Ryp = m_doc->ApplyGridF(m_canvasPressCoord).y();
 	m_canvasPressCoord.setY( qRound(Ryp) );
 	if (m->button() == Qt::MidButton)
 	{
@@ -229,6 +227,7 @@
 	}
 	if (m->button() != Qt::LeftButton)
 		return;
+	PageItem *currItem;
 	if (GetItem(&currItem))
 	{
 		m_inItemRotation = true;
@@ -478,7 +477,7 @@
 		m_doc->setRotationMode(id);
 		return;
 	}
-	else if (e->key() == Qt::Key_Down)
+	if (e->key() == Qt::Key_Down)
 	{
 		auto id = m_view->m_ScMW->propertiesPalette->xyzPal->basePointWidget->checkedId();
 		id = (id + 1) % 5;
@@ -492,57 +491,54 @@
 		increment = 1.0;
 	if (e->key() == Qt::Key_Right)
 		increment = -1.0;
-	if (e->modifiers() & Qt::ControlModifier) {
+	if (e->modifiers() & Qt::ControlModifier)
 		increment *= 10;
-	}
-	if (e->modifiers() & Qt::ShiftModifier) {
+	if (e->modifiers() & Qt::ShiftModifier)
 		increment /= 10;
-	}
+
+	if (increment = 0.0)
+		return;
 	PageItem *currItem;
-	if (increment != 0)
-	{ 
-		if (GetItem(&currItem))
-		{
-			if (!m_view->groupTransactionStarted())
-			{
-				m_view->startGroupTransaction(Um::Rotate, "", Um::IRotate);
-			}
-			if (m_doc->m_Selection->isMultipleSelection())
-			{
-				m_doc->setRotationMode(m_rotMode);
-				m_view->RCenter = m_rotCenter;
-			}
-			if (m_doc->m_Selection->isMultipleSelection())
-				m_doc->rotateGroup(increment, m_view->RCenter);
-			else
-				m_doc->itemSelection_Rotate(currItem->rotation() + increment);
-			m_canvas->setRenderModeUseBuffer(false);
-			if (m_doc->m_Selection->isMultipleSelection())
-			{
-				double x, y, w, h;
-				m_doc->setRotationMode(m_oldRotMode);
-				m_view->RCenter = m_oldRotCenter;
-				m_doc->m_Selection->setGroupRect();
-				m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
-				m_view->updateContents(QRect(static_cast<int>(x - 5), static_cast<int>(y - 5), static_cast<int>(w + 10), static_cast<int>(h + 10)));
-			}
-			else
-			{
-				m_doc->setRedrawBounding(currItem);
-				currItem->OwnPage = m_doc->OnPage(currItem);
-				if (currItem->asLine())
-					m_view->updateContents();
-			}
-		}
-		if (m_view->groupTransactionStarted())
-		{
-			for (int i = 0; i < m_doc->m_Selection->count(); ++i)
-				m_doc->m_Selection->itemAt(i)->checkChanges(true);
-			m_view->endGroupTransaction();
-		}
+	if (GetItem(&currItem))
+	{
+		if (!m_view->groupTransactionStarted())
+			m_view->startGroupTransaction(Um::Rotate, "", Um::IRotate);
+
+		if (m_doc->m_Selection->isMultipleSelection())
+		{
+			m_doc->setRotationMode(m_rotMode);
+			m_view->RCenter = m_rotCenter;
+		}
+		if (m_doc->m_Selection->isMultipleSelection())
+			m_doc->rotateGroup(increment, m_view->RCenter);
+		else
+			m_doc->itemSelection_Rotate(currItem->rotation() + increment);
+		m_canvas->setRenderModeUseBuffer(false);
+		if (m_doc->m_Selection->isMultipleSelection())
+		{
+			double x, y, w, h;
+			m_doc->setRotationMode(m_oldRotMode);
+			m_view->RCenter = m_oldRotCenter;
+			m_doc->m_Selection->setGroupRect();
+			m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
+			m_view->updateContents(QRect(static_cast<int>(x - 5), static_cast<int>(y - 5), static_cast<int>(w + 10), static_cast<int>(h + 10)));
+		}
+		else
+		{
+			m_doc->setRedrawBounding(currItem);
+			currItem->OwnPage = m_doc->OnPage(currItem);
+			if (currItem->asLine())
+				m_view->updateContents();
+		}
+	}
+	if (m_view->groupTransactionStarted())
+	{
 		for (int i = 0; i < m_doc->m_Selection->count(); ++i)
 			m_doc->m_Selection->itemAt(i)->checkChanges(true);
-	}
+		m_view->endGroupTransaction();
+	}
+	for (int i = 0; i < m_doc->m_Selection->count(); ++i)
+		m_doc->m_Selection->itemAt(i)->checkChanges(true);
 }
 
 void CanvasMode_Rotate::createContextMenu(PageItem* currItem, double mx, double my)

Modified: trunk/Scribus/scribus/fonts/scface.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/fonts/scface.h
==============================================================================
--- trunk/Scribus/scribus/fonts/scface.h	(original)
+++ trunk/Scribus/scribus/fonts/scface.h	Mon Nov 25 20:54:11 2019
@@ -88,10 +88,9 @@
 	typedef uint ucs4_type;
 	struct GlyphEncoding
 	{
-		GlyphEncoding() { charcode = 0; toUnicode = "0000"; }
-		ucs4_type charcode;
-		QString   glyphName;
-		QString   toUnicode;
+		ucs4_type charcode {0};
+		QString glyphName;
+		QString toUnicode {"0000"};
 	};
 	typedef QMap<gid_type, GlyphEncoding> FaceEncoding;
 
@@ -117,16 +116,15 @@
 		/// controls load()
 	mutable int usage {0};
 
+		QString family;
+		QString fontFile {"(None)"};
+		QString forDocument;
+		QString psName;
 		QString scName;
-		QString fontFile {"(None)"};
-		int     faceIndex {-1};
-		QString psName;
-		QString family;
 		QString style;
 		QString variant;
 		QStringList fontFeatures;
-
-		QString forDocument;
+		int     faceIndex {-1};
 
 		mutable ScFace::Status status {ScFace::NULLFACE};
 		ScFace::FontType typeCode {ScFace::UNKNOWN_TYPE};

Modified: trunk/Scribus/scribus/fonts/scface_ttf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/fonts/scface_ttf.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface_ttf.cpp	(original)
+++ trunk/Scribus/scribus/fonts/scface_ttf.cpp	Mon Nov 25 20:54:11 2019
@@ -47,7 +47,7 @@
 //		qDebug() << "can't use post table from " << face->family_name << face->style_name << ":" << checkPost.errorMsg;
 //	else
 //		qDebug() << "posttable from" << face->family_name << face->style_name << "has names for" << checkPost.numberOfGlyphs() << "glyphs and" << maxGlyph << "glyphs in charmap";
-	const_cast<bool&>(hasGlyphNames) = checkPost.usable && checkPost.numberOfGlyphs() >= maxGlyph;
+	const_cast<bool&>(hasGlyphNames) = checkPost.usable() && checkPost.numberOfGlyphs() >= maxGlyph;
 }
 
 void ScFace_ttf::unload() const

Modified: trunk/Scribus/scribus/fonts/sfnt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/fonts/sfnt.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/sfnt.cpp	(original)
+++ trunk/Scribus/scribus/fonts/sfnt.cpp	Mon Nov 25 20:54:11 2019
@@ -307,11 +307,31 @@
 
 
 
+bool PostTable::usable() const
+{
+    return m_usable;
+}
+
+void PostTable::setUsable(bool usable)
+{
+    m_usable = usable;
+}
+
+QString PostTable::errorMsg() const
+{
+    return m_errorMsg;
+}
+
+void PostTable::setErrorMsg(const QString& errorMsg)
+{
+    m_errorMsg = errorMsg;
+}
+
 uint PostTable::numberOfGlyphs() const
 {
-	if (m_names.length() > 0)
-		return m_names.length();
-	return post_format10_names_count;
+    if (m_names.length() > 0)
+        return m_names.length();
+    return post_format10_names_count;
 }
 
 QString PostTable::nameFor(uint glyph) const
@@ -332,36 +352,36 @@
 	//qDebug() << "load post" << error << size;
 	if (error || size == 0)
 	{
-		errorMsg = "no post table";
-		usable = false;
+		m_errorMsg = "no post table";
+		m_usable = false;
 		return;
 	}
 	postData.resize(size);
 	error = FT_Load_Sfnt_Table ( face, TTAG_post , 0, reinterpret_cast<FT_Byte*>(postData.data()), &size );
 	if (error)
 	{
-		errorMsg = "can't load post table";
-		usable = false;
+		m_errorMsg = "can't load post table";
+		m_usable = false;
 		return;
 	}
 	
 	switch (sfnt::word(postData, ttf_post_format))
 	{
 		case sfnt::post_format10:
-			usable = true;
+			m_usable = true;
 			m_names.clear();
 			return;
 		case sfnt::post_format20:
 			break;
 		case sfnt::post_format30:
-			errorMsg = QString("post table has no glyph names");
-			usable = false;
+			m_errorMsg = QString("post table has no glyph names");
+			m_usable = false;
 			return;
 		case sfnt::post_format25:
 		case sfnt::post_format40:
 		default:
-			errorMsg = QString("unsupported post format %1").arg(sfnt::word(postData,0));
-			usable = false;
+			m_errorMsg = QString("unsupported post format %1").arg(sfnt::word(postData,0));
+			m_usable = false;
 			return;
 			
 	}
@@ -388,21 +408,21 @@
 		else if (nameIndex < pascalStrings.length() + sfnt::post_format10_names_count)
 			name = pascalStrings[nameIndex - sfnt::post_format10_names_count];
 		else {
-			usable = false;
-			errorMsg = QString("missing name %1 for glyph %2").arg(nameIndex).arg(gid);
+			m_usable = false;
+			m_errorMsg = QString("missing name %1 for glyph %2").arg(nameIndex).arg(gid);
 			return;
 		}
 		if (name != ".notdef" && name[0] != QChar(0) && usedNames.contains(name))
 		{
-			usable = false;
-			errorMsg = QString("duplicate name %1 used for glyphs %2 and %3").arg(name).arg(gid).arg(usedNames[name]);
+			m_usable = false;
+			m_errorMsg = QString("duplicate name %1 used for glyphs %2 and %3").arg(name).arg(gid).arg(usedNames[name]);
 			return;
 		}
 		usedNames[name] = gid;
 		m_names.append(name);
 	}
-	errorMsg = "";
-	usable = true;
+	m_errorMsg = "";
+	m_usable = true;
 }
 
 

Modified: trunk/Scribus/scribus/fonts/sfnt.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/fonts/sfnt.h
==============================================================================
--- trunk/Scribus/scribus/fonts/sfnt.h	(original)
+++ trunk/Scribus/scribus/fonts/sfnt.h	Mon Nov 25 20:54:11 2019
@@ -21,8 +21,8 @@
 
 
 
-namespace sfnt {
-	
+namespace sfnt
+{
 	uchar byte(QByteArray const & bb, uint pos);
 	quint32  word(QByteArray const & bb, uint pos);
 	void  putWord(QByteArray & bb, uint pos, quint32 val);
@@ -41,16 +41,22 @@
 /**
  This class checks the post table of a ttf font.
  */
-class SCRIBUS_API PostTable {
+class SCRIBUS_API PostTable
+{
 	public:
-		PostTable() {usable=false;}
-		bool usable;
-		QString errorMsg;
+		PostTable() = default;
 		uint numberOfGlyphs() const;
 		QString nameFor(uint glyphId) const;
 		void readFrom(FT_Face face);
+		bool usable() const;
+		void setUsable(bool usable);
+		QString errorMsg() const;
+		void setErrorMsg(const QString& errorMsg);
+
 	private:
 		QList<QString> m_names;
+		bool m_usable {false};
+		QString m_errorMsg;
 };
 
 } //namespace

Modified: trunk/Scribus/scribus/iconmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/iconmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/iconmanager.cpp	(original)
+++ trunk/Scribus/scribus/iconmanager.cpp	Mon Nov 25 20:54:11 2019
@@ -141,20 +141,18 @@
 			if (isd.activeversion.isEmpty())
 				continue;
 
-			int av_major, av_minor, av_patch, curr_major, curr_minor, curr_patch, ver_major, ver_minor, ver_patch;
-			int av_fullver, curr_fullver, ver_fullver;
-			av_major = isd.activeversion.section(".", 0, 0).toInt();
-			av_minor = isd.activeversion.section(".", 1, 1).toInt();
-			av_patch = isd.activeversion.section(".", 2, 2).toInt();
-			av_fullver = av_major * 10000 + av_minor * 100 + av_patch;
-			curr_major = m_activeSetVersion.section(".", 0, 0).toInt();
-			curr_minor = m_activeSetVersion.section(".", 1, 1).toInt();
-			curr_patch = m_activeSetVersion.section(".", 2, 2).toInt();
-			curr_fullver = curr_major * 10000 + curr_minor * 100 + curr_patch;
-			ver_major = QString(VERSION).section(".", 0, 0).toInt();
-			ver_minor = QString(VERSION).section(".", 1, 1).toInt();
-			ver_patch = QString(VERSION).section(".", 2, 2).toInt();
-			ver_fullver = ver_major * 10000 + ver_minor * 100 + ver_patch;
+			int av_major = isd.activeversion.section(".", 0, 0).toInt();
+			int av_minor = isd.activeversion.section(".", 1, 1).toInt();
+			int av_patch = isd.activeversion.section(".", 2, 2).toInt();
+			int av_fullver = av_major * 10000 + av_minor * 100 + av_patch;
+			int curr_major = m_activeSetVersion.section(".", 0, 0).toInt();
+			int curr_minor = m_activeSetVersion.section(".", 1, 1).toInt();
+			int curr_patch = m_activeSetVersion.section(".", 2, 2).toInt();
+			int curr_fullver = curr_major * 10000 + curr_minor * 100 + curr_patch;
+			int ver_major = QString(VERSION).section(".", 0, 0).toInt();
+			int ver_minor = QString(VERSION).section(".", 1, 1).toInt();
+			int ver_patch = QString(VERSION).section(".", 2, 2).toInt();
+			int ver_fullver = ver_major * 10000 + ver_minor * 100 + ver_patch;
 			//If iconset version <= app version, and iconset version >= current active iconset version
 			if ((av_fullver <= ver_fullver) && (av_fullver >= curr_fullver))
 			{

Modified: trunk/Scribus/scribus/langdef.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/langdef.cpp
==============================================================================
--- trunk/Scribus/scribus/langdef.cpp	(original)
+++ trunk/Scribus/scribus/langdef.cpp	Mon Nov 25 20:54:11 2019
@@ -21,22 +21,13 @@
 
 #include "langdef.h"
 
-LangDef::LangDef()
-{
-	m_hyphAvailable=false;
-	m_spellAvailable=false;
-	m_transAvailable=false;
-};
+LangDef::LangDef() = default;;
 
 LangDef::LangDef(const QString& pri,
 			 const QString& alt,
 			 const QString& name,
 			 const QString& transName)
 {
-	m_hyphAvailable=false;
-	m_spellAvailable=false;
-	m_transAvailable=false;
-
 	m_priAbbrev=pri;
 	m_altAbbrev=alt;
 	m_name=name;

Modified: trunk/Scribus/scribus/langdef.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/langdef.h
==============================================================================
--- trunk/Scribus/scribus/langdef.h	(original)
+++ trunk/Scribus/scribus/langdef.h	Mon Nov 25 20:54:11 2019
@@ -33,16 +33,16 @@
 		LangDef(const QString& pri, const QString& alt, const QString& name, const QString& transName);
 		~LangDef() {}
 
+		QString m_altAbbrev;
+		QString m_hyphFile;
+		QString m_name;
 		QString m_priAbbrev;
-		QString m_altAbbrev;
-		QString m_name;
+		QString m_spellFile;
+		QString m_transFile;
 		QString m_transName;
-		bool m_hyphAvailable;
-		QString m_hyphFile;
-		bool m_spellAvailable;
-		QString m_spellFile;
-		bool m_transAvailable;
-		QString m_transFile;
+		bool m_hyphAvailable {false};
+		bool m_spellAvailable {false};
+		bool m_transAvailable {false};
 };
 
 #endif // LANGDEF_H

Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.cpp	Mon Nov 25 20:54:11 2019
@@ -621,9 +621,8 @@
 	{
 		ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
 		progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
-		QStringList barNames, barTexts;
-		barNames << "GI";
-		barTexts << tr("Analyzing File:");
+		QStringList barNames("GI");
+		QStringList barTexts(tr("Analyzing File:"));
 		QList<bool> barsNumeric;
 		barsNumeric << false;
 		progressDialog->addExtraProgressBars(barNames, barTexts, barsNumeric);
@@ -799,11 +798,10 @@
 
 bool PagesPlug::convert(const QString& fn)
 {
-	bool retVal = true;
 	importedColors.clear();
 	importedPatterns.clear();
 	m_StyleSheets.clear();
-	m_currentStyleSheet = "";
+	m_currentStyleSheet.clear();
 	if (progressDialog)
 	{
 		progressDialog->setOverallProgress(2);
@@ -819,7 +817,7 @@
 			progressDialog->close();
 		return false;
 	}
-	retVal = false;
+	bool retVal = false;
 	if (uz->contains("index.xml"))
 		retVal = parseDocReference("index.xml", false);
 	else if (uz->contains("index.xml.gz"))
@@ -1549,34 +1547,6 @@
 PageItem* PagesPlug::parseObjReference(QDomElement &draw)
 {
 	ObjState obState;
-	obState.currentPath = QPainterPath();
-	obState.currentPathClosed = false;
-	obState.clipPath = QPainterPath();
-	obState.transform = QTransform();
-	obState.CurrColorFill = CommonStrings::None;
-	obState.fillOpacity = 0.0;
-	obState.CurrColorStroke = CommonStrings::None;
-	obState.strokeOpacity = 0.0;
-	obState.LineW = 1.0;
-	obState.fillGradientTyp = 0;
-	obState.gradientScale = 1.0;
-	obState.maskTyp = 0;
-	obState.strokeTyp = 0;
-	obState.imagePath = "";
-	obState.itemType = 0;
-	obState.patternName = "";
-	obState.patternMask = "";
-	obState.CapStyle = Qt::FlatCap;
-	obState.JoinStyle = Qt::MiterJoin;
-	obState.DashOffset = 0;
-	obState.DashPattern.clear();
-	obState.xPos = 0.0;
-	obState.yPos = 0.0;
-	obState.width = 0.0;
-	obState.height = 0.0;
-	obState.rotation = 0.0;
-	obState.styleRef = "";
-	obState.layoutStyleRef = "";
 	StoryText itemText;
 	itemText.clear();
 	itemText.setDoc(m_Doc);

Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.h	(original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.h	Mon Nov 25 20:54:11 2019
@@ -180,20 +180,20 @@
 	struct ObjState
 	{
 		QPainterPath currentPath;
-		bool currentPathClosed;
+		bool currentPathClosed {false};
 		QPainterPath clipPath;
 		QTransform transform;
-		QString CurrColorFill;
-		double fillOpacity;
-		QString CurrColorStroke;
-		double strokeOpacity;
-		double LineW;
+		QString CurrColorFill {CommonStrings::None};
+		double fillOpacity {0.0};
+		QString CurrColorStroke {CommonStrings::None};
+		double strokeOpacity {0.0};
+		double LineW {1.0};
 		VGradient currentGradient;
 		QPointF gradientStart;
 		QPointF gradientEnd;
 		QPointF gradientFocus;
-		double gradientScale;
-		int fillGradientTyp;
+		double gradientScale {1.0};
+		int fillGradientTyp {0};
 		QString imagePath;
 		QString patternName;
 		VGradient gradientMask;
@@ -201,25 +201,25 @@
 		QPointF maskEnd;
 		QPointF maskFocus;
 		double maskScale;
-		int maskTyp;
+		int maskTyp {0};
 		QString patternMask;
 		VGradient gradientStroke;
 		QPointF strokeStart;
 		QPointF strokeEnd;
 		QPointF strokeFocus;
 		double strokeScale;
-		int strokeTyp;
+		int strokeTyp {0};
 		QString patternStroke;
-		int itemType;
-		Qt::PenCapStyle CapStyle;
-		Qt::PenJoinStyle JoinStyle;
+		int itemType {0};
+		Qt::PenCapStyle CapStyle {Qt::FlatCap};
+		Qt::PenJoinStyle JoinStyle {Qt::MiterJoin};
 		QVector<double> DashPattern;
-		double DashOffset;
-		double xPos;
-		double yPos;
-		double width;
-		double height;
-		double rotation;
+		double DashOffset {0.0};
+		double xPos {0.0};
+		double yPos {0.0};
+		double width {0.0};
+		double height {0.0};
+		double rotation {0.0};
 		QString styleRef;
 		QString layoutStyleRef;
 	};

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	Mon Nov 25 20:54:11 2019
@@ -68,8 +68,7 @@
 	m_Doc = doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
-	progressDialog = nullptr;
-	m_pdfDoc = nullptr;
+
 }
 
 QImage PdfPlug::readThumbnail(const QString& fName)

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.h	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.h	Mon Nov 25 20:54:11 2019
@@ -88,14 +88,14 @@
 	QStringList importedColors;
 
 	bool interactive;
-	MultiProgressDialog * progressDialog;
-	bool cancel;
-	ScribusDoc* m_Doc;
-	Selection* tmpSele;
+	MultiProgressDialog *progressDialog {nullptr};
+	bool cancel {false};
+	ScribusDoc* m_Doc {nullptr};
+	Selection* tmpSele {nullptr};
 	int importerFlags;
 	int oldDocItemCount;
 	QString baseFile;
-	PDFDoc *m_pdfDoc;
+	PDFDoc *m_pdfDoc {nullptr};
 
 public slots:
 	void cancelRequested() { cancel = true; }

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp	Mon Nov 25 20:54:11 2019
@@ -22,39 +22,35 @@
 
 LinkSubmitForm::LinkSubmitForm(Object *actionObj)
 {
-	Object obj1, obj2, obj3;
-	fileName = nullptr;
-	m_flags = 0;
-
-	if (actionObj->isDict())
-	{
-		obj1 = actionObj->dictLookup("F");
-		if (!obj1.isNull())
-		{
-			if (obj1.isDict())
-			{
-				obj3 = obj1.dictLookup("FS");
-				if (!obj3.isNull())
-				{
-					if (obj3.isName())
+	if (!actionObj->isDict())
+		return;
+
+	Object obj1 = actionObj->dictLookup("F");
+	if (!obj1.isNull())
+	{
+		if (obj1.isDict())
+		{
+			Object obj3 = obj1.dictLookup("FS");
+			if (!obj3.isNull())
+			{
+				if (obj3.isName())
+				{
+					POPPLER_CONST char *name = obj3.getName();
+					if (!strcmp(name, "URL"))
 					{
-						POPPLER_CONST char *name = obj3.getName();
-						if (!strcmp(name, "URL"))
-						{
-							obj2 = obj1.dictLookup("F");
-							if (!obj2.isNull())
-								fileName = obj2.getString()->copy();
-						}
+						Object obj2 = obj1.dictLookup("F");
+						if (!obj2.isNull())
+							fileName = obj2.getString()->copy();
 					}
 				}
 			}
 		}
-		obj1 = actionObj->dictLookup("Flags");
-		if (!obj1.isNull())
-		{
-			if (obj1.isNum())
-				m_flags = obj1.getInt();
-		}
+	}
+	obj1 = actionObj->dictLookup("Flags");
+	if (!obj1.isNull())
+	{
+		if (obj1.isNum())
+			m_flags = obj1.getInt();
 	}
 }
 
@@ -65,21 +61,15 @@
 
 LinkImportData::LinkImportData(Object *actionObj)
 {
-	Object obj1, obj3;
-	fileName = nullptr;
-
-	if (actionObj->isDict())
-	{
-		obj1 = actionObj->dictLookup("F");
-		if (!obj1.isNull())
-		{
-			obj3 = getFileSpecNameForPlatform(&obj1);
-			if (!obj3.isNull())
-			{
-				fileName = obj3.getString()->copy();
-			}
-		}
-	}
+	if (!actionObj->isDict())
+		return;
+	Object obj1 = actionObj->dictLookup("F");
+	if (obj1.isNull())
+		return;
+
+	Object obj3 = getFileSpecNameForPlatform(&obj1);
+	if (!obj3.isNull())
+		fileName = obj3.getString()->copy();
 }
 
 LinkImportData::~LinkImportData()
@@ -97,12 +87,9 @@
 {
 	m_doc = doc;
 	m_importedColors = importedColors;
+	CurrColorText = "Black";
+	CurrColorFill = CommonStrings::None;
 	CurrColorStroke = CommonStrings::None;
-	CurrColorFill = CommonStrings::None;
-	CurrColorText = "Black";
-	m_fontSize = 12.0;
-	m_fontName = nullptr;
-	m_itemText = nullptr;
 }
 
 void AnoOutputDev::eoFill(GfxState *state)
@@ -238,36 +225,14 @@
 {
 	m_doc = doc;
 	m_Elements = Elements;
-	m_groupStack.clear();
 	pushGroup();
-	m_clipPaths.clear();
-	m_currentMask = "";
 	m_importedColors = importedColors;
 	CurrColorStroke = "Black";
-	CurrFillShade = 100;
 	CurrColorFill = "Black";
-	CurrStrokeShade = 100;
-	PLineEnd = Qt::FlatCap;
-	PLineJoin = Qt::MiterJoin;
-	DashOffset = 0.0;
-	Coords = "";
-	pathIsClosed = false;
 	tmpSel = new Selection(m_doc, false);
-	firstLayer = true;
-	layerNum = 1;
 	importerFlags = flags;
 	currentLayer = m_doc->activeLayer();
-	xref = nullptr;
-	pdfDoc = nullptr;
-	catalog = nullptr;
-	m_fontEngine = nullptr;
-	m_font = nullptr;
-	m_formWidgets = nullptr;
-	updateGUICounter = 0;
 	layersSetByOCG = false;
-	cropOffsetX = 0;
-	cropOffsetY = 0;
-	inPattern = 0;
 }
 
 SlaOutputDev::~SlaOutputDev()

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h	Mon Nov 25 20:54:11 2019
@@ -73,8 +73,8 @@
 	int getFlags() { return m_flags; }
 
 private:
-	GooString *fileName;		// file name
-	int m_flags;
+GooString *fileName {nullptr};		// file name
+int m_flags {0};
 };
 
 //------------------------------------------------------------------------
@@ -96,7 +96,7 @@
 	GooString *getFileName() { return fileName; }
 
 private:
-	GooString *fileName;		// file name
+GooString *fileName {nullptr};		// file name
 };
 //------------------------------------------------------------------------
 // SplashOutFontFileID
@@ -141,9 +141,9 @@
 	QString CurrColorText;
 	QString CurrColorFill;
 	QString CurrColorStroke;
-	double m_fontSize;
-	GooString *m_fontName;
-	GooString *m_itemText;
+	double m_fontSize {12};
+	GooString *m_fontName {nullptr};
+	GooString *m_itemText {nullptr};
 
 private:
 	QString getColor(GfxColorSpace *color_space, POPPLER_CONST_070 GfxColor *color, int *shade);
@@ -274,8 +274,8 @@
 	void processLink(AnnotLink * /*link*/) override { qDebug() << "Draw Link"; }
 
 	bool layersSetByOCG;
-	double cropOffsetX;
-	double cropOffsetY;
+	double cropOffsetX {0.0};
+	double cropOffsetY {0.0};
 	int rotate;
 
 private:
@@ -288,15 +288,15 @@
 	void pushGroup(const QString& maskName = "", GBool forSoftMask = gFalse, GBool alpha = gFalse, bool inverted = false);
 	QString UnicodeParsedString(POPPLER_CONST GooString *s1);
 	bool checkClip();
-	bool pathIsClosed;
+	bool pathIsClosed {false};
 	QString CurrColorFill;
-	int CurrFillShade;
+	int CurrFillShade {100};
 	QString CurrColorStroke;
-	int CurrStrokeShade;
-	Qt::PenCapStyle PLineEnd;
-	Qt::PenJoinStyle PLineJoin;
+	int CurrStrokeShade {100};
+	Qt::PenCapStyle PLineEnd {Qt::FlatCap};
+	Qt::PenJoinStyle PLineJoin {Qt::MiterJoin};
 	QVector<double> DashValues;
-	double DashOffset;
+	double DashOffset {0.0};
 	QString Coords;
 	FPointArray m_currentClipPath;
 	QStack<FPointArray> m_clipPaths;
@@ -327,18 +327,18 @@
 		QString ocgName;
 	};
 	QStack<mContent> m_mcStack;
-	int inPattern;
-	int layerNum;
+	int inPattern {0};
+	int layerNum {1};
 	int currentLayer;
-	bool firstLayer;
+	bool firstLayer {true};
 	int importerFlags;
-	int updateGUICounter;
-	XRef *xref;		// xref table for current document
-	PDFDoc *pdfDoc;
-	Catalog *catalog;
-	SplashFontEngine *m_fontEngine;
-	SplashFont *m_font;
-	FormPageWidgets *m_formWidgets;
+	int updateGUICounter {0};
+	XRef *xref {nullptr};		// xref table for current document
+	PDFDoc *pdfDoc {nullptr};
+	Catalog *catalog {nullptr};
+	SplashFontEngine *m_fontEngine {nullptr};
+	SplashFont *m_font {nullptr};
+	FormPageWidgets *m_formWidgets {nullptr};
 	QHash<QString, QList<int> > m_radioMap;
 	QHash<int, PageItem*> m_radioButtons;
 	int m_actPage;

Modified: trunk/Scribus/scribus/plugins/import/pm/importpm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pm/importpm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pm/importpm.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pm/importpm.cpp	Mon Nov 25 20:54:11 2019
@@ -67,11 +67,8 @@
 QImage PmPlug::readThumbnail(const QString& fName)
 {
 	QFileInfo fi = QFileInfo(fName);
-	double b, h;
-	b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
-	h = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
-	docWidth = b;
-	docHeight = h;
+	docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
+	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
 	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
@@ -127,7 +124,6 @@
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 	importerFlags = flags;
 	cancel = false;
-	double b, h;
 	bool ret = false;
 	QFileInfo fi = QFileInfo(fNameIn);
 	if ( !ScCore->usingGUI() )
@@ -155,18 +151,18 @@
 	else
 		progressDialog = nullptr;
 /* Set default Page to size defined in Preferences */
-	b = 0.0;
-	h = 0.0;
+	double w = 0.0;
+	double h = 0.0;
 	if (progressDialog)
 	{
 		progressDialog->setOverallProgress(1);
 		qApp->processEvents();
 	}
-	if (b == 0.0)
-		b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
+	if (w == 0.0)
+		w = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 	if (h == 0.0)
 		h = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
-	docWidth = b;
+	docWidth = w;
 	docHeight = h;
 	baseX = 0;
 	baseY = 0;

Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23377&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.cpp	Mon Nov 25 20:54:11 2019
@@ -70,11 +70,8 @@
 QImage PubPlug::readThumbnail(const QString& fName)
 {
 	QFileInfo fi = QFileInfo(fName);
-	double b, h;
-	b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
-	h = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
-	docWidth = b;
-	docHeight = h;
+	docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
+	docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
 	progressDialog = nullptr;
 	m_Doc = new ScribusDoc();
 	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
@@ -130,7 +127,6 @@
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 	importerFlags = flags;
 	cancel = false;
-	double b, h;
 	bool ret = false;
 	QFileInfo fi = QFileInfo(fNameIn);
 	if ( !ScCore->usingGUI() )
@@ -158,18 +154,18 @@
 	else
 		progressDialog = nullptr;
 /* Set default Page to size defined in Preferences */
-	b = 0.0;
-	h = 0.0;
+	double w = 0.0;
+	double h = 0.0;
 	if (progressDialog)
 	{
 		progressDialog->setOverallProgress(1);
 		qApp->processEvents();
 	}
-	if (b == 0.0)
-		b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
+	if (w == 0.0)
+		w = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
 	if (h == 0.0)
 		h = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
-	docWidth = b;
+	docWidth = w;
 	docHeight = h;
 	baseX = 0;
 	baseY = 0;




More information about the scribus-commit mailing list