Author: jghali
Date: Sun Oct  3 02:29:51 2021
New Revision: 24718

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

Modified:
    trunk/Scribus/scribus/filewatcher.cpp
    trunk/Scribus/scribus/filewatcher.h
    trunk/Scribus/scribus/fpoint.h
    trunk/Scribus/scribus/text/boxes.cpp
    trunk/Scribus/scribus/text/boxes.h
    trunk/Scribus/scribus/text/frect.cpp
    trunk/Scribus/scribus/text/frect.h
    trunk/Scribus/scribus/text/fsize.cpp
    trunk/Scribus/scribus/text/fsize.h
    trunk/Scribus/scribus/text/glyphcluster.cpp
    trunk/Scribus/scribus/text/glyphcluster.h
    trunk/Scribus/scribus/ui/cmykfw.cpp
    trunk/Scribus/scribus/ui/cmykfw.h
    trunk/Scribus/scribus/ui/customfdialog.cpp
    trunk/Scribus/scribus/ui/customfdialog.h
    trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp

Modified: trunk/Scribus/scribus/filewatcher.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/filewatcher.cpp
==============================================================================
--- trunk/Scribus/scribus/filewatcher.cpp       (original)
+++ trunk/Scribus/scribus/filewatcher.cpp       Sun Oct  3 02:29:51 2021
@@ -22,9 +22,6 @@
 
 FileWatcher::FileWatcher( QObject* parent) : QObject(parent)
 {
-       m_stateFlags = 0;
-       m_timeOut = 10000;
-       m_watchedFiles.clear();
        m_watchTimer = new QTimer(this);
        m_watchTimer->setSingleShot(true);
        connect(m_watchTimer, SIGNAL(timeout()), this, SLOT(checkFiles()));
@@ -139,7 +136,7 @@
        return m_watchedFiles.contains(qtFileName);
 }
 
-QList<QString> FileWatcher::files()
+QList<QString> FileWatcher::files() const
 {
        return m_watchedFiles.keys();
 }

Modified: trunk/Scribus/scribus/filewatcher.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/filewatcher.h
==============================================================================
--- trunk/Scribus/scribus/filewatcher.h (original)
+++ trunk/Scribus/scribus/filewatcher.h Sun Oct  3 02:29:51 2021
@@ -33,7 +33,8 @@
        void setTimeOut(const int newTimeOut, const bool restartTimer=false);
        // Get the timer length
        int timeOut() const;
-       QList<QString> files();
+       // Get list of watched files and directories
+       QList<QString> files() const;
        
 public slots:
        //Add a file to the watch list for monitoring
@@ -65,7 +66,7 @@
 
        };
 
-       typedef enum
+       enum StateFlags
        {
                AddRemoveBlocked  = 1,
                FileCheckRunning  = 2,
@@ -73,12 +74,12 @@
                TimerStopped  = 8,
                Dying = 16,
                FileCheckMustStop = 20 //StopRequested + Dying
-       } StateFlags;
+       };
 
        QMap<QString, fileMod> m_watchedFiles;
-       QTimer* m_watchTimer;
-       int  m_stateFlags;
-       int  m_timeOut; // milliseconds
+       QTimer* m_watchTimer { nullptr };
+       int  m_stateFlags { 0 };
+       int  m_timeOut { 10000 }; // milliseconds
 
 private slots:
        void checkFiles();

Modified: trunk/Scribus/scribus/fpoint.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/fpoint.h
==============================================================================
--- trunk/Scribus/scribus/fpoint.h      (original)
+++ trunk/Scribus/scribus/fpoint.h      Sun Oct  3 02:29:51 2021
@@ -43,14 +43,14 @@
 class SCRIBUS_API FPoint
 {
 public: 
-       FPoint() {}
+       FPoint() = default;
        FPoint(double x, double y) : xp(x), yp(y) {}
        FPoint(const QPoint & p) : xp(p.x()), yp(p.y()) {}
        FPoint(const QPointF & p) : xp(p.x()), yp(p.y()) {}
        FPoint(const FPoint & p) : xp(p.xp), yp(p.yp) {}
        //Creates a transformed point, replaces ScribusView::transformPoint()
        FPoint(double x, double y, double dx, double dy, double rot, double sx, 
double sy, bool invert=false);
-//  ~FPoint() {};
+
        FPoint& operator=(const FPoint & rhs);
        double x() const;
        double y() const;
@@ -61,10 +61,10 @@
        bool operator!=(const FPoint &rhs) const;
        FPoint &operator+=( const FPoint &p );
        FPoint &operator-=( const FPoint &p );
-       friend inline const FPoint operator+( const FPoint &, const FPoint & );
-       friend inline const FPoint operator-( const FPoint &, const FPoint & );
-       friend inline const FPoint operator*( const FPoint &, const double & );
-       friend inline const FPoint operator*( const double &, const FPoint & );
+       friend inline FPoint operator+( const FPoint &, const FPoint & );
+       friend inline FPoint operator-( const FPoint &, const FPoint & );
+       friend inline FPoint operator*( const FPoint &, const double & );
+       friend inline FPoint operator*( const double &, const FPoint & );
        friend inline double  operator*( const FPoint &a, const FPoint &b );
        //Transform an existing point
        void transform(double dx, double dy, double rot, double sx, double sy, 
bool invert);
@@ -82,24 +82,24 @@
 };
 
 
