Delete object editor

Mon, 04 Jul 2022 00:23:50 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Mon, 04 Jul 2022 00:23:50 +0300
changeset 330
edb6c09cdd3c
parent 329
6d75fa09cc0c
child 331
638a7458ef5e

Delete object editor

CMakeLists.txt file | annotate | diff | comparison | revisions
src/layers/edittools.cpp file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/ui/objecteditor.cpp file | annotate | diff | comparison | revisions
src/ui/objecteditor.h file | annotate | diff | comparison | revisions
src/ui/objecteditor.ui file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Mon Jul 04 00:19:18 2022 +0300
+++ b/CMakeLists.txt	Mon Jul 04 00:23:50 2022 +0300
@@ -90,7 +90,6 @@
 	src/settingseditor/settingseditor.cpp
 	src/types/boundingbox.cpp
 	src/ui/circletooloptionswidget.cpp
-	src/ui/objecteditor.cpp
 	src/widgets/colorindexinput.cpp
 	src/widgets/colorselectdialog.cpp
 )
@@ -126,7 +125,6 @@
 	src/settingseditor/settingseditor.h
 	src/types/boundingbox.h
 	src/ui/circletooloptionswidget.h
-	src/ui/objecteditor.h
 	src/widgets/colorindexinput.h
 	src/widgets/colorselectdialog.h
 	thirdparty/earcut.h
@@ -137,7 +135,6 @@
 	src/settingseditor/librarieseditor.ui
 	src/settingseditor/settingseditor.ui
 	src/ui/circletool.ui
-	src/ui/objecteditor.ui
 	src/widgets/colorselectdialog.ui
 	src/widgets/colorindexinput.ui
 )
--- a/src/layers/edittools.cpp	Mon Jul 04 00:19:18 2022 +0300
+++ b/src/layers/edittools.cpp	Mon Jul 04 00:23:50 2022 +0300
@@ -19,7 +19,6 @@
 #include <QMouseEvent>
 #include <QPainter>
 #include "src/model.h"
-#include "src/ui/objecteditor.h"
 #include "src/gl/partrenderer.h"
 #include "src/circularprimitive.h"
 #include "src/layers/edittools.h"
--- a/src/main.cpp	Mon Jul 04 00:19:18 2022 +0300
+++ b/src/main.cpp	Mon Jul 04 00:23:50 2022 +0300
@@ -18,7 +18,6 @@
 #include "src/settings.h"
 #include "src/settingseditor/settingseditor.h"
 #include "src/ui/circletooloptionswidget.h"
-#include "src/ui/objecteditor.h"
 #include "src/version.h"
 #include "src/widgets/colorselectdialog.h"
 #include "src/parser.h"
@@ -283,7 +282,6 @@
 struct ToolWidgets
 {
 	CircleToolOptionsWidget* circleToolOptions;
-	ObjectEditor* objectEditor;
 };
 
 void initializeTools(Ui_MainWindow* ui, ToolWidgets* toolWidgets, QWidget* parent)
@@ -298,7 +296,7 @@
 			.name = QObject::tr("Select"),
 			.tooltip = QObject::tr("Select elements from the model."),
 			.icon = {":/icons/navigate-outline.png"},
