r21488 by jghali - #14338: replace auto_ptr by QScopedPointer

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 31 21:09:07 UTC 2016


Author: jghali
Date: Mon Oct 31 21:09:07 2016
New Revision: 21488

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21488
Log:
#14338: replace auto_ptr by QScopedPointer

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/scimage.cpp
    trunk/Scribus/scribus/scprintengine_gdi.cpp
    trunk/Scribus/scribus/scslainforeader.cpp
    trunk/Scribus/scribus/ui/markvariabletext.cpp
    trunk/Scribus/scribus/ui/smtextstyles.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21488&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	Mon Oct 31 21:09:07 2016
@@ -40,6 +40,7 @@
 #include <QFileInfo>
 #include <QList>
 #include <QDataStream>
+#include <QScopedPointer>
 
 #include "scxmlstreamwriter.h"
 
@@ -135,13 +136,13 @@
 bool Scribus150Format::savePalette(const QString & fileName)
 {
 	QString fileDir = QFileInfo(fileName).absolutePath();
-	std::auto_ptr<QIODevice> outputFile;
+	QScopedPointer<QIODevice> outputFile;
 	outputFile.reset( new QFile(fileName) );
 	if (!outputFile->open(QIODevice::WriteOnly))
 		return false;
 	ScXmlStreamWriter docu;
 	docu.setAutoFormatting(true);
-	docu.setDevice(outputFile.get());
+	docu.setDevice(outputFile.data());
 	docu.writeStartDocument();
 	docu.writeStartElement("SCRIBUSCOLORS");
 	writeColors(docu);
@@ -150,7 +151,7 @@
 	docu.writeEndElement();
 	docu.writeEndDocument();
 	bool  writeSucceed = false;
-	const QFile* qFile = dynamic_cast<QFile*>(outputFile.get());
+	const QFile* qFile = dynamic_cast<QFile*>(outputFile.data());
 	writeSucceed = (qFile->error() == QFile::NoError);
 	outputFile->close();
 	return writeSucceed;
@@ -181,7 +182,7 @@
 	if (QFile::exists(tmpFileName))
 		return false;
 
-	std::auto_ptr<QIODevice> outputFile;
+	QScopedPointer<QIODevice> outputFile;
 	if (fileName.toLower().right(2) == "gz")
 	{
 		aFile.setFileName(tmpFileName);
@@ -197,7 +198,7 @@
 
 	ScXmlStreamWriter docu;
 	docu.setAutoFormatting(true);
-	docu.setDevice(outputFile.get());
+	docu.setDevice(outputFile.data());
 	docu.writeStartDocument();
 	docu.writeStartElement("SCRIBUSUTF8NEW");
 	docu.writeAttribute("Version", QString(VERSION));
@@ -423,7 +424,7 @@
 	docu.writeEndDocument();
 
 	bool  writeSucceed = false;
-	const QFile* qFile = dynamic_cast<QFile*>(outputFile.get());
+	const QFile* qFile = dynamic_cast<QFile*>(outputFile.data());
 	if (qFile)
 		writeSucceed = (qFile->error() == QFile::NoError);
 	else

Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21488&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp	(original)
+++ trunk/Scribus/scribus/scimage.cpp	Mon Oct 31 21:09:07 2016
@@ -33,6 +33,7 @@
 #include <QList>
 #include <QByteArray>
 #include <QImageReader>
+#include <QScopedPointer>
 #include <cassert>
 #include <cmath>
 #include <cstdlib>
@@ -1964,7 +1965,7 @@
 bool ScImage::getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes, int scaleXSize, int scaleYSize)
 {
 	bool gotAlpha = false;
-	auto_ptr<ScImgDataLoader> pDataLoader;
+	QScopedPointer<ScImgDataLoader> pDataLoader;
 	imgInfo.valid = false;
 	imgInfo.clipPath = "";
 	imgInfo.PDSpathData.clear();
@@ -1996,25 +1997,25 @@
 	else if (extensionIndicatesTIFF(ext))
 	{
 		pDataLoader.reset( new ScImgDataLoader_TIFF() );
-		if	(pDataLoader.get())
+		if	(pDataLoader.data())
 			pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps);
 	}
 	else if (extensionIndicatesPSD(ext))
 	{
 		pDataLoader.reset( new ScImgDataLoader_PSD() );
-		if	(pDataLoader.get())
+		if	(pDataLoader.data())
 			pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps);
 	}
 	else if (ext == "ora")
 	{
 		pDataLoader.reset( new ScImgDataLoader_ORA() );
-		if	(pDataLoader.get())
+		if	(pDataLoader.data())
 			pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps);
 	}
     else if (ext == "kra")
     {
         pDataLoader.reset( new ScImgDataLoader_KRA() );
-        if	(pDataLoader.get())
+        if	(pDataLoader.data())
             pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps);
     }
 	else if (ext == "pat")
@@ -2036,7 +2037,7 @@
 		pDataLoader.reset( new ScImgDataLoader_QT() );
 #endif
 
