Author: jghali
Date: Tue Dec 22 23:35:34 2020
New Revision: 24355

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

Modified:
    trunk/Scribus/scribus/ui/inspage.cpp
    trunk/Scribus/scribus/ui/inspage.h

Modified: trunk/Scribus/scribus/ui/inspage.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24355&path=/trunk/Scribus/scribus/ui/inspage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.cpp        (original)
+++ trunk/Scribus/scribus/ui/inspage.cpp        Tue Dec 22 23:35:34 2020
@@ -13,6 +13,7 @@
 #include <QGroupBox>
 #include <QCheckBox>
 #include <QPushButton>
+#include <QScopedPointer>
 
 #include "commonstrings.h"
 #include "iconmanager.h"
@@ -24,7 +25,7 @@
 #include "util.h"
 
 InsPage::InsPage( QWidget* parent, ScribusDoc* currentDoc, int currentPage, 
int maxPages)
-       : QDialog( parent, Qt::WindowFlags() )
+       : QDialog(parent, Qt::WindowFlags())
 {
        m_doc = currentDoc;
 
@@ -38,45 +39,45 @@
        whereLayout = new QGridLayout();
        whereLayout->setSpacing(6);
        whereLayout->setContentsMargins(0, 0, 0, 0);
-       insCountData = new QSpinBox( this );
+       insCountData = new QSpinBox(this);
        insCountData->setMinimum(1);
        insCountData->setMaximum(999);
-       insCountData->setValue( 1 );
+       insCountData->setValue(1);
        insCountLabel = new QLabel(tr( "&Insert" ), this );
        insCountLabel->setBuddy(insCountData);
-       whereLayout->addWidget( insCountLabel, 0, 0 );
-       whereLayout->addWidget( insCountData, 0, 1 );
+       whereLayout->addWidget(insCountLabel, 0, 0);
+       whereLayout->addWidget(insCountData, 0, 1);
        pagesLabel = new QLabel( tr( "Page(s)" ), this);
-       whereLayout->addWidget( pagesLabel, 0, 2 );
+       whereLayout->addWidget(pagesLabel, 0, 2);
 
        insWhereData = new QComboBox( this );
        insWhereData->addItem( tr("before Page"));
        insWhereData->addItem( tr("after Page"));
        insWhereData->addItem( tr("at End"));
        insWhereData->setCurrentIndex(2);
-       whereLayout->addWidget( insWhereData, 1, 0, 1, 2 );
+       whereLayout->addWidget(insWhereData, 1, 0, 1, 2);
 
        insWherePageData = new QSpinBox(this);
        insWherePageData->setMinimum(1);
        insWherePageData->setMaximum(maxPages);
-       insWherePageData->setValue( currentPage+1 );
-       insWherePageData->setDisabled( true );
-
-       whereLayout->addWidget( insWherePageData, 1, 2 );
+       insWherePageData->setValue(currentPage + 1);
+       insWherePageData->setDisabled(true);
+
+       whereLayout->addWidget(insWherePageData, 1, 2);
        whereLayout->addItem(new 
QSpacerItem(insCountLabel->fontMetrics().horizontalAdvance( tr( "&Insert" )), 
0), 0, 0);
-       dialogLayout->addLayout( whereLayout );
+       dialogLayout->addLayout(whereLayout);
        
        masterPageLabel = nullptr;
        masterPageGroup = new QGroupBox( this);
        masterPageGroup->setTitle( tr( "Master Pages" ) );
        masterPageLayout = new QGridLayout( masterPageGroup );
-       masterPageLayout->setAlignment( Qt::AlignTop );
+       masterPageLayout->setAlignment(Qt::AlignTop);
        masterPageLayout->setSpacing(6);
        masterPageLayout->setContentsMargins(9, 9, 9, 9);
        if (m_doc->pagePositioning() == 0)
        {
                QComboBox* pageData = new QComboBox(masterPageGroup);
-               for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+               for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                {
                        pageData->addItem(it.key() == 
CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key(), 
it.key());
                }
@@ -84,7 +85,7 @@
                        setCurrentComboItem(pageData, 
CommonStrings::trMasterPageNormal);
                masterPageLabel = new QLabel(tr("&Master Page:"), 
masterPageGroup);
                masterPageLabel->setBuddy(pageData);
-               masterPageLayout->addWidget( masterPageLabel, 0, 0 );
+               masterPageLayout->addWidget(masterPageLabel, 0, 0);
                masterPageLayout->addWidget(pageData, 0, 1);
                masterPageCombos.append(pageData);
        }
@@ -95,12 +96,12 @@
                for (int mp = 0; mp < currentPageSet.pageNames.count(); ++mp)
                {
                        QComboBox* pageData = new QComboBox(masterPageGroup);
-//                     for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+//                     for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
 //                             pageData->insertItem(it.key() == 
CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key());
                        if (mp == 0)
                        {
-                               bool conNam = m_doc->MasterNames.contains( 
CommonStrings::trMasterPageNormalLeft);
-                               for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+                               bool conNam = 
m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalLeft);
+                               for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                                {
                                        if ((it.key() == 
CommonStrings::masterPageNormal) && (!conNam))
                                                
pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
@@ -112,7 +113,7 @@
                                                        
pageData->addItem(it.key(), it.key());
                                        }
                                }
