r21941 by craig - Clazy part 7: Fix QFileInfo::.exists() calls and remove copy constructor from MarginStruct that should not be necessary

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 20 19:58:44 UTC 2017


Author: craig
Date: Thu Apr 20 19:58:43 2017
New Revision: 21941

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21941
Log:
Clazy part 7: Fix QFileInfo::.exists() calls and remove copy constructor from MarginStruct that should not be necessary

Modified:
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
    trunk/Scribus/scribus/margins.h
    trunk/Scribus/scribus/scribusapp.cpp
    trunk/Scribus/scribus/urllauncher.cpp

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21941&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp	Thu Apr 20 19:58:43 2017
@@ -1170,7 +1170,6 @@
 	double x, y, b, h;
 	ScTextStream ts2(&m_BBox, QIODevice::ReadOnly);
 	ts2 >> x >> y >> b >> h;
-	QFileInfo fi = QFileInfo(fn);
 	QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc1.jpg");
 	QFile f2(tmpFile);
 	QString tmp;
@@ -1305,7 +1304,6 @@
 	double x, y, b, h;
 	ScTextStream ts2(&m_BBox, QIODevice::ReadOnly);
 	ts2 >> x >> y >> b >> h;
-	QFileInfo fi = QFileInfo(fn);
 	QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc1.jpg");
 	QFile f2(tmpFile);
 	QString tmp;

Modified: trunk/Scribus/scribus/margins.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21941&path=/trunk/Scribus/scribus/margins.h
==============================================================================
--- trunk/Scribus/scribus/margins.h	(original)
+++ trunk/Scribus/scribus/margins.h	Thu Apr 20 19:58:43 2017
@@ -28,7 +28,9 @@
 		MarginStruct() : m_top(0), m_left(0), m_bottom(0), m_right(0) {}
 		MarginStruct(double top, double left, double bottom, double right) :
 			m_top(top), m_left(left), m_bottom(bottom), m_right(right) {}
-		MarginStruct(const MarginStruct& rhs) {m_top=rhs.m_top;m_bottom=rhs.m_bottom;m_left=rhs.m_left;m_right=rhs.m_right;}
+//unneeded? default compiler generated should suffice
+//		MarginStruct(const MarginStruct& rhs) {m_top=rhs.m_top;m_bottom=rhs.m_bottom;m_left=rhs.m_left;m_right=rhs.m_right;}
+//		MarginStruct& operator=(const MarginStruct& rhs) {m_top=rhs.m_top;m_bottom=rhs.m_bottom;m_left=rhs.m_left;m_right=rhs.m_right;return *this;}
 		void set(double top, double left, double bottom, double right) {m_top=top;m_bottom=bottom;m_left=left;m_right=right;}
 		void resetToZero() {m_top=0.0;m_bottom=0.0;m_left=0.0;m_right=0.0;}
 		bool isNull() const {return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom);}

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21941&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp	(original)
+++ trunk/Scribus/scribus/scribusapp.cpp	Thu Apr 20 19:58:43 2017
@@ -175,7 +175,7 @@
 				std::exit(EXIT_FAILURE);
 			}
 			pythonScript = QFile::decodeName(args[argi + 1].toLocal8Bit());
-			if (!QFileInfo(pythonScript).exists())
+			if (!QFileInfo::exists(pythonScript))
 			{
 				std::cout << tr("Python script %1 does not exist, aborting.").arg(pythonScript).toLocal8Bit().data() << std::endl;
 				std::exit(EXIT_FAILURE);
@@ -296,7 +296,7 @@
 				std::exit(EXIT_FAILURE);
 			}
 			m_fileName = QFile::decodeName(args[argi].toLocal8Bit());
-			if (!QFileInfo(m_fileName).exists())
+			if (!QFileInfo::exists(m_fileName))
 			{
 				std::cout << tr("File %1 does not exist, aborting.").arg(m_fileName).toLocal8Bit().data() << std::endl;
 				std::exit(EXIT_FAILURE);
@@ -311,7 +311,7 @@
 	for ( ; argi<argsc; argi++)
 	{
 		m_fileName = QFile::decodeName(args[argi].toLocal8Bit());
-		if (!QFileInfo(m_fileName).exists())
+		if (!QFileInfo::exists(m_fileName))
 		{
 			std::cout << tr("File %1 does not exist, aborting.").arg(m_fileName).toLocal8Bit().data() << std::endl;
 			std::exit(EXIT_FAILURE);
@@ -391,7 +391,7 @@
 
 	//add in user preferences lang, only overridden by lang command line option
 	QString Pff = QDir::toNativeSeparators(ScPaths::preferencesDir());
-	QFileInfo Pffi = QFileInfo(Pff);
+	QFileInfo Pffi(Pff);
 	if (Pffi.exists())
 	{
 		QString PrefsPfad;
@@ -668,7 +668,7 @@
 
 bool ScribusQApp::neverSplashExists()
 {
-	return QFileInfo(ScPaths::preferencesDir() + ".neversplash").exists();
+	return QFileInfo::exists(ScPaths::preferencesDir() + ".neversplash");
 }
 
 void ScribusQApp::downloadComplete(const QString &t)

Modified: trunk/Scribus/scribus/urllauncher.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21941&path=/trunk/Scribus/scribus/urllauncher.cpp
==============================================================================
--- trunk/Scribus/scribus/urllauncher.cpp	(original)
+++ trunk/Scribus/scribus/urllauncher.cpp	Thu Apr 20 19:58:43 2017
@@ -61,7 +61,7 @@
 			if (!QDesktopServices::openUrl(link))
 			{
 				extBrowser = QFileDialog::getOpenFileName(p, tr("Locate your web browser"), QString::null, QString::null);
-				if (!QFileInfo(extBrowser).exists())
+				if (!QFileInfo::exists(extBrowser))
 					extBrowser="";
 				PrefsManager::instance()->setExtBrowserExecutable(extBrowser);
 			}




More information about the scribus-commit mailing list