removed the GuiUtilities class

Thu, 27 Dec 2018 23:41:06 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 27 Dec 2018 23:41:06 +0200
changeset 1435
b8dc3620e5db
parent 1434
4c06435bd87f
child 1436
241d3e452b32

removed the GuiUtilities class

src/guiutilities.cpp file | annotate | diff | comparison | revisions
src/guiutilities.h file | annotate | diff | comparison | revisions
src/hierarchyelement.cpp file | annotate | diff | comparison | revisions
src/hierarchyelement.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
--- a/src/guiutilities.cpp	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/guiutilities.cpp	Thu Dec 27 23:41:06 2018 +0200
@@ -32,10 +32,6 @@
 #include "dialogs/circularprimitiveeditor.h"
 #include "widgets/vertexobjecteditor.h"
 
-GuiUtilities::GuiUtilities (QObject* parent) :
-	QObject (parent),
-	HierarchyElement (parent) {}
-
 /*
  * makeColorIcon
  *
@@ -78,11 +74,11 @@
  *
  * Fills the provided combo box with the colors used in the current document.
  */
-void GuiUtilities::fillUsedColorsToComboBox (QComboBox* box)
+void fillUsedColorsToComboBox(Model* model, QComboBox* box)
 {
 	QMap<LDColor, int> frequencies;
 
-	for (LDObject* object : currentDocument()->objects())
+	for (LDObject* object : model->objects())
 	{
 		if (object->isColored() and object->color().isValid())
 		{
--- a/src/guiutilities.h	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/guiutilities.h	Thu Dec 27 23:41:06 2018 +0200
@@ -21,20 +21,7 @@
 #include "main.h"
 #include "mainwindow.h"
 
-/*
- * GuiUtilities
- *
- * Contains generic state-aware GUI functions.
- */
-class GuiUtilities : public QObject, public HierarchyElement
-{
-	Q_OBJECT
-public:
-	explicit GuiUtilities (QObject* parent);
-
-	void fillUsedColorsToComboBox (class QComboBox* box);
-};
-
+void fillUsedColorsToComboBox(Model* model, class QComboBox* box);
 QColor mainColorRepresentation();
 QIcon makeColorIcon(LDColor color, int size);
 void setColorButton(class QPushButton* button, LDColor color);
--- a/src/hierarchyelement.cpp	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/hierarchyelement.cpp	Thu Dec 27 23:41:06 2018 +0200
@@ -19,7 +19,6 @@
 #include <QMetaObject>
 #include "hierarchyelement.h"
 #include "mainwindow.h"
-#include "guiutilities.h"
 
 
 HierarchyElement::HierarchyElement (QObject* parent) :
@@ -45,12 +44,6 @@
 }
 
 
-GuiUtilities* HierarchyElement::guiUtilities() const
-{
-	return m_window->guiUtilities();
-}
-
-
 LDDocument* HierarchyElement::currentDocument() const
 {
 	return m_window->currentDocument();
--- a/src/hierarchyelement.h	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/hierarchyelement.h	Thu Dec 27 23:41:06 2018 +0200
@@ -22,7 +22,6 @@
 #include "configuration.h"
 #include "mainwindow.h"
 
-class GuiUtilities;
 class LDDocument;
 class DocumentManager;
 class PrimitiveManager;
@@ -40,7 +39,6 @@
 
 	QSet<LDObject *> selectedObjects();
 	LDDocument* currentDocument() const;
-	GuiUtilities* guiUtilities() const;
 	PrimitiveManager* primitives();
 	Grid* grid() const;
 
--- a/src/mainwindow.cpp	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/mainwindow.cpp	Thu Dec 27 23:41:06 2018 +0200
@@ -50,7 +50,6 @@
 //
 MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) :
 	QMainWindow (parent, flags),
-	m_guiUtilities (new GuiUtilities (this)),
 	m_primitives(new PrimitiveManager(this)),
 	m_grid(new Grid(this)),
 	ui (*new Ui_MainWindow),
@@ -181,7 +180,6 @@
 
 MainWindow::~MainWindow()
 {
-	delete m_guiUtilities;
 	delete m_primitives;
 	delete m_grid;
 	delete &ui;
@@ -951,11 +949,6 @@
 	return m_externalPrograms;
 }
 
-GuiUtilities* MainWindow::guiUtilities()
-{
-	return m_guiUtilities;
-}
-
 Grid* MainWindow::grid()
 {
 	return m_grid;
--- a/src/mainwindow.h	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/mainwindow.h	Thu Dec 27 23:41:06 2018 +0200
@@ -61,7 +61,6 @@
 	LDColor getUniformSelectedColor();
 	Canvas* getRendererForDocument(LDDocument* document);
 	Grid* grid();
-	class GuiUtilities* guiUtilities();
 	void loadShortcuts();
 	void openDocumentForEditing(LDDocument* document);
 	PrimitiveManager* primitives();
@@ -104,7 +103,6 @@
 private:
 	struct ToolInfo;
 
-	class GuiUtilities* m_guiUtilities;
 	QMap<LDDocument*, Canvas*> m_renderers;
 	QMap<LDDocument*, QItemSelectionModel*> m_selections;
 	PrimitiveManager* m_primitives;
--- a/src/toolsets/extprogramtoolset.cpp	Wed Dec 26 23:04:09 2018 +0200
+++ b/src/toolsets/extprogramtoolset.cpp	Thu Dec 27 23:41:06 2018 +0200
@@ -439,8 +439,8 @@
 	QDialog* dlg = new QDialog;
 	Ui::IntersectorUI ui;
 	ui.setupUi (dlg);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_incol);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_cutcol);
+	fillUsedColorsToComboBox(currentDocument(), ui.cmb_incol);
+	fillUsedColorsToComboBox(currentDocument(), ui.cmb_cutcol);
 	ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut "
 								" the cutter group with the input group. Both groups are cut by the intersection.");
 	ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection.");
@@ -527,8 +527,8 @@
 	QDialog* dlg = new QDialog;
 	Ui::CovererUI ui;
 	ui.setupUi (dlg);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col1);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col2);
+	fillUsedColorsToComboBox(currentDocument(), ui.cmb_col1);
+	fillUsedColorsToComboBox(currentDocument(), ui.cmb_col2);
 
 	if (not dlg->exec())
 		return;
@@ -578,8 +578,8 @@
 	QDialog* dlg = new QDialog;
 	ui.setupUi (dlg);
 
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col1);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col2);
+	fillUsedColorsToComboBox(currentDocument(), ui.cmb_col1);
+	fillUsedColorsToComboBox(currentDocument(), ui.cmb_col2);
 
 	LDColor in1Col, in2Col;
 

mercurial