-                               if (m_doc->MasterNames.contains( 
CommonStrings::trMasterPageNormalLeft))
+                               if 
(m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalLeft))
                                        setCurrentComboItem(pageData, 
CommonStrings::trMasterPageNormalLeft);
                        }
                        else if (mp == 1)
@@ -120,7 +121,7 @@
                                if (currentPageSet.pageNames.count() > 2)
                                {
                                        bool conNam = 
m_doc->MasterNames.contains( CommonStrings::trMasterPageNormalMiddle);
-                                       for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+                                       for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                                        {
                                                if ((it.key() == 
CommonStrings::masterPageNormal) && (!conNam))
                                                        
pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
@@ -132,13 +133,13 @@
                                                                
pageData->addItem(it.key(), it.key());
                                                }
                                        }
-                                       if (m_doc->MasterNames.contains( 
CommonStrings::trMasterPageNormalMiddle))
+                                       if 
(m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalMiddle))
                                                setCurrentComboItem(pageData, 
CommonStrings::trMasterPageNormalMiddle);
                                }
                                else
                                {
                                        bool conNam = 
m_doc->MasterNames.contains( CommonStrings::trMasterPageNormalRight);
-                                       for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+                                       for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                                        {
                                                if ((it.key() == 
CommonStrings::masterPageNormal) && (!conNam))
                                                        
pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
@@ -150,7 +151,7 @@
                                                                
pageData->addItem(it.key(), it.key());
                                                }
                                        }
-                                       if (m_doc->MasterNames.contains( 
CommonStrings::trMasterPageNormalRight))
+                                       if 
(m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalRight))
                                                setCurrentComboItem(pageData, 
CommonStrings::trMasterPageNormalRight);
                                }
                        }
@@ -158,8 +159,8 @@
                        {
                                if (currentPageSet.pageNames.count() > 3)
                                {
-                                       bool conNam = 
m_doc->MasterNames.contains( CommonStrings::trMasterPageNormalMiddle);
-                                       for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+                                       bool conNam = 
m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalMiddle);
+                                       for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                                        {
                                                if ((it.key() == 
CommonStrings::masterPageNormal) && (!conNam))
                                                        
pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
@@ -171,13 +172,13 @@
                                                                
pageData->addItem(it.key(), it.key());
                                                }
                                        }