-inline const FPoint operator+( const FPoint &p1, const FPoint &p2 )
+inline FPoint operator+( const FPoint &p1, const FPoint &p2 )
 {
-       return FPoint(p1.xp+p2.xp, p1.yp+p2.yp); 
+       return FPoint(p1.xp + p2.xp, p1.yp + p2.yp); 
 }
 
-inline const FPoint operator-( const FPoint &p1, const FPoint &p2 )
+inline FPoint operator-( const FPoint &p1, const FPoint &p2 )
 {
-       return FPoint(p1.xp-p2.xp, p1.yp-p2.yp); 
+       return FPoint(p1.xp - p2.xp, p1.yp - p2.yp); 
 }
 
-inline const FPoint operator*( const FPoint &p, const double &c )
+inline FPoint operator*( const FPoint &p, const double &c )
 {
-       return FPoint(p.xp*c, p.yp*c); 
+       return FPoint(p.xp * c, p.yp * c); 
 }
 
-inline const FPoint operator*( const double &c, const FPoint &p )
+inline FPoint operator*( const double &c, const FPoint &p )
 {
-       return FPoint(p.xp*c, p.yp*c); 
+       return FPoint(p.xp * c, p.yp * c); 
 }
 
 inline double operator*( const FPoint &a, const FPoint &b )
@@ -107,7 +107,7 @@
        return a.xp * b.xp + a.yp * b.yp; 
 }
 
