r18910 by fschmid - Removed all uses of ScGzFile and replaced them by QtIOCompressor class.
scribus-commit
scribus-commit at lists.scribus.net
Fri Mar 14 16:34:17 UTC 2014
Author: fschmid
Date: Fri Mar 14 16:34:16 2014
New Revision: 18910
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18910
Log:
Removed all uses of ScGzFile and replaced them by QtIOCompressor class.
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
trunk/Scribus/scribus/scgzfile.cpp
trunk/Scribus/scribus/scgzfile.h
trunk/Scribus/scribus/scslainforeader.cpp
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Fri Mar 14 16:34:16 2014
@@ -636,7 +636,6 @@
scdomelement.cpp
scfonts.cpp
scgtplugin.cpp
- scgzfile.cpp
schelptreemodel.cpp
scimage.cpp
scimagecacheproxy.cpp
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Fri Mar 14 16:34:16 2014
@@ -32,7 +32,6 @@
#include "util_math.h"
#include "util_color.h"
#include "util_text.h"
-#include "scgzfile.h"
#ifdef HAVE_OSG
#include "pageitem_osgframe.h"
#endif
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&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 Fri Mar 14 16:34:16 2014
@@ -14,6 +14,7 @@
#include "commonstrings.h"
#include "ui/missing.h"
#include "prefsmanager.h"
+#include "qtiocompressor.h"
#include "resourcecollection.h"
#include "scconfig.h"
#include "scpattern.h"
@@ -35,7 +36,6 @@
#include "util.h"
#include "util_math.h"
#include "util_color.h"
-#include "scgzfile.h"
#include <QCursor>
#include <QFileInfo>
#include <QList>
@@ -184,7 +184,12 @@
std::auto_ptr<QIODevice> outputFile;
if (fileName.toLower().right(2) == "gz")
- outputFile.reset( new ScGzFile(tmpFileName) );
+ {
+ aFile.setFileName(tmpFileName);
+ QtIOCompressor *compressor = new QtIOCompressor(&aFile);
+ compressor->setStreamFormat(QtIOCompressor::GzipFormat);
+ outputFile.reset(compressor);
+ }
else
outputFile.reset( new QFile(tmpFileName) );
@@ -406,11 +411,10 @@
bool writeSucceed = false;
const QFile* qFile = dynamic_cast<QFile*>(outputFile.get());
- const ScGzFile* gzFile = dynamic_cast<ScGzFile*>(outputFile.get());
if (qFile)
writeSucceed = (qFile->error() == QFile::NoError);
- else if (gzFile)
- writeSucceed = !gzFile->errorOccurred();
+ else
+ writeSucceed = true;
outputFile->close();
if (writeSucceed)
Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.cpp Fri Mar 14 16:34:16 2014
@@ -40,11 +40,11 @@
#include "prefsfile.h"
#include "prefsmanager.h"
#include "prefstable.h"
+#include "qtiocompressor.h"
#include "rawimage.h"
#include "scclocale.h"
#include "sccolorengine.h"
#include "scconfig.h"
-#include "scgzfile.h"
#include "scmimedata.h"
#include "scpaths.h"
#include "scribus.h"
@@ -433,7 +433,13 @@
QString fname = getLongPathName(tmpFile->fileName());
tmpFile->write(f);
tmpFile->close();
- if (!ScGzFile::readFromFile(fname, f))
+ QFile file(fname);
+ QtIOCompressor compressor(&file);
+ compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+ compressor.open(QIODevice::ReadOnly);
+ f = compressor.readAll();
+ compressor.close();
+ if (f.isEmpty())
{
delete tmpFile;
return false;
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&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 Fri Mar 14 16:34:16 2014
@@ -24,10 +24,10 @@
#include "pageitem.h"
#include "prefsfile.h"
#include "prefsmanager.h"
+#include "qtiocompressor.h"
#include "sccolorengine.h"
#include "scclocale.h"
#include "scconfig.h"
-#include "scgzfile.h"
#include "sclimits.h"
#include "scmimedata.h"
#include "scpaths.h"
@@ -342,11 +342,13 @@
}
if ((fName.right(2) == "gz") || (isCompressed))
{
- ScGzFile file(fName);
- if (!file.open(QIODevice::ReadOnly))
+ QFile file(fName);
+ QtIOCompressor compressor(&file);
+ compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+ if (!compressor.open(QIODevice::ReadOnly))
return false;
- success = inpdoc.setContent(&file);
- file.close();
+ success = inpdoc.setContent(&compressor);
+ compressor.close();
}
else
{
Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Fri Mar 14 16:34:16 2014
@@ -42,7 +42,7 @@
#include "prefsmanager.h"
#include "prefsfile.h"
#include "prefscontext.h"
-#include "scgzfile.h"
+#include "qtiocompressor.h"
#include "scpage.h"
#include "scpattern.h"
#include "scribuscore.h"
@@ -261,9 +261,15 @@
if(Options.compressFile)
{
// zipped saving
- QByteArray array(docu.toString().toUtf8());
- if (!ScGzFile::writeToFile(fName, array, vo.toUtf8().data()))
- return false;
+ QString wr = vo;
+ wr += docu.toString();
+ QByteArray utf8wr = wr.toUtf8();
+ QFile file(fName);
+ QtIOCompressor compressor(&file);
+ compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+ compressor.open(QIODevice::WriteOnly);
+ compressor.write(utf8wr);
+ compressor.close();
}
else
{
Modified: trunk/Scribus/scribus/scslainforeader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18910&path=/trunk/Scribus/scribus/scslainforeader.cpp
==============================================================================
--- trunk/Scribus/scribus/scslainforeader.cpp (original)
+++ trunk/Scribus/scribus/scslainforeader.cpp Fri Mar 14 16:34:16 2014
@@ -10,7 +10,7 @@
#include <QFile>
#include <QXmlStreamReader>
-#include "scgzfile.h"
+#include "qtiocompressor.h"
void ScSlaInfoReader::resetFileInfos(void)
{
@@ -27,9 +27,14 @@
std::auto_ptr<QIODevice> file;
resetFileInfos();
-
+ QFile aFile;
if (fileName.right(2).toLower() == "gz")
- file.reset( new ScGzFile(fileName) );
+ {
+ aFile.setFileName(fileName);
+ QtIOCompressor *compressor = new QtIOCompressor(&aFile);
+ compressor->setStreamFormat(QtIOCompressor::GzipFormat);
+ file.reset(compressor);
+ }
else
file.reset( new QFile(fileName) );
More information about the scribus-commit
mailing list