-                                       if (m_doc->MasterNames.contains( 
CommonStrings::trMasterPageNormalMiddle))
+                                       if 
(m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalMiddle))
                                                setCurrentComboItem(pageData, 
CommonStrings::trMasterPageNormalMiddle);
                                }
                                else
                                {
-                                       bool conNam = 
m_doc->MasterNames.contains( CommonStrings::trMasterPageNormalRight);
-                                       for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+                                       bool conNam = 
m_doc->MasterNames.contains(CommonStrings::trMasterPageNormalRight);
+                                       for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                                        {
                                                if ((it.key() == 
CommonStrings::masterPageNormal) && (!conNam))
                                                        
pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
@@ -196,7 +197,7 @@
                        else if (mp == 3)
                        {
                                bool conNam = m_doc->MasterNames.contains( 
CommonStrings::trMasterPageNormalRight);
-                               for (QMap<QString,int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
+                               for (QMap<QString, int>::Iterator it = 
m_doc->MasterNames.begin(); it != m_doc->MasterNames.end(); ++it)
                                {
                                        if ((it.key() == 
CommonStrings::masterPageNormal) && (!conNam))
                                                
pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
@@ -225,13 +226,13 @@
        dialogLayout->addWidget(overrideMPSizingCheckBox);
        dsGroupBox7 = new QGroupBox( this );
        dsGroupBox7->setTitle( tr( "Page Size" ) );
-       dsGroupBox7Layout = new QGridLayout( dsGroupBox7 );
+       dsGroupBox7Layout = new QGridLayout(dsGroupBox7);
        dsGroupBox7Layout->setSpacing(6);
        dsGroupBox7Layout->setContentsMargins(9, 9, 9, 9);
-       TextLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7);
-       dsGroupBox7Layout->addWidget( TextLabel1, 0, 0);
-
-       PageSize *ps = new PageSize(m_doc->pageSize());
+       textLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7);
+       dsGroupBox7Layout->addWidget(textLabel1, 0, 0);
+
+       QScopedPointer<PageSize> ps(new PageSize(m_doc->pageSize()));
        prefsPageSizeName = ps->name();
        sizeQComboBox = new QComboBox(dsGroupBox7);
        QStringList insertList(ps->activeSizeTRList());
@@ -246,52 +247,51 @@
        else
                sizeQComboBox->setCurrentIndex(sizeQComboBox->count() - 1);
 
-       TextLabel1->setBuddy(sizeQComboBox);
+       textLabel1->setBuddy(sizeQComboBox);
        dsGroupBox7Layout->addWidget(sizeQComboBox, 0, 1, 1, 3);
-       TextLabel2 = new QLabel( tr( "Orie&ntation:" ), dsGroupBox7);
-       dsGroupBox7Layout->addWidget( TextLabel2, 1, 0);
+       textLabel2 = new QLabel( tr( "Orie&ntation:" ), dsGroupBox7);
+       dsGroupBox7Layout->addWidget(textLabel2, 1, 0);
        orientationQComboBox = new QComboBox(dsGroupBox7);
        orientationQComboBox->addItem( tr( "Portrait" ) );
        orientationQComboBox->addItem( tr( "Landscape" ) );
        orientationQComboBox->setCurrentIndex(m_doc->pageOrientation() );
-       TextLabel2->setBuddy(orientationQComboBox);
-       dsGroupBox7Layout->addWidget( orientationQComboBox, 1, 1, 1, 3 );
-       widthSpinBox = new ScrSpinBox( 1, 10000, dsGroupBox7, 
m_doc->unitIndex() );
+       textLabel2->setBuddy(orientationQComboBox);
+       dsGroupBox7Layout->addWidget(orientationQComboBox, 1, 1, 1, 3);
+       widthSpinBox = new ScrSpinBox(1, 10000, dsGroupBox7, 
m_doc->unitIndex());
        widthQLabel = new QLabel( tr( "&Width:" ), dsGroupBox7);
        widthSpinBox->setValue(m_doc->pageWidth() * m_doc->unitRatio());
        widthQLabel->setBuddy(widthSpinBox);
-       dsGroupBox7Layout->addWidget( widthQLabel, 2, 0 );
-       dsGroupBox7Layout->addWidget( widthSpinBox, 2, 1 );
-       heightSpinBox = new ScrSpinBox( 1, 10000, dsGroupBox7, 
m_doc->unitIndex() );
+       dsGroupBox7Layout->addWidget(widthQLabel, 2, 0);
+       dsGroupBox7Layout->addWidget(widthSpinBox, 2, 1);
+       heightSpinBox = new ScrSpinBox(1, 10000, dsGroupBox7, 
m_doc->unitIndex());
        heightSpinBox->setValue(m_doc->pageHeight() * m_doc->unitRatio());
        heightQLabel = new QLabel( tr( "&Height:" ), dsGroupBox7);
        heightQLabel->setBuddy(heightSpinBox);
-       dsGroupBox7Layout->addWidget( heightQLabel, 3, 0 );
-       dsGroupBox7Layout->addWidget( heightSpinBox, 3, 1 );
+       dsGroupBox7Layout->addWidget(heightQLabel, 3, 0);
+       dsGroupBox7Layout->addWidget(heightSpinBox, 3, 1);
        moveObjectsCheckBox = new QCheckBox( dsGroupBox7);
        moveObjectsCheckBox->setText( tr( "Move Objects with their Page" ) );
-       moveObjectsCheckBox->setChecked( true );
-       dsGroupBox7Layout->addWidget( moveObjectsCheckBox, 4, 0, 1, 4 );
-       dialogLayout->addWidget( dsGroupBox7 );
+       moveObjectsCheckBox->setChecked(true);
+       dsGroupBox7Layout->addWidget(moveObjectsCheckBox, 4, 0, 1, 4);
+       dialogLayout->addWidget(dsGroupBox7);
        dsGroupBox7->setEnabled(false);
        bool b = (sizeQComboBox->currentText() == 
CommonStrings::trCustomPageSize);
-       heightSpinBox->setEnabled( b );
-       widthSpinBox->setEnabled( b );
-       delete ps;
+       heightSpinBox->setEnabled(b);
+       widthSpinBox->setEnabled(b);
 
        okCancelLayout = new QHBoxLayout;
        okCancelLayout->setSpacing(6);
        okCancelLayout->setContentsMargins(0, 0, 0, 0);
-       QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, 
QSizePolicy::Minimum );
-       okCancelLayout->addItem( spacer );
+       QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, 
QSizePolicy::Minimum);
+       okCancelLayout->addItem(spacer);
 
        okButton = new QPushButton( CommonStrings::tr_OK, this);
-       okButton->setDefault( true );
-       okCancelLayout->addWidget( okButton );
+       okButton->setDefault(true);
+       okCancelLayout->addWidget(okButton);
 
        cancelButton = new QPushButton( CommonStrings::tr_Cancel, this);
-       okCancelLayout->addWidget( cancelButton );
-       dialogLayout->addLayout( okCancelLayout );
+       okCancelLayout->addWidget(cancelButton);
+       dialogLayout->addLayout(okCancelLayout);
        setMaximumSize(sizeHint());
        m_unitRatio = m_doc->unitRatio();
 

Modified: trunk/Scribus/scribus/ui/inspage.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=24355&path=/trunk/Scribus/scribus/ui/inspage.h
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.h  (original)
+++ trunk/Scribus/scribus/ui/inspage.h  Tue Dec 22 23:35:34 2020
@@ -47,36 +47,36 @@
        bool   moveObjects() const;
 
 private:
-       ScribusDoc* m_doc;
+       ScribusDoc* m_doc { nullptr };
 
-       QLabel* insCountLabel;
-       QLabel* masterPageLabel;
-       QLabel* pagesLabel;
-       QPushButton* cancelButton;
-       QPushButton* okButton;
-       QComboBox* insWhereData;
-       QSpinBox* insWherePageData;
-       QSpinBox* insCountData;
-       QVBoxLayout* dialogLayout;
-       QGridLayout* whereLayout;
-       QGridLayout* masterPageLayout;
-       QHBoxLayout* okCancelLayout;
-       QGridLayout* dsGroupBox7Layout;
+       QLabel* insCountLabel { nullptr };
+       QLabel* masterPageLabel { nullptr };
+       QLabel* pagesLabel { nullptr };
+       QPushButton* cancelButton { nullptr };
+       QPushButton* okButton { nullptr };
+       QComboBox* insWhereData { nullptr };
+       QSpinBox* insWherePageData { nullptr };
+       QSpinBox* insCountData { nullptr };
+       QVBoxLayout* dialogLayout { nullptr };
+       QGridLayout* whereLayout { nullptr };
+       QGridLayout* masterPageLayout { nullptr };
+       QHBoxLayout* okCancelLayout { nullptr };
+       QGridLayout* dsGroupBox7Layout { nullptr };
 
-       QGroupBox*  dsGroupBox7;
-       QGroupBox*  masterPageGroup;
-       ScrSpinBox* widthSpinBox;
-       ScrSpinBox* heightSpinBox;
-       QLabel*     widthQLabel;
-       QLabel*     heightQLabel;
-       QLabel*     TextLabel1;
-       QLabel*     TextLabel2;
-       QComboBox*  sizeQComboBox;
-       QComboBox*  orientationQComboBox;
-       QCheckBox*  moveObjectsCheckBox;
-       QCheckBox*  overrideMPSizingCheckBox;
+       QGroupBox*  dsGroupBox7 { nullptr };
+       QGroupBox*  masterPageGroup { nullptr };
+       ScrSpinBox* widthSpinBox { nullptr };
+       ScrSpinBox* heightSpinBox { nullptr };
+       QLabel*     widthQLabel { nullptr };
+       QLabel*     heightQLabel { nullptr };
+       QLabel*     textLabel1 { nullptr };
+       QLabel*     textLabel2 { nullptr };
+       QComboBox*  sizeQComboBox { nullptr };
+       QComboBox*  orientationQComboBox { nullptr };
+       QCheckBox*  moveObjectsCheckBox { nullptr };
+       QCheckBox*  overrideMPSizingCheckBox { nullptr };
        
-       double m_unitRatio;
+       double m_unitRatio { 1.0 };
        QList<QComboBox*> masterPageCombos;
 
 private slots:


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

Reply via email to