-	if (pDataLoader.get())
+	if (pDataLoader.data())
 	{
 		bool hasAlpha    = false;
 		bool alphaLoaded = pDataLoader->preloadAlphaChannel(fn, page, gsRes, hasAlpha);
@@ -2233,7 +2234,7 @@
 	RequestType reqType = requestType;
 	int cmsFlags = 0;
 	int cmsProofFlags = 0;
-	auto_ptr<ScImgDataLoader> pDataLoader;
+	QScopedPointer<ScImgDataLoader> pDataLoader;
 	QFileInfo fi = QFileInfo(fn);
 	if (!fi.exists())
 		return ret;

Modified: trunk/Scribus/scribus/scprintengine_gdi.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21488&path=/trunk/Scribus/scribus/scprintengine_gdi.cpp
==============================================================================
--- trunk/Scribus/scribus/scprintengine_gdi.cpp	(original)
+++ trunk/Scribus/scribus/scprintengine_gdi.cpp	Mon Oct 31 21:09:07 2016
@@ -16,6 +16,7 @@
 #include <valarray>
 #include <windows.h>
 #include <QByteArray>
+#include <QScopedPointer>
 using namespace ::std;
 
 #include "scconfig.h"
@@ -204,7 +205,7 @@
 bool ScPrintEngine_GDI::printPages(ScribusDoc* doc, PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName)
 {
 	int  jobId;
-	auto_ptr<MultiProgressDialog> progress;
+	QScopedPointer<MultiProgressDialog> progress;
 	PrintPageFunc printPageFunc = NULL;
 	bool  success = true;
 	WCHAR docName[512];
@@ -256,7 +257,7 @@
 		progress.reset(new MultiProgressDialog(QObject::tr("Printing..."), CommonStrings::tr_Cancel, doc->scMW()));
 		progress->setOverallTotalSteps(options.pageNumbers.size());
 		progress->setOverallProgress(0);
-		connect(progress.get(), SIGNAL(canceled()), this, SLOT(cancelRequested()));
+		connect(progress.data(), SIGNAL(canceled()), this, SLOT(cancelRequested()));
 		progress->show();
 	}
 

Modified: trunk/Scribus/scribus/scslainforeader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21488&path=/trunk/Scribus/scribus/scslainforeader.cpp
==============================================================================
--- trunk/Scribus/scribus/scslainforeader.cpp	(original)
+++ trunk/Scribus/scribus/scslainforeader.cpp	Mon Oct 31 21:09:07 2016
@@ -9,6 +9,7 @@
 #include <memory>
 
 #include <QFile>
+#include <QScopedPointer>
 #include <QXmlStreamReader>
 #include "qtiocompressor.h"
 
@@ -24,7 +25,7 @@
 	bool isScribusDocument = false;
 	bool readInfoSuccess   = false;
 	bool firstStartElement = true;
-	std::auto_ptr<QIODevice> file;
+	QScopedPointer<QIODevice> file;
 
 	resetFileInfos();
 	QFile aFile;
@@ -38,7 +39,7 @@
 	else
 		file.reset( new QFile(fileName) );
 
-	if (!file.get() || !file->open(QIODevice::ReadOnly))
+	if (file.isNull() || !file->open(QIODevice::ReadOnly))
 		return false;
 
 	QByteArray bytes = file->read(512);
@@ -49,7 +50,7 @@
 	}
 	file->reset();
 
-	QXmlStreamReader reader(file.get());
+	QXmlStreamReader reader(file.data());
 	while (!reader.atEnd() && !reader.hasError())
 	{
 		QXmlStreamReader::TokenType ttype = reader.readNext();

Modified: trunk/Scribus/scribus/ui/markvariabletext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21488&path=/trunk/Scribus/scribus/ui/markvariabletext.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/markvariabletext.cpp	(original)
+++ trunk/Scribus/scribus/ui/markvariabletext.cpp	Mon Oct 31 21:09:07 2016
@@ -2,7 +2,7 @@
 #include "marks.h"
 #include <QComboBox>
 
-MarkVariableText::MarkVariableText(const QList<Mark*>& marks, QWidget *parent) : MarkInsert(marks, parent), m_mark(0), m_widgetType(ComboBox)
+MarkVariableText::MarkVariableText(const QList<Mark*>& marks, QWidget *parent) : MarkInsert(marks, parent), m_widgetType(ComboBox), m_mark(0)
 {
 	//for editing mark entry in text - user can change mark pointer inserted into text or create new mark entry
 	setupUi(this);
@@ -22,7 +22,7 @@
 	setWindowTitle(tr("Mark with Variable Text"));
 }
 
-MarkVariableText::MarkVariableText(const Mark* mark, QWidget *parent) : MarkInsert(mark, parent), m_mark(mark), m_widgetType(LineEdit)
+MarkVariableText::MarkVariableText(const Mark* mark, QWidget *parent) : MarkInsert(mark, parent), m_widgetType(LineEdit), m_mark(mark)
 {
 	//for editing by marks Manager - user can change label and variable text
 	setupUi(this);

Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21488&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp	(original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp	Mon Oct 31 21:09:07 2016
@@ -42,7 +42,7 @@
 
 
 SMParagraphStyle::SMParagraphStyle(SMCharacterStyle* cstyleItem) : StyleItem(),
-m_pwidget(0), m_doc(0), m_selectionIsDirty(false), m_unitRatio(1.0), m_cstyleItem(cstyleItem)
+m_pwidget(0), m_cstyleItem(cstyleItem), m_doc(0), m_selectionIsDirty(false), m_unitRatio(1.0)
 {
 	Q_ASSERT(m_cstyleItem);
 	m_cstyles = m_cstyleItem->tmpStyles();




More information about the scribus-commit mailing list