Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 18909 → Rev 18910

/trunk/Scribus/scribus/scgzfile.cpp
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/scgzfile.h
===================================================================
--- trunk/Scribus/scribus/scgzfile.h (revision 18909)
+++ trunk/Scribus/scribus/scgzfile.h (nonexistent)
@@ -1,54 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-#ifndef SCGZFILE_H
-#define SCGZFILE_H
-
-#include <QByteArray>
-#include <QIODevice>
-#include <QString>
-
-#include "scribusapi.h"
-
-struct ScGzFileDataPrivate;
-
-class SCRIBUS_API ScGzFile : public QIODevice
-{
-protected:
- QString m_fileName;
- ScGzFileDataPrivate* m_data;
- ScGzFileDataPrivate* newPrivateData(void);
- void freeData(void);
-
- bool gzFileOpen(QString fileName, ScGzFileDataPrivate* data, QIODevice::OpenMode mode);
-
- virtual qint64 readData (char * data, qint64 maxSize);
- virtual qint64 writeData (const char * data, qint64 maxSize);
-
-public:
- ScGzFile(const QString& filename);
- ~ScGzFile(void);
-
- static const int gzipExpansionFactor;
-
- virtual bool atEnd() const;
- virtual bool open(QIODevice::OpenMode mode);
- virtual void close();
-
- virtual qint64 size () const;
-
- bool errorOccurred(void) const;
- int error(void) const;
-
- bool reset(void);
-
- static bool readFromFile(const QString& filename, QByteArray& bArray, uint maxBytes = 0);
- static bool writeToFile (const QString& filename, const QByteArray& bArray);
- static bool writeToFile (const QString& filename, const QByteArray& bArray, const char* header);
-};
-
-#endif
/trunk/Scribus/scribus/scgzfile.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/CMakeLists.txt
===================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (revision 18909)
+++ trunk/Scribus/scribus/CMakeLists.txt (revision 18910)
@@ -636,7 +636,6 @@
scdomelement.cpp
scfonts.cpp
scgtplugin.cpp
- scgzfile.cpp
schelptreemodel.cpp
scimage.cpp
scimagecacheproxy.cpp
Index: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 18909)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 18910)
@@ -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
Index: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 18909)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 18910)
@@ -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)
/trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
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;
/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
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
{
/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
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
{
/trunk/Scribus/scribus/scslainforeader.cpp
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) );