r22612 by craig - clazy and clang fixes, part 10
scribus-commit
scribus-commit at lists.scribus.net
Sun Aug 5 12:37:54 UTC 2018
Author: craig
Date: Sun Aug 5 12:37:54 2018
New Revision: 22612
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22612
Log:
clazy and clang fixes, part 10
Modified:
trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.h
trunk/Scribus/scribus/plugins/fontpreview/fontpreview.cpp
trunk/Scribus/scribus/plugins/fontpreview/fontpreview.h
trunk/Scribus/scribus/plugins/fontpreview/fontpreviewplugin.cpp
trunk/Scribus/scribus/plugins/gettext/csvim/csvdia.cpp
trunk/Scribus/scribus/plugins/gettext/docim/docim.cpp
trunk/Scribus/scribus/plugins/gettext/docim/docim.h
trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp
trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.h
trunk/Scribus/scribus/plugins/gettext/sxwim/sxwdia.cpp
trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.cpp
trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.h
trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp
trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.h
trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp
trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.h
trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp
trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h
trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
trunk/Scribus/scribus/plugins/picbrowser/collection.cpp
trunk/Scribus/scribus/plugins/picbrowser/iview.cpp
trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
trunk/Scribus/scribus/plugins/picbrowser/multicombobox.cpp
trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp
trunk/Scribus/scribus/plugins/picbrowser/previewimage.cpp
trunk/Scribus/scribus/plugins/picbrowser/previewimage.h
trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
trunk/Scribus/scribus/plugins/shapes/shapepalette.cpp
Modified: trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp Sun Aug 5 12:37:54 2018
@@ -131,7 +131,7 @@
{
Q_ASSERT(filename.isEmpty());
QString fileName;
- if (doc!=0)
+ if (doc!=nullptr)
{
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("xpsex");
QString wdir = prefs->get("wdir", ".");
@@ -347,9 +347,9 @@
{
ScLayer ll;
ll.isPrintable = false;
- for (int la = 0; la < m_Doc->Layers.count(); la++)
- {
- m_Doc->Layers.levelToLayer(ll, la);
+ for (int i = 0; i < m_Doc->Layers.count(); i++)
+ {
+ m_Doc->Layers.levelToLayer(ll, i);
if (ll.isPrintable)
{
ScPage *mpage = m_Doc->MasterPages.at(m_Doc->MasterNames[Page->MPageNam]);
@@ -566,10 +566,8 @@
if (Item->GrType == 14)
processHatchFill(xOffset, yOffset, Item, parentElem, rel_root);
bool closedPath;
- if ((Item->itemType() == PageItem::Polygon) || (Item->itemType() == PageItem::RegularPolygon) || (Item->itemType() == PageItem::Arc))
- closedPath = true;
- else
- closedPath = false;
+ closedPath = ((Item->itemType() == PageItem::Polygon) || (Item->itemType() == PageItem::RegularPolygon) || (Item->itemType() == PageItem::Arc));
+
QDomElement ob = p_docu.createElement("Path");
FPointArray path = Item->PoLine.copy();
QTransform mpx;
@@ -628,7 +626,6 @@
parentElem.appendChild(grp2);
}
}
- return;
}
void XPSExPlug::processLineItem(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root)
@@ -667,7 +664,6 @@
}
parentElem.appendChild(ob);
}
- return;
}
void XPSExPlug::processImageItem(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root)
@@ -797,7 +793,6 @@
parentElem.appendChild(grp2);
}
}
- return;
}
class XPSPainter: public TextLayoutPainter
@@ -1231,7 +1226,6 @@
writeItemOnPage(embed->gXpos, embed->gYpos, embed, ob, rel_root);
}
parentElem.appendChild(ob);
- return;
}
void XPSExPlug::processTableItem(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root)
@@ -1679,7 +1673,6 @@
xpos += adv;
}
parentElem.appendChild(ob);
- return;
}
void XPSExPlug::processArrows(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root)
@@ -1785,7 +1778,6 @@
arrow.map(arrowTrans);
drawArrow(xOffset, yOffset, Item, parentElem, rel_root, arrow);
}
- return;
}
void XPSExPlug::drawArrow(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root, FPointArray &arrow)
@@ -1835,7 +1827,7 @@
}
}
-QString XPSExPlug::embedFont(const ScFace font, QDomElement &rel_root)
+QString XPSExPlug::embedFont(const ScFace& font, QDomElement &rel_root)
{
QByteArray fontData;
loadRawText(font.fontFilePath(), fontData);
@@ -2145,132 +2137,131 @@
}
return;
}
- else
- {
- if ((Item->GrType == 6) || (Item->GrType == 7))
- {
- QDomElement ob = p_docu.createElement("Path.Fill");
- QDomElement gr;
- double GrStartX = (Item->GrStartX + xOffset) * conversionFactor;
- double GrStartY = (Item->GrStartY + yOffset) * conversionFactor;
- double GrFocalX = (Item->GrFocalX + xOffset) * conversionFactor;
- double GrFocalY = (Item->GrFocalY + yOffset) * conversionFactor;
- double GrEndX = (Item->GrEndX + xOffset) * conversionFactor;
- double GrEndY = (Item->GrEndY + yOffset) * conversionFactor;
- if (Item->GrType == 6)
- {
- gr = p_docu.createElement("LinearGradientBrush");
- gr.setAttribute("MappingMode", "Absolute");
- gr.setAttribute("StartPoint", FToStr(GrStartX) + ", " + FToStr(GrStartY));
- gr.setAttribute("EndPoint", FToStr(GrEndX) + ", " + FToStr(GrEndY));
- }
- else
- {
- gr = p_docu.createElement("RadialGradientBrush");
- double rad = sqrt(pow(GrEndX - GrStartX, 2) + pow(GrEndY - GrStartY,2));
- gr.setAttribute("MappingMode", "Absolute");
- gr.setAttribute("RadiusX", FToStr(rad));
- gr.setAttribute("RadiusY", FToStr(rad));
- gr.setAttribute("Center", FToStr(GrStartX) + ", " + FToStr(GrStartY));
- gr.setAttribute("GradientOrigin", FToStr(GrFocalX) + ", " + FToStr(GrFocalY));
- }
- double gradientSkew;
- if (Item->GrSkew == 90)
- gradientSkew = 1;
- else if (Item->GrSkew == 180)
- gradientSkew = 0;
- else if (Item->GrSkew == 270)
- gradientSkew = -1;
- else if (Item->GrSkew == 390)
- gradientSkew = 0;
- else
- gradientSkew = tan(M_PI / 180.0 * Item->GrSkew);
- QTransform qmatrix;
- if (Item->GrType == 6)
- {
- qmatrix.translate(GrStartX, GrStartY);
- qmatrix.shear(-gradientSkew, 0);
- qmatrix.translate(-GrStartX, -GrStartY);
- }
- else
- {
- double rotEnd = xy2Deg(GrEndX - GrStartX, GrEndY - GrStartY);
- qmatrix.translate(GrStartX, GrStartY);
- qmatrix.rotate(rotEnd);
- qmatrix.shear(gradientSkew, 0);
- qmatrix.translate(0, GrStartY * (1.0 - Item->GrScale));
- qmatrix.translate(-GrStartX, -GrStartY);
- qmatrix.scale(1, Item->GrScale);
- }
- gr.setAttribute("Transform", MatrixToStr(qmatrix));
- if ((Item->fillTransparency() != 0) && ((withTransparency) || (Item->GrMask == 0)))
- gr.setAttribute("Opacity", FToStr(1.0 - Item->fillTransparency()));
- QDomElement grs;
- if (Item->GrType == 6)
- grs = p_docu.createElement("LinearGradientBrush.GradientStops");
- else
- grs = p_docu.createElement("RadialGradientBrush.GradientStops");
- bool isFirst = true;
- double actualStop = 0.0, lastStop = 0.0;
- QList<VColorStop*> cstops = Item->fill_gradient.colorStops();
- for (int cst = 0; cst < Item->fill_gradient.Stops(); ++cst)
- {
- actualStop = cstops.at(cst)->rampPoint;
- if ((actualStop != lastStop) || (isFirst))
- {
- QDomElement itcl = p_docu.createElement("GradientStop");
- itcl.setAttribute("Offset", FToStr(cstops.at(cst)->rampPoint));
- itcl.setAttribute("Color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade, 1.0 - cstops.at(cst)->opacity));
- grs.appendChild(itcl);
- lastStop = actualStop;
- isFirst = false;
- }
- }
- gr.appendChild(grs);
- ob.appendChild(gr);
- parentElem.appendChild(ob);
- }
- else if (Item->GrType == 8)
- {
- ScPattern pa = m_Doc->docPatterns[Item->pattern()];
- QDomElement ob = p_docu.createElement("Path.Fill");
- QDomElement gr = p_docu.createElement("VisualBrush");
- gr.setAttribute("TileMode", "Tile");
- gr.setAttribute("ViewboxUnits", "Absolute");
- gr.setAttribute("ViewportUnits", "Absolute");
- gr.setAttribute("Viewbox", QString("0, 0, %1, %2").arg(pa.width * conversionFactor).arg(pa.height * conversionFactor));
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- Item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
- patternScaleX /= 100.0;
- patternScaleY /= 100.0;
- gr.setAttribute("Viewport", QString("%1, %2, %3, %4").arg((xOffset + patternOffsetX) * conversionFactor).arg((yOffset + patternOffsetY) * conversionFactor).arg((pa.width * patternScaleX) * conversionFactor).arg((pa.height * patternScaleY) * conversionFactor));
- bool mirrorX, mirrorY;
- Item->patternFlip(mirrorX, mirrorY);
- if ((patternRotation != 0) || (patternSkewX != 0) || (patternSkewY != 0) || mirrorX || mirrorY)
- {
- QTransform mpa;
- mpa.rotate(patternRotation);
- mpa.shear(-patternSkewX, patternSkewY);
- mpa.scale(pa.scaleX, pa.scaleY);
- if (mirrorX)
- mpa.scale(-1, 1);
- if (mirrorY)
- mpa.scale(1, -1);
- gr.setAttribute("Transform", MatrixToStr(mpa));
- }
- if ((Item->fillTransparency() != 0) && ((withTransparency) || (Item->GrMask == 0)))
- gr.setAttribute("Opacity", FToStr(1.0 - Item->fillTransparency()));
- QDomElement grp = p_docu.createElement("VisualBrush.Visual");
- for (int em = 0; em < pa.items.count(); ++em)
- {
- PageItem* embed = pa.items.at(em);
- writeItemOnPage(embed->gXpos, embed->gYpos, embed, grp, rel_root);
- }
- gr.appendChild(grp);
- ob.appendChild(gr);
- parentElem.appendChild(ob);
- }
- }
+
+ if ((Item->GrType == 6) || (Item->GrType == 7))
+ {
+ QDomElement ob = p_docu.createElement("Path.Fill");
+ QDomElement gr;
+ double GrStartX = (Item->GrStartX + xOffset) * conversionFactor;
+ double GrStartY = (Item->GrStartY + yOffset) * conversionFactor;
+ double GrFocalX = (Item->GrFocalX + xOffset) * conversionFactor;
+ double GrFocalY = (Item->GrFocalY + yOffset) * conversionFactor;
+ double GrEndX = (Item->GrEndX + xOffset) * conversionFactor;
+ double GrEndY = (Item->GrEndY + yOffset) * conversionFactor;
+ if (Item->GrType == 6)
+ {
+ gr = p_docu.createElement("LinearGradientBrush");
+ gr.setAttribute("MappingMode", "Absolute");
+ gr.setAttribute("StartPoint", FToStr(GrStartX) + ", " + FToStr(GrStartY));
+ gr.setAttribute("EndPoint", FToStr(GrEndX) + ", " + FToStr(GrEndY));
+ }
+ else
+ {
+ gr = p_docu.createElement("RadialGradientBrush");
+ double rad = sqrt(pow(GrEndX - GrStartX, 2) + pow(GrEndY - GrStartY,2));
+ gr.setAttribute("MappingMode", "Absolute");
+ gr.setAttribute("RadiusX", FToStr(rad));
+ gr.setAttribute("RadiusY", FToStr(rad));
+ gr.setAttribute("Center", FToStr(GrStartX) + ", " + FToStr(GrStartY));
+ gr.setAttribute("GradientOrigin", FToStr(GrFocalX) + ", " + FToStr(GrFocalY));
+ }
+ double gradientSkew;
+ if (Item->GrSkew == 90)
+ gradientSkew = 1;
+ else if (Item->GrSkew == 180)
+ gradientSkew = 0;
+ else if (Item->GrSkew == 270)
+ gradientSkew = -1;
+ else if (Item->GrSkew == 390)
+ gradientSkew = 0;
+ else
+ gradientSkew = tan(M_PI / 180.0 * Item->GrSkew);
+ QTransform qmatrix;
+ if (Item->GrType == 6)
+ {
+ qmatrix.translate(GrStartX, GrStartY);
+ qmatrix.shear(-gradientSkew, 0);
+ qmatrix.translate(-GrStartX, -GrStartY);
+ }
+ else
+ {
+ double rotEnd = xy2Deg(GrEndX - GrStartX, GrEndY - GrStartY);
+ qmatrix.translate(GrStartX, GrStartY);
+ qmatrix.rotate(rotEnd);
+ qmatrix.shear(gradientSkew, 0);
+ qmatrix.translate(0, GrStartY * (1.0 - Item->GrScale));
+ qmatrix.translate(-GrStartX, -GrStartY);
+ qmatrix.scale(1, Item->GrScale);
+ }
+ gr.setAttribute("Transform", MatrixToStr(qmatrix));
+ if ((Item->fillTransparency() != 0) && ((withTransparency) || (Item->GrMask == 0)))
+ gr.setAttribute("Opacity", FToStr(1.0 - Item->fillTransparency()));
+ QDomElement grs;
+ if (Item->GrType == 6)
+ grs = p_docu.createElement("LinearGradientBrush.GradientStops");
+ else
+ grs = p_docu.createElement("RadialGradientBrush.GradientStops");
+ bool isFirst = true;
+ double actualStop = 0.0, lastStop = 0.0;
+ QList<VColorStop*> cstops = Item->fill_gradient.colorStops();
+ for (int cst = 0; cst < Item->fill_gradient.Stops(); ++cst)
+ {
+ actualStop = cstops.at(cst)->rampPoint;
+ if ((actualStop != lastStop) || (isFirst))
+ {
+ QDomElement itcl = p_docu.createElement("GradientStop");
+ itcl.setAttribute("Offset", FToStr(cstops.at(cst)->rampPoint));
+ itcl.setAttribute("Color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade, 1.0 - cstops.at(cst)->opacity));
+ grs.appendChild(itcl);
+ lastStop = actualStop;
+ isFirst = false;
+ }
+ }
+ gr.appendChild(grs);
+ ob.appendChild(gr);
+ parentElem.appendChild(ob);
+ }
+ else if (Item->GrType == 8)
+ {
+ ScPattern pa = m_Doc->docPatterns[Item->pattern()];
+ QDomElement ob = p_docu.createElement("Path.Fill");
+ QDomElement gr = p_docu.createElement("VisualBrush");
+ gr.setAttribute("TileMode", "Tile");
+ gr.setAttribute("ViewboxUnits", "Absolute");
+ gr.setAttribute("ViewportUnits", "Absolute");
+ gr.setAttribute("Viewbox", QString("0, 0, %1, %2").arg(pa.width * conversionFactor).arg(pa.height * conversionFactor));
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+ Item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ patternScaleX /= 100.0;
+ patternScaleY /= 100.0;
+ gr.setAttribute("Viewport", QString("%1, %2, %3, %4").arg((xOffset + patternOffsetX) * conversionFactor).arg((yOffset + patternOffsetY) * conversionFactor).arg((pa.width * patternScaleX) * conversionFactor).arg((pa.height * patternScaleY) * conversionFactor));
+ bool mirrorX, mirrorY;
+ Item->patternFlip(mirrorX, mirrorY);
+ if ((patternRotation != 0) || (patternSkewX != 0) || (patternSkewY != 0) || mirrorX || mirrorY)
+ {
+ QTransform mpa;
+ mpa.rotate(patternRotation);
+ mpa.shear(-patternSkewX, patternSkewY);
+ mpa.scale(pa.scaleX, pa.scaleY);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
+ gr.setAttribute("Transform", MatrixToStr(mpa));
+ }
+ if ((Item->fillTransparency() != 0) && ((withTransparency) || (Item->GrMask == 0)))
+ gr.setAttribute("Opacity", FToStr(1.0 - Item->fillTransparency()));
+ QDomElement grp = p_docu.createElement("VisualBrush.Visual");
+ for (int em = 0; em < pa.items.count(); ++em)
+ {
+ PageItem* embed = pa.items.at(em);
+ writeItemOnPage(embed->gXpos, embed->gYpos, embed, grp, rel_root);
+ }
+ gr.appendChild(grp);
+ ob.appendChild(gr);
+ parentElem.appendChild(ob);
+ }
+
}
void XPSExPlug::handleMask(int type, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root, double xOffset, double yOffset)
@@ -2311,7 +2302,7 @@
double gradientSkew;
if (Item->GrMaskSkew == 90)
gradientSkew = 1;
- else if (Item->GrMaskSkew == 180)
+ else if (Item->GrMaskSkew == 180)
gradientSkew = 0;
else if (Item->GrMaskSkew == 270)
gradientSkew = -1;
@@ -2400,7 +2391,7 @@
parentElem.appendChild(ob);
}
-QString XPSExPlug::SetColor(QString farbe, int shad, double transparency)
+QString XPSExPlug::SetColor(const QString& farbe, int shad, double transparency)
{
if (farbe == CommonStrings::None)
return "#00FFFFFF";
Modified: trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.h (original)
+++ trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.h Sun Aug 5 12:37:54 2018
@@ -89,12 +89,12 @@
void processSymbolStroke(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root);
void processArrows(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root);
void drawArrow(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root, FPointArray &arrow);
- QString embedFont(const ScFace font, QDomElement &rel_root);
+ QString embedFont(const ScFace& font, QDomElement &rel_root);
void GetMultiStroke(struct SingleLine *sl, QDomElement &parentElem);
void getStrokeStyle(PageItem *Item, QDomElement &parentElem, QDomElement &rel_root, double xOffset, double yOffset, bool forArrow = false);
void getFillStyle(PageItem *Item, QDomElement &parentElem, QDomElement &rel_root, double xOffset, double yOffset, bool withTransparency = true);
void handleMask(int type, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root, double xOffset, double yOffset);
- QString SetColor(QString farbe, int shad, double transparency);
+ QString SetColor(const QString& farbe, int shad, double transparency);
void SetClipAttr(QDomElement &elem, FPointArray *ite, bool fillRule);
QString SetClipPath(FPointArray *ite, bool closed);
void writeDocRels();
Modified: trunk/Scribus/scribus/plugins/fontpreview/fontpreview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/fontpreview/fontpreview.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fontpreview/fontpreview.cpp (original)
+++ trunk/Scribus/scribus/plugins/fontpreview/fontpreview.cpp Sun Aug 5 12:37:54 2018
@@ -18,8 +18,8 @@
#include "iconmanager.h"
-FontPreview::FontPreview(QString fontName, QWidget* parent, ScribusDoc* doc)
- : QDialog(parent, 0)
+FontPreview::FontPreview(const QString& fontName, QWidget* parent, ScribusDoc* doc)
+ : QDialog(parent, nullptr)
{
setupUi(this);
setModal(true);
@@ -66,7 +66,7 @@
searchName = fontName;
else
{
- Q_ASSERT(m_Doc!=0);
+ Q_ASSERT(m_Doc!=nullptr);
if (m_Doc->m_Selection->count() != 0)
searchName = m_Doc->currentStyle.charStyle().font().scName();
else
@@ -76,7 +76,7 @@
Qt::DisplayRole, searchName,
1,
Qt::MatchContains | Qt::MatchWrap);
- if (found.size() > 0)
+ if (!found.empty())
{
fontList->scrollTo(found.at(0), QAbstractItemView::PositionAtCenter);
fontList->selectRow(found.at(0).row());
Modified: trunk/Scribus/scribus/plugins/fontpreview/fontpreview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/fontpreview/fontpreview.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fontpreview/fontpreview.h (original)
+++ trunk/Scribus/scribus/plugins/fontpreview/fontpreview.h Sun Aug 5 12:37:54 2018
@@ -30,7 +30,7 @@
/*! \brief Create Font Preview window,
\param fontName Optional name of the font to init/select on start.
*/
- FontPreview(QString fontName = QString::null, QWidget* parent = 0, ScribusDoc* doc=0);
+ FontPreview(const QString& fontName = QString::null, QWidget* parent = 0, ScribusDoc* doc=0);
~FontPreview();
/*! \brief Get the current selected font name.
Modified: trunk/Scribus/scribus/plugins/fontpreview/fontpreviewplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/fontpreview/fontpreviewplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fontpreview/fontpreviewplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/fontpreview/fontpreviewplugin.cpp Sun Aug 5 12:37:54 2018
@@ -84,7 +84,7 @@
*/
bool FontPreviewPlugin::run(ScribusDoc* doc, QString target)
{
- ScribusMainWindow* scmw=(doc==0)?ScCore->primaryMainWindow():doc->scMW();
+ ScribusMainWindow* scmw=(doc==nullptr)?ScCore->primaryMainWindow():doc->scMW();
return run(scmw, doc, target);
}
Modified: trunk/Scribus/scribus/plugins/gettext/csvim/csvdia.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/csvim/csvdia.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/csvim/csvdia.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/csvim/csvdia.cpp Sun Aug 5 12:37:54 2018
@@ -21,7 +21,7 @@
#include "iconmanager.h"
-CsvDialog::CsvDialog() : QDialog(0)
+CsvDialog::CsvDialog() : QDialog(nullptr)
{
setModal(true);
setWindowTitle( tr("CSV Importer Options"));
Modified: trunk/Scribus/scribus/plugins/gettext/docim/docim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/docim/docim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/docim/docim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/docim/docim.cpp Sun Aug 5 12:37:54 2018
@@ -51,19 +51,17 @@
{
if (hasAntiword())
return QObject::tr("Word Documents");
- else
- return QString::null;
+ return QString::null;
}
QStringList FileExtensions()
{
if (hasAntiword())
return QStringList("doc");
- else
- return QStringList();
+ return QStringList();
}
-void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer)
+void GetText(const QString& filename, const QString& encoding, bool textOnly, gtWriter *writer)
{
if (!hasAntiword())
return;
@@ -76,7 +74,7 @@
delete dim;
}
-DocIm::DocIm(const QString& fname, const QString& enc, bool textO, gtWriter *w) : QObject(), textBuffer(this), errorBuffer(this)
+DocIm::DocIm(const QString& fname, const QString& enc, bool textO, gtWriter *w) : textBuffer(this), errorBuffer(this)
{
filename = fname;
encoding = enc;
@@ -162,7 +160,7 @@
void DocIm::write()
{
- QTextCodec *codec = 0;
+ QTextCodec *codec = nullptr;
#if defined(Q_OS_WIN32)
// #10258 : use UTF-8 whenever possible
@@ -177,10 +175,10 @@
if (failed)
{
- QString error = codec->toUnicode( errorBuffer.data() );
- ScMessageBox::information(0, tr("Importing failed"),
- tr("Importing Word document failed \n%1").arg(error),
- QMessageBox::Ok);
+ QString error = codec->toUnicode( errorBuffer.data() );
+ ScMessageBox::information(nullptr, tr("Importing failed"),
+ tr("Importing Word document failed \n%1").arg(error),
+ QMessageBox::Ok);
return;
}
Modified: trunk/Scribus/scribus/plugins/gettext/docim/docim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/docim/docim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/docim/docim.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/docim/docim.h Sun Aug 5 12:37:54 2018
@@ -17,7 +17,7 @@
class gtWriter;
class QProcess;
-extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer);
+extern "C" PLUGIN_API void GetText(const QString& filename, const QString& encoding, bool textOnly, gtWriter *writer);
/*! \brief Returns the string with importer description.
\retval QString a string or QString::null when the plugin should not be loaded.
Modified: trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&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 Sun Aug 5 12:37:54 2018
@@ -675,22 +675,17 @@
if (it.current().family().toLower() == fontName.toLower())
{
if (it.currentKey().toLower() == fontName.toLower()) // exact Match
- {
return fontName;
- }
- else
- {
- QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
- if (slist.count() > 0)
- {
- slist.sort();
- int reInd = slist.indexOf("Regular");
- if (reInd < 0)
- fontName = it.current().family() + " " + slist[0];
- else
- fontName = it.current().family() + " " + slist[reInd];
- return fontName;
- }
+ QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
+ if (slist.count() > 0)
+ {
+ slist.sort();
+ int reInd = slist.indexOf("Regular");
+ if (reInd < 0)
+ fontName = it.current().family() + " " + slist[0];
+ else
+ fontName = it.current().family() + " " + slist[reInd];
+ return fontName;
}
}
}
@@ -698,7 +693,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont dia(0, fontName, m_Doc);
+ MissingFont dia(nullptr, fontName, m_Doc);
static_cast<void>(dia.exec());
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = dia.getReplacementFont();
Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&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 Sun Aug 5 12:37:54 2018
@@ -1354,11 +1354,8 @@
fontName = it.current().family() + " " + slist[reInd];
return fontName;
}
- else
- {
- fontName = it.current().family();
- return fontName;
- }
+ fontName = it.current().family();
+ return fontName;
}
// Still no font found
@@ -1372,7 +1369,7 @@
}
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- QScopedPointer<MissingFont> dia(new MissingFont(0, family, m_Doc));
+ QScopedPointer<MissingFont> dia(new MissingFont(nullptr, family, m_Doc));
if (dia->exec())
fontName = dia->getReplacementFont();
else
Modified: trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp Sun Aug 5 12:37:54 2018
@@ -69,8 +69,7 @@
PdbIm::~PdbIm()
{
- if (m_buf)
- delete m_buf;
+ delete m_buf;
}
void PdbIm::write()
@@ -189,16 +188,14 @@
{
if (m_littlendian)
return (r >> 8) | (r << 8);
- else
- return r;
+ return r;
}
DWord PdbIm::swap_DWord( DWord r )
{
if (m_littlendian)
return ( (r >> 24) & 0x00FF ) | (r << 24) | ( (r >> 8) & 0xFF00 ) | ( (r << 8) & 0xFF0000 );
- else
- return r;
+ return r;
}
void PdbIm::uncompress( buffer *m_buf )
Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/contentreader.cpp Sun Aug 5 12:37:54 2018
@@ -211,7 +211,7 @@
--append;
if (inList || inNote || inNoteBody)
{
- if (styleNames.size() != 0)
+ if (!styleNames.empty())
styleNames.pop_back();
}
else
@@ -221,7 +221,7 @@
{
inSpan = false;
currentStyle = pstyle;
- if (styleNames.size() != 0)
+ if (!styleNames.empty())
styleNames.pop_back();
currentStyle = sreader->getStyle(getName());
}
@@ -357,7 +357,7 @@
void ContentReader::getStyle()
{
gtStyle *style = nullptr, *tmp = nullptr;
- if (styleNames.size() == 0)
+ if (styleNames.empty())
style = sreader->getStyle("default-style");
else
style = sreader->getStyle(styleNames[0]);
Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp Sun Aug 5 12:37:54 2018
@@ -37,11 +37,10 @@
extern xmlSAXHandlerPtr sSAXHandler;
-StyleReader::StyleReader(QString documentName, gtWriter *w,
- bool textOnly, bool prefix, bool combineStyles)
+StyleReader::StyleReader(const QString& documentName, gtWriter *w, bool textOnly, bool prefix, bool combineStyles)
{
sreader = this;
- docname = documentName;
+ docname = documentName;
readProperties = false;
writer = w;
importTextOnly = textOnly;
@@ -185,125 +184,125 @@
void StyleReader::styleProperties(const QXmlAttributes& attrs)
{
- if ((currentStyle == nullptr) || (!readProperties))
- return;
- gtParagraphStyle* pstyle = nullptr;
- if (currentStyle->target() == "paragraph")
- pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
- else
- pstyle = nullptr;
- QString align;
- QString force;
- bool hasColorTag = false;
- for (int i = 0; i < attrs.count(); ++i)
- {
- if ((attrs.localName(i) == "style:font-name") && (!inList))
- currentStyle->getFont()->setName(getFont(attrs.value(i)));
- else if (attrs.localName(i) == "fo:font-size")
- {
- double size = 0.0;
- double psize = 0.0;
- if (parentStyle != nullptr)
- psize = static_cast<double>(parentStyle->getFont()->getSize());
- else if (styles.contains("default-style"))
- psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
-
- psize = psize / 10;
- size = getSize(attrs.value(i), psize);
- int nsize = static_cast<int>(size * 10);
- currentStyle->getFont()->setSize(nsize);
- if (pstyle)
- pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
- }
- else if ((attrs.localName(i) == "fo:line-height") && (parentStyle != nullptr))
- {
- gtParagraphStyle* ppstyle;
- if (parentStyle->target() == "paragraph")
- {
- ppstyle = dynamic_cast<gtParagraphStyle*>(parentStyle);
- assert(ppstyle != nullptr);
- ppstyle->setLineSpacing(getSize(attrs.value(i), writer->getPreferredLineSpacing(currentStyle->getFont()->getSize())));
- }
- }
- else if (attrs.localName(i) == "fo:color")
- {
- currentStyle->getFont()->setColor(attrs.value(i));
- hasColorTag = true;
- }
- else if ((attrs.localName(i) == "style:use-window-font-color") && (attrs.value(i) == "true"))
- {
- currentStyle->getFont()->setColor("Black");
- hasColorTag = true;
- }
- else if ((attrs.localName(i) == "fo:font-weight") && (attrs.value(i) == "bold"))
- currentStyle->getFont()->setWeight(BOLD);
- else if ((attrs.localName(i) == "fo:font-style") && (attrs.value(i) == "italic"))
- currentStyle->getFont()->setSlant(ITALIC);
- else if ((attrs.localName(i) == "style:text-underline") && (attrs.value(i) != "none"))
- currentStyle->getFont()->toggleEffect(UNDERLINE);
- else if ((attrs.localName(i) == "style:text-crossing-out") && (attrs.value(i) != "none"))
- currentStyle->getFont()->toggleEffect(STRIKETHROUGH);
- else if ((attrs.localName(i) == "fo:font-variant") && (attrs.value(i) == "small-caps"))
- currentStyle->getFont()->toggleEffect(SMALL_CAPS);
- else if ((attrs.localName(i) == "style:text-outline") && (attrs.value(i) == "true"))
- {
- currentStyle->getFont()->toggleEffect(OUTLINE);
- currentStyle->getFont()->setStrokeColor("Black");
- currentStyle->getFont()->setColor("White");
- }
- else if (attrs.localName(i) == "fo:letter-spacing")
- currentStyle->getFont()->setKerning(static_cast<int>(getSize(attrs.value(i), -1.0)));
- else if (attrs.localName(i) == "style:text-scale")
- currentStyle->getFont()->setHscale(static_cast<int>(getSize(attrs.value(i), -1.0)));
- else if ((attrs.localName(i) == "style:text-position") &&
- (((attrs.value(i)).indexOf("sub") != -1) ||
- (((attrs.value(i)).left(1) == "-") && ((attrs.value(i)).left(1) != "0"))))
- currentStyle->getFont()->toggleEffect(SUBSCRIPT);
- else if ((attrs.localName(i) == "style:text-position") &&
- (((attrs.value(i)).indexOf("super") != -1) ||
- (((attrs.value(i)).left(1) != "-") && ((attrs.value(i)).left(1) != "0"))))
- currentStyle->getFont()->toggleEffect(SUPERSCRIPT);
- else if ((attrs.localName(i) == "fo:margin-top") && (pstyle != nullptr))
- pstyle->setSpaceAbove(getSize(attrs.value(i)));
- else if ((attrs.localName(i) == "fo:margin-bottom") && (pstyle != nullptr))
- pstyle->setSpaceBelow(getSize(attrs.value(i)));
- else if ((attrs.localName(i) == "fo:margin-left") && (pstyle != nullptr))
- {
- if (inList)
- pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
- else
- pstyle->setIndent(getSize(attrs.value(i)));
- }
- else if ((attrs.localName(i) == "text:space-before") && (pstyle != nullptr))
- {
- if (inList)
- pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
- else
- pstyle->setIndent(getSize(attrs.value(i)));
- }
- else if ((attrs.localName(i) == "fo:text-indent") && (pstyle != nullptr))
- pstyle->setFirstLineIndent(getSize(attrs.value(i)));
- else if ((attrs.localName(i) == "fo:text-align") && (pstyle != nullptr))
- align = attrs.value(i);
- else if ((attrs.localName(i) == "style:justify-single-word") && (pstyle != nullptr))
- force = attrs.value(i);
- }
- if (!align.isEmpty() && (pstyle != nullptr))
- {
- if (align == "end")
- pstyle->setAlignment(RIGHT);
- else if (align == "center")
- pstyle->setAlignment(CENTER);
- else if (align == "justify")
- {
- if (force == "false")
- pstyle->setAlignment(BLOCK);
- else
- pstyle->setAlignment(FORCED);
- }
- }
- if (!hasColorTag)
- currentStyle->getFont()->setColor("Black");
+ if ((currentStyle == nullptr) || (!readProperties))
+ return;
+ gtParagraphStyle* pstyle = nullptr;
+ if (currentStyle->target() == "paragraph")
+ pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
+ else
+ pstyle = nullptr;
+ QString align;
+ QString force;
+ bool hasColorTag = false;
+ for (int i = 0; i < attrs.count(); ++i)
+ {
+ if ((attrs.localName(i) == "style:font-name") && (!inList))
+ currentStyle->getFont()->setName(getFont(attrs.value(i)));
+ else if (attrs.localName(i) == "fo:font-size")
+ {
+ double size = 0.0;
+ double psize = 0.0;
+ if (parentStyle != nullptr)
+ psize = static_cast<double>(parentStyle->getFont()->getSize());
+ else if (styles.contains("default-style"))
+ psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
+
+ psize = psize / 10;
+ size = getSize(attrs.value(i), psize);
+ int nsize = static_cast<int>(size * 10);
+ currentStyle->getFont()->setSize(nsize);
+ if (pstyle)
+ pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
+ }
+ else if ((attrs.localName(i) == "fo:line-height") && (parentStyle != nullptr))
+ {
+ gtParagraphStyle* ppstyle;
+ if (parentStyle->target() == "paragraph")
+ {
+ ppstyle = dynamic_cast<gtParagraphStyle*>(parentStyle);
+ assert(ppstyle != nullptr);
+ ppstyle->setLineSpacing(getSize(attrs.value(i), writer->getPreferredLineSpacing(currentStyle->getFont()->getSize())));
+ }
+ }
+ else if (attrs.localName(i) == "fo:color")
+ {
+ currentStyle->getFont()->setColor(attrs.value(i));
+ hasColorTag = true;
+ }
+ else if ((attrs.localName(i) == "style:use-window-font-color") && (attrs.value(i) == "true"))
+ {
+ currentStyle->getFont()->setColor("Black");
+ hasColorTag = true;
+ }
+ else if ((attrs.localName(i) == "fo:font-weight") && (attrs.value(i) == "bold"))
+ currentStyle->getFont()->setWeight(BOLD);
+ else if ((attrs.localName(i) == "fo:font-style") && (attrs.value(i) == "italic"))
+ currentStyle->getFont()->setSlant(ITALIC);
+ else if ((attrs.localName(i) == "style:text-underline") && (attrs.value(i) != "none"))
+ currentStyle->getFont()->toggleEffect(UNDERLINE);
+ else if ((attrs.localName(i) == "style:text-crossing-out") && (attrs.value(i) != "none"))
+ currentStyle->getFont()->toggleEffect(STRIKETHROUGH);
+ else if ((attrs.localName(i) == "fo:font-variant") && (attrs.value(i) == "small-caps"))
+ currentStyle->getFont()->toggleEffect(SMALL_CAPS);
+ else if ((attrs.localName(i) == "style:text-outline") && (attrs.value(i) == "true"))
+ {
+ currentStyle->getFont()->toggleEffect(OUTLINE);
+ currentStyle->getFont()->setStrokeColor("Black");
+ currentStyle->getFont()->setColor("White");
+ }
+ else if (attrs.localName(i) == "fo:letter-spacing")
+ currentStyle->getFont()->setKerning(static_cast<int>(getSize(attrs.value(i), -1.0)));
+ else if (attrs.localName(i) == "style:text-scale")
+ currentStyle->getFont()->setHscale(static_cast<int>(getSize(attrs.value(i), -1.0)));
+ else if ((attrs.localName(i) == "style:text-position") &&
+ (((attrs.value(i)).indexOf("sub") != -1) ||
+ (((attrs.value(i)).left(1) == "-") && ((attrs.value(i)).left(1) != "0"))))
+ currentStyle->getFont()->toggleEffect(SUBSCRIPT);
+ else if ((attrs.localName(i) == "style:text-position") &&
+ (((attrs.value(i)).indexOf("super") != -1) ||
+ (((attrs.value(i)).left(1) != "-") && ((attrs.value(i)).left(1) != "0"))))
+ currentStyle->getFont()->toggleEffect(SUPERSCRIPT);
+ else if ((attrs.localName(i) == "fo:margin-top") && (pstyle != nullptr))
+ pstyle->setSpaceAbove(getSize(attrs.value(i)));
+ else if ((attrs.localName(i) == "fo:margin-bottom") && (pstyle != nullptr))
+ pstyle->setSpaceBelow(getSize(attrs.value(i)));
+ else if ((attrs.localName(i) == "fo:margin-left") && (pstyle != nullptr))
+ {
+ if (inList)
+ pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
+ else
+ pstyle->setIndent(getSize(attrs.value(i)));
+ }
+ else if ((attrs.localName(i) == "text:space-before") && (pstyle != nullptr))
+ {
+ if (inList)
+ pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
+ else
+ pstyle->setIndent(getSize(attrs.value(i)));
+ }
+ else if ((attrs.localName(i) == "fo:text-indent") && (pstyle != nullptr))
+ pstyle->setFirstLineIndent(getSize(attrs.value(i)));
+ else if ((attrs.localName(i) == "fo:text-align") && (pstyle != nullptr))
+ align = attrs.value(i);
+ else if ((attrs.localName(i) == "style:justify-single-word") && (pstyle != nullptr))
+ force = attrs.value(i);
+ }
+ if (!align.isEmpty() && (pstyle != nullptr))
+ {
+ if (align == "end")
+ pstyle->setAlignment(RIGHT);
+ else if (align == "center")
+ pstyle->setAlignment(CENTER);
+ else if (align == "justify")
+ {
+ if (force == "false")
+ pstyle->setAlignment(BLOCK);
+ else
+ pstyle->setAlignment(FORCED);
+ }
+ }
+ if (!hasColorTag)
+ currentStyle->getFont()->setColor("Black");
}
void StyleReader::styleStyle(const QXmlAttributes& attrs)
@@ -501,8 +500,7 @@
return tmp;
}
- else
- return getDefaultStyle();
+ return getDefaultStyle();
}
void StyleReader::setStyle(const QString& name, gtStyle* style)
@@ -560,8 +558,7 @@
{
if (fonts.contains(key))
return fonts[key];
- else
- return key;
+ return key;
}
void StyleReader::setupFrameStyle()
@@ -588,117 +585,117 @@
bool StyleReader::updateStyle(gtStyle* style, gtStyle* parent2Style, const QString& key, const QString& value)
{
- gtParagraphStyle* pstyle = nullptr;
- if (style->target() == "paragraph")
- pstyle = dynamic_cast<gtParagraphStyle*>(style);
- else
- pstyle = nullptr;
- QString align;
- QString force;
-
- if (key == "style:font-name")
- style->getFont()->setName(getFont(value));
- else if (key == "fo:font-size")
- {
- double size = 0;
- double psize = 0;
- if (parent2Style != nullptr)
- psize = static_cast<double>(parent2Style->getFont()->getSize());
- else if (styles.contains("default-style"))
- psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
- psize = psize / 10;
- size = getSize(value, psize);
- int nsize = static_cast<int>(size * 10);
- style->getFont()->setSize(nsize);
- if (pstyle)
- pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
- }
- else if ((key == "fo:line-height") && (parent2Style != nullptr))
- {
- gtParagraphStyle* ppstyle;
- if (parent2Style->target() == "paragraph")
- {
- ppstyle = dynamic_cast<gtParagraphStyle*>(parent2Style);
- assert(ppstyle != nullptr);
- ppstyle->setLineSpacing(getSize(value, writer->getPreferredLineSpacing(style->getFont()->getSize())));
- }
- }
- else if (key == "fo:color")
- style->getFont()->setColor(value);
- else if ((key == "style:use-window-font-color") && (value == "true"))
- style->getFont()->setColor("Black");
- else if ((key == "fo:font-weight") && (value == "bold"))
- style->getFont()->setWeight(BOLD);
- else if ((key == "fo:font-style") && (value == "italic"))
- style->getFont()->setSlant(ITALIC);
- else if ((key == "style:text-underline") && (value != "none"))
- style->getFont()->toggleEffect(UNDERLINE);
- else if ((key == "style:text-crossing-out") && (value != "none"))
- style->getFont()->toggleEffect(STRIKETHROUGH);
- else if ((key == "fo:font-variant") && (value == "small-caps"))
- style->getFont()->toggleEffect(SMALL_CAPS);
- else if ((key == "style:text-outline") && (value == "true"))
- {
- style->getFont()->toggleEffect(OUTLINE);
- style->getFont()->setStrokeColor("Black");
- style->getFont()->setColor("White");
- }
- else if (key == "fo:letter-spacing")
- style->getFont()->setKerning(static_cast<int>(getSize(value, -1.0)));
- else if (key == "style:text-scale")
- style->getFont()->setHscale(static_cast<int>(getSize(value, -1.0)));
- else if ((key == "style:text-position") &&
- (((value).indexOf("sub") != -1) ||
- (((value).left(1) == "-") && ((value).left(1) != "0"))))
- style->getFont()->toggleEffect(SUBSCRIPT);
- else if ((key == "style:text-position") &&
- (((value).indexOf("super") != -1) ||
- (((value).left(1) != "-") && ((value).left(1) != "0"))))
- style->getFont()->toggleEffect(SUPERSCRIPT);
- else if ((key == "fo:margin-top") && (pstyle != nullptr))
- pstyle->setSpaceAbove(getSize(value));
- else if ((key == "fo:margin-bottom") && (pstyle != nullptr))
- pstyle->setSpaceBelow(getSize(value));
- else if ((key == "fo:margin-left") && (pstyle != nullptr))
- {
- if (inList)
- pstyle->setIndent(pstyle->getIndent() + getSize(value));
- else
- pstyle->setIndent(getSize(value));
- }
- else if ((key == "text:space-before") && (pstyle != nullptr))
- {
- if (inList)
- pstyle->setIndent(pstyle->getIndent() + getSize(value));
- else
- pstyle->setIndent(getSize(value));
- }
- else if ((key == "fo:text-indent") && (pstyle != nullptr))
- pstyle->setFirstLineIndent(getSize(value));
- else if ((key == "fo:text-align") && (pstyle != nullptr))
- align = value;
- else if ((key == "style:justify-single-word") && (pstyle != nullptr))
- force = value;
-
- if (!align.isEmpty() && (pstyle != nullptr))
- {
- if (align == "end")
- pstyle->setAlignment(RIGHT);
- else if (align == "center")
- pstyle->setAlignment(CENTER);
- else if (align == "justify")
- {
- if (force != "false")
- pstyle->setAlignment(FORCED);
- else
- pstyle->setAlignment(BLOCK);
- }
- }
-
- return true;
- }
-
- double StyleReader::getSize(QString s, double parentSize)
+ gtParagraphStyle* pstyle = nullptr;
+ if (style->target() == "paragraph")
+ pstyle = dynamic_cast<gtParagraphStyle*>(style);
+ else
+ pstyle = nullptr;
+ QString align;
+ QString force;
+
+ if (key == "style:font-name")
+ style->getFont()->setName(getFont(value));
+ else if (key == "fo:font-size")
+ {
+ double size = 0;
+ double psize = 0;
+ if (parent2Style != nullptr)
+ psize = static_cast<double>(parent2Style->getFont()->getSize());
+ else if (styles.contains("default-style"))
+ psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
+ psize = psize / 10;
+ size = getSize(value, psize);
+ int nsize = static_cast<int>(size * 10);
+ style->getFont()->setSize(nsize);
+ if (pstyle)
+ pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
+ }
+ else if ((key == "fo:line-height") && (parent2Style != nullptr))
+ {
+ gtParagraphStyle* ppstyle;
+ if (parent2Style->target() == "paragraph")
+ {
+ ppstyle = dynamic_cast<gtParagraphStyle*>(parent2Style);
+ assert(ppstyle != nullptr);
+ ppstyle->setLineSpacing(getSize(value, writer->getPreferredLineSpacing(style->getFont()->getSize())));
+ }
+ }
+ else if (key == "fo:color")
+ style->getFont()->setColor(value);
+ else if ((key == "style:use-window-font-color") && (value == "true"))
+ style->getFont()->setColor("Black");
+ else if ((key == "fo:font-weight") && (value == "bold"))
+ style->getFont()->setWeight(BOLD);
+ else if ((key == "fo:font-style") && (value == "italic"))
+ style->getFont()->setSlant(ITALIC);
+ else if ((key == "style:text-underline") && (value != "none"))
+ style->getFont()->toggleEffect(UNDERLINE);
+ else if ((key == "style:text-crossing-out") && (value != "none"))
+ style->getFont()->toggleEffect(STRIKETHROUGH);
+ else if ((key == "fo:font-variant") && (value == "small-caps"))
+ style->getFont()->toggleEffect(SMALL_CAPS);
+ else if ((key == "style:text-outline") && (value == "true"))
+ {
+ style->getFont()->toggleEffect(OUTLINE);
+ style->getFont()->setStrokeColor("Black");
+ style->getFont()->setColor("White");
+ }
+ else if (key == "fo:letter-spacing")
+ style->getFont()->setKerning(static_cast<int>(getSize(value, -1.0)));
+ else if (key == "style:text-scale")
+ style->getFont()->setHscale(static_cast<int>(getSize(value, -1.0)));
+ else if ((key == "style:text-position") &&
+ (((value).indexOf("sub") != -1) ||
+ (((value).left(1) == "-") && ((value).left(1) != "0"))))
+ style->getFont()->toggleEffect(SUBSCRIPT);
+ else if ((key == "style:text-position") &&
+ (((value).indexOf("super") != -1) ||
+ (((value).left(1) != "-") && ((value).left(1) != "0"))))
+ style->getFont()->toggleEffect(SUPERSCRIPT);
+ else if ((key == "fo:margin-top") && (pstyle != nullptr))
+ pstyle->setSpaceAbove(getSize(value));
+ else if ((key == "fo:margin-bottom") && (pstyle != nullptr))
+ pstyle->setSpaceBelow(getSize(value));
+ else if ((key == "fo:margin-left") && (pstyle != nullptr))
+ {
+ if (inList)
+ pstyle->setIndent(pstyle->getIndent() + getSize(value));
+ else
+ pstyle->setIndent(getSize(value));
+ }
+ else if ((key == "text:space-before") && (pstyle != nullptr))
+ {
+ if (inList)
+ pstyle->setIndent(pstyle->getIndent() + getSize(value));
+ else
+ pstyle->setIndent(getSize(value));
+ }
+ else if ((key == "fo:text-indent") && (pstyle != nullptr))
+ pstyle->setFirstLineIndent(getSize(value));
+ else if ((key == "fo:text-align") && (pstyle != nullptr))
+ align = value;
+ else if ((key == "style:justify-single-word") && (pstyle != nullptr))
+ force = value;
+
+ if (!align.isEmpty() && (pstyle != nullptr))
+ {
+ if (align == "end")
+ pstyle->setAlignment(RIGHT);
+ else if (align == "center")
+ pstyle->setAlignment(CENTER);
+ else if (align == "justify")
+ {
+ if (force != "false")
+ pstyle->setAlignment(FORCED);
+ else
+ pstyle->setAlignment(BLOCK);
+ }
+ }
+
+ return true;
+ }
+
+ double StyleReader::getSize(const QString& s, double parentSize)
{
QString dbl("0.0");
QString lowerValue = s.toLower();
Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.h Sun Aug 5 12:37:54 2018
@@ -63,14 +63,14 @@
bool inList;
QString currentList;
bool defaultStyleCreated;
- double getSize(QString s, double parentSize = -1);
+ double getSize(const QString& s, double parentSize = -1);
void styleProperties(const QXmlAttributes& attrs);
void defaultStyle(const QXmlAttributes& attrs);
void styleStyle(const QXmlAttributes& attrs);
void tabStop(const QXmlAttributes& attrs);
void setupFrameStyle();
public:
- StyleReader(QString documentName, gtWriter *wr, bool textOnly, bool prefix, bool combineStyles = true);
+ StyleReader(const QString& documentName, gtWriter *wr, bool textOnly, bool prefix, bool combineStyles = true);
~StyleReader();
bool updateStyle(gtStyle* style, gtStyle* parent2Style, const QString& key, const QString& value);
static void startElement(void *user_data, const xmlChar * fullname, const xmlChar ** atts);
Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/sxwdia.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/sxwdia.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/sxwdia.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/sxwdia.cpp Sun Aug 5 12:37:54 2018
@@ -17,7 +17,7 @@
#include "scribusapi.h"
#include "iconmanager.h"
-SxwDialog::SxwDialog(bool update, bool prefix, bool pack) : QDialog(0)
+SxwDialog::SxwDialog(bool update, bool prefix, bool pack) : QDialog(nullptr)
{
setModal(true);
setWindowIcon(QIcon(IconManager::instance()->loadIcon("AppIcon.png")));
Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.cpp Sun Aug 5 12:37:54 2018
@@ -51,7 +51,7 @@
return QStringList("sxw");
}
-void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer)
+void GetText(const QString& filename, const QString& encoding, bool textOnly, gtWriter *writer)
{
SxwIm* sim = new SxwIm(filename, encoding, writer, textOnly);
delete sim;
Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/sxwim.h Sun Aug 5 12:37:54 2018
@@ -32,7 +32,7 @@
#include "scconfig.h"
#include "pluginapi.h"
-extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer);
+extern "C" PLUGIN_API void GetText(const QString& filename, const QString& encoding, bool textOnly, gtWriter *writer);
extern "C" PLUGIN_API QString FileFormatName();
Modified: trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp Sun Aug 5 12:37:54 2018
@@ -31,7 +31,7 @@
return QStringList();
}
-void GetText(QString filename, QString encoding, bool, gtWriter *writer)
+void GetText(const QString& filename, const QString& encoding, bool, gtWriter *writer)
{
TextFilter* tf = new TextFilter(filename, encoding, writer);
delete tf;
@@ -43,7 +43,7 @@
{
filename = fname;
encoding = enc;
- filters = 0;
+ filters = nullptr;
writer = w;
writer->setOverridePStyleFont(false);
prefs = PrefsManager::instance()->prefsFile->getPluginContext("TextFilter");
@@ -122,7 +122,7 @@
}
}
}
- if (pstyles.size() == 0)
+ if (pstyles.empty())
writer->append(text);
else
{
Modified: trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.h Sun Aug 5 12:37:54 2018
@@ -13,7 +13,7 @@
#include "gtwriter.h"
#include "tffilter.h"
-extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer);
+extern "C" PLUGIN_API void GetText(const QString& filename, const QString& encoding, bool textOnly, gtWriter *writer);
extern "C" PLUGIN_API QString FileFormatName();
Modified: trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp Sun Aug 5 12:37:54 2018
@@ -27,7 +27,7 @@
#include "util.h"
tfFilter::tfFilter(QWidget *parent, const char *name,
- int action, QString regExp, QString replace, QString pstyleName,
+ int action, const QString& regExp, const QString& replace, const QString& pstyleName,
int less, int more, int style, bool match, bool enabled, bool regexp)
: QWidget(parent)
{
@@ -134,12 +134,12 @@
// layout->addStretch(10);
layout->addSpacing(20);
- removeButton = new QPushButton(IconManager::instance()->loadIcon("22/list-remove.png"), 0, this);
+ removeButton = new QPushButton(IconManager::instance()->loadIcon("22/list-remove.png"), nullptr, this);
removeButton->setToolTip( tr("Remove this filter row"));
removeButton->setMaximumSize(QSize(25,25));
removeButton->setMinimumSize(QSize(25,25));
layout->addWidget(removeButton, 0, Qt::AlignTop);
- addButton = new QPushButton(IconManager::instance()->loadIcon("22/list-add.png"), 0, this);
+ addButton = new QPushButton(IconManager::instance()->loadIcon("22/list-add.png"), nullptr, this);
addButton->setToolTip( tr("Add a new filter row"));
addButton->setMaximumSize(QSize(25,25));
addButton->setMinimumSize(QSize(25,25));
@@ -547,8 +547,7 @@
int i = text.toInt(&ok);
if (ok)
return i;
- else
- return -1;
+ return -1;
}
int tfFilter::getStyle()
Modified: trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/textfilter/tffilter.h Sun Aug 5 12:37:54 2018
@@ -74,7 +74,7 @@
void getParagraphStyles();
public:
tfFilter(QWidget *parent, const char *name,
- int action, QString regExp, QString replace, QString pstyleName,
+ int action, const QString& regExp, const QString& replace, const QString& pstyleName,
int less, int more, int style, bool match, bool enabled, bool regexp);
tfFilter(QWidget *parent = 0, const char *name = 0);
~tfFilter();
Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp Sun Aug 5 12:37:54 2018
@@ -37,7 +37,7 @@
return QStringList("xtg");
}
-void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, bool append, PageItem *textItem)
+void GetText2(const QString& filename, QString encoding, bool textOnly, bool prefix, bool append, PageItem *textItem)
{
XtgIm* xtgim = new XtgIm(textItem, textOnly, prefix, append);
xtgim->import(filename);
@@ -53,11 +53,10 @@
XtgIm::~XtgIm()
{
- if (m_scanner)
- delete m_scanner;
+ delete m_scanner;
}
-bool XtgIm::import(QString fileName)
+bool XtgIm::import(const QString& fileName)
{
if (!m_scanner)
return false;
Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h Sun Aug 5 12:37:54 2018
@@ -36,7 +36,7 @@
class StyleManager;
class XtgScanner;
-extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, bool append, PageItem *textItem);
+extern "C" PLUGIN_API void GetText2(const QString& filename, QString encoding, bool textOnly, bool prefix, bool append, PageItem *textItem);
extern "C" PLUGIN_API QString FileFormatName();
extern "C" PLUGIN_API QStringList FileExtensions();
@@ -46,7 +46,7 @@
XtgIm(PageItem *textItem, bool textOnly, bool prefix, bool append);
~XtgIm();
- bool import(QString fileName);
+ bool import(const QString& fileName);
protected:
XtgScanner* m_scanner;
Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp Sun Aug 5 12:37:54 2018
@@ -72,8 +72,7 @@
XtgScanner::~XtgScanner()
{
- if (m_decoder)
- delete m_decoder;
+ delete m_decoder;
}
bool XtgScanner::open(const QString& fileName)
@@ -441,23 +440,19 @@
if (it.current().family().toLower() == fontName.toLower())
{
if (it.currentKey().toLower() == fontName.toLower()) // exact Match
+ return fontName;
+
+ QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
+ slist.sort();
+ if (slist.count() > 0)
{
+ int reInd = slist.indexOf("Regular");
+ if (reInd < 0)
+ fontName = it.current().family() + " " + slist[0];
+ else
+ fontName = it.current().family() + " " + slist[reInd];
return fontName;
}
- else
- {
- QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
- slist.sort();
- if (slist.count() > 0)
- {
- int reInd = slist.indexOf("Regular");
- if (reInd < 0)
- fontName = it.current().family() + " " + slist[0];
- else
- fontName = it.current().family() + " " + slist[reInd];
- return fontName;
- }
- }
}
}
@@ -468,7 +463,7 @@
}
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- QScopedPointer<MissingFont> dia(new MissingFont(0, fontName, m_doc));
+ QScopedPointer<MissingFont> dia(new MissingFont(nullptr, fontName, m_doc));
if (dia->exec())
{
PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = dia->getReplacementFont();
@@ -941,8 +936,7 @@
if (!codec)
codec = QTextCodec::codecForLocale();
- if (m_decoder)
- delete m_decoder;
+ delete m_decoder;
m_decoder = new QTextDecoder(codec, QTextCodec::IgnoreHeader);
}
@@ -1472,7 +1466,7 @@
}
else
{ // find the name and return it as a tag
- while (1)
+ while (true)
{
temp = lookAhead();
if (temp == ':' || temp == '=' )
Modified: trunk/Scribus/scribus/plugins/picbrowser/collection.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/collection.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/collection.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/collection.cpp Sun Aug 5 12:37:54 2018
@@ -36,7 +36,7 @@
collectionReaderThread::collectionReaderThread ( QString &xmlFile2, bool importCollection )
{
categoriesCount = 0;
- collection = 0;
+ collection = nullptr;
type = 0;
restartThread = false;
@@ -256,7 +256,7 @@
collectionListReaderThread::collectionListReaderThread ( QStringList &xmlFiles2 )
{
- m_clrt = 0;
+ m_clrt = nullptr;
restartThread = false;
xmlFiles = xmlFiles2;
Modified: trunk/Scribus/scribus/plugins/picbrowser/iview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/iview.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/iview.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/iview.cpp Sun Aug 5 12:37:54 2018
@@ -21,7 +21,7 @@
IView::IView ( QWidget * parent )
:QGraphicsView ( parent )
{
- curImage = 0;
+ curImage = nullptr;
setScene ( new QGraphicsScene );
setInteractive ( true );
isPanning = false;
@@ -34,8 +34,7 @@
IView::~ IView()
{
QGraphicsScene * s(scene());
- if(s)
- delete s;
+ delete s;
}
void IView::mouseMoveEvent ( QMouseEvent * e )
@@ -85,7 +84,7 @@
if ( curImage )
{
delete curImage;
- curImage = 0;
+ curImage = nullptr;
}
curImage = scene()->addPixmap ( pixmap );
Modified: trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp Sun Aug 5 12:37:54 2018
@@ -129,7 +129,7 @@
//no realCMYK
bool mode=false;
//no document needs to be assigned to this
- CMSettings cms ( 0, "", Intent_Perceptual);
+ CMSettings cms ( nullptr, "", Intent_Perceptual);
cms.allowColorManagement(false);
cms.setUseEmbeddedProfile(true);
Modified: trunk/Scribus/scribus/plugins/picbrowser/multicombobox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/multicombobox.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/multicombobox.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/multicombobox.cpp Sun Aug 5 12:37:54 2018
@@ -24,7 +24,7 @@
multiView::multiView ( QWidget* parent ) : QListView ( parent )
{
- parentMcb = 0;
+ parentMcb = nullptr;
}
@@ -128,17 +128,10 @@
QVariant var = QComboBox::itemData ( index, Qt::CheckStateRole );
if ( var == Qt::Checked )
- {
return 1;
- }
- else if ( var == Qt::PartiallyChecked )
- {
+ if ( var == Qt::PartiallyChecked )
return 2;
- }
- else
- {
- return 0;
- }
+ return 0;
}
Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp Sun Aug 5 12:37:54 2018
@@ -26,8 +26,8 @@
PictureBrowser::PictureBrowser(ScribusDoc* doc, QWidget *parent):
QDialog(parent),
- pModel(0),
- pImages(0)
+ pModel(nullptr),
+ pImages(nullptr)
{
setupUi(this);
@@ -107,10 +107,10 @@
pImages = new previewImages(QStringList());
//set threadpointer to 0
- fit = 0;
- crt = 0;
- cdbwt = 0;
- clrt = 0;
+ fit = nullptr;
+ crt = nullptr;
+ cdbwt = nullptr;
+ clrt = nullptr;
pModel = new PreviewImagesModel(this);
@@ -287,9 +287,9 @@
void PictureBrowser::closeEvent(QCloseEvent* e)
{
delete pImages;
- pImages=0;
+ pImages=nullptr;
delete pModel;
- pModel=0;
+ pModel=nullptr;
}
@@ -723,7 +723,7 @@
updateBrowser(true, true, false);
delete fit;
- fit = 0;
+ fit = nullptr;
}
}
@@ -806,7 +806,7 @@
}
delete crt;
- crt = 0;
+ crt = nullptr;
}
@@ -889,7 +889,7 @@
else
{
delete cdbwt;
- cdbwt = 0;
+ cdbwt = nullptr;
}
}
Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp Sun Aug 5 12:37:54 2018
@@ -16,7 +16,7 @@
// Set action info in languageChange, so we only have to do
// it in one place.
languageChange();
- pictureBrowser = 0;
+ pictureBrowser = nullptr;
}
PictureBrowserPlugin::~PictureBrowserPlugin()
@@ -71,7 +71,7 @@
//picturebrowser isn't running yet, so create it
if ( !pictureBrowser )
{
- pictureBrowser = new PictureBrowser ( doc, 0 );
+ pictureBrowser = new PictureBrowser ( doc, nullptr );
if ( !pictureBrowser )
{
Modified: trunk/Scribus/scribus/plugins/picbrowser/previewimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/previewimage.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/previewimage.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/previewimage.cpp Sun Aug 5 12:37:54 2018
@@ -39,7 +39,7 @@
-previewImage::previewImage ( QString imageFile )
+previewImage::previewImage ( const QString& imageFile )
{
filtered = false;
previewIconCreated = false;
@@ -98,12 +98,7 @@
bool previewImage::insertIntoImageFrame ( ScribusDoc *doc, PageItem *imageFrame )
{
//inserting image
- if ( !imageFrame->loadImage ( fileInformation.absoluteFilePath(), false, -1, true ) )
- {
- return false;
- }
-
- return true;
+ return imageFrame->loadImage ( fileInformation.absoluteFilePath(), false, -1, true );
}
@@ -116,15 +111,11 @@
void previewImages::createPreviewImagesList ( const QStringList& imageFiles )
{
//if there are already previewimages allocated, remove them
- if ( previewImagesList.size() > 0 )
- {
+ if ( !previewImagesList.empty() )
clearPreviewImagesList();
- }
if ( imageFiles.isEmpty() )
- {
return;
- }
int s = imageFiles.size();
@@ -426,10 +417,8 @@
pId++;
//if there are already items stored, remove them
- if ( modelItemsList.size() > 0 )
- {
+ if ( !modelItemsList.empty() )
clearModelItemsList();
- }
pictureBrowser->imagesDisplayed = 0;
pictureBrowser->imagesFiltered = 0;
@@ -521,24 +510,14 @@
return QIcon ( defaultIcon );
}
- else
- {
- return QIcon ( tmpImage->previewIcon );
- }
-
+ return QIcon ( tmpImage->previewIcon );
+ }
+ if ( role == Qt::DisplayRole )
+ {
+ if ( pictureBrowser->pbSettings.previewMode == 1 )
+ return tmpImage->fileInformation.fileName();
return QVariant();
}
- else if ( role == Qt::DisplayRole )
- {
- if ( pictureBrowser->pbSettings.previewMode == 1 )
- {
- return tmpImage->fileInformation.fileName();
- }
- else
- {
- return QVariant();
- }
- }
return QVariant();
}
@@ -547,9 +526,7 @@
Qt::ItemFlags PreviewImagesModel::flags ( const QModelIndex &index ) const
{
if ( index.isValid() )
- {
return ( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled );
- }
//Qt modeltest requests 0 here
return 0;
@@ -559,13 +536,8 @@
int PreviewImagesModel::rowCount ( const QModelIndex &parent ) const
{
if ( parent.isValid() )
- {
return 0;
- }
- else
- {
- return modelItemsList.size();
- }
+ return modelItemsList.size();
}
Modified: trunk/Scribus/scribus/plugins/picbrowser/previewimage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/picbrowser/previewimage.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/previewimage.h (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/previewimage.h Sun Aug 5 12:37:54 2018
@@ -60,7 +60,7 @@
{
public:
//constructor, sets filepath for an image
- previewImage ( QString imageFile );
+ previewImage ( const QString& imageFile );
~previewImage();
//creates the previewicon in desired size in pixels
Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp Sun Aug 5 12:37:54 2018
@@ -108,7 +108,7 @@
MenuSAT* Sat = new MenuSAT();
Sat->RunSATPlug(m_Doc);
delete Sat;
- Sat = 0;
+ Sat = nullptr;
}
return true;
}
Modified: trunk/Scribus/scribus/plugins/shapes/shapepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22612&path=/trunk/Scribus/scribus/plugins/shapes/shapepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/shapes/shapepalette.cpp (original)
+++ trunk/Scribus/scribus/plugins/shapes/shapepalette.cpp Sun Aug 5 12:37:54 2018
@@ -217,7 +217,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(w, h, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, scMW, 0);
+ m_Doc->setGUI(false, scMW, nullptr);
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset(), w, h, m_Doc->itemToolPrefs().shapeLineWidth, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor);
PageItem* ite = m_Doc->Items->at(z);
ite->PoLine = shapes[key].path.copy();
@@ -277,7 +277,7 @@
}
}
-ShapePalette::ShapePalette( QWidget* parent) : ScDockPalette( parent, "Shap", 0)
+ShapePalette::ShapePalette( QWidget* parent) : ScDockPalette( parent, "Shap", nullptr)
{
setMinimumSize( QSize( 220, 240 ) );
setObjectName(QString::fromLocal8Bit("Shap"));
More information about the scribus-commit
mailing list