r22609 by craig - clazy and clang fixes, part 9
scribus-commit
scribus-commit at lists.scribus.net
Sun Aug 5 11:24:18 UTC 2018
Author: craig
Date: Sun Aug 5 11:24:17 2018
New Revision: 22609
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22609
Log:
clazy and clang fixes, part 9
Modified:
trunk/Scribus/scribus/plugins/import/ai/importai.cpp
trunk/Scribus/scribus/plugins/import/ai/importai.h
trunk/Scribus/scribus/plugins/import/cdr/importcdr.cpp
trunk/Scribus/scribus/plugins/import/cdr/importcdr.h
trunk/Scribus/scribus/plugins/import/cdr/importcdrplugin.cpp
trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
trunk/Scribus/scribus/plugins/import/cgm/importcgm.h
trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
trunk/Scribus/scribus/plugins/import/cvg/importcvg.h
trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
trunk/Scribus/scribus/plugins/import/drw/importdrw.h
trunk/Scribus/scribus/plugins/import/emf/importemf.cpp
trunk/Scribus/scribus/plugins/import/emf/importemf.h
trunk/Scribus/scribus/plugins/import/emf/importemfplugin.cpp
trunk/Scribus/scribus/plugins/import/fh/importfh.cpp
trunk/Scribus/scribus/plugins/import/fh/importfh.h
trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
trunk/Scribus/scribus/plugins/import/idml/importidml.h
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.h
trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
trunk/Scribus/scribus/plugins/import/pct/importpct.h
trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
trunk/Scribus/scribus/plugins/import/pm/importpm.cpp
trunk/Scribus/scribus/plugins/import/pm/importpm.h
trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
trunk/Scribus/scribus/plugins/import/pub/importpub.h
trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
trunk/Scribus/scribus/plugins/import/shape/importshape.h
trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
trunk/Scribus/scribus/plugins/import/sml/importsml.h
trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
trunk/Scribus/scribus/plugins/import/svm/importsvm.h
trunk/Scribus/scribus/plugins/import/svm/importsvmplugin.cpp
trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
trunk/Scribus/scribus/plugins/import/vsd/importvsd.h
trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp
trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
trunk/Scribus/scribus/plugins/import/wpg/importwpg.h
trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
trunk/Scribus/scribus/plugins/import/xar/importxar.h
trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
trunk/Scribus/scribus/plugins/import/xfig/importxfig.h
trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp Sun Aug 5 11:24:17 2018
@@ -156,8 +156,7 @@
image.setText("YSize", QString("%1").arg(image.height()));
return image;
}
- else
- return QImage();
+ return QImage();
}
}
QFile fT2(fName);
@@ -193,7 +192,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
ColorList::Iterator it;
@@ -298,7 +297,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
ColorList::Iterator it;
@@ -384,7 +383,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -539,7 +538,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -577,7 +576,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -614,12 +613,11 @@
AIPlug::~AIPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool AIPlug::extractFromPDF(QString infile, QString outfile)
+bool AIPlug::extractFromPDF(const QString& infile, const QString& outfile)
{
bool ret = false;
#ifdef HAVE_PODOFO
@@ -779,7 +777,7 @@
return true;
}
-bool AIPlug::parseHeader(QString fName, double &x, double &y, double &b, double &h)
+bool AIPlug::parseHeader(const QString& fName, double &x, double &y, double &b, double &h)
{
QString tmp, BBox, FarNam;
ScColor cc;
@@ -1162,7 +1160,7 @@
return ret;
}
-QString AIPlug::parseCustomColorX(QString data, double &shade, QString type)
+QString AIPlug::parseCustomColorX(QString data, double &shade, const QString& type)
{
QString ret = CommonStrings::None;
if (data.isEmpty())
@@ -2526,7 +2524,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, family, m_Doc);
+ MissingFont *dia = new MissingFont(nullptr, family, m_Doc);
dia->exec();
QString tmpf = dia->getReplacementFont();
delete dia;
@@ -2798,9 +2796,9 @@
currentPatternDefName = "";
break;
}
- else if (tmp.startsWith("Tile"))
+ if (tmp.startsWith("Tile"))
continue;
- else if (tmp.contains(") @"))
+ if (tmp.contains(") @"))
{
tmpData += tmp;
tmpData.remove(") @");
@@ -3136,8 +3134,7 @@
tmp = removeAIPrefix(readLineFromDataStream(ts));
if (tmp.startsWith("EndGradient"))
break;
- else
- processGradientData(tmp);
+ processGradientData(tmp);
}
}
if (tmp.startsWith("BeginPattern:"))
@@ -3164,8 +3161,7 @@
tmp = removeAIPrefix(readLineFromDataStream(ts));
if (tmp.startsWith("EndGradient"))
break;
- else
- processGradientData(tmp);
+ processGradientData(tmp);
if(progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
@@ -3360,8 +3356,7 @@
}
if (tmp.startsWith("EndLayer"))
break;
- else
- processData(rl);
+ processData(rl);
if(progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
Modified: trunk/Scribus/scribus/plugins/import/ai/importai.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/ai/importai.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.h (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.h Sun Aug 5 11:24:17 2018
@@ -66,16 +66,16 @@
\param outfile a filename for output
\retval bool true if conversion was ok
*/
- bool extractFromPDF(QString infile, QString outfile);
+ bool extractFromPDF(const QString& infile, const QString& outfile);
bool decompressAIData(QString &fName);
- bool parseHeader(QString fName, double &x, double &y, double &b, double &h);
+ bool parseHeader(const QString& fName, double &x, double &y, double &b, double &h);
QString removeAIPrefix(QString comment);
QString parseColor(QString data);
QString parseColorGray(QString data);
QString parseColorRGB(QString data);
QString parseCustomColor(QString data, double &shade);
- QString parseCustomColorX(QString data, double &shade, QString type);
+ QString parseCustomColorX(QString data, double &shade, const QString& type);
QStringList getStrings(QString data);
void getCommands(QString data, QStringList &commands);
void decodeA85(QByteArray &psdata, QString tmp);
Modified: trunk/Scribus/scribus/plugins/import/cdr/importcdr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cdr/importcdr.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cdr/importcdr.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cdr/importcdr.cpp Sun Aug 5 11:24:17 2018
@@ -66,7 +66,7 @@
cancel = false;
}
-QImage CdrPlug::readThumbnail(QString fName)
+QImage CdrPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
@@ -79,7 +79,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -116,13 +116,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -143,7 +140,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -255,7 +252,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -286,7 +283,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -321,12 +318,11 @@
CdrPlug::~CdrPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool CdrPlug::convert(QString fn)
+bool CdrPlug::convert(const QString& fn)
{
importedColors.clear();
importedPatterns.clear();
@@ -387,7 +383,7 @@
progressDialog->close();
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"));
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
Modified: trunk/Scribus/scribus/plugins/import/cdr/importcdr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cdr/importcdr.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cdr/importcdr.h (original)
+++ trunk/Scribus/scribus/plugins/import/cdr/importcdr.h Sun Aug 5 11:24:17 2018
@@ -54,10 +54,10 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- bool convert(QString fn);
+ bool convert(const QString& fn);
QList<PageItem*> Elements;
double baseX, baseY;
Modified: trunk/Scribus/scribus/plugins/import/cdr/importcdrplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cdr/importcdrplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cdr/importcdrplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cdr/importcdrplugin.cpp Sun Aug 5 11:24:17 2018
@@ -150,7 +150,7 @@
Q_CHECK_PTR(dia);
if (!dia->import(fileName, trSettings, flags, !(flags & lfScripted)))
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
//Import per Uniconverter
qDebug() << "ERROR: Parsing with libcdr failed! Trying now Uniconverter.";
const FileFormat *fmt = LoadSavePlugin::getFormatByExt("cdt");
Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp Sun Aug 5 11:24:17 2018
@@ -108,7 +108,7 @@
progressDialog = nullptr;
}
-QImage CgmPlug::readThumbnail(QString fName)
+QImage CgmPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
@@ -122,7 +122,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -159,13 +159,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -188,7 +185,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -302,7 +299,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -319,7 +316,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -354,16 +351,15 @@
CgmPlug::~CgmPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-void CgmPlug::parseHeader(QString fName, double &b, double &h)
-{
-}
-
-bool CgmPlug::convert(QString fn)
+void CgmPlug::parseHeader(const QString& fName, double &b, double &h)
+{
+}
+
+bool CgmPlug::convert(const QString& fn)
{
Coords.resize(0);
Coords.svgInit();
@@ -1658,8 +1654,8 @@
Coords.resize(0);
Coords.svgInit();
Coords.svgMoveTo(pStart.x(), pStart.y());
- Coords.svgArcTo(radius, radius, 0, 0, rad1.angle() < rad3.angle() ? 0 : 1, pInter.x(), pInter.y());
- Coords.svgArcTo(radius, radius, 0, 0, rad1.angle() < rad3.angle() ? 0 : 1, pEnd.x(), pEnd.y());
+ Coords.svgArcTo(radius, radius, 0, false, rad1.angle() >= rad3.angle(), pInter.x(), pInter.y());
+ Coords.svgArcTo(radius, radius, 0, false, rad1.angle() >= rad3.angle(), pEnd.x(), pEnd.y());
Coords.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
if (recordRegion)
regionPath.connectPath(Coords.toQPainterPath(false));
@@ -1712,8 +1708,8 @@
}
else
Coords.svgMoveTo(pStart.x(), pStart.y());
- Coords.svgArcTo(radius, radius, 0, 0, rad1.angle() < rad3.angle() ? 0 : 1, pInter.x(), pInter.y());
- Coords.svgArcTo(radius, radius, 0, 0, rad1.angle() < rad3.angle() ? 0 : 1, pEnd.x(), pEnd.y());
+ Coords.svgArcTo(radius, radius, 0, false, rad1.angle() >= rad3.angle(), pInter.x(), pInter.y());
+ Coords.svgArcTo(radius, radius, 0, false, rad1.angle() >= rad3.angle(), pEnd.x(), pEnd.y());
if (mode == 0)
Coords.svgLineTo(center.x(), center.y());
else
@@ -1958,12 +1954,12 @@
if (dstX.angleTo(dstY) > 180)
{
Coords.svgMoveTo(stP.x(), stP.y());
- Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) < 180 ? 1 : 0, dstX.angleTo(dstY) > 180 ? 1 : 0, enP.x(), enP.y());
+ Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) < 180, dstX.angleTo(dstY) > 180, enP.x(), enP.y());
}
else
{
Coords.svgMoveTo(stP.x(), stP.y());
- Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) > 180 ? 1 : 0, dstX.angleTo(dstY) > 180 ? 1 : 0, enP.x(), enP.y());
+ Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) > 180, dstX.angleTo(dstY) > 180, enP.x(), enP.y());
}
Coords.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
ell = Coords.toQPainterPath(false);
@@ -2059,12 +2055,12 @@
if (dstX.angleTo(dstY) > 180)
{
Coords.svgLineTo(stP.x(), stP.y());
- Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) < 180 ? 1 : 0, dstX.angleTo(dstY) > 180 ? 1 : 0, enP.x(), enP.y());
+ Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) < 180, dstX.angleTo(dstY) > 180, enP.x(), enP.y());
}
else
{
Coords.svgLineTo(stP.x(), stP.y());
- Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) > 180 ? 1 : 0, dstX.angleTo(dstY) > 180 ? 1 : 0, enP.x(), enP.y());
+ Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) > 180, dstX.angleTo(dstY) > 180, enP.x(), enP.y());
}
Coords.svgLineTo(cx, cy);
Coords.svgClosePath();
@@ -2074,12 +2070,12 @@
if (dstX.angleTo(dstY) > 180)
{
Coords.svgMoveTo(stP.x(), stP.y());
- Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) < 180 ? 1 : 0, dstX.angleTo(dstY) > 180 ? 1 : 0, enP.x(), enP.y());
+ Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) < 180, dstX.angleTo(dstY) > 180, enP.x(), enP.y());
}
else
{
Coords.svgMoveTo(stP.x(), stP.y());
- Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) > 180 ? 1 : 0, dstX.angleTo(dstY) > 180 ? 1 : 0, enP.x(), enP.y());
+ Coords.svgArcTo(distX, distY, rotB, stv.angleTo(env) > 180, dstX.angleTo(dstY) > 180, enP.x(), enP.y());
}
Coords.svgLineTo(stP.x(), stP.y());
Coords.svgClosePath();
@@ -3324,7 +3320,7 @@
else
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
- m_Doc->changePageProperties(0, 0, 0, 0, height, width, height, width, m_Doc->pageOrientation(), m_Doc->pageSize(), m_Doc->currentPage()->pageNr(), 0);
+ m_Doc->changePageProperties(0, 0, 0, 0, height, width, height, width, m_Doc->pageOrientation(), m_Doc->pageSize(), m_Doc->currentPage()->pageNr(), false);
}
else
{
@@ -3340,14 +3336,14 @@
}
}
-void CgmPlug::handleMetaFileDescription(QString value)
+void CgmPlug::handleMetaFileDescription(const QString& value)
{
if (importerFlags & LoadSavePlugin::lfCreateDoc)
m_Doc->documentInfo().setComments(value);
// qDebug() << "Metafile Description" << value;
}
-QString CgmPlug::handleColor(ScColor &color, QString proposedName)
+QString CgmPlug::handleColor(ScColor &color, const QString& proposedName)
{
QString tmpName = m_Doc->PageColors.tryAddColor(proposedName, color);
if (tmpName == proposedName)
Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgm.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgm.h (original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgm.h Sun Aug 5 11:24:17 2018
@@ -73,11 +73,11 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- void parseHeader(QString fName, double &b, double &h);
- bool convert(QString fn);
+ void parseHeader(const QString& fName, double &b, double &h);
+ bool convert(const QString& fn);
void decodeText(QFile &f);
/* binary Decoder */
@@ -112,8 +112,8 @@
void handleStartMetaFile(QString value);
void handleStartPicture(QString value);
void handleStartPictureBody(double width, double height);
- void handleMetaFileDescription(QString value);
- QString handleColor(ScColor &color, QString proposedName);
+ void handleMetaFileDescription(const QString& value);
+ QString handleColor(ScColor &color, const QString& proposedName);
double convertCoords(double input);
QPointF convertCoords(QPointF input);
void appendPath(QPainterPath &path1, QPainterPath &path2);
Modified: trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp Sun Aug 5 11:24:17 2018
@@ -59,7 +59,7 @@
progressDialog = nullptr;
}
-QImage CvgPlug::readThumbnail(QString fName)
+QImage CvgPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
@@ -76,7 +76,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -113,13 +113,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -142,7 +139,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -255,7 +252,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -272,7 +269,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -308,12 +305,11 @@
CvgPlug::~CvgPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-void CvgPlug::parseHeader(QString fName, double &b, double &h)
+void CvgPlug::parseHeader(const QString& fName, double &b, double &h)
{
QFile f(fName);
if (f.open(QIODevice::ReadOnly))
@@ -331,7 +327,7 @@
}
}
-bool CvgPlug::convert(QString fn)
+bool CvgPlug::convert(const QString& fn)
{
CurrColorFill = "Black";
CurrFillShade = 100.0;
@@ -447,28 +443,27 @@
else if (opCode == 0x000f)
break;
}
- if (Coords.size() > 0)
- {
- Coords.svgClosePath();
- z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX + obX / 72.0, baseY + obY / 72.0 * scPg, 10, 10, lineWidth / 72.0, CurrColorFill, CurrColorStroke);
- ite = m_Doc->Items->at(z);
- ite->PoLine = Coords.copy();
- ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
- ite->ClipEdited = true;
- ite->FrameType = 3;
- ite->setFillShade(CurrFillShade);
- ite->setLineShade(CurrStrokeShade);
- FPoint wh = getMaxClipF(&ite->PoLine);
- ite->setWidthHeight(wh.x(),wh.y());
- ite->setTextFlowMode(PageItem::TextFlowDisabled);
- m_Doc->adjustItemSize(ite);
- ite->OldB2 = ite->width();
- ite->OldH2 = ite->height();
- ite->updateClip();
- Elements.append(ite);
- if (groupStack.count() != 0)
- groupStack.top().append(ite);
- }
+ if (Coords.empty())
+ return;
+ Coords.svgClosePath();
+ z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX + obX / 72.0, baseY + obY / 72.0 * scPg, 10, 10, lineWidth / 72.0, CurrColorFill, CurrColorStroke);
+ ite = m_Doc->Items->at(z);
+ ite->PoLine = Coords.copy();
+ ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
+ ite->ClipEdited = true;
+ ite->FrameType = 3;
+ ite->setFillShade(CurrFillShade);
+ ite->setLineShade(CurrStrokeShade);
+ FPoint wh = getMaxClipF(&ite->PoLine);
+ ite->setWidthHeight(wh.x(),wh.y());
+ ite->setTextFlowMode(PageItem::TextFlowDisabled);
+ m_Doc->adjustItemSize(ite);
+ ite->OldB2 = ite->width();
+ ite->OldH2 = ite->height();
+ ite->updateClip();
+ Elements.append(ite);
+ if (groupStack.count() != 0)
+ groupStack.top().append(ite);
}
void CvgPlug::parseColor(quint32 dataF, quint32 dataS, bool color, quint16 flag)
Modified: trunk/Scribus/scribus/plugins/import/cvg/importcvg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/cvg/importcvg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cvg/importcvg.h (original)
+++ trunk/Scribus/scribus/plugins/import/cvg/importcvg.h Sun Aug 5 11:24:17 2018
@@ -52,11 +52,11 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- void parseHeader(QString fName, double &b, double &h);
- bool convert(QString fn);
+ void parseHeader(const QString& fName, double &b, double &h);
+ bool convert(const QString& fn);
void getObjects(QDataStream &ts, bool colorFlag, quint32 lenData);
void parseColor(quint32 dataF, quint32 dataS, bool color, quint16 flag);
Modified: trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp Sun Aug 5 11:24:17 2018
@@ -68,7 +68,7 @@
progressDialog = nullptr;
}
-QImage DrwPlug::readThumbnail(QString fName)
+QImage DrwPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
@@ -81,7 +81,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -130,13 +130,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -158,7 +155,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -270,7 +267,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -301,7 +298,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -336,12 +333,11 @@
DrwPlug::~DrwPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool DrwPlug::convert(QString fn)
+bool DrwPlug::convert(const QString& fn)
{
Coords.resize(0);
Coords.svgInit();
@@ -742,7 +738,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, fontName, m_Doc);
+ MissingFont *dia = new MissingFont(nullptr, fontName, m_Doc);
dia->exec();
textFont = dia->getReplacementFont();
delete dia;
@@ -788,7 +784,7 @@
else
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
- m_Doc->changePageProperties(0, 0, 0, 0, docHeight, docWidth, docHeight, docWidth, m_Doc->pageOrientation(), m_Doc->pageSize(), m_Doc->currentPage()->pageNr(), 0);
+ m_Doc->changePageProperties(0, 0, 0, 0, docHeight, docWidth, docHeight, docWidth, m_Doc->pageOrientation(), m_Doc->pageSize(), m_Doc->currentPage()->pageNr(), false);
cmdText = QString("DRW Page Width %1 Height %2").arg(docWidth).arg(docHeight);
}
break;
Modified: trunk/Scribus/scribus/plugins/import/drw/importdrw.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/drw/importdrw.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/drw/importdrw.h (original)
+++ trunk/Scribus/scribus/plugins/import/drw/importdrw.h Sun Aug 5 11:24:17 2018
@@ -60,10 +60,10 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- bool convert(QString fn);
+ bool convert(const QString& fn);
void decodeCmdData(QDataStream &ts, uint dataLen, quint8 cmd);
void decodeCmd(quint8 cmd, int pos);
void decodeSymbol(QDataStream &ds, bool last = false);
Modified: trunk/Scribus/scribus/plugins/import/emf/importemf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/emf/importemf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/emf/importemf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/emf/importemf.cpp Sun Aug 5 11:24:17 2018
@@ -489,7 +489,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -555,17 +555,14 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
-bool EmfPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
+bool EmfPlug::import(const QString& fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
{
QString fName = fNameIn;
bool success = false;
@@ -583,7 +580,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -738,7 +735,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -769,7 +766,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -805,8 +802,7 @@
EmfPlug::~EmfPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
@@ -1098,8 +1094,7 @@
{
if (id == U_EMR_EOF)
break;
- else if (id == U_EMR_COMMENT)
- handleComment(ds);
+ handleComment(ds);
}
else
{
@@ -2615,12 +2610,12 @@
if (enlin.angleTo(stlin) > 180)
{
// currentDC.Coords.svgMoveTo(st.x(), st.y());
- currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) < 180 ? 1 : 0, stlin.angleTo(enlin) > 180 ? 1 : 0, en.x(), en.y());
+ currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) < 180, stlin.angleTo(enlin) > 180, en.x(), en.y());
}
else
{
// currentDC.Coords.svgMoveTo(st.x(), st.y());
- currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) > 180 ? 1 : 0, stlin.angleTo(enlin) > 180 ? 1 : 0, en.x(), en.y());
+ currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) > 180, stlin.angleTo(enlin) > 180, en.x(), en.y());
}
currentDC.currentPoint = en;
}
@@ -2784,7 +2779,7 @@
if (currentDC.textAlignment & 0x0008)
painterPath.translate(0, fm.descent());
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorText, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -2915,7 +2910,7 @@
painterPath = bm.map(painterPath);
FPointArray textPath;
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorText, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -4903,7 +4898,7 @@
}
FPointArray textPath;
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorFill, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -4998,7 +4993,7 @@
painterPath = bm.map(painterPath);
painterPath.translate(rect[0].x(), rect[0].y());
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorFill, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
Modified: trunk/Scribus/scribus/plugins/import/emf/importemf.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/emf/importemf.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/emf/importemf.h (original)
+++ trunk/Scribus/scribus/plugins/import/emf/importemf.h Sun Aug 5 11:24:17 2018
@@ -141,7 +141,7 @@
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
- bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
+ bool import(const QString& fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
QImage readThumbnail(QString fn);
private:
Modified: trunk/Scribus/scribus/plugins/import/emf/importemfplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/emf/importemfplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/emf/importemfplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/emf/importemfplugin.cpp Sun Aug 5 11:24:17 2018
@@ -133,7 +133,7 @@
else
return true;
}
- if (m_Doc == 0)
+ if (m_Doc == nullptr)
m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction* activeTransaction = nullptr;
bool emptyDoc = (m_Doc == nullptr);
Modified: trunk/Scribus/scribus/plugins/import/fh/importfh.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/fh/importfh.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/fh/importfh.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/fh/importfh.cpp Sun Aug 5 11:24:17 2018
@@ -66,7 +66,7 @@
cancel = false;
}
-QImage FhPlug::readThumbnail(QString fName)
+QImage FhPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
@@ -79,7 +79,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -116,13 +116,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -143,7 +140,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -255,7 +252,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -286,7 +283,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -321,12 +318,11 @@
FhPlug::~FhPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool FhPlug::convert(QString fn)
+bool FhPlug::convert(const QString& fn)
{
importedColors.clear();
importedPatterns.clear();
@@ -350,7 +346,7 @@
progressDialog->close();
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
Modified: trunk/Scribus/scribus/plugins/import/fh/importfh.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/fh/importfh.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/fh/importfh.h (original)
+++ trunk/Scribus/scribus/plugins/import/fh/importfh.h Sun Aug 5 11:24:17 2018
@@ -54,10 +54,10 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- bool convert(QString fn);
+ bool convert(const QString& fn);
QList<PageItem*> Elements;
double baseX, baseY;
Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Sun Aug 5 11:24:17 2018
@@ -164,7 +164,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
Elements.clear();
@@ -201,13 +201,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
}
}
return tmp;
@@ -221,7 +218,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
QByteArray f;
QFileInfo fi = QFileInfo(fNameIn);
QString ext = fi.suffix().toLower();
@@ -297,7 +294,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -403,7 +400,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -420,7 +417,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -456,12 +453,11 @@
IdmlPlug::~IdmlPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool IdmlPlug::convert(QString fn)
+bool IdmlPlug::convert(const QString& fn)
{
Coords.resize(0);
Coords.svgInit();
@@ -688,8 +684,7 @@
}
}
}
- if (fun != nullptr)
- delete fun;
+ delete fun;
if (progressDialog)
progressDialog->close();
return retVal;
@@ -1356,7 +1351,7 @@
bleedLeft = e.attribute("DocumentBleedInsideOrLeftOffset").toDouble();
bleedRight = e.attribute("DocumentBleedOutsideOrRightOffset").toDouble();
bleedBottom = e.attribute("DocumentBleedBottomOffset").toDouble();
- facingPages = (e.attribute("FacingPages","") == "true") ? 1 : 0;
+ facingPages = e.attribute("FacingPages","") == "true";
}
}
if (e.tagName() == "MarginPreference")
@@ -2124,7 +2119,7 @@
pathTextStart = ite.attribute("StartBracket").toDouble();
}
}
- if (GCoords.size() > 0)
+ if (!GCoords.empty())
{
int z;
QTransform finalMat = transformation * pTrans;
@@ -3297,7 +3292,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, family, m_Doc);
+ MissingFont *dia = new MissingFont(nullptr, family, m_Doc);
dia->exec();
fontName = dia->getReplacementFont();
delete dia;
Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.h (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.h Sun Aug 5 11:24:17 2018
@@ -96,7 +96,7 @@
QString RightLineEnd;
};
QString getNodeValue(QDomNode &baseNode, QString path);
- bool convert(QString fn);
+ bool convert(const QString& fn);
bool parseFontsXML(const QDomElement& grElem);
void parseFontsXMLNode(const QDomElement& grNode);
bool parseGraphicsXML(const QDomElement& grElem);
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Sun Aug 5 11:24:17 2018
@@ -135,7 +135,7 @@
return tmp;
}
-bool OdgPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
+bool OdgPlug::import(const QString& fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
{
QString fName = fNameIn;
bool success = false;
@@ -154,7 +154,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -260,7 +260,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -291,7 +291,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -328,12 +328,11 @@
OdgPlug::~OdgPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool OdgPlug::convert(QString fn)
+bool OdgPlug::convert(const QString& fn)
{
bool retVal = true;
importedColors.clear();
@@ -3342,7 +3341,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, family, m_Doc);
+ MissingFont *dia = new MissingFont(nullptr, family, m_Doc);
dia->exec();
fontName = dia->getReplacementFont();
delete dia;
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.h (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.h Sun Aug 5 11:24:17 2018
@@ -228,7 +228,7 @@
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
- bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
+ bool import(const QString& fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
QImage readThumbnail(QString fn);
private:
@@ -314,7 +314,7 @@
AttributeValue opacityStart;
};
- bool convert(QString fn);
+ bool convert(const QString& fn);
bool parseStyleSheets(QString designMap);
bool parseStyleSheetsXML(QDomDocument &designMapDom);
bool parseDocReference(QString designMap);
Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Sun Aug 5 11:24:17 2018
@@ -283,11 +283,8 @@
drawPage = offDraw.namedItem( "draw:page" );
if (drawPage.isNull())
return QImage();
- else
- {
- isOODraw2 = true;
- drawPagePNode = body.namedItem( "office:drawing" );
- }
+ isOODraw2 = true;
+ drawPagePNode = body.namedItem( "office:drawing" );
}
else
drawPagePNode = body;
@@ -315,7 +312,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
@@ -418,11 +415,8 @@
ScMessageBox::warning( m_Doc->scMW(), CommonStrings::trWarning, tr("This document does not seem to be an OpenOffice Draw file.") );
return false;
}
- else
- {
- isOODraw2 = true;
- drawPagePNode = body.namedItem( "office:drawing" );
- }
+ isOODraw2 = true;
+ drawPagePNode = body.namedItem( "office:drawing" );
}
else
drawPagePNode = body;
@@ -569,7 +563,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -586,7 +580,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.cpp Sun Aug 5 11:24:17 2018
@@ -623,7 +623,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -729,7 +729,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -760,7 +760,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -797,8 +797,7 @@
PagesPlug::~PagesPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
Modified: trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pct/importpct.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pct/importpct.cpp Sun Aug 5 11:24:17 2018
@@ -62,7 +62,7 @@
progressDialog = nullptr;
}
-QImage PctPlug::readThumbnail(QString fName)
+QImage PctPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
@@ -79,7 +79,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset() - x;
baseY = m_Doc->currentPage()->yOffset() - y;
Elements.clear();
@@ -116,13 +116,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -145,7 +142,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -275,7 +272,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -306,7 +303,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -341,12 +338,11 @@
PctPlug::~PctPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-void PctPlug::parseHeader(QString fName, double &x, double &y, double &b, double &h)
+void PctPlug::parseHeader(const QString& fName, double &x, double &y, double &b, double &h)
{
QFile f(fName);
if (f.open(QIODevice::ReadOnly))
@@ -1219,7 +1215,7 @@
ts >> y >> x;
Coords.svgLineTo(x * resX, y * resX);
}
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
int z;
if (opCode == 0x0070)
@@ -1561,7 +1557,7 @@
QPainterPath painterPath;
painterPath.addText( currentPointT.x(), currentPointT.y(), textFont, string);
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, CurrColorStroke, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -1624,7 +1620,7 @@
if ((dh == 0) && (dv == 0))
return;
QPoint s = currentPoint;
- if (Coords.size() == 0)
+ if (Coords.empty())
Coords.svgMoveTo(s.x(), s.y());
Coords.svgLineTo(s.x()+dh * resX, s.y()+dv * resY);
currentPoint = QPoint(s.x()+dh * resX, s.y()+dv * resY);
@@ -1656,7 +1652,7 @@
if ((x == 0) && (y == 0))
return;
QPoint s = currentPoint;
- if (Coords.size() == 0)
+ if (Coords.empty())
Coords.svgMoveTo(s.x(), s.y());
Coords.svgLineTo(x * resX, y * resY);
currentPoint = QPoint(x * resX, y * resY);
Modified: trunk/Scribus/scribus/plugins/import/pct/importpct.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pct/importpct.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pct/importpct.h (original)
+++ trunk/Scribus/scribus/plugins/import/pct/importpct.h Sun Aug 5 11:24:17 2018
@@ -54,10 +54,10 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- void parseHeader(QString fName, double &x, double &y, double &b, double &h);
+ void parseHeader(const QString& fName, double &x, double &y, double &b, double &h);
bool convert(QString fn);
void parsePict(QDataStream &ts);
void alignStreamToWord(QDataStream &ts, uint len);
Modified: trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp Sun Aug 5 11:24:17 2018
@@ -128,7 +128,7 @@
else
return true;
}
- if (m_Doc == 0)
+ if (m_Doc == nullptr)
m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction activeTransaction;
bool emptyDoc = (m_Doc == nullptr);
Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp Sun Aug 5 11:24:17 2018
@@ -141,15 +141,9 @@
delete globalParams;
return image;
}
- else
- {
- delete pdfDoc;
- delete globalParams;
- return QImage();
- }
+ delete pdfDoc;
+ delete globalParams;
}
- else
- return QImage();
}
return QImage();
}
@@ -178,7 +172,7 @@
return QImage();
*/
-bool PdfPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
+bool PdfPlug::import(const QString& fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
{
#ifdef Q_OS_OSX
#if QT_VERSION >= 0x050300
@@ -201,7 +195,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw = (m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw = (m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -322,7 +316,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -339,7 +333,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -376,8 +370,7 @@
PdfPlug::~PdfPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSele;
}
@@ -983,7 +976,7 @@
delete pdfDoc;
}
delete globalParams;
- globalParams = 0;
+ globalParams = nullptr;
// qDebug() << "converting finished";
// qDebug() << "Imported" << Elements.count() << "Elements";
Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.h (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.h Sun Aug 5 11:24:17 2018
@@ -66,7 +66,7 @@
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
- bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
+ bool import(const QString& fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
QImage readThumbnail(QString fn);
QImage readPreview(int pgNum, int width, int height, int box);
enum PDF_Box_Type
Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Sun Aug 5 11:24:17 2018
@@ -92,8 +92,7 @@
LinkSubmitForm::~LinkSubmitForm()
{
- if (fileName)
- delete fileName;
+ delete fileName;
}
LinkImportData::LinkImportData(Object *actionObj)
@@ -131,16 +130,13 @@
LinkImportData::~LinkImportData()
{
- if (fileName)
- delete fileName;
+ delete fileName;
}
AnoOutputDev::~AnoOutputDev()
{
- if (m_fontName)
- delete m_fontName;
- if (m_itemText)
- delete m_itemText;
+ delete m_fontName;
+ delete m_itemText;
}
AnoOutputDev::AnoOutputDev(ScribusDoc* doc, QStringList *importedColors)
@@ -303,9 +299,9 @@
importerFlags = flags;
currentLayer = m_doc->activeLayer();
xref = nullptr;
- m_fontEngine = 0;
- m_font = 0;
- m_formWidgets = 0;
+ m_fontEngine = nullptr;
+ m_font = nullptr;
+ m_formWidgets = nullptr;
updateGUICounter = 0;
layersSetByOCG = false;
cropOffsetX = 0;
@@ -1016,7 +1012,7 @@
return retVal;
}
-void SlaOutputDev::applyTextStyle(PageItem* ite, QString fontName, QString textColor, double fontSize)
+void SlaOutputDev::applyTextStyle(PageItem* ite, const QString& fontName, const QString& textColor, double fontSize)
{
CharStyle newStyle;
newStyle.setFillColor(textColor);
@@ -1032,12 +1028,12 @@
newStyle.setFont(face);
break;
}
- else if ((face.family() == fontName) && (face.usable()) && (face.type() == ScFace::TTF))
+ if ((face.family() == fontName) && (face.usable()) && (face.type() == ScFace::TTF))
{
newStyle.setFont(face);
break;
}
- else if ((face.scName() == fontName) && (face.usable()) && (face.type() == ScFace::TTF))
+ if ((face.scName() == fontName) && (face.usable()) && (face.type() == ScFace::TTF))
{
newStyle.setFont(face);
break;
@@ -1535,43 +1531,40 @@
tmpSel->clear();
return;
}
+ PageItem *ite;
+ for (int dre = 0; dre < gElements.Items.count(); ++dre)
+ {
+ tmpSel->addItem(gElements.Items.at(dre), true);
+ m_Elements->removeAll(gElements.Items.at(dre));
+ }
+ if ((gElements.Items.count() != 1) || (gElements.isolated))
+ ite = m_doc->groupObjectsSelection(tmpSel);
else
- {
- PageItem *ite;
- for (int dre = 0; dre < gElements.Items.count(); ++dre)
- {
- tmpSel->addItem(gElements.Items.at(dre), true);
- m_Elements->removeAll(gElements.Items.at(dre));
- }
- if ((gElements.Items.count() != 1) || (gElements.isolated))
- ite = m_doc->groupObjectsSelection(tmpSel);
- else
- ite = gElements.Items.first();
- if (ite->isGroup())
- {
- ite->ClipEdited = true;
- ite->FrameType = 3;
- if (checkClip())
- {
- FPointArray out = m_currentClipPath.copy();
- out.translate(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
- out.translate(-ite->xPos(), -ite->yPos());
- ite->PoLine = out.copy();
- ite->setTextFlowMode(PageItem::TextFlowDisabled);
- m_doc->adjustItemSize(ite, true);
- m_doc->resizeGroupToContents(ite);
- ite->OldB2 = ite->width();
- ite->OldH2 = ite->height();
- }
- }
- ite->setFillTransparency(1.0 - state->getFillOpacity());
- ite->setFillBlendmode(getBlendMode(state));
- m_Elements->append(ite);
- if (m_groupStack.count() != 0)
- {
- applyMask(ite);
- m_groupStack.top().Items.append(ite);
- }
+ ite = gElements.Items.first();
+ if (ite->isGroup())
+ {
+ ite->ClipEdited = true;
+ ite->FrameType = 3;
+ if (checkClip())
+ {
+ FPointArray out = m_currentClipPath.copy();
+ out.translate(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
+ out.translate(-ite->xPos(), -ite->yPos());
+ ite->PoLine = out.copy();
+ ite->setTextFlowMode(PageItem::TextFlowDisabled);
+ m_doc->adjustItemSize(ite, true);
+ m_doc->resizeGroupToContents(ite);
+ ite->OldB2 = ite->width();
+ ite->OldH2 = ite->height();
+ }
+ }
+ ite->setFillTransparency(1.0 - state->getFillOpacity());
+ ite->setFillBlendmode(getBlendMode(state));
+ m_Elements->append(ite);
+ if (m_groupStack.count() != 0)
+ {
+ applyMask(ite);
+ m_groupStack.top().Items.append(ite);
}
}
tmpSel->clear();
@@ -2459,11 +2452,11 @@
void SlaOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool interpolate, GBool inlineImg)
{
// qDebug() << "Draw Image Mask";
- QImage * image = 0;
+ QImage * image = nullptr;
int invert_bit;
int row_stride;
int x, y, i, bit;
- unsigned char *dest = 0;
+ unsigned char *dest = nullptr;
unsigned char *buffer;
Guchar *pix;
ImageStream * imgStr = new ImageStream(str, width, 1, 1);
@@ -2627,9 +2620,9 @@
// qDebug() << "Masked Image Components" << colorMap->getNumPixelComps();
ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
imgStr->reset();
- unsigned int *dest = 0;
+ unsigned int *dest = nullptr;
unsigned char * buffer = new unsigned char[width * height * 4];
- QImage * image = 0;
+ QImage * image = nullptr;
for (int y = 0; y < height; y++)
{
dest = (unsigned int *)(buffer + y * 4 * width);
@@ -2646,7 +2639,7 @@
}
ImageStream *mskStr = new ImageStream(maskStr, maskWidth, maskColorMap->getNumPixelComps(), maskColorMap->getBits());
mskStr->reset();
- Guchar *mdest = 0;
+ Guchar *mdest = nullptr;
unsigned char * mbuffer = new unsigned char[maskWidth * maskHeight];
memset(mbuffer, 0, maskWidth * maskHeight);
for (int y = 0; y < maskHeight; y++)
@@ -2770,9 +2763,9 @@
{
ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
imgStr->reset();
- unsigned int *dest = 0;
+ unsigned int *dest = nullptr;
unsigned char * buffer = new unsigned char[width * height * 4];
- QImage * image = 0;
+ QImage * image = nullptr;
for (int y = 0; y < height; y++)
{
dest = (unsigned int *)(buffer + y * 4 * width);
@@ -2789,7 +2782,7 @@
}
ImageStream *mskStr = new ImageStream(maskStr, maskWidth, 1, 1);
mskStr->reset();
- Guchar *mdest = 0;
+ Guchar *mdest = nullptr;
int invert_bit = maskInvert ? 1 : 0;
unsigned char * mbuffer = new unsigned char[maskWidth * maskHeight];
memset(mbuffer, 0, maskWidth * maskHeight);
@@ -2921,7 +2914,7 @@
ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
// qDebug() << "Image Components" << colorMap->getNumPixelComps() << "Mask" << maskColors;
imgStr->reset();
- QImage * image = 0;
+ QImage* image = nullptr;
if (maskColors)
{
image = new QImage(width, height, QImage::Format_ARGB32);
@@ -3375,9 +3368,11 @@
if ((fontFile = m_fontEngine->getFontFile(id))) {
delete id;
- } else {
-
- if (!(fontLoc = gfxFont->locateFont(xref, 0))) {
+ }
+ else
+ {
+ if (!(fontLoc = gfxFont->locateFont(xref, nullptr)))
+ {
error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
gfxFont->getName() ? gfxFont->getName()->getCString()
: "(unnamed)");
@@ -3567,7 +3562,6 @@
err1:
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
- return;
}
#else
void SlaOutputDev::updateFont(GfxState *state)
@@ -4088,7 +4082,7 @@
tmp.setRegistrationColor(false);
if (color->getSpace() == AnnotColor::colorTransparent)
return CommonStrings::None;
- else if (color->getSpace() == AnnotColor::colorRGB)
+ if (color->getSpace() == AnnotColor::colorRGB)
{
const double *color_data = color->getValues();
double Rc = color_data[0];
Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h Sun Aug 5 11:24:17 2018
@@ -155,7 +155,7 @@
bool handleTextAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);
bool handleLinkAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);
bool handleWidgetAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);
- void applyTextStyle(PageItem* ite, QString fontName, QString textColor, double fontSize);
+ void applyTextStyle(PageItem* ite, const QString& fontName, const QString& textColor, double fontSize);
void handleActions(PageItem* ite, AnnotWidget *ano);
void startDoc(PDFDoc *doc, XRef *xrefA, Catalog *catA);
Modified: trunk/Scribus/scribus/plugins/import/pm/importpm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pm/importpm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pm/importpm.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pm/importpm.cpp Sun Aug 5 11:24:17 2018
@@ -66,7 +66,7 @@
cancel = false;
}
-QImage PmPlug::readThumbnail(QString fName)
+QImage PmPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
@@ -79,7 +79,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -116,13 +116,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -143,7 +140,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -255,12 +252,12 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
- for (int dre=0; dre<Elements.count(); ++dre)
+ for (int i=0; i<Elements.count(); ++i)
{
- tmpSel->addItem(Elements.at(dre), true);
+ tmpSel->addItem(Elements.at(i), true);
}
tmpSel->setGroupRect();
ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
@@ -268,16 +265,16 @@
m_Doc->view()->updatesOn(true);
if (importedPatterns.count() != 0)
{
- for (int cd = 0; cd < importedPatterns.count(); cd++)
+ for (int i = 0; i < importedPatterns.count(); i++)
{
- m_Doc->docPatterns.remove(importedPatterns[cd]);
+ m_Doc->docPatterns.remove(importedPatterns[i]);
}
}
if (importedColors.count() != 0)
{
- for (int cd = 0; cd < importedColors.count(); cd++)
+ for (int i = 0; i < importedColors.count(); i++)
{
- m_Doc->PageColors.remove(importedColors[cd]);
+ m_Doc->PageColors.remove(importedColors[i]);
}
}
m_Doc->m_Selection->delaySignalsOff();
@@ -286,7 +283,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -321,12 +318,11 @@
PmPlug::~PmPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool PmPlug::convert(QString fn)
+bool PmPlug::convert(const QString& fn)
{
importedColors.clear();
importedPatterns.clear();
@@ -350,7 +346,7 @@
progressDialog->close();
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"));
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -361,16 +357,16 @@
{
if (importedColors.count() != 0)
{
- for (int cd = 0; cd < importedColors.count(); cd++)
- {
- m_Doc->PageColors.remove(importedColors[cd]);
+ for (int i = 0; i < importedColors.count(); i++)
+ {
+ m_Doc->PageColors.remove(importedColors[i]);
}
}
if (importedPatterns.count() != 0)
{
- for (int cd = 0; cd < importedPatterns.count(); cd++)
- {
- m_Doc->docPatterns.remove(importedPatterns[cd]);
+ for (int i = 0; i < importedPatterns.count(); i++)
+ {
+ m_Doc->docPatterns.remove(importedPatterns[i]);
}
}
}
Modified: trunk/Scribus/scribus/plugins/import/pm/importpm.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pm/importpm.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pm/importpm.h (original)
+++ trunk/Scribus/scribus/plugins/import/pm/importpm.h Sun Aug 5 11:24:17 2018
@@ -54,10 +54,10 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- bool convert(QString fn);
+ bool convert(const QString& fn);
QList<PageItem*> Elements;
double baseX, baseY;
Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.cpp Sun Aug 5 11:24:17 2018
@@ -70,7 +70,7 @@
cancel = false;
}
-QImage PubPlug::readThumbnail(QString fName)
+QImage PubPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
@@ -83,7 +83,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -120,13 +120,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -147,7 +144,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -259,7 +256,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -290,7 +287,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -325,8 +322,7 @@
PubPlug::~PubPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
@@ -358,7 +354,7 @@
progressDialog->close();
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"));
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.h (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.h Sun Aug 5 11:24:17 2018
@@ -54,7 +54,7 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
bool convert(QString fn);
Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp Sun Aug 5 11:24:17 2018
@@ -921,7 +921,7 @@
{
Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
}
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke);
ite = m_Doc->Items->at(z);
@@ -949,7 +949,7 @@
Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
}
Coords.svgClosePath();
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
{
@@ -996,7 +996,7 @@
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
{
- fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
+ fmt->setupTargets(m_Doc, nullptr, nullptr, nullptr, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
if (m_Doc->m_Selection->count() > 0)
{
@@ -1149,7 +1149,7 @@
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
{
- fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
+ fmt->setupTargets(m_Doc, nullptr, nullptr, nullptr, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
if (m_Doc->m_Selection->count() > 0)
{
@@ -1291,7 +1291,7 @@
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
{
- fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
+ fmt->setupTargets(m_Doc, nullptr, nullptr, nullptr, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
if (m_Doc->m_Selection->count() > 0)
{
@@ -1672,7 +1672,7 @@
if (propList["style:text-position"])
{
QStringList pos = QString(propList["style:text-position"]->getStr().cstr()).split(' ', QString::SkipEmptyParts);
- if (pos.size() > 0)
+ if (!pos.empty())
{
if (pos[0] == "super")
styleEffects |= ScStyle_Superscript;
@@ -3484,7 +3484,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, family, m_Doc);
+ MissingFont *dia = new MissingFont(nullptr, family, m_Doc);
dia->exec();
fontName = dia->getReplacementFont();
delete dia;
@@ -3508,8 +3508,7 @@
s1.chop(1);
return ScCLocale::toDoubleC(s1) / 100.0;
}
- else
- return ScCLocale::toDoubleC(s1) / 100.0;
+ return ScCLocale::toDoubleC(s1) / 100.0;
}
QColor RawPainter::parseColorN( const QString &rgbColor )
Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.cpp Sun Aug 5 11:24:17 2018
@@ -61,7 +61,7 @@
progressDialog = nullptr;
}
-QImage ShapePlug::readThumbnail(QString fName)
+QImage ShapePlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
@@ -78,7 +78,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -115,17 +115,14 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
-bool ShapePlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
+bool ShapePlug::import(const QString& fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
{
QString fName = fNameIn;
bool success = false;
@@ -144,7 +141,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -259,7 +256,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -276,7 +273,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -312,8 +309,7 @@
ShapePlug::~ShapePlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.h (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.h Sun Aug 5 11:24:17 2018
@@ -52,8 +52,8 @@
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
- bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ bool import(const QString& fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
+ QImage readThumbnail(const QString& fn);
private:
void parseHeader(QString fName, double &b, double &h);
Modified: trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/sml/importsml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/sml/importsml.cpp Sun Aug 5 11:24:17 2018
@@ -60,7 +60,7 @@
progressDialog = nullptr;
}
-QImage SmlPlug::readThumbnail(QString fName)
+QImage SmlPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
@@ -77,7 +77,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -114,13 +114,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -142,7 +139,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -255,7 +252,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -272,7 +269,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -308,8 +305,7 @@
SmlPlug::~SmlPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
Modified: trunk/Scribus/scribus/plugins/import/sml/importsml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/sml/importsml.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/sml/importsml.h (original)
+++ trunk/Scribus/scribus/plugins/import/sml/importsml.h Sun Aug 5 11:24:17 2018
@@ -53,7 +53,7 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
void parseHeader(QString fName, double &b, double &h);
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Sun Aug 5 11:24:17 2018
@@ -156,7 +156,7 @@
if (!checkFlags(flags))
return false;
m_Doc = ScCore->primaryMainWindow()->doc;
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
if (filename.isEmpty())
{
flags |= lfInteractive;
@@ -237,7 +237,7 @@
// m_gc.setAutoDelete( true );
}
-QImage SVGPlug::readThumbnail(QString fName)
+QImage SVGPlug::readThumbnail(const QString& fName)
{
if (!loadData(fName))
return QImage();
@@ -251,7 +251,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(wh.width(), wh.height(), 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
m_Doc->scMW()->setScriptRunning(true);
@@ -501,7 +501,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -539,7 +539,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -937,9 +937,7 @@
bool SVGPlug::isIgnorableNodeName( const QString &n )
{
- if (n.startsWith("sodipodi") || n.startsWith("inkscape") || n == "metadata")
- return true;
- return false;
+ return n.startsWith("sodipodi") || n.startsWith("inkscape") || n == "metadata";
}
FPoint SVGPlug::parseTextPosition(const QDomElement &e, const FPoint* pos)
@@ -1267,13 +1265,13 @@
}
groupLevel--;
SvgStyle *gc = m_gc.top();
- if (clipPath.size() == 0)
- {
- if (gc->clipPath.size() != 0)
+ if (clipPath.empty())
+ {
+ if (!gc->clipPath.empty())
clipPath = gc->clipPath.copy();
}
parseFilterAttr(e, neu);
- if (gElements.count() == 0 || (gElements.count() < 2 && (clipPath.size() == 0) && (gc->Opacity == 1.0)))
+ if (gElements.count() == 0 || (gElements.count() < 2 && (clipPath.empty()) && (gc->Opacity == 1.0)))
{
// Unfortunately we have to take the long route here, or we risk crash on undo/redo
// FIXME : create group object after parsing grouped objects
@@ -1312,7 +1310,7 @@
{
neu->setXYPos(gx, gy);
neu->setWidthHeight(gw, gh);
- if (clipPath.size() != 0)
+ if (!clipPath.empty())
{
QTransform mm = gc->matrix;
neu->PoLine = clipPath.copy();
@@ -1612,7 +1610,7 @@
m_Doc->loadPict(fileName, ite);
}
}
- if (clipPath.size() != 0)
+ if (!clipPath.empty())
ite->PoLine = clipPath.copy();
clipPath.resize(0);
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
@@ -1890,7 +1888,7 @@
QPainterPath painterPath;
painterPath.addText( StartX, StartY, textFont, textString );
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
// double lineWidth = 0.0;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, gc->LWidth, textFillColor, textStrokeColor);
@@ -1935,14 +1933,11 @@
{
if (de.hasAttribute("requiredExtensions") || de.hasAttribute("requiredFeatures"))
continue;
- else if (de.hasAttribute("id") && hrefs.contains(de.attribute("id")))
+ if (de.hasAttribute("id") && hrefs.contains(de.attribute("id")))
continue;
- else
- {
- SElements = parseElement(de);
- if (SElements.count() > 0)
- break;
- }
+ SElements = parseElement(de);
+ if (SElements.count() > 0)
+ break;
}
}
return SElements;
@@ -2130,8 +2125,7 @@
s1.chop(1);
return ScCLocale::toDoubleC(s1) / 100.0;
}
- else
- return ScCLocale::toDoubleC(s1);
+ return ScCLocale::toDoubleC(s1);
}
double SVGPlug::parseFontSize(const QString& fsize)
@@ -2431,7 +2425,7 @@
iccColorFound = true;
}
}
- if (iccColorFound == false)
+ if (!iccColorFound)
return ret;
ScColor tmp;
tmp.fromQColor(color);
@@ -2448,7 +2442,7 @@
void SVGPlug::parsePA( SvgStyle *obj, const QString &command, const QString ¶ms )
{
if (command == "display")
- obj->Display = (params == "none") ? false : true;
+ obj->Display = params != "none";
else if (command == "stroke-opacity")
obj->StrokeOpacity = fromPercentage(params);
else if (command == "fill-opacity")
@@ -2858,7 +2852,6 @@
parsePA(obj, command, params);
}
}
- return;
}
void SVGPlug::parseColorStops(GradientHelper *gradient, const QDomElement &e)
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.h (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.h Sun Aug 5 11:24:17 2018
@@ -235,7 +235,7 @@
SVGPlug(ScribusDoc* doc, int flags);
~SVGPlug();
bool import(QString fname, const TransactionSettings& trSettings, int flags);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
bool loadData(QString fname);
void convert(const TransactionSettings& trSettings, int flags);
void addGraphicContext();
Modified: trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp Sun Aug 5 11:24:17 2018
@@ -316,7 +316,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -382,13 +382,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -410,7 +407,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -538,7 +535,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -569,7 +566,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -605,12 +602,11 @@
SvmPlug::~SvmPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-void SvmPlug::parseHeader(QString fName, double &x, double &y, double &b, double &h)
+void SvmPlug::parseHeader(const QString& fName, double &x, double &y, double &b, double &h)
{
QFile f(fName);
if (f.open(QIODevice::ReadOnly))
@@ -1684,12 +1680,12 @@
if (enlin.angleTo(stlin) > 180)
{
// currentDC.Coords.svgMoveTo(st.x(), st.y());
- currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) < 180 ? 1 : 0, stlin.angleTo(enlin) > 180 ? 1 : 0, en.x(), en.y());
+ currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) < 180, stlin.angleTo(enlin) > 180, en.x(), en.y());
}
else
{
// currentDC.Coords.svgMoveTo(st.x(), st.y());
- currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) > 180 ? 1 : 0, stlin.angleTo(enlin) > 180 ? 1 : 0, en.x(), en.y());
+ currentDC.Coords.svgArcTo(BoxDev.width() / 2.0, BoxDev.height() / 2.0, 0, enlin.angleTo(stlin) > 180, stlin.angleTo(enlin) > 180, en.x(), en.y());
}
currentDC.currentPoint = en;
}
@@ -1928,7 +1924,7 @@
else if (currentDC.textAlignment == ALIGN_BOTTOM)
painterPath.translate(0, fm.descent());
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorText, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -2024,7 +2020,7 @@
painterPath.translate(0, fm.descent());
FPointArray textPath;
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorText, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -3832,7 +3828,7 @@
}
FPointArray textPath;
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorFill, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -3927,7 +3923,7 @@
painterPath = bm.map(painterPath);
painterPath.translate(rect[0].x(), rect[0].y());
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, currentDC.CurrColorFill, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
Modified: trunk/Scribus/scribus/plugins/import/svm/importsvm.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/svm/importsvm.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svm/importsvm.h (original)
+++ trunk/Scribus/scribus/plugins/import/svm/importsvm.h Sun Aug 5 11:24:17 2018
@@ -145,7 +145,7 @@
QImage readThumbnail(QString fn);
private:
- void parseHeader(QString fName, double &x, double &y, double &b, double &h);
+ void parseHeader(const QString& fName, double &x, double &y, double &b, double &h);
bool convert(QString fn);
// Common functions
void aligntoQuadWord(QDataStream &ds);
Modified: trunk/Scribus/scribus/plugins/import/svm/importsvmplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/svm/importsvmplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svm/importsvmplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svm/importsvmplugin.cpp Sun Aug 5 11:24:17 2018
@@ -133,7 +133,7 @@
else
return true;
}
- if (m_Doc == 0)
+ if (m_Doc == nullptr)
m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction* activeTransaction = nullptr;
bool emptyDoc = (m_Doc == nullptr);
Modified: trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp Sun Aug 5 11:24:17 2018
@@ -41,7 +41,6 @@
UniconvImportPlugin* plug = new UniconvImportPlugin();
Q_CHECK_PTR(plug);
return plug;
- return 0;
}
void uniconvertorplugin_freePlugin(ScPlugin* plugin)
@@ -132,7 +131,7 @@
m_Doc = ScCore->primaryMainWindow()->doc;
ScribusMainWindow *mw =
- (m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ (m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
//Get a temporary filename ending in .svg (sadly
//uniconvertor has no other way of specifying the output format
Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.cpp Sun Aug 5 11:24:17 2018
@@ -121,7 +121,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -158,13 +158,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return tmp;
}
@@ -175,7 +172,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
importedColors.clear();
QByteArray f;
loadRawText(fNameIn, f);
@@ -220,7 +217,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -323,7 +320,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -340,7 +337,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -376,8 +373,7 @@
VivaPlug::~VivaPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
@@ -458,7 +454,7 @@
pgGap = parseUnit(e.attribute("vd:distance", "0"));
}
else if (e.tagName() == "vd:pageMode")
- facingPages = (e.text() == "doublePage") ? 1 : 0;
+ facingPages = e.text() == "doublePage";
else if (e.tagName() == "vd:pageFormat")
papersize = e.text();
else if (e.tagName() == "vd:pageOrientation")
@@ -532,7 +528,7 @@
tmp.setRgbColor(r, g, b);
break;
}
- else if (grs.tagName() == "vc:cmyk")
+ if (grs.tagName() == "vc:cmyk")
{
int c = grs.attribute("vc:cyan", "0").toInt();
int m = grs.attribute("vc:magenta", "0").toInt();
@@ -541,7 +537,7 @@
tmp.setColor(c, m, y, k);
break;
}
- else if (grs.tagName() == "vc:lab")
+ if (grs.tagName() == "vc:lab")
{
double L = grs.attribute("vc:l", "100").toDouble();
double a = grs.attribute("vc:a", "0").toDouble();
@@ -549,7 +545,7 @@
tmp.setLabColor(L, a, b);
break;
}
- else if (grs.tagName() == "vc:hsv")
+ if (grs.tagName() == "vc:hsv")
{
int h = grs.attribute("vc:hue", "0").toInt();
int s = grs.attribute("vc:saturation", "0").toInt();
@@ -560,7 +556,7 @@
tmp = ScColorEngine::convertToModel(tmp, m_Doc, colorModelRGB);
break;
}
- else if (grs.tagName() == "vc:registrationColor")
+ if (grs.tagName() == "vc:registrationColor")
{
seenRegC = true;
int r = e.attribute("vc:red", "0").toInt();
@@ -569,7 +565,7 @@
tmp.setRgbColor(r, g, b);
break;
}
- else if (grs.tagName() == "vc:spotColor")
+ if (grs.tagName() == "vc:spotColor")
seenSpot = true;
}
tmp.setSpotColor(seenSpot);
@@ -2357,7 +2353,7 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, family, m_Doc);
+ MissingFont *dia = new MissingFont(nullptr, family, m_Doc);
dia->exec();
fontName = dia->getReplacementFont();
delete dia;
Modified: trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp Sun Aug 5 11:24:17 2018
@@ -70,7 +70,7 @@
cancel = false;
}
-QImage VsdPlug::readThumbnail(QString fName)
+QImage VsdPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
@@ -83,7 +83,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -120,13 +120,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -147,7 +144,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -259,7 +256,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -290,7 +287,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -325,12 +322,11 @@
VsdPlug::~VsdPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool VsdPlug::convert(QString fn)
+bool VsdPlug::convert(const QString& fn)
{
importedColors.clear();
importedPatterns.clear();
@@ -360,7 +356,7 @@
progressDialog->close();
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"));
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
Modified: trunk/Scribus/scribus/plugins/import/vsd/importvsd.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/vsd/importvsd.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/vsd/importvsd.h (original)
+++ trunk/Scribus/scribus/plugins/import/vsd/importvsd.h Sun Aug 5 11:24:17 2018
@@ -54,10 +54,10 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
- bool convert(QString fn);
+ bool convert(const QString& fn);
QList<PageItem*> Elements;
double baseX, baseY;
Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp Sun Aug 5 11:24:17 2018
@@ -159,7 +159,7 @@
{
qDeleteAll(m_commands);
m_commands.clear();
- if ( m_tmpSel) delete m_tmpSel;
+ delete m_tmpSel;
if ( m_ObjHandleTab )
{
for (int i = 0; i < MAX_OBJHANDLE; ++i)
@@ -324,7 +324,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(width, height, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
m_Doc->scMW()->setScriptRunning(true);
@@ -661,7 +661,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -681,7 +681,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -698,7 +698,7 @@
return true;
}
-QList<PageItem*> WMFImport::parseWmfCommands(void)
+QList<PageItem*> WMFImport::parseWmfCommands()
{
int idx, i;
const WmfCmd* cmd;
@@ -708,7 +708,7 @@
if ( !m_Valid ) return elements;
- if ( m_ObjHandleTab ) delete[] m_ObjHandleTab;
+ delete[] m_ObjHandleTab;
m_ObjHandleTab = new WmfObjHandle* [ MAX_OBJHANDLE ];
for ( i = MAX_OBJHANDLE-1; i >= 0; i-- )
m_ObjHandleTab[ i ] = nullptr;
@@ -864,7 +864,7 @@
lineWidth = 1.0;
FPointArray paramPoints = pointsFromParam( params[0], ¶ms[1] );
FPointArray points = pointsToPolyline( paramPoints, true );
- if( paramPoints.size() > 0 )
+ if( !paramPoints.empty() )
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, fillColor, strokeColor);
PageItem* ite = m_Doc->Items->at(z);
@@ -904,7 +904,7 @@
double lineWidth = m_context.pen().width();
if (doStroke && lineWidth <= 0.0 )
lineWidth = 1.0;
- if( pointsPoly.size() > 0 )
+ if( !pointsPoly.empty() )
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, fillColor, strokeColor);
PageItem* ite = m_Doc->Items->at(z);
@@ -928,7 +928,7 @@
lineWidth = 1.0;
FPointArray paramPoints = pointsFromParam( params[0], ¶ms[1] );
FPointArray points = pointsToPolyline( paramPoints, false );
- if( paramPoints.size() > 0 )
+ if( !paramPoints.empty() )
{
int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, fillColor, strokeColor);
PageItem* ite = m_Doc->Items->at(z);
@@ -1017,7 +1017,7 @@
painterPath.arcMoveTo(x, y, xWidth, yHeight, angleStart);
painterPath.arcTo(x, y, xWidth, yHeight, angleStart, angleLength);
pointArray.fromQPainterPath(painterPath);
- if( pointArray.size() > 0 )
+ if( !pointArray.empty() )
{
int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, fillColor, strokeColor);
PageItem* ite = m_Doc->Items->at(z);
@@ -1054,7 +1054,7 @@
painterPath.arcTo (x, y, xWidth, yHeight, angleStart, angleLength);
painterPath.lineTo(firstPoint);
pointArray.fromQPainterPath(painterPath);
- if( pointArray.size() > 0 )
+ if( !pointArray.empty() )
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, fillColor, strokeColor);
PageItem* ite = m_Doc->Items->at(z);
@@ -1092,7 +1092,7 @@
painterPath.lineTo(xCenter, yCenter);
painterPath.lineTo(firstPoint);
pointArray.fromQPainterPath(painterPath);
- if( pointArray.size() > 0 )
+ if( !pointArray.empty() )
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, fillColor, strokeColor);
PageItem* ite = m_Doc->Items->at(z);
@@ -1254,7 +1254,7 @@
xpos += params[idxOffset + index - 1];
painterPath.addText(xpos, ypos, m_context.font(), textString.at(index));
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, textColor, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
@@ -1271,7 +1271,7 @@
QPainterPath painterPath;
painterPath.addText( startX, startY, m_context.font(), textString );
textPath.fromQPainterPath(painterPath);
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
double lineWidth = 0.0;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, BaseX, BaseY, 10, 10, lineWidth, textColor, CommonStrings::None);
@@ -1284,7 +1284,7 @@
m_context.restore();
}
-void WMFImport::selectObject( QList<PageItem*>& /*items*/, long, short* params )
+void WMFImport::selectObject( QList<PageItem*>& items, long num, short* params )
{
int idx = params[ 0 ];
if ( idx >= 0 && idx < MAX_OBJHANDLE && m_ObjHandleTab[ idx ] )
Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp Sun Aug 5 11:24:17 2018
@@ -133,9 +133,9 @@
{
if (!checkFlags(flags))
return false;
- if (m_Doc == 0)
+ if (m_Doc == nullptr)
m_Doc = ScCore->primaryMainWindow()->doc;
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
if (filename.isEmpty())
{
flags |= lfInteractive;
Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp Sun Aug 5 11:24:17 2018
@@ -88,7 +88,7 @@
else
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
- m_Doc->changePageProperties(0, 0, 0, 0, 72 * height, 72 * width, 72 * height, 72 * width, m_Doc->pageOrientation(), m_Doc->pageSize(), m_Doc->currentPage()->pageNr(), 0);
+ m_Doc->changePageProperties(0, 0, 0, 0, 72 * height, 72 * width, 72 * height, 72 * width, m_Doc->pageOrientation(), m_Doc->pageSize(), m_Doc->currentPage()->pageNr(), false);
}
firstLayer = true;
}
@@ -277,7 +277,7 @@
}
if (closed)
Coords.svgClosePath();
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
int z;
if (closed)
@@ -316,7 +316,7 @@
break;
}
}
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
int z;
if (fillSet)
@@ -435,7 +435,7 @@
cancel = false;
}
-QImage WpgPlug::readThumbnail(QString fName)
+QImage WpgPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
@@ -448,7 +448,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -485,13 +485,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -512,7 +509,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -624,7 +621,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -641,7 +638,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -676,8 +673,7 @@
WpgPlug::~WpgPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/wpg/importwpg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wpg/importwpg.h (original)
+++ trunk/Scribus/scribus/plugins/import/wpg/importwpg.h Sun Aug 5 11:24:17 2018
@@ -101,7 +101,7 @@
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
- QImage readThumbnail(QString fn);
+ QImage readThumbnail(const QString& fn);
private:
bool convert(QString fn);
Modified: trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/importxar.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xar/importxar.cpp Sun Aug 5 11:24:17 2018
@@ -92,7 +92,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
m_Doc->scMW()->setScriptRunning(true);
@@ -120,7 +120,7 @@
tsc.skipRawData(dataLen);
break;
}
- else if (opCode == 51)
+ if (opCode == 51)
handleComplexColor(tsc);
else
tsc.skipRawData(dataLen);
@@ -230,9 +230,9 @@
return image;
}
-bool XarPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
-{
- QString fName = fNameIn;
+bool XarPlug::import(const QString& fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
+{
+ const QString& fName = fNameIn;
bool success = false;
interactive = (flags & LoadSavePlugin::lfInteractive);
importerFlags = flags;
@@ -247,7 +247,7 @@
}
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -361,7 +361,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -392,7 +392,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -429,8 +429,7 @@
XarPlug::~XarPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
@@ -452,7 +451,7 @@
}
}
-bool XarPlug::convert(QString fn)
+bool XarPlug::convert(const QString& fn)
{
Coords.resize(0);
Coords.svgInit();
@@ -1253,7 +1252,7 @@
double xpos = 0;
if (isPathText)
{
- if (textPath.size() > 0)
+ if (!textPath.empty())
{
QPainterPath guidePath = textPath.toQPainterPath(false);
for (int a = 0; a < textLines.count(); a++)
@@ -1327,7 +1326,7 @@
Coords.fromQPainterPath(painterPath);
QPointF np = textMatrix.map(QPointF(TextX, TextY));
Coords.translate(np.x(), np.y());
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, txDat.FillCol, CommonStrings::None);
PageItem *item = m_Doc->Items->at(z);
@@ -1434,7 +1433,7 @@
double dist = qMax(gc->LineWidth, gc->LineWidth2) - (QFontMetricsF(textFont).width(txDat.itemText) / 10.0);
Coords.translate(dist, 0);
}
- if (Coords.size() > 0)
+ if (!Coords.empty())
{
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, gc->FillCol, CommonStrings::None);
PageItem *item = m_Doc->Items->at(z);
@@ -3182,7 +3181,7 @@
XarGroup gg = groupStack.top();
if (gg.clipping)
{
- if (clipCoords.size() == 0)
+ if (clipCoords.empty())
{
gc->clipPath = ite->PoLine.copy();
gc->clipPath.translate(ite->xPos(), ite->yPos());
@@ -3669,7 +3668,7 @@
groupItem->FrameType = 3;
groupItem->setTextFlowMode(PageItem::TextFlowDisabled);
groupItem->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
- if (gc->clipPath.size() > 0)
+ if (!gc->clipPath.empty())
{
groupItem->PoLine = gc->clipPath.copy();
groupItem->PoLine.translate(-minx + baseX, -miny + baseY);
Modified: trunk/Scribus/scribus/plugins/import/xar/importxar.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/xar/importxar.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/importxar.h (original)
+++ trunk/Scribus/scribus/plugins/import/xar/importxar.h Sun Aug 5 11:24:17 2018
@@ -254,13 +254,13 @@
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
- bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
+ bool import(const QString& fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
QImage readThumbnail(QString fn);
bool readColors(const QString& fileName, ColorList & colors);
private:
void parseHeader(QString fName, double &x, double &y, double &b, double &h);
- bool convert(QString fn);
+ bool convert(const QString& fn);
void parseXar(QDataStream &ts);
void handleTags(quint32 tag, quint32 dataLen, QDataStream &ts);
void createGuideLine(QDataStream &ts);
Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp Sun Aug 5 11:24:17 2018
@@ -80,7 +80,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -180,13 +180,10 @@
delete m_Doc;
return tmpImage;
}
- else
- {
- QDir::setCurrent(CurDirP);
- m_Doc->DoDrawing = true;
- m_Doc->scMW()->setScriptRunning(false);
- delete m_Doc;
- }
+ QDir::setCurrent(CurDirP);
+ m_Doc->DoDrawing = true;
+ m_Doc->scMW()->setScriptRunning(false);
+ delete m_Doc;
return QImage();
}
@@ -271,7 +268,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -393,7 +390,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -410,7 +407,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -445,12 +442,11 @@
XfigPlug::~XfigPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
}
-bool XfigPlug::parseHeader(QString fName, double &x, double &y, double &b, double &h)
+bool XfigPlug::parseHeader(const QString& fName, double &x, double &y, double &b, double &h)
{
bool found = false;
QFile f(fName);
Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfig.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfig.h (original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfig.h Sun Aug 5 11:24:17 2018
@@ -68,7 +68,7 @@
\param h double
\retval bool true if conversion was ok
*/
- bool parseHeader(QString fName, double &x, double &y, double &b, double &h);
+ bool parseHeader(const QString& fName, double &x, double &y, double &b, double &h);
void parseColor(QString data);
void useColor(int colorNum, int area_fill, bool forFill);
QVector<double> getDashValues(double linewidth, int code);
Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22609&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.cpp Sun Aug 5 11:24:17 2018
@@ -132,7 +132,7 @@
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
Elements.clear();
@@ -210,7 +210,7 @@
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+ ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
@@ -316,7 +316,7 @@
else
{
m_Doc->DragP = true;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -347,7 +347,7 @@
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
- m_Doc->DraggedElem = 0;
+ m_Doc->DraggedElem = nullptr;
m_Doc->DragElements.clear();
}
}
@@ -384,8 +384,7 @@
XpsPlug::~XpsPlug()
{
- if (progressDialog)
- delete progressDialog;
+ delete progressDialog;
delete tmpSel;
for (int a = 0; a < tempFontFiles.count(); a++)
{
@@ -1929,23 +1928,17 @@
unsigned short guid[16];
if (!parseGUID(baseName, guid))
return t;
- else
- {
- if (fontData.length() < 32)
- {
- qDebug() << "Font file is too small";
- return t;
- }
- else
- {
- // Obfuscation - xor bytes in font binary with bytes from guid (font's filename)
- const static int mapping[] = {15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 4, 5, 0, 1, 2, 3};
- for (int i = 0; i < 16; i++)
- {
- fontData[i] = fontData[i] ^ guid[mapping[i]];
- fontData[i+16] = fontData[i+16] ^ guid[mapping[i]];
- }
- }
+ if (fontData.length() < 32)
+ {
+ qDebug() << "Font file is too small";
+ return t;
+ }
+ // Obfuscation - xor bytes in font binary with bytes from guid (font's filename)
+ const static int mapping[] = {15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 4, 5, 0, 1, 2, 3};
+ for (int i = 0; i < 16; i++)
+ {
+ fontData[i] = fontData[i] ^ guid[mapping[i]];
+ fontData[i+16] = fontData[i+16] ^ guid[mapping[i]];
}
}
QFile ft(fname);
More information about the scribus-commit
mailing list