r22563 by craig - Fix some clang cleanups
scribus-commit
scribus-commit at lists.scribus.net
Mon May 28 21:25:52 UTC 2018
Author: craig
Date: Mon May 28 21:25:52 2018
New Revision: 22563
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22563
Log:
Fix some clang cleanups
Modified:
trunk/Scribus/scribus/canvas.cpp
trunk/Scribus/scribus/canvas.h
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode.h
trunk/Scribus/scribus/filewatcher.cpp
trunk/Scribus/scribus/filewatcher.h
trunk/Scribus/scribus/fpointarray.cpp
trunk/Scribus/scribus/fpointarray.h
trunk/Scribus/scribus/langmgr.cpp
trunk/Scribus/scribus/langmgr.h
trunk/Scribus/scribus/localemgr.cpp
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Mon May 28 21:25:52 2018
@@ -182,7 +182,7 @@
*/
-QPoint Canvas::canvasToLocal(FPoint p) const
+QPoint Canvas::canvasToLocal(const FPoint& p) const
{
return QPoint(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale));
@@ -213,7 +213,7 @@
}
-QPoint Canvas::canvasToGlobal(FPoint p) const
+QPoint Canvas::canvasToGlobal(const FPoint& p) const
{
return mapToParent(QPoint(0,0)) + parentWidget()->mapToGlobal(QPoint(0, 0)) + canvasToLocal(p);
}
@@ -266,7 +266,7 @@
// Tests for Finding Things:
-bool Canvas::hitsCanvasPoint(QPoint globalPoint, FPoint canvasPoint) const
+bool Canvas::hitsCanvasPoint(QPoint globalPoint, const FPoint& canvasPoint) const
{
QPoint localPoint1 = globalPoint - (mapToParent(QPoint(0,0)) + parentWidget()->mapToGlobal(QPoint(0, 0)));
QPoint localPoint2 = canvasToLocal(canvasPoint);
@@ -964,8 +964,8 @@
// QTime tim;
// tim.start();
// qDebug() << "Canvas::drawContents" << clipx << clipy << clipw << cliph<<m_viewMode.forceRedraw<<m_viewMode.operItemSelecting;
- uint docPagesCount=m_doc->Pages->count();
- ScPainter *painter=0;
+ int docPagesCount=m_doc->Pages->count();
+ ScPainter *painter=nullptr;
QImage img = QImage(clipw * devicePixelRatio(), cliph * devicePixelRatio(), QImage::Format_ARGB32_Premultiplied);
img.setDevicePixelRatio(devicePixelRatio());
painter = new ScPainter(&img, img.width(), img.height(), 1.0, 0);
@@ -1382,11 +1382,11 @@
PageItem *currItem;
ScPage* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
- uint layerCount = m_doc->layerCount();
+ int layerCount = m_doc->layerCount();
if ((layerCount > 1) && ((layer.blendMode != 0) || (layer.transparency != 1.0)) && (!layer.outlineMode))
painter->beginLayer(layer.transparency, layer.blendMode);
- uint pageFromMasterCount=page->FromMaster.count();
- for (uint a = 0; a < pageFromMasterCount; ++a)
+ int pageFromMasterCount=page->FromMaster.count();
+ for (int a = 0; a < pageFromMasterCount; ++a)
{
currItem = page->FromMaster.at(a);
if (currItem->LayerID != layer.ID)
@@ -1458,7 +1458,7 @@
qRound(clip.width() / m_viewMode.scale + 0.5), qRound(clip.height() / m_viewMode.scale + 0.5));
PageItem *currItem;
- uint layerCount = m_doc->layerCount();
+ int layerCount = m_doc->layerCount();
int docCurrPageNo=static_cast<int>(m_doc->currentPageNumber());
if ((layerCount > 1) && ((layer.blendMode != 0) || (layer.transparency != 1.0)) && (!layer.outlineMode))
painter->beginLayer(layer.transparency, layer.blendMode);
@@ -1598,7 +1598,7 @@
*/
void Canvas::drawBackgroundPageOutlines(ScPainter* painter, int clipx, int clipy, int clipw, int cliph)
{
- uint docPagesCount=m_doc->Pages->count();
+ int docPagesCount=m_doc->Pages->count();
if (PrefsManager::instance()->appPrefs.displayPrefs.showPageShadow)
{
painter->setBrush(QColor(128,128,128));
@@ -1704,12 +1704,12 @@
}
}
- else if ((currItem->asTextFrame()) && ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0)))
+ else if ((currItem->asTextFrame()) && ((currItem->nextInChain() != nullptr) || (currItem->prevInChain() != nullptr)))
{
PageItem *nextItem = currItem;
- while (nextItem != 0)
- {
- if (nextItem->prevInChain() != 0)
+ while (nextItem != nullptr)
+ {
+ if (nextItem->prevInChain() != nullptr)
nextItem = nextItem->prevInChain();
else
break;
@@ -1792,8 +1792,8 @@
}
else
{
- uint docPagesCount = m_doc->Pages->count();
- for (uint a = 0; a < docPagesCount; ++a)
+ int docPagesCount = m_doc->Pages->count();
+ for (int a = 0; a < docPagesCount; ++a)
{
ScPage *page = m_doc->Pages->at(a);
QRectF drawRect = QRectF(page->xOffset() * m_viewMode.scale, page->yOffset() * m_viewMode.scale, page->width() * m_viewMode.scale + 5, page->height() * m_viewMode.scale + 5);
@@ -1854,8 +1854,8 @@
}
else
{
- uint docPagesCount = m_doc->Pages->count();
- for (uint a = 0; a < docPagesCount; ++a)
+ int docPagesCount = m_doc->Pages->count();
+ for (int a = 0; a < docPagesCount; ++a)
{
ScPage *page = m_doc->Pages->at(a);
QRectF drawRect = QRectF(page->xOffset() * m_viewMode.scale, page->yOffset() * m_viewMode.scale, page->width() * m_viewMode.scale + 5, page->height() * m_viewMode.scale + 5);
@@ -1908,8 +1908,8 @@
}
else
{
- uint docPagesCount = m_doc->Pages->count();
- for (uint a = 0; a < docPagesCount; ++a)
+ int docPagesCount = m_doc->Pages->count();
+ for (int a = 0; a < docPagesCount; ++a)
{
ScPage *page = m_doc->Pages->at(a);
QRectF drawRect = QRectF(page->xOffset() * m_viewMode.scale, page->yOffset() * m_viewMode.scale, page->width() * m_viewMode.scale + 5, page->height() * m_viewMode.scale + 5);
@@ -2036,8 +2036,8 @@
}
else
{
- uint docPagesCount = m_doc->Pages->count();
- for (uint a = 0; a < docPagesCount; ++a)
+ int docPagesCount = m_doc->Pages->count();
+ for (int a = 0; a < docPagesCount; ++a)
{
ScPage *page = m_doc->Pages->at(a);
QRectF drawRect = QRectF(page->xOffset() * m_viewMode.scale, page->yOffset() * m_viewMode.scale, page->width() * m_viewMode.scale + 5, page->height() * m_viewMode.scale + 5);
@@ -2087,8 +2087,8 @@
}
else
{
- uint docPagesCount = m_doc->Pages->count();
- for (uint a = 0; a < docPagesCount; ++a)
+ int docPagesCount = m_doc->Pages->count();
+ for (int a = 0; a < docPagesCount; ++a)
{
ScPage *page = m_doc->Pages->at(a);
QRectF drawRect = QRectF(page->xOffset() * m_viewMode.scale, page->yOffset() * m_viewMode.scale, page->width() * m_viewMode.scale + 5, page->height() * m_viewMode.scale + 5);
@@ -2137,8 +2137,8 @@
}
else
{
- uint docPagesCount = m_doc->Pages->count();
- for (uint a = 0; a < docPagesCount; ++a)
+ int docPagesCount = m_doc->Pages->count();
+ for (int a = 0; a < docPagesCount; ++a)
{
ScPage *page = m_doc->Pages->at(a);
if (page == m_doc->currentPage())
@@ -2193,14 +2193,14 @@
}
else
{
- while (nextItem != 0)
- {
- if (nextItem->prevInChain() != 0)
+ while (nextItem != nullptr)
+ {
+ if (nextItem->prevInChain() != nullptr)
nextItem = nextItem->prevInChain();
else
break;
}
- while (nextItem != 0)
+ while (nextItem != nullptr)
{
if (nextItem->nextInChain() != nullptr)
{
@@ -2328,7 +2328,7 @@
void Canvas::calculateFrameLinkPoints(PageItem *pi1, PageItem *pi2, FPoint & start, FPoint & end)
{
- if (pi1==0 || pi2==0)
+ if (pi1==nullptr || pi2==nullptr)
return;
//Calculate the link points of the frames
double x11 = pi1->xPos();
Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h (original)
+++ trunk/Scribus/scribus/canvas.h Mon May 28 21:25:52 2018
@@ -150,8 +150,8 @@
double scale() const { return m_viewMode.scale; }
void setScale(double scale);
- QPoint canvasToLocal(FPoint p) const;
- QPoint canvasToGlobal(FPoint p) const;
+ QPoint canvasToLocal(const FPoint& p) const;
+ QPoint canvasToGlobal(const FPoint& p) const;
QPoint canvasToLocal(QPointF p) const;
QPoint canvasToGlobal(QPointF p) const;
QRect canvasToLocal(QRectF p) const;
@@ -163,7 +163,7 @@
// FPoint globalToCanvas(QPointF p) const;
QRectF globalToCanvas(QRect p) const;
// QRectF globalToCanvas(QRectF p) const;
- bool hitsCanvasPoint(QPoint globalPoint, FPoint canvasPoint) const;
+ bool hitsCanvasPoint(QPoint globalPoint, const FPoint& canvasPoint) const;
bool hitsCanvasPoint(QPoint globalPoint, QPointF canvasPoint) const;
bool hitsCanvasPoint(FPoint globalPoint, QPointF canvasPoint) const;
QRect exposedRect() const;
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Mon May 28 21:25:52 2018
@@ -285,7 +285,7 @@
psx->setClipRegion(QRegion ( m_canvas->exposedRect() ) );
if (m_doc->m_Selection->isMultipleSelection())
{
- PageItem *curItem(0);
+ PageItem *curItem(nullptr);
for(int a=0; a<m_doc->m_Selection->count(); ++a)
{
curItem = m_doc->m_Selection->itemAt(a);
@@ -296,9 +296,9 @@
// items inside a a multi
if (m_doc->m_Selection->count() > 1)
{
- uint docSelectionCount = m_doc->m_Selection->count();
+ int docSelectionCount = m_doc->m_Selection->count();
PageItem *currItem;
- for (uint a=0; a<docSelectionCount; ++a)
+ for (int a=0; a<docSelectionCount; ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
if (!m_doc->Items->contains(currItem))
@@ -356,9 +356,9 @@
}
else if (m_doc->m_Selection->count() != 0)
{
- uint docSelectionCount = m_doc->m_Selection->count();
+ int docSelectionCount = m_doc->m_Selection->count();
PageItem *currItem;
- for (uint a = 0; a < docSelectionCount; ++a)
+ for (int a = 0; a < docSelectionCount; ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
psx->save();
@@ -578,7 +578,7 @@
p->setClipping(true);
p->setClipRect(QRectF(0.0, 0.0, currItem->visualWidth(), currItem->visualHeight()));
PageItem_Group* gItem = currItem->asGroupFrame();
- uint itemCountG = gItem->groupItemList.count();
+ int itemCountG = gItem->groupItemList.count();
if (itemCountG < m_canvas->moveWithFullOutlinesThreshold)
{
if (gItem->imageFlippedH())
@@ -656,12 +656,12 @@
double x, y, w, h;
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
- uint docSelectionCount = m_doc->m_Selection->count();
+ int docSelectionCount = m_doc->m_Selection->count();
if (docSelectionCount < m_canvas->moveWithBoxesOnlyThreshold)
{
PageItem *currItem;
// p->translate(x, y);
- for (uint a=0; a<docSelectionCount; ++a)
+ for (int a=0; a<docSelectionCount; ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
if (!m_doc->Items->contains(currItem))
Modified: trunk/Scribus/scribus/canvasmode.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/canvasmode.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode.h (original)
+++ trunk/Scribus/scribus/canvasmode.h Mon May 28 21:25:52 2018
@@ -142,7 +142,7 @@
void setModeCursor();
/** main canvas modes don't have a delegate */
- virtual CanvasMode* delegate() { return 0; }
+ virtual CanvasMode* delegate() { return nullptr; }
ScribusView* view() const { return m_view; }
virtual ~CanvasMode();
@@ -168,7 +168,7 @@
QMap<QString,QBrush> m_brush;
bool m_keyRepeat;
- bool m_arrowKeyDown;
+ bool m_arrowKeyDown;
//FPoint m_mousePointDoc;
};
Modified: trunk/Scribus/scribus/filewatcher.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/filewatcher.cpp
==============================================================================
--- trunk/Scribus/scribus/filewatcher.cpp (original)
+++ trunk/Scribus/scribus/filewatcher.cpp Mon May 28 21:25:52 2018
@@ -54,7 +54,7 @@
return m_timeOut;
}
-void FileWatcher::addFile(QString fileName, bool fast, ScribusDoc* doc)
+void FileWatcher::addFile(const QString& fileName, bool fast, ScribusDoc* doc)
{
if (fileName.isEmpty())
{
@@ -81,7 +81,7 @@
m_watchTimer->start(m_timeOut);
}
-void FileWatcher::removeFile(QString fileName)
+void FileWatcher::removeFile(const QString& fileName)
{
m_watchTimer->stop();
if (m_watchedFiles.contains(fileName))
@@ -94,12 +94,12 @@
m_watchTimer->start(m_timeOut);
}
-void FileWatcher::addDir(QString fileName, bool fast)
+void FileWatcher::addDir(const QString& fileName, bool fast)
{
addFile(fileName, fast);
}
-void FileWatcher::removeDir(QString fileName)
+void FileWatcher::removeDir(const QString& fileName)
{
removeFile(fileName);
}
@@ -241,7 +241,7 @@
m_watchedFiles.clear();
else
{
- for( int i=0; i<toRemove.count(); ++i)
+ for(int i=0; i<toRemove.count(); ++i)
m_watchedFiles.remove(toRemove[i]);
m_stateFlags &= ~AddRemoveBlocked;
m_stateFlags &= ~TimerStopped;
Modified: trunk/Scribus/scribus/filewatcher.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/filewatcher.h
==============================================================================
--- trunk/Scribus/scribus/filewatcher.h (original)
+++ trunk/Scribus/scribus/filewatcher.h Mon May 28 21:25:52 2018
@@ -35,13 +35,13 @@
public slots:
//Add a file to the watch list for monitoring
- void addFile(QString fileName, bool fast = false, ScribusDoc* doc=0); //see struct note for doc var
+ void addFile(const QString& fileName, bool fast = false, ScribusDoc* doc=nullptr); //see struct note for doc var
//Remove a file from the watch list
- void removeFile(QString fileName);
+ void removeFile(const QString& fileName);
//Add a directory to the watch list for monitoring
- void addDir(QString fileName, bool fast = false);
+ void addDir(const QString& fileName, bool fast = false);
//Remove a directory from the watch list
- void removeDir(QString fileName);
+ void removeDir(const QString& fileName);
//Start the watcher's timer for file monitoring
void start();
//Stop the watcher's timer
Modified: trunk/Scribus/scribus/fpointarray.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/fpointarray.cpp
==============================================================================
--- trunk/Scribus/scribus/fpointarray.cpp (original)
+++ trunk/Scribus/scribus/fpointarray.cpp Mon May 28 21:25:52 2018
@@ -238,7 +238,7 @@
return FPoint(maxx - minx,maxy - miny);
}
-void FPointArray::map( QTransform m )
+void FPointArray::map( const QTransform& m )
{
const double m11 = m.m11();
const double m12 = m.m12();
@@ -296,7 +296,7 @@
QVector<FPoint>::append(FPoint(x, y));
}
-void FPointArray::addPoint(FPoint p)
+void FPointArray::addPoint(const FPoint& p)
{
QVector<FPoint>::append(p);
}
@@ -332,7 +332,7 @@
QVector<FPoint>::append(FPoint(x4, y4));
}
-void FPointArray::addQuadPoint(FPoint p1, FPoint p2, FPoint p3, FPoint p4)
+void FPointArray::addQuadPoint(const FPoint& p1, const FPoint& p2, const FPoint& p3, const FPoint& p4)
{
QVector<FPoint>::append(p1);
QVector<FPoint>::append(p2);
@@ -403,9 +403,9 @@
// Calculate derivative if necessary.
FPoint d;
if( tn || n )
- pointDerivativesAt( seg, t, p, &d, 0L );
+ pointDerivativesAt( seg, t, p, &d, nullptr );
else
- pointDerivativesAt( seg, t, p, 0L, 0L );
+ pointDerivativesAt( seg, t, p, nullptr, nullptr );
// Normalize derivative.
if( tn || n )
{
Modified: trunk/Scribus/scribus/fpointarray.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/fpointarray.h
==============================================================================
--- trunk/Scribus/scribus/fpointarray.h (original)
+++ trunk/Scribus/scribus/fpointarray.h Mon May 28 21:25:52 2018
@@ -61,7 +61,7 @@
void scale( double sx, double sy );
QRectF boundingRect();
FPoint WidthHeight() const;
- void map(QTransform m);
+ void map(const QTransform& m);
FPointArray &operator=( const FPointArray &a );
FPointArray copy() const;
void setMarker();
@@ -69,10 +69,10 @@
bool isMarkerI(ConstIterator p) const;
bool isMarkerD(double x, double y) const;
void addPoint(double x, double y);
- void addPoint(FPoint p);
+ void addPoint(const FPoint& p);
bool hasLastQuadPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) const;
void addQuadPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4);
- void addQuadPoint(FPoint p1, FPoint p2, FPoint p3, FPoint p4);
+ void addQuadPoint(const FPoint& p1, const FPoint& p2, const FPoint& p3, const FPoint& p4);
double lenPathSeg(int seg) const;
double lenPathDist(int seg, double t1, double t2) const;
void pointTangentNormalAt( int seg, double t, FPoint* p, FPoint* tn, FPoint* n ) const;
Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Mon May 28 21:25:52 2018
@@ -33,9 +33,9 @@
#include "langmgr.h"
#include "scpaths.h"
-LanguageManager * LanguageManager::m_instance = 0;
-
-LanguageManager * LanguageManager::instance()
+LanguageManager* LanguageManager::m_instance = nullptr;
+
+LanguageManager* LanguageManager::instance()
{
if(!m_instance)
{
@@ -50,7 +50,7 @@
{
if (m_instance)
delete m_instance;
- m_instance = 0;
+ m_instance = nullptr;
}
void LanguageManager::languageChange()
@@ -657,7 +657,7 @@
QDir dir(path , "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
if (dir.exists() && (dir.count() != 0))
{
- for (uint i = 0; i < dir.count(); ++i)
+ for (int i = 0; i < dir.count(); ++i)
{
QFileInfo file(path + dir[i]);
if (file.suffix().toLower() == "qm")
@@ -773,7 +773,7 @@
return "";
}
-const QString LanguageManager::getAbbrevFromLang(QString lang, bool useInstalled)
+const QString LanguageManager::getAbbrevFromLang(const QString& lang, bool useInstalled)
{
for (int i = 0; i < m_langTable.size(); ++i)
{
@@ -792,7 +792,7 @@
return "";
}
-const QString LanguageManager::getLangFromTransLang(QString transLang)
+const QString LanguageManager::getLangFromTransLang(const QString& transLang)
{
for (int i = 0; i < m_langTable.size(); ++i)
{
@@ -802,7 +802,7 @@
return "";
}
-const QString LanguageManager::getTransLangFromLang(QString lang)
+const QString LanguageManager::getTransLangFromLang(const QString& lang)
{
for (int i = 0; i < m_langTable.size(); ++i)
{
@@ -831,7 +831,7 @@
return "";
}
-const QString LanguageManager::getShortAbbrevFromAbbrevDecomposition(QString langAbbrev)
+const QString LanguageManager::getShortAbbrevFromAbbrevDecomposition(const QString& langAbbrev)
{
int tIndex = langTableIndex(langAbbrev);
if (tIndex >= 0)
@@ -848,7 +848,7 @@
return "";
}
-const QString LanguageManager::getAlternativeAbbrevfromAbbrev(QString langAbbrev)
+const QString LanguageManager::getAlternativeAbbrevfromAbbrev(const QString& langAbbrev)
{
int i=langTableIndex(langAbbrev);
if (i!=-1)
@@ -856,7 +856,7 @@
return "";
}
-QStringList LanguageManager::getAbbrevDecomposition(QString langAbbrev)
+QStringList LanguageManager::getAbbrevDecomposition(const QString& langAbbrev)
{
QStringList abbrevs;
abbrevs.append(langAbbrev);
@@ -973,7 +973,7 @@
f.close();
}
-QString LanguageManager::numericSequence(QString seq)
+QString LanguageManager::numericSequence(const QString& seq)
{
QString retSeq;
const int nsBengali=0,nsDevanagari=1,nsGujarati=2,nsGurumukhi=3,nsKannada=4,nsMalayalam=5,nsOriya=6,nsTamil=7,nsTelugu=8,nsTibetan=9,nsLepcha=10;
Modified: trunk/Scribus/scribus/langmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/langmgr.h
==============================================================================
--- trunk/Scribus/scribus/langmgr.h (original)
+++ trunk/Scribus/scribus/langmgr.h Mon May 28 21:25:52 2018
@@ -47,19 +47,19 @@
QStringList languageList(bool getTranslated=true);
const QString getLangFromAbbrev(QString, bool getTranslated=true);
- const QString getAbbrevFromLang(QString, bool useInstalled=true);
- const QString getLangFromTransLang(QString transLang);
- const QString getTransLangFromLang(QString lang);
+ const QString getAbbrevFromLang(const QString&, bool useInstalled=true);
+ const QString getLangFromTransLang(const QString& transLang);
+ const QString getTransLangFromLang(const QString& lang);
const QString getShortAbbrevFromAbbrev(QString langAbbrev);
- const QString getShortAbbrevFromAbbrevDecomposition(QString langAbbrev);
- const QString getAlternativeAbbrevfromAbbrev(QString langAbbrev);
- QStringList getAbbrevDecomposition(QString langAbbrev);
+ const QString getShortAbbrevFromAbbrevDecomposition(const QString& langAbbrev);
+ const QString getAlternativeAbbrevfromAbbrev(const QString& langAbbrev);
+ QStringList getAbbrevDecomposition(const QString& langAbbrev);
void fillInstalledStringList(QStringList *stringListToFill);
void fillInstalledGUIStringList(QStringList *stringListToFill);
void fillInstalledHyphStringList(QStringList *stringListToFill);
void fillInstalledSpellStringList(QStringList *stringListToFill);
void printInstalledList();
- QString numericSequence(QString seq);
+ QString numericSequence(const QString& seq);
bool findSpellingDictionaries(QStringList& sl);
void findSpellingDictionarySets(QStringList& dictionaryPaths, QMap<QString, QString>& dictionaryMap);
bool findHyphDictionaries(QStringList& sl);
Modified: trunk/Scribus/scribus/localemgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/localemgr.cpp
==============================================================================
--- trunk/Scribus/scribus/localemgr.cpp (original)
+++ trunk/Scribus/scribus/localemgr.cpp Mon May 28 21:25:52 2018
@@ -32,7 +32,7 @@
#include "localemgr.h"
#include "scpaths.h"
-LocaleManager * LocaleManager::m_instance = 0;
+LocaleManager * LocaleManager::m_instance = nullptr;
LocaleManager * LocaleManager::instance()
{
@@ -49,7 +49,7 @@
{
if (m_instance)
delete m_instance;
- m_instance = 0;
+ m_instance = nullptr;
}
void LocaleManager::init()
@@ -102,10 +102,9 @@
QString LocaleManager::pageSizeForLocale(const QString& locale)
{
- QString selectedLocale(locale);
for (int i = 0; i < m_localeTable.size(); ++i)
{
- if (m_localeTable[i].m_locale==selectedLocale)
+ if (m_localeTable[i].m_locale==locale)
return m_localeTable[i].m_pageSize;
}
@@ -115,16 +114,15 @@
return "A4";
else
return "Letter";
- qFatal("Page Size not found in LocaleManager");
- return "";
+// qFatal("Page Size not found in LocaleManager");
+// return "";
}
QString LocaleManager::unitForLocale(const QString &locale)
{
- QString selectedLocale(locale);
for (int i = 0; i < m_localeTable.size(); ++i)
{
- if (m_localeTable[i].m_locale==selectedLocale)
+ if (m_localeTable[i].m_locale==locale)
return m_localeTable[i].m_unit;
}
//qDebug()<<"No definition for locale: "<<selectedLocale;
@@ -133,8 +131,8 @@
return "mm";
else
return "in";
- qFatal("Unit not found in LocaleManager");
- return "";
+// qFatal("Unit not found in LocaleManager");
+// return "";
}
LocaleManager::~LocaleManager()
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Mon May 28 21:25:52 2018
@@ -39,7 +39,6 @@
#include <cassert>
#include <qdrawutil.h>
#include <sstream>
-
#include "appmodes.h"
#include "canvas.h"
@@ -93,7 +92,9 @@
PageItem::PageItem(const PageItem & other)
: QObject(other.parent()),
- UndoObject(other), SingleObservable<PageItem>(other.m_Doc->itemsChanged()), TextContext(this),
+ UndoObject(other),
+ SingleObservable<PageItem>(other.m_Doc->itemsChanged()),
+ TextContext(this),
// 200 attributes! That is madness, or to quote some famous people from Kriquet:
// "THAT ALL HAS TO GO!"
@@ -416,8 +417,8 @@
lineTransparencyVal(0.0),
fillBlendmodeVal(0),
lineBlendmodeVal(0),
- m_ImageIsFlippedH(0),
- m_ImageIsFlippedV(0),
+ m_ImageIsFlippedH(false),
+ m_ImageIsFlippedV(false),
m_Locked(false),
m_SizeLocked(false),
m_SizeHLocked(false),
@@ -427,8 +428,8 @@
Parent = nullptr;
m_Doc = pa;
QString tmp;
- BackBox = 0;
- NextBox = 0;
+ BackBox = nullptr;
+ NextBox = nullptr;
gXpos = oldXpos = m_xPos = x;
gYpos = oldYpos = m_yPos = y;
//CB Surely we can remove some of these?
@@ -834,15 +835,15 @@
firstLineOffsetP = FLOPRealGlyphHeight;
Cols = m_Doc->itemToolPrefs().textColumns;
ColGap = m_Doc->itemToolPrefs().textColumnGap;
- LeftLink = 0;
- RightLink = 0;
- TopLink = 0;
- BottomLink = 0;
+ LeftLink = nullptr;
+ RightLink = nullptr;
+ TopLink = nullptr;
+ BottomLink = nullptr;
LeftLinkID = 0;
RightLinkID = 0;
TopLinkID = 0;
BottomLinkID = 0;
- LeftLine = 0;
+ LeftLine = false;
RightLine = false;
TopLine = false;
BottomLine = false;
@@ -890,7 +891,7 @@
hatchForeground = "Black";
hatchForegroundQ = qcol;
selectedMeshControlPoint=0;
- snapToPatchGrid=0;
+ snapToPatchGrid=false;
gridOffset_=0.0;
gridValue_=0.0;
FrameOnly=false;
@@ -1264,7 +1265,7 @@
QColor color(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor);
if ((isBookmark) || (m_isAnnotation))
color = PrefsManager::instance()->appPrefs.displayPrefs.frameAnnotationColor;
- if ((BackBox != 0) || (NextBox != 0))
+ if ((BackBox != nullptr) || (NextBox != nullptr))
color = PrefsManager::instance()->appPrefs.displayPrefs.frameLinkColor;
if (m_Locked)
color = PrefsManager::instance()->appPrefs.displayPrefs.frameLockColor;
@@ -1438,11 +1439,11 @@
void PageItem::dropLinks()
{
// update auto pointers
- if (isAutoText && NextBox == 0)
+ if (isAutoText && NextBox == nullptr)
{
m_Doc->LastAuto = BackBox;
}
- if (isAutoText && BackBox == 0)
+ if (isAutoText && BackBox == nullptr)
{
m_Doc->FirstAuto = NextBox;
}
@@ -1451,7 +1452,7 @@
// leave text in remaining chain
PageItem* before = BackBox;
PageItem* after = NextBox;
- if (after == 0 && before == 0)
+ if (after == nullptr && before == nullptr)
return;
itemText = StoryText(m_Doc);
@@ -1487,7 +1488,7 @@
bool PageItem::hasLinks() const
{
- return (BackBox != 0 || NextBox != 0);
+ return (BackBox != nullptr || NextBox != nullptr);
}
//unlink selected frame from text chain
@@ -2562,7 +2563,7 @@
return retImg;
}
-void PageItem::SetQColor(QColor *tmp, QString colorName, double shad)
+void PageItem::SetQColor(QColor *tmp, const QString& colorName, double shad)
{
if (colorName == CommonStrings::None)
return;
@@ -2576,7 +2577,7 @@
}
}
-void PageItem::DrawPolyL(QPainter *p, QPolygon pts)
+void PageItem::DrawPolyL(QPainter *p, const QPolygon& pts)
{
if (Segments.count() != 0)
{
@@ -2622,7 +2623,8 @@
}
}
-void PageItem::setMaskGradient(VGradient grad){
+void PageItem::setMaskGradient(const VGradient& grad)
+{
if (mask_gradient==grad)
return;
if (UndoManager::undoEnabled())
@@ -2635,7 +2637,8 @@
mask_gradient=grad;
}
-void PageItem::setFillGradient(VGradient grad){
+void PageItem::setFillGradient(const VGradient& grad)
+{
if (fill_gradient==grad)
return;
if (UndoManager::undoEnabled())
@@ -2648,7 +2651,8 @@
fill_gradient=grad;
}
-void PageItem::setStrokeGradient(VGradient grad){
+void PageItem::setStrokeGradient(const VGradient& grad)
+{
if (stroke_gradient==grad)
return;
if (UndoManager::undoEnabled())
@@ -2675,7 +2679,7 @@
GrControl4 = c4;
}
-void PageItem::setDiamondGeometry(FPoint c1, FPoint c2, FPoint c3, FPoint c4, FPoint c5)
+void PageItem::setDiamondGeometry(const FPoint& c1, const FPoint& c2, const FPoint& c3, const FPoint& c4, const FPoint& c5)
{
GrControl1 = c1;
GrControl2 = c2;
@@ -2880,7 +2884,7 @@
trans.commit();
}
-void PageItem::get4ColorGeometry(FPoint &c1, FPoint &c2, FPoint &c3, FPoint &c4)
+void PageItem::get4ColorGeometry(FPoint& c1, FPoint& c2, FPoint& c3, FPoint& c4)
{
c1 = GrControl1;
c2 = GrControl2;
@@ -2904,7 +2908,7 @@
col4 = GrColorP4;
}
-void PageItem::setMeshPointColor(int x, int y, QString color, int shade, double transparency, bool forPatch)
+void PageItem::setMeshPointColor(int x, int y, const QString& color, int shade, double transparency, bool forPatch)
{
QString MColor(color);
QColor MQColor;
@@ -4275,7 +4279,7 @@
if (UndoManager::undoEnabled())
{
- SimpleState *ss = new SimpleState(Um::Overprint, 0, Um::IGroup);
+ SimpleState *ss = new SimpleState(Um::Overprint, nullptr, Um::IGroup);
ss->set("OVERPRINT", val);
undoManager->action(this, ss);
}
@@ -4289,7 +4293,7 @@
if (UndoManager::undoEnabled())
{
- SimpleState *ss = new SimpleState(Um::SoftShadow, 0, Um::IGroup);
+ SimpleState *ss = new SimpleState(Um::SoftShadow, nullptr, Um::IGroup);
ss->set("SOFT_SHADOW");
ss->set("NEW_VALUE", val);
ss->set("OLD_VALUE", m_hasSoftShadow);
@@ -4305,7 +4309,7 @@
if (UndoManager::undoEnabled())
{
- SimpleState *ss = new SimpleState(Um::SoftShadowColor, 0, Um::IGroup);
+ SimpleState *ss = new SimpleState(Um::SoftShadowColor, nullptr, Um::IGroup);
ss->set("SOFT_SHADOW_COLOR");
ss->set("NEW_VALUE", val);
ss->set("OLD_VALUE", m_softShadowColor);
@@ -4321,7 +4325,7 @@
if (UndoManager::undoEnabled())
{
- SimpleState *ss = new SimpleState(Um::SoftShadowShade, 0, Um::IGroup);
+ SimpleState *ss = new SimpleState(Um::SoftShadowShade, nullptr, Um::IGroup);
ss->set("SOFT_SHADOW_SHADE");
ss->set("NEW_VALUE", val);
ss->set("OLD_VALUE", m_softShadowShade);
@@ -4337,7 +4341,7 @@
if (UndoManager::undoEnabled())
{
- SimpleState *ss = new SimpleState(Um::SoftShadowBlurRadius, 0, Um::IGroup);
+ SimpleState *ss = new SimpleState(Um::SoftShadowBlurRadius, nullptr, Um::IGroup);
ss->set("SOFT_SHADOW_BLUR_RADIUS");
ss->set("NEW_VALUE", val);
ss->set("OLD_VALUE", m_softShadowBlurRadius);
@@ -7997,7 +8001,7 @@
GrTypeStroke = val;
}
-void PageItem::setGradientCol1(QString val)
+void PageItem::setGradientCol1(const QString& val)
{
if (GrColorP1==val)
return;
@@ -8012,7 +8016,7 @@
GrColorP1 = val;
}
-void PageItem::setGradientCol2(QString val)
+void PageItem::setGradientCol2(const QString& val)
{
if (GrColorP2==val)
return;
@@ -8027,7 +8031,7 @@
GrColorP2 = val;
}
-void PageItem::setGradientCol3(QString val)
+void PageItem::setGradientCol3(const QString& val)
{
if (GrColorP3==val)
return;
@@ -8042,7 +8046,7 @@
GrColorP3 = val;
}
-void PageItem::setGradientCol4(QString val)
+void PageItem::setGradientCol4(const QString& val)
{
if (GrColorP4==val)
return;
@@ -8177,7 +8181,7 @@
GrCol4transp = val;
}
-void PageItem::setGradientColor1(QColor val)
+void PageItem::setGradientColor1(const QColor& val)
{
if (GrColorP1QColor ==val)
return;
@@ -8191,7 +8195,7 @@
GrColorP1QColor = val;
}
-void PageItem::setGradientColor2(QColor val)
+void PageItem::setGradientColor2(const QColor& val)
{
if (GrColorP2QColor ==val)
return;
@@ -8205,7 +8209,7 @@
GrColorP2QColor = val;
}
-void PageItem::setGradientColor3(QColor val)
+void PageItem::setGradientColor3(const QColor& val)
{
if (GrColorP3QColor ==val)
return;
@@ -8219,7 +8223,7 @@
GrColorP3QColor = val;
}
-void PageItem::setGradientColor4(QColor val)
+void PageItem::setGradientColor4(const QColor& val)
{
if (GrColorP4QColor ==val)
return;
@@ -8492,7 +8496,8 @@
GrMaskSkew = val;
}
-void PageItem::setGradientControl1(FPoint val){
+void PageItem::setGradientControl1(const FPoint& val)
+{
if (GrControl1==val)
return;
if (UndoManager::undoEnabled())
@@ -8505,7 +8510,8 @@
GrControl1 = val;
}
-void PageItem::setGradientControl2(FPoint val){
+void PageItem::setGradientControl2(const FPoint& val)
+{
if (GrControl2==val)
return;
if (UndoManager::undoEnabled())
@@ -8518,7 +8524,8 @@
GrControl2 = val;
}
-void PageItem::setGradientControl3(FPoint val){
+void PageItem::setGradientControl3(const FPoint& val)
+{
if (GrControl3==val)
return;
if (UndoManager::undoEnabled())
@@ -8531,7 +8538,8 @@
GrControl3 = val;
}
-void PageItem::setGradientControl4(FPoint val){
+void PageItem::setGradientControl4(const FPoint& val)
+{
if (GrControl4==val)
return;
if (UndoManager::undoEnabled())
@@ -8544,7 +8552,8 @@
GrControl4 = val;
}
-void PageItem::setGradientControl5(FPoint val){
+void PageItem::setGradientControl5(const FPoint& val)
+{
if (GrControl5==val)
return;
if (UndoManager::undoEnabled())
@@ -8557,7 +8566,8 @@
GrControl5 = val;
}
-void PageItem::setGradientStrokeScale(double val){
+void PageItem::setGradientStrokeScale(double val)
+{
if (GrStrokeScale==val)
return;
if (UndoManager::undoEnabled())
@@ -8571,7 +8581,8 @@
GrStrokeScale = val;
}
-void PageItem::setGradientStrokeSkew(double val){
+void PageItem::setGradientStrokeSkew(double val)
+{
if (GrStrokeSkew==val)
return;
if (UndoManager::undoEnabled())
@@ -8585,7 +8596,8 @@
GrStrokeSkew = val;
}
-void PageItem::setGradientStrokeFocalX(double val){
+void PageItem::setGradientStrokeFocalX(double val)
+{
if (GrStrokeFocalX==val)
return;
if (UndoManager::undoEnabled())
@@ -8599,7 +8611,8 @@
GrStrokeFocalX = val;
}
-void PageItem::setGradientStrokeFocalY(double val){
+void PageItem::setGradientStrokeFocalY(double val)
+{
if (GrStrokeFocalY==val)
return;
if (UndoManager::undoEnabled())
@@ -8613,7 +8626,8 @@
GrStrokeFocalY = val;
}
-void PageItem::setGradientStrokeStartX(double val){
+void PageItem::setGradientStrokeStartX(double val)
+{
if (GrStrokeStartX==val)
return;
if (UndoManager::undoEnabled())
@@ -8627,7 +8641,8 @@
GrStrokeStartX = val;
}
-void PageItem::setGradientStrokeStartY(double val){
+void PageItem::setGradientStrokeStartY(double val)
+{
if (GrStrokeStartY==val)
return;
if (UndoManager::undoEnabled())
@@ -8641,7 +8656,8 @@
GrStrokeStartY = val;
}
-void PageItem::setGradientStrokeEndX(double val){
+void PageItem::setGradientStrokeEndX(double val)
+{
if (GrStrokeEndX==val)
return;
if (UndoManager::undoEnabled())
@@ -8655,7 +8671,8 @@
GrStrokeEndX = val;
}
-void PageItem::setGradientStrokeEndY(double val){
+void PageItem::setGradientStrokeEndY(double val)
+{
if (GrStrokeEndY==val)
return;
if (UndoManager::undoEnabled())
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22563&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Mon May 28 21:25:52 2018
@@ -416,8 +416,8 @@
const CharStyle& currentCharStyle() const;
/// Return current text properties (current char + paragraph properties)
virtual void currentTextProps(ParagraphStyle& parStyle) const;
- void SetQColor(QColor *tmp, QString farbe, double shad);
- void DrawPolyL(QPainter *p, QPolygon pts);
+ void SetQColor(QColor *tmp, const QString& farbe, double shad);
+ void DrawPolyL(QPainter *p, const QPolygon& pts);
const FPointArray shape() const { return PoLine; }
void setShape(const FPointArray& val) { PoLine = val; }
const FPointArray contour() const { return ContourLine; }
@@ -569,15 +569,15 @@
double gradientMaskSkew() const { return GrMaskSkew; }
void setGradientMaskSkew(double val);
FPoint gradientControl1() const { return GrControl1; }
- void setGradientControl1(FPoint val);
+ void setGradientControl1(const FPoint& val);
FPoint gradientControl2() const { return GrControl2; }
- void setGradientControl2(FPoint val);
+ void setGradientControl2(const FPoint& val);
FPoint gradientControl3() const { return GrControl3; }
- void setGradientControl3(FPoint val);
+ void setGradientControl3(const FPoint& val);
FPoint gradientControl4() const { return GrControl4; }
- void setGradientControl4(FPoint val);
+ void setGradientControl4(const FPoint& val);
FPoint gradientControl5() const { return GrControl5; }
- void setGradientControl5(FPoint val);
+ void setGradientControl5(const FPoint& val);
double gradientStrokeScale() const { return GrStrokeScale; }
void setGradientStrokeScale(double val);
double gradientStrokeSkew() const { return GrStrokeSkew; }
@@ -595,13 +595,13 @@
double gradientStrokeEndY() const { return GrStrokeEndY; }
void setGradientStrokeEndY(double val);
QString gradientCol1() const { return GrColorP1; }
- void setGradientCol1(QString val);
+ void setGradientCol1(const QString& val);
QString gradientCol2() const { return GrColorP2; }
- void setGradientCol2(QString val);
+ void setGradientCol2(const QString& val);
QString gradientCol3() const { return GrColorP3; }
- void setGradientCol3(QString val);
+ void setGradientCol3(const QString& val);
QString gradientCol4() const { return GrColorP4; }
- void setGradientCol4(QString val);
+ void setGradientCol4(const QString& val);
double gradientTransp1() const { return GrCol1transp; }
void setGradientTransp1(double val);
double gradientTransp2() const { return GrCol2transp; }
@@ -619,13 +619,13 @@
int gradientShade4() const { return GrCol4Shade; }
void setGradientShade4(int val);
QColor gradientColor1() const { return GrColorP1QColor; }
- void setGradientColor1(QColor val);
+ void setGradientColor1(const QColor& val);
QColor gradientColor2() const { return GrColorP2QColor; }
- void setGradientColor2(QColor val);
+ void setGradientColor2(const QColor& val);
QColor gradientColor3() const { return GrColorP3QColor; }
- void setGradientColor3(QColor val);
+ void setGradientColor3(const QColor& val);
QColor gradientColor4() const { return GrColorP4QColor; }
- void setGradientColor4(QColor val);
+ void setGradientColor4(const QColor& val);
void setGradientExtend(VGradient::VGradientRepeatMethod val);
void setStrokeGradientExtend(VGradient::VGradientRepeatMethod val);
VGradient::VGradientRepeatMethod getGradientExtend();
@@ -637,18 +637,18 @@
bool getSnapToPatchGrid() const { return snapToPatchGrid; }
void setSnapToPatchGrid(bool val);
- void setMaskGradient(VGradient grad);
- void setFillGradient(VGradient grad);
- void setStrokeGradient(VGradient grad);
+ void setMaskGradient(const VGradient& grad);
+ void setFillGradient(const VGradient& grad);
+ void setStrokeGradient(const VGradient& grad);
void set4ColorGeometry(FPoint c1, FPoint c2, FPoint c3, FPoint c4);
void set4ColorTransparency(double t1, double t2, double t3, double t4);
void set4ColorShade(int t1, int t2, int t3, int t4);
void set4ColorColors(QString col1, QString col2, QString col3, QString col4);
- void get4ColorGeometry(FPoint &c1, FPoint &c2, FPoint &c3, FPoint &c4);
- void setDiamondGeometry(FPoint c1, FPoint c2, FPoint c3, FPoint c4, FPoint c5);
+ void get4ColorGeometry(FPoint& c1, FPoint& c2, FPoint& c3, FPoint& c4);
+ void setDiamondGeometry(const FPoint& c1, const FPoint& c2, const FPoint& c3, const FPoint& c4, const FPoint& c5);
void get4ColorTransparency(double &t1, double &t2, double &t3, double &t4);
void get4ColorColors(QString &col1, QString &col2, QString &col3, QString &col4);
- void setMeshPointColor(int x, int y, QString color, int shade, double transparency, bool forPatch = false);
+ void setMeshPointColor(int x, int y, const QString& color, int shade, double transparency, bool forPatch = false);
void createGradientMesh(int rows, int cols);
void resetGradientMesh();
void meshToShape();
More information about the scribus-commit
mailing list