r21527 by craig - #9808: Switch directory finding for data dirs to QStandardPaths, thereby implementing XDG standards on Linux. Clean up. Bump Qt minimum to 5.5, second part

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 20 22:57:40 UTC 2016


Author: craig
Date: Sun Nov 20 22:57:39 2016
New Revision: 21527

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21527
Log:
#9808: Switch directory finding for data dirs to QStandardPaths, thereby implementing XDG standards on Linux. Clean up. Bump Qt minimum to 5.5, second part

Modified:
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/ps/importps.cpp
    trunk/Scribus/scribus/plugins/scripter/api_printer.cpp
    trunk/Scribus/scribus/scpaths.cpp
    trunk/Scribus/scribus/ui/preview.cpp

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21527&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	Sun Nov 20 22:57:39 2016
@@ -145,7 +145,7 @@
 /*	Old Code to be backed up
 	QString tmp, cmd1, cmd2;
 	QString pdfFile = QDir::toNativeSeparators(fName);
-	QString tmpFile = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc.png");
+	QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc.png");
 	int ret = -1;
 	tmp.setNum(1);
 	QStringList args;

Modified: trunk/Scribus/scribus/plugins/import/ps/importps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21527&path=/trunk/Scribus/scribus/plugins/import/ps/importps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ps/importps.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/ps/importps.cpp	Sun Nov 20 22:57:39 2016
@@ -337,8 +337,8 @@
 	QString cmd, cmd1, cmd2, cmd3, tmp, tmp2, tmp3, tmp4;
 	// import.prolog do not cope with filenames containing blank spaces
 	// so take care that output filename does not (win32 compatibility)
-	QString tmpFile = getShortPathName(ScPaths::getTempFileDir())+ "/ps.out";
-	QString errFile = getShortPathName(ScPaths::getTempFileDir())+ "/ps.err";
+	QString tmpFile = getShortPathName(ScPaths::tempFileDir())+ "/ps.out";
+	QString errFile = getShortPathName(ScPaths::tempFileDir())+ "/ps.err";
 	QString pfad = ScPaths::instance().libDir();
 	QString pfad2 = QDir::toNativeSeparators(pfad + "import.prolog");
 	QFileInfo fi = QFileInfo(fn);
@@ -350,7 +350,7 @@
 	}
 /*
 // Destill the eps with ghostscript to get a clean eps file
-	QString cleanFile = getShortPathName(ScPaths::getTempFileDir())+ "/clean.eps";
+	QString cleanFile = getShortPathName(ScPaths::tempFileDir())+ "/clean.eps";
 	args.append( "-q" );
 	args.append( "-dNOPAUSE" );
 	args.append( "-sDEVICE=epswrite" );

Modified: trunk/Scribus/scribus/plugins/scripter/api_printer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21527&path=/trunk/Scribus/scribus/plugins/scripter/api_printer.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_printer.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/api_printer.cpp	Sun Nov 20 22:57:39 2016
@@ -132,7 +132,7 @@
 	if (dd != NULL)
 	{
 		if (!fil)
-			fna = QDir::toNativeSeparators(ScPaths::getTempFileDir()+"/tmp.ps");
+			fna = QDir::toNativeSeparators(ScPaths::tempFileDir()+"/tmp.ps");
 		PSfile = dd->PS_set_file(fna);
 		fna = QDir::toNativeSeparators(fna);
 		if (PSfile)

Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21527&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp	(original)
+++ trunk/Scribus/scribus/scpaths.cpp	Sun Nov 20 22:57:39 2016
@@ -290,7 +290,7 @@
 	}
 
 #elif defined(_WIN32)
-	QString progFiles = getSpecialDir(CSIDL_PROGRAM_FILES);
+	QString progFiles = windowsSpecialDir(CSIDL_PROGRAM_FILES);
 	d.setPath(progFiles+windowsLOPath);
 	if (d.exists())
 	{
@@ -357,7 +357,7 @@
 	}
 
 #elif defined(_WIN32)
-	QString progFiles = getSpecialDir(CSIDL_PROGRAM_FILES);
+	QString progFiles = windowsSpecialDir(CSIDL_PROGRAM_FILES);
 	d.setPath(progFiles+windowsLOPath);
 	if (d.exists())
 	{
@@ -393,7 +393,7 @@
 	fontDirs.append("/Network/Library/Fonts/");
 	fontDirs.append("/System/Library/Fonts/");
 #elif defined(_WIN32)
-	fontDirs.append( getSpecialDir(CSIDL_FONTS) );
+	fontDirs.append( windowsSpecialDir(CSIDL_FONTS) );
 #endif
 	return fontDirs;
 }
@@ -420,7 +420,7 @@
 	ZeroMemory( &osVersion, sizeof(OSVERSIONINFO));
 	osVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); // Necessary for GetVersionEx to succeed
 	GetVersionEx(&osVersion);  // Get Windows version infos
-	GetSystemDirectoryW( sysDir, MAX_PATH ); // getSpecialDir(CSIDL_SYSTEM) fails on Win9x
+	GetSystemDirectoryW( sysDir, MAX_PATH ); // windowsSpecialDir(CSIDL_SYSTEM) fails on Win9x
 	QString winSysDir = QString::fromUtf16((const ushort*) sysDir);
 	winSysDir = winSysDir.replace('\\','/');
 	if( osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT	) // Windows NT/2k/XP
@@ -477,10 +477,10 @@
 	createDirs.append("/usr/share/create/swatches/");
 	createDirs.append("/usr/local/share/create/swatches/");
 #elif defined(_WIN32)
-	QString localAppData = getSpecialDir(CSIDL_LOCAL_APPDATA);
-	QString commonAppData = getSpecialDir(CSIDL_COMMON_APPDATA);
-	QString programFilesCommon = getSpecialDir(CSIDL_PROGRAM_FILES_COMMON);
-	createDirs.append(getSpecialDir(CSIDL_APPDATA) + "create/swatches/");
+	QString localAppData = windowsSpecialDir(CSIDL_LOCAL_APPDATA);
+	QString commonAppData = windowsSpecialDir(CSIDL_COMMON_APPDATA);
+	QString programFilesCommon = windowsSpecialDir(CSIDL_PROGRAM_FILES_COMMON);
+	createDirs.append(windowsSpecialDir(CSIDL_APPDATA) + "create/swatches/");
 	if ( !localAppData.isEmpty() )
 		createDirs.append(localAppData + "create/swatches/");
 	if ( !commonAppData.isEmpty() )
@@ -511,7 +511,7 @@
 #ifdef APPLICATION_CONFIG_DIR
 	prefsDir =  QDir::homePath() + "/" + APPLICATION_CONFIG_DIR + "/";
 #else
-	//Jean wants to make all prefs for Scribus be in the roaming directory on Windows
+	//Jean wants to make all prefs for Scribus be in the roaming directory on Windows so return the same as applicationDataDir
 	#ifdef Q_OS_WIN32
 		prefsDir =  QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/";
 	#else
@@ -610,7 +610,7 @@
 		tempPath += "/";
 		// GetTempPath may return Windows directory, better not use this one
 		// for temporary files
-		if (QDir(tempPath).exists() && tempPath != getSpecialDir(CSIDL_WINDOWS))
+		if (QDir(tempPath).exists() && tempPath != windowsSpecialDir(CSIDL_WINDOWS))
 			return tempPath;
 	}
 #endif

Modified: trunk/Scribus/scribus/ui/preview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21527&path=/trunk/Scribus/scribus/ui/preview.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/preview.cpp	(original)
+++ trunk/Scribus/scribus/ui/preview.cpp	Sun Nov 20 22:57:39 2016
@@ -551,7 +551,7 @@
 		options.useSpotColors = false;
 		bool done = winPrint.gdiPrintPreview(doc, page, &image, options, Res / 72.0);
 		if (done)
-			image.save( ScPaths::getTempFileDir() + "/sc.png", "PNG" );
+			image.save( ScPaths::tempFileDir() + "/sc.png", "PNG" );
 		return (done ? 0 : 1);
 	}
 #endif




More information about the scribus-commit mailing list