r13990 by fschmid - Useg GMagick only for fileformats Qt doesn't know about.

scribus-commit scribus-commit at lists.scribus.net
Tue Sep 15 13:45:29 CEST 2009


Revision: 13990
Author: fschmid
Date: 2009-09-15T11:43:36.854237Z
Commit message: Useg GMagick only for fileformats Qt doesn't know about.

Changeset: 
M  /trunk/Scribus/scribus/scimage.cpp

Diffs:
Index: scribus/scimage.cpp
===================================================================
--- scribus/scimage.cpp	(revision 13989)
+++ scribus/scimage.cpp	(revision 13990)
@@ -25,6 +25,7 @@
 #include <QMessageBox>
 #include <QList>
 #include <QByteArray>
+#include <QImageReader>
 #include <cassert>
 #include <cmath>
 #include <cstdlib>
@@ -1788,6 +1789,12 @@
 	alpha.resize(0);
 	QString tmp, BBox, tmp2;
 	QString ext = fi.suffix().toLower();
+	QList<QByteArray> fmtList = QImageReader::supportedImageFormats();
+	QStringList fmtImg;
+	for (int i = 0; i < fmtList.count(); i++)
+	{
+		fmtImg.append( QString(fmtList[i].toLower()) );
+	}
 	if (extensionIndicatesJPEG(ext))
 		return true;
 	if (extensionIndicatesPDF(ext))
@@ -1812,14 +1819,21 @@
 	}
 	else if (ext == "pat")
 		pDataLoader = new ScImgDataLoader_GIMP();
+	else if (fmtImg.contains(ext))
+		pDataLoader = new ScImgDataLoader_QT();
+	#ifdef GMAGICK_FOUND
+		#warning "Compiling with GraphicsMagick support!"
 	else
+		pDataLoader = new ScImgDataLoader_GMagick();
+	#endif
+/*	else
 	#ifdef GMAGICK_FOUND
 		#warning "Compiling with GraphicsMagick support!"
 		pDataLoader = new ScImgDataLoader_GMagick();
 	#else
 		pDataLoader = new ScImgDataLoader_QT();
 	#endif
-
+*/
 	if (pDataLoader)
 	{
 		bool hasAlpha    = false;
@@ -1981,6 +1995,12 @@
 	QChar tc;
 	QString profileName = "";
 	bool hasEmbeddedProfile = false;
+	QList<QByteArray> fmtList = QImageReader::supportedImageFormats();
+	QStringList fmtImg;
+	for (int i = 0; i < fmtList.count(); i++)
+	{
+		fmtImg.append( QString(fmtList[i].toLower()) );
+	}
 //	bool found = false;
 
 	if (ext.isEmpty())
@@ -2007,13 +2027,18 @@
 		pDataLoader.reset( new ScImgDataLoader_JPEG() );
 	else if (ext == "pat")
 		pDataLoader.reset( new ScImgDataLoader_GIMP() );
+	else if (fmtImg.contains(ext))
+		pDataLoader.reset( new ScImgDataLoader_QT() );
+	#ifdef GMAGICK_FOUND
 	else
-	#ifdef GMAGICK_FOUND
 		pDataLoader.reset( new ScImgDataLoader_GMagick() );
+	#endif
+/*	#ifdef GMAGICK_FOUND
+		pDataLoader.reset( new ScImgDataLoader_GMagick() );
 	#else
 		pDataLoader.reset( new ScImgDataLoader_QT() );
 	#endif
-
+*/
 	if (pDataLoader->loadPicture(fn, page, gsRes, (requestType == Thumbnail)))
 	{
 		QImage::operator=(pDataLoader->image());




More information about the scribus-commit mailing list