-inline FPoint &  FPoint::operator=(const FPoint & rhs)
+inline FPoint& FPoint::operator=(const FPoint & rhs)
 {
        xp = rhs.xp; 
        yp = rhs.yp; 

Modified: trunk/Scribus/scribus/text/boxes.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/boxes.cpp
==============================================================================
--- trunk/Scribus/scribus/text/boxes.cpp        (original)
+++ trunk/Scribus/scribus/text/boxes.cpp        Sun Oct  3 02:29:51 2021
@@ -161,32 +161,29 @@
 int LineBox::pointToPosition(QPointF coord, const StoryText &story) const
 {
        int position = GroupBox::pointToPosition(coord, story);
-       if (position < 0)
-       {
-               if (containsPoint(coord))
-               {
-                       const ParagraphStyle& style = 
story.paragraphStyle(firstChar());
-                       if (style.direction() == ParagraphStyle::RTL)
-                       {
-                               if (coord.x() < x())
-                                       position = lastChar();
-                               else
-                                       position = firstChar();
-                       }
-                       else
-                       {
-                               if (coord.x() < x())
-                                       position = firstChar();
-                               else
-                                       position = lastChar();
-                       }
-                       if (position == story.length() - 1)
-                       {
-                               if (m_firstChar == m_lastChar)
-                                       position = m_lastChar;
-                               else if 
(!SpecialChars::isBreak(story.text(position)))
-                                       position = story.length();
-                       }
+       if (position < 0 && containsPoint(coord))
+       {
+               const ParagraphStyle& style = story.paragraphStyle(firstChar());
+               if (style.direction() == ParagraphStyle::RTL)
+               {
+                       if (coord.x() < x())
+                               position = lastChar();
+                       else
+                               position = firstChar();
+               }
+               else
+               {
+                       if (coord.x() < x())
+                               position = firstChar();
+                       else
+                               position = lastChar();
+               }
+               if (position == story.length() - 1)
+               {
+                       if (m_firstChar == m_lastChar)
+                               position = m_lastChar;
+                       else if (!SpecialChars::isBreak(story.text(position)))
+                               position = story.length();
                }
        }
 
@@ -774,7 +771,7 @@
                        else
                                componentX = x() + (componentWidth * i);
 
-                       if ((coord.x() >= componentX && coord.x() <= componentX 
+ componentWidth))
+                       if ((coord.x() >= componentX) && (coord.x() <= 
componentX + componentWidth))
                        {
                                if (coord.x() <= componentX + componentWidth / 
2.0)
                                        return rtlLayout ? (firstChar() + i + 
1) : (firstChar() + i);

Modified: trunk/Scribus/scribus/text/boxes.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/boxes.h
==============================================================================
--- trunk/Scribus/scribus/text/boxes.h  (original)
+++ trunk/Scribus/scribus/text/boxes.h  Sun Oct  3 02:29:51 2021
@@ -41,16 +41,7 @@
                D_Vertical
        };
 
-       Box()
-       {
-               m_type = T_Invalid;
-               m_direction = D_Horizontal;
-               m_x = m_y = m_width = m_ascent = m_descent = 0;
-               m_firstChar = 0;
-               m_lastChar = 0;
-               m_naturalAscent = 0;
-               m_naturalDescent = 0;
-       }
+       Box() = default;
 
        virtual ~Box()
        {
@@ -107,7 +98,7 @@
        int lastChar() const { return m_lastChar == INT_MIN ? 0 : m_lastChar; }
 
        /// Sets the transformation matrix to applied to the box.
-       void setMatrix(QTransform x) { m_matrix = x; }
+       void setMatrix(const QTransform& x) { m_matrix = x; }
 
        /// The transformation matrix applied to the box.
        const QTransform& matrix() const { return m_matrix; }
@@ -143,26 +134,26 @@
        BoxType type() const { return m_type; }
 
 protected:
-       BoxType m_type;
-       BoxDirection m_direction;
-       double m_x;
-       double m_y;
-       double m_width;
-       double m_descent;
-       double m_ascent;
+       BoxType m_type { T_Invalid };
+       BoxDirection m_direction { D_Horizontal };
+       double m_x { 0.0 };
+       double m_y { 0.0 };
+       double m_width { 0.0 };
+       double m_descent { 0.0 };
+       double m_ascent { 0.0 };
        QList<Box*> m_boxes;
-       int m_firstChar;
-       int m_lastChar;
+       int m_firstChar { 0 };
+       int m_lastChar { 0 };
        QTransform m_matrix;
-       double m_naturalAscent;
-       double m_naturalDescent;
+       double m_naturalAscent { 0.0 };
+       double m_naturalDescent { 0.0 };
 };
 
 
 class GroupBox: public Box
 {
 public:
-       GroupBox(BoxDirection direction)
+       explicit GroupBox(BoxDirection direction)
        {
                m_type = T_Block;
                m_direction = direction;
@@ -244,7 +235,7 @@
 class GlyphBox: public Box
 {
 public:
-       GlyphBox(const GlyphCluster& run)
+       explicit GlyphBox(const GlyphCluster& run)
                : m_glyphRun(run)
                , m_effects(run.style().effects())
        {
@@ -275,7 +266,7 @@
 class ObjectBox: public GlyphBox
 {
 public:
-       ObjectBox(const GlyphCluster& run, ITextContext* ctx)
+       ObjectBox(const GlyphCluster& run, const ITextContext* ctx)
                : GlyphBox(run)
                , m_object(ctx->object(run.object()))
        {

Modified: trunk/Scribus/scribus/text/frect.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/frect.cpp
==============================================================================
--- trunk/Scribus/scribus/text/frect.cpp        (original)
+++ trunk/Scribus/scribus/text/frect.cpp        Sun Oct  3 02:29:51 2021
@@ -105,10 +105,10 @@
 
 FRect::FRect( FPoint &topLeft, FPoint &bottomRight )
 {
-       x1 = (qreal)topLeft.x();
-       y1 = (qreal)topLeft.y();
-       x2 = (qreal)bottomRight.x();
-       y2 = (qreal)bottomRight.y();
+       x1 = topLeft.x();
+       y1 = topLeft.y();
+       x2 = bottomRight.x();
+       y2 = bottomRight.y();
 }
 
 /*!
@@ -118,10 +118,10 @@
 
 FRect::FRect( FPoint &topLeft, FSize &size )
 {
-       x1 = (qreal)topLeft.x();
-       y1 = (qreal)topLeft.y();
-       x2 = (qreal)(x1+size.width());
-       y2 = (qreal)(y1+size.height());
+       x1 = topLeft.x();
+       y1 = topLeft.y();
+       x2 = (x1 + size.width());
+       y2 = (y1 + size.height());
 }
 
 /*!
@@ -368,7 +368,7 @@
 
        \sa topLeft(), moveTopLeft(), setBottomRight(), setTopRight(), 
setBottomLeft()
 */
-void FRect::setTopLeft( FPoint &p )
+void FRect::setTopLeft( const FPoint &p )
 {
        setLeft( p.x() );
        setTop( p.y() );
@@ -381,7 +381,7 @@
 
        \sa bottomRight(), moveBottomRight(), setTopLeft(), setTopRight(), 
setBottomLeft()
 */
-void FRect::setBottomRight( FPoint &p )
+void FRect::setBottomRight( const FPoint &p )
 {
        setRight( p.x() );
        setBottom( p.y() );
@@ -394,7 +394,7 @@
 
        \sa topRight(), moveTopRight(), setTopLeft(), setBottomRight(), 
setBottomLeft()
 */
-void FRect::setTopRight( FPoint &p )
+void FRect::setTopRight( const FPoint &p )
 {
        setRight( p.x() );
        setTop( p.y() );
@@ -407,7 +407,7 @@
 
        \sa bottomLeft(), moveBottomLeft(), setTopLeft(), setBottomRight(), 
setTopRight()
 */
-void FRect::setBottomLeft( FPoint &p )
+void FRect::setBottomLeft( const FPoint &p )
 {
        setLeft( p.x() );
        setBottom( p.y() );
@@ -493,8 +493,8 @@
 */
 void FRect::moveLeft( qreal pos )
 {
-       x2 += (qreal)(pos - x1);
-       x1 = (qreal)pos;
+       x2 += (pos - x1);
+       x1 = pos;
 }
 
 /*!
@@ -506,8 +506,8 @@
 
 void FRect::moveTop( qreal pos )
 {
-       y2 += (qreal)(pos - y1);
-       y1 = (qreal)pos;
+       y2 += (pos - y1);
+       y1 = pos;
 }
 
 /*!
@@ -519,8 +519,8 @@
 
 void FRect::moveRight( qreal pos )
 {
-       x1 += (qreal)(pos - x2);
-       x2 = (qreal)pos;
+       x1 += (pos - x2);
+       x2 = pos;
 }
 
 /*!
@@ -532,8 +532,8 @@
 
 void FRect::moveBottom( qreal pos )
 {
-       y1 += (qreal)(pos - y2);
-       y2 = (qreal)pos;
+       y1 += (pos - y2);
+       y2 = pos;
 }
 
 /*!
@@ -543,7 +543,7 @@
        \sa topLeft(), setTopLeft(), moveBottomRight(), moveTopRight(), 
moveBottomLeft()
 */
 
-void FRect::moveTopLeft( FPoint &p )
+void FRect::moveTopLeft( const FPoint &p )
 {
        moveLeft( p.x() );
        moveTop( p.y() );
@@ -556,7 +556,7 @@
        \sa bottomRight(), setBottomRight(), moveTopLeft(), moveTopRight(), 
moveBottomLeft()
 */
 
-void FRect::moveBottomRight( FPoint &p )
+void FRect::moveBottomRight( const FPoint &p )
 {
        moveRight( p.x() );
        moveBottom( p.y() );
@@ -569,7 +569,7 @@
        \sa topRight(), setTopRight(), moveTopLeft(), moveBottomRight(), 
moveBottomLeft()
 */
 
-void FRect::moveTopRight( FPoint &p )
+void FRect::moveTopRight( const FPoint &p )
 {
        moveRight( p.x() );
        moveTop( p.y() );
@@ -582,7 +582,7 @@
        \sa bottomLeft(), setBottomLeft(), moveTopLeft(), moveBottomRight(), 
moveTopRight()
 */
 
-void FRect::moveBottomLeft( FPoint &p )
+void FRect::moveBottomLeft( const FPoint &p )
 {
        moveLeft( p.x() );
        moveBottom( p.y() );
@@ -596,12 +596,12 @@
        \sa center(), moveTopLeft(), moveBottomRight(), moveTopRight(), 
moveBottomLeft()
 */
 
-void FRect::moveCenter( FPoint &p )
+void FRect::moveCenter( const FPoint &p )
 {
        qreal w = x2 - x1;
        qreal h = y2 - y1;
-       x1 = (qreal)(p.x() - w/2);
-       y1 = (qreal)(p.y() - h/2);
+       x1 = (p.x() - w / 2);
+       y1 = (p.y() - h / 2);
        x2 = x1 + w;
        y2 = y1 + h;
 }
@@ -617,10 +617,10 @@
 
 void FRect::moveBy( qreal dx, qreal dy )
 {
-       x1 += (qreal)dx;
-       y1 -= (qreal)dy;
-       x2 += (qreal)dx;
-       y2 -= (qreal)dy;
+       x1 += dx;
+       y1 -= dy;
+       x2 += dx;
+       y2 -= dy;
 }
 
 /*!
@@ -632,10 +632,10 @@
 
 void FRect::setRect( qreal x, qreal y, qreal w, qreal h )
 {
-       x1 = (qreal)x;
-       y1 = (qreal)y;
-       x2 = (qreal)(x+w);
-       y2 = (qreal)(y+h);
+       x1 = x;
+       y1 = y;
+       x2 = (x + w);
+       y2 = (y + h);
 }
 
 /*!
@@ -648,10 +648,10 @@
 
 void FRect::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2 )
 {
-       x1 = (qreal)xp1;
-       y1 = (qreal)yp1;
-       x2 = (qreal)xp2;
-       y2 = (qreal)yp2;
+       x1 = xp1;
+       y1 = yp1;
+       x2 = xp2;
+       y2 = yp2;
 }
 
 /*!
@@ -661,10 +661,10 @@
 
 void FRect::addCoords( qreal xp1, qreal yp1, qreal xp2, qreal yp2 )
 {
-       x1 += (qreal)xp1;
-       y1 += (qreal)yp1;
-       x2 += (qreal)xp2;
-       y2 += (qreal)yp2;
+       x1 += xp1;
+       y1 += yp1;
+       x2 += xp2;
+       y2 += yp2;
 }
 
 /*!
@@ -702,7 +702,7 @@
 
 void FRect::setWidth( qreal w )
 {
-       x2 = (qreal)(x1 + w);
+       x2 = (x1 + w);
 }
 
 /*!
@@ -714,7 +714,7 @@
 
 void FRect::setHeight( qreal h )
 {
-       y2 = (qreal)(y1 + h);
+       y2 = (y1 + h);
 }
 
 /*!
@@ -726,8 +726,8 @@
 
 void FRect::setSize( const FSize &s )
 {
-       x2 = (qreal)(s.width() +x1);
-       y2 = (qreal)(s.height()+y1);
+       x2 = (s.width() + x1);
+       y2 = (s.height() + y1);
 }
 
 /*!

Modified: trunk/Scribus/scribus/text/frect.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/frect.h
==============================================================================
--- trunk/Scribus/scribus/text/frect.h  (original)
+++ trunk/Scribus/scribus/text/frect.h  Sun Oct  3 02:29:51 2021
@@ -77,10 +77,10 @@
                void setX(qreal x);
                void setY(qreal y);
 
-               void setTopLeft(FPoint &p);
-               void setBottomRight(FPoint &p);
-               void setTopRight(FPoint &p);
-               void setBottomLeft(FPoint &p);
+               void setTopLeft(const FPoint &p);
+               void setBottomRight(const FPoint &p);
+               void setTopRight(const FPoint &p);
+               void setBottomLeft(const FPoint &p);
 
                FPoint topLeft() const;
                FPoint bottomRight() const;
@@ -95,11 +95,11 @@
                void moveTop(qreal pos);
                void moveRight(qreal pos);
                void moveBottom(qreal pos);
-               void moveTopLeft(FPoint &p);
-               void moveBottomRight(FPoint &p);
-               void moveTopRight(FPoint &p);
-               void moveBottomLeft(FPoint &p);
-               void moveCenter(FPoint &p);
+               void moveTopLeft(const FPoint &p);
+               void moveBottomRight(const FPoint &p);
+               void moveTopRight(const FPoint &p);
+               void moveBottomLeft(const FPoint &p);
+               void moveCenter(const FPoint &p);
                void moveBy(qreal dx, qreal dy);
 
                void setRect(qreal x, qreal y, qreal w, qreal h);
@@ -157,14 +157,14 @@
 
 inline FRect::FRect(qreal left, qreal top, qreal width, qreal height)
 {
-       x1 = (qreal)left;
-       y1 = (qreal)top;
-       x2 = (qreal)(left+width-1);
-       y2 = (qreal)(top+height-1);
+       x1 = left;
+       y1 = top;
+       x2 = (left + width - 1);
+       y2 = (top + height -1);
 }
 
 inline bool FRect::isNull() const
-{ return x2 == x1-1 && y2 == y1-1; }
+{ return x2 == x1 - 1 && y2 == y1 - 1; }
 
 inline bool FRect::isEmpty() const
 { return x1 > x2 || y1 > y2; }
@@ -203,19 +203,19 @@
 { return y1; }
 
 inline void FRect::setLeft(qreal pos)
-{ x1 = (qreal)pos; }
+{ x1 = pos; }
 
 inline void FRect::setTop(qreal pos)
-{ y1 = (qreal)pos; }
+{ y1 = pos; }
 
 inline void FRect::setRight(qreal pos)
-{ x2 = (qreal)pos; }
+{ x2 = pos; }
 
 inline void FRect::setBottom(qreal pos)
-{ y2 = (qreal)pos; }
+{ y2 = pos; }
 
 inline void FRect::setX(qreal x)
-{ x1 = (qreal)x; }
+{ x1 = x; }
 
 inline void FRect::setY(qreal y)
 { y1 = (qreal)y; }

Modified: trunk/Scribus/scribus/text/fsize.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/fsize.cpp
==============================================================================
--- trunk/Scribus/scribus/text/fsize.cpp        (original)
+++ trunk/Scribus/scribus/text/fsize.cpp        Sun Oct  3 02:29:51 2021
@@ -176,8 +176,8 @@
 void FSize::scale( qreal w, qreal h, Qt::AspectRatioMode mode )
 {
     if ( mode == Qt::IgnoreAspectRatio ) {
-       m_wd = (qreal)w;
-       m_ht = (qreal)h;
+       m_wd = w;
+       m_ht = h;
     } else {
        bool useHeight = true;
        qreal w0 = width();
@@ -191,11 +191,11 @@
        }
 
        if ( useHeight ) {
-           m_wd = (qreal)rw;
-           m_ht = (qreal)h;
+           m_wd = rw;
+           m_ht = h;
        } else {
-           m_wd = (qreal)w;
-           m_ht = (qreal)( w * h0 / w0 );
+           m_wd = w;
+           m_ht = ( w * h0 / w0 );
        }
     }
 }

Modified: trunk/Scribus/scribus/text/fsize.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/fsize.h
==============================================================================
--- trunk/Scribus/scribus/text/fsize.h  (original)
+++ trunk/Scribus/scribus/text/fsize.h  Sun Oct  3 02:29:51 2021
@@ -84,14 +84,14 @@
 
     friend inline bool operator==( const FSize &, const FSize & );
     friend inline bool operator!=( const FSize &, const FSize & );
-    friend inline const FSize operator+( const FSize &, const FSize & );
-    friend inline const FSize operator-( const FSize &, const FSize & );
-    friend inline const FSize operator*( const FSize &, int );
-    friend inline const FSize operator*( int, const FSize & );
-    friend inline const FSize operator*( const FSize &, qreal );
-    friend inline const FSize operator*( qreal, const FSize & );
-    friend inline const FSize operator/( const FSize &, int );
-    friend inline const FSize operator/( const FSize &, qreal );
+    friend inline FSize operator+( const FSize &, const FSize & );
+    friend inline FSize operator-( const FSize &, const FSize & );
+    friend inline FSize operator*( const FSize &, int );
+    friend inline FSize operator*( int, const FSize & );
+    friend inline FSize operator*( const FSize &, qreal );
+    friend inline FSize operator*( qreal, const FSize & );
+    friend inline FSize operator/( const FSize &, int );
+    friend inline FSize operator/( const FSize &, qreal );
 
 private:
     static void warningDivByZero();
@@ -117,7 +117,7 @@
 { m_wd = m_ht = -1; }
 
 inline FSize::FSize( qreal w, qreal h )
-{ m_wd=(qreal)w; m_ht=(qreal)h; }
+{ m_wd = w; m_ht = h; }
 
 inline bool FSize::isNull() const
 { return m_wd==0 && m_ht==0; }
@@ -147,16 +147,16 @@
 { return m_ht; }
 
 inline FSize &FSize::operator+=( const FSize &s )
-{ m_wd+=s.m_wd; m_ht+=s.m_ht; return *this; }
+{ m_wd+=s.m_wd; m_ht += s.m_ht; return *this; }
 
 inline FSize &FSize::operator-=( const FSize &s )
-{ m_wd-=s.m_wd; m_ht-=s.m_ht; return *this; }
+{ m_wd-=s.m_wd; m_ht -= s.m_ht; return *this; }
 
 inline FSize &FSize::operator*=( int c )
 { m_wd*=(qreal)c; m_ht*=(qreal)c; return *this; }
 
 inline FSize &FSize::operator*=( qreal c )
-{ m_wd=(qreal)(m_wd*c); m_ht=(qreal)(m_ht*c); return *this; }
+{ m_wd = (m_wd * c); m_ht = (m_ht * c); return *this; }
 
 inline bool operator==( const FSize &s1, const FSize &s2 )
 { return s1.m_wd == s2.m_wd && s1.m_ht == s2.m_ht; }
@@ -164,23 +164,23 @@
 inline bool operator!=( const FSize &s1, const FSize &s2 )
 { return s1.m_wd != s2.m_wd || s1.m_ht != s2.m_ht; }
 
-inline const FSize operator+( const FSize & s1, const FSize & s2 )
+inline FSize operator+( const FSize & s1, const FSize & s2 )
 { return FSize(s1.m_wd+s2.m_wd, s1.m_ht+s2.m_ht); }
 
-inline const FSize operator-( const FSize &s1, const FSize &s2 )
+inline FSize operator-( const FSize &s1, const FSize &s2 )
 { return FSize(s1.m_wd-s2.m_wd, s1.m_ht-s2.m_ht); }
 
-inline const FSize operator*( const FSize &s, int c )
+inline FSize operator*( const FSize &s, int c )
 { return FSize(s.m_wd*c, s.m_ht*c); }
 
-inline const FSize operator*( int c, const FSize &s )
+inline FSize operator*( int c, const FSize &s )
 {  return FSize(s.m_wd*c, s.m_ht*c); }
 
-inline const FSize operator*( const FSize &s, qreal c )
-{ return FSize((qreal)(s.m_wd*c), (qreal)(s.m_ht*c)); }
-
-inline const FSize operator*( qreal c, const FSize &s )
-{ return FSize((qreal)(s.m_wd*c), (qreal)(s.m_ht*c)); }
+inline FSize operator*( const FSize &s, qreal c )
+{ return FSize(s.m_wd * c, s.m_ht * c); }
+
+inline FSize operator*( qreal c, const FSize &s )
+{ return FSize(s.m_wd * c, s.m_ht * c); }
 
 inline FSize &FSize::operator/=( int c )
 {
@@ -202,7 +202,7 @@
     return *this;
 }
 
-inline const FSize operator/( const FSize &s, int c )
+inline FSize operator/( const FSize &s, int c )
 {
 #if defined(QT_CHECK_MATH)
     if ( c == 0 )
@@ -211,23 +211,23 @@
        return FSize(s.m_wd/c, s.m_ht/c);
 }
 
-inline const FSize operator/( const FSize &s, qreal c )
+inline FSize operator/( const FSize &s, qreal c )
 {
 #if defined(QT_CHECK_MATH)
     if ( c == 0.0 )
        FSize::warningDivByZero();
 #endif
-       return FSize((qreal)(s.m_wd/c), (qreal)(s.m_ht/c));
+       return FSize(s.m_wd / c, s.m_ht / c);
 }
 
 inline FSize FSize::expandedTo( const FSize & otherSize ) const
 {
-       return FSize( qMax(m_wd,otherSize.m_wd), qMax(m_ht,otherSize.m_ht) );
+       return FSize( qMax(m_wd, otherSize.m_wd), qMax(m_ht, otherSize.m_ht) );
 }
 
 inline FSize FSize::boundedTo( const FSize & otherSize ) const
 {
-       return FSize( qMin(m_wd,otherSize.m_wd), qMin(m_ht,otherSize.m_ht) );
+       return FSize( qMin(m_wd, otherSize.m_wd), qMin(m_ht, otherSize.m_ht) );
 }
 
 

Modified: trunk/Scribus/scribus/text/glyphcluster.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/glyphcluster.cpp
==============================================================================
--- trunk/Scribus/scribus/text/glyphcluster.cpp (original)
+++ trunk/Scribus/scribus/text/glyphcluster.cpp Sun Oct  3 02:29:51 2021
@@ -1,17 +1,12 @@
 #include "glyphcluster.h"
 
 GlyphCluster::GlyphCluster(const CharStyle* style, LayoutFlags flags, int 
first, int last, const InlineFrame& o, int i, const QString& str)
-       : extraWidth(0.0)
-       , xoffset(0.0)
-       , yoffset(0.0)
-       , m_style(style)
+       : m_style(style)
        , m_flags(flags)
        , m_object(o)
        , m_firstChar(first)
        , m_lastChar(last)
        , m_visualIndex(i)
-       , m_scaleH(1.0)
-       , m_scaleV(1.0)
        , m_str(str)
 {}
 

Modified: trunk/Scribus/scribus/text/glyphcluster.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/text/glyphcluster.h
==============================================================================
--- trunk/Scribus/scribus/text/glyphcluster.h   (original)
+++ trunk/Scribus/scribus/text/glyphcluster.h   Sun Oct  3 02:29:51 2021
@@ -43,9 +43,10 @@
        // get text out
        QString getText() const;
 
-       double extraWidth;
-       double xoffset;
-       double yoffset;
+       double extraWidth { 0.0 };
+       double xoffset { 0.0 };
+       double yoffset { 0.0 };
+
 private:
        const CharStyle* m_style;
        LayoutFlags m_flags;
@@ -54,8 +55,8 @@
        int m_firstChar;
        int m_lastChar;
        int m_visualIndex;
-       double m_scaleH;
-       double m_scaleV;
+       double m_scaleH { 1.0 };
+       double m_scaleV { 1.0 };
        QString m_str;
 };
 

Modified: trunk/Scribus/scribus/ui/cmykfw.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/ui/cmykfw.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.cpp (original)
+++ trunk/Scribus/scribus/ui/cmykfw.cpp Sun Oct  3 02:29:51 2021
@@ -51,15 +51,15 @@
 
 
 CMYKChoose::CMYKChoose( QWidget* parent, ScribusDoc* doc, ScColor orig, const 
QString& name, ColorList *Colors, bool newCol  )
-               : QDialog( parent ), CurrSwatch(doc)
+               : QDialog( parent ),
+             Farbe(orig),
+             isNew(newCol),
+             EColors(Colors),
+             CurrSwatch(doc),
+             m_doc(doc)
 {
        setModal(true);
-       m_doc = doc;
-       isNew = newCol;
-       dynamic = true;
-       Wsave = false;
-       isHLC = false;
-       EColors = Colors;
+
        CurrSwatch.clear();
        alertIcon = IconManager::instance().loadPixmap("alert.png");
        imageA = QPixmap(50,50);
@@ -70,7 +70,6 @@
        imageN.fill( ScColorEngine::getDisplayColor(orig, m_doc) );
        if ( ScColorEngine::isOutOfGamut(orig, m_doc) )
                paintAlert(alertIcon, imageN, 2, 2, false);
-       Farbe = orig;
 
        resize( 498, 306 );
        setWindowTitle( tr( "Edit Color" ) );

Modified: trunk/Scribus/scribus/ui/cmykfw.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/ui/cmykfw.h
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.h   (original)
+++ trunk/Scribus/scribus/ui/cmykfw.h   Sun Oct  3 02:29:51 2021
@@ -34,12 +34,12 @@
        QPixmap alertIcon;
        ScColor Farbe;
 
-       bool Wsave;
-       bool dynamic;
-       bool isNew;
-       bool isRegistration;
-       int BlackComp;
-       ColorList *EColors;
+       bool Wsave { false };
+       bool dynamic { true };
+       bool isNew { false };
+       bool isRegistration { false };
+       int BlackComp { 0 };
+       ColorList *EColors { nullptr };
        ColorList CurrSwatch;
        QString Fnam;
 
@@ -59,14 +59,14 @@
 
 protected:
        ColorSetManager csm;
-       ScribusDoc* m_doc;
-       QTreeWidgetItem *systemSwatches;
-       QTreeWidgetItem *userSwatches;
-       QTreeWidgetItem *hsvSelector;
+       ScribusDoc* m_doc { nullptr };
+       QTreeWidgetItem *systemSwatches { nullptr };
+       QTreeWidgetItem *userSwatches { nullptr };
+       QTreeWidgetItem *hsvSelector { nullptr };
        QStringList customColSet;
-       bool isHLC;
+       bool isHLC { false };
        
-       virtual void showEvent(QShowEvent * event);
+       void showEvent(QShowEvent * event) override;
 
        QPalette sliderPix(int farbe);
        QPalette sliderBlack();

Modified: trunk/Scribus/scribus/ui/customfdialog.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/ui/customfdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/customfdialog.cpp  (original)
+++ trunk/Scribus/scribus/ui/customfdialog.cpp  Sun Oct  3 02:29:51 2021
@@ -135,7 +135,7 @@
        updatePix();
        if (name.isEmpty())
                return;
-       QFileInfo fi = QFileInfo(name);
+       QFileInfo fi(name);
        if (fi.isDir())
                return;
        int w = pixmap()->width();
@@ -283,7 +283,9 @@
 }
 
 CustomFDialog::CustomFDialog(QWidget *parent, const QString& wDir, const 
QString& caption, const QString& filter, int flags)
-                       : QDialog(parent), m_optionFlags(flags)
+                       : QDialog(parent),
+                 m_optionFlags(flags),
+                 m_previewIsShown(true)
 {
        m_fileDialogPrefs = 
PrefsManager::instance().prefsFile->getContext("customfdialog", false);
 
@@ -319,7 +321,6 @@
        showPreview->setText( tr("Show Preview"));
        showPreview->setToolTip( tr("Show a preview and information for the 
selected file"));
        showPreview->setChecked(true);
-       m_previewIsShown = true;
        hboxLayout1->addWidget(showPreview);
        QSpacerItem *spacerItem = new QSpacerItem(2, 2, QSizePolicy::Expanding, 
QSizePolicy::Minimum);
        hboxLayout1->addItem(spacerItem);
@@ -490,10 +491,6 @@
        resize(minimumSizeHint());
 }
 
-CustomFDialog::~CustomFDialog()
-{
-}
-
 void CustomFDialog::closeEvent(QCloseEvent *closeEvent)
 {
        storeSize();
@@ -508,7 +505,7 @@
 
 void CustomFDialog::showEvent(QShowEvent *showEvent)
 {
-       QScreen* dialogScreen = this->screen();
+       const QScreen* dialogScreen = this->screen();
        if (m_fileDialogPrefs && dialogScreen && !showEvent->spontaneous())
        {
                if (m_fileDialogPrefs->contains("width"))
@@ -568,12 +565,12 @@
                        
filePreview->genPreview(QDir::fromNativeSeparators(sel[0]));
        }
        // #11856: Hack to avoid file dialog widget turning black with Qt5
-       qApp->processEvents();
+       QCoreApplication::processEvents();
        filePreview->setVisible(!m_previewIsShown);
-       qApp->processEvents();
+       QCoreApplication::processEvents();
        filePreview->setVisible(m_previewIsShown);
        fileDialog->repaint();
-       qApp->processEvents();
+       QCoreApplication::processEvents();
        repaint();
 }
 

Modified: trunk/Scribus/scribus/ui/customfdialog.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/ui/customfdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/customfdialog.h    (original)
+++ trunk/Scribus/scribus/ui/customfdialog.h    Sun Oct  3 02:29:51 2021
@@ -102,7 +102,7 @@
        \param flags combination of fdFlags, default to fdExistingFiles
        */
        CustomFDialog(QWidget *parent, const QString& wDir, const QString& 
caption = "",  const QString& filter = "", int flags = fdExistingFiles);
-       ~CustomFDialog();
+       ~CustomFDialog() = default;
 
        void setSelection(const QString& fileName);
        QString selectedFile() const;

Modified: trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24718&path=/trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp (original)
+++ trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp Sun Oct  3 02:29:51 2021
@@ -64,20 +64,17 @@
        }
        else if (e->type() == QEvent::Drop)
        {
-               QDropEvent *dropEvent = static_cast<QDropEvent *>(e);
-               if (dropEvent)
+               auto *dropEvent = static_cast<QDropEvent *>(e);
+               if (dropEvent && 
dropEvent->mimeData()->hasFormat("text/uri-list"))
                {
-                       if (dropEvent->mimeData()->hasFormat("text/uri-list"))
+                       QString fileUrl;
+                       QList<QUrl> fileUrls = dropEvent->mimeData()->urls();
+                       if (fileUrls.count() > 0)
                        {
-                               QString fileUrl;
-                               QList<QUrl> fileUrls = 
dropEvent->mimeData()->urls();
-                               if (fileUrls.count() > 0)
+                               fileUrl = fileUrls[0].toLocalFile();
+                               if (fileUrls[0].isLocalFile())
                                {
-                                       fileUrl = fileUrls[0].toLocalFile();
-                                       if (fileUrls[0].isLocalFile())
-                                       {
-                                               emit dropLocation(fileUrl);
-                                       }
+                                       emit dropLocation(fileUrl);
                                }
                        }
                }


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

Reply via email to