Author: jghali
Date: Sun Oct  3 20:23:49 2021
New Revision: 24730

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24730
Log:
Code cleanup

Modified:
    trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/sccolor.cpp
    trunk/Scribus/scribus/sccolor.h
    trunk/Scribus/scribus/sccolorshade.cpp
    trunk/Scribus/scribus/sccolorshade.h
    trunk/Scribus/scribus/sccolorstructs.cpp
    trunk/Scribus/scribus/sccolorstructs.h
    trunk/Scribus/scribus/scimage.cpp
    trunk/Scribus/scribus/transaction.h
    trunk/Scribus/scribus/undogui.cpp
    trunk/Scribus/scribus/undogui.h
    trunk/Scribus/scribus/undomanager.cpp
    trunk/Scribus/scribus/undomanager.h
    trunk/Scribus/scribus/undostate.cpp
    trunk/Scribus/scribus/undostate.h
    trunk/Scribus/scribus/util_formats.cpp
    trunk/Scribus/scribus/util_formats.h
    trunk/Scribus/scribus/util_ghostscript.cpp

Modified: trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp (original)
+++ trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp Sun Oct  3 
20:23:49 2021
@@ -81,39 +81,40 @@
 
 QString ScLcms2ColorProfileImpl::productDescription() const
 {
-       if (m_productDescription.isEmpty())
+       if (!m_productDescription.isEmpty())
+               return m_productDescription;
+
+       if (m_profileHandle == nullptr)
+               return QString();
+
+#ifdef _WIN32
+       cmsUInt32Number descSize = cmsGetProfileInfo(m_profileHandle, 
cmsInfoDescription, "en", "US", nullptr, 0);
+       if (descSize > 0)
        {
-               if (m_profileHandle)
+               wchar_t* descData = (wchar_t*) malloc(descSize + 
sizeof(wchar_t));
+               if (descData)
+                       descSize = cmsGetProfileInfo(m_profileHandle, 
cmsInfoDescription, "en", "US", descData, descSize);
+               if (descData && (descSize > 0))
                {
-#ifdef _WIN32
-                       cmsUInt32Number descSize = 
cmsGetProfileInfo(m_profileHandle, cmsInfoDescription, "en", "US", nullptr, 0);
-                       if (descSize > 0)
-                       {
-                               wchar_t* descData = (wchar_t*) malloc(descSize 
+ sizeof(wchar_t));
-                               if (descData)
-                                       descSize = 
cmsGetProfileInfo(m_profileHandle, cmsInfoDescription, "en", "US", descData, 
descSize);
-                               if (descData && (descSize > 0))
-                               {
-                                       uint stringLen = descSize / 
sizeof(wchar_t);
-                                       descData[stringLen] = 0;
-                                       m_productDescription = 
QString::fromWCharArray(descData);
-                               }
-                               free(descData);
-                       }
+                       uint stringLen = descSize / sizeof(wchar_t);
+                       descData[stringLen] = 0;
+                       m_productDescription = 
QString::fromWCharArray(descData);
+               }
+               free(descData);
+       }
 #else
-                       cmsUInt32Number descSize = 
cmsGetProfileInfoASCII(m_profileHandle, cmsInfoDescription, "en", "US", 
nullptr, 0);
-                       if (descSize > 0)
-                       {
-                               char* descData = (char*) malloc(descSize + 
sizeof(char));
-                               if (descData)
-                                       descSize = 
cmsGetProfileInfoASCII(m_profileHandle, cmsInfoDescription, "en", "US", 
descData, descSize);
-                               if (descData && (descSize > 0))
-                                       m_productDescription = 
QString(descData);
-                               free(descData);
-                       }
+       cmsUInt32Number descSize = cmsGetProfileInfoASCII(m_profileHandle, 
cmsInfoDescription, "en", "US", nullptr, 0);
+       if (descSize > 0)
+       {
+               char* descData = (char*) malloc(descSize + sizeof(char));
+               if (descData)
+                       descSize = cmsGetProfileInfoASCII(m_profileHandle, 
cmsInfoDescription, "en", "US", descData, descSize);
+               if (descData && (descSize > 0))
+                       m_productDescription = QString(descData);
+               free(descData);
+       }
 #endif
-               }
-       }
+
        return m_productDescription;
 }
 
@@ -134,7 +135,7 @@
 
        // First retrieve profile size
        cmsUInt32Number bytesNeeded = 0;
-       bool done = cmsSaveProfileToMem(m_profileHandle, 0, &bytesNeeded);
+       bool done = cmsSaveProfileToMem(m_profileHandle, nullptr, &bytesNeeded);
        if (!done)
                return false;
 

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp  (original)
+++ trunk/Scribus/scribus/pageitem.cpp  Sun Oct  3 20:23:49 2021
@@ -524,7 +524,7 @@
        uniqueNr = m_Doc->TotalItems;
        setUName(m_itemName);
        m_annotation.setBorderColor(outline);
-//     toPixmap = false;
+
        ImageIntent = Intent_Relative_Colorimetric;
        m_layerID = m_Doc->activeLayer();
        stroke_gradient = VGradient(VGradient::linear);
@@ -536,42 +536,33 @@
                stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, m_lineColor, 100);
                stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, m_lineColor, 100);
        }
-       else
-       {
-               if (m_Doc->itemToolPrefs().shapeLineColor != 
CommonStrings::None)
-               {
-                       const ScColor& col = 
m_Doc->PageColors[m_Doc->itemToolPrefs().shapeLineColor];
-                       QColor qcol = ScColorEngine::getRGBColor(col, m_Doc);
-                       stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, 
m_Doc->itemToolPrefs().shapeLineColor, 100);
-                       stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, 
m_Doc->itemToolPrefs().shapeLineColor, 100);
-               }
-               else
-               {
-                       if (m_fillColor != CommonStrings::None)
-                       {
-                               const ScColor& col = 
m_Doc->PageColors[m_fillColor];
-                               QColor qcol = ScColorEngine::getRGBColor(col, 
m_Doc);
-                               stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, 
m_fillColor, 100);
-                               stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, 
m_fillColor, 100);
-                       }
-                       else
-                       {
-                               if (m_Doc->itemToolPrefs().shapeFillColor != 
CommonStrings::None)
-                               {
-                                       const ScColor& col = 
m_Doc->PageColors[m_Doc->itemToolPrefs().shapeFillColor];
-                                       QColor qcol = 
ScColorEngine::getRGBColor(col, m_Doc);
-                                       stroke_gradient.addStop(qcol, 0.0, 0.5, 
1.0, m_Doc->itemToolPrefs().shapeFillColor, 100);
-                                       stroke_gradient.addStop(qcol, 1.0, 0.5, 
1.0, m_Doc->itemToolPrefs().shapeFillColor, 100);
-                               }
-                               else if (m_Doc->PageColors.contains("Black"))
-                               {
-                                       const ScColor& col = 
m_Doc->PageColors["Black"];
-                                       QColor qcol = 
ScColorEngine::getRGBColor(col, m_Doc);
-                                       stroke_gradient.addStop(qcol, 0.0, 0.5, 
1.0, "Black", 100);
-                                       stroke_gradient.addStop(qcol, 1.0, 0.5, 
1.0, "Black", 100);
-                               }
-                       }
-               }
+       else if (m_Doc->itemToolPrefs().shapeLineColor != CommonStrings::None)
+       {
+               const ScColor& col = 
m_Doc->PageColors[m_Doc->itemToolPrefs().shapeLineColor];
+               QColor qcol = ScColorEngine::getRGBColor(col, m_Doc);
+               stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, 
m_Doc->itemToolPrefs().shapeLineColor, 100);
+               stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, 
m_Doc->itemToolPrefs().shapeLineColor, 100);
+       }
+       else if (m_fillColor != CommonStrings::None)
+       {
+               const ScColor& col = m_Doc->PageColors[m_fillColor];
+               QColor qcol = ScColorEngine::getRGBColor(col, m_Doc);
+               stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, m_fillColor, 100);
+               stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, m_fillColor, 100);
+       }
+       else if (m_Doc->itemToolPrefs().shapeFillColor != CommonStrings::None)
+       {
+               const ScColor& col = 
m_Doc->PageColors[m_Doc->itemToolPrefs().shapeFillColor];
+               QColor qcol = ScColorEngine::getRGBColor(col, m_Doc);
+               stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, 
m_Doc->itemToolPrefs().shapeFillColor, 100);
+               stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, 
m_Doc->itemToolPrefs().shapeFillColor, 100);
+       }
+       else if (m_Doc->PageColors.contains("Black"))
+       {
+               const ScColor& col = m_Doc->PageColors["Black"];
+               QColor qcol = ScColorEngine::getRGBColor(col, m_Doc);
+               stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, "Black", 100);
+               stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, "Black", 100);
        }
        fill_gradient = VGradient(VGradient::linear);
        fill_gradient.clearStops();
@@ -789,14 +780,14 @@
                return (Parent->asGroupFrame()->groupItemList.indexOf(thisItem) 
+ 1);
        if (!m_Doc)
                return 0;
-       QList<PageItem*>* items = OnMasterPage.isEmpty() ? &m_Doc->DocItems : 
&m_Doc->MasterItems;
+       const auto* items = OnMasterPage.isEmpty() ? &m_Doc->DocItems : 
&m_Doc->MasterItems;
        return (items->indexOf(thisItem) + 1);
 }
 
 void PageItem::moveBy(const double dX, const double dY, bool drawingOnly)
 {
        //qDebug() << "pageitem::moveby" << dX << dY;
-       if (dX==0.0 && dY==0.0)
+       if (dX == 0.0 && dY == 0.0)
                return;
        invalid = true;
        if (dX != 0.0)
@@ -992,7 +983,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::Rotate, QString(), 
Um::IRotate);
+               auto *ss = new SimpleState(Um::Rotate, QString(), Um::IRotate);
                ss->set("IMAGE_ROTATION");
                ss->set("OLD_ROT", m_imageRotation);
                ss->set("NEW_ROT", newRotation);
@@ -1074,7 +1065,7 @@
        return 0;
 }
 
-int PageItem::maxCharsInFrame()
+int PageItem::maxCharsInFrame() const
 {
        return m_maxChars;
 }
@@ -1100,7 +1091,7 @@
        qreal bottom = top + sideLength;
 
        QColor 
color(PrefsManager::instance().appPrefs.displayPrefs.frameNormColor);
-       if ((isBookmark) || (m_isAnnotation))
+       if (isBookmark || m_isAnnotation)
                color = 
PrefsManager::instance().appPrefs.displayPrefs.frameAnnotationColor;
        if ((m_backBox != nullptr) || (m_nextBox != nullptr))
                color = 
PrefsManager::instance().appPrefs.displayPrefs.frameLinkColor;
@@ -1452,7 +1443,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
+               auto *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
                ss->set("LEFT_TEXTFRAMEDIST");
                ss->set("OLD_DIST", m_textDistanceMargins.left());
                ss->set("NEW_DIST", newLeft);
@@ -1468,7 +1459,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
+               auto *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
                ss->set("RIGHT_TEXTFRAMEDIST");
                ss->set("OLD_DIST", m_textDistanceMargins.right());
                ss->set("NEW_DIST", newRight);
@@ -1484,7 +1475,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
+               auto *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
                ss->set("TOP_TEXTFRAMEDIST");
                ss->set("OLD_DIST", m_textDistanceMargins.top());
                ss->set("NEW_DIST", newTop);
@@ -1500,7 +1491,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
+               auto *ss = new SimpleState(Um::TextFrameDist, QString(), 
Um::ITextFrame);
                ss->set("BOTTOM_TEXTFRAMEDIST");
                ss->set("OLD_DIST", m_textDistanceMargins.bottom());
                ss->set("NEW_DIST", newBottom);
