r24754 by jghali - Code cleanup
scribus-commit
scribus-commit at lists.scribus.net
Mon Oct 25 19:55:09 UTC 2021
Author: jghali
Date: Mon Oct 25 19:55:09 2021
New Revision: 24754
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24754
Log:
Code cleanup
Modified:
trunk/Scribus/scribus/text/textshaper.cpp
trunk/Scribus/scribus/text/textshaper.h
trunk/Scribus/scribus/ui/aligndistribute.cpp
trunk/Scribus/scribus/ui/aligndistribute.h
trunk/Scribus/scribus/ui/applytemplatedialog.cpp
trunk/Scribus/scribus/ui/applytemplatedialog.h
trunk/Scribus/scribus/ui/inspage.cpp
trunk/Scribus/scribus/ui/newdocdialog.cpp
trunk/Scribus/scribus/ui/newdocdialog.h
trunk/Scribus/scribus/ui/numformatcombo.cpp
trunk/Scribus/scribus/ui/numformatcombo.h
trunk/Scribus/scribus/ui/outlinepalette.cpp
trunk/Scribus/scribus/ui/outlinepalette.h
trunk/Scribus/scribus/ui/pagepropertiesdialog.cpp
trunk/Scribus/scribus/ui/pagepropertiesdialog.h
trunk/Scribus/scribus/ui/textpalette.cpp
trunk/Scribus/scribus/ui/textpalette.h
trunk/Scribus/scribus/updatemanager.cpp
trunk/Scribus/scribus/updatemanager.h
trunk/Scribus/scribus/util_debug.cpp
Modified: trunk/Scribus/scribus/text/textshaper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/text/textshaper.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textshaper.cpp (original)
+++ trunk/Scribus/scribus/text/textshaper.cpp Mon Oct 25 19:55:09 2021
@@ -19,7 +19,6 @@
TextShaper::TextShaper(ITextContext* context, ITextSource &story, int firstChar, bool singlePar)
: m_context(context),
- m_contextNeeded(false),
m_story(story),
m_firstChar(firstChar),
m_singlePar(singlePar)
@@ -27,7 +26,6 @@
TextShaper::TextShaper(ITextSource &story, int firstChar)
: m_context(nullptr),
- m_contextNeeded(false),
m_story(story),
m_firstChar(firstChar),
m_singlePar(false)
@@ -44,7 +42,7 @@
}
}
-QList<TextShaper::TextRun> TextShaper::itemizeBiDi()
+QList<TextShaper::TextRun> TextShaper::itemizeBiDi() const
{
QList<TextRun> textRuns;
UBiDi *obj = ubidi_open();
@@ -75,7 +73,7 @@
return textRuns;
}
-QList<TextShaper::TextRun> TextShaper::itemizeScripts(const QList<TextRun> &runs)
+QList<TextShaper::TextRun> TextShaper::itemizeScripts(const QList<TextRun> &runs) const
{
QList<TextRun> newRuns;
ScriptRun scriptrun((const UChar*) m_text.utf16(), m_text.length());
@@ -111,7 +109,7 @@
return newRuns;
}
-QList<TextShaper::FeaturesRun> TextShaper::itemizeFeatures(const TextRun &run)
+QList<TextShaper::FeaturesRun> TextShaper::itemizeFeatures(const TextRun &run) const
{
QList<FeaturesRun> newRuns;
QList<FeaturesRun> subfeature;
@@ -136,7 +134,7 @@
return newRuns;
}
-QList<TextShaper::TextRun> TextShaper::itemizeStyles(const QList<TextRun> &runs)
+QList<TextShaper::TextRun> TextShaper::itemizeStyles(const QList<TextRun> &runs) const
{
QList<TextRun> newRuns;
@@ -214,7 +212,7 @@
const ParagraphStyle& style = m_story.paragraphStyle(i);
if (style.hasDropCap() || style.hasBullet() || style.hasNum())
{
- CharStyle charStyle = ((m_story.text(i) != SpecialChars::PARSEP) ? m_story.charStyle(i) : style.charStyle());
+ CharStyle charStyle = (m_story.text(i) != SpecialChars::PARSEP) ? m_story.charStyle(i) : style.charStyle();
const QString& curParent(style.hasParent() ? style.parent() : style.name());
CharStyle newStyle(charStyle);
if (style.peCharStyleName().isEmpty())
@@ -227,7 +225,7 @@
else if (!style.peCharStyleName().isEmpty())
{
//par effect is cleared but is set dcCharStyleName = clear drop cap char style
- CharStyle charStyle = ((m_story.text(i) != SpecialChars::PARSEP) ? m_story.charStyle(i) : style.charStyle());
+ CharStyle charStyle = (m_story.text(i) != SpecialChars::PARSEP) ? m_story.charStyle(i) : style.charStyle();
if (charStyle.parent() == style.peCharStyleName())
{
const QString& curParent(style.hasParent() ? style.parent() : style.name());
@@ -270,9 +268,8 @@
{
m_contextNeeded = false;
- ShapedText result(ShapedText(&m_story, fromPos, toPos, m_context));
+ ShapedText result(&m_story, fromPos, toPos, m_context);
-
QVector<int> smallCaps;
buildText(fromPos, toPos, smallCaps);
Modified: trunk/Scribus/scribus/text/textshaper.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/text/textshaper.h
==============================================================================
--- trunk/Scribus/scribus/text/textshaper.h (original)
+++ trunk/Scribus/scribus/text/textshaper.h Mon Oct 25 19:55:09 2021
@@ -53,19 +53,18 @@
QStringList features;
};
-// QString ExpandToken(int base);
void buildText(int fromPos, int toPos, QVector<int>& smallCaps);
- QList<TextRun> itemizeBiDi();
- QList<TextRun> itemizeScripts(const QList<TextRun> &runs);
- QList<TextRun> itemizeStyles(const QList<TextRun> &runs);
- QList<FeaturesRun> itemizeFeatures(const TextRun &run);
+ QList<TextRun> itemizeBiDi() const;
+ QList<TextRun> itemizeScripts(const QList<TextRun> &runs) const;
+ QList<TextRun> itemizeStyles(const QList<TextRun> &runs) const;
+ QList<FeaturesRun> itemizeFeatures(const TextRun &run) const;
- ITextContext* m_context;
- bool m_contextNeeded;
+ ITextContext* m_context { nullptr };
+ bool m_contextNeeded { false };
ITextSource& m_story;
- int m_firstChar;
- bool m_singlePar;
+ int m_firstChar { 0 };
+ bool m_singlePar { false };
QString m_text;
QMap<int, int> m_textMap;
};
Modified: trunk/Scribus/scribus/ui/aligndistribute.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/aligndistribute.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/aligndistribute.cpp (original)
+++ trunk/Scribus/scribus/ui/aligndistribute.cpp Mon Oct 25 19:55:09 2021
@@ -66,10 +66,6 @@
connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange()));
-}
-
-AlignDistributePalette::~AlignDistributePalette()
-{
}
void AlignDistributePalette::changeEvent(QEvent *e)
Modified: trunk/Scribus/scribus/ui/aligndistribute.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/aligndistribute.h
==============================================================================
--- trunk/Scribus/scribus/ui/aligndistribute.h (original)
+++ trunk/Scribus/scribus/ui/aligndistribute.h Mon Oct 25 19:55:09 2021
@@ -57,7 +57,7 @@
public:
AlignDistributePalette( QWidget* parent = nullptr, const char* name = 0);
- ~AlignDistributePalette();
+ ~AlignDistributePalette() = default;
virtual void setDoc( ScribusDoc* newDoc );
void unitChange();
@@ -107,16 +107,18 @@
private:
void init();
- UndoManager *undoManager;
- ScribusDoc::AlignTo currAlignTo;
- ScribusDoc::AlignMethod currAlignMethod;
- QList<AlignObjs> *alignObjects;
- ScribusDoc *currDoc {nullptr};
- qreal unitRatio;
- int guideDirection {-1};
- qreal guidePosition;
- QString guideInfoText, guideInfoTextNone;
void enableGuideButtons();
+
+ UndoManager *undoManager { nullptr };
+ ScribusDoc::AlignTo currAlignTo { ScribusDoc::alignFirst };
+ ScribusDoc::AlignMethod currAlignMethod { ScribusDoc::alignByMoving };
+ QList<AlignObjs> *alignObjects { nullptr };
+ ScribusDoc *currDoc { nullptr };
+ qreal unitRatio { 1.0 };
+ int guideDirection { -1 };
+ qreal guidePosition { 0.0 };
+ QString guideInfoText;
+ QString guideInfoTextNone;
signals:
void documentChanged();
Modified: trunk/Scribus/scribus/ui/applytemplatedialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/applytemplatedialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/applytemplatedialog.cpp (original)
+++ trunk/Scribus/scribus/ui/applytemplatedialog.cpp Mon Oct 25 19:55:09 2021
@@ -147,17 +147,11 @@
masterPageLabel->setBuddy( masterPageComboBox );
}
-/*
- * Destroys the object and frees any allocated resources
- */
-ApplyMasterPageDialog::~ApplyMasterPageDialog()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
void ApplyMasterPageDialog::setup(ScribusDoc *doc, const QString& Nam)
{
- QString na = (Nam == CommonStrings::masterPageNormal) ? CommonStrings::trMasterPageNormal : Nam, in;
+ QString na = (Nam == CommonStrings::masterPageNormal) ? CommonStrings::trMasterPageNormal : Nam;
+ QString in;
+
int cc = 0;
for (QMap<QString,int>::Iterator it = doc->MasterNames.begin(); it != doc->MasterNames.end(); ++it)
{
@@ -167,13 +161,13 @@
masterPageComboBox->setCurrentIndex(cc);
++cc;
}
- const unsigned int docPagesCount = doc->Pages->count();
+ const int docPagesCount = doc->Pages->count();
if (docPagesCount < 2)
evenPagesRadioButton->setEnabled(false);
fromPageSpinBox->setMaximum(docPagesCount);
- fromPageSpinBox->setValue(doc->currentPage()->pageNr()+1);
+ fromPageSpinBox->setValue(doc->currentPage()->pageNr() + 1);
toPageSpinBox->setMaximum(docPagesCount);
- toPageSpinBox->setValue(static_cast<int>(docPagesCount));
+ toPageSpinBox->setValue(docPagesCount);
}
Modified: trunk/Scribus/scribus/ui/applytemplatedialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/applytemplatedialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/applytemplatedialog.h (original)
+++ trunk/Scribus/scribus/ui/applytemplatedialog.h Mon Oct 25 19:55:09 2021
@@ -40,21 +40,21 @@
public:
ApplyMasterPageDialog( QWidget* parent = nullptr );
- ~ApplyMasterPageDialog();
+ ~ApplyMasterPageDialog() = default;
- QLabel* masterPageLabel;
- QComboBox* masterPageComboBox;
- QGroupBox* applyToPageButtonGroup;
- QRadioButton* currentPageRadioButton;
- QRadioButton* evenPagesRadioButton;
- QRadioButton* oddPagesRadioButton;
- QRadioButton* allPagesRadioButton;
- QCheckBox* useRangeCheckBox;
- ScrSpinBox* fromPageSpinBox;
- QLabel* toPageLabel;
- ScrSpinBox* toPageSpinBox;
- QPushButton* okButton;
- QPushButton* cancelButton;
+ QLabel* masterPageLabel { nullptr };
+ QComboBox* masterPageComboBox { nullptr };
+ QGroupBox* applyToPageButtonGroup { nullptr };
+ QRadioButton* currentPageRadioButton { nullptr };
+ QRadioButton* evenPagesRadioButton { nullptr };
+ QRadioButton* oddPagesRadioButton { nullptr };
+ QRadioButton* allPagesRadioButton { nullptr };
+ QCheckBox* useRangeCheckBox { nullptr };
+ ScrSpinBox* fromPageSpinBox { nullptr };
+ QLabel* toPageLabel { nullptr };
+ ScrSpinBox* toPageSpinBox { nullptr };
+ QPushButton* okButton { nullptr };
+ QPushButton* cancelButton { nullptr };
virtual void setup(ScribusDoc* doc, const QString& Nam);
virtual QString getMasterPageName();
@@ -64,14 +64,14 @@
virtual int getToPage();
protected:
- QVBoxLayout* ApplyMasterPageDialogLayout;
- QHBoxLayout* templateNameLayout;
- QSpacerItem* spacer2;
- QVBoxLayout* applyToPageButtonGroupLayout;
- QHBoxLayout* rangeLayout;
- QSpacerItem* spacer3;
- QHBoxLayout* layout8;
- QSpacerItem* spacer1;
+ QVBoxLayout* ApplyMasterPageDialogLayout { nullptr };
+ QHBoxLayout* templateNameLayout { nullptr };
+ QSpacerItem* spacer2 { nullptr };
+ QVBoxLayout* applyToPageButtonGroupLayout { nullptr };
+ QHBoxLayout* rangeLayout { nullptr };
+ QSpacerItem* spacer3 { nullptr };
+ QHBoxLayout* layout8 { nullptr };
+ QSpacerItem* spacer1 { nullptr };
void changeEvent(QEvent *e) override;
Modified: trunk/Scribus/scribus/ui/inspage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/inspage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.cpp (original)
+++ trunk/Scribus/scribus/ui/inspage.cpp Mon Oct 25 19:55:09 2021
@@ -316,10 +316,11 @@
void InsPage::setSize(const QString & gr)
{
+ PageSize ps2(gr);
+
widthSpinBox->setEnabled(false);
heightSpinBox->setEnabled(false);
- PageSize *ps2 = new PageSize(gr);
- prefsPageSizeName = ps2->name();
+ prefsPageSizeName = ps2.name();
if (gr == CommonStrings::trCustomPageSize)
{
widthSpinBox->setEnabled(true);
@@ -328,10 +329,9 @@
}
else
{
- widthSpinBox->setValue(ps2->width() * m_unitRatio);
- heightSpinBox->setValue(ps2->height() * m_unitRatio);
- }
- delete ps2;
+ widthSpinBox->setValue(ps2.width() * m_unitRatio);
+ heightSpinBox->setValue(ps2.height() * m_unitRatio);
+ }
}
void InsPage::setOrientation(int ori)
Modified: trunk/Scribus/scribus/ui/newdocdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/newdocdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.cpp Mon Oct 25 19:55:09 2021
@@ -66,19 +66,21 @@
void PageLayoutsWidget::arrangeIcons()
{
- QListWidgetItem* ic;
int startY = 5;
int startX = 5;
+ int maxSizeY = 0;
+
setResizeMode(QListView::Fixed);
- int maxSizeY = 0;
- for (int cc = 0; cc < count(); ++cc)
- {
- ic = item(cc);
- QRect ir = visualItemRect(ic);
- setPositionForIndex(QPoint(startX, startY), indexFromItem(ic));
- startX += ir.width() + 5;
- maxSizeY = qMax(maxSizeY, ir.height());
- }
+
+ for (int i = 0; i < count(); ++i)
+ {
+ QListWidgetItem* itemWidget = item(i);
+ QRect itemRect = visualItemRect(itemWidget);
+ setPositionForIndex(QPoint(startX, startY), indexFromItem(itemWidget));
+ startX += itemRect.width() + 5;
+ maxSizeY = qMax(maxSizeY, itemRect.height());
+ }
+
maxX = startX;
maxY = maxSizeY + 10;
}
@@ -89,12 +91,12 @@
}
NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : QDialog(parent),
- prefsManager(PrefsManager::instance())
+ prefsManager(PrefsManager::instance()),
+ m_onStartup(startUp)
{
setObjectName(QString::fromLocal8Bit("NewDocumentWindow"));
setModal(true);
- m_onStartup = startUp;
m_unitIndex = prefsManager.appPrefs.docSetupPrefs.docUnitIndex;
m_unitRatio = unitGetRatioFromIndex(m_unitIndex);
m_unitSuffix = unitGetSuffixFromIndex(m_unitIndex);
@@ -644,16 +646,15 @@
}
else
{
- PageSize *ps2 = new PageSize(gr);
+ PageSize ps2(gr);
if (pageOrientationComboBox->currentIndex() == portraitPage)
{
- m_pageWidth = ps2->width();
- m_pageHeight = ps2->height();
+ m_pageWidth = ps2.width();
+ m_pageHeight = ps2.height();
} else {
- m_pageWidth = ps2->height();
- m_pageHeight = ps2->width();
+ m_pageWidth = ps2.height();
+ m_pageHeight = ps2.width();
}
- delete ps2;
}
widthSpinBox->setValue(m_pageWidth * m_unitRatio);
heightSpinBox->setValue(m_pageHeight * m_unitRatio);
Modified: trunk/Scribus/scribus/ui/newdocdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/newdocdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.h (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.h Mon Oct 25 19:55:09 2021
@@ -169,14 +169,14 @@
double m_unitRatio { 1.0 };
int m_orientation { 0 };
int m_choosenLayout { 0 };
- double m_pageWidth;
- double m_pageHeight;
+ double m_pageWidth { 1.0 };
+ double m_pageHeight { 1.0 };
double m_distance { 11.0 };
QString m_unitSuffix;
QString m_selectedFile;
int m_unitIndex { 0 };
int m_tabSelected { 0 };
- bool m_onStartup;
+ bool m_onStartup { false };
double m_bleedBottom { 0.0 };
double m_bleedTop { 0.0 };
double m_bleedLeft { 0.0 };
Modified: trunk/Scribus/scribus/ui/numformatcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/numformatcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/numformatcombo.cpp (original)
+++ trunk/Scribus/scribus/ui/numformatcombo.cpp Mon Oct 25 19:55:09 2021
@@ -15,14 +15,13 @@
NumFormatCombo::NumFormatCombo(QWidget* parent)
: QComboBox(parent)
{
- m_showNoneFormat = false;
setupCombo();
}
NumFormatCombo::NumFormatCombo(QWidget* parent, bool showNone)
- : QComboBox(parent)
+ : QComboBox(parent),
+ m_showNoneFormat(showNone)
{
- m_showNoneFormat = showNone;
setupCombo();
}
Modified: trunk/Scribus/scribus/ui/numformatcombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/numformatcombo.h
==============================================================================
--- trunk/Scribus/scribus/ui/numformatcombo.h (original)
+++ trunk/Scribus/scribus/ui/numformatcombo.h Mon Oct 25 19:55:09 2021
@@ -22,14 +22,14 @@
Q_OBJECT
public:
- NumFormatCombo(QWidget* parent=nullptr);
+ NumFormatCombo(QWidget* parent = nullptr);
NumFormatCombo(QWidget* parent, bool showNone);
NumFormat currentFormat() const;
void setCurrentFormat(NumFormat format);
protected:
- bool m_showNoneFormat;
+ bool m_showNoneFormat { false };
void changeEvent(QEvent *e) override;
void languageChange(void);
Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Mon Oct 25 19:55:09 2021
@@ -6,6 +6,7 @@
*/
#include <QBuffer>
+#include <QDebug>
#include <QEvent>
#include <QHeaderView>
#include <QHelpEvent>
@@ -16,12 +17,12 @@
#include <QMenu>
#include <QMessageBox>
#include <QResizeEvent>
+#include <QSignalBlocker>
+#include <QSignalMapper>
+#include <QShortcut>
#include <QToolTip>
#include <QVariant>
#include <QWidgetAction>
-#include <QSignalMapper>
-#include <QShortcut>
-#include <QDebug>
#include "actionmanager.h"
#include "appmodes.h"
@@ -47,20 +48,12 @@
OutlineTreeItem::OutlineTreeItem(OutlineTreeItem* parent, OutlineTreeItem* after) : QTreeWidgetItem(parent, after)
{
- PageObject = nullptr;
- PageItemObject = nullptr;
- DocObject = nullptr;
- type = -1;
- LayerID = -1;
+
}
OutlineTreeItem::OutlineTreeItem(QTreeWidget* parent, OutlineTreeItem* after) : QTreeWidgetItem(parent, after)
{
- PageObject = nullptr;
- PageItemObject = nullptr;
- DocObject = nullptr;
- type = -1;
- LayerID = -1;
+
}
OutlineWidget::OutlineWidget(QWidget* parent) : QTreeWidget(parent)
@@ -480,12 +473,6 @@
unsetDoc();
- selectionTriggered = false;
- m_MainWindow = nullptr;
- freeObjects = nullptr;
- rootObject = nullptr;
- currentObject = nullptr;
-
iconSetChange();
languageChange();
@@ -519,14 +506,14 @@
void OutlinePalette::unsetDoc()
{
- currDoc=nullptr;
+ currDoc = nullptr;
clearPalette();
}
void OutlinePalette::setPaletteShown(bool visible)
{
ScDockPalette::setPaletteShown(visible);
- if ((visible) && (currDoc != nullptr))
+ if (visible && (currDoc != nullptr))
BuildTree();
}
@@ -551,7 +538,7 @@
else if ((item->type == 1) || (item->type == 3) || (item->type == 4))
{
PageItem *currItem = item->PageItemObject;
- if (currItem!=nullptr)
+ if (currItem != nullptr)
{
currentObject = ite;
createContextMenu(currItem, point.x(), point.y());
@@ -648,58 +635,59 @@
{
if (!m_MainWindow || m_MainWindow->scriptIsRunning())
return;
- disconnect(reportDisplay, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotDoRename(QTreeWidgetItem*, int)));
+
+ QSignalBlocker reportDisplayBlocker(reportDisplay);
+
OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(ite);
- if (item != nullptr)
- {
- if ((item->type == 1) || (item->type == 3) || (item->type == 4))
- {
- QString NameOld = item->PageItemObject->itemName();
- QString NameNew = ite->text(col);
- if (NameOld != NameNew)
- {
- if (NameNew == "")
- ite->setText(col, NameOld);
+ if (item == nullptr)
+ return;
+
+ if ((item->type == 1) || (item->type == 3) || (item->type == 4))
+ {
+ QString oldName = item->PageItemObject->itemName();
+ QString newName = ite->text(col);
+ if (oldName != newName)
+ {
+ if (newName.isEmpty())
+ ite->setText(col, oldName);
+ else
+ {
+ bool found = false;
+ QList<PageItem*> allItems;
+ for (int a = 0; a < currDoc->Items->count(); ++a)
+ {
+ PageItem *currItem = currDoc->Items->at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getAllChildren();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ PageItem* ite = allItems.at(ii);
+ if ((newName == ite->itemName()) && (ite != item->PageItemObject))
+ {
+ found = true;
+ break;
+ }
+ }
+ allItems.clear();
+ }
+ if (found)
+ {
+ ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(newName)+"</qt>");
+ ite->setText(col, oldName);
+ }
else
{
- bool found = false;
- QList<PageItem*> allItems;
- for (int a = 0; a < currDoc->Items->count(); ++a)
- {
- PageItem *currItem = currDoc->Items->at(a);
- if (currItem->isGroup())
- allItems = currItem->getAllChildren();
- else
- allItems.append(currItem);
- for (int ii = 0; ii < allItems.count(); ii++)
- {
- PageItem* ite = allItems.at(ii);
- if ((NameNew == ite->itemName()) && (ite != item->PageItemObject))
- {
- found = true;
- break;
- }
- }
- allItems.clear();
- }
- if (found)
- {
- ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>");
- ite->setText(col, NameOld);
- }
- else
- {
- item->PageItemObject->setItemName(NameNew);
- m_MainWindow->propertiesPalette->setCurrentItem(item->PageItemObject);
- m_MainWindow->contentPalette->setCurrentItem(item->PageItemObject);
- currDoc->setModified(true);
- }
- }
- }
- }
- filterTree();
- }
- connect(reportDisplay, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotDoRename(QTreeWidgetItem*, int)));
+ item->PageItemObject->setItemName(newName);
+ m_MainWindow->propertiesPalette->setCurrentItem(item->PageItemObject);
+ m_MainWindow->contentPalette->setCurrentItem(item->PageItemObject);
+ currDoc->setModified(true);
+ }
+ }
+ }
+ }
+ filterTree();
}
QTreeWidgetItem* OutlinePalette::getListItem(int pageNr, PageItem *pageItem)
@@ -767,13 +755,15 @@
{
if (!m_MainWindow || m_MainWindow->scriptIsRunning())
return;
- if (currDoc==nullptr)
+ if (currDoc == nullptr)
return;
if (currDoc->isLoading())
return;
if (selectionTriggered)
return;
- disconnect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
+
+ QSignalBlocker reportDisplayBlocker(reportDisplay);
+
reportDisplay->clearSelection();
if (currDoc->m_Selection->count() > 0)
{
@@ -797,7 +787,6 @@
QList<QTreeWidgetItem *> items = reportDisplay->selectedItems();
if (items.count() > 0)
reportDisplay->scrollToItem(items[0], QAbstractItemView::EnsureVisible);
- connect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
}
void OutlinePalette::setItemIcon(QTreeWidgetItem *item, PageItem *pgItem)
@@ -882,7 +871,7 @@
return;
OutlineTreeItem *item = nullptr;
QTreeWidgetItemIterator it( reportDisplay );
- while ( (*it) )
+ while (*it)
{
item = dynamic_cast<OutlineTreeItem*>(*it);
if (!item)
@@ -917,7 +906,7 @@
currDoc->OpenNodes.clear();
OutlineTreeItem *item = nullptr;
QTreeWidgetItemIterator it( reportDisplay );
- while ( (*it) )
+ while (*it)
{
item = dynamic_cast<OutlineTreeItem*>(*it);
if (!item)
@@ -937,10 +926,12 @@
{
if (!m_MainWindow || m_MainWindow->scriptIsRunning())
return;
- if (currDoc==nullptr)
- return;
- disconnect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
+ if (currDoc == nullptr)
+ return;
+
+ QSignalBlocker reportDisplayBlocker(reportDisplay);
selectionTriggered = true;
+
QList<QTreeWidgetItem *> items = reportDisplay->selectedItems();
if (items.count() != 1)
{
@@ -984,7 +975,6 @@
else
slotSelect(items[0], 0);
selectionTriggered = false;
- connect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
}
void OutlinePalette::slotSelect(QTreeWidgetItem* ite, int)
@@ -1084,21 +1074,23 @@
return;
if (selectionTriggered)
return;
- disconnect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
- disconnect(reportDisplay, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotDoRename(QTreeWidgetItem*, int)));
+
+ QSignalBlocker reportDisplayBlocker(reportDisplay);
setUpdatesEnabled(false);
if (storeVals)
buildReopenVals();
clearPalette();
+
OutlineTreeItem * item = new OutlineTreeItem( reportDisplay, nullptr );
rootObject = item;
item->setText( 0, currDoc->documentFileName().section( '/', -1 ) );
item->type = -2;
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+ QString tmp;
+ PageItem* pgItem;
OutlineTreeItem * pagep = nullptr;
freeObjects = nullptr;
- PageItem* pgItem;
- QString tmp;
if (currDoc->symbolEditMode() || currDoc->inlineEditMode())
{
OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
@@ -1151,7 +1143,7 @@
for (int b = 0; b < currDoc->MasterItems.count(); ++b)
{
pgItem = currDoc->MasterItems.at(b);
- if (((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam)))
+ if ((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam))
{
if (!pgItem->isGroup())
{
@@ -1181,7 +1173,7 @@
page->setText(0, currDoc->MasterPages.at(a)->pageName());
}
bool hasfreeItems = false;
- for (int a = 0; a < static_cast<int>(currDoc->DocPages.count()); ++a)
+ for (int a = 0; a < currDoc->DocPages.count(); ++a)
{
OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
page->PageObject = currDoc->DocPages.at(a);
@@ -1382,15 +1374,13 @@
if (currDoc->m_Selection->count() > 0)
slotShowSelect(0, nullptr);
update();
- connect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
- connect(reportDisplay, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(slotDoRename(QTreeWidgetItem*,int)));
}
void OutlinePalette::filterTree(const QString& keyword)
{
OutlineTreeItem *item = nullptr;
QTreeWidgetItemIterator it( reportDisplay );
- while ( (*it) )
+ while (*it)
{
item = dynamic_cast<OutlineTreeItem*>(*it);
if (item != nullptr)
@@ -1502,11 +1492,11 @@
void OutlinePalette::createContextMenu(PageItem * currItem, double /*mx*/, double /*my*/)
{
- if (m_MainWindow==nullptr || currDoc==nullptr)
- return;
- ContextMenu* cmen=nullptr;
+ if (m_MainWindow == nullptr || currDoc == nullptr)
+ return;
+ ContextMenu* cmen = nullptr;
// qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (currItem!=nullptr)
+ if (currItem != nullptr)
cmen = new ContextMenu(*(currDoc->m_Selection), m_MainWindow, currDoc);
else
cmen = new ContextMenu(m_MainWindow, currDoc, currDoc->currentPage()->xOffset(), currDoc->currentPage()->yOffset());
Modified: trunk/Scribus/scribus/ui/outlinepalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/outlinepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.h (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.h Mon Oct 25 19:55:09 2021
@@ -30,11 +30,12 @@
OutlineTreeItem(OutlineTreeItem* parent, OutlineTreeItem* after);
OutlineTreeItem(QTreeWidget* parent, OutlineTreeItem* after);
~OutlineTreeItem() {};
- PageItem *PageItemObject;
- ScPage *PageObject;
- ScribusDoc *DocObject;
- int LayerID;
- int type; //1=PageItem on Master Page,2=,3=PageItem,4=,5=,...
+
+ PageItem *PageItemObject { nullptr };
+ ScPage *PageObject { nullptr };
+ ScribusDoc *DocObject { nullptr };
+ int LayerID { -1 };
+ int type { -1 }; //1=PageItem on Master Page,2=,3=PageItem,4=,5=,...
};
class SCRIBUS_API OutlineWidget : public QTreeWidget
@@ -103,6 +104,10 @@
void clearPalette();
void createContextMenu(PageItem *currItem, double, double);
+ bool selectionTriggered { false };
+ ScribusDoc* currDoc { nullptr };
+ ScribusMainWindow* m_MainWindow { nullptr };
+
QWidget* containerWidget { nullptr };
OutlineWidget* reportDisplay { nullptr };
QTreeWidgetItem* freeObjects { nullptr };
@@ -110,7 +115,6 @@
QTreeWidgetItem* currentObject { nullptr };
QLabel* filterLabel { nullptr };
QLineEdit* filterEdit { nullptr };
- ScribusMainWindow* m_MainWindow { nullptr };
QPixmap textIcon;
QPixmap imageIcon;
QPixmap latexIcon;
@@ -130,8 +134,6 @@
QPixmap annotLinkIcon;
QPixmap annot3DIcon;
QPixmap groupIcon;
- bool selectionTriggered { false };
- ScribusDoc *currDoc { nullptr };
};
#endif // TREE_H
Modified: trunk/Scribus/scribus/ui/pagepropertiesdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/pagepropertiesdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepropertiesdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepropertiesdialog.cpp Mon Oct 25 19:55:09 2021
@@ -4,16 +4,16 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
-#include <QPixmap>
+#include <QCheckBox>
+#include <QColorDialog>
+#include <QComboBox>
#include <QGridLayout>
#include <QHBoxLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPixmap>
+#include <QPushButton>
#include <QVBoxLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QGroupBox>
-#include <QComboBox>
-#include <QCheckBox>
-#include <QColorDialog>
#include "commonstrings.h"
#include "iconmanager.h"
@@ -26,12 +26,13 @@
#include "scrspinbox.h"
#include "units.h"
-PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc ) : QDialog( parent)
+PagePropertiesDialog::PagePropertiesDialog( QWidget* parent, ScribusDoc* doc )
+ : QDialog( parent),
+ m_unitRatio(doc->unitRatio())
{
setModal(true);
setWindowTitle( tr( "Manage Page Properties" ) );
setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
- unitRatio = doc->unitRatio();
dialogLayout = new QVBoxLayout(this);
dialogLayout->setContentsMargins(9, 9, 9, 9);
dialogLayout->setSpacing(6);
@@ -94,11 +95,10 @@
TextLabel3 = new QLabel( tr( "Type:" ), dsGroupBox7 );
dsGroupBox7Layout->addWidget( TextLabel3, 4, 0, 1, 2 );
Links = new QComboBox( dsGroupBox7 );
- QStringList::Iterator pNames;
QList<PageSet> pageSet(doc->pageSets());
- for(pNames = pageSet[doc->pagePositioning()].pageNames.begin(); pNames != pageSet[doc->pagePositioning()].pageNames.end(); ++pNames )
+ const QStringList& pageNames = pageSet.at(doc->pagePositioning()).pageNames;
+ for (auto pNames = pageNames.begin(); pNames != pageNames.end(); ++pNames )
{
- //Links->insertItem((*pNames));
Links->addItem(CommonStrings::translatePageSetLocString((*pNames)));
}
Links->setEditable(false);
@@ -159,8 +159,10 @@
okCancelLayout->addWidget(cancelButton);
dialogLayout->addLayout( okCancelLayout );
setMaximumSize(sizeHint());
- pageWidth = widthSpinBox->value() / unitRatio;
- pageHeight = heightSpinBox->value() / unitRatio;
+
+ m_pageWidth = widthSpinBox->value() / m_unitRatio;
+ m_pageHeight = heightSpinBox->value() / m_unitRatio;
+
bool isCustom = (sizeQComboBox->currentText() == CommonStrings::trCustomPageSize);
heightSpinBox->setEnabled(isCustom);
widthSpinBox->setEnabled(isCustom);
@@ -187,8 +189,8 @@
void PagePropertiesDialog::setPageWidth(double)
{
- pageWidth = widthSpinBox->value() / unitRatio;
- marginWidget->setPageWidth(pageWidth);
+ m_pageWidth = widthSpinBox->value() / m_unitRatio;
+ marginWidget->setPageWidth(m_pageWidth);
int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
if (newOrientation != orientationQComboBox->currentIndex())
{
@@ -201,8 +203,8 @@
void PagePropertiesDialog::setPageHeight(double)
{
- pageHeight = heightSpinBox->value() / unitRatio;
- marginWidget->setPageHeight(pageHeight);
+ m_pageHeight = heightSpinBox->value() / m_unitRatio;
+ marginWidget->setPageHeight(m_pageHeight);
int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
if (newOrientation != orientationQComboBox->currentIndex())
{
@@ -222,12 +224,12 @@
void PagePropertiesDialog::setSize(const QString & gr)
{
- pageWidth = widthSpinBox->value() / unitRatio;
- pageHeight = heightSpinBox->value() / unitRatio;
+ m_pageWidth = widthSpinBox->value() / m_unitRatio;
+ m_pageHeight = heightSpinBox->value() / m_unitRatio;
widthSpinBox->setEnabled(false);
heightSpinBox->setEnabled(false);
- PageSize *ps2 = new PageSize(gr);
- prefsPageSizeName = ps2->name();
+ PageSize ps2(gr);
+ prefsPageSizeName = ps2.name();
if (gr == CommonStrings::trCustomPageSize)
{
widthSpinBox->setEnabled(true);
@@ -236,19 +238,18 @@
}
else
{
- pageWidth = ps2->width();
- pageHeight = ps2->height();
+ m_pageWidth = ps2.width();
+ m_pageHeight = ps2.height();
}
disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
- widthSpinBox->setValue(pageWidth * unitRatio);
- heightSpinBox->setValue(pageHeight * unitRatio);
- marginWidget->setPageHeight(pageHeight);
- marginWidget->setPageWidth(pageWidth);
+ widthSpinBox->setValue(m_pageWidth * m_unitRatio);
+ heightSpinBox->setValue(m_pageHeight * m_unitRatio);
+ marginWidget->setPageHeight(m_pageHeight);
+ marginWidget->setPageWidth(m_pageWidth);
marginWidget->setPageSize(gr);
connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
- delete ps2;
}
void PagePropertiesDialog::setOrientation(int ori)
@@ -272,13 +273,13 @@
}
}
oldOri = ori;
- pageWidth = widthSpinBox->value() / unitRatio;
- pageHeight = heightSpinBox->value() / unitRatio;
+ m_pageWidth = widthSpinBox->value() / m_unitRatio;
+ m_pageHeight = heightSpinBox->value() / m_unitRatio;
connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
}
-int PagePropertiesDialog::pageOrder()
+int PagePropertiesDialog::pageOrder() const
{
int lp=0;
if (Links!=nullptr)
@@ -292,59 +293,59 @@
return lp;
}
-double PagePropertiesDialog::getPageWidth()
-{
- return pageWidth;
-}
-
-double PagePropertiesDialog::getPageHeight()
-{
- return pageHeight;
-}
-
-int PagePropertiesDialog::getPageOrientation()
+double PagePropertiesDialog::getPageWidth() const
+{
+ return m_pageWidth;
+}
+
+double PagePropertiesDialog::getPageHeight() const
+{
+ return m_pageHeight;
+}
+
+int PagePropertiesDialog::getPageOrientation() const
{
return orientationQComboBox->currentIndex();
}
-QString PagePropertiesDialog::getPrefsPageSizeName()
+QString PagePropertiesDialog::getPrefsPageSizeName() const
{
return prefsPageSizeName;
}
-bool PagePropertiesDialog::getMoveObjects()
+bool PagePropertiesDialog::getMoveObjects() const
{
return moveObjects->isChecked();
}
-double PagePropertiesDialog::top()
+double PagePropertiesDialog::top() const
{
return marginWidget->top();
}
-double PagePropertiesDialog::bottom()
+double PagePropertiesDialog::bottom() const
{
return marginWidget->bottom();
}
-double PagePropertiesDialog::left()
+double PagePropertiesDialog::left() const
{
return marginWidget->left();
}
-double PagePropertiesDialog::right()
+double PagePropertiesDialog::right() const
{
return marginWidget->right();
}
-QString PagePropertiesDialog::masterPage()
+QString PagePropertiesDialog::masterPage() const
{
if (masterPageComboBox != nullptr)
return masterPageComboBox->currentText();
- return "";
-}
-
-int PagePropertiesDialog::getMarginPreset()
+ return QString();
+}
+
+int PagePropertiesDialog::getMarginPreset() const
{
return marginWidget->getMarginPreset();
}
Modified: trunk/Scribus/scribus/ui/pagepropertiesdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/pagepropertiesdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/pagepropertiesdialog.h (original)
+++ trunk/Scribus/scribus/ui/pagepropertiesdialog.h Mon Oct 25 19:55:09 2021
@@ -38,38 +38,38 @@
/*! \brief Returns recomputed "Links" index/value for facing pages.
\retval int 0 for max item, 1 for min. item++ for middle. Why? */
- int pageOrder();
+ int pageOrder() const;
/*! \brief Current value of orientationQComboBox.
\retval int index of combobox */
- int getPageOrientation();
+ int getPageOrientation() const;
/*! \brief Selected page width
\retval double X */
- double getPageWidth();
+ double getPageWidth() const;
/*! \brief Selected page height
\retval double Y */
- double getPageHeight();
+ double getPageHeight() const;
/*! \brief Bool value of moveObjects "property"
\retval bool true for moving */
- bool getMoveObjects();
+ bool getMoveObjects() const;
/*! \brief Returns prefsPageSizeName value
\retval QString prefsPageSizeName property */
- QString getPrefsPageSizeName();
+ QString getPrefsPageSizeName() const;
/*! \brief Top Margin
\retval double margin size */
- double top();
+ double top() const;
/*! \brief Bottom Margin
\retval double margin size */
- double bottom();
+ double bottom() const;
/*! \brief Left Margin
\retval double margin size */
- double left();
+ double left() const;
/*! \brief Right Margin
\retval double margin size */
- double right();
+ double right() const;
/*! \brief Master Page
\retval QString Master Page Name */
- QString masterPage();
- int getMarginPreset();
+ QString masterPage() const;
+ int getMarginPreset() const;
public slots:
//! \brief as setOrientation for orientationQComboBox current item
@@ -90,35 +90,36 @@
void setPageHeight(double v);
private:
- MarginWidget* marginWidget;
- QGroupBox* dsGroupBox7;
- QGroupBox* groupMaster;
- QLabel* masterPageLabel;
- QComboBox* masterPageComboBox;
- ScrSpinBox* widthSpinBox;
- ScrSpinBox* heightSpinBox;
- QLabel* widthQLabel;
- QLabel* heightQLabel;
- QLabel* TextLabel1;
- QLabel* TextLabel2;
- QComboBox* sizeQComboBox;
- QComboBox* orientationQComboBox;
- QComboBox* Links;
- QLabel* TextLabel3;
- QCheckBox* moveObjects;
- QPushButton* pageFillColorButton;
- QPushButton* cancelButton;
- QPushButton* okButton;
- double unitRatio;
- double pageWidth;
- double pageHeight;
+ MarginWidget* marginWidget { nullptr };
+ QGroupBox* dsGroupBox7 { nullptr };
+ QGroupBox* groupMaster { nullptr };
+ QLabel* masterPageLabel { nullptr };
+ QComboBox* masterPageComboBox { 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 };
+ QComboBox* Links { nullptr };
+ QLabel* TextLabel3 { nullptr };
+ QCheckBox* moveObjects { nullptr };
+ QPushButton* pageFillColorButton { nullptr };
+ QPushButton* cancelButton { nullptr };
+ QPushButton* okButton { nullptr };
+ QGridLayout* dsGroupBox7Layout { nullptr };
+ QVBoxLayout* dialogLayout { nullptr };
+ QHBoxLayout* okCancelLayout { nullptr };
+ QHBoxLayout* masterLayout { nullptr };
+
+ double m_unitRatio { 1.0 };
+ double m_pageWidth { 1.0 };
+ double m_pageHeight { 1.0 };
//! \brief Old orientation. Before it's changed via combobox.
- int oldOri;
+ int oldOri { 0 };
QString prefsPageSizeName;
- QGridLayout* dsGroupBox7Layout;
- QVBoxLayout* dialogLayout;
- QHBoxLayout* okCancelLayout;
- QHBoxLayout* masterLayout;
};
Modified: trunk/Scribus/scribus/ui/textpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/textpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/textpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/textpalette.cpp Mon Oct 25 19:55:09 2021
@@ -56,8 +56,6 @@
setWidget( textPal );
languageChange();
-
- m_haveItem = false;
}
void TextPalette::closeEvent(QCloseEvent *closeEvent)
Modified: trunk/Scribus/scribus/ui/textpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/ui/textpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/textpalette.h (original)
+++ trunk/Scribus/scribus/ui/textpalette.h Mon Oct 25 19:55:09 2021
@@ -77,8 +77,6 @@
UndoManager *undoManager { nullptr };
ScGuardedPtr<ScribusDoc> m_doc;
-
- int idTextItem;
void changeEvent(QEvent *e) override;
void closeEvent(QCloseEvent *closeEvent) override;
Modified: trunk/Scribus/scribus/updatemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/updatemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/updatemanager.cpp (original)
+++ trunk/Scribus/scribus/updatemanager.cpp Mon Oct 25 19:55:09 2021
@@ -1,16 +1,8 @@
#include "updatemanager.h"
-
-UpdateMemento::~UpdateMemento()
-{}
-
-
-// int m_updatesDisabled;
-// QSet<QPair<UpdateManaged*, UpdateMemento*> > m_pending;
-typedef QPair<UpdateManaged*, UpdateMemento*> PendingUpdate;
-
+using PendingUpdate = QPair<UpdateManaged*, UpdateMemento*>;
UpdateManager::~UpdateManager()
{
@@ -40,7 +32,6 @@
}
}
-
bool UpdateManager::requestUpdate(UpdateManaged* observable, UpdateMemento* what)
{
if (m_updatesDisabled == 0)
@@ -48,4 +39,3 @@
m_pending.insert(PendingUpdate(observable, what));
return false;
}
-
Modified: trunk/Scribus/scribus/updatemanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/updatemanager.h
==============================================================================
--- trunk/Scribus/scribus/updatemanager.h (original)
+++ trunk/Scribus/scribus/updatemanager.h Mon Oct 25 19:55:09 2021
@@ -28,7 +28,7 @@
*/
struct SCRIBUS_API UpdateMemento
{
- virtual ~UpdateMemento();
+ virtual ~UpdateMemento() = default;
};
@@ -42,7 +42,7 @@
{
public:
virtual void updateNow(UpdateMemento* what) = 0;
- virtual ~UpdateManaged() {}
+ virtual ~UpdateManaged() = default;
};
@@ -69,12 +69,12 @@
QSet<QPair<UpdateManaged*, UpdateMemento*> > m_pending;
public:
- UpdateManager() {}
+ UpdateManager() = default;
virtual ~UpdateManager();
void setUpdatesEnabled(bool val = true);
void setUpdatesDisabled() { setUpdatesEnabled(false); };
- bool updatesEnabled() { return m_updatesDisabled == 0; };
+ bool updatesEnabled() const { return m_updatesDisabled == 0; };
/**
Returns true if updates are enabled, otherwise stores 'observable' for notification when updates get enabled again.
*/
Modified: trunk/Scribus/scribus/util_debug.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24754&path=/trunk/Scribus/scribus/util_debug.cpp
==============================================================================
--- trunk/Scribus/scribus/util_debug.cpp (original)
+++ trunk/Scribus/scribus/util_debug.cpp Mon Oct 25 19:55:09 2021
@@ -42,8 +42,7 @@
void tDebug(const QString& message)
{
- QDateTime debugTime;
- qDebug("%s", QString("%1\t%2").arg(debugTime.currentDateTime().toString("hh:mm:ss:zzz"), message).toLatin1().constData());
+ qDebug("%s", QString("%1\t%2").arg(QDateTime::currentDateTime().toString("hh:mm:ss:zzz"), message).toLatin1().constData());
}
More information about the scribus-commit
mailing list