Replaced LDObjectList with QVector<LDObject*>

Thu, 23 Feb 2017 20:28:17 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 23 Feb 2017 20:28:17 +0200
changeset 1162
94e12806d741
parent 1161
e6a5ff67c057
child 1163
6562cd40565e

Replaced LDObjectList with QVector<LDObject*>

src/basics.h file | annotate | diff | comparison | revisions
src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/mainwindow.h file | annotate | diff | comparison | revisions
src/toolsets/extprogramtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/extprogramtoolset.h file | annotate | diff | comparison | revisions
src/toolsets/movetoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/basics.h	Thu Feb 23 20:25:47 2017 +0200
+++ b/src/basics.h	Thu Feb 23 20:28:17 2017 +0200
@@ -30,9 +30,7 @@
 #include "macros.h"
 #include "transform.h"
 
-class LDObject;
 class Matrix;
-using LDObjectList = QList<LDObject*>;
 
 template<typename T, typename R>
 using Pair = std::pair<T, R>;
--- a/src/mainwindow.cpp	Thu Feb 23 20:25:47 2017 +0200
+++ b/src/mainwindow.cpp	Thu Feb 23 20:28:17 2017 +0200
@@ -670,7 +670,7 @@
 //
 void MainWindow::deleteByColor (LDColor color)
 {
-	LDObjectList unwanted;
+	QVector<LDObject*> unwanted;
 
 	for (LDObject* object : m_currentDocument->objects())
 	{
--- a/src/mainwindow.h	Thu Feb 23 20:25:47 2017 +0200
+++ b/src/mainwindow.h	Thu Feb 23 20:28:17 2017 +0200
@@ -153,7 +153,7 @@
 	PrimitiveManager* m_primitives;
 	Grid* m_grid;
 	MathFunctions* m_mathFunctions;
-	LDObjectList m_sel;
+	QVector<LDObject*> m_sel;
 	QVector<ColorToolbarItem>	m_quickColors;
 	QList<QToolButton*>	m_colorButtons;
 	QList<QAction*> m_recentFiles;
--- a/src/toolsets/extprogramtoolset.cpp	Thu Feb 23 20:25:47 2017 +0200
+++ b/src/toolsets/extprogramtoolset.cpp	Thu Feb 23 20:28:17 2017 +0200
@@ -149,7 +149,7 @@
 
 // =============================================================================
 //
-void ExtProgramToolset::writeObjects (const LDObjectList& objects, QFile& f)
+void ExtProgramToolset::writeObjects (const QVector<LDObject*>& objects, QFile& f)
 {
 	for (LDObject* obj : objects)
 	{
@@ -158,14 +158,14 @@
 			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
 			Model model {m_documents};
 			ref->inlineContents(model, true, false);
-			writeObjects(model.objects().toList(), f);
+			writeObjects(model.objects(), f);
 		}
 		else if (obj->type() == LDObjectType::BezierCurve)
 		{
 			LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj);
 			Model model {m_documents};
 			curve->rasterize(model, grid()->bezierCurveSegments());
-			writeObjects(model.objects().toList(), f);
+			writeObjects(model.objects(), f);
 		}
 		else
 			f.write ((obj->asText() + "\r\n").toUtf8());
@@ -174,7 +174,7 @@
 
 // =============================================================================
 //
-void ExtProgramToolset::writeObjects (const LDObjectList& objects, QString filename)
+void ExtProgramToolset::writeObjects (const QVector<LDObject*>& objects, QString filename)
 {
 	// Write the input file
 	QFile f (filename);
@@ -198,14 +198,14 @@
 //
 void ExtProgramToolset::writeSelection (QString fname)
 {
-	writeObjects (selectedObjects().toList(), fname);
+	writeObjects(selectedObjects().toList().toVector(), fname);
 }
 
 // =============================================================================
 //
 void ExtProgramToolset::writeColorGroup (LDColor color, QString fname)
 {
-	LDObjectList objects;
+	QVector<LDObject*> objects;
 
 	for (LDObject* obj : currentDocument()->objects())
 	{
--- a/src/toolsets/extprogramtoolset.h	Thu Feb 23 20:25:47 2017 +0200
+++ b/src/toolsets/extprogramtoolset.h	Thu Feb 23 20:28:17 2017 +0200
@@ -64,8 +64,8 @@
 	QString errorCodeString (ExtProgramType program, class QProcess& process);
 	void insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace);
 	void writeColorGroup (LDColor color, QString fname);
-	void writeObjects (const LDObjectList& objects, QFile& f);
-	void writeObjects (const LDObjectList& objects, QString fname);
+	void writeObjects (const QVector<LDObject*>& objects, QFile& f);
+	void writeObjects (const QVector<LDObject*>& objects, QString fname);
 	void writeSelection (QString fname);
 
 	ExtProgramInfo extProgramInfo[NumExternalPrograms];
--- a/src/toolsets/movetoolset.cpp	Thu Feb 23 20:25:47 2017 +0200
+++ b/src/toolsets/movetoolset.cpp	Thu Feb 23 20:28:17 2017 +0200
@@ -31,7 +31,7 @@
 void MoveToolset::moveSelection (bool up)
 {
 	// TODO: order these!
-	LDObjectList objs = selectedObjects().toList();
+	QVector<LDObject*> objs = selectedObjects().toList().toVector();
 
 	if (objs.isEmpty())
 		return;
@@ -211,4 +211,4 @@
 		m_config->setRotationPointType((int) pointType);
 		m_config->setCustomRotationPoint (custompoint);
 	}
-}
\ No newline at end of file
+}

mercurial