r24227 by jghali - Remove of few uses of obsolete QXmlSimpleReader class
scribus-commit
scribus-commit at lists.scribus.net
Wed Nov 11 14:26:14 UTC 2020
Author: jghali
Date: Wed Nov 11 14:26:14 2020
New Revision: 24227
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24227
Log:
Remove of few uses of obsolete QXmlSimpleReader class
Modified:
trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
Modified: trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24227&path=/trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp Wed Nov 11 14:26:14 2020
@@ -14,8 +14,7 @@
#include <QApplication>
#include <QByteArray>
-#include <QXmlInputSource>
-#include <QXmlSimpleReader>
+
#include "scribusdoc.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
@@ -71,22 +70,20 @@
void DocXIm::parseContentTypes()
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read("[Content_Types].xml", f))
- return;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+ if (!uz->read("[Content_Types].xml", xmlData))
+ return;
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return;
}
+
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
{
@@ -117,22 +114,20 @@
void DocXIm::parseTheme()
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(themePart, f))
- return;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+ if (!uz->read(themePart, xmlData))
+ return;
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return;
}
+
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
{
@@ -165,27 +160,26 @@
void DocXIm::parseStyles()
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(stylePart, f))
- return;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+ if (!uz->read(stylePart, xmlData))
+ return;
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return;
}
+
defaultParagraphStyle.setParent(CommonStrings::DefaultParagraphStyle);
defaultParagraphStyle.charStyle().setParent(CommonStrings::DefaultCharacterStyle);
currentParagraphStyle.setParent(CommonStrings::DefaultParagraphStyle);
currentParagraphStyle.charStyle().setParent(CommonStrings::DefaultCharacterStyle);
currentParagraphStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
+
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
{
@@ -256,22 +250,20 @@
void DocXIm::parseStyledText(PageItem *textItem)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(docPart, f))
- return;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+ if (!uz->read(docPart, xmlData))
+ return;
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return;
}
+
if (!m_append)
{
QString pStyleD = CommonStrings::DefaultParagraphStyle;
@@ -282,6 +274,7 @@
textItem->itemText.setDefaultStyle(newStyle);
}
textItem->itemText.setDefaultStyle(defaultParagraphStyle);
+
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
{
@@ -588,22 +581,20 @@
void DocXIm::parsePlainTextOnly(PageItem *textItem)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(docPart, f))
- return;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+ if (!uz->read(docPart, xmlData))
+ return;
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return;
}
+
if (!m_append)
{
QString pStyleD = CommonStrings::DefaultParagraphStyle;
@@ -616,6 +607,7 @@
currentParagraphStyle.setParent(CommonStrings::DefaultParagraphStyle);
currentParagraphStyle.charStyle().setParent(CommonStrings::DefaultCharacterStyle);
currentParagraphStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
+
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
{
Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24227&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp Wed Nov 11 14:26:14 2020
@@ -15,8 +15,6 @@
#include <QApplication>
#include <QByteArray>
#include <QScopedPointer>
-#include <QXmlInputSource>
-#include <QXmlSimpleReader>
#include "scribusdoc.h"
#include "styles/charstyle.h"
@@ -140,18 +138,15 @@
bool ODTIm::parseRawDocReference(const QString& designMap)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(designMap, f))
+ if (!uz->read(designMap, xmlData))
return false;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return false;
@@ -317,18 +312,15 @@
bool ODTIm::parseStyleSheets(const QString& designMap)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(designMap, f))
+ if (!uz->read(designMap, xmlData))
return false;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return false;
@@ -581,18 +573,15 @@
bool ODTIm::parseDocReference(const QString& designMap)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(designMap, f))
+ if (!uz->read(designMap, xmlData))
return false;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return false;
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24227&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Wed Nov 11 14:26:14 2020
@@ -13,6 +13,7 @@
#include <QByteArray>
#include <QCursor>
+#include <QDebug>
#include <QDrag>
#include <QFile>
#include <QList>
@@ -20,9 +21,6 @@
#include <QRegExp>
#include <QStack>
#include <QUrl>
-#include <QXmlInputSource>
-#include <QXmlSimpleReader>
-#include <QDebug>
#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
#define _USE_MATH_DEFINES
@@ -401,18 +399,15 @@
bool OdgPlug::parseStyleSheets(const QString& designMap)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(designMap, f))
+ if (!uz->read(designMap, xmlData))
return false;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return false;
@@ -528,18 +523,15 @@
bool OdgPlug::parseDocReference(const QString& designMap)
{
- QByteArray f;
+ QByteArray xmlData;
QDomDocument designMapDom;
- if (!uz->read(designMap, f))
+ if (!uz->read(designMap, xmlData))
return false;
- QXmlInputSource xmlSource;
- xmlSource.setData(f);
- QXmlSimpleReader xmlReader;
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- QString errorMsg = "";
+
+ QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
- if (!designMapDom.setContent(&xmlSource, &xmlReader, &errorMsg, &errorLine, &errorColumn))
+ if (!designMapDom.setContent(xmlData, false, &errorMsg, &errorLine, &errorColumn))
{
qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
return false;
More information about the scribus-commit
mailing list