From eb53e58ca2cfd3b03b89d6af48f5ab6f690924d5 Mon Sep 17 00:00:00 2001
From: Raphael Grimm <raphael.grimm@kit.edu>
Date: Mon, 31 Aug 2020 13:28:23 +0200
Subject: [PATCH] Revert "Move GraspEditorWindow from library to example"

This reverts commit 0e0778dc0095c250e5910c74552ff8ed5136da22.
---
 VirtualRobot/CMakeLists.txt                         | 13 +++++++++++++
 .../GraspEditor/GraspEditor.ui                      |  0
 .../GraspEditor/GraspEditorWindow.cpp               |  3 +++
 .../GraspEditor/GraspEditorWindow.h                 |  2 +-
 VirtualRobot/examples/GraspEditor/CMakeLists.txt    |  8 +++-----
 VirtualRobot/examples/GraspEditor/GraspEditor.cpp   |  2 +-
 6 files changed, 21 insertions(+), 7 deletions(-)
 rename VirtualRobot/{examples => Grasping}/GraspEditor/GraspEditor.ui (100%)
 rename VirtualRobot/{examples => Grasping}/GraspEditor/GraspEditorWindow.cpp (99%)
 rename VirtualRobot/{examples => Grasping}/GraspEditor/GraspEditorWindow.h (99%)

diff --git a/VirtualRobot/CMakeLists.txt b/VirtualRobot/CMakeLists.txt
index a91c85fc9..8e32dec13 100644
--- a/VirtualRobot/CMakeLists.txt
+++ b/VirtualRobot/CMakeLists.txt
@@ -713,6 +713,19 @@ if(Simox_BUILD_EXAMPLES)
     ADD_SUBDIRECTORY(examples/)
 endif()
 
+# -----------------------------------------------------------------------------------
+# Adding the UI files to the library
+if (Simox_USE_COIN_VISUALIZATION AND SOQT_FOUND)
+    MESSAGE (STATUS " ** Adding GraspEditor gui")
+
+
+    SET(SOURCES ${SOURCES} Grasping/GraspEditor/GraspEditorWindow.cpp)
+    SET(INCLUDES ${INCLUDES}
+        Grasping/GraspEditor/GraspEditorWindow.h
+        Grasping/GraspEditor/GraspEditor.ui
+    )
+endif()
+
 # Finished adding UI files
 #-----------------------------------------------------------------------------------
 set_target_properties(VirtualRobot PROPERTIES SOURCES "${SOURCES};${INCLUDES}")
diff --git a/VirtualRobot/examples/GraspEditor/GraspEditor.ui b/VirtualRobot/Grasping/GraspEditor/GraspEditor.ui
similarity index 100%
rename from VirtualRobot/examples/GraspEditor/GraspEditor.ui
rename to VirtualRobot/Grasping/GraspEditor/GraspEditor.ui
diff --git a/VirtualRobot/examples/GraspEditor/GraspEditorWindow.cpp b/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp
similarity index 99%
rename from VirtualRobot/examples/GraspEditor/GraspEditorWindow.cpp
rename to VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp
index af4a4f0c3..e5d76169e 100644
--- a/VirtualRobot/examples/GraspEditor/GraspEditorWindow.cpp
+++ b/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp
@@ -27,6 +27,9 @@
 
 #include <sstream>
 
+#include "ui_GraspEditor.h"
+
+
 using namespace std;
 using namespace VirtualRobot;
 
diff --git a/VirtualRobot/examples/GraspEditor/GraspEditorWindow.h b/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.h
similarity index 99%
rename from VirtualRobot/examples/GraspEditor/GraspEditorWindow.h
rename to VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.h
index 980eba3d1..d6b5461ff 100644
--- a/VirtualRobot/examples/GraspEditor/GraspEditorWindow.h
+++ b/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.h
@@ -24,7 +24,7 @@
 
 #include <vector>
 
-#include "ui_GraspEditor.h"
+// #include "ui_GraspEditor.h"
 
 namespace Ui
 {
diff --git a/VirtualRobot/examples/GraspEditor/CMakeLists.txt b/VirtualRobot/examples/GraspEditor/CMakeLists.txt
index 4dc6ef587..a7c24afe6 100644
--- a/VirtualRobot/examples/GraspEditor/CMakeLists.txt
+++ b/VirtualRobot/examples/GraspEditor/CMakeLists.txt
@@ -1,12 +1,10 @@
 PROJECT ( GraspEditor )
 
 IF(Simox_VISUALIZATION AND Simox_USE_COIN_VISUALIZATION)
-    MESSAGE (STATUS " ** Adding GraspEditor gui")
 
-    SET(demo_SRCS    GraspEditorWindow.cpp GraspEditor.cpp)
-    SET(demo_INCS    GraspEditorWindow.h)
-    SET(GUI_MOC_HDRS ${demo_INCS})
-    SET(GUI_UIS      GraspEditor.ui)
+	# the variable "demo_SRCS" contains all .cpp files of this project
+        FILE(GLOB demo_SRCS ${PROJECT_SOURCE_DIR}/GraspEditor.cpp)
+
 
 	# create the executable
 	VirtualRobotQtApplication(${PROJECT_NAME} "${demo_SRCS}" "${demo_INCS}" "${GUI_MOC_HDRS}" "${GUI_UIS}")
diff --git a/VirtualRobot/examples/GraspEditor/GraspEditor.cpp b/VirtualRobot/examples/GraspEditor/GraspEditor.cpp
index c971abec7..780e59ae0 100644
--- a/VirtualRobot/examples/GraspEditor/GraspEditor.cpp
+++ b/VirtualRobot/examples/GraspEditor/GraspEditor.cpp
@@ -21,7 +21,7 @@ using namespace VirtualRobot;
 #include <Eigen/Core>
 #include <Eigen/Geometry>
 
-#include "GraspEditorWindow.h"
+#include <VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.h>
 
 
 int main(int argc, char* argv[])
-- 
GitLab