r19891 by craig - Some variable naming clean up

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 1 18:51:34 UTC 2015


Author: craig
Date: Sun Mar  1 18:51:34 2015
New Revision: 19891

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19891
Log:
Some variable naming clean up

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusXml.cpp
    trunk/Scribus/scribus/scribusXml.h
    trunk/Scribus/scribus/vgradient.h

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19891&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 Sun Mar  1 18:51:34 2015
@@ -193,19 +193,20 @@
 	GrX = 0.0;
 	GrY = 0.0;
 
+	QList<PageItem*> TableItems;
+	QList<PageItem*> TableItemsF;
+	QList<PageItem*> TableItemsM;
+	QList<PageItem*> WeldItems;
 	QMap<int,PageItem*> TableID;
+	QMap<int,PageItem*> TableIDF;
 	QMap<int,PageItem*> TableIDM;
-	QMap<int,PageItem*> TableIDF;
-	QList<PageItem*> TableItems;
-	QList<PageItem*> TableItemsM;
-	QList<PageItem*> TableItemsF;
 	QMap<int,PageItem*> WeldID;
-	QList<PageItem*> WeldItems;
 	QStack< QList<PageItem*> > groupStack;
 	QStack< QList<PageItem*> > groupStackF;
 	QStack< QList<PageItem*> > groupStackM;
 	QStack< QList<PageItem*> > groupStackP;
 	QStack<int> groupStack2;
+
 
 	itemRemap.clear();
 	itemNext.clear();
@@ -215,16 +216,7 @@
 	itemCountM = 0;
 	itemRemapF.clear();
 	itemNextF.clear();
-
 	FrameItems.clear();
-	TableItems.clear();
-	TableID.clear();
-	TableItemsM.clear();
-	TableIDM.clear();
-	TableItemsF.clear();
-	TableIDF.clear();
-	WeldItems.clear();
-	WeldID.clear();
 
 	bool firstElement = true;
 	bool success = true;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19891&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Mar  1 18:51:34 2015
@@ -4602,14 +4602,14 @@
 	if (!HaveDoc)
 		return;
 	if (doc->appMode == modeEditClip)
-	view->requestMode(submodeEndNodeEdit);
+		view->requestMode(submodeEndNodeEdit);
 	UndoTransaction activeTransaction;
 	if (!ScMimeData::clipboardHasScribusData() && (!internalCopy))
 		return;
 	if (UndoManager::undoEnabled())
 		activeTransaction = undoManager->beginTransaction(doc->currentPage()->getUName(), 0, Um::Paste, "", Um::IPaste);
 	PageItem* selItem = doc->m_Selection->itemAt(0);
-	if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && (selItem->isTextFrame() || selItem->isTable()))
+	if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && selItem && (selItem->isTextFrame() || selItem->isTable()))
 	{
 		PageItem_TextFrame *currItem;
 		if (doc->appMode == modeEditTable)
@@ -4758,7 +4758,7 @@
 		if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment() || internalCopy)
 		{
 			view->Deselect(true);
-			uint ac = doc->Items->count();
+			uint docItemCount = doc->Items->count();
 			bool savedAlignGrid = doc->SnapGrid;
 			bool savedAlignGuides = doc->SnapGuides;
 			bool savedAlignElement = doc->SnapElement;
@@ -4770,6 +4770,7 @@
 			else
 			{
 				QString buffer  = ScMimeData::clipboardScribusElem();
+				qDebug()<<buffer;
 				slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
 			}
 			// update style lists:
@@ -4787,7 +4788,7 @@
 			doc->SnapGuides = savedAlignGuides;
 			doc->SnapElement = savedAlignElement;
 			doc->m_Selection->delaySignalsOn();
-			for (int as = ac; as < doc->Items->count(); ++as)
+			for (int as = docItemCount; as < doc->Items->count(); ++as)
 			{
 				PageItem* currItem = doc->Items->at(as);
 				if (currItem->isBookmark)
@@ -4795,20 +4796,8 @@
 				doc->m_Selection->addItem(currItem);
 			}
 			doc->m_Selection->delaySignalsOff();
-			int docSelectionCount = doc->m_Selection->count();
-			// Already done by selection delaySignalsOff()
-			/*if (docSelectionCount > 0)
-			{
-				doc->m_Selection->itemAt(0)->connectToGUI();
-				doc->m_Selection->itemAt(0)->emitAllToGUI();
-			}*/
-			if (docSelectionCount > 1)
-			{
+			if (doc->m_Selection->count() > 1)
 				doc->m_Selection->setGroupRect();
-			}
-			// Done via Selection selectionChanged() signal
-			/*if (docSelectionCount > 0)
-				HaveNewSel();*/
 		}
 		view->DrawNew();
 	}

Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19891&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp (original)
+++ trunk/Scribus/scribus/scribusXml.cpp Sun Mar  1 18:51:34 2015
@@ -109,43 +109,43 @@
 	return (succeed && !sReader.hasError());
 }
 
