r21933 by craig - Some code cleaning, mostly courtesy of clazy

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 20 05:59:40 UTC 2017


Author: craig
Date: Thu Apr 20 05:59:40 2017
New Revision: 21933

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21933
Log:
Some code cleaning, mostly courtesy of clazy

Modified:
    trunk/Scribus/scribus/canvasgesture.h
    trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pageitem_textframe.h
    trunk/Scribus/scribus/plugins/picbrowser/iview.h
    trunk/Scribus/scribus/plugins/picbrowser/multicombobox.h
    trunk/Scribus/scribus/plugins/picbrowser/pictview.h
    trunk/Scribus/scribus/plugins/scriptplugin/pconsole.h
    trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.h
    trunk/Scribus/scribus/scmimedata.h
    trunk/Scribus/scribus/text/boxes.h
    trunk/Scribus/scribus/third_party/zip/unzip.cpp
    trunk/Scribus/scribus/ui/colorlistbox.cpp
    trunk/Scribus/scribus/ui/colorlistmodel.cpp
    trunk/Scribus/scribus/ui/colorsandfills.cpp
    trunk/Scribus/scribus/ui/fontcombo.h
    trunk/Scribus/scribus/ui/gradienteditor.ui
    trunk/Scribus/scribus/ui/linecombo.h
    trunk/Scribus/scribus/ui/linkbutton.h
    trunk/Scribus/scribus/ui/sccombobox.h

