r24715 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat Oct 2 21:22:19 UTC 2021


Author: jghali
Date: Sat Oct  2 21:22:19 2021
New Revision: 24715

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

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

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24715&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sat Oct  2 21:22:19 2021
@@ -624,9 +624,9 @@
 	//m_keyrep = false;
 	//m_arrowKeyDown = false;
 	ClipB = QApplication::clipboard();
-	for (int i=0; i<PAL_MAX ; ++i)
+	for (int i = 0; i < PAL_MAX ; ++i)
 		m_palettesStatus[i] = false;
-	for (int i=0; i<GS_MAX ; ++i)
+	for (int i = 0; i < GS_MAX ; ++i)
 		m_guidesStatus[i] = false;
 #ifdef HAVE_OSG
 	QStringList supportedExts;
@@ -817,19 +817,19 @@
 void ScribusMainWindow::initScrapbook()
 {
 	QString scrapbookFileO = QDir::toNativeSeparators(m_prefsManager.preferencesLocation()+"/scrap13.scs");
-	QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO);
+	QFileInfo scrapbookFileInfoO(scrapbookFileO);
 	if (scrapbookFileInfoO.exists())
 	{
 		scrapbookPalette->readOldContents(scrapbookFileO, ScPaths::scrapbookDir(true) + "main");
-		QDir d = QDir();
+		QDir d;
 		d.rename(scrapbookFileO, QDir::toNativeSeparators(m_prefsManager.preferencesLocation()+"/scrap13.backup"));
 	}
 	QString scrapbookTemp = QDir::toNativeSeparators(ScPaths::scrapbookDir(true) + "tmp");
-	QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp);
+	QFileInfo scrapbookTempInfo(scrapbookTemp);
 	if (scrapbookTempInfo.exists())
 		scrapbookPalette->readTempContents(scrapbookTemp);
 	QString scrapbookFile = QDir::toNativeSeparators(ScPaths::scrapbookDir(true) + "main");
-	QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile);
+	QFileInfo scrapbookFileInfo(scrapbookFile);
 	if (scrapbookFileInfo.exists())
 		scrapbookPalette->readContents(scrapbookFile);
 	scrapbookPalette->setScrapbookFileName(scrapbookFile);
@@ -1710,7 +1710,7 @@
 		if (k->modifiers() & Qt::AltModifier)
 			keyMod |= Qt::ALT;
 
-		QKeySequence currKeySeq = QKeySequence(k->key() | keyMod);
+		QKeySequence currKeySeq(k->key() | keyMod);
 		if (QString(currKeySeq.toString()).isNull())
 			return false;
 		retVal = true;
@@ -5360,11 +5360,11 @@
 	//Zoom to Fit
 	if (zoomFactor == -100.0)
 	{
-		finalZoomFactor = (view->height()-70) / (doc->currentPage()->height()+30);
+		finalZoomFactor = (view->height() - 70) / (doc->currentPage()->height()+30);
 	}
 	else if (zoomFactor == -200.0)
 	{
-		finalZoomFactor = (view->width()-50) / (doc->currentPage()->width()+30);
+		finalZoomFactor = (view->width() - 50) / (doc->currentPage()->width()+30);
 	}
 	//Zoom to %
 	else
@@ -6986,9 +6986,9 @@
 	{
 		QDir di = QDir();
 		if (!doc->m_Selection->isEmpty())
-			filename = di.currentPath() + "/" + doc->documentFileName() + "_selection.eps";
+			filename = QDir::currentPath() + "/" + doc->documentFileName() + "_selection.eps";
 		else
-			filename = di.currentPath() + "/" + getFileNameByPage(doc, doc->currentPage()->pageNr(), "eps");
+			filename = QDir::currentPath() + "/" + getFileNameByPage(doc, doc->currentPage()->pageNr(), "eps");
 	}
 	filename = QDir::toNativeSeparators(filename);
 

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24715&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h	(original)
+++ trunk/Scribus/scribus/scribus.h	Sat Oct  2 21:22:19 2021
@@ -201,9 +201,9 @@
 	void setPreviewToolbar();
 	void updateFromDrop();
 	struct CopyContentsBuffer contentsBuffer;
-	bool internalCopy;
+	bool internalCopy { false };
 	QString internalCopyBuffer;
-	int  HaveDoc;
+	int  HaveDoc { 0 };
 	PrefsContext* dirs {nullptr};
 	/** \brief view is the main widget which represents your working area. The View
 	 * class should handle all events of the view widget.  It is kept empty so
@@ -220,8 +220,8 @@
 
 
 	QProgressBar* mainWindowProgressBar {nullptr};
-	ScrSpinBox* zoomSpinBox; //zoom spinbox at bottom of view
-	PageSelector* pageSelector; //Page selector at bottom of view
+	ScrSpinBox* zoomSpinBox {nullptr}; //zoom spinbox at bottom of view
+	PageSelector* pageSelector {nullptr}; //Page selector at bottom of view
 	QPushButton *zoomDefaultToolbarButton {nullptr};
 	QPushButton *zoomOutToolbarButton {nullptr};
 	QPushButton *zoomInToolbarButton {nullptr};
@@ -625,33 +625,20 @@
 	QString m_statusLabelText;
 	//QPixmap noIcon;
 
-	int m_toolbarMenuTools;
-	int m_toolbarMenuPDFTools;
-	int m_viewToolbars;
-	int m_viewPropertiesPalette;
-	int m_viewPropertiesPaletteText;
-	int m_viewOutlinePalette;
-	int m_viewNodePalette;
-	int m_viewBpal;
-	int m_viewLayerPalette;
-	int m_viewPagePalette;
-	int m_viewBopal;
-	int m_viewUndoPalette;
-
-	bool m_palettesStatus[13];
-	bool m_guidesStatus[13];
+	bool m_palettesStatus[13] { false };
+	bool m_guidesStatus[13] { false };
 
 	//bool m_keyrep;
 	/** @brief Tells if an arrow key is pressed down */
 	//bool m_arrowKeyDown;
 	/** @brief tells the undo mode */
-	bool m_objectSpecificUndo;
+	bool m_objectSpecificUndo { false };
 
 	//CB: #8212: add overrideMasterPageSizing, however default to true for compatibility with other calls.. for now
 	void addNewPages(int wo, int where, int numPages, double height, double width, int orient, const QString& siz, bool mov, QStringList* basedOn = 0, bool overrideMasterPageSizing=true);
 
-	int m_DocNr;
-	bool m_PrinterUsed;
+	int m_DocNr { 1 };
+	bool m_PrinterUsed { false };
 	struct PDe {
 					QString Pname;
 					QString Dname;
@@ -669,9 +656,9 @@
 
 	void insertMark(MarkType);
 	bool insertMarkDialog(PageItem_TextFrame* item, MarkType mT, ScItemsState* &is);
-	int m_marksCount; //remember marks count from last call
-	bool m_WasAutoSave;
-	bool m_pagePalVisible;
+	int m_marksCount { 0 }; //remember marks count from last call
+	bool m_WasAutoSave { false };
+	bool m_pagePalVisible { false };
 };
 
 #endif




More information about the scribus-commit mailing list