-bool ScriXmlDoc::ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub)
+bool ScriXmlDoc::ReadElem(QString fileNameOrData, SCFonts &avail, ScribusDoc *doc, double xPos, double yPos, bool isDataFromFile, bool loc, QMap<QString,QString> &FontSub)
 {
 	// Do not suppose the existence of layer with id = 0
 	// return ReadElemToLayer(fileName, avail, doc, Xp, Yp, Fi, loc, FontSub, view, 0);
-	return ReadElemToLayer(fileName, avail, doc, Xp, Yp, Fi, loc, FontSub, doc->activeLayer());
-}
-
-bool ScriXmlDoc::ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, int toLayer)
-{
-	QString ff;
+	return ReadElemToLayer(fileNameOrData, avail, doc, xPos, yPos, isDataFromFile, loc, FontSub, doc->activeLayer());
+}
+
+bool ScriXmlDoc::ReadElemToLayer(QString fileNameOrData, SCFonts &avail, ScribusDoc *doc, double xPos, double yPos, bool isDataFromFile, bool loc, QMap<QString,QString> &FontSub, int toLayer)
+{
+	QString elementData;
 	QString fileDir = QDir::homePath();
-	if (Fi)
+	if (isDataFromFile)
 	{
 		QByteArray f;
-		if (!loadRawText(fileName, f))
+		if (!loadRawText(fileNameOrData, f))
 			return false;
 		if (f.left(16) == "<SCRIBUSELEMUTF8")
-			ff = QString::fromUtf8(f.data());
+			elementData = QString::fromUtf8(f.data());
 		else
-			ff = f;
-		fileDir = QFileInfo(fileName).absolutePath();
+			elementData = f;
+		fileDir = QFileInfo(fileNameOrData).absolutePath();
 	}
 	else
 	{
-		ff = fileName;
-	}
-	// In case ff contains some old broken scribus xml
-	ff.replace(QChar(5), SpecialChars::PARSEP);
-	ff.replace(QChar(4), SpecialChars::TAB);
-	ff.replace(QChar(0), QChar(32));
-	ff.replace("&#x5;", SpecialChars::PARSEP);
-	ff.replace("&#x4;", SpecialChars::TAB);
+		elementData = fileNameOrData;
+	}
+	// In case elementData contains some old broken scribus xml
+	elementData.replace(QChar(5), SpecialChars::PARSEP);
+	elementData.replace(QChar(4), SpecialChars::TAB);
+	elementData.replace(QChar(0), QChar(32));
+	elementData.replace("&#x5;", SpecialChars::PARSEP);
+	elementData.replace("&#x4;", SpecialChars::TAB);
 	const FileFormat *fmt = LoadSavePlugin::getFormatById(FORMATID_SLA150IMPORT);
 	if (fmt)
 	{
 		fmt->setupTargets(doc, 0, doc->scMW(), 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-		fmt->loadElements(ff, fileDir, toLayer, Xp, Yp, loc);
+		fmt->loadElements(elementData, fileDir, toLayer, xPos, yPos, loc);
 		return true;
 	}
 	return false;

Modified: trunk/Scribus/scribus/scribusXml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19891&path=/trunk/Scribus/scribus/scribusXml.h
==============================================================================
--- trunk/Scribus/scribus/scribusXml.h (original)
+++ trunk/Scribus/scribus/scribusXml.h Sun Mar  1 18:51:34 2015
@@ -48,8 +48,8 @@
 	\retval bool true = Scribus format file, false : not Scribus
 	*/
 	bool ReadElemHeader(QString file, bool isFile, double *x, double *y, double *w, double *h);
-	bool ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub);
-	bool ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, int toLayer);
+	bool ReadElem(QString fileNameOrData, SCFonts &avail, ScribusDoc *doc, double xPos, double yPos, bool isDataFromFile, bool loc, QMap<QString,QString> &FontSub);
+	bool ReadElemToLayer(QString fileNameOrData, SCFonts &avail, ScribusDoc *doc, double xPos, double yPos, bool isDataFromFile, bool loc, QMap<QString,QString> &FontSub, int toLayer);
 	
 	static QString WriteElem(ScribusDoc *doc, Selection *selection);
 	static ScElemMimeData* WriteToMimeData(ScribusDoc *doc, Selection *selection);

Modified: trunk/Scribus/scribus/vgradient.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19891&path=/trunk/Scribus/scribus/vgradient.h
==============================================================================
--- trunk/Scribus/scribus/vgradient.h (original)
+++ trunk/Scribus/scribus/vgradient.h Sun Mar  1 18:51:34 2015
@@ -136,13 +136,13 @@
 	void transform( const QTransform& m );
 
 protected:
-	QList<VColorStop*>        m_colorStops;
+	QList<VColorStop*> m_colorStops;
 
 	int  compareItems(const VColorStop* item1, const VColorStop* item2 ) const;
 	void inSort( VColorStop* d );
 
 private:
-	VGradientType         m_type;
+	VGradientType m_type;
 	VGradientRepeatMethod m_repeatMethod	: 3;
 
 	// coordinates:




More information about the scribus-commit mailing list