r24850 by jghali - Qt6: Build fixes
scribus-commit
scribus-commit at lists.scribus.net
Sun Jan 30 02:03:28 UTC 2022
Author: jghali
Date: Sun Jan 30 02:03:27 2022
New Revision: 24850
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24850
Log:
Qt6: Build fixes
Modified:
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/picbrowser/collection.cpp
trunk/Scribus/scribus/plugins/picbrowser/imagedialog.cpp
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24850&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sun Jan 30 02:03:27 2022
@@ -17,7 +17,9 @@
#include <QFileInfo>
#include <QIODevice>
#include <QList>
+#include <QRegularExpression>
#include <QScopedPointer>
+#include <QStringView>
#include "../../formatidlist.h"
#include "commonstrings.h"
@@ -266,7 +268,7 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
attrs = reader.scAttributes();
if (m_mwProgressBar != nullptr)
@@ -281,14 +283,14 @@
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
success = false;
break;
}
firstElement = false;
}
- if (tagName == "DOCUMENT")
+ if (tagName == QLatin1String("DOCUMENT"))
{
readDocAttributes(m_Doc, attrs);
layerToSetActive = attrs.valueAsInt("ALAYER", 0);
@@ -307,24 +309,24 @@
m_Doc->setCurCheckProfile(attrs.valueAsString("currentProfile"));
}
}
- if (tagName == "CheckProfile")
+ if (tagName == QLatin1String("CheckProfile"))
{
success = readCheckProfile(m_Doc, attrs);
if (!success) break;
}
- if (tagName == "PageSets")
+ if (tagName == QLatin1String("PageSets"))
{
success = readPageSets(m_Doc, reader);
if (!success) break;
hasPageSets = true;
}
// 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
- if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
+ if (tagName == QLatin1String("COLOR") && attrs.valueAsString("NAME") != CommonStrings::None)
{
success = readColor(m_Doc->PageColors, attrs);
if (!success) break;
}
- if (tagName == "STYLE")
+ if (tagName == QLatin1String("STYLE"))
{
ParagraphStyle pstyle;
readParagraphStyle(m_Doc, reader, pstyle);
@@ -332,7 +334,7 @@
tmp.create(pstyle);
m_Doc->redefineStyles(tmp, false);
}
- if (tagName == "CHARSTYLE")
+ if (tagName == QLatin1String("CHARSTYLE"))
{
CharStyle cstyle;
ScXmlStreamAttributes attrs = reader.scAttributes();
@@ -341,24 +343,24 @@
temp.create(cstyle);
m_Doc->redefineCharStyles(temp, false);
}
- if (tagName == "JAVA")
+ if (tagName == QLatin1String("JAVA"))
{
QString name = attrs.valueAsString("NAME");
if (!name.isEmpty())
m_Doc->JavaScripts[name] = attrs.valueAsString("SCRIPT");
}
- if (tagName == "LAYERS")
+ if (tagName == QLatin1String("LAYERS"))
{
ScLayer newLayer;
readLayers(newLayer, attrs);
m_Doc->Layers.append(newLayer);
}
- if (tagName == "Arrows")
+ if (tagName == QLatin1String("Arrows"))
{
success = readArrows(m_Doc, attrs);
if (!success) break;
}
- if (tagName == "MultiLine")
+ if (tagName == QLatin1String("MultiLine"))
{
multiLine ml;
QString mlName = attrs.valueAsString("Name");
@@ -369,7 +371,7 @@
m_Doc->docLineStyles.insert(mlName, ml);
}
}
- if (tagName == "Bookmark")
+ if (tagName == QLatin1String("Bookmark"))
{
int bmElem = 0;
struct ScribusDoc::BookMa bookmark;
@@ -377,60 +379,60 @@
if (!success) break;
bookmarks.insert(bmElem, bookmark);
}
- if (tagName == "PDF")
+ if (tagName == QLatin1String("PDF"))
{
success = readPDFOptions(m_Doc, reader);
if (!success) break;
}
- if (tagName == "Printer")
+ if (tagName == QLatin1String("Printer"))
{
success = readPrinterOptions(m_Doc, reader);
if (!success) break;
}
- if (tagName == "DocItemAttributes")
+ if (tagName == QLatin1String("DocItemAttributes"))
{
success = readDocItemAttributes(m_Doc, reader);
if (!success) break;
}
- if (tagName == "TablesOfContents")
+ if (tagName == QLatin1String("TablesOfContents"))
{
success = readTableOfContents(m_Doc, reader);
if (!success) break;
}
- if (tagName == "Sections")
+ if (tagName == QLatin1String("Sections"))
{
success = readSections(m_Doc, reader);
if (!success) break;
}
- if (tagName == "HYPHEN")
+ if (tagName == QLatin1String("HYPHEN"))
{
success = readHyphen(m_Doc, reader);
if (!success) break;
}
- if (tagName == "PAGE" || tagName == "MASTERPAGE")
+ if (tagName == QLatin1String("PAGE") || tagName == QLatin1String("MASTERPAGE"))
{
success = readPage(m_Doc, reader);
if (!success) break;
}
- if (tagName == "PAGEOBJECT" || tagName == "MASTEROBJECT" || tagName == "FRAMEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT") || tagName == QLatin1String("MASTEROBJECT") || tagName == QLatin1String("FRAMEOBJECT"))
{
ItemInfo itemInfo;
success = readObject(m_Doc, reader, itemInfo, fileDir, false);
if (!success) break;
// first of linked chain?
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
{
if (itemInfo.nextItem != -1)
itemNext[itemInfo.ownNr] = itemInfo.nextItem;
}
- else if (tagName == "MASTEROBJECT")
+ else if (tagName == QLatin1String("MASTEROBJECT"))
{
if (itemInfo.nextItem != -1)
itemNextM[itemInfo.ownNr] = itemInfo.nextItem;
}
/* not sure if we want that...
- else if (tagName == "FRAMEOBJECT")
+ else if (tagName == QLatin1String("FRAMEOBJECT"))
{
if (itemInfo.nextItem != -1)
itemNextF[itemInfo.item->ItemNr] = itemInfo.nextItem;
@@ -438,12 +440,12 @@
if (itemInfo.item->isTableItem)
{
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
{
TableItems.append(itemInfo.item);
TableID.insert(itemInfo.ownLink, itemInfo.item);
}
- else if (tagName == "FRAMEOBJECT")
+ else if (tagName == QLatin1String("FRAMEOBJECT"))
{
TableItemsF.append(itemInfo.item);
TableIDF.insert(itemInfo.ownLink, itemInfo.item);
@@ -455,7 +457,7 @@
}
}
- if ((tagName == "PAGEOBJECT") && (groupStackPI.count() > 0))
+ if ((tagName == QLatin1String("PAGEOBJECT")) && (groupStackPI.count() > 0))
{
groupStackPI.top().append(itemInfo.item);
while (itemInfo.ownNr == groupStackPI2.top())
@@ -466,7 +468,7 @@
break;
}
}
- else if ((tagName == "FRAMEOBJECT") && (groupStackFI.count() > 0))
+ else if ((tagName == QLatin1String("FRAMEOBJECT")) && (groupStackFI.count() > 0))
{
groupStackFI.top().append(itemInfo.item);
while (itemInfo.ownNr == groupStackFI2.top())
@@ -477,7 +479,7 @@
break;
}
}
- else if ((tagName == "MASTEROBJECT") && (groupStackMI.count() > 0))
+ else if ((tagName == QLatin1String("MASTEROBJECT")) && (groupStackMI.count() > 0))
{
groupStackMI.top().append(itemInfo.item);
while (itemInfo.ownNr == groupStackMI2.top())
@@ -493,12 +495,12 @@
{
QList<PageItem*> groupItems;
groupItems.append(itemInfo.item);
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
{
groupStackPI.push(groupItems);
groupStackPI2.push(itemInfo.groupLastItem + itemInfo.ownNr);
}
- else if (tagName == "FRAMEOBJECT")
+ else if (tagName == QLatin1String("FRAMEOBJECT"))
{
groupStackFI.push(groupItems);
groupStackFI2.push(itemInfo.groupLastItem + itemInfo.ownNr);
@@ -510,7 +512,7 @@
}
}
}
- if (tagName == "Pattern")
+ if (tagName == QLatin1String("Pattern"))
{
success = readPattern(m_Doc, reader, fileDir);
if (!success) break;
@@ -1091,7 +1093,7 @@
doc->itemToolPrefs().shapeLineWidth = attrs.valueAsDouble("WIDTH", 0.0);
doc->itemToolPrefs().lineWidth = attrs.valueAsDouble("WIDTHLINE", 1.0);
doc->itemToolPrefs().shapeLineColorShade = attrs.valueAsInt("PENSHADE", 100);
- doc->itemToolPrefs().lineColor = attrs.valueAsInt("LINESHADE", 100);
+ doc->itemToolPrefs().lineColorShade = attrs.valueAsInt("LINESHADE", 100);
doc->itemToolPrefs().shapeFillColorShade = attrs.valueAsInt("BRUSHSHADE", 100);
doc->opToolPrefs().dispX = attrs.valueAsDouble("dispX", 10.0);
doc->opToolPrefs().dispY = attrs.valueAsDouble("dispY", 10.0);
@@ -1131,12 +1133,12 @@
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
if (reader.isStartElement())
attrs = reader.attributes();
- if (reader.isEndElement() && tagName == "PageSets")
+ if (reader.isEndElement() && tagName == QLatin1String("PageSets"))
break;
- if (reader.isStartElement() && tagName == "Set")
+ if (reader.isStartElement() && tagName == QLatin1String("Set"))
{
ScXmlStreamAttributes attrs = reader.scAttributes();
pageS.Name = CommonStrings::untranslatePageSetString(attrs.valueAsString("Name"));
@@ -1148,7 +1150,7 @@
// pageS.GapBelow = attrs.valueAsDouble("GapBelow", 0);
pageS.pageNames.clear();
}
- if (reader.isEndElement() && tagName == "Set")
+ if (reader.isEndElement() && tagName == QLatin1String("Set"))
{
//->Prefs doc->pageSets.append(pageS);
doc->appendToPageSets(pageS);
@@ -1158,7 +1160,7 @@
doc->setPageGapVertical(attrs.valueAsDouble("GapBelow", 0.0));
}
}
- if (reader.isStartElement() && tagName == "PageNames")
+ if (reader.isStartElement() && tagName == QLatin1String("PageNames"))
pageS.pageNames.append(CommonStrings::untranslatePageSetLocString(attrs.valueAsString("Name")));
}
return !reader.hasError();
@@ -1482,13 +1484,13 @@
{
QList<ParagraphStyle::TabRecord> tbs;
newStyle.resetTabValues();
- QStringRef thisTagName = reader.name();
+ QStringView thisTagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == thisTagName)
break;
- if (reader.isStartElement() && reader.name() == "Tabs")
+ if (reader.isStartElement() && reader.name() == QLatin1String("Tabs"))
{
ParagraphStyle::TabRecord tb;
ScXmlStreamAttributes attrs2 = reader.scAttributes();
@@ -1545,13 +1547,13 @@
{
ml = multiLine();
ScXmlStreamAttributes rattrs = reader.scAttributes();
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
ScXmlStreamReader::TokenType tType = reader.readNext();
if (tType == ScXmlStreamReader::EndElement && reader.name() == tagName)
break;
- if (tType == ScXmlStreamReader::StartElement && reader.name() == "SubLine")
+ if (tType == ScXmlStreamReader::StartElement && reader.name() == QLatin1String("SubLine"))
{
struct SingleLine sl;
ScXmlStreamAttributes attrs = reader.scAttributes();
@@ -1650,7 +1652,7 @@
doc->pdfOptions().PageLayout = attrs.valueAsInt("PageLayout", 0);
doc->pdfOptions().openAction = attrs.valueAsString("openAction", "");
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
@@ -1658,9 +1660,9 @@
break;
if (!reader.isStartElement())
continue;
- QStringRef tName = reader.name();
+ QStringView tName = reader.name();
attrs = reader.scAttributes();
- if (tName == "LPI")
+ if (tName == QLatin1String("LPI"))
{
struct LPIData lpo;
lpo.Angle = attrs.valueAsInt("Angle");
@@ -1668,19 +1670,19 @@
lpo.SpotFunc = attrs.valueAsInt("SpotFunction");
doc->pdfOptions().LPISettings[attrs.valueAsString("Color")] = lpo;
}
- if (tName == "Fonts")
+ if (tName == QLatin1String("Fonts"))
{
QString fname = attrs.valueAsString("Name");
if (!doc->pdfOptions().EmbedList.contains(fname))
doc->pdfOptions().EmbedList.append(fname);
}
- if (tName == "Subset")
+ if (tName == QLatin1String("Subset"))
{
QString sname = attrs.valueAsString("Name");
if (!doc->pdfOptions().SubsetList.contains(sname))
doc->pdfOptions().SubsetList.append(sname);
}
- if (tName == "Effekte")
+ if (tName == QLatin1String("Effekte"))
{
struct PDFPresentationData ef;
ef.pageEffectDuration = attrs.valueAsInt("pageEffectDuration");
@@ -1740,12 +1742,12 @@
doc->Print_Options.printerCommand = attrs.valueAsString("printerCommand");
doc->Print_Options.copies = 1;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
ScXmlStreamReader::TokenType tType = reader.readNext();
- QStringRef tName = reader.name();
- if (tType == ScXmlStreamReader::StartElement && tName == "Separation")
+ QStringView tName = reader.name();
+ if (tType == ScXmlStreamReader::StartElement && tName == QLatin1String("Separation"))
doc->Print_Options.allSeparations.append(reader.attributes().value("Name").toString());
if (tType == ScXmlStreamReader::EndElement && tName == tagName)
break;
@@ -1755,14 +1757,14 @@
bool Scribus134Format::readDocItemAttributes(ScribusDoc *doc, ScXmlStreamReader& reader)
{
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
doc->clearItemAttributes();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == tagName)
break;
- if (reader.isStartElement() && reader.name() == "ItemAttribute")
+ if (reader.isStartElement() && reader.name() == QLatin1String("ItemAttribute"))
{
ScXmlStreamAttributes attrs = reader.scAttributes();
ObjectAttribute objattr;
@@ -1781,14 +1783,14 @@
bool Scribus134Format::readTableOfContents(ScribusDoc* doc, ScXmlStreamReader& reader)
{
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
m_Doc->clearTocSetups();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == tagName)
break;
- if (reader.isStartElement() && reader.name() == "TableOfContents")
+ if (reader.isStartElement() && reader.name() == QLatin1String("TableOfContents"))
{
ScXmlStreamAttributes attrs = reader.scAttributes();
ToCSetup tocsetup;
@@ -1812,13 +1814,13 @@
bool Scribus134Format::readSections(ScribusDoc* doc, ScXmlStreamReader& reader)
{
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == tagName)
break;
- if (reader.isStartElement() && reader.name() == "Section")
+ if (reader.isStartElement() && reader.name() == QLatin1String("Section"))
{
ScXmlStreamAttributes attrs = reader.scAttributes();
struct DocumentSection newSection;
@@ -1854,20 +1856,20 @@
if (!doc->docHyphenator)
doc->createHyphenator();
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == tagName)
break;
- if (reader.isStartElement() && reader.name() == "EXCEPTION")
+ if (reader.isStartElement() && reader.name() == QLatin1String("EXCEPTION"))
{
ScXmlStreamAttributes attrs = reader.scAttributes();
QString word = attrs.valueAsString("WORD");
QString hyph = attrs.valueAsString("HYPHENATED");
doc->docHyphenator->specialWords.insert(word, hyph);
}
- else if (reader.isStartElement() && reader.name() == "IGNORE")
+ else if (reader.isStartElement() && reader.name() == QLatin1String("IGNORE"))
{
ScXmlStreamAttributes attrs = reader.scAttributes();
QString word = attrs.valueAsString("WORD");
@@ -1879,12 +1881,12 @@
bool Scribus134Format::readPage(ScribusDoc* doc, ScXmlStreamReader& reader)
{
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
ScXmlStreamAttributes attrs = reader.scAttributes();
int pageNum = attrs.valueAsInt("NUM");
QString pageName = attrs.valueAsString("NAM", "");
- if (tagName == "MASTERPAGE" && pageName.isEmpty())
+ if (tagName == QLatin1String("MASTERPAGE") && pageName.isEmpty())
{
qDebug() << "scribus134format: corrupted masterpage with empty name detected";
return true;
@@ -1941,26 +1943,26 @@
bool Scribus134Format::readObject(ScribusDoc* doc, ScXmlStreamReader& reader, ItemInfo& info, const QString& baseDir, bool loadPage, const QString& renamedPageName)
{
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
ScXmlStreamAttributes attrs = reader.scAttributes();
if (!loadPage)
{
- if (tagName == "PAGEOBJECT" || tagName =="FRAMEOBJECT" || tagName =="PatternItem")
+ if (tagName == QLatin1String("PAGEOBJECT") || tagName == QLatin1String("FRAMEOBJECT") || tagName == QLatin1String("PatternItem"))
doc->setMasterPageMode(false);
else
doc->setMasterPageMode(true);
}
PageItem::ItemKind itemKind = PageItem::StandardItem;
- if (tagName == "FRAMEOBJECT")
+ if (tagName == QLatin1String("FRAMEOBJECT"))
itemKind = PageItem::InlineItem;
- else if (tagName == "PatternItem")
+ else if (tagName == QLatin1String("PatternItem"))
itemKind = PageItem::PatternItem;
int pagenr = -1;
QString masterPageName = attrs.valueAsString("OnMasterPage");
- if ((!masterPageName.isEmpty()) && (tagName == "MASTEROBJECT"))
+ if ((!masterPageName.isEmpty()) && (tagName == QLatin1String("MASTEROBJECT")))
{
if (!renamedPageName.isEmpty())
masterPageName = renamedPageName;
@@ -1970,11 +1972,11 @@
PageItem* newItem = pasteItem(doc, attrs, baseDir, itemKind, pagenr);
newItem->setRedrawBounding();
- if (tagName == "MASTEROBJECT")
+ if (tagName == QLatin1String("MASTEROBJECT"))
newItem->setOwnerPage(doc->OnPage(newItem));
else
newItem->setOwnerPage(attrs.valueAsInt("OwnPage"));
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
newItem->setMasterPageName(QString());
QString tmpf = attrs.valueAsString("IFONT", doc->itemToolPrefs().textFont);
m_AvailableFonts->findFont(tmpf, doc);
@@ -1989,7 +1991,7 @@
if (newItem->isAutoText)
doc->LastAuto = newItem;
- if (tagName == "FRAMEOBJECT")
+ if (tagName == QLatin1String("FRAMEOBJECT"))
{
FrameItems.append(doc->Items->takeAt(doc->Items->indexOf(newItem)));
newItem->setLayer(doc->firstLayerID());
@@ -2017,9 +2019,9 @@
break;
if (tType != ScXmlStreamReader::StartElement)
continue;
- QStringRef tName = reader.name();
+ QStringView tName = reader.name();
ScXmlStreamAttributes tAtt = reader.scAttributes();
- if (tName == "CSTOP")
+ if (tName == QLatin1String("CSTOP"))
{
QString name = tAtt.valueAsString("NAME");
double ramp = tAtt.valueAsDouble("RAMP", 0.0);
@@ -2028,9 +2030,9 @@
newItem->fill_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
}
- if (tName == "ITEXT")
+ if (tName == QLatin1String("ITEXT"))
readItemText(newItem, tAtt, lastStyle);
- else if (tName == "para")
+ else if (tName == QLatin1String("para"))
{
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::PARSEP);
ParagraphStyle newStyle;
@@ -2039,14 +2041,14 @@
newItem->itemText.setStyle(newItem->itemText.length()-1, newStyle);
newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, lastStyle->Style);
}
- else if (tName == "trail")
+ else if (tName == QLatin1String("trail"))
{
ParagraphStyle newStyle;
// PrefsManager& prefsManager = PrefsManager::instance();
readParagraphStyle(doc, reader, newStyle);
newItem->itemText.setStyle(newItem->itemText.length(), newStyle);
}
- else if (tName == "tab")
+ else if (tName == QLatin1String("tab"))
{
CharStyle newStyle;
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::TAB);
@@ -2055,24 +2057,24 @@
lastStyle->StyleStart = newItem->itemText.length()-1;
lastStyle->Style = newStyle;
}
- else if (tName == "breakline")
+ else if (tName == QLatin1String("breakline"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::LINEBREAK);
- else if (tName == "breakcol")
+ else if (tName == QLatin1String("breakcol"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::COLBREAK);
- else if (tName == "breakframe")
+ else if (tName == QLatin1String("breakframe"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::FRAMEBREAK);
- else if (tName == "nbhyphen")
+ else if (tName == QLatin1String("nbhyphen"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::NBHYPHEN);
- else if (tName == "nbspace")
+ else if (tName == QLatin1String("nbspace"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::NBSPACE);
- else if (tName == "zwnbspace")
+ else if (tName == QLatin1String("zwnbspace"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::ZWNBSPACE);
- else if (tName == "zwspace")
+ else if (tName == QLatin1String("zwspace"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::ZWSPACE);
- else if (tName == "var")
+ else if (tName == QLatin1String("var"))
{
CharStyle newStyle;
- if (tAtt.value("name") == "pgno")
+ if (tAtt.value("name") == QLatin1String("pgno"))
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::PAGENUMBER);
else
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::PAGECOUNT);
@@ -2081,11 +2083,11 @@
lastStyle->StyleStart = newItem->itemText.length()-1;
lastStyle->Style = newStyle;
}
- if (tName == "PageItemAttributes")
+ if (tName == QLatin1String("PageItemAttributes"))
{
readPageItemAttributes(newItem, reader);
}
- if (tName == "PSDLayer")
+ if (tName == QLatin1String("PSDLayer"))
{
layerFound = true;
loadingInfo.blend = tAtt.valueAsString("Blend");
@@ -2094,14 +2096,14 @@
loadingInfo.useMask = tAtt.valueAsBool("useMask", true);
newItem->pixm.imgInfo.RequestProps.insert(tAtt.valueAsInt("Layer"), loadingInfo);
}
- if (tName == "ImageEffect")
+ if (tName == QLatin1String("ImageEffect"))
{
struct ImageEffect ef;
ef.effectParameters = tAtt.valueAsString("Param");
ef.effectCode = tAtt.valueAsInt("Code");
newItem->effectsInUse.append(ef);
}
- if (tName == "Tabs")
+ if (tName == QLatin1String("Tabs"))
{
ParagraphStyle::TabRecord tb;
tb.tabPosition = tAtt.valueAsDouble("Pos");
@@ -2110,7 +2112,7 @@
tb.tabFillChar = tbCh.isEmpty() ? QChar() : tbCh[0];
tabValues.append(tb);
}
- if (tName == "LATEX")
+ if (tName == QLatin1String("LATEX"))
{
if (newItem->isLatexFrame())
{
@@ -2198,13 +2200,13 @@
m_Doc->SnapGrid = false;
m_Doc->SnapGuides = false;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == tagName)
break;
- if (!reader.isStartElement() || reader.name() != "PatternItem")
+ if (!reader.isStartElement() || reader.name() != QLatin1String("PatternItem"))
continue;
ScXmlStreamAttributes tAtt = reader.attributes();
@@ -2345,9 +2347,9 @@
tmp2 = attrs.valueAsString("CH");
// legacy stuff:
- tmp2.replace(QRegExp("\r"), QChar(13));
- tmp2.replace(QRegExp("\n"), QChar(13));
- tmp2.replace(QRegExp("\t"), QChar(9));
+ tmp2.replace(QRegularExpression("\r"), QChar(13));
+ tmp2.replace(QRegularExpression("\n"), QChar(13));
+ tmp2.replace(QRegularExpression("\t"), QChar(9));
}
// more legacy stuff:
@@ -2538,14 +2540,14 @@
bool Scribus134Format::readPageItemAttributes(PageItem* item, ScXmlStreamReader& reader)
{
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
ObjAttrVector pageItemAttributes;
while (!reader.atEnd() && !reader.hasError())
{
reader.readNext();
if (reader.isEndElement() && reader.name() == tagName)
break;
- if (reader.isStartElement() && reader.name() == "ItemAttribute")
+ if (reader.isStartElement() && reader.name() == QLatin1String("ItemAttribute"))
{
ScXmlStreamAttributes tAtt = reader.scAttributes();
ObjectAttribute objattr;
@@ -3155,7 +3157,7 @@
bool Scribus134Format::readLatexInfo(PageItem_LatexFrame* latexitem, ScXmlStreamReader& reader)
{
ScXmlStreamAttributes attrs = reader.scAttributes();
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
latexitem->setConfigFile(attrs.valueAsString("ConfigFile"), true);
latexitem->setDpi(attrs.valueAsInt("DPI"));
@@ -3169,7 +3171,7 @@
break;
if (reader.isCharacters())
formula += reader.text().toString();
- if (reader.isStartElement() && reader.name() == "PROPERTY")
+ if (reader.isStartElement() && reader.name() == QLatin1String("PROPERTY"))
{
ScXmlStreamAttributes tAtt = reader.scAttributes();
QString name = tAtt.valueAsString("name");
@@ -3260,12 +3262,12 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
attrs = reader.scAttributes();
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
success = false;
break;
@@ -3273,18 +3275,18 @@
firstElement = false;
}
- if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
+ if (tagName == QLatin1String("COLOR") && attrs.valueAsString("NAME") != CommonStrings::None)
{
success = readColor(m_Doc->PageColors, attrs);
if (!success) break;
}
- if (tagName == "JAVA")
+ if (tagName == QLatin1String("JAVA"))
{
QString name = attrs.valueAsString("NAME");
if (!name.isEmpty())
m_Doc->JavaScripts[name] = attrs.valueAsString("SCRIPT");
}
- if (tagName == "LAYERS")
+ if (tagName == QLatin1String("LAYERS"))
{
ScLayer newLayer;
readLayers(newLayer, attrs);
@@ -3301,12 +3303,12 @@
m_Doc->Layers.append(newLayer);
}
}
- if (tagName == "Arrows")
+ if (tagName == QLatin1String("Arrows"))
{
success = readArrows(m_Doc, attrs);
if (!success) break;
}
- if (tagName == "MultiLine")
+ if (tagName == QLatin1String("MultiLine"))
{
multiLine ml;
QString mlName = attrs.valueAsString("Name");
@@ -3317,12 +3319,12 @@
mlName2 = getUniqueName(mlName2, m_Doc->docLineStyles);
m_Doc->docLineStyles.insert(mlName2, ml);
}
- if (tagName == "Pattern")
+ if (tagName == QLatin1String("Pattern"))
{
success = readPattern(m_Doc, reader, fileDir);
if (!success) break;
}
- if (tagName == "Bookmark")
+ if (tagName == QLatin1String("Bookmark"))
{
int bmElem = 0;
struct ScribusDoc::BookMa bookmark;
@@ -3330,19 +3332,19 @@
if (!success) break;
bookmarks.insert(bmElem, bookmark);
}
- if (tagName == "STYLE")
+ if (tagName == QLatin1String("STYLE"))
{
ParagraphStyle pStyle;
getStyle(pStyle, reader, nullptr, m_Doc, true);
}
- if (tagName == "CHARSTYLE")
+ if (tagName == QLatin1String("CHARSTYLE"))
{
CharStyle cstyle;
getStyle(cstyle, reader, nullptr, m_Doc, true);
}
- if (((tagName == "PAGE") || (tagName == "MASTERPAGE")) && (attrs.valueAsInt("NUM") == pageNumber))
- {
- if (Mpage && (tagName != "MASTERPAGE"))
+ if (((tagName == QLatin1String("PAGE")) || (tagName == QLatin1String("MASTERPAGE"))) && (attrs.valueAsInt("NUM") == pageNumber))
+ {
+ if (Mpage && (tagName != QLatin1String("MASTERPAGE")))
continue;
a = m_Doc->currentPage()->pageNr();
newPage = m_Doc->Pages->at(a);
@@ -3396,9 +3398,9 @@
newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto);
newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto);
}
- if ((tagName == "PAGEOBJECT") || (tagName == "MASTEROBJECT") || (tagName == "FRAMEOBJECT"))
- {
- if ((Mpage && tagName != "MASTEROBJECT") || (!Mpage && tagName == "MASTEROBJECT"))
+ if ((tagName == QLatin1String("PAGEOBJECT")) || (tagName == QLatin1String("MASTEROBJECT")) || (tagName == QLatin1String("FRAMEOBJECT")))
+ {
+ if ((Mpage && tagName != QLatin1String("MASTEROBJECT")) || (!Mpage && tagName == QLatin1String("MASTEROBJECT")))
{
// Go to end of node
reader.readToElementEnd();
@@ -3406,22 +3408,22 @@
}
if (attrs.valueAsInt("OwnPage") != pageNumber)
{
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
itemRemap[itemCount++] = -1;
- else if (tagName == "MASTEROBJECT")
+ else if (tagName == QLatin1String("MASTEROBJECT"))
itemRemapM[itemCountM++] = -1;
reader.readToElementEnd();
}
else
{
// first of linked chain?
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
{
itemRemap[itemCount++] = m_Doc->DocItems.count();
if (attrs.valueAsInt("NEXTITEM") != -1)
itemNext[m_Doc->DocItems.count()] = attrs.valueAsInt("NEXTITEM");
}
- else if (tagName == "MASTEROBJECT")
+ else if (tagName == QLatin1String("MASTEROBJECT"))
{
itemRemapM[itemCountM++] = m_Doc->MasterItems.count();
if (attrs.valueAsInt("NEXTITEM") != -1)
@@ -3436,7 +3438,7 @@
PageItem* newItem = itemInfo.item;
newItem->moveBy(-pageX + newPage->xOffset(), - pageY + newPage->yOffset());
newItem->setOwnerPage(m_Doc->currentPageNumber());
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
newItem->setMasterPageName(QString());
else if (Mpage && !renamedPageName.isEmpty())
newItem->setMasterPageName(renamedPageName);
@@ -3448,7 +3450,7 @@
TableID.insert(itemInfo.ownLink, newItem);
}
- if ((tagName == "PAGEOBJECT") && (groupStackPI.count() > 0))
+ if ((tagName == QLatin1String("PAGEOBJECT")) && (groupStackPI.count() > 0))
{
groupStackPI.top().append(itemInfo.item);
while (itemInfo.ownNr == groupStackPI2.top())
@@ -3459,7 +3461,7 @@
break;
}
}
- else if ((tagName == "FRAMEOBJECT") && (groupStackFI.count() > 0))
+ else if ((tagName == QLatin1String("FRAMEOBJECT")) && (groupStackFI.count() > 0))
{
groupStackFI.top().append(itemInfo.item);
while (itemInfo.ownNr == groupStackFI2.top())
@@ -3470,7 +3472,7 @@
break;
}
}
- else if ((tagName == "MASTEROBJECT") && (groupStackMI.count() > 0))
+ else if ((tagName == QLatin1String("MASTEROBJECT")) && (groupStackMI.count() > 0))
{
groupStackMI.top().append(itemInfo.item);
while (itemInfo.ownNr == groupStackMI2.top())
@@ -3486,12 +3488,12 @@
{
QList<PageItem*> groupItems;
groupItems.append(itemInfo.item);
- if (tagName == "PAGEOBJECT")
+ if (tagName == QLatin1String("PAGEOBJECT"))
{
groupStackPI.push(groupItems);
groupStackPI2.push(itemInfo.groupLastItem + itemInfo.ownNr);
}
- else if (tagName == "FRAMEOBJECT")
+ else if (tagName == QLatin1String("FRAMEOBJECT"))
{
groupStackFI.push(groupItems);
groupStackFI2.push(itemInfo.groupLastItem + itemInfo.ownNr);
@@ -3821,10 +3823,10 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
success = false;
break;
@@ -3832,7 +3834,7 @@
firstElement = false;
continue;
}
- if (tagName == "STYLE")
+ if (tagName == QLatin1String("STYLE"))
{
pstyle.erase();
getStyle(pstyle, reader, &docParagraphStyles, doc, false);
@@ -3861,10 +3863,10 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
success = false;
break;
@@ -3872,7 +3874,7 @@
firstElement = false;
continue;
}
- if (tagName == "CHARSTYLE")
+ if (tagName == QLatin1String("CHARSTYLE"))
{
cstyle.erase();
attrs = reader.scAttributes();
@@ -3899,10 +3901,10 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
success = false;
break;
@@ -3910,7 +3912,7 @@
firstElement = false;
continue;
}
- if (tagName == "MultiLine")
+ if (tagName == QLatin1String("MultiLine"))
{
multiLine ml;
attrs = reader.scAttributes();
@@ -3949,10 +3951,10 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
// success = false;
break;
@@ -3960,7 +3962,7 @@
firstElement = false;
continue;
}
- if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
+ if (tagName == QLatin1String("COLOR") && attrs.valueAsString("NAME") != CommonStrings::None)
{
attrs = reader.scAttributes();
if (attrs.valueAsString("NAME") != CommonStrings::None)
@@ -3991,10 +3993,10 @@
QXmlStreamReader::TokenType tType = reader.readNext();
if (tType != QXmlStreamReader::StartElement)
continue;
- QStringRef tagName = reader.name();
+ QStringView tagName = reader.name();
if (firstElement)
{
- if (tagName != "SCRIBUSUTF8NEW")
+ if (tagName != QLatin1String("SCRIBUSUTF8NEW"))
{
success = false;
break;
@@ -4002,9 +4004,9 @@
firstElement = false;
continue;
}
- if (tagName == "PAGE")
+ if (tagName == QLatin1String("PAGE"))
counter++;
- if (tagName == "MASTERPAGE")
+ if (tagName == QLatin1String("MASTERPAGE"))
{
pageName = reader.scAttributes().valueAsString("NAM");
if (!pageName.isEmpty())
Modified: trunk/Scribus/scribus/plugins/picbrowser/collection.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24850&path=/trunk/Scribus/scribus/plugins/picbrowser/collection.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/collection.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/collection.cpp Sun Jan 30 02:03:27 2022
@@ -62,16 +62,16 @@
if ( isStartElement() )
{
- if ( name() == "picturebrowser" )
+ if (name() == QLatin1String("picturebrowser"))
{
//we have a collectionsdbfile
- if ( attributes().value ( "type" ) == "collectionsset" )
+ if ( attributes().value ( "type" ) == QLatin1String("collectionsset") )
{
readCollectionsDb();
type = 1;
}
//we have a collectionfile
- else if ( attributes().value ( "type" ) == "collection" )
+ else if ( attributes().value ( "type" ) == QLatin1String("collection") )
{
collection = new imageCollection;
collection->file = xmlFile;
@@ -109,7 +109,7 @@
if ( isStartElement() )
{
- if ( name() == "category" )
+ if ( name() == QLatin1String("category") )
{
QString name = attributes().value ( "name" ).toString();
collections *tmpCollections = new collections ( name );
@@ -141,7 +141,7 @@
if ( isStartElement() )
{
- if ( name() == "image" )
+ if ( name() == QLatin1String("image") )
{
QString tmpImageFile = attributes().value ( "file" ).toString();
collection->imageFiles.append ( tmpImageFile );
@@ -170,7 +170,7 @@
if ( isStartElement() )
{
- if ( name() == "collection" )
+ if ( name() == QLatin1String("collection") )
{
readCollection();
}
@@ -207,7 +207,7 @@
if ( isStartElement() )
{
- if ( name() == "tag" )
+ if ( name() == QLatin1String("tag") )
{
//read tag here
tmpTags.append ( readElementText() );
Modified: trunk/Scribus/scribus/plugins/picbrowser/imagedialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24850&path=/trunk/Scribus/scribus/plugins/picbrowser/imagedialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/imagedialog.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/imagedialog.cpp Sun Jan 30 02:03:27 2022
@@ -9,13 +9,15 @@
#include <QApplication>
#include <QScreen>
+#include "scribuscore.h"
+
Imagedialog::Imagedialog ( const QString& imageFile, ScribusDoc* doc , QWidget *parent ) : QDialog ( parent )
{
setupUi ( this );
setAttribute ( Qt::WA_DeleteOnClose );
setWindowTitle ( imageFile );
- m_hRatio = double(ScCore->primaryMainWindow()->screen()->logicalDpiX()) / 72.0;
- m_vRatio = double(ScCore->primaryMainWindow()->screen()->logicalDpiY()) / 72.0;
+ m_hRatio = double(ScCore->primaryMainWindow()->screen()->logicalDotsPerInchX()) / 72.0;
+ m_vRatio = double(ScCore->primaryMainWindow()->screen()->logicalDotsPerInchY()) / 72.0;
//no realCMYK
bool mode=false;
More information about the scribus-commit
mailing list