r16171 by fschmid - Made the Dia shape reading part of the "StencilReader" a proper import plugin. Thus the stencilreader class is now no longer used and removed from the build.

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 27 18:00:34 CET 2010


Author: fschmid
Date: Mon Dec 27 17:00:33 2010
New Revision: 16171

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16171
Log:
Made the Dia shape reading part of the "StencilReader" a proper import plugin. Thus the stencilreader class is now no longer used and removed from the build.

Added:
    trunk/Scribus/scribus/plugins/import/shape/
    trunk/Scribus/scribus/plugins/import/shape/CMakeLists.txt
    trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
    trunk/Scribus/scribus/plugins/import/shape/importshape.h
    trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp
    trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.h
Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/plugins/import/CMakeLists.txt
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/ui/customfdialog.cpp
    trunk/Scribus/scribus/ui/paintmanager.cpp
    trunk/Scribus/scribus/ui/scrapbookpalette.cpp

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Mon Dec 27 17:00:33 2010
@@ -591,7 +591,7 @@
   scxmlstreamreader.cpp
   selection.cpp
   serializer.cpp
-  stencilreader.cpp
+#  stencilreader.cpp
   styleitem.cpp
   textwriter.cpp
   tocgenerator.cpp

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Mon Dec 27 17:00:33 2010
@@ -49,7 +49,6 @@
 #include "scribusview.h"
 #include "scribusXml.h"
 #include "selection.h"
-#include "stencilreader.h"
 #include "undomanager.h"
 #include "util.h"
 #include "util_icon.h"
@@ -1279,10 +1278,8 @@
 		fmtCode++;
 		fmt = LoadSavePlugin::getFormatById(fmtCode);
 	}
-	allFormats += "*.sce *.SCE ";
-	allFormats += "*.shape *.SHAPE);;";
+	allFormats += "*.sce *.SCE;;";
 	formats.append("Scribus Objects (*.sce *.SCE)");
-	formats.append("Dia Shapes (*.shape *.SHAPE)");
 	qSort(formats);
 	allFormats += formats.join(";;");
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -1298,22 +1295,12 @@
 		PrefsManager::instance()->prefsFile->getContext("dirs")->set("pastefile", fileName.left(fileName.lastIndexOf("/")));
 		m_doc->setLoading(true);
 		QFileInfo fi(fileName);
-		if (fi.suffix().toLower() == "shape")
-		{
-			QString f = "";
-			loadText(fileName, &f);
-			StencilReader *pre = new StencilReader();
-			fileName = pre->createShape(f);
-			delete pre;
-		}
 		bool savedAlignGrid = m_doc->useRaster;
 		bool savedAlignGuides = m_doc->SnapGuides;
 		m_doc->useRaster = false;
 		m_doc->SnapGuides = false;
 		if (fi.suffix().toLower() == "sce")
 			m_ScMW->slotElemRead(fileName, pastePoint.x(), pastePoint.y(), true, false, m_doc, m_doc->view());
