r24055 by craig - Code cleanup
scribus-commit
scribus-commit at lists.scribus.net
Thu Oct 8 21:16:25 UTC 2020
Author: craig
Date: Thu Oct 8 21:16:25 2020
New Revision: 24055
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24055
Log:
Code cleanup
Modified:
trunk/Scribus/scribus/canvasmode_edit.cpp
trunk/Scribus/scribus/desaxe/digester.cpp
trunk/Scribus/scribus/desaxe/simple_actions.h
trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
trunk/Scribus/scribus/scpaths.cpp
trunk/Scribus/scribus/scribus.h
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusview.h
trunk/Scribus/scribus/text/boxes.cpp
trunk/Scribus/scribus/text/textlayout.cpp
trunk/Scribus/scribus/text/textshaper.cpp
trunk/Scribus/scribus/ui/actionsearchdialog.cpp
trunk/Scribus/scribus/ui/charselect.h
trunk/Scribus/scribus/ui/colorchart.cpp
trunk/Scribus/scribus/ui/colorchart.h
trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp
trunk/Scribus/scribus/ui/createrange.cpp
trunk/Scribus/scribus/ui/createrange.h
trunk/Scribus/scribus/ui/directionselect.h
trunk/Scribus/scribus/ui/fontcombo.h
trunk/Scribus/scribus/ui/guidemanager.h
trunk/Scribus/scribus/ui/layers.cpp
trunk/Scribus/scribus/ui/newdocdialog.cpp
trunk/Scribus/scribus/ui/outlinepalette.h
trunk/Scribus/scribus/ui/scrpalettebase.h
Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Thu Oct 8 21:16:25 2020
@@ -527,6 +527,7 @@
void CanvasMode_Edit::mousePressEvent(QMouseEvent *m)
{
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 1"<<m_doc->isModified();
if (UndoManager::undoEnabled())
{
SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo());
@@ -576,28 +577,33 @@
int oldP=0;
if (GetItem(&currItem))
{
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 2"<<m_doc->isModified();
// m_view->slotDoCurs(false);
if ((!currItem->locked() || currItem->isTextFrame()) && !currItem->isLine())
{
FPoint canvasPoint = m_canvas->globalToCanvas(m->globalPos());
if (m_canvas->frameHitTest(QPointF(canvasPoint.x(), canvasPoint.y()), currItem) < 0)
{
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 3"<<m_doc->isModified();
m_doc->m_Selection->delaySignalsOn();
m_view->deselectItems(true);
bool wantNormal = true;
if (SeleItem(m))
{
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 4"<<m_doc->isModified();
currItem = m_doc->m_Selection->itemAt(0);
if ((currItem->isTextFrame()) || (currItem->isImageFrame()))
{
m_view->requestMode(modeEdit);
wantNormal = false;
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 21"<<m_doc->isModified();
}
else
{
m_view->requestMode(submodePaintingDone);
m_view->setCursor(QCursor(Qt::ArrowCursor));
}
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 10"<<m_doc->isModified();
if (currItem->isTextFrame())
{
m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
@@ -708,6 +714,7 @@
}
else if (!currItem->isImageFrame() || m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem) < 0)
{
+ qDebug()<<"CanvasMode_Edit::mousePressEvent 7"<<m_doc->isModified();
m_view->deselectItems(true);
if (SeleItem(m))
{
Modified: trunk/Scribus/scribus/desaxe/digester.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/desaxe/digester.cpp
==============================================================================
--- trunk/Scribus/scribus/desaxe/digester.cpp (original)
+++ trunk/Scribus/scribus/desaxe/digester.cpp Thu Oct 8 21:16:25 2020
@@ -202,9 +202,9 @@
Xml_string Digester::concat(const Xml_string& pattern1, const Xml_string& pattern2)
{
- if (pattern1 == "")
+ if (pattern1.isEmpty())
return pattern2;
- if (pattern2 == "")
+ if (pattern2.isEmpty())
return pattern1;
if ( (pattern1[pattern1.length()-1] != '/') && (pattern2[0] != '/') )
// insert "/" as separator
Modified: trunk/Scribus/scribus/desaxe/simple_actions.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/desaxe/simple_actions.h
==============================================================================
--- trunk/Scribus/scribus/desaxe/simple_actions.h (original)
+++ trunk/Scribus/scribus/desaxe/simple_actions.h Thu Oct 8 21:16:25 2020
@@ -541,7 +541,7 @@
void begin(const Xml_string&, Xml_attr)
{
- txt = "";
+ txt.clear();
}
void chars(const Xml_string& chunk)
@@ -634,11 +634,11 @@
mode.isIdRef = true;
}
else {
- mode.ID = "";
+ mode.ID.clear();
mode.isIdRef = false;
}
}
- if (mode.ID != "")
+ if (!mode.ID.isEmpty())
{
Obj_Type* storedObj = this->dig->template lookup<Obj_Type>(mode.ID);
if ( !storedObj )
Modified: trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlthread.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlthread.cpp Thu Oct 8 21:16:25 2020
@@ -44,7 +44,7 @@
QString l(QDir::cleanPath(location));
if (!l.endsWith("/"))
l += "/";
- for (const QString& u : m_urlList)
+ for (const QString& u : qAsConst(m_urlList))
{
QUrl url(u);
if (!urlOK(u))
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Oct 8 21:16:25 2020
@@ -6311,7 +6311,7 @@
QString mlName2 = mlName;
readMultiline(ml, reader);
QHash<QString,multiLine>::ConstIterator mlit = m_Doc->docLineStyles.find(mlName2);
- if (mlit != m_Doc->docLineStyles.end() && ml != mlit.value())
+ if (mlit != m_Doc->docLineStyles.constEnd() && ml != mlit.value())
mlName2 = getUniqueName(mlName2, m_Doc->docLineStyles);
m_Doc->docLineStyles.insert(mlName2, ml);
}
@@ -6991,7 +6991,7 @@
readMultiline(ml, reader);
int copyC = 1;
QHash<QString,multiLine>::ConstIterator mlit = styles->find(mlName2);
- if (mlit != styles->end() && ml != mlit.value())
+ if (mlit != styles->constEnd() && ml != mlit.value())
{
while (styles->contains(mlName2))
{
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Thu Oct 8 21:16:25 2020
@@ -1453,7 +1453,7 @@
void Scribus150Format::writeNotesFrames(ScXmlStreamWriter &docu)
{
QList<PageItem_NoteFrame*> nfList;
- for (NotesStyle* noteStyle : m_Doc->m_docNotesStylesList)
+ for (NotesStyle* noteStyle : qAsConst(m_Doc->m_docNotesStylesList))
nfList.append(m_Doc->listNotesFrames(noteStyle));
writeNotesFrames(docu, nfList);
Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.cpp Thu Oct 8 21:16:25 2020
@@ -63,7 +63,7 @@
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
- double b, h;
+ double b = 0.0, h = 0.0;
parseHeader(fName, b, h);
if (b == 0.0)
b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp (original)
+++ trunk/Scribus/scribus/scpaths.cpp Thu Oct 8 21:16:25 2020
@@ -467,7 +467,7 @@
path_data = line.mid(envVar.length()+1); //eg, Strip "XDG_DATA_DIRS="
}
const QStringList splitpath_data(path_data.split(sep, QString::SkipEmptyParts));
- for (QString dir : splitpath_data)
+ for (const QString &dir : splitpath_data)
{
QFileInfo info(dir+dirToFind);
if (info.exists())
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Thu Oct 8 21:16:25 2020
@@ -193,7 +193,7 @@
* @return true if application is in object specific undo mode, other wise returns false
*/
bool isObjectSpecificUndo();
- void restore(UndoState* state, bool isUndo);
+ void restore(UndoState* state, bool isUndo) override;
void restoreGrouping(SimpleState *state, bool isUndo);
void restoreUngrouping(SimpleState *state, bool isUndo);
void restoreAddPage(SimpleState *state, bool isUndo);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Oct 8 21:16:25 2020
@@ -1209,7 +1209,7 @@
else
itemlist = nullptr;
}
- for (NotesStyle* nStyle : m_docNotesStylesList)
+ for (NotesStyle* nStyle : qAsConst(m_docNotesStylesList))
{ //update styles names in notes styles
if (nStyle == nullptr)
continue;
@@ -2187,7 +2187,7 @@
if (delNF)
{
auto noteFrameList = listNotesFrames(noteStyle);
- for (PageItem_NoteFrame* noteFrame : noteFrameList)
+ for (PageItem_NoteFrame* noteFrame : qAsConst(noteFrameList))
delNoteFrame(noteFrame, false);
flag_updateEndNotes = noteStyle->isEndNotes();
}
@@ -16589,7 +16589,7 @@
// Reset ALL counters
QList<NumStruct*> numerationValues = numerations.values();
- for (NumStruct * numS : numerationValues)
+ for (NumStruct * numS : qAsConst(numerationValues))
for (int l = 0; l < numS->m_nums.count(); ++l)
numS->m_counters[l] = numS->m_nums[l].start - 1;
@@ -16599,7 +16599,7 @@
PageItem* item = allTextFramePos.at(i).item;
// Reset stories range counters
- for (NumStruct * numS : numerationValues)
+ for (NumStruct * numS : qAsConst(numerationValues))
for (int l = 0; l < numS->m_nums.count(); ++l)
if (numS->m_nums[l].range == NSRstory)
numS->m_counters[l] = numS->m_nums[l].start - 1;
@@ -16699,7 +16699,7 @@
Mark* ScribusDoc::getMark(const QString& l, MarkType t)
{
- for (Mark* mrk : m_docMarksList)
+ for (Mark* mrk : qAsConst(m_docMarksList))
{
if ((mrk != nullptr) && (mrk->label == l) && mrk->isType(t))
return mrk;
@@ -16965,7 +16965,7 @@
{
if (updateNotesMarks && !notesList().isEmpty())
{
- for (PageItem* item : DocItems)
+ for (PageItem* item : qAsConst(DocItems))
{
if (!item->isTextFrame() || item->isNoteFrame())
continue;
@@ -17000,7 +17000,7 @@
if (!isLoading())
{
//run for variable text (invalidate frames with variable text)
- for (Mark* mrk : m_docMarksList)
+ for (Mark* mrk : qAsConst(m_docMarksList))
{
if (mrk->isType(MARKVariableTextType))
{
@@ -17038,7 +17038,7 @@
}
//for all marks
- for (Mark* mrk : m_docMarksList)
+ for (Mark* mrk : qAsConst(m_docMarksList))
{
//set mark page number
PageItem* mItem = findFirstMarkItem(mrk);
@@ -17130,7 +17130,7 @@
void ScribusDoc::renameNotesStyle(NotesStyle* noteStyle, const QString& newName)
{
- for (Mark* mrk : m_docMarksList)
+ for (Mark* mrk : qAsConst(m_docMarksList))
mrk->label.replace("_" + noteStyle->name()+ "_", "_" + newName + "_");
noteStyle->setName(newName);
}
@@ -17147,7 +17147,7 @@
activeTransaction = m_undoManager->beginTransaction(Um::DeleteNotesStyle, Um::IDelete, Um::Delete, "", Um::IDelete);
QList<TextNote*> toDel;
//search for notes to deleting
- for (TextNote* note : m_docNotesList)
+ for (TextNote* note : qAsConst(m_docNotesList))
{
if (note->notesStyle() == noteStyle)
toDel.append(note);
@@ -17455,7 +17455,7 @@
bool ScribusDoc::updateEndNotesNums()
{
bool docWasChanged = false;
- for (NotesStyle* ns : m_docNotesStylesList)
+ for (NotesStyle* ns : qAsConst(m_docNotesStylesList))
{
if (ns->isEndNotes())
{
@@ -17508,7 +17508,7 @@
while (item != nullptr)
{
auto noteFrameList = item->asTextFrame()->notesFramesList();
- for (PageItem_NoteFrame* noteFrame : noteFrameList)
+ for (PageItem_NoteFrame* noteFrame : qAsConst(noteFrameList))
{
NotesStyle* nSet = noteFrame->notesStyle();
if (nSet->isEndNotes())
@@ -17527,7 +17527,7 @@
QList<PageItem_NoteFrame *> ScribusDoc::listNotesFrames(NotesStyle *noteStyle)
{
QList<PageItem_NoteFrame *> list;
- for (PageItem* item : DocItems)
+ for (PageItem* item : qAsConst(DocItems))
{
if (item->isNoteFrame() && item->asNoteFrame()->notesStyle() == noteStyle)
list.append(item->asNoteFrame());
@@ -17619,7 +17619,7 @@
void ScribusDoc::updateNotesFramesSettings(NotesStyle *noteStyle)
{
QList<PageItem_NoteFrame*> noteFramesList = listNotesFrames(noteStyle);
- for (PageItem_NoteFrame* nF : noteFramesList)
+ for (PageItem_NoteFrame* nF : qAsConst(noteFramesList))
{
if (nF->isWelded() && !noteStyle->isAutoWeldNotesFrames())
nF->unWeld();
@@ -17654,7 +17654,7 @@
else if (nStyle->isEndNotes())
{
auto noteFrameList = listNotesFrames(nStyle);
- for (PageItem_NoteFrame* nF : noteFrameList)
+ for (PageItem_NoteFrame* nF : qAsConst(noteFrameList))
updateEndNotesFrameContent(nF);
}
flag_updateEndNotes = false;
@@ -17666,7 +17666,7 @@
void ScribusDoc::updateEndNotesFrameContent(PageItem_NoteFrame *nF, bool invalidate)
{
QList<TextNote*> nList;
- for (PageItem* item : DocItems)
+ for (PageItem* item : qAsConst(DocItems))
{
if (item->isTextFrame() && !item->isNoteFrame())
{
@@ -17700,12 +17700,12 @@
nF->invalid = true;
nF->layout();
//layout all endnotes frames with same range
- for (NotesStyle* noteStyle : m_docNotesStylesList)
+ for (NotesStyle* noteStyle : qAsConst(m_docNotesStylesList))
{
if ((noteStyle != currNS) && (noteStyle->isEndNotes() && noteStyle->range() == currNS->range()))
{
auto noteFrameList = listNotesFrames(noteStyle);
- for (PageItem_NoteFrame* noteFrame : noteFrameList)
+ for (PageItem_NoteFrame* noteFrame : qAsConst(noteFrameList))
noteFrame->layout();
}
}
@@ -17831,7 +17831,7 @@
{
//check if chosen numbering type is available with chosen range, prefix and suffix
QString errStr;
- for (NotesStyle* NS2 : m_docNotesStylesList)
+ for (NotesStyle* NS2 : qAsConst(m_docNotesStylesList))
{
if (newName.isEmpty())
//hack for validate nset while its name will change
@@ -17856,14 +17856,14 @@
void ScribusDoc::invalidateNoteFrames(NotesStyle *nStyle)
{
auto noteFrameList = listNotesFrames(nStyle);
- for (PageItem_NoteFrame* noteFrame : noteFrameList)
+ for (PageItem_NoteFrame* noteFrame : qAsConst(noteFrameList))
noteFrame->invalid = true;
}
void ScribusDoc::invalidateMasterFrames(NotesStyle *nStyle)
{
QList<PageItem*> toInvalidate;
- for (TextNote* note : m_docNotesList)
+ for (TextNote* note : qAsConst(m_docNotesList))
{
if (note->notesStyle() == nStyle)
toInvalidate.append(note->masterMark()->getItemPtr());
Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Thu Oct 8 21:16:25 2020
@@ -202,7 +202,7 @@
void setScale(const double newScale);
double scale() const;
- virtual void changed(QRectF re, bool);
+ void changed(QRectF re, bool) override;
void updateCanvas(QRectF box = QRectF());
void updateCanvas(double x, double y, double width, double height) { updateCanvas(QRectF(x, y, width, height)); }
@@ -235,7 +235,7 @@
void scrollBy(int x, int y);
void scrollCanvasBy(double deltaX, double deltaY);
- void scrollContentsBy(int dx, int dy);
+ void scrollContentsBy(int dx, int dy) override;
void zoom(double scale = 0.0);
void zoom(int canvasX, int canvasY, double scale, bool preservePoint);
@@ -337,10 +337,10 @@
bool handleObjectImport(QMimeData* mimeData, TransactionSettings* trSettings = nullptr);
protected: // Protected methods
- virtual void enterEvent(QEvent *);
- virtual void leaveEvent(QEvent *);
- virtual void resizeEvent ( QResizeEvent * event );
- bool eventFilter(QObject *obj, QEvent *event);
+ void enterEvent(QEvent *) override;
+ void leaveEvent(QEvent *) override;
+ void resizeEvent(QResizeEvent *event) override;
+ bool eventFilter(QObject *obj, QEvent *event) override;
// those appear to be gone from QScrollArea:
virtual void contentsDragEnterEvent(QDragEnterEvent *e);
Modified: trunk/Scribus/scribus/text/boxes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/text/boxes.cpp
==============================================================================
--- trunk/Scribus/scribus/text/boxes.cpp (original)
+++ trunk/Scribus/scribus/text/boxes.cpp Thu Oct 8 21:16:25 2020
@@ -129,7 +129,8 @@
void GroupBox::update()
{
m_naturalHeight = m_naturalWidth = 0;
- for (const Box* box : boxes()) {
+ for (const Box* box : boxes())
+ {
m_firstChar = qMin(m_firstChar, box->firstChar());
m_lastChar = qMax(m_lastChar, box->lastChar());
if (m_direction == D_Horizontal)
@@ -469,7 +470,8 @@
void PathLineBox::update()
{
- for (Box* box : boxes()) {
+ for (Box* box : boxes())
+ {
m_firstChar = qMin(m_firstChar, box->firstChar());
m_lastChar = qMax(m_lastChar, box->lastChar());
}
Modified: trunk/Scribus/scribus/text/textlayout.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/text/textlayout.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textlayout.cpp (original)
+++ trunk/Scribus/scribus/text/textlayout.cpp Thu Oct 8 21:16:25 2020
@@ -49,7 +49,7 @@
uint TextLayout::lines() const
{
uint count = 0;
- for (const Box *box : m_box->boxes())
+ for (auto box : qAsConst(m_box->boxes()))
{
count += box->boxes().count();
}
Modified: trunk/Scribus/scribus/text/textshaper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/text/textshaper.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textshaper.cpp (original)
+++ trunk/Scribus/scribus/text/textshaper.cpp Thu Oct 8 21:16:25 2020
@@ -295,7 +295,7 @@
// Insert implicit spaces in justification between characters
// in scripts that do not use spaces to seperate words
- for (const TextRun& run : scriptRuns)
+ for (const TextRun& run : qAsConst(scriptRuns))
{
switch (run.script) {
// clustered scripts from https://drafts.csswg.org/css-text-3/#script-groups
@@ -331,7 +331,7 @@
}
}
- for (const TextRun& textRun : textRuns)
+ for (auto textRun : qAsConst(textRuns))
{
const CharStyle &style = m_story.charStyle(m_textMap.value(textRun.start));
Modified: trunk/Scribus/scribus/ui/actionsearchdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/actionsearchdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/actionsearchdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/actionsearchdialog.cpp Thu Oct 8 21:16:25 2020
@@ -103,14 +103,14 @@
void ActionSearchDialog::updateList()
{
ui->actionsListWidget->clear();
-
+
const auto filter = ui->filterLineEdit->text().trimmed();
if (filter.isEmpty())
return;
-
- if (!filter.contains(" "))
+
+ if (!filter.contains(" "))
{
- for (const auto& name: m_actionNames)
+ for (auto& name: qAsConst(m_actionNames))
{
if (name.contains(filter, Qt::CaseInsensitive))
{
@@ -121,10 +121,10 @@
else
{
auto words = filter.split(" ");
- for (const auto& name: m_actionNames)
+ for (auto& name: qAsConst(m_actionNames))
{
bool matches(true);
- for (const auto& word: words)
+ for (auto& word: qAsConst(words))
{
if (!name.contains(word, Qt::CaseInsensitive))
{
@@ -132,13 +132,13 @@
break;
}
}
-
+
if (!matches)
continue;
ui->actionsListWidget->addItem(name);
}
}
-
+
if (ui->actionsListWidget->count() > 0)
ui->actionsListWidget->setCurrentRow(0);
}
Modified: trunk/Scribus/scribus/ui/charselect.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/charselect.h
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.h (original)
+++ trunk/Scribus/scribus/ui/charselect.h Thu Oct 8 21:16:25 2020
@@ -38,7 +38,7 @@
CharSelect(QWidget* parent);
~CharSelect();
- void hide();
+ void hide() override;
void show();
void setDoc(ScribusDoc* doc);
void setEnabled(bool state, PageItem* item=0);
Modified: trunk/Scribus/scribus/ui/colorchart.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/colorchart.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.cpp (original)
+++ trunk/Scribus/scribus/ui/colorchart.cpp Thu Oct 8 21:16:25 2020
@@ -31,20 +31,12 @@
ColorChart::ColorChart(QWidget *parent) : QWidget(parent), m_doc(nullptr)
{
- Xp = 0;
- Yp = 0;
- doDrawMark = false;
- drawMode = 0;
setAutoFillBackground(false);
drawPalette(255);
}
ColorChart::ColorChart(QWidget *parent, ScribusDoc* doc) : QWidget(parent), m_doc(doc)
{
- Xp = 0;
- Yp = 0;
- doDrawMark = false;
- drawMode = 0;
setAutoFillBackground(false);
drawPalette(255);
}
@@ -161,12 +153,10 @@
{
QImage image(xSize, ySize, QImage::Format_ARGB32_Premultiplied);
QColor color;
- int x;
- int y;
- for (y = 0; y < ySize; ++y)
+ for (int y = 0; y < ySize; ++y)
{
unsigned int* p = reinterpret_cast<unsigned int*>(image.scanLine(y));
- for(x = 0; x < xSize; ++x)
+ for(int x = 0; x < xSize; ++x)
{
color.setHsv(360*x/xSize, 256*( ySize - 1 - y )/ySize, val);
*p = color.rgb();
Modified: trunk/Scribus/scribus/ui/colorchart.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/colorchart.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.h (original)
+++ trunk/Scribus/scribus/ui/colorchart.h Thu Oct 8 21:16:25 2020
@@ -56,10 +56,10 @@
void setMark(int h, int s);
void drawPalette(int val);
- int Xp;
- int Yp;
- bool doDrawMark;
- int drawMode;
+ int Xp {0};
+ int Yp {0};
+ bool doDrawMark {false};
+ int drawMode {0};
QPixmap pmx;
protected:
Modified: trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp (original)
+++ trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp Thu Oct 8 21:16:25 2020
@@ -17,7 +17,7 @@
setupUi(this);
QList<QAbstractButton *> buttonList = buttonBox->buttons();
- for (QAbstractButton* b : buttonList)
+ for (QAbstractButton* b : qAsConst(buttonList))
{
if (buttonBox->buttonRole(b) == QDialogButtonBox::AcceptRole)
b->setText(CommonStrings::tr_OK);
Modified: trunk/Scribus/scribus/ui/createrange.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/createrange.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/createrange.cpp (original)
+++ trunk/Scribus/scribus/ui/createrange.cpp Thu Oct 8 21:16:25 2020
@@ -18,9 +18,7 @@
#include <QTabWidget>
CreateRange::CreateRange(const QString& currText, int pageCount, QWidget* parent) : QDialog(parent),
- m_PageCount(pageCount),
- m_RangeType(0),
- m_BasicRangeType(0)
+ m_PageCount(pageCount)
{
setupUi(this);
pageCountValueLabel->setText(QString("%1").arg(pageCount));
Modified: trunk/Scribus/scribus/ui/createrange.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/createrange.h
==============================================================================
--- trunk/Scribus/scribus/ui/createrange.h (original)
+++ trunk/Scribus/scribus/ui/createrange.h Thu Oct 8 21:16:25 2020
@@ -36,9 +36,9 @@
void advSpinChange();
protected:
- int m_PageCount;
- int m_RangeType;
- int m_BasicRangeType;
+ int m_PageCount {0};
+ int m_RangeType {0};
+ int m_BasicRangeType {0};
QString m_PageString;
};
Modified: trunk/Scribus/scribus/ui/directionselect.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/directionselect.h
==============================================================================
--- trunk/Scribus/scribus/ui/directionselect.h (original)
+++ trunk/Scribus/scribus/ui/directionselect.h Thu Oct 8 21:16:25 2020
@@ -21,34 +21,34 @@
{
Q_OBJECT
-public:
- DirectionSelect(QWidget* parent);
- ~DirectionSelect() {};
+ public:
+ DirectionSelect(QWidget* parent);
+ ~DirectionSelect() {};
- void setStyle(int s);
- int getStyle();
- int selectedId();
+ void setStyle(int s);
+ int getStyle();
+ int selectedId();
- QButtonGroup* buttonGroup { nullptr };
- QToolButton* RTL { nullptr };
- QToolButton* LTR { nullptr };
+ QButtonGroup* buttonGroup { nullptr };
+ QToolButton* RTL { nullptr };
+ QToolButton* LTR { nullptr };
-public slots:
- void iconSetChange();
- void languageChange();
+ public slots:
+ void iconSetChange();
+ void languageChange();
-protected:
- QHBoxLayout* groupSelectLayout { nullptr };
-
- int m_selected { 0 };
+ protected:
+ QHBoxLayout* groupSelectLayout { nullptr };
- void changeEvent(QEvent *e) override;
+ int m_selected { 0 };
-private slots:
- void setTypeStyle(int a);
+ void changeEvent(QEvent *e) override;
-signals:
- void State(int);
+ private slots:
+ void setTypeStyle(int a);
+
+ signals:
+ void State(int);
};
#endif // DIRECTIONSELECT_H
Modified: trunk/Scribus/scribus/ui/fontcombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/fontcombo.h
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.h (original)
+++ trunk/Scribus/scribus/ui/fontcombo.h Thu Oct 8 21:16:25 2020
@@ -111,33 +111,33 @@
class FontFamilyDelegate : public QAbstractItemDelegate
{
Q_OBJECT
-public:
- explicit FontFamilyDelegate(QObject *parent);
+ public:
+ explicit FontFamilyDelegate(QObject *parent);
- // painting
- void paint(QPainter *painter,
- const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
-
- bool helpEvent(QHelpEvent * event, QAbstractItemView * view,
- const QStyleOptionViewItem & option, const QModelIndex & index) Q_DECL_OVERRIDE;
-
- QSize sizeHint(const QStyleOptionViewItem &option,
+ // painting
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
const QModelIndex &index) const Q_DECL_OVERRIDE;
- QFontDatabase::WritingSystem writingSystem;
+ bool helpEvent(QHelpEvent * event, QAbstractItemView * view,
+ const QStyleOptionViewItem & option, const QModelIndex & index) Q_DECL_OVERRIDE;
-protected:
- QFont m_font;
- static QPixmapCache pixmapCache;
+ QSize sizeHint(const QStyleOptionViewItem &option,
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+ QFontDatabase::WritingSystem writingSystem;
+
+ protected:
+ QFont m_font;
+ static QPixmapCache pixmapCache;
};
class FontComboValidator : public QValidator
{
Q_OBJECT
-public:
- FontComboValidator(QObject* parent = nullptr);
- virtual State validate(QString & input, int & pos) const;
+ public:
+ FontComboValidator(QObject* parent = nullptr);
+ virtual State validate(QString & input, int & pos) const;
};
#endif
Modified: trunk/Scribus/scribus/ui/guidemanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/guidemanager.h
==============================================================================
--- trunk/Scribus/scribus/ui/guidemanager.h (original)
+++ trunk/Scribus/scribus/ui/guidemanager.h Thu Oct 8 21:16:25 2020
@@ -41,7 +41,7 @@
void setDoc(ScribusDoc* doc);
/*! \brief Reimplement ScrPaletteBase::setVisible() */
- virtual void setVisible(bool visible);
+ void setVisible(bool visible) override;
/*! \brief Set the widgets on the page change.
It has to be called on every page to page transition */
Modified: trunk/Scribus/scribus/ui/layers.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/layers.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/layers.cpp (original)
+++ trunk/Scribus/scribus/ui/layers.cpp Thu Oct 8 21:16:25 2020
@@ -417,7 +417,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
@@ -437,7 +437,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
@@ -454,7 +454,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
@@ -475,7 +475,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
@@ -492,7 +492,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
@@ -509,7 +509,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
@@ -565,7 +565,7 @@
{
if (!m_Doc)
return;
- int level = QString(sender()->objectName()).toInt();
+ int level = sender()->objectName().toInt();
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
Modified: trunk/Scribus/scribus/ui/newdocdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/newdocdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/newdocdialog.cpp Thu Oct 8 21:16:25 2020
@@ -381,14 +381,14 @@
fileDialog->setSizeGripEnabled(false);
fileDialog->setModal(false);
QList<QPushButton *> pushButtons = fileDialog->findChildren<QPushButton *>();
- for (auto pushButton : pushButtons)
+ for (auto pushButton : qAsConst(pushButtons))
pushButton->setVisible(false);
fileDialog->setWindowFlags(Qt::Widget);
openDocLayout->addWidget(fileDialog);
FileDialogEventCatcher* keyCatcher = new FileDialogEventCatcher(this);
QList<QListView *> listViews = fileDialog->findChildren<QListView *>();
- for (auto listView : listViews)
+ for (auto listView : qAsConst(listViews))
listView->installEventFilter(keyCatcher);
connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject()));
connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString)));
Modified: trunk/Scribus/scribus/ui/outlinepalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/outlinepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.h (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.h Thu Oct 8 21:16:25 2020
@@ -76,7 +76,7 @@
void iconSetChange();
void languageChange();
void slotShowSelect(int pageNr, PageItem *pageItem);
- void setPaletteShown(bool);
+ void setPaletteShown(bool) override;
void slotRightClick(QPoint point);
void setActiveLayer(int layerID);
void setLayerVisible(int layerID);
Modified: trunk/Scribus/scribus/ui/scrpalettebase.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24055&path=/trunk/Scribus/scribus/ui/scrpalettebase.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrpalettebase.h (original)
+++ trunk/Scribus/scribus/ui/scrpalettebase.h Thu Oct 8 21:16:25 2020
@@ -49,7 +49,7 @@
public slots:
virtual void setPaletteShown(bool);
virtual void setFontSize();
- virtual int exec() { return QDialog::exec();}
+ int exec() override { return QDialog::exec();}
int exec(QWidget* newParent);
signals:
@@ -81,6 +81,6 @@
QWidget* m_tempParent { nullptr };
protected slots:
- virtual void reject();
+ void reject() override;
};
#endif
More information about the scribus-commit
mailing list