@@ -1538,11 +1529,11 @@
 
 void PageItem::setColumns(int newColumnCount)
 {
-       if (m_columns==newColumnCount)
-               return;
-       if (UndoManager::undoEnabled())
-       {
-               SimpleState *ss = new SimpleState(Um::Columns, QString(), 
Um::IBorder);
+       if (m_columns == newColumnCount)
+               return;
+       if (UndoManager::undoEnabled())
+       {
+               auto *ss = new SimpleState(Um::Columns, QString(), Um::IBorder);
                ss->set("COLUMNS");
                ss->set("OLD_COLUMNS", m_columns);
                ss->set("NEW_COLUMNS", newColumnCount);
@@ -1553,11 +1544,11 @@
 
 void PageItem::setColumnGap(double newColumnGap)
 {
-       if (m_columnGap==newColumnGap)
-               return;
-       if (UndoManager::undoEnabled())
-       {
-               SimpleState *ss = new SimpleState(Um::Columns, QString(), 
Um::IBorder);
+       if (m_columnGap == newColumnGap)
+               return;
+       if (UndoManager::undoEnabled())
+       {
+               auto *ss = new SimpleState(Um::Columns, QString(), Um::IBorder);
                ss->set("COLUMNSGAP");
                ss->set("OLD_COLUMNS", m_columnGap);
                ss->set("NEW_COLUMNS", newColumnGap);
@@ -1577,7 +1568,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::AlignText, QString(), 
Um::ITextFrame);
+               auto *ss = new SimpleState(Um::AlignText, QString(), 
Um::ITextFrame);
                ss->set("VERTICAL_ALIGN");
                ss->set("OLD_VERTALIGN", verticalAlign);
                ss->set("NEW_VERTALIGN", val);
@@ -1592,7 +1583,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *state = new SimpleState(Um::RoundCorner, 
QString(), Um::IBorder);
+               auto *state = new SimpleState(Um::RoundCorner, QString(), 
Um::IBorder);
                state->set("CORNER_RADIUS");
                state->set("OLD_RADIUS", m_roundedCornerRadius);
                state->set("NEW_RADIUS", newRadius);
@@ -1623,7 +1614,7 @@
        DrawObj_Pre(p);
        if (m_Doc->layerOutline(m_layerID))
        {
-               if ((itemType() == TextFrame || itemType() == ImageFrame || 
itemType() == PathText || itemType() == Line || itemType() == PolyLine || 
itemType() == Group || itemType() == Symbol))
+               if (itemType() == TextFrame || itemType() == ImageFrame || 
itemType() == PathText || itemType() == Line || itemType() == PolyLine || 
itemType() == Group || itemType() == Symbol)
                        DrawObj_Item(p, cullingArea);
        }
        else
@@ -1695,10 +1686,10 @@
                        if (GrType == Gradient_4Colors)
                        {
                                p->setFillMode(ScPainter::Gradient);
-                               FPoint pG1 = FPoint(0, 0);
-                               FPoint pG2 = FPoint(width(), 0);
-                               FPoint pG3 = FPoint(width(), height());
-                               FPoint pG4 = FPoint(0, height());
+                               FPoint pG1(0, 0);
+                               FPoint pG2(width(), 0);
+                               FPoint pG3(width(), height());
+                               FPoint pG4(0, height());
                                p->set4ColorGeometry(pG1, pG2, pG3, pG4, 
GrControl1, GrControl2, GrControl3, GrControl4);
                                p->set4ColorColors(m_grQColorP1, m_grQColorP2, 
m_grQColorP3, m_grQColorP4);
                        }
@@ -1993,7 +1984,7 @@
                        if ((drawFrame()) && (m_Doc->guidesPrefs().framesShown) 
&& ((itemType() == ImageFrame) || (itemType() == LatexFrame) || (itemType() == 
OSGFrame) || (itemType() == PathText)) && (no_stroke))
                        {
                                
p->setPen(PrefsManager::instance().appPrefs.displayPrefs.frameNormColor, 
scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-                               if ((isBookmark) || (m_isAnnotation))
+                               if (isBookmark || m_isAnnotation)
                                        
p->setPen(PrefsManager::instance().appPrefs.displayPrefs.frameAnnotationColor, 
scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
                                if ((m_backBox != nullptr) || (m_nextBox != 
nullptr))
                                        
p->setPen(PrefsManager::instance().appPrefs.displayPrefs.frameLinkColor, 
scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
@@ -2361,7 +2352,7 @@
        bool isEmbedded_Old = isEmbedded;
        bool savedFlag = m_Doc->guidesPrefs().framesShown;
        m_Doc->guidesPrefs().framesShown = false;
-       QImage retImg = QImage(qRound(gWidth * scaling), qRound(gHeight * 
scaling), QImage::Format_ARGB32_Premultiplied);
+       QImage retImg(qRound(gWidth * scaling), qRound(gHeight * scaling), 
QImage::Format_ARGB32_Premultiplied);
        retImg.fill( qRgba(0, 0, 0, 0) );
        ScPainter *painter = new ScPainter(&retImg, retImg.width(), 
retImg.height(), 1, 0);
        painter->setZoomFactor(scaling);
@@ -2424,7 +2415,7 @@
        AutoName=false;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::Rename, 
QString(Um::FromTo).arg(oldName, newName));
+               auto *ss = new SimpleState(Um::Rename, 
QString(Um::FromTo).arg(oldName, newName));
                ss->set("OLD_NAME", oldName);
                ss->set("NEW_NAME", newName);
                undoManager->action(this, ss);
@@ -2702,7 +2693,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) const
 {
        c1 = GrControl1;
        c2 = GrControl2;
@@ -2710,7 +2701,7 @@
        c4 = GrControl4;
 }
 
-void PageItem::get4ColorTransparency(double &t1, double &t2, double &t3, 
double &t4)
+void PageItem::get4ColorTransparency(double &t1, double &t2, double &t3, 
double &t4) const
 {
        t1 = GrCol1transp;
        t2 = GrCol2transp;
@@ -2718,7 +2709,7 @@
        t4 = GrCol4transp;
 }
 
-void PageItem::get4ColorColors(QString &col1, QString &col2, QString &col3, 
QString &col4)
+void PageItem::get4ColorColors(QString &col1, QString &col2, QString &col3, 
QString &col4) const
 {
        col1 = GrColorP1;
        col2 = GrColorP2;
@@ -4476,9 +4467,9 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::SendToLayer,
-                                                                               
  QString(Um::FromTo).arg(m_layerID).arg(newLayerID),
-                                                                               
  Um::ILayerAction);
+               auto *ss = new SimpleState(Um::SendToLayer,
+                                          
QString(Um::FromTo).arg(m_layerID).arg(newLayerID),
+                                          Um::ILayerAction);
                ss->set("SEND_TO_LAYER");
                ss->set("OLD_LAYER", m_layerID);
                ss->set("NEW_LAYER", newLayerID);
@@ -5163,7 +5154,7 @@
 
 void PageItem::restoreMarkString(SimpleState *state, bool isUndo)
 {
-       ScItemState< QPair<int,QString> > *is = dynamic_cast<ScItemState< 
QPair<int,QString> >*>(state);
+       const auto *is = dynamic_cast<ScItemState< QPair<int,QString> 
>*>(state);
        if (!is)
                return;
        Mark* mark = itemText.mark(is->getItem().first);
@@ -5695,9 +5686,10 @@
 
 void PageItem::restoreGradPos(SimpleState *state, bool isUndo)
 {
-       ScItemState<QList<FPoint> > *is = 
dynamic_cast<ScItemState<QList<FPoint> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QList<FPoint> > *>(state);
        if (!is)
                qFatal("PageItem::restoreGradPos: dynamic cast failed");
+
        if (isUndo)
        {
                GrStartX = is->getDouble("OLDSTARTX");
@@ -5769,7 +5761,7 @@
 
 void PageItem::restoreGradientColor1(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<QColor,QColor> > *is = 
dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreGradientColor1: dynamic cast failed");
        if (isUndo)
@@ -5781,7 +5773,7 @@
 
 void PageItem::restoreRemoveMeshPatch(SimpleState *state, bool isUndo)
 {
-       ScItemState<meshGradientPatch>* is = 
dynamic_cast<ScItemState<meshGradientPatch> *>(state);
+       const auto* is = dynamic_cast<ScItemState<meshGradientPatch> *>(state);
        if (!is)
                qFatal("PageItem::restoreRemoveMeshPatch: dynamic cast failed");
        if (isUndo)
@@ -5799,7 +5791,7 @@
 
 void PageItem::restoreCreateMeshGrad(SimpleState *state, bool isUndo)
 {
-       ScItemState<QList<QList<MeshPoint> > >* is = 
dynamic_cast<ScItemState<QList<QList<MeshPoint> > > *>(state);
+       const auto* is = dynamic_cast<ScItemState<QList<QList<MeshPoint> > > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreCreateMeshGrad: dynamic cast failed");
        if (isUndo)
@@ -5811,7 +5803,7 @@
 
 void PageItem::restoreMoveMeshGrad(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<QList<QList<MeshPoint> >,FPointArray> > *is = 
dynamic_cast<ScItemState<QPair<QList<QList<MeshPoint> >,FPointArray> > 
*>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<QList<QList<MeshPoint> 
>,FPointArray> > *>(state);
        if (!is)
                qFatal("PageItem::restoreMoveMeshGrad: dynamic cast failed");
        if (isUndo)
@@ -5834,7 +5826,7 @@
 
 void PageItem::restoreResetMeshGrad(SimpleState *state, bool isUndo)
 {
-       ScItemState<QList<QList<MeshPoint> > > *is = 
dynamic_cast<ScItemState<QList<QList<MeshPoint> > > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QList<QList<MeshPoint> > > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreResetMeshGrad: dynamic cast failed");
        if (isUndo)
@@ -5846,7 +5838,7 @@
 
 void PageItem::restoreGradientColor2(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<QColor,QColor> > *is = 
dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreGradientColor2: dynamic cast failed");
        if (isUndo)
@@ -5858,7 +5850,7 @@
 
 void PageItem::restoreGradientColor3(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<QColor,QColor> > *is = 
dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreGradientColor3: dynamic cast failed");
        if (isUndo)
@@ -5870,7 +5862,7 @@
 
 void PageItem::restoreGradientColor4(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<QColor,QColor> > *is = 
dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreGradientColor4: dynamic cast failed");
        if (isUndo)
@@ -5882,9 +5874,10 @@
 
 void PageItem::restoreMoveMeshPatch(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<MeshPoint,MeshPoint> > *is = 
dynamic_cast<ScItemState<QPair<MeshPoint,MeshPoint> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<MeshPoint,MeshPoint> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreMoveMeshPatch: dynamic cast failed");
+
        int x = is->getInt("X");
        int y = is->getInt("Y");
        if (isUndo)
@@ -5934,9 +5927,10 @@
 
 void PageItem::restoreFillGradient(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<VGradient,VGradient> > *is = 
dynamic_cast<ScItemState<QPair<VGradient,VGradient> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<VGradient,VGradient> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreFillGradient: dynamic cast failed");
+
        if (isUndo)
                fill_gradient = is->getItem().first;
        else
@@ -5948,7 +5942,7 @@
 
 void PageItem::restoreMaskGradient(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<VGradient,VGradient> > *is = 
dynamic_cast<ScItemState<QPair<VGradient,VGradient> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<VGradient,VGradient> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreMaskGradient: dynamic cast failed");
        if (isUndo)
@@ -5961,7 +5955,7 @@
 
 void PageItem::restoreStrokeGradient(SimpleState *state, bool isUndo)
 {
-       ScItemState<QPair<VGradient,VGradient> > *is = 
dynamic_cast<ScItemState<QPair<VGradient,VGradient> > *>(state);
+       const auto *is = dynamic_cast<ScItemState<QPair<VGradient,VGradient> > 
*>(state);
        if (!is)
                qFatal("PageItem::restoreStrokeGradient: dynamic cast failed");
        if (isUndo)
@@ -5973,9 +5967,10 @@
 
 void PageItem::restoreGradientMeshColor(SimpleState *ss, bool isUndo)
 {
-       ScItemState<QPair<QColor,QColor> > *is = 
dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(ss);
+       const auto *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(ss);
        if (!is)
                qFatal("PageItem::restoreGradientMeshColor: dynamic cast 
failed");
+
        int x = is->getInt("X");
        int y = is->getInt("Y");
        MeshPoint *mp=nullptr;
@@ -6405,7 +6400,7 @@
 
 void PageItem::restoreDefaultParagraphStyle(SimpleState *ss, bool isUndo)
 {
-       ScItemState<QPair<ParagraphStyle, ParagraphStyle > > *is = 
dynamic_cast<ScItemState<QPair<ParagraphStyle, ParagraphStyle> >*>(ss);
+       const auto *is = dynamic_cast<ScItemState<QPair<ParagraphStyle, 
ParagraphStyle> >*>(ss);
        if (!is)
                qFatal("PageItem::restoreDefaultParagraphStyle: dynamic cast 
failed");
        if (isUndo)
@@ -6416,7 +6411,7 @@
 
 void PageItem::restoreParagraphStyle(SimpleState *ss, bool isUndo)
 {
-       ScItemState<QPair<ParagraphStyle, ParagraphStyle > > *is = 
dynamic_cast<ScItemState<QPair<ParagraphStyle, ParagraphStyle> >*>(ss);
+       const auto *is = dynamic_cast<ScItemState<QPair<ParagraphStyle, 
ParagraphStyle> >*>(ss);
        if (!is)
                qFatal("PageItem::restoreParagraphStyle: dynamic cast failed");
        int pos = is->getInt("POS");
@@ -6431,7 +6426,7 @@
 
 void PageItem::restoreCharStyle(SimpleState *ss, bool isUndo)
 {
-       ScItemState<QPair<CharStyle, CharStyle > > *is = 
dynamic_cast<ScItemState<QPair<CharStyle, CharStyle> >*>(ss);
+       const auto *is = dynamic_cast<ScItemState<QPair<CharStyle, CharStyle> 
>*>(ss);
        if (!is)
                qFatal("PageItem::restoreCharStyle: dynamic cast failed");
        int length = is->getInt("LENGTH");
@@ -6447,7 +6442,7 @@
 
 void PageItem::restoreSetCharStyle(SimpleState *ss, bool isUndo)
 {
-       ScItemState<QPair<CharStyle, CharStyle > > *is = 
dynamic_cast<ScItemState<QPair<CharStyle, CharStyle> >*>(ss);
+       const auto *is = dynamic_cast<ScItemState<QPair<CharStyle, CharStyle> 
>*>(ss);
        if (!is)
                qFatal("PageItem::restoreSetCharStyle: dynamic cast failed");
        int length = is->getInt("LENGTH");
@@ -6460,7 +6455,7 @@
 
 void PageItem::restoreSetParagraphStyle(SimpleState *ss, bool isUndo)
 {
-       ScItemState<QPair<ParagraphStyle, ParagraphStyle > > *is = 
dynamic_cast<ScItemState<QPair<ParagraphStyle, ParagraphStyle> >*>(ss);
+       const auto *is = dynamic_cast<ScItemState<QPair<ParagraphStyle, 
ParagraphStyle> >*>(ss);
        if (!is)
                qFatal("PageItem::restoreSetParagraphStyle: dynamic cast 
failed");
        int pos = is->getInt("POS");
@@ -6472,7 +6467,7 @@
 
 void PageItem::restoreDeleteFrameText(SimpleState *ss, bool isUndo)
 {
-       ScItemState<CharStyle> *is = dynamic_cast<ScItemState<CharStyle> *>(ss);
+       const auto *is = dynamic_cast<ScItemState<CharStyle> *>(ss);
        if (!is)
                qFatal("PageItem::restoreDeleteFrameText: dynamic cast failed");
 
@@ -6497,7 +6492,7 @@
 
 void PageItem::restoreDeleteFrameParagraph(SimpleState *ss, bool isUndo)
 {
-       ScItemState<ParagraphStyle> *is = 
dynamic_cast<ScItemState<ParagraphStyle> *>(ss);
+       const auto *is = dynamic_cast<ScItemState<ParagraphStyle> *>(ss);
        if (!is)
                qFatal("PageItem::restoreDeleteFrameParagraph: dynamic cast 
failed");
 
@@ -6539,7 +6534,7 @@
 
 void PageItem::restoreInsertFrameParagraph(SimpleState *ss, bool isUndo)
 {
-       ScItemState<ParagraphStyle> *is = 
dynamic_cast<ScItemState<ParagraphStyle> *>(ss);
+       const auto *is = dynamic_cast<ScItemState<ParagraphStyle> *>(ss);
        if (!is)
                qFatal("PageItem::restoreInsertFrameParagraph: dynamic cast 
failed");
 
@@ -6680,7 +6675,7 @@
        QString fill(state->get("OLD_FILL"));
        if (!isUndo)
                fill = state->get("NEW_FILL");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetItemBrush(fill, &tempSelection);
 }
@@ -6699,7 +6694,7 @@
        int shade = state->getInt("OLD_SHADE");
        if (!isUndo)
                shade = state->getInt("NEW_SHADE");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetItemBrushShade(shade, &tempSelection);
 }
@@ -6709,7 +6704,7 @@
        QString fill(state->get("OLD_COLOR"));
        if (!isUndo)
                fill = state->get("NEW_COLOR");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetItemPen(fill, &tempSelection);
 }
@@ -6719,7 +6714,7 @@
        int shade = state->getInt("OLD_SHADE");
        if (!isUndo)
                shade = state->getInt("NEW_SHADE");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetItemPenShade(shade, &tempSelection);
 }
@@ -6729,7 +6724,7 @@
        double tp = state->getDouble("OLD_TP");
        if (!isUndo)
                tp = state->getDouble("NEW_TP");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetItemFillTransparency(tp, &tempSelection);
 }
@@ -6739,7 +6734,7 @@
        double tp = state->getDouble("OLD_TP");
        if (!isUndo)
                tp = state->getDouble("NEW_TP");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetItemLineTransparency(tp, &tempSelection);
 }
@@ -6750,7 +6745,7 @@
        Qt::PenStyle ps = static_cast<Qt::PenStyle>(state->getInt("OLD_STYLE"));
        if (!isUndo)
                ps = static_cast<Qt::PenStyle>(state->getInt("NEW_STYLE"));
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetLineArt(ps, &tempSelection);
 }
@@ -6760,7 +6755,7 @@
        Qt::PenCapStyle pcs = 
static_cast<Qt::PenCapStyle>(state->getInt("OLD_STYLE"));
        if (!isUndo)
                pcs = static_cast<Qt::PenCapStyle>(state->getInt("NEW_STYLE"));
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetLineEnd(pcs, &tempSelection);
 }
@@ -6770,7 +6765,7 @@
        Qt::PenJoinStyle pjs = 
static_cast<Qt::PenJoinStyle>(state->getInt("OLD_STYLE"));
        if (!isUndo)
                pjs = static_cast<Qt::PenJoinStyle>(state->getInt("NEW_STYLE"));
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetLineJoin(pjs, &tempSelection);
 }
@@ -6780,7 +6775,7 @@
        double w = state->getDouble("OLD_LINEWIDTH");
        if (!isUndo)
                w = state->getDouble("NEW_LINEWIDTH");
-       Selection tempSelection(0, false);
+       Selection tempSelection(nullptr, false);
        tempSelection.addItem(this);
        m_Doc->itemSelection_SetLineWidth(w, &tempSelection);
 }
@@ -6946,7 +6941,7 @@
                return;
        if (isUndo)
        {
-               ScItemState<ScImageEffectList>* is = 
dynamic_cast<ScItemState<ScImageEffectList>*>(state);
+               const auto* is = 
dynamic_cast<ScItemState<ScImageEffectList>*>(state);
                if (!is)
                        qFatal("PageItem::restoreClearImage: dynamic cast 
failed");
                Pfile = is->get("CI_PFILE");
@@ -7213,7 +7208,7 @@
 
 void PageItem::restoreSplitItem(SimpleState *state, bool isUndo)
 {
-       ScItemState< QList<int> > *is = dynamic_cast<ScItemState< QList<int> 
>*>(state);
+       const auto *is = dynamic_cast<ScItemState< QList<int> >*>(state);
        if (!is)
                qFatal("PageItem::restoreSplitItem: dynamic cast failed");
        
@@ -7232,7 +7227,7 @@
 
 void PageItem::restoreContourLine(SimpleState *state, bool isUndo)
 {
-       ScItemState<FPointArray> *is = 
dynamic_cast<ScItemState<FPointArray>*>(state);
+       const auto *is = dynamic_cast<ScItemState<FPointArray>*>(state);
        if (!is)
                qFatal("PageItem::restoreContourLine: dynamic cast failed");
        if (isUndo)
@@ -7249,7 +7244,7 @@
        // OLD_FRAME_TYPE - original frame type
        // NEW_FRAME_TYPE - change of frame type
        // binary QPair<FPointArray, FPointArray> - .first original shape, 
.second new shape
-       ScItemState<QPair<FPointArray,FPointArray> > *is = 
dynamic_cast<ScItemState<QPair<FPointArray,FPointArray> >*>(state);
+       const auto *is = 
dynamic_cast<ScItemState<QPair<FPointArray,FPointArray> >*>(state);
        if (!is)
                qFatal("PageItem::restoreShapeType: dynamic cast failed");
        if (isUndo)
@@ -7317,7 +7312,7 @@
 
 void PageItem::restoreShapeContour(UndoState *state, bool isUndo)
 {
-       auto *istate = dynamic_cast<ScItemState<QPair<FPointArray,FPointArray> 
>*>(state);
+       const auto *istate = 
dynamic_cast<ScItemState<QPair<FPointArray,FPointArray> >*>(state);
        if (istate)
        {
                FPointArray oldClip = istate->getItem().first;
@@ -7354,7 +7349,7 @@
 
 void PageItem::restoreImageEffects(UndoState *state, bool isUndo)
 {
-       auto *istate = 
dynamic_cast<ScItemState<QPair<ScImageEffectList,ScImageEffectList> >*>(state);
+       const auto *istate = 
dynamic_cast<ScItemState<QPair<ScImageEffectList,ScImageEffectList> >*>(state);
        if (istate)
        {
                if (isUndo)
@@ -7724,7 +7719,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradType, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradType, QString(), Um::IFill);
                ss->set("GRAD_TYPE");
                ss->set("OLD", GrType);
                ss->set("NEW", val);
@@ -7739,7 +7734,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradTypeStroke, 
QString(), Um::ILineStyle);
+               auto *ss = new SimpleState(Um::GradTypeStroke, QString(), 
Um::ILineStyle);
                ss->set("GRAD_TYPESTROKE");
                ss->set("OLD", GrTypeStroke);
                ss->set("NEW", val);
@@ -7754,7 +7749,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_COL1");
                ss->set("OLD", GrColorP1);
                ss->set("NEW", val);
@@ -7769,7 +7764,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_COL2");
                ss->set("OLD", GrColorP2);
                ss->set("NEW", val);
@@ -7784,7 +7779,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_COL3");
                ss->set("OLD", GrColorP3);
                ss->set("NEW", val);
@@ -7799,7 +7794,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_COL4");
                ss->set("OLD", GrColorP4);
                ss->set("NEW", val);
@@ -7814,7 +7809,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_SHADE1");
                ss->set("OLD", GrCol1Shade);
                ss->set("NEW", val);
@@ -7829,7 +7824,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_SHADE2");
                ss->set("OLD", GrCol2Shade);
                ss->set("NEW", val);
@@ -7844,7 +7839,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_SHADE3");
                ss->set("OLD", GrCol3Shade);
                ss->set("NEW", val);
@@ -7859,7 +7854,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_SHADE4");
                ss->set("OLD", GrCol4Shade);
                ss->set("NEW", val);
@@ -7874,7 +7869,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_TRANSP1");
                ss->set("OLD", GrCol1transp);
                ss->set("NEW", val);
@@ -7889,7 +7884,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_TRANSP2");
                ss->set("OLD", GrCol2transp);
                ss->set("NEW", val);
@@ -7904,7 +7899,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_TRANSP3");
                ss->set("OLD", GrCol3transp);
                ss->set("NEW", val);
@@ -7919,7 +7914,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradCol, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradCol, QString(), Um::IFill);
                ss->set("GRAD_TRANSP4");
                ss->set("OLD", GrCol4transp);
                ss->set("NEW", val);
@@ -8011,7 +8006,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("SNAP_TO_PATCH");
                ss->set("OLD", val);
                undoManager->action(this, ss);
@@ -8025,7 +8020,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_START");
                ss->set("OLDX", GrStartX);
                ss->set("OLDY", GrStartY);
@@ -8043,7 +8038,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_END");
                ss->set("OLDX", GrEndX);
                ss->set("OLDY", GrEndY);
@@ -8061,7 +8056,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_FOCAL");
                ss->set("OLDX", GrFocalX);
                ss->set("OLDY", GrFocalY);
@@ -8079,7 +8074,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_SCALE");
                ss->set("OLD", GrScale);
                ss->set("NEW", val);
@@ -8094,7 +8089,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_SKEW");
                ss->set("OLD", GrSkew);
                ss->set("NEW", val);
@@ -8109,7 +8104,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_MASKSTART");
                ss->set("OLDX", GrMaskStartX);
                ss->set("OLDY", GrMaskStartY);
@@ -8127,7 +8122,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_MASKEND");
                ss->set("OLDX", GrMaskEndX);
                ss->set("OLDY", GrMaskEndY);
@@ -8145,7 +8140,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_MASKFOCAL");
                ss->set("OLDX", GrMaskFocalX);
                ss->set("OLDY", GrMaskFocalY);
@@ -8163,7 +8158,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_MASKSCALE");
                ss->set("OLD", GrMaskScale);
                ss->set("NEW", val);
@@ -8178,7 +8173,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::IFill);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::IFill);
                ss->set("GRAD_MASKSKEW");
                ss->set("OLD", GrMaskSkew);
                ss->set("NEW", val);
@@ -8193,7 +8188,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               ScItemState<QPair<FPoint,FPoint> > *ss = new 
ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, QString(), Um::IFill);
+               auto *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, 
QString(), Um::IFill);
                ss->set("GRAD_CONTROL1");
                ss->setItem(qMakePair(GrControl1, val));
                undoManager->action(this, ss);
@@ -8207,7 +8202,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               ScItemState<QPair<FPoint,FPoint> > *ss = new 
ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, QString(), Um::IFill);
+               auto *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, 
QString(), Um::IFill);
                ss->set("GRAD_CONTROL2");
                ss->setItem(qMakePair(GrControl2, val));
                undoManager->action(this, ss);
@@ -8221,7 +8216,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               ScItemState<QPair<FPoint,FPoint> > *ss = new 
ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, QString(), Um::IFill);
+               auto *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, 
QString(), Um::IFill);
                ss->set("GRAD_CONTROL3");
                ss->setItem(qMakePair(GrControl3, val));
                undoManager->action(this, ss);
@@ -8235,7 +8230,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               ScItemState<QPair<FPoint,FPoint> > *ss = new 
ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, QString(), Um::IFill);
+               auto *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, 
QString(), Um::IFill);
                ss->set("GRAD_CONTROL4");
                ss->setItem(qMakePair(GrControl4, val));
                undoManager->action(this, ss);
@@ -8249,7 +8244,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               ScItemState<QPair<FPoint,FPoint> > *ss = new 
ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, QString(), Um::IFill);
+               auto *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos, 
QString(), Um::IFill);
                ss->set("GRAD_CONTROL5");
                ss->setItem(qMakePair(GrControl5, val));
                undoManager->action(this, ss);
@@ -8263,7 +8258,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::ILine);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::ILine);
                ss->set("GRADSTROKE_SCALE");
                ss->set("OLD", GrStrokeScale);
                ss->set("NEW", val);
@@ -8278,7 +8273,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::ILine);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::ILine);
                ss->set("GRADSTROKE_SKEW");
                ss->set("OLD", GrStrokeSkew);
                ss->set("NEW", val);
@@ -8289,11 +8284,11 @@
 
 void PageItem::setGradientStrokeFocal(double x, double y)
 {
-       if ((GrStrokeFocalX == x) & (GrStrokeFocalY == y))
-               return;
-       if (UndoManager::undoEnabled())
-       {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::ILine);
+       if ((GrStrokeFocalX == x) && (GrStrokeFocalY == y))
+               return;
+       if (UndoManager::undoEnabled())
+       {
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::ILine);
                ss->set("GRADSTROKE_FOCAL");
                ss->set("OLDX", GrStrokeFocalX);
                ss->set("OLDY", GrStrokeFocalY);
@@ -8311,7 +8306,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::ILine);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::ILine);
                ss->set("GRADSTROKE_START");
                ss->set("OLDX", GrStrokeStartX);
                ss->set("OLDY", GrStrokeStartY);
@@ -8329,7 +8324,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::GradPos, QString(), 
Um::ILine);
+               auto *ss = new SimpleState(Um::GradPos, QString(), Um::ILine);
                ss->set("GRADSTROKE_END");
                ss->set("OLDX", GrStrokeEndX);
                ss->set("OLDY", GrStrokeEndY);
@@ -8673,7 +8668,7 @@
        double y = BoundingY - moreSpace / 2.0;
        double w = BoundingW + moreSpace;
        double h = BoundingH + moreSpace;
-       QRectF ret = QRectF(x, y, w, h);
+       QRectF ret(x, y, w, h);
        return ret;
 }
 
@@ -8834,11 +8829,11 @@
                }
                if ((!patternStrokeVal.isEmpty()) && 
(m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
                {
-                       ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];
+                       const ScPattern *pat = 
&m_Doc->docPatterns[patternStrokeVal];
                        QTransform mat;
                        mat.rotate(patternStrokeRotation);
                        mat.scale(patternStrokeScaleX / 100.0, 
patternStrokeScaleY / 100.0);
-                       QRectF p1R = QRectF(0, 0, pat->width, pat->height);
+                       QRectF p1R(0, 0, pat->width, pat->height);
                        QRectF p2R = mat.map(p1R).boundingRect();
                        extraSpace = p2R.height();
                }
@@ -9077,7 +9072,6 @@
                }
                if ((((m_lineColor != CommonStrings::None) || 
(!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0)) && (m_lineWidth > 1)) || 
(!NamedLStyle.isEmpty()))
                {
-//                     QVector<double> m_array;
                        QPainterPath ppa;
                        QPainterPath result;
                        if (itemType() == PageItem::PolyLine)
@@ -9122,7 +9116,7 @@
 
 bool PageItem::pointWithinItem(int x, const int y) const
 {
-       const_cast<PageItem*>(this)-> setRedrawBounding();
+       const_cast<PageItem*>(this)->setRedrawBounding();
        // FIXME: We should be rounding or truncating here, not letting the 
compiler do it.
        // Should we be rounding, truncating up, or truncating down?
        //CB is this now correct?
@@ -9468,17 +9462,17 @@
 }
 
 
-void PageItem::drawLockedMarker(ScPainter *p)
+void PageItem::drawLockedMarker(ScPainter *p) const
 {
        //TODO: CB clean
        double scp1 = p->zoomFactor() ;
        double ofwh = 6 * scp1;
        double ofx = m_width - ofwh/2;
        double ofy = m_height - ofwh*1.5;
-       double bx1= ofx+ scp1;
-       double by1= ofy+3 * scp1;
-       double bw= 4*scp1;
-       double bh= 2*scp1;
+       double bx1 = ofx + scp1;
+       double by1 = ofy + 3 * scp1;
+       double bw = 4 * scp1;
+       double bh = 2 * scp1;
        p->setPen(Qt::black, 0.5 / p->zoomFactor(), Qt::SolidLine, Qt::FlatCap, 
Qt::MiterJoin);
        p->setPenOpacity(1.0);
        p->setBrush(Qt::white);
@@ -9489,14 +9483,14 @@
        p->drawRect(bx1, by1, bw, bh);
        p->setPen(Qt::black, 1.5 / p->zoomFactor(), Qt::SolidLine, Qt::FlatCap, 
Qt::RoundJoin);
        if (m_Locked)
-               p->drawLine(FPoint(bx1+scp1/2, ofy+scp1), FPoint(bx1+scp1/2, 
by1));
-       p->drawLine(FPoint(bx1+scp1*3.5, ofy+scp1), FPoint(bx1+scp1*3.5, by1));
-       p->drawLine(FPoint(bx1+scp1/2, ofy+scp1), FPoint(bx1+scp1*3.5, 
ofy+scp1));
+               p->drawLine(FPoint(bx1 + scp1 / 2, ofy + scp1), FPoint(bx1 + 
scp1 / 2, by1));
+       p->drawLine(FPoint(bx1 + scp1 * 3.5, ofy + scp1), FPoint(bx1 + scp1 * 
3.5, by1));
+       p->drawLine(FPoint(bx1 + scp1 / 2, ofy + scp1), FPoint(bx1 + scp1 * 
3.5, ofy + scp1));
 }
 
 void PageItem::drawArrow(ScPainter *p, QTransform &arrowTrans, int arrowIndex)
 {
-       FPointArray arrow = m_Doc->arrowStyles().at(arrowIndex-1).points.copy();
+       FPointArray arrow = m_Doc->arrowStyles().at(arrowIndex - 
1).points.copy();
        if (NamedLStyle.isEmpty())
        {
                if (m_lineWidth != 0.0)
@@ -9506,7 +9500,7 @@
        {
                multiLine ml = m_Doc->docLineStyles[NamedLStyle];
                if (ml[ml.size()-1].Width != 0.0)
-                       arrowTrans.scale(ml[ml.size()-1].Width, 
ml[ml.size()-1].Width);
+                       arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size() - 
1].Width);
        }
        arrow.map(arrowTrans);
        p->setupPolygon(&arrow);
@@ -9601,7 +9595,7 @@
        double imageRot = fmod(m_imageRotation, 360);
        if (imageRot != 0.0)
        {
-               QRectF br = QRectF(0, 0, OrigW, OrigH);
+               QRectF br(0, 0, OrigW, OrigH);
                QTransform m;
                m.rotate(m_imageRotation);
                br = m.mapRect(br);
@@ -9609,8 +9603,8 @@
                ys = m_height / br.height();
                double xs2 = AspectRatio ? qMin(xs, ys) : xs;
                double ys2 = AspectRatio ? qMin(xs, ys) : ys;
-               QLineF wL = QLineF(0, 0, OrigW, 0);
-               QLineF hL = QLineF(0, 0, 0, OrigH);
+               QLineF wL(0, 0, OrigW, 0);
+               QLineF hL(0, 0, 0, OrigH);
                QTransform mm;
                mm.scale(xs2, ys2);
                mm.rotate(-m_imageRotation);
@@ -9631,7 +9625,7 @@
        }
        if (imageRot != 0.0)
        {
-               QRectF br = QRectF(0, 0, OrigW * xs, OrigH * ys);
+               QRectF br(0, 0, OrigW * xs, OrigH * ys);
                QTransform m;
                m.scale(1.0 / xs, 1.0 / ys);
                m.rotate(m_imageRotation);
@@ -9972,7 +9966,7 @@
                return; // nothing to do -> return
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::ActionPDF, nullptr, 
Um::IGroup);
+               auto *ss = new SimpleState(Um::ActionPDF, nullptr, Um::IGroup);
                ss->set("ACTIONPDFANNOTATION", isAnnot);
                undoManager->action(this, ss);
        }
@@ -9985,7 +9979,7 @@
                return; // nothing to do -> return
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::ActionPDF, nullptr, 
Um::IGroup);
+               auto *ss = new SimpleState(Um::ActionPDF, nullptr, Um::IGroup);
                ss->set("ACTIONPDFBOOKMARK", isBM);
                undoManager->action(this, ss);
        }
@@ -9998,7 +9992,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::ResTyp, QString(), 
Um::IImageFrame);
+               auto *ss = new SimpleState(Um::ResTyp, QString(), 
Um::IImageFrame);
                ss->set("RES_TYP");
                ss->set("OLD_RES",pixm.imgInfo.lowResType);
                ss->set("NEW_RES",id);
@@ -10018,7 +10012,7 @@
                return;
        if (UndoManager::undoEnabled())
        {
-               SimpleState *ss = new SimpleState(Um::ResTyp, QString(), 
Um::IImageFrame);
+               auto *ss = new SimpleState(Um::ResTyp, QString(), 
Um::IImageFrame);
                ss->set("SHOW_IMAGE");
                ss->set("OLD", m_imageVisible);
                undoManager->action(this, ss);
@@ -10462,8 +10456,8 @@
 
 void PageItem::addWelded(PageItem* item)
 {
-       FPoint centerI = FPoint(xPos() + (width() / 2.0), yPos() + (height() / 
2.0));
-       FPoint centerP = FPoint(item->xPos() + (item->width() / 2.0), 
item->yPos() + (item->height() / 2.0));
+       FPoint centerI(xPos() + (width() / 2.0), yPos() + (height() / 2.0));
+       FPoint centerP(item->xPos() + (item->width() / 2.0), item->yPos() + 
(item->height() / 2.0));
        WeldingInfo wInf;
        wInf.weldItem = item;
        wInf.weldPoint = FPoint((width() / 2.0) + ((centerP.x() - centerI.x()) 
/ 2.0), (height() / 2.0) + ((centerP.y() - centerI.y()) / 2.0));
@@ -10474,7 +10468,7 @@
 void PageItem::weldTo(PageItem* item)
 {
        UndoTransaction activeTransaction;
-       if (undoManager->undoEnabled())
+       if (UndoManager::undoEnabled())
                activeTransaction = undoManager->beginTransaction(Um::WeldItems 
+ "/" + Um::Selection, Um::IGroup,
                                                                                
                                  Um::WeldItems, QString(), Um::IGroup);
        for (int i = 0 ; i <  weldList.count(); i++)
@@ -10488,7 +10482,7 @@
                return;
        addWelded(item);
        item->addWelded(this);
-       if (undoManager->undoEnabled())
+       if (UndoManager::undoEnabled())
        {
                ScItemState<PageItem*> *is = new 
ScItemState<PageItem*>(Um::WeldItems, QString(), Um::IGroup);
                is->set("WELD_ITEMS");
@@ -10601,7 +10595,7 @@
 void PageItem::unWeld()
 {
        UndoTransaction activeTransaction;
-       if (undoManager->undoEnabled())
+       if (UndoManager::undoEnabled())
                activeTransaction = 
undoManager->beginTransaction(Um::UnweldItems + "/" + Um::Selection, Um::IGroup,
                                                                                
                                  Um::UnweldItems, QString(), Um::IDelete);
        for (int i = 0 ; i < weldList.count(); i++)
@@ -10622,7 +10616,7 @@
                                item->weldList.removeAt(j);
                                if (undoManager->undoEnabled())
                                {
-                                       ScItemState<PageItem*> *is = new 
ScItemState<PageItem*>(Um::UnweldItems, QString(), Um::IGroup);
+                                       auto *is = new 
ScItemState<PageItem*>(Um::UnweldItems, QString(), Um::IGroup);
                                        is->set("UNWELD_ITEM");
                                        is->setItem(item);
                                        is->set("thisPoint_x", 
wInf.weldPoint.x());

Modified: trunk/Scribus/scribus/pageitem.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h    (original)
+++ trunk/Scribus/scribus/pageitem.h    Sun Oct  3 20:23:49 2021
@@ -677,10 +677,10 @@
        void set4ColorTransparency(double t1, double t2, double t3, double t4);
        void set4ColorShade(int t1, int t2, int t3, int t4);
        void set4ColorColors(const QString& col1, const QString& col2, const 
QString& col3, const QString& col4);
-       void get4ColorGeometry(FPoint& c1, FPoint& c2, FPoint& c3, FPoint& c4);
+       void get4ColorGeometry(FPoint& c1, FPoint& c2, FPoint& c3, FPoint& c4) 
const;
        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 get4ColorTransparency(double &t1, double &t2, double &t3, double 
&t4) const;
+       void get4ColorColors(QString &col1, QString &col2, QString &col3, 
QString &col4) const;
        void setMeshPointColor(int x, int y, const QString& color, int shade, 
double transparency, bool forPatch = false);
        void createGradientMesh(int rows, int cols);
        void resetGradientMesh();
@@ -1270,7 +1270,8 @@
                // End public functions
 
 public:        // Start public variables
-       int maxCharsInFrame();
+       int maxCharsInFrame() const;
+
        bool AutoName {true};
        double gXpos {0.0};
        double gYpos {0.0};
@@ -1518,7 +1519,7 @@
        void DrawObj_Polygon(ScPainter *p);
        void DrawObj_PolyLine(ScPainter *p);
        void DrawObj_PathText(ScPainter *p, double sc);
-       void drawLockedMarker(ScPainter *p);
+       void drawLockedMarker(ScPainter *p) const;
        void drawArrow(ScPainter *p, QTransform &arrowTrans, int arrowIndex);
 
        /** @brief Manages undostack and is where all undo actions/states are 
sent. */

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp       (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp       Sun Oct  3 20:23:49 2021
@@ -1775,6 +1775,7 @@
                }
                if (tmp2.isEmpty())
                        tmp2 = "0000";
+
                toUnicodeMap += "<" + Pdf::toAscii(tmp) + "> <" + 
Pdf::toAscii(tmp2) + ">\n";
                toUnicodeMapCounter++;
                if (toUnicodeMapCounter == 100)

Modified: trunk/Scribus/scribus/sccolor.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/sccolor.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolor.cpp   (original)
+++ trunk/Scribus/scribus/sccolor.cpp   Sun Oct  3 20:23:49 2021
@@ -49,13 +49,11 @@
 }
 
 ScColor::ScColor(double l, double a, double b)
-{
-       m_Model = colorModelLab;
-
-       m_L_val = l;
-       m_a_val = a;
-       m_b_val = b;
-
+          : m_L_val(l),
+            m_a_val(a),
+            m_b_val(b),
+            m_Model(colorModelLab)
+{
        m_values[0] = 0.6;
        m_values[1] = 0.4;
        m_values[2] = 0.2;
@@ -411,9 +409,10 @@
 }
 
 ColorList::ColorList(ScribusDoc* doc, bool retainDoc)
-{
-       m_doc = doc;
-       m_retainDoc = retainDoc;
+            : m_doc(doc),
+              m_retainDoc(retainDoc)
+{
+
 }
 
 void ColorList::setDocument(ScribusDoc* doc)
@@ -538,12 +537,12 @@
 
 void ColorList::ensureRegistration()
 {
-       ScColor cc = ScColor(255, 255, 255, 255);
+       ScColor cc(255, 255, 255, 255);
        cc.setRegistrationColor(true);
        insert("Registration", cc);
 }
 
-QString ColorList::tryAddColor(QString name, ScColor col)
+QString ColorList::tryAddColor(QString name, const ScColor& col)
 {
        if (contains(name))
                return name;

Modified: trunk/Scribus/scribus/sccolor.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/sccolor.h
==============================================================================
--- trunk/Scribus/scribus/sccolor.h     (original)
+++ trunk/Scribus/scribus/sccolor.h     Sun Oct  3 20:23:49 2021
@@ -167,9 +167,32 @@
 
 class SCRIBUS_API ColorList : public QMap<QString, ScColor>
 {
+public:
+       ColorList(ScribusDoc* doc = nullptr, bool retainDoc = false);
+
+       ColorList& operator= (const ColorList& list);
+
+       /** \brief Get the document the list is related , return in cpp due to 
scribusdoc class delcaration */
+       ScribusDoc* document() const;
+
+       /** \brief Assign the doc to which the list belong to.*/
+       void setDocument(ScribusDoc* doc);
+
+       /** \brief Add colors from the specified list. Colors are added using 
shadow copy.*/
+       void addColors(const ColorList& colorList, bool overwrite = true);
+
+       /** \brief Copy colors from the specified list.*/
+       void copyColors(const ColorList& colorList, bool overwrite = true);
+
+       /** \brief Ensure availability of black and white colors. */
+       void ensureDefaultColors();
+
+       /** \brief Try to add ScColor col to the list, if col already exists 
either by name or by value the existing color name is returned. */
+       QString tryAddColor(QString name, const ScColor& col);
+
 protected:
        QPointer<ScribusDoc> m_doc;
-       bool m_retainDoc;
+       bool m_retainDoc { false };
 
        /** \brief Ensure availability of black color. */
        void ensureBlack();
@@ -179,29 +202,6 @@
 
        /** \brief Ensure availability of registration color. */
        void ensureRegistration();
-
-public:
-       ColorList(ScribusDoc* doc = nullptr, bool retainDoc = false);
-
-       ColorList& operator= (const ColorList& list);
-
-       /** \brief Get the document the list is related , return in cpp due to 
scribusdoc class delcaration */
-       ScribusDoc* document() const;
-
-       /** \brief Assign the doc to which the list belong to.*/
-       void setDocument(ScribusDoc* doc);
-
-       /** \brief Add colors from the specified list. Colors are added using 
shadow copy.*/
-       void addColors(const ColorList& colorList, bool overwrite = true);
-
-       /** \brief Copy colors from the specified list.*/
-       void copyColors(const ColorList& colorList, bool overwrite = true);
-
-       /** \brief Ensure availability of black and white colors. */
-       void ensureDefaultColors();
-
-       /** \brief Try to add ScColor col to the list, if col already exists 
either by name or by value the existing color name is returned. */
-       QString tryAddColor(QString name, ScColor col);
 };
 
 #endif

Modified: trunk/Scribus/scribus/sccolorshade.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/sccolorshade.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolorshade.cpp      (original)
+++ trunk/Scribus/scribus/sccolorshade.cpp      Sun Oct  3 20:23:49 2021
@@ -27,22 +27,23 @@
 ScColorShade::ScColorShade()
 {
        color.setColor( 0, 0, 0, 0 );
-       shade = 100;
 }
 
 ScColorShade::ScColorShade( const QColor& c, int level )
+               : color(c.red(), c.green(), c.blue()),
+                 shade(level)
 {
-       color = ScColor(c.red(), c.green(), c.blue());
-       shade = level;
+
 }
 
 ScColorShade::ScColorShade( const ScColor& c, int level )
+               : color(c),
+                 shade(level)
 {
-       color = c;
-       shade = level;
+
 }
 
-ScColor ScColorShade::getShadedColor()
+ScColor ScColorShade::getShadedColor() const
 {
        ScColor value;
        if (color.getColorModel() == colorModelRGB)

Modified: trunk/Scribus/scribus/sccolorshade.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/sccolorshade.h
==============================================================================
--- trunk/Scribus/scribus/sccolorshade.h        (original)
+++ trunk/Scribus/scribus/sccolorshade.h        Sun Oct  3 20:23:49 2021
@@ -34,10 +34,10 @@
        ScColorShade(const QColor& c, int level);
        ScColorShade(const ScColor& c, int level);
 
-       ScColor getShadedColor();
+       ScColor getShadedColor() const;
 
        ScColor color;
-       int shade;
+       int shade { 100 };
 };
 
 #endif

Modified: trunk/Scribus/scribus/sccolorstructs.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/sccolorstructs.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolorstructs.cpp    (original)
+++ trunk/Scribus/scribus/sccolorstructs.cpp    Sun Oct  3 20:23:49 2021
@@ -10,14 +10,14 @@
 
 #include "sccolorstructs.h"
 
-void RGBColor::getRgb(RGBColorF& rgbF)
+void RGBColor::getRgb(RGBColorF& rgbF) const
 {
        rgbF.r = r / 255.0;
        rgbF.g = g / 255.0;
        rgbF.b = b / 255.0;
 }
 
-void RGBColorF::getRgb(RGBColor& rgb)
+void RGBColorF::getRgb(RGBColor& rgb) const
 {
        double rgb_r = qMax(0.0, qMin(r, 1.0));
        double rgb_g = qMax(0.0, qMin(g, 1.0));
@@ -28,7 +28,7 @@
        rgb.b = qRound(rgb_b * 255.0);
 }
 
-void RGBColorF::toHsv(HSVColorF& hsv)
+void RGBColorF::toHsv(HSVColorF& hsv) const
 {
        double rgb_r = qMax(0.0, qMin(r, 1.0));
        double rgb_g = qMax(0.0, qMin(g, 1.0));

Modified: trunk/Scribus/scribus/sccolorstructs.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/sccolorstructs.h
==============================================================================
--- trunk/Scribus/scribus/sccolorstructs.h      (original)
+++ trunk/Scribus/scribus/sccolorstructs.h      Sun Oct  3 20:23:49 2021
@@ -18,59 +18,89 @@
 
 struct RGBColor
 {
-       int r;
-       int g;
-       int b;
+       int r { 0 };
+       int g { 0 };
+       int b { 0 };
        
-       RGBColor() {r=g=b=0;}
+       RGBColor() = default;
 
-       void getRgb(RGBColorF& rgb);
-       void getValues(int& vr, int& vg, int& vb) { vr = r; vg = g; vb = b; }
+       void getRgb(RGBColorF& rgb) const;
+       void getValues(int& vr, int& vg, int& vb) const
+       {
+               vr = r;
+               vg = g;
+               vb = b;
+       }
 };
 
 struct RGBColorF
 {
-       double r;
-       double g;
-       double b;
+       double r { 0.0 };
+       double g { 0.0 };
+       double b { 0.0 };
        
-       RGBColorF() {r=g=b=0.0;}
+       RGBColorF() = default;
 
-       void getRgb(RGBColor& rgb);
-       void getValues(double& vr, double& vg, double& vb) { vr = r; vg = g; vb 
= b; }
-       void toHsv(HSVColorF& hsv);
+       void getRgb(RGBColor& rgb) const;
+       void getValues(double& vr, double& vg, double& vb) const
+       {
+               vr = r;
+               vg = g;
+               vb = b;
+       }
+       void toHsv(HSVColorF& hsv) const;
 };
 
 struct CMYKColor
 {
-       int c;
-       int m;
-       int y;
-       int k;
+       int c { 0 };
+       int m { 0 };
+       int y { 0 };
+       int k { 0 };
        
-       CMYKColor() {c=m=y=k=0;}
-       void getValues(int& vc, int& vm, int& vy, int& vk) { vc = c; vm = m; vy 
= y; vk = k; }
+       CMYKColor() = default;
+
+       void getValues(int& vc, int& vm, int& vy, int& vk) const
+       {
+               vc = c;
+               vm = m;
+               vy = y;
+               vk = k;
+       }
 };
 
 struct CMYKColorF
 {
-       double c;
-       double m;
-       double y;
-       double k;
+       double c { 0.0 };
+       double m { 0.0 };
+       double y { 0.0 };
+       double k { 0.0 };
        
-       CMYKColorF() {c=m=y=k=0.0;}
-       void getValues(double& vc, double& vm, double& vy, double& vk) { vc = 
c; vm = m; vy = y; vk = k; }
+       CMYKColorF() = default;
+
+       void getValues(double& vc, double& vm, double& vy, double& vk) const
+       {
+               vc = c;
+               vm = m;
+               vy = y;
+               vk = k;
+       }
 };
 
 struct HSVColorF
 {
-       double h;
-       double s;
-       double v;
+       double h { 0.0 };
+       double s { 0.0 };
+       double v { 0.0 };
        
-       HSVColorF() { h = s = v = 0.0; }
-       void getValues(double& vh, double& vs, double& vv) { vh = h; vs = s; vv 
= v; }
+       HSVColorF() = default;
+
+       void getValues(double& vh, double& vs, double& vv) const
+       {
+               vh = h;
+               vs = s;
+               vv = v;
+       }
        void toRgb(RGBColor& rgb)  const;
        void toRgb(RGBColorF& rgb) const;
 };

Modified: trunk/Scribus/scribus/scimage.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp   (original)
+++ trunk/Scribus/scribus/scimage.cpp   Sun Oct  3 20:23:49 2021
@@ -2134,9 +2134,10 @@
        profile->resize(0);
        *components = 0;
 
-       QFileInfo fi = QFileInfo(fn);
+       QFileInfo fi(fn);
        if (!fi.exists())
                return;
+
        QString ext = fi.suffix().toLower();
        QString ext2 = getImageType(fn);
        if (ext.isEmpty() || (!ext2.isEmpty() && (ext2 != ext)))
@@ -2250,26 +2251,24 @@
        if (realCMYK != nullptr)
                *realCMYK = false;
        bool bilevel = false;
-//     short resolutionunit = 0;
        RequestType reqType = requestType;
        int cmsFlags = 0;
        int cmsProofFlags = 0;
-       QScopedPointer<ScImgDataLoader> pDataLoader;
-       QFileInfo fi = QFileInfo(fn);
+
+       QString profileName;
+       bool hasEmbeddedProfile = false;
+       ScColorTransform xform;
+       ScColorProfile inputProf;
+
+       QFileInfo fi(fn);
        if (!fi.exists())
                return ret;
        QString ext = fi.suffix().toLower();
-       QString profileName;
-       bool hasEmbeddedProfile = false;
+
+       QStringList fmtImg;
        QList<QByteArray> fmtList = QImageReader::supportedImageFormats();
-       QStringList fmtImg;
-       ScColorTransform xform;
-       ScColorProfile inputProf;
        for (int i = 0; i < fmtList.count(); i++)
-       {
                fmtImg.append( QString(fmtList[i].toLower()) );
-       }
-//     bool found = false;
 
        // Do some basic checks when requestType is OutputProfile
        if (requestType == OutputProfile)
@@ -2286,6 +2285,8 @@
        QString ext2 = getImageType(fn);
        if (ext.isEmpty() || (!ext2.isEmpty() && (ext2 != ext)))
                ext = ext2;
+
+       QScopedPointer<ScImgDataLoader> pDataLoader;
        if (extensionIndicatesPDF(ext))
                pDataLoader.reset( new ScImgDataLoader_PDF() );
        else if (extensionIndicatesEPSorPS(ext))

Modified: trunk/Scribus/scribus/transaction.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/transaction.h
==============================================================================
--- trunk/Scribus/scribus/transaction.h (original)
+++ trunk/Scribus/scribus/transaction.h Sun Oct  3 20:23:49 2021
@@ -50,7 +50,7 @@
        class TransactionStateBase : public QSharedData
        {
        public:
-               virtual ~TransactionStateBase() {};
+               virtual ~TransactionStateBase() = default;
 
                Status m_status;
        };
@@ -67,7 +67,7 @@
            can cancel in the subclass destructor; the commit here then will do 
nothing.
            Don't forget to set m_data to NULL if you free the m_data pointer!
         */
-       virtual ~Transaction() {};
+       virtual ~Transaction() = default;
 
        /**
                Test if transaction has some valid data 

Modified: trunk/Scribus/scribus/undogui.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/undogui.cpp
==============================================================================
--- trunk/Scribus/scribus/undogui.cpp   (original)
+++ trunk/Scribus/scribus/undogui.cpp   Sun Oct  3 20:23:49 2021
@@ -182,11 +182,6 @@
        }
 }
 
-UndoWidget::~UndoWidget()
-{
-
-}
-
 /*** UndoPalette 
**************************************************************/
 
 UndoPalette::UndoPalette(QWidget* parent, const char* name) : UndoGui(parent, 
name)
@@ -196,8 +191,6 @@
        setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
 
        container = new QWidget(this);
-       currentSelection = 0;
-       redoItems = 0;
        QVBoxLayout* layout = new QVBoxLayout(container);
        layout->setContentsMargins(3, 3, 3, 3);
        layout->setSpacing(3);
@@ -332,7 +325,7 @@
        undoList->scrollToItem(undoList->item(currentSelection));
        for (int i = 0; i < undoList->count(); ++i)
        {
-               UndoItem *item = dynamic_cast<UndoItem*>(undoList->item(i));
+               auto *item = dynamic_cast<UndoItem*>(undoList->item(i));
                if (!item)
                        continue;
 
@@ -381,7 +374,7 @@
 
 void UndoPalette::showToolTip(QListWidgetItem *i)
 {
-       UndoItem *item = dynamic_cast<UndoItem*>(i);
+       auto *item = dynamic_cast<UndoItem*>(i);
        if (item)
        {
                QString tip = item->getDescription();
@@ -397,28 +390,17 @@
        undoList->setToolTip("");
 }
 
-UndoPalette::~UndoPalette()
-{
-
-}
-
 /*** UndoPalette::UndoItem 
****************************************************/
 
-UndoPalette::UndoItem::UndoItem()
-{
-       targetpixmap = nullptr;
-       actionpixmap = nullptr;
-       isUndoAction_ = true;
-}
-
 UndoPalette::UndoItem::UndoItem(const UndoItem &another)
-{
-       target = another.target;
-       action = another.action;
-       description = another.description;
-       targetpixmap = another.targetpixmap;
-       actionpixmap = another.actionpixmap;
-       isUndoAction_ = another.isUndoAction_;
+       : m_targetPixmap(another.m_targetPixmap),
+         m_actionPixmap(another.m_actionPixmap),
+         m_target(another.m_target),
+         m_action(another.m_action),
+         m_description(another.m_description),
+         m_isUndoAction(another.m_isUndoAction)
+{
+
 }
 
 UndoPalette::UndoItem::UndoItem(const QString &targetName,
@@ -430,12 +412,12 @@
                                 QListWidget * parent
                                                           )
        : QListWidgetItem(parent),
-       targetpixmap(targetPixmap),
-       actionpixmap(actionPixmap),
-       target(targetName),
-       action(actionName),
-       description(actionDescription),
-       isUndoAction_(isUndoAction)
+       m_targetPixmap(targetPixmap),
+       m_actionPixmap(actionPixmap),
+       m_target(targetName),
+       m_action(actionName),
+       m_description(actionDescription),
+       m_isUndoAction(isUndoAction)
 {
        /*TODO: 16x16 is hardcoded, because images automatically scaled by 
QIcon are no longer recognizable 
        would be better to have the icons designed for 16x16*/
@@ -461,25 +443,20 @@
        setText(tr("%1 - %2\n%3").arg(targetName, actionName, 
actionDescription));
 }
 
-QString UndoPalette::UndoItem::getDescription()
-{
-  return description;
-}
-
-bool UndoPalette::UndoItem::isUndoAction()
-{
-       return isUndoAction_;
+QString UndoPalette::UndoItem::getDescription() const
+{
+  return m_description;
+}
+
+bool UndoPalette::UndoItem::isUndoAction() const
+{
+       return m_isUndoAction;
 }
 
 void UndoPalette::UndoItem::setUndoAction(bool isUndo)
 {
-       isUndoAction_ = isUndo;
+       m_isUndoAction = isUndo;
        QFont f = font();
-       f.setItalic(!isUndoAction_);
+       f.setItalic(!m_isUndoAction);
        setFont(f);
 }
-
-UndoPalette::UndoItem::~UndoItem()
-{
-
-}

Modified: trunk/Scribus/scribus/undogui.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/undogui.h
==============================================================================
--- trunk/Scribus/scribus/undogui.h     (original)
+++ trunk/Scribus/scribus/undogui.h     Sun Oct  3 20:23:49 2021
@@ -154,12 +154,10 @@
        static const uint MENU_HEIGHT = 5;
        std::vector<QString> undoItems;
        std::vector<QString> redoItems;
-       /* BnF buttons
-       QToolButton* undoButton;
-       QToolButton* redoButton;
-       */
-       QMenu* undoMenu;
-       QMenu* redoMenu;
+
+       QMenu* undoMenu { nullptr };
+       QMenu* redoMenu { nullptr };
+
        void updateUndoMenu();
        void updateRedoMenu();
 
@@ -168,7 +166,7 @@
        UndoWidget(QWidget* parent = nullptr, const char* name = 0);
 
        /** @brief Destroys the widget */
-       virtual ~UndoWidget();
+       virtual ~UndoWidget() = default;
 
        /** @brief Empties the undo stack for this widget. */
        void clear() override;
@@ -273,7 +271,7 @@
        UndoPalette(QWidget* parent = nullptr, const char* name = 0);
 
        /** @brief Destroys the widget */
-       ~UndoPalette();
+       ~UndoPalette() = default;
 
        /** @brief Empties the undo stack for this widget. */
        void clear() override;
@@ -306,21 +304,21 @@
        {
        private:
                /** @brief An icon for the undo target */
-               QPixmap *targetpixmap { nullptr };
+               QPixmap *m_targetPixmap { nullptr };
                /** @brief An icon for the undo state (action) */
-               QPixmap *actionpixmap { nullptr };
+               QPixmap *m_actionPixmap { nullptr };
                /** @brief Name of the target of the state (action) */
-               QString target;
+               QString m_target;
                /** @brief Undo action's name */
-               QString action;
+               QString m_action;
                /** @brief Description of the action */
-               QString description;
+               QString m_description;
                /** @brief Does this item describe an undo action if false it's 
a redo action */
-               bool isUndoAction_ { true };
+               bool m_isUndoAction { true };
 
        public:
                /** @brief Create an empty UndoItem object */
-               UndoItem();
+               UndoItem() = default;
                /**
                 * @brief Create a copy of <code>another</code> UndoItem 
instance.
                 * @param another UndoItem instance to copy
@@ -345,13 +343,11 @@
                  QPixmap *actionPixmap,
                         bool isUndoAction,
                                 QListWidget* parent = nullptr);
-               ~UndoItem();
-
-               /*void paint(QPainter *painter);
-               int height(const QListWidget*) const;
-               int width(const QListWidget*) const;*/
-               QString getDescription();
-               bool isUndoAction();
+               ~UndoItem() = default;
+
+               QString getDescription() const;
+
+               bool isUndoAction() const;
                void setUndoAction(bool isUndo);
        };
        

Modified: trunk/Scribus/scribus/undomanager.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp       (original)
+++ trunk/Scribus/scribus/undomanager.cpp       Sun Oct  3 20:23:49 2021
@@ -77,7 +77,6 @@
 
 UndoManager::UndoManager()
 {
-       m_currentUndoObjectId = -1;
        if (!UndoManager::IGuides)
                initIcons();
        prefs_ = PrefsManager::instance().prefsFile->getContext("undo");
@@ -101,22 +100,22 @@
                return UndoTransaction(nullptr);
        
        /** @brief Dummy object for storing transaction target's name */
-       UndoObject* transactionTarget_ = new DummyUndoObject();
-       TransactionState* transactionState_ = new TransactionState();
-       transactionTarget_->setUName(targetName); // Name which will be in 
action history
+       UndoObject* transactionTarget = new DummyUndoObject();
+       TransactionState* transactionState = new TransactionState();
+       transactionTarget->setUName(targetName); // Name which will be in 
action history
        if (targetPixmap)
-               transactionTarget_->setUPixmap(targetPixmap);
+               transactionTarget->setUPixmap(targetPixmap);
        if (name.length() > 0)          // if left to 0 length action will be 
fetched from the
-               transactionState_->setName(name); // last added UndoState in 
this transaction
+               transactionState->setName(name); // last added UndoState in 
this transaction
        if (description.length() > 0)
-               transactionState_->setDescription(description); // tool tip for 
action history
+               transactionState->setDescription(description); // tool tip for 
action history
        if (actionPixmap)
-               transactionState_->setPixmap(actionPixmap); // for action 
history
+               transactionState->setPixmap(actionPixmap); // for action history
 
        // Holds the state and data of this transaction:
-       TransactionData *transaction = new TransactionData();
-       transaction->transactionObject = transactionTarget_;
-       transaction->transactionState = transactionState_;
+       auto *transaction = new TransactionData();
+       transaction->transactionObject = transactionTarget;
+       transaction->transactionState = transactionState;
        transaction->stackLevel = m_transactions.size();
        transaction->UM = this;
        
@@ -126,7 +125,7 @@
        return UndoTransaction(transaction);
 }
 
-bool UndoManager::isTransactionMode()
+bool UndoManager::isTransactionMode() const
 {
        return !m_transactions.empty();
 }
@@ -302,16 +301,17 @@
 
 void UndoManager::removeStack(const QString& stackName)
 {
-       if (m_stacks.contains(stackName))
-       {
-               m_stacks[stackName].clear();
-               m_stacks.remove(stackName);
-               if (m_currentDoc == stackName)
-               {
-                       for (size_t i = 0; i < m_undoGuis.size(); ++i)
-                               m_undoGuis[i]->clear();
-                       m_currentDoc = "__no_name__";
-               }
+       auto stackIt = m_stacks.find(stackName);
+       if (stackIt == m_stacks.end())
+               return;
+
+       stackIt->clear();
+       m_stacks.remove(stackName);
+       if (m_currentDoc == stackName)
+       {
+               for (size_t i = 0; i < m_undoGuis.size(); ++i)
+                       m_undoGuis[i]->clear();
+               m_currentDoc = "__no_name__";
        }
 }
 
@@ -336,7 +336,7 @@
 
        if (!m_undoEnabled) // if so flush down the state
        {
-               TransactionState *ts = dynamic_cast<TransactionState*>(state);
+               auto *ts = dynamic_cast<TransactionState*>(state);
                if (ts) // flush the TransactionObject too
                        delete target;
                delete state;
@@ -415,16 +415,22 @@
        setTexts();
 }
 
-bool UndoManager::hasUndoActions(int )
+bool UndoManager::hasUndoActions(int ) const
 {
        // TODO Needs to fixed for object specific mode
-       return m_stacks[m_currentDoc].undoItems() > 0;
-}
-
-bool UndoManager::hasRedoActions(int )
+       auto currentStackIt = m_stacks.constFind(m_currentDoc);
+       if (currentStackIt != m_stacks.constEnd())
+               return (currentStackIt->undoItems() > 0);
+       return false;
+}
+
+bool UndoManager::hasRedoActions(int ) const
 {
        // TODO Needs to be fixed for object specific mode
-       return m_stacks[m_currentDoc].redoItems() > 0;
+       auto currentStackIt = m_stacks.constFind(m_currentDoc);
+       if (currentStackIt != m_stacks.constEnd())
+               return (currentStackIt->redoItems() > 0);
+       return false;
 }
 
 void UndoManager::showObject(int uid)
@@ -500,14 +506,15 @@
        }
 }
 
-int UndoManager::getHistoryLength()
-{
-       if (!m_stacks.empty() && m_stacks[m_currentDoc].redoItems() > 0)
-               return -1;
-       return static_cast<int>(m_stacks[m_currentDoc].maxSize());
-}
-
-bool UndoManager::isGlobalMode()
+int UndoManager::getHistoryLength() const
+{
+       auto currentStackIt = m_stacks.constFind(m_currentDoc);
+       if ((currentStackIt != m_stacks.constEnd()) && 
(currentStackIt->redoItems() <= 0))
+               return static_cast<int>(currentStackIt->maxSize());
+       return -1;
+}
+
+bool UndoManager::isGlobalMode() const
 {
        return m_currentUndoObjectId == -1;
 }
@@ -519,7 +526,7 @@
 
        if (currentStack.undoItems() > 0)
        {
-               UndoState *state = 
currentStack.getNextUndo(m_currentUndoObjectId);
+               const UndoState *state = 
currentStack.getNextUndo(m_currentUndoObjectId);
                if (state)
                        
scMW->scrActions["editUndoAction"]->setTexts(QString(Um::MenuUndo).arg(state->getName()));
                else
@@ -530,7 +537,7 @@
 
        if (currentStack.redoItems() > 0)
        {
-               UndoState *state = 
currentStack.getNextRedo(m_currentUndoObjectId);
+               const UndoState *state = 
currentStack.getNextRedo(m_currentUndoObjectId);
                if (state)
                        
scMW->scrActions["editRedoAction"]->setTexts(QString(Um::MenuRedo).arg(state->getName()));
                else
@@ -551,10 +558,8 @@
        StackMap::iterator it;
        for (it = m_stacks.begin(); it != m_stacks.end(); ++it)
        {
-               for (uint i = 0; i < (*it).size(); ++i)
-               {
-                       (*it).clear();
-               }
+               for (uint i = 0; i < it->size(); ++i)
+                       it->clear();
        }
        m_stacks.clear();
 }

Modified: trunk/Scribus/scribus/undomanager.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Sun Oct  3 20:23:49 2021
@@ -183,7 +183,7 @@
         * @brief Returns true if in transaction mode if not will return false.
         * @return bool true if in transaction mode if not will return false
         */
-       bool isTransactionMode();
+       bool isTransactionMode() const;
        
        /**
         * @brief Register an UndoGui to the UndoManager.
@@ -234,14 +234,14 @@
         * or disabled depending on the status of the undo stack.
         * @return true if there are actions that can be undone otherwise 
returns false
         */
-       bool hasUndoActions(int uid = -1);
+       bool hasUndoActions(int uid = -1) const;
        
        /**
         * @brief Returns true if there are actions that can be redone 
otherwise returns false.
         * @return true if there are actions that can be redone otherwise 
returns false
         * @sa UndoManager::hasUndoActions()
         */
-       bool hasRedoActions(int uid = -1);
+       bool hasRedoActions(int uid = -1) const;
        
        /**
         * @brief Replace an UndoObject with the id uid with a new UndoObject 
new.
@@ -255,13 +255,13 @@
         * @brief Returns the maximum length of the undostack.
         * @return the maximum length of the undostack
         */
-       int getHistoryLength();
+       int getHistoryLength() const;
 
        /**
         * @brief Returns true if in global mode and false if in object 
specific mode.
         * @return true if in global mode and false if in object specific mode
         */
-       bool isGlobalMode();
+       bool isGlobalMode() const;
 
        UndoState* getLastUndo();
 
@@ -288,7 +288,7 @@
         */
        static int m_undoEnabledCounter;
 
-       PrefsContext *prefs_;
+       PrefsContext* prefs_ { nullptr };
 
        /** @brief Doc to which the currently active stack belongs */
        QString m_currentDoc;
@@ -297,7 +297,7 @@
         * @brief Id number of the object for what the object specific undo is 
shown
         * @brief or -1 if global undo is used.
         */
-       int m_currentUndoObjectId;
+       int m_currentUndoObjectId { -1 };
 
        /**
         * @brief Stores the transactions which are currently started but not

Modified: trunk/Scribus/scribus/undostate.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/undostate.cpp
==============================================================================
--- trunk/Scribus/scribus/undostate.cpp (original)
+++ trunk/Scribus/scribus/undostate.cpp Sun Oct  3 20:23:49 2021
@@ -28,7 +28,6 @@
 #include "undoobject.h"
 
 UndoState::UndoState(const QString& name, const QString& description, QPixmap* 
pixmap) :
-       transactionCode(0),
        m_actionName(name),
        m_actionDescription(description),
        m_actionPixmap(pixmap),
@@ -89,45 +88,38 @@
        return m_undoObject;
 }
 
-UndoState::~UndoState()
-{
-
-}
-
 /*** SimpleState 
**************************************************************/
 
 SimpleState::SimpleState(const QString& name, const QString& description, 
QPixmap* pixmap)
-: UndoState(name, description, pixmap)
-{
-
-}
-
-bool SimpleState::contains(const QString& key)
+           : UndoState(name, description, pixmap)
+{
+
+}
+
+bool SimpleState::contains(const QString& key) const
 {
        return m_values.contains(key);
 }
 
-QVariant SimpleState::variant(const QString& key, const QVariant& def)
+QVariant SimpleState::variant(const QString& key, const QVariant& def) const
 {
        QMap<QString, QVariant>::const_iterator it = m_values.constFind(key);
        if (it != m_values.constEnd())
                return it.value();
 
-       m_values[key] = def;
        return def;
 }
 
-QString SimpleState::get(const QString& key, const QString& def)
+QString SimpleState::get(const QString& key, const QString& def) const
 {
        QMap<QString, QVariant>::const_iterator it = m_values.constFind(key);
        if (it != m_values.constEnd())
                return it.value().toString();
 
-       m_values[key] = def;
        return def;
 }
 
-bool SimpleState::getBool(const QString& key, bool def)
+bool SimpleState::getBool(const QString& key, bool def) const
 {
        bool ok = false;
        QVariant retVar = variant(key, QVariant(def));
@@ -137,7 +129,7 @@
        return ret;
 }
 
-int SimpleState::getInt(const QString& key, int def)
+int SimpleState::getInt(const QString& key, int def) const
 {
        bool ok = false;
        QVariant retVar = variant(key, QVariant(def));
@@ -147,7 +139,7 @@
        return ret;
 }
 
-uint SimpleState::getUInt(const QString& key, uint def)
+uint SimpleState::getUInt(const QString& key, uint def) const
 {
        bool ok = false;
        QVariant retVar = variant(key, QVariant(def));
@@ -157,7 +149,7 @@
        return ret;
 }
 
-double SimpleState::getDouble(const QString& key, double def)
+double SimpleState::getDouble(const QString& key, double def) const
 {
        bool ok = false;
        QVariant retVar = variant(key, QVariant(def));
@@ -167,7 +159,7 @@
        return ret;
 }
 
-void* SimpleState::getVoidPtr(const QString& key, void* def)
+void* SimpleState::getVoidPtr(const QString& key, void* def) const
 {
        void* ret = nullptr;
        QVariant retVar = variant(key, QVariant::fromValue(def));
@@ -212,16 +204,11 @@
        m_values[key] = QVariant::fromValue<void*>(ptr);
 }
 
-SimpleState::~SimpleState()
-{
-
-}
-
 /*** TransactionState *****************************************************/
 
 TransactionState::TransactionState() : UndoState(QString())
 {
-       m_size = 0;
+
 }
 
 UndoState* TransactionState::at(int index) const

Modified: trunk/Scribus/scribus/undostate.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/undostate.h
==============================================================================
--- trunk/Scribus/scribus/undostate.h   (original)
+++ trunk/Scribus/scribus/undostate.h   Sun Oct  3 20:23:49 2021
@@ -66,9 +66,9 @@
         * @param description Description of the state (action)
         * @param pixmap Pointer to an icon describing the action visually.
         */
-       UndoState(const QString& name, const QString& description = 0, QPixmap* 
pixmap = nullptr);
-
-       virtual ~UndoState();
+       UndoState(const QString& name, const QString& description = QString(), 
QPixmap* pixmap = nullptr);
+
+       virtual ~UndoState() = default;
 
        /**
         * @brief Returns name of the state (action).
@@ -118,7 +118,8 @@
        virtual void setUndoObject(UndoObject *object);
        /** @brief return the UndoObject this state belongs to */
        virtual UndoObject* undoObject();
-       int transactionCode;
+
+       int transactionCode { 0 };
 
 private:
        /** @brief Name of the state (operation) (f.e. Move object) */
@@ -152,16 +153,16 @@
         * @param description Description of the state (action)
         * @param pixmap Pointer to an icon describing the state (action) 
visually.
         */
-       SimpleState(const QString& name, const QString& description = 0, 
QPixmap* pixmap = nullptr);
-
-       virtual ~SimpleState();
+       SimpleState(const QString& name, const QString& description = 
QString(), QPixmap* pixmap = nullptr);
+
+       ~SimpleState() override = default;
 
        /**
         * @brief Returns true if parameter key exists in the map.
         * @param key Key that is searched from the map
         * @return true if parameter key exists in the map if not false
         */
-       bool contains(const QString& key);
+       bool contains(const QString& key) const;
 
        /**
         * @brief Returns the QString value attached to the key.
@@ -175,7 +176,7 @@
         * from the map it will be added with the value described in the param
         * <code>def</code> which is then returned.
         */
-       QString get(const QString& key, const QString& def = QString());
+       QString get(const QString& key, const QString& def = QString()) const;
 
        /**
         * @brief Returns the int value attached to the key.
@@ -192,7 +193,7 @@
         * from the map it will be added with the value described in the param
         * <code>def</code> which is then returned.
         */
-       int getInt(const QString& key, int def = 0);
+       int getInt(const QString& key, int def = 0) const;
 
        /**
         * @brief Returns the uint value attached to the key.
@@ -209,7 +210,7 @@
         * from the map it will be added with the value described in the param
         * <code>def</code> which is then returned.
         */
-       uint getUInt(const QString& key, uint def = 0);
+       uint getUInt(const QString& key, uint def = 0) const;
 
        /**
         * @brief Returns the double value attached to the key.
@@ -225,7 +226,7 @@
         * from the map it will be added with the value described in the 
parameter
         * <code>def</code> which is then returned.
         */
-       double getDouble(const QString& key, double def = 0.0);
+       double getDouble(const QString& key, double def = 0.0) const;
 
        /**
         * @brief Returns the boolean value attached to the key.
@@ -241,7 +242,7 @@
         * from the map it will be added with the value described in the 
parameter
         * <code>def</code> which is then returned.
         */
-       bool getBool(const QString& key, bool def = false);
+       bool getBool(const QString& key, bool def = false) const;
 
        /**
        * @brief Returns the pointer value attached to the key.
@@ -257,7 +258,7 @@
        * from the map it will be added with the value described in the 
parameter
        * <code>def</code> which is then returned.
        */
-       void* getVoidPtr(const QString& key, void* def = nullptr);
+       void* getVoidPtr(const QString& key, void* def = nullptr) const;
 
        /**
         * @brief Set a key with no value, to be used only for configuring 
action type
@@ -312,7 +313,7 @@
        /** @brief QMap to store key-value pairs */
        QMap<QString, QVariant> m_values;
 
-       QVariant variant(const QString& key, const QVariant& def);
+       QVariant variant(const QString& key, const QVariant& def) const;
 };
 
 /*** ItemState 
***************************************************************************/
@@ -321,9 +322,10 @@
 class ScItemState : public SimpleState
 {
 public:
-       ScItemState(const QString& name, const QString& description = 0, 
QPixmap* pixmap = nullptr)
+       ScItemState(const QString& name, const QString& description = 
QString(), QPixmap* pixmap = nullptr)
        : SimpleState(name, description, pixmap) {}
-       ~ScItemState() {}
+
+       ~ScItemState() override = default;
 
        void setItem(const C &c) { item_ = c; }
        C getItem() const { return item_; }
@@ -337,9 +339,10 @@
 class ScItemsState : public SimpleState
 {
 public:
-       ScItemsState(const QString& name, const QString& description = 0, 
QPixmap* pixmap = nullptr)
+       ScItemsState(const QString& name, const QString& description = 
QString(), QPixmap* pixmap = nullptr)
        : SimpleState(name, description, pixmap) {}
-       ~ScItemsState() {}
+
+       ~ScItemsState() override = default;
 
        void insertItem(QString itemname, void * item) { 
pointerMap.insert(itemname, item); }
        void* getItem(const QString& itemname) const;
@@ -427,7 +430,7 @@
 
 private:
        /** @brief Number of undo states stored in this transaction */
-       uint m_size;
+       uint m_size { 0 };
        /** @brief vector to keep the states in */
        std::vector<UndoState*> m_states;
 };

Modified: trunk/Scribus/scribus/util_formats.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/util_formats.cpp
==============================================================================
--- trunk/Scribus/scribus/util_formats.cpp      (original)
+++ trunk/Scribus/scribus/util_formats.cpp      Sun Oct  3 20:23:49 2021
@@ -157,10 +157,6 @@
        updateSupportedImageFormats(m_supportedImageFormats);
 }
 
-FormatsManager::~FormatsManager()
-{
-}
-
 FormatsManager* FormatsManager::instance()
 {
        if (m_instance == nullptr)
@@ -175,12 +171,7 @@
        m_instance = nullptr;
 }
 
-void FormatsManager::imageFormatSupported(const QString& ext)
-{
-//     return m_supportedImageFormats.contains(QByteArray(ext).toLatin1());
-}
-
-void FormatsManager::updateSupportedImageFormats(QList<QByteArray>& 
supportedImageFormats)
+void FormatsManager::updateSupportedImageFormats(QList<QByteArray>& 
supportedImageFormats) const
 {
        QMapIterator<int, QStringList> it(m_fmts);
        while (it.hasNext())
@@ -195,7 +186,7 @@
        }
 }
 
-QString FormatsManager::nameOfFormat(int type)
+QString FormatsManager::nameOfFormat(int type) const
 {
        QMapIterator<int, QString> it(m_fmtNames);
        while (it.hasNext())
@@ -207,7 +198,7 @@
        return QString();
 }
 
-QStringList FormatsManager::mimetypeOfFormat(int type)
+QStringList FormatsManager::mimetypeOfFormat(int type) const
 {
        QMapIterator<int, QStringList> it(m_fmtMimeTypes);
        while (it.hasNext())
@@ -219,7 +210,7 @@
        return QStringList();
 }
 
-QString FormatsManager::extensionsForFormat(int type)
+QString FormatsManager::extensionsForFormat(int type) const
 {
        QString a;
        QString b;
@@ -228,7 +219,7 @@
        return b;
 }
 
-QString FormatsManager::fileDialogFormatList(int type)
+QString FormatsManager::fileDialogFormatList(int type) const
 {
        QString a;
        QString b;
@@ -237,7 +228,7 @@
        return a + b + ";;" +c;
 }
 
-QString FormatsManager::extensionListForFormat(int type, int listType)
+QString FormatsManager::extensionListForFormat(int type, int listType) const
 {
        QString nameMatch;
        QString separator(listType==0 ? " *." : "|");
@@ -277,7 +268,7 @@
        return nameMatch;
 }
 
-void FormatsManager::fileTypeStrings(int type, QString& formatList, QString& 
formatText, QString& formatAll, bool lowerCaseOnly)
+void FormatsManager::fileTypeStrings(int type, QString& formatList, QString& 
formatText, QString& formatAll, bool lowerCaseOnly) const
 {
        QString allFormats = QObject::tr("All Supported Formats")+" (";
        QStringList formats;
@@ -294,13 +285,13 @@
                                continue;
                        if ((GIF & it.key()) && 
!m_supportedImageFormats.contains(QByteArray("gif")))
                                continue;
+
                        if (first)
-                               first=false;
+                               first = false;
                        else
-                       {
                                allFormats += " ";
-                       }
-                       QString text=m_fmtNames[it.key()] + " (";
+
+                       QString text = m_fmtNames[it.key()] + " (";
                        QStringListIterator itSL(it.value());
                        while (itSL.hasNext())
                        {
@@ -323,10 +314,10 @@
                }
                ++n;
        }
-       formatList+=allFormats + ");;";
+       formatList += allFormats + ");;";
        formats.sort(Qt::CaseInsensitive);
-       formatText+=formats.join(";;");
-       formatAll=QObject::tr("All Files (*)");
+       formatText += formats.join(";;");
+       formatAll = QObject::tr("All Files (*)");
 }
 
 bool extensionIndicatesEPS(const QString &ext)
@@ -387,41 +378,43 @@
 
 QString getImageType(const QString& filename)
 {
-       QString ret;
        QFile f(filename);
        QFileInfo fi(f);
-       if (fi.exists())
-       {
-               QByteArray buf(24, ' ');
-               if (f.open(QIODevice::ReadOnly))
-               {
-                       f.read(buf.data(), 24);
-                       if ((buf[0] == '%') && (buf[1] == '!') && (buf[2] == 
'P') && (buf[3] == 'S') && (buf[4] == '-') && (buf[5] == 'A'))
-                               ret = "eps";
-                       else if ((buf[0] == '\xC5') && (buf[1] == '\xD0') && 
(buf[2] == '\xD3') && (buf[3] == '\xC6'))
-                               ret = "eps";
-                       else if ((buf[0] == 'G') && (buf[1] == 'I') && (buf[2] 
== 'F') && (buf[3] == '8'))
-                               ret = "gif";
-                       else if ((buf[0] == '\xFF') && (buf[1] == '\xD8') && 
(buf[2] == '\xFF'))
-                               ret = "jpg";
-                       else if ((buf[20] == 'G') && (buf[21] == 'P') && 
(buf[22] == 'A') && (buf[23] == 'T'))
-                               ret = "pat";
-                       else if ((buf[0] == '%') && (buf[1] == 'P') && (buf[2] 
== 'D') && (buf[3] == 'F'))
-                               ret = "pdf";
-                       else if ((buf[0] == 'P') && (buf[1] == 'G') && (buf[2] 
== 'F'))
-                               ret = "pgf";
-                       else if ((buf[0] == '\x89') && (buf[1] == 'P') && 
(buf[2] == 'N') && (buf[3] == 'G'))
-                               ret = "png";
-                       else if ((buf[0] == '8') && (buf[1] == 'B') && (buf[2] 
== 'P') && (buf[3] == 'S'))
-                               ret = "psd";
-                       else if (((buf[0] == 'I') && (buf[1] == 'I') && (buf[2] 
== '\x2A')) || ((buf[0] == 'M') && (buf[1] == 'M') && (buf[3] == '\x2A')))
-                               ret = "tif";
-                       else if ((buf[0] == '/') && (buf[1] == '*') && (buf[2] 
== ' ') && (buf[3] == 'X') && (buf[4] == 'P') && (buf[5] == 'M'))
-                               ret = "xpm";
-                       else if ((buf[0] == 'V') && (buf[1] == 'C') && (buf[2] 
== 'L') && (buf[3] == 'M') && (buf[4] == 'T') && (buf[5] == 'F'))
-                               ret = "svm";
-                       f.close();
-               }
-       }
+       if (!fi.exists())
+               return QString();
+
+       if (!f.open(QIODevice::ReadOnly))
+               return QString();
+
+       QString ret;
+       QByteArray buf(24, ' ');
+       f.read(buf.data(), 24);
+       
+       if ((buf[0] == '%') && (buf[1] == '!') && (buf[2] == 'P') && (buf[3] == 
'S') && (buf[4] == '-') && (buf[5] == 'A'))
+               ret = "eps";
+       else if ((buf[0] == '\xC5') && (buf[1] == '\xD0') && (buf[2] == '\xD3') 
&& (buf[3] == '\xC6'))
+               ret = "eps";
+       else if ((buf[0] == 'G') && (buf[1] == 'I') && (buf[2] == 'F') && 
(buf[3] == '8'))
+               ret = "gif";
+       else if ((buf[0] == '\xFF') && (buf[1] == '\xD8') && (buf[2] == '\xFF'))
+               ret = "jpg";
+       else if ((buf[20] == 'G') && (buf[21] == 'P') && (buf[22] == 'A') && 
(buf[23] == 'T'))
+               ret = "pat";
+       else if ((buf[0] == '%') && (buf[1] == 'P') && (buf[2] == 'D') && 
(buf[3] == 'F'))
+               ret = "pdf";
+       else if ((buf[0] == 'P') && (buf[1] == 'G') && (buf[2] == 'F'))
+               ret = "pgf";
+       else if ((buf[0] == '\x89') && (buf[1] == 'P') && (buf[2] == 'N') && 
(buf[3] == 'G'))
+               ret = "png";
+       else if ((buf[0] == '8') && (buf[1] == 'B') && (buf[2] == 'P') && 
(buf[3] == 'S'))
+               ret = "psd";
+       else if (((buf[0] == 'I') && (buf[1] == 'I') && (buf[2] == '\x2A')) || 
((buf[0] == 'M') && (buf[1] == 'M') && (buf[3] == '\x2A')))
+               ret = "tif";
+       else if ((buf[0] == '/') && (buf[1] == '*') && (buf[2] == ' ') && 
(buf[3] == 'X') && (buf[4] == 'P') && (buf[5] == 'M'))
+               ret = "xpm";
+       else if ((buf[0] == 'V') && (buf[1] == 'C') && (buf[2] == 'L') && 
(buf[3] == 'M') && (buf[4] == 'T') && (buf[5] == 'F'))
+               ret = "svm";
+       f.close();
+
        return ret;
 }

Modified: trunk/Scribus/scribus/util_formats.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/util_formats.h
==============================================================================
--- trunk/Scribus/scribus/util_formats.h        (original)
+++ trunk/Scribus/scribus/util_formats.h        Sun Oct  3 20:23:49 2021
@@ -103,7 +103,7 @@
                };
 */
                FormatsManager();
-               ~FormatsManager();
+               ~FormatsManager() = default;
 
        /**
                 * @brief Returns a pointer to the FormatsManager instance
@@ -115,21 +115,21 @@
                 * Must be called when FormatsManager is no longer needed.
         */
                static void deleteInstance();
-               void imageFormatSupported(const QString&);
+
                //! Returns the name of a format, eg "Encapsulated PostScript"
-               QString nameOfFormat(int type);
+               QString nameOfFormat(int type) const;
                
                //! Returns the mimetypes of a format, eg 
"application/postscript"
-               QStringList mimetypeOfFormat(int type);
+               QStringList mimetypeOfFormat(int type) const;
                
                //! Returns in the form of "EPS (*.eps *.EPS *.epsf *.EPSF 
*.epsi *.EPSI)"
-               QString extensionsForFormat(int type);
+               QString extensionsForFormat(int type) const;
                
                //! Returns in the form of "*.eps *.epsf *.epsi" or 
"eps|epsf|epsi"
-               QString extensionListForFormat(int type, int listType);
+               QString extensionListForFormat(int type, int listType) const;
                
                //! Returns in the form of "All Supported Formats (*.eps *.EPS 
*.epsf *.EPSF *.epsi *.EPSI);;EPS (*.eps *.EPS);;EPSI (*.epsf *.EPSF);;EPSI 
(*.epsi *.EPSI);;All Files (*)"
-               QString fileDialogFormatList(int type);
+               QString fileDialogFormatList(int type) const;
                
        protected:
                QMap<int, QString> m_fmtNames;
@@ -139,8 +139,9 @@
                
                QList<QByteArray> m_qtSupportedImageFormats;
                QList<QByteArray> m_supportedImageFormats;
-               void updateSupportedImageFormats(QList<QByteArray>& 
supportedImageFormats);
-               void fileTypeStrings(int type, QString& formatList, QString& 
formatText, QString& formatAll, bool lowerCaseOnly=false);
+
+               void updateSupportedImageFormats(QList<QByteArray>& 
supportedImageFormats) const;
+               void fileTypeStrings(int type, QString& formatList, QString& 
formatText, QString& formatAll, bool lowerCaseOnly=false) const;
                
        private:
        /**

Modified: trunk/Scribus/scribus/util_ghostscript.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24730&path=/trunk/Scribus/scribus/util_ghostscript.cpp
==============================================================================
--- trunk/Scribus/scribus/util_ghostscript.cpp  (original)
+++ trunk/Scribus/scribus/util_ghostscript.cpp  Sun Oct  3 20:23:49 2021
@@ -237,8 +237,10 @@
        QProcess proc;
        proc.start(gsExe.toLocal8Bit(), args);
        if (proc.waitForStarted(5000))
+       {
                while (!proc.waitForFinished(5000))
-                       qApp->processEvents();
+                       QCoreApplication::processEvents();
+       }
        QString gsVer;
        if (proc.exitStatus() == QProcess::NormalExit)
                gsVer = proc.readAllStandardOutput();
@@ -376,14 +378,16 @@
                DWORD keyIndex = 0;
                while (RegEnumKeyExW(hKey1, keyIndex, regVersion, 
&regVersionSize, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
                {
-                       int gsNumericVer, gsMajor, gsMinor;
+                       int gsNumericVer { 0 };
+                       int gsMajor { 0 };
+                       int gsMinor { 0 };
                        wcscpy(regPath, (const wchar_t*) regKey.utf16());
                        wcscat(regPath, L"\\");
                        wcscat(regPath, regVersion);
                        if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, regPath, 0, 
flags, &hKey2) == ERROR_SUCCESS)
                        {
                                size = sizeof(gsPath) - 2;
-                               if (RegQueryValueExW(hKey2, L"GS_DLL", 0, 
&regType, (LPBYTE) gsPath, &size) == ERROR_SUCCESS)
+                               if (RegQueryValueExW(hKey2, L"GS_DLL", nullptr, 
&regType, (LPBYTE) gsPath, &size) == ERROR_SUCCESS)
                                {
                                        // We now have GhostScript dll path, 
but we want gswin32c.exe
                                        // Normally gswin32c.exe and gsdll.dll 
are in the same directory


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to