-			.widget = toolWidgets->objectEditor,
+			.widget = nullptr,
 		},
 		{
 			.name = QObject::tr("Draw"),
@@ -440,7 +438,6 @@
 	ui.setupUi(&mainWindow);
 	ToolWidgets toolWidgets{
 		.circleToolOptions = new CircleToolOptionsWidget{&mainWindow},
-		.objectEditor = new ObjectEditor{&mainWindow},
 	};
 	const auto updateTitle = [&ui, &mainWindow]{
 		mainWindow.setWindowTitle(title(&ui));
--- a/src/ui/objecteditor.cpp	Mon Jul 04 00:19:18 2022 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-#include <QCheckBox>
-#include <QLineEdit>
-#include <QFormLayout>
-#include "src/ui/objecteditor.h"
-#include "src/widgets/colorindexinput.h"
-#include "widgets/colorbutton.h"
-#include "widgets/vec3editor.h"
-
-using PropertyPointer = std::variant<
-	glm::vec3*,
-	glm::mat4*,
-	QString*,
-	ldraw::Color*,
-	CircularFraction*>;
-
-enum class PropertyKey
-{
-	Point1,
-	Point2,
-	Point3,
-	Point4,
-	Control1,
-	Control2,
-	Color,
-	Transformation,
-	Name,
-	Text,
-	Code,
-	Fraction,
-};
-
-constexpr std::size_t NUM_PROPERTIES = static_cast<int>(PropertyKey::Fraction) + 1;
-
-static QString propertyName(PropertyKey key)
-{
-	switch (key) {
-	case PropertyKey::Point1:
-		return ObjectEditor::tr("Vertex 1");
-	case PropertyKey::Point2:
-		return ObjectEditor::tr("Vertex 2");
-	case PropertyKey::Point3:
-		return ObjectEditor::tr("Vertex 3");
-	case PropertyKey::Point4:
-		return ObjectEditor::tr("Vertex 4");
-	case PropertyKey::Control1:
-		return ObjectEditor::tr("Control point 1");
-	case PropertyKey::Control2:
-		return ObjectEditor::tr("Control point 2");
-	case PropertyKey::Color:
-		return ObjectEditor::tr("Colour");
-	case PropertyKey::Transformation:
-		return ObjectEditor::tr("Transformation");
-	case PropertyKey::Name:
-		return ObjectEditor::tr("Name");
-	case PropertyKey::Text:
-		return ObjectEditor::tr("Text");
-	case PropertyKey::Code:
-		return ObjectEditor::tr("Code");
-	case PropertyKey::Fraction:
-		return ObjectEditor::tr("Fraction");
-	}
-	return "";
-}
-
-static std::map<PropertyKey, PropertyPointer> collectProperties(ModelElement& element)
-{
-	std::map<PropertyKey, PropertyPointer> result;
-	std::visit<void>(overloaded{
-		[&](Colored<LineSegment>& edge) {
-			result[PropertyKey::Point1] = &edge.p1;
-			result[PropertyKey::Point2] = &edge.p2;
-			result[PropertyKey::Color] = &edge.color;
-		},
-		[&](Colored<Triangle>& tri) {
-			result[PropertyKey::Point1] = &tri.p1;
-			result[PropertyKey::Point2] = &tri.p2;
-			result[PropertyKey::Point3] = &tri.p3;
-			result[PropertyKey::Color] = &tri.color;
-		},
-		[&](Colored<Quadrilateral>& quad) {
-			result[PropertyKey::Point1] = &quad.p1;
-			result[PropertyKey::Point2] = &quad.p2;
-			result[PropertyKey::Point3] = &quad.p3;
-			result[PropertyKey::Point4] = &quad.p4;
-			result[PropertyKey::Color] = &quad.color;
-		},
-		[&](Colored<ConditionalEdge>& cedge) {
-			result[PropertyKey::Point1] = &cedge.p1;
-			result[PropertyKey::Point2] = &cedge.p2;
-			result[PropertyKey::Control1] = &cedge.c1;
-			result[PropertyKey::Control2] = &cedge.c2;
-			result[PropertyKey::Color] = &cedge.color;
-		},
-		[&](Colored<SubfileReference>& ref) {
-			result[PropertyKey::Transformation] = &ref.transformation;
-			result[PropertyKey::Name] = &ref.name;
-			result[PropertyKey::Color] = &ref.color;
-		},
-		[&](Colored<CircularPrimitive>& circ) {
-			result[PropertyKey::Transformation] = &circ.transformation;
-			result[PropertyKey::Fraction] = &circ.fraction;
-			result[PropertyKey::Color] = &circ.color;
-		},
-		[&](Empty) {},
-		[&](Comment& comment) {
-			result[PropertyKey::Text] = &comment.text;
-		},
-		[&](ParseError& parseError) {
-			result[PropertyKey::Code] = &parseError.code;
-		},
-	}, element);
-	return result;
-}
-
-
-ObjectEditor::ObjectEditor(QWidget* parent) :
-	QWidget{parent}
-{
-	this->ui.setupUi(this);
-}
--- a/src/ui/objecteditor.h	Mon Jul 04 00:19:18 2022 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#pragma once
-#include <QWidget>
-#include <ui_objecteditor.h>
-#include "src/basics.h"
-#include "src/model.h"
-
-class ObjectEditor final : public QWidget
-{
-	Q_OBJECT
-	Ui_ObjectEditor ui;
-	std::vector<QWidget*> editorwidgets;
-public:
-	ObjectEditor(QWidget* parent);
-};
--- a/src/ui/objecteditor.ui	Mon Jul 04 00:19:18 2022 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ObjectEditor</class>
- <widget class="QWidget" name="ObjectEditor">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>941</width>
-    <height>400</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <widget class="QScrollArea" name="scrollArea">
-     <property name="widgetResizable">
-      <bool>true</bool>
-     </property>
-     <widget class="QWidget" name="scrollAreaWidgetContents">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>907</width>
-        <height>481</height>
-       </rect>
-      </property>
-      <layout class="QHBoxLayout" name="horizontalLayout_2">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_3">
-         <item>
-          <layout class="QVBoxLayout" name="verticalLayout">
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout">
-             <item>
-              <widget class="QLabel" name="typeIconLabel">
-               <property name="text">
-                <string>&lt;icon&gt;</string>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <widget class="QLabel" name="typeNameLabel">
-               <property name="styleSheet">
-                <string notr="true">font-weight: bold</string>
-               </property>
-               <property name="text">
-                <string>Object</string>
-               </property>
-              </widget>
-             </item>
-            </layout>
-           </item>
-           <item>
-            <widget class="QGroupBox" name="properties">
-             <property name="title">
-              <string>Properties</string>
-             </property>
-             <layout class="QFormLayout" name="formLayout">
-              <item row="1" column="0">
-               <widget class="QLabel" name="point1Label">
-                <property name="text">
-                 <string>Point 1</string>
-                </property>
-                <property name="buddy">
-                 <cstring>point1Label</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="1" column="1">
-               <widget class="VectorInput" name="point1" native="true"/>
-              </item>
-              <item row="2" column="0">
-               <widget class="QLabel" name="point2Label">
-                <property name="text">
-                 <string>Point 2</string>
-                </property>
-                <property name="buddy">
-                 <cstring>point2Label</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="2" column="1">
-               <widget class="VectorInput" name="point2" native="true"/>
-              </item>
-              <item row="3" column="0">
-               <widget class="QLabel" name="point3Label">
-                <property name="text">
-                 <string>Point 3</string>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="1">
-               <widget class="VectorInput" name="point3" native="true"/>
-              </item>
-              <item row="4" column="0">
-               <widget class="QLabel" name="point4Label">
-                <property name="text">
-                 <string>Point 4</string>
-                </property>
-               </widget>
-              </item>
-              <item row="4" column="1">
-               <widget class="VectorInput" name="point4" native="true"/>
-              </item>
-              <item row="5" column="0">
-               <widget class="QLabel" name="control1Label">
-                <property name="text">
-                 <string>Control 1</string>
-                </property>
-               </widget>
-              </item>
-              <item row="5" column="1">
-               <widget class="VectorInput" name="control1" native="true"/>
-              </item>
-              <item row="6" column="0">
-               <widget class="QLabel" name="control2Label">
-                <property name="text">
-                 <string>Control 2</string>
-                </property>
-               </widget>
-              </item>
-              <item row="6" column="1">
-               <widget class="VectorInput" name="control2" native="true"/>
-              </item>
-              <item row="8" column="0">
-               <widget class="QLabel" name="transformLabel">
-                <property name="text">
-                 <string>Transform</string>
-                </property>
-               </widget>
-              </item>
-              <item row="8" column="1">
-               <widget class="MatrixEditor" name="transformation" native="true"/>
-              </item>
-              <item row="9" column="0">
-               <widget class="QLabel" name="nameLabel">
-                <property name="text">
-                 <string>Name</string>
-                </property>
-                <property name="buddy">
-                 <cstring>name</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="10" column="0">
-               <widget class="QLabel" name="textLabel">
-                <property name="text">
-                 <string>Text</string>
-                </property>
-                <property name="buddy">
-                 <cstring>text</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="11" column="0">
-               <widget class="QLabel" name="codeLabel">
-                <property name="text">
-                 <string>Code</string>
-                </property>
-                <property name="buddy">
-                 <cstring>code</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="12" column="0">
-               <widget class="QLabel" name="fractionLabel">
-                <property name="text">
-                 <string>Fraction</string>
-                </property>
-               </widget>
-              </item>
-              <item row="9" column="1">
-               <widget class="QLineEdit" name="name"/>
-              </item>
-              <item row="10" column="1">
-               <widget class="QLineEdit" name="text"/>
-              </item>
-              <item row="11" column="1">
-               <widget class="QLineEdit" name="code"/>
-              </item>
-              <item row="0" column="0">
-               <widget class="QLabel" name="colorLabel">
-                <property name="text">
-                 <string>Colour</string>
-                </property>
-                <property name="buddy">
-                 <cstring>color</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="0" column="1">
-               <widget class="ColorIndexInput" name="color" native="true"/>
-              </item>
-             </layout>
-            </widget>
-           </item>
-          </layout>
-         </item>
-         <item>
-          <spacer name="verticalSpacer">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>508</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>VectorInput</class>
-   <extends>QWidget</extends>
-   <header>widgets/vec3editor.h</header>
-  </customwidget>
-  <customwidget>
-   <class>MatrixEditor</class>
-   <extends>QWidget</extends>
-   <header>widgets/matrixeditor.h</header>
-  </customwidget>
-  <customwidget>
-   <class>ColorIndexInput</class>
-   <extends>QWidget</extends>
-   <header>src/widgets/colorindexinput.h</header>
-   <container>1</container>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

mercurial