r24935 by craig - Update some copy constructed classes to references

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 10 19:13:18 UTC 2022


Author: craig
Date: Thu Feb 10 19:13:18 2022
New Revision: 24935

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24935
Log:
Update some copy constructed classes to references

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.cpp
    trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp
    trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
    trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
    trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
    trunk/Scribus/scribus/plugins/import/qxp/importqxp.cpp
    trunk/Scribus/scribus/plugins/import/zmf/importzmf.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/ui/outputpreview_pdf.cpp
    trunk/Scribus/scribus/ui/scrapbookpalette.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Thu Feb 10 19:13:18 2022
@@ -2328,7 +2328,7 @@
 		PdfFont pdfFont;
 		QByteArray fontName = QByteArray("Fo") + Pdf::toPdf(a);
 		
-		QMap<uint, QString> usedGlyphs = it.value();
+		const QMap<uint, QString>& usedGlyphs = it.value();
 		if (usedGlyphs.count() <= 0)
 			continue;
 		

Modified: trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.cpp	Thu Feb 10 19:13:18 2022
@@ -195,9 +195,8 @@
 		QString srcValue = attrs.value("src");
 		if (!srcValue.isEmpty())
 		{
-			QString attrValue = srcValue;
-			if (attrValue.indexOf("data:image") < 0)
-				imgline +=  " src: " + attrValue;
+			if (srcValue.indexOf("data:image") < 0)
+				imgline +=  " src: " + srcValue;
 			else
 			{
 				// TODO: correctly embed the image (just putting the source in the

Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp	Thu Feb 10 19:13:18 2022
@@ -127,7 +127,7 @@
 		bool isTextStyle = false;
 		for (auto attr = attrs.cbegin(); attr != attrs.cend(); ++attr)
 		{
-			QString attrName = attr.key();
+			const QString& attrName = attr.key();
 			if (attrName == "style:name")
 				sname = attr.value();
 			else if ((attrName == "style:family") && (attr.value() == "text"))

Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp	Thu Feb 10 19:13:18 2022
@@ -146,8 +146,7 @@
 			if (!styleLines.isEmpty())
 			{
 				bool ok = false;
-				QString sd = styleLines;
-				int dh = sd.toInt(&ok);
+				int dh = styleLines.toInt(&ok);
 				if (ok)
 				{
 					gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
@@ -165,7 +164,7 @@
 		QString style;
 		for (auto attr = attrs.cbegin(); attr != attrs.cend(); ++attr)
 		{
-			QString attrName = attr.key();
+			const QString& attrName = attr.key();
 			if (attrName == "style:name")
 				key = attr.value();
 			else if (attrName == "fo:font-family")
@@ -214,8 +213,8 @@
 	bool hasColorTag = false;
 	for (auto attr = attrs.begin(); attr != attrs.end(); ++attr)
 	{
-		QString attrName = attr.key();
-		QString attrValue = attr.value();
+		const QString& attrName = attr.key();
+		const QString& attrValue = attr.value();
 		if ((attrName == "style:font-name") && (!inList))
 			currentStyle->getFont()->setName(getFont(attrValue));
 		else if (attrName == "fo:font-size")
@@ -346,8 +345,8 @@
 
 	for (auto attr = attrs.begin(); attr != attrs.end(); ++attr)
 	{
-		QString attrName = attr.key();
-		QString attrValue = attr.value();
+		const QString& attrName = attr.key();
+		const QString& attrValue = attr.value();
 		if (attrName == "style:family")
 		{
 			if (attrValue == "paragraph")

Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp	Thu Feb 10 19:13:18 2022
@@ -2023,7 +2023,7 @@
 	bool bFirst = true;
 	for ( QStringList::Iterator it = ptList.begin(); it != ptList.end(); ++it)
 	{
-		point = FPoint(ScCLocale::toDoubleC((*it).section( ',', 0, 0 )), ScCLocale::toDoubleC((*it).section( ',', 1, 1 )));
+		point = FPoint(ScCLocale::toDoubleC((*it).section( ',', 0, 0 )), ScCLocale::toDoubleC((*it).section( ',', 1, 1)));
 		if (bFirst)
 		{
 			composite->addPoint(point);

Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp	Thu Feb 10 19:13:18 2022
@@ -1479,7 +1479,7 @@
 	bool bFirst = true;
 	for (QStringList::Iterator it = ptList.begin(); it != ptList.end(); ++it)
 	{
-		point = FPoint(ScCLocale::toDoubleC((*it).section( ',', 0, 0 )), ScCLocale::toDoubleC((*it).section( ',', 1, 1 )));
+		point = FPoint(ScCLocale::toDoubleC((*it).section( ',', 0, 0 )), ScCLocale::toDoubleC((*it).section( ',', 1, 1)));
 		if (bFirst)
 		{
 			composite->addPoint(point);

Modified: trunk/Scribus/scribus/plugins/import/qxp/importqxp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/import/qxp/importqxp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/qxp/importqxp.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/qxp/importqxp.cpp	Thu Feb 10 19:13:18 2022
@@ -128,14 +128,13 @@
 
 bool QxpPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
 {
-	QString fName = fNameIn;
 	bool success = false;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 	importerFlags = flags;
 	cancel = false;
 	double b, h;
 	bool ret = false;
-	QFileInfo fi = QFileInfo(fName);
+	QFileInfo fi = QFileInfo(fNameIn);
 	if ( !ScCore->usingGUI() )
 	{
 		interactive = false;
@@ -221,7 +220,7 @@
 	qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 	QString CurDirP = QDir::currentPath();
 	QDir::setCurrent(fi.path());
-	if (convert(fName))
+	if (convert(fNameIn))
 	{
 		tmpSel->clear();
 		QDir::setCurrent(CurDirP);

Modified: trunk/Scribus/scribus/plugins/import/zmf/importzmf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/import/zmf/importzmf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/zmf/importzmf.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/zmf/importzmf.cpp	Thu Feb 10 19:13:18 2022
@@ -128,14 +128,13 @@
 
 bool ZmfPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
 {
-	QString fName = fNameIn;
 	bool success = false;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 	importerFlags = flags;
 	cancel = false;
 	double b, h;
 	bool ret = false;
-	QFileInfo fi = QFileInfo(fName);
+	QFileInfo fi = QFileInfo(fNameIn);
 	if ( !ScCore->usingGUI() )
 	{
 		interactive = false;
@@ -221,7 +220,7 @@
 	qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 	QString CurDirP = QDir::currentPath();
 	QDir::setCurrent(fi.path());
-	if (convert(fName))
+	if (convert(fNameIn))
 	{
 		tmpSel->clear();
 		QDir::setCurrent(CurDirP);

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp	(original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp	Thu Feb 10 19:13:18 2022
@@ -119,7 +119,7 @@
 
 QString SATDialog::findTemplateXml(const QString& dir)
 {
-	QString lang = ScCore->getGuiLanguage();
+	const QString& lang = ScCore->getGuiLanguage();
 	QString tmp = dir + "/template." + lang + ".xml";
 	if (QFile::exists(tmp))
 		return tmp;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp	Thu Feb 10 19:13:18 2022
@@ -454,7 +454,7 @@
 	auto itEnd = lineStyles.constEnd();
 	for (auto it = lineStyles.constBegin(); it != itEnd; ++it)
 	{
-		QString lineStyleName = it.key();
+		const QString& lineStyleName = it.key();
 		if (PyList_Append(lineStyleList, PyUnicode_FromString(lineStyleName.toUtf8())))
 		{
 			// An exception will have already been set by PyList_Append apparently.

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Thu Feb 10 19:13:18 2022
@@ -9854,10 +9854,8 @@
 				is->set("MARK", QString("new"));
 				if (mrk->isType(MARK2MarkType))
 				{
-					QString dName = mrk->getDestMarkName();
-					MarkType dType = mrk->getDestMarkType();
-					is->set("dName", dName);
-					is->set("dType", (int) dType);
+					is->set("dName", mrk->getDestMarkName());
+					is->set("dType", (int) mrk->getDestMarkType());
 				}
 				if (mrk->isType(MARK2ItemType))
 					is->insertItem("itemPtr", mrk->getItemPtr());
@@ -9884,7 +9882,7 @@
 				}
 				if (mrk->isType(MARK2MarkType))
 				{
-					QString dName = mrk->getDestMarkName();
+					const QString& dName = mrk->getDestMarkName();
 					MarkType dType = mrk->getDestMarkType();
 					if (dName != oldData.destMarkName || dType != oldData.destMarkType)
 					{

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Thu Feb 10 19:13:18 2022
@@ -17082,10 +17082,8 @@
 			ims->set("at", findMarkCPos(mrk, master));
 			if (mrk->isType(MARK2MarkType))
 			{
-				QString dName = mrk->getDestMarkName();
-				MarkType dType = mrk->getDestMarkType();
-				ims->set("dName", dName);
-				ims->set("dType", (int) dType);
+				ims->set("dName", mrk->getDestMarkName());
+				ims->set("dType", (int) mrk->getDestMarkType());
 			}
 			if (mrk->isType(MARK2ItemType))
 				ims->insertItem("itemPtr", mrk->getItemPtr());

Modified: trunk/Scribus/scribus/ui/outputpreview_pdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/ui/outputpreview_pdf.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outputpreview_pdf.cpp	(original)
+++ trunk/Scribus/scribus/ui/outputpreview_pdf.cpp	Thu Feb 10 19:13:18 2022
@@ -875,7 +875,7 @@
 
 		for (auto itAnn = annotationFonts.begin(); itAnn != annotationFonts.end(); ++itAnn)
 		{
-			QString annotFont = itAnn.key();
+			const QString& annotFont = itAnn.key();
 			if (!m_pdfOptions.EmbedList.contains(annotFont))
 				m_pdfOptions.EmbedList.append(annotFont);
 			int subsetIndex = m_pdfOptions.SubsetList.indexOf(annotFont);

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24935&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp	Thu Feb 10 19:13:18 2022
@@ -1730,11 +1730,10 @@
 
 void Biblio::objFromMenu(QString text)
 {
-	QString nam = "";
 	QString tmp;
 	if (!activeBView->canWrite)
 		return;
-	nam = getObjectName(text);
+	QString nam(getObjectName(text));
 	if (Frame3->currentIndex() == 1)
 	{
 		if (nam.isEmpty())
@@ -1758,10 +1757,9 @@
 		nam = dia.getEditText();
 	else
 		return;
-	QString ff = text;
-	activeBView->checkAndChange(ff, QDir::cleanPath(QDir::toNativeSeparators(activeBView->ScFilename + "/" + nam + ".sce")), QDir::cleanPath(QDir::toNativeSeparators(activeBView->ScFilename)));
+	activeBView->checkAndChange(text, QDir::cleanPath(QDir::toNativeSeparators(activeBView->ScFilename + "/" + nam + ".sce")), QDir::cleanPath(QDir::toNativeSeparators(activeBView->ScFilename)));
 	ScPreview *pre = new ScPreview();
-	QPixmap pm = QPixmap::fromImage(pre->createPreview(ff));
+	QPixmap pm = QPixmap::fromImage(pre->createPreview(text));
 	activeBView->addObject(nam, QDir::cleanPath(QDir::toNativeSeparators(activeBView->ScFilename + "/" + nam + ".sce")), pm);
 	if (PrefsManager::instance().appPrefs.scrapbookPrefs.writePreviews)
 	{
@@ -1930,10 +1928,9 @@
 		nam = dia.getEditText();
 	else
 		return;
-	QString ff = text;
-	actBView->checkAndChange(ff, QDir::cleanPath(QDir::toNativeSeparators(actBView->ScFilename + "/" + nam + ".sce")), QDir::cleanPath(QDir::toNativeSeparators(actBView->ScFilename)));
+	actBView->checkAndChange(text, QDir::cleanPath(QDir::toNativeSeparators(actBView->ScFilename + "/" + nam + ".sce")), QDir::cleanPath(QDir::toNativeSeparators(actBView->ScFilename)));
 	ScPreview *pre = new ScPreview();
-	QPixmap pm = QPixmap::fromImage(pre->createPreview(ff));
+	QPixmap pm = QPixmap::fromImage(pre->createPreview(text));
 	actBView->addObject(nam, QDir::cleanPath(QDir::toNativeSeparators(actBView->ScFilename + "/" + nam + ".sce")), pm);
 	if (PrefsManager::instance().appPrefs.scrapbookPrefs.writePreviews)
 	{




More information about the scribus-commit mailing list