-		else if (fi.suffix().toLower() == "shape")
-			m_ScMW->slotElemRead(fileName, pastePoint.x(), pastePoint.y(), false, true, m_doc, m_doc->view());
 		else
 		{
 			FileLoader *fileLoader = new FileLoader(fileName);

Modified: trunk/Scribus/scribus/plugins/import/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/plugins/import/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/import/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/import/CMakeLists.txt Mon Dec 27 17:00:33 2010
@@ -6,6 +6,7 @@
 ADD_SUBDIRECTORY(oodraw)
 ADD_SUBDIRECTORY(pct)
 ADD_SUBDIRECTORY(ps)
+ADD_SUBDIRECTORY(shape)
 ADD_SUBDIRECTORY(sml)
 ADD_SUBDIRECTORY(svg)
 ADD_SUBDIRECTORY(uniconvertor)

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Mon Dec 27 17:00:33 2010
@@ -27,6 +27,7 @@
 #include "scclocale.h"
 #include "scconfig.h"
 #include "scgzfile.h"
+#include "sclimits.h"
 #include "scmimedata.h"
 #include "scpaths.h"
 #include "scpattern.h"
@@ -1122,10 +1123,10 @@
 	}
 	else
 	{
-		double minx = 999999.9;
-		double miny = 999999.9;
-		double maxx = -999999.9;
-		double maxy = -999999.9;
+		double minx =  std::numeric_limits<double>::max();
+		double miny =  std::numeric_limits<double>::max();
+		double maxx = -std::numeric_limits<double>::max();
+		double maxy = -std::numeric_limits<double>::max();
 		GElements.append(neu);
 		for (int gr = 0; gr < gElements.count(); ++gr)
 		{

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Mon Dec 27 17:00:33 2010
@@ -89,7 +89,6 @@
 #include "canvasmode.h"
 #include "ui/charselect.h"
 #include "ui/checkDocument.h"
-//#include "ui/cmsprefs.h"
 #include "ui/collectforoutput_ui.h"
 #include "ui/colorcombo.h"
 #include "commonstrings.h"
@@ -101,14 +100,12 @@
 #include "desaxe/saxXML.h"
 #include "desaxe/simple_actions.h"
 #include "docinfo.h"
-//#include "ui/docitemattrprefs.h"
 #include "documentchecker.h"
 #include "documentinformation.h"
 #include "ui/effectsdialog.h"
 #include "fileloader.h"
 #include "filewatcher.h"
 #include "ui/fontcombo.h"
-//#include "ui/fontprefs.h"
 #include "fpoint.h"
 #include "fpointarray.h"
 #include "gtgettext.h"
@@ -116,7 +113,6 @@
 #include "ui/helpbrowser.h"
 #include "ui/hruler.h"
 #include "hyphenator.h"
-//#include "ui/hysettings.h"
 #include "ui/imageinfodialog.h"
 #include "ui/insertaframe.h"
 #include "ui/inspage.h"
@@ -151,7 +147,6 @@
 #include "ui/pageselector.h"
 #include "pagesize.h"
 #include "ui/paintmanager.h"
-//#include "ui/patterndialog.h"
 #include "pdflib.h"
 #include "pdfoptions.h"
 #include "ui/pdfopts.h"
@@ -160,7 +155,6 @@
 #include "plugins/formatidlist.h"
 #include "ui/polygonwidget.h"
 #include "ui/preferencesdialog.h"
-//#include "ui/prefs.h"
 #include "prefscontext.h"
 #include "prefsfile.h"
 #include "prefsmanager.h"
@@ -170,7 +164,6 @@
 #include "ui/propertiespalette.h"
 #include "pslib.h"
 #include "ui/query.h"
-//#include "ui/reformdoc.h"
 #include "ui/replacecolors.h"
 #include "resourcecollection.h"
 #include "sccolorengine.h"
@@ -197,19 +190,12 @@
 #include "ui/smlinestyle.h"
 #include "ui/smtextstyles.h"
 #include "ui/splash.h"
-#include "stencilreader.h"
 #include "ui/storyeditor.h"
 #include "ui/stylemanager.h"
 #include "ui/symbolpalette.h"
-//#include "ui/tabcheckdoc.h"
-//#include "ui/tabguides.h"
 #include "ui/tabmanager.h"
-//#include "ui/tabpdfoptions.h"
-//#include "ui/tabtools.h"
-//#include "ui/tabtypography.h"
 #include "text/nlsconfig.h"
 #include "tocgenerator.h"
-//#include "ui/tocindexprefs.h"
 #include "ui/transformdialog.h"
 #include "ui/transparencypalette.h"
 #include "ui/copypagetomasterpagedialog.h"
@@ -3370,24 +3356,13 @@
 		else
 		{
 			UndoTransaction pasteAction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate));
-			if (fi.suffix().toLower() == "shape")
-			{
-				QString f = "";
-				loadText(data, &f);
-				StencilReader *pre = new StencilReader();
-				data = pre->createShape(f);
-				delete pre;
-			}
 			view->Deselect(true);
 			uint ac = doc->Items->count();
 			bool savedAlignGrid = doc->useRaster;
 			bool savedAlignGuides = doc->SnapGuides;
 			doc->useRaster = false;
 			doc->SnapGuides = false;
-			if (fi.suffix().toLower() == "sce")
-				slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
-			else
-				slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+			slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
 			doc->useRaster = savedAlignGrid;
 			doc->SnapGuides = savedAlignGuides;
 			Selection tmpSelection(this, false);
@@ -3432,10 +3407,8 @@
 		fmtCode++;
 		fmt = LoadSavePlugin::getFormatById(fmtCode);
 	}