Modified: trunk/Scribus/scribus/canvasgesture.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/canvasgesture.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture.h	(original)
+++ trunk/Scribus/scribus/canvasgesture.h	Thu Apr 20 05:59:40 2017
@@ -46,6 +46,7 @@
  */
 class SCRIBUS_API CanvasGesture : public CanvasMode
 {
+	Q_OBJECT
 protected:
 	explicit CanvasGesture (CanvasMode* parent) : CanvasMode(parent->view()), m_delegate(parent) {};
 	explicit CanvasGesture (ScribusView* view) : CanvasMode(view), m_delegate(NULL) {};

Modified: trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp	(original)
+++ trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp	Thu Apr 20 05:59:40 2017
@@ -48,7 +48,6 @@
 	if ((!d.exists()) || (d.count() == 0))
 		return profileInfos;
 
-	QString nam = "";
 	cmsHPROFILE hIn = NULL;
 
 	for (uint dc = 0; dc < d.count(); ++dc)

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	Thu Apr 20 05:59:40 2017
@@ -284,7 +284,7 @@
 					if (image->height()-yt < rows)
 						tileH = image->height()-yt;
 					tileW = columns;
-					register uint32 yi;
+					uint32 yi;
 					int chans = image->channels();
 					for (xt = 0; xt < (uint) image->width(); xt += columns)
 					{

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h	(original)
+++ trunk/Scribus/scribus/pageitem.h	Thu Apr 20 05:59:40 2017
@@ -132,7 +132,7 @@
 	Q_PROPERTY(double textToFrameDistBottom READ textToFrameDistBottom WRITE setTextToFrameDistBottom DESIGNABLE false)
 	Q_PROPERTY(double ColGap READ columnGap WRITE setColumnGap DESIGNABLE false)
 	Q_PROPERTY(int Cols READ columns WRITE setColumns DESIGNABLE false)
-	Q_ENUMS(FirstLineOffsetPolicy)
+	Q_ENUM(FirstLineOffsetPolicy)
 	Q_PROPERTY(FirstLineOffsetPolicy firstLineOffset READ firstLineOffset WRITE setFirstLineOffset DESIGNABLE false)
 	// FIXME: QMetaProperty can't translate these to/from enumerator names, probably because the
 	// properties aren't moc'd in the Qt sources. They work fine in their

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Thu Apr 20 05:59:40 2017
@@ -5534,8 +5534,8 @@
 		item = firstInChain();
 	while (item != NULL)
 	{
-		QMap<PageItem_NoteFrame*, QList<TextNote*> >::iterator it = m_notesFramesMap.begin();
-		QMap<PageItem_NoteFrame*, QList<TextNote*> >::iterator end = m_notesFramesMap.end();
+		NotesInFrameMap::iterator it = m_notesFramesMap.begin();
+		NotesInFrameMap::iterator end = m_notesFramesMap.end();
 		while (it != end)
 		{
 			if (it.key()->notesStyle() == NS)

Modified: trunk/Scribus/scribus/pageitem_textframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/pageitem_textframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.h	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.h	Thu Apr 20 05:59:40 2017
@@ -22,7 +22,7 @@
 #ifndef PAGEITEMTEXTFRAME_H
 #define PAGEITEMTEXTFRAME_H
 
-#include <QMap>
+#include <QHash>
 #include <QRectF>
 #include <QString>
 #include <QKeyEvent>
@@ -36,7 +36,7 @@
 class ScPainter;
 class ScribusDoc;
 
-typedef QMap<PageItem_NoteFrame*, QList<TextNote *> > NotesInFrameMap;
+typedef QHash<PageItem_NoteFrame*, QList<TextNote *> > NotesInFrameMap;
 
 
 //cezaryece: I remove static statement and made it public as this function is used also by PageItem_NoteFrame
@@ -49,7 +49,7 @@
 public:
 	PageItem_TextFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline);
 	PageItem_TextFrame(const PageItem & p);
-	~PageItem_TextFrame() {};
+	~PageItem_TextFrame() {}
 
 	virtual PageItem_TextFrame * asTextFrame() { return this; }
 	virtual bool isTextFrame() const { return true; }

Modified: trunk/Scribus/scribus/plugins/picbrowser/iview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/plugins/picbrowser/iview.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/iview.h	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/iview.h	Thu Apr 20 05:59:40 2017
@@ -21,6 +21,7 @@
 
 class IView: public QGraphicsView
 {
+	Q_OBJECT
 	public:
 		IView ( QWidget* parent );
 		~IView();

Modified: trunk/Scribus/scribus/plugins/picbrowser/multicombobox.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/plugins/picbrowser/multicombobox.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/multicombobox.h	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/multicombobox.h	Thu Apr 20 05:59:40 2017
@@ -16,6 +16,7 @@
 
 class multiComboboxModel : public QStandardItemModel
 {
+	Q_OBJECT
 	public:
 		multiComboboxModel ( QObject* parent = 0 );
 		Qt::ItemFlags flags ( const QModelIndex& index ) const;
@@ -24,6 +25,7 @@
 
 class multiView : public QListView
 {
+	Q_OBJECT
 	public:
 		multiView ( QWidget* parent = 0 );
 		multiView ( multiCombobox* parent );
@@ -36,8 +38,7 @@
 
 class multiCombobox : public QComboBox
 {
-		Q_OBJECT
-
+	Q_OBJECT
 	public:
 		multiCombobox ( QWidget *parent = 0 );
 

Modified: trunk/Scribus/scribus/plugins/picbrowser/pictview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/plugins/picbrowser/pictview.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/pictview.h	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/pictview.h	Thu Apr 20 05:59:40 2017
@@ -19,6 +19,7 @@
 
 class PictView : public QListView
 {
+	Q_OBJECT
 	public:
 		PictView(QWidget * parent );
 		

Modified: trunk/Scribus/scribus/plugins/scriptplugin/pconsole.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/plugins/scriptplugin/pconsole.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/pconsole.h	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/pconsole.h	Thu Apr 20 05:59:40 2017
@@ -116,6 +116,7 @@
 */
 class SyntaxHighlighter : public QSyntaxHighlighter
 {
+	Q_OBJECT
 	public:
 		SyntaxHighlighter(QTextEdit *textEdit);
 

Modified: trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.h
==============================================================================
--- trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.h	(original)
+++ trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.h	Thu Apr 20 05:59:40 2017
@@ -15,6 +15,7 @@
  */
 class SWSyntaxHighlighter : public QSyntaxHighlighter
 {
+	Q_OBJECT
 	public:
 		SWSyntaxHighlighter(QTextEdit *textEdit);
 

Modified: trunk/Scribus/scribus/scmimedata.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/scmimedata.h
==============================================================================
--- trunk/Scribus/scribus/scmimedata.h	(original)
+++ trunk/Scribus/scribus/scmimedata.h	Thu Apr 20 05:59:40 2017
@@ -28,6 +28,7 @@
 
 class SCRIBUS_API ScMimeData
 {
+	Q_OBJECT
 public:
 	static const QString ScribusElemMimeType;
 	static const QString ScribusFragmentMimeType;
@@ -42,15 +43,16 @@
 	static QString clipboardKnownDataExt(void);
 	static QByteArray clipboardKnownDataData(void);
 
-	static QString    clipboardScribusElem(void);
+	static QString clipboardScribusElem(void);
 	static QByteArray clipboardScribusFragment(void);
 	static QByteArray clipboardScribusText(void);
 };
 
 class SCRIBUS_API ScFragmentMimeData : public QMimeData
 {
+	Q_OBJECT
 public:
-	ScFragmentMimeData(void) : QMimeData() {};
+	ScFragmentMimeData(void) : QMimeData() {}
 
 	void setScribusFragment(const QByteArray& fragment) { setData(ScMimeData::ScribusFragmentMimeType, fragment); }
 	QByteArray scribusFragment(void) { return data(ScMimeData::ScribusFragmentMimeType); }
@@ -58,8 +60,9 @@
 
 class SCRIBUS_API ScElemMimeData : public QMimeData
 {
+	Q_OBJECT
 protected:
-	QString     m_scribusElemData;
+	QString m_scribusElemData;
 	QStringList m_formats;
 
 	virtual QVariant retrieveData ( const QString & mimeType, QVariant::Type type ) const;
@@ -76,8 +79,9 @@
 
 class SCRIBUS_API ScTextMimeData : public QMimeData
 {
+	Q_OBJECT
 public:
-	ScTextMimeData(void) : QMimeData() {};
+	ScTextMimeData(void) : QMimeData() {}
 
 	void setScribusText(const QByteArray& scText) { setData(ScMimeData::ScribusTextMimeType, scText); }
 	QByteArray scribusText(void) { return data(ScMimeData::ScribusFragmentMimeType); }

Modified: trunk/Scribus/scribus/text/boxes.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/text/boxes.h
==============================================================================
--- trunk/Scribus/scribus/text/boxes.h	(original)
+++ trunk/Scribus/scribus/text/boxes.h	Thu Apr 20 05:59:40 2017
@@ -162,6 +162,7 @@
 
 class GroupBox: public Box
 {
+	Q_OBJECT
 public:
 	GroupBox(BoxDirection direction)
 	{
@@ -201,6 +202,7 @@
 
 class LineBox: public GroupBox
 {
+	Q_OBJECT
 public:
 	LineBox()
 		: GroupBox(D_Horizontal)
@@ -232,6 +234,7 @@
 
 class PathLineBox: public LineBox
 {
+	Q_OBJECT
 public:
 	PathLineBox()
 	{
@@ -245,6 +248,7 @@
 
 class GlyphBox: public Box
 {
+	Q_OBJECT
 public:
 	GlyphBox(const GlyphCluster& run)
 		: m_glyphRun(run)
@@ -276,6 +280,7 @@
 
 class ObjectBox: public GlyphBox
 {
+	Q_OBJECT
 public:
 	ObjectBox(const GlyphCluster& run, ITextContext* ctx)
 		: GlyphBox(run)

Modified: trunk/Scribus/scribus/third_party/zip/unzip.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/third_party/zip/unzip.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/zip/unzip.cpp	(original)
+++ trunk/Scribus/scribus/third_party/zip/unzip.cpp	Thu Apr 20 05:59:40 2017
@@ -694,7 +694,7 @@
         if (options & UnZip::SkipPaths)
             return UnZip::Ok;
 
-        directory = QString("%1/%2").arg(dir.absolutePath()).arg(QDir::cleanPath(name));
+		directory = QString("%1/%2").arg(dir.absolutePath(), QDir::cleanPath(name));
         if (!createDirectory(directory)) {
             qDebug() << QString("Unable to create directory: %1").arg(directory);
             return UnZip::CreateDirFailed;
@@ -714,7 +714,7 @@
         if (options & UnZip::SkipPaths) {
             directory = dir.absolutePath();
         } else {
-            directory = QString("%1/%2").arg(dir.absolutePath()).arg(QDir::cleanPath(dirname));
+			directory = QString("%1/%2").arg(dir.absolutePath(), QDir::cleanPath(dirname));
             if (!createDirectory(directory)) {
                 qDebug() << QString("Unable to create directory: %1").arg(directory);
                 return UnZip::CreateDirFailed;
@@ -733,7 +733,7 @@
         }
     }
 
-    name = QString("%1/%2").arg(directory).arg(name);
+	name = QString("%1/%2").arg(directory, name);
 
     QFile outFile(name);
     if (!outFile.open(QIODevice::WriteOnly)) {

Modified: trunk/Scribus/scribus/ui/colorlistbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/colorlistbox.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorlistbox.cpp	(original)
+++ trunk/Scribus/scribus/ui/colorlistbox.cpp	Thu Apr 20 05:59:40 2017
@@ -240,7 +240,6 @@
 
 ColorListBox::~ColorListBox()
 {
-	int count = this->count();
 	if (itemDelegate())
 		delete itemDelegate();
 	clear();
@@ -397,7 +396,7 @@
 void ColorListBox::setCurrentColor(QString colorName)
 {
 	if (colorName == CommonStrings::None)
-		colorName == CommonStrings::tr_NoneColor;
+		colorName = CommonStrings::tr_NoneColor;
 
 	QModelIndex firstIndex = model()->index(0, 0, QModelIndex());
 	QModelIndexList indexes = this->model()->match(firstIndex, Qt::DisplayRole, colorName, -1, Qt::MatchExactly);
@@ -408,7 +407,6 @@
 void ColorListBox::setColors(ColorList& list, bool insertNone)
 {
 	ColorList::Iterator it;
-	ScribusDoc* doc = list.document();
 
 	ColorListModel* colorModel = dynamic_cast<ColorListModel*>(this->model());
 	if (!colorModel)

Modified: trunk/Scribus/scribus/ui/colorlistmodel.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/colorlistmodel.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorlistmodel.cpp	(original)
+++ trunk/Scribus/scribus/ui/colorlistmodel.cpp	Thu Apr 20 05:59:40 2017
@@ -99,7 +99,6 @@
 	if (pColorValue)
 		return QModelIndex();
 
-	int colCount = columnCount();
 	if (row < 0 || (row >= rowCount()) || (column != 0))
 		return QModelIndex();
 
@@ -276,4 +275,4 @@
 		sortString2 = sortString2.arg("D").arg(v2.m_name);
 
 	return (sortString1 < sortString2);
-}
+}

Modified: trunk/Scribus/scribus/ui/colorsandfills.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/colorsandfills.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorsandfills.cpp	(original)
+++ trunk/Scribus/scribus/ui/colorsandfills.cpp	Thu Apr 20 05:59:40 2017
@@ -25,14 +25,14 @@
 ***************************************************************************/
 
 #include <QCheckBox>
+#include <QCursor>
+#include <QDir>
+#include <QDomDocument>
+#include <QEventLoop>
+#include <QFileDialog>
+#include <QImageReader>
+#include <QMenu>
 #include <QMessageBox>
-#include <QDomDocument>
-#include <QMenu>
-#include <QCursor>
-#include <QEventLoop>
-#include <QImageReader>
-#include <QDir>
-#include <QFileDialog>
 
 #include "cmykfw.h"
 #include "colorlistbox.h"

Modified: trunk/Scribus/scribus/ui/fontcombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/fontcombo.h
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.h	(original)
+++ trunk/Scribus/scribus/ui/fontcombo.h	Thu Apr 20 05:59:40 2017
@@ -47,6 +47,7 @@
 
 class SCRIBUS_API FontCombo : public QComboBox
 {
+	Q_OBJECT
 public:
 	FontCombo(QWidget* pa);
 	~FontCombo() {}

Modified: trunk/Scribus/scribus/ui/gradienteditor.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/gradienteditor.ui
==============================================================================
--- trunk/Scribus/scribus/ui/gradienteditor.ui	(original)
+++ trunk/Scribus/scribus/ui/gradienteditor.ui	Thu Apr 20 05:59:40 2017
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>210</width>
-    <height>172</height>
+    <height>178</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -20,7 +20,16 @@
    <enum>QFrame::Plain</enum>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <property name="margin">
+   <property name="leftMargin">
+    <number>4</number>
+   </property>
+   <property name="topMargin">
+    <number>4</number>
+   </property>
+   <property name="rightMargin">
+    <number>4</number>
+   </property>
+   <property name="bottomMargin">
     <number>4</number>
    </property>
    <property name="spacing">

Modified: trunk/Scribus/scribus/ui/linecombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/linecombo.h
==============================================================================
--- trunk/Scribus/scribus/ui/linecombo.h	(original)
+++ trunk/Scribus/scribus/ui/linecombo.h	Thu Apr 20 05:59:40 2017
@@ -36,9 +36,10 @@
 
 class SCRIBUS_API LineCombo : public QComboBox
 {
+	Q_OBJECT
 public: 
 	LineCombo(QWidget* pa);
-	~LineCombo() {};
+	~LineCombo() {}
 	void updateList();
 	QPixmap createIcon(int type);
 };

Modified: trunk/Scribus/scribus/ui/linkbutton.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/linkbutton.h
==============================================================================
--- trunk/Scribus/scribus/ui/linkbutton.h	(original)
+++ trunk/Scribus/scribus/ui/linkbutton.h	Thu Apr 20 05:59:40 2017
@@ -33,6 +33,7 @@
 
 class SCRIBUS_API LinkButton : public QToolButton
 {
+	Q_OBJECT
 public: 
 	/*!
 	\author Franz Schmid

Modified: trunk/Scribus/scribus/ui/sccombobox.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21933&path=/trunk/Scribus/scribus/ui/sccombobox.h
==============================================================================
--- trunk/Scribus/scribus/ui/sccombobox.h	(original)
+++ trunk/Scribus/scribus/ui/sccombobox.h	Thu Apr 20 05:59:40 2017
@@ -25,7 +25,7 @@
 */
 class ScComboBox : public QComboBox
 {
-
+	Q_OBJECT
 public: 
 	ScComboBox( QWidget* parent=0);
 };




More information about the scribus-commit mailing list