-	allFormats += "*.sce *.SCE ";
-	allFormats += "*.shape *.SHAPE);;";
+	allFormats += "*.sce *.SCE;;";
 	formats.append("Scribus Objects (*.sce *.SCE)");
-	formats.append("Dia Shapes (*.shape *.SHAPE)");
 	qSort(formats);
 	allFormats += formats.join(";;");
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -9770,7 +9743,7 @@
 					loadDoc( fi.absoluteFilePath() );
 				}
 			}
-			else if ((fileUrl.endsWith(".shape")) || (fileUrl.endsWith(".sce")))
+			else if (fileUrl.endsWith(".sce"))
 			{
 				QUrl url( fileUrls[i] );
 				QFileInfo fi(url.path());
@@ -9780,16 +9753,7 @@
 					QString data;
 					QByteArray cf;
 					loadRawText(url.toLocalFile(), cf);
-					if (fileUrl.endsWith(".sce"))
-						data = QString::fromUtf8(cf.data());
-					else
-					{
-						QString f = QString::fromUtf8(cf.data());
-						StencilReader *pre = new StencilReader();
-						if (fileUrl.endsWith(".shape"))
-							data = pre->createShape(f);
-						delete pre;
-					}
+					data = QString::fromUtf8(cf.data());
 					double gx, gy, gw, gh;
 					ScriXmlDoc *ss = new ScriXmlDoc();
 					if(ss->ReadElemHeader(data, false, &gx, &gy, &gw, &gh))
@@ -9797,10 +9761,7 @@
 						doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
 						HaveNewDoc();
 						doc->reformPages(true);
-						if (fileUrl.endsWith(".sce"))
-							slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
-						else
-							slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+						slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
 						slotDocCh(false);
 						doc->regionsChanged()->update(QRectF());
 						delete ss;

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Mon Dec 27 17:00:33 2010
@@ -111,7 +111,6 @@
 #include "scribusXml.h"
 #include "selection.h"
 #include "serializer.h"
-#include "stencilreader.h"
 #include "ui/storyeditor.h"
 #include "ui/symbolpalette.h"
 #include "text/nlsconfig.h"
@@ -915,7 +914,7 @@
 		bool vectorFile = false;
 		if (fi.exists())
 		{
-			if ((fi.suffix().toLower() == "shape") || (fi.suffix().toLower() == "sce"))
+			if (fi.suffix().toLower() == "sce")
 				vectorFile = true;
 			else
 			{
@@ -993,17 +992,7 @@
 				if (fi.exists())
 				{
 					QString data;
-					if (fi.suffix().toLower() == "shape")
-					{
-						QByteArray cf;
-						loadRawText(url.toLocalFile(), cf);
-						StencilReader *pre = new StencilReader();
-						QString f = QString::fromUtf8(cf.data());
-						data = pre->createShape(f);
-						delete pre;
-						emit LoadElem(data, dropPosDoc.x(), dropPosDoc.y(), false, false, Doc, this);
-					}
-					else if (fi.suffix().toLower() == "sce")
+					if (fi.suffix().toLower() == "sce")
 					{
 						emit LoadElem(url.toLocalFile(), dropPosDoc.x(), dropPosDoc.y(), true, false, Doc, this);
 					}

Modified: trunk/Scribus/scribus/ui/customfdialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/ui/customfdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/customfdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/customfdialog.cpp Mon Dec 27 17:00:33 2010
@@ -50,7 +50,6 @@
 #include "scimage.h"
 #include "scribusstructs.h"
 #include "scslainforeader.h"
-#include "stencilreader.h"
 #include "scpreview.h"
 #include "units.h"
 #include "util.h"
@@ -228,33 +227,6 @@
 					repaint();
 				}
 			}
-		}
-	}
-	else if (ext.toUtf8() == "shape")
-	{
-		QByteArray cf;
-		if (loadRawText(name, cf))
-		{
-			QString f = QString::fromUtf8(cf.data());
-			StencilReader *pre = new StencilReader();
-			QString f2 = pre->createShape(f);
-			ScPreview *pre2 = new ScPreview();
-			QImage im = pre2->createPreview(f2);
-			im = im.scaled(w - 5, h - 21, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-			QPainter p;
-			QBrush b(QColor(205,205,205), loadIcon("testfill.png"));
-			pm = *pixmap();
-			p.begin(&pm);
-			p.fillRect(0, 0, w, h-21, b);
-			p.fillRect(0, h-21, w, 21, QColor(255, 255, 255));
-			p.drawImage((w - im.width()) / 2, (h - 21 - im.height()) / 2, im);
-			QString desc = tr("Size:")+QString(" %1 x %2").arg(im.width()).arg(im.height());
-			p.drawText(2, h-5, desc);
-			p.end();
-			setPixmap(pm);
-			repaint();
-			delete pre;
-			delete pre2;
 		}
 	}
 	else if (ext.toUtf8() == "sce")

Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Mon Dec 27 17:00:33 2010
@@ -55,7 +55,6 @@
 #include "scpaths.h"
 #include "sctextstream.h"
 #include "scribusXml.h"
-#include "stencilreader.h"
 #include "undomanager.h"
 #include "util.h"
 #include "util_color.h"
@@ -1078,9 +1077,7 @@
 				fmt = LoadSavePlugin::getFormatById(fmtCode);
 			}
 			allFormats += "*.sce *.SCE ";
-			allFormats += "*.shape *.SHAPE ";
 			formats.append("Scribus Objects (*.sce *.SCE)");
-			formats.append("Dia Shapes (*.shape *.SHAPE)");
 			QString form1 = "";
 			QString form2 = "";
 			QStringList imgFormats;
@@ -1162,7 +1159,7 @@
 				qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 				PrefsManager::instance()->prefsFile->getContext("dirs")->set("patterns", fileName.left(fileName.lastIndexOf("/")));
 				QFileInfo fi(fileName);
-				if ((fi.suffix().toLower() == "shape") || (fi.suffix().toLower() == "sce") || (!imgFormats.contains(fi.suffix().toLower())))
+				if ((fi.suffix().toLower() == "sce") || (!imgFormats.contains(fi.suffix().toLower())))
 				{
 					loadVectors(fileName);
 				}
@@ -1231,7 +1228,7 @@
 				qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
 				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(fileName + "/" + d[dc])));
 				QString ext = fi.suffix().toLower();
-				if ((ext == "shape") || (ext == "sce") || (!formats.contains(ext)))
+				if ((ext == "sce") || (!formats.contains(ext)))
 					loadVectors(QDir::cleanPath(QDir::convertSeparators(fileName + "/" + d[dc])));
 			}
 			for (uint dc = 0; dc < d.count(); ++dc)
@@ -1240,7 +1237,7 @@
 				qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
 				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(fileName + "/" + d[dc])));
 				QString ext = fi.suffix().toLower();
-				if ((ext == "shape") || (ext == "sce") || (!formats.contains(ext)))
+				if ((ext == "sce") || (!formats.contains(ext)))
 					continue;
 				else if (formats.contains(ext))
 				{
@@ -1275,14 +1272,6 @@
 	m_doc->setLoading(true);
 	QFileInfo fi(data);
 	QString patNam = fi.baseName().trimmed().simplified().replace(" ", "_");
-	if (fi.suffix().toLower() == "shape")
-	{
-		QString f = "";
-		loadText(data, &f);
-		StencilReader *pre = new StencilReader();
-		data = pre->createShape(f);
-		delete pre;
-	}
 	uint ac = m_doc->Items->count();
 	uint ap = m_doc->docPatterns.count();
 	bool savedAlignGrid = m_doc->useRaster;
@@ -1293,11 +1282,6 @@
 	{
 		ScriXmlDoc ss;
 		ss.ReadElem(data, PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts, m_doc, m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset(), true, true, PrefsManager::instance()->appPrefs.fontPrefs.GFontSub);
-	}
-	else if (fi.suffix().toLower() == "shape")
-	{
-		ScriXmlDoc ss;
-		ss.ReadElem(data, PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts, m_doc, m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset(), false, true, PrefsManager::instance()->appPrefs.fontPrefs.GFontSub);
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16171&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Mon Dec 27 17:00:33 2010
@@ -42,7 +42,6 @@
 #include "scpreview.h"
 #include "scimage.h"
 #include "scribuscore.h"
-#include "stencilreader.h"
 #include "fileloader.h"
 #include "loadsaveplugin.h"
 #include "plugins/formatidlist.h"
@@ -87,17 +86,7 @@
 	QFileInfo fi(dt);
 	QMimeData *mimeData = new QMimeData;
 	QList<QUrl> urlList;
-	if (fi.suffix().toLower() == "shape")
-	{
-		QByteArray cf;
-		loadRawText(dt, cf);
-		QString f = QString::fromUtf8(cf.data());
-		StencilReader *pre = new StencilReader();
-		dt = pre->createShape(f);
-		delete pre;
-		mimeData->setText(dt);
-	}
-	else if (fi.suffix().toLower() == "sce")
+	if (fi.suffix().toLower() == "sce")
 	{
 		if ( fi.exists() )
 		{
@@ -118,7 +107,6 @@
 	QDrag *drag = new QDrag(this);
 	drag->setMimeData(mimeData);
 	drag->setPixmap(objectMap[currentItem()->text()].Preview);
-//	drag->setDragCursor(objectMap[currentItem()->text()].Preview, Qt::CopyAction);
 	drag->exec(Qt::CopyAction);
 	clearSelection();
  }
@@ -306,199 +294,7 @@
 	s.writeRawData(cs.data(), cs.length());
 	f.close();
 }
-/*
-void BibView::SaveContents(QString name, QString oldName)
-{
-	QDir thumbs(name);
-	if (thumbs.exists())
-	{
-		if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-			thumbs.mkdir(".ScribusThumbs");
-	}
-	QDir d(oldName, "*.sce", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-	if ((d.exists()) && (d.count() != 0))
-	{
-		for (uint dc = 0; dc < d.count(); ++dc)
-		{
-			QByteArray cf;
-			if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d[dc])), cf))
-				continue;
-			QString ff = QString::fromUtf8(cf.data());
-			QPixmap pm;
-			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
-			if (fi2.exists())
-				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
-			else
-			{
-				QString f;
-				if (cf.left(16) == "<SCRIBUSELEMUTF8")
-					f = QString::fromUtf8(cf.data());
-				else
-					f = cf.data();
-				ScPreview *pre = new ScPreview();
-				pm = QPixmap::fromImage(pre->createPreview(f));
-				delete pre;
-			}
-			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])));
-			if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-				pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/.ScribusThumbs/"+fi3.baseName()+".png")), "PNG");
-			checkAndChange(ff, QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])), QDir::cleanPath(QDir::convertSeparators(name)));
-		}
-	}
-	QDir d2(oldName, "*.sml", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-	if ((d2.exists()) && (d2.count() != 0))
-	{
-		for (uint dc = 0; dc < d2.count(); ++dc)
-		{
-			QByteArray cf;
-			if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d2[dc])), cf))
-				continue;
-			QFile fil(QDir::cleanPath(QDir::convertSeparators(name + "/" + d2[dc])));
-			if(!fil.open(QIODevice::WriteOnly))
-				continue ;
-			QDataStream s(&fil);
-			s.writeRawData(cf.data(), cf.length());
-			fil.close();
-			QPixmap pm;
-			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d2[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-			if (fi2.exists())
-				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-			else
-			{
-				QString f = QString::fromUtf8(cf.data());
-				StencilReader *pre = new StencilReader();
-				pm = pre->createPreview(f);
-				delete pre;
-			}
-			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(name + "/" + d2[dc])));
-			if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-				pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/"+fi3.baseName()+".png")), "PNG");
-		}
-	}
-	QDir d3(name, "*.shape", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-	if ((d3.exists()) && (d3.count() != 0))
-	{
-		for (uint dc = 0; dc < d3.count(); ++dc)
-		{
-			QByteArray cf;
-			if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d3[dc])), cf))
-				continue;
-			QFile fil(QDir::cleanPath(QDir::convertSeparators(name + "/" + d3[dc])));
-			if(!fil.open(QIODevice::WriteOnly))
-				continue ;
-			QDataStream s(&fil);
-			s.writeRawData(cf.data(), cf.length());
-			fil.close();
-			QPixmap pm;
-			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d3[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-			if (fi2.exists())
-				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-			else
-			{
-				QString f = QString::fromUtf8(cf.data());
-				StencilReader *pre = new StencilReader();
-				QString f2 = pre->createShape(f);
-				ScPreview *pre2 = new ScPreview();
-				pm = QPixmap::fromImage(pre2->createPreview(f2));
-				delete pre;
-				delete pre2;
-			}
-			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(name + "/" + d3[dc])));
-			if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-				pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/"+fi3.baseName()+".png")), "PNG");
-		}
-	}
-	QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
-	for (int v = 0; v < vectorFiles.count(); v++)
-	{
-		QString ext = "*." + vectorFiles[v];
-		QDir d4(name, ext, QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-		if ((d4.exists()) && (d4.count() != 0))
-		{
-			for (uint dc = 0; dc < d4.count(); ++dc)
-			{
-				QByteArray cf;
-				if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d4[dc])), cf))
-					continue;
-				QFile fil(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-				if(!fil.open(QIODevice::WriteOnly))
-					continue ;
-				QDataStream s(&fil);
-				s.writeRawData(cf.data(), cf.length());
-				fil.close();
-				QPixmap pm;
-				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
-				if (fi2.exists())
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
-				else
-				{
-					FileLoader *fileLoader = new FileLoader(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-					int testResult = fileLoader->TestFile();
-					delete fileLoader;
-					if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
-					{
-						const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						if( fmt )
-						{
-							QImage im = fmt->readThumbnail(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-							im = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-							pm = QPixmap::fromImage(im);
-						}
-					}
-				}
-				QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-				if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-					pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/.ScribusThumbs/"+fi3.fileName()+".png")), "PNG");
-			}
-		}
-	}
-	QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
-	QStringList rasterFiles = formatD.split("|");
-	for (int v = 0; v < rasterFiles.count(); v++)
-	{
-		QString ext = "*." + rasterFiles[v];
-		QDir d5(name, ext, QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-		if ((d5.exists()) && (d5.count() != 0))
-		{
-			for (uint dc = 0; dc < d5.count(); ++dc)
-			{
-				QByteArray cf;
-				if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d5[dc])), cf))
-					continue;
-				QFile fil(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])));
-				if(!fil.open(QIODevice::WriteOnly))
-					continue ;
-				QDataStream s(&fil);
-				s.writeRawData(cf.data(), cf.length());
-				fil.close();
-				QPixmap pm;
-				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])));
-				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
-				if (fi2.exists())
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
-				else
-				{
-					bool mode = false;
-					ScImage im;
-					CMSettings cms(0, "", Intent_Perceptual);
-					cms.allowColorManagement(false);
-					if (im.loadPicture(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])), 1, cms, ScImage::Thumbnail, 72, &mode))
-					{
-						QImage img = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-						if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-							img.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")), "PNG");
-						pm = QPixmap::fromImage(img);
-					}
-				}
-			}
-		}
-	}
-}
-*/
+
 void BibView::ReadOldContents(QString name, QString newName)
 {
 	bool isUtf8 = false;
@@ -558,8 +354,6 @@
 	fileCount += dd.count();
 	QDir d(name, "*.sce", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
 	fileCount += d.count();
-	QDir d3(name, "*.shape", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-	fileCount += d3.count();
 	QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
 	for (int v = 0; v < vectorFiles.count(); v++)
 	{
@@ -634,56 +428,6 @@
 			}
 			previewFiles.append(fi.baseName()+".png");
 			AddObj(fi.baseName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])), pm);
-		}
-	}
-	if ((d3.exists()) && (d3.count() != 0))
-	{
-		for (uint dc = 0; dc < d3.count(); ++dc)
-		{
-			if (pgDia)
-			{
-				pgDia->setValue(readCount);
-				readCount++;
-			}
-			QPixmap pm;
-			QByteArray cf;
-			if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(name + "/" + d3[dc])), cf))
-				continue;
-			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d3[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-			QFileInfo fi2p(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".xpm")));
-			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
-			if ((fi2.exists()) || (fi2p.exists()) || (fi3.exists()))
-			{
-				if (fi3.exists())
-				{
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
-					previewFiles.append(fi.baseName()+".png");
-				}
-				else if (fi2.exists())
-				{
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-					previewFiles.append(fi.baseName()+".png");
-				}
-				else if (fi2p.exists())
-				{
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".xpm")));
-					previewFiles.append(fi.baseName()+".xpm");
-				}
-			}
-			else
-			{
-				QString f = QString::fromUtf8(cf.data());
-				StencilReader *pre = new StencilReader();
-				QString f2 = pre->createShape(f);
-				ScPreview *pre2 = new ScPreview();
-				pm = QPixmap::fromImage(pre2->createPreview(f2));
-				if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-					pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")), "PNG");
-				delete pre;
-				delete pre2;
-			}
-			AddObj(fi.baseName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d3[dc])), pm);
 		}
 	}
 	for (int v = 0; v < vectorFiles.count(); v++)




More information about the scribus-commit mailing list