From d2bd0fd4ee1d49bf8f5de05761dec7e817409e19 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 10 Oct 2023 12:29:10 +0200
Subject: [PATCH] rm undo/redo buttons from LayerOrientedSampleEditor

---
 .../LayerOrientedSampleEditor.cpp             | 31 -----------
 .../LayerOrientedSampleEditor.h               |  5 --
 GUI/gui.qrc                                   |  2 -
 GUI/images/redo.svg                           | 55 -------------------
 GUI/images/undo-variant.svg                   | 54 ------------------
 5 files changed, 147 deletions(-)
 delete mode 100644 GUI/images/redo.svg
 delete mode 100644 GUI/images/undo-variant.svg

diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp
index 70a0b9bdd08..14fc3c072e7 100644
--- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp
+++ b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp
@@ -28,8 +28,6 @@
 LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent, ProjectDocument* document)
     : QWidget(parent)
     , m_currentSampleWidget(nullptr)
-    , m_undoAction(nullptr)
-    , m_redoAction(nullptr)
     , m_currentSample(nullptr)
     , m_document(document)
 {
@@ -37,12 +35,9 @@ LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent, ProjectDoc
     m_scrollArea->setWidgetResizable(true);
     m_scrollArea->setWidget(createEmptyWidget());
 
-    m_toolbar = new StyledToolbar(this);
-
     auto* mainLayout = new QVBoxLayout(this);
     mainLayout->setContentsMargins(0, 0, 0, 0);
     mainLayout->setSpacing(0);
-    mainLayout->addWidget(m_toolbar);
     mainLayout->addWidget(m_scrollArea);
 }
 
@@ -59,16 +54,9 @@ void LayerOrientedSampleEditor::setCurrentSample(SampleItem* sampleItem)
     m_currentSampleWidget = nullptr;
     delete m_scrollArea->takeWidget();
 
-    // use the correct toolbar buttons (from correct undo stack)
-    delete m_undoAction;
-    m_undoAction = nullptr;
-    delete m_redoAction;
-    m_redoAction = nullptr;
-
     m_currentSample = sampleItem;
     if (m_currentSample == nullptr) {
         m_scrollArea->setWidget(createEmptyWidget());
-        updateActionEnabling();
         return;
     }
 
@@ -82,31 +70,12 @@ void LayerOrientedSampleEditor::setCurrentSample(SampleItem* sampleItem)
             &LayerOrientedSampleEditor::aboutToRemoveItem);
     connect(ec, &SampleEditorController::modified, this, &LayerOrientedSampleEditor::modified);
 
-    m_undoAction = ec->undoStack()->createUndoAction(this);
-    m_redoAction = ec->undoStack()->createRedoAction(this);
-    m_undoAction->setIcon(QIcon(":/images/undo-variant.svg"));
-    m_redoAction->setIcon(QIcon(":/images/redo.svg"));
-
-    m_toolbar->addAction(m_undoAction);
-    m_toolbar->addAction(m_redoAction);
-
     createLayerColors();
 
     m_currentSampleWidget = new SampleForm(this, m_currentSample, ec);
     ec->setSampleForm(m_currentSampleWidget);
     m_currentSampleWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
     m_scrollArea->setWidget(m_currentSampleWidget);
-
-    updateActionEnabling();
-}
-
-void LayerOrientedSampleEditor::updateActionEnabling()
-{
-    // Undo/Redo is not complete => hide the related buttons/actions
-    if (m_undoAction)
-        m_undoAction->setVisible(false);
-    if (m_redoAction)
-        m_redoAction->setVisible(false);
 }
 
 void LayerOrientedSampleEditor::createLayerColors() // #baLayerEditor move to better place
diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h
index cf32dc15da7..1310e778d2a 100644
--- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h
+++ b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h
@@ -42,8 +42,6 @@ signals:
     void modified();
 
 private:
-    void updateActionEnabling();
-
     void createLayerColors();
 
     //! Create empty widget with a button for sample creation
@@ -52,9 +50,6 @@ private:
 private:
     SampleForm* m_currentSampleWidget;
     QScrollArea* m_scrollArea;
-    QToolBar* m_toolbar;
-    QAction* m_undoAction; // dedicated to the current sample
-    QAction* m_redoAction;
     SampleItem* m_currentSample = nullptr;
     QMap<SampleItem*, SampleEditorController*> m_editControllers;
     ProjectDocument* m_document;
diff --git a/GUI/gui.qrc b/GUI/gui.qrc
index c65363c384c..5683f2bf002 100644
--- a/GUI/gui.qrc
+++ b/GUI/gui.qrc
@@ -66,8 +66,6 @@
         <file>images/menu-open.svg</file>
         <file>images/move_up_down.svg</file>
         <file>images/rotate-left.svg</file>
-        <file>images/undo-variant.svg</file>
-        <file>images/redo.svg</file>
         <file>images/1D_Error.png</file>
         <file>images/1D_OK.png</file>
         <file>images/2D_OK.png</file>
diff --git a/GUI/images/redo.svg b/GUI/images/redo.svg
deleted file mode 100644
index 0a7eec2c9ca..00000000000
--- a/GUI/images/redo.svg
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
-   inkscape:version="1.1 (c68e22c387, 2021-05-23)"
-   sodipodi:docname="redo.svg"
-   id="svg4"
-   viewBox="0 0 24 24"
-   height="24"
-   width="24"
-   version="1.1"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:dc="http://purl.org/dc/elements/1.1/">
-  <metadata
-     id="metadata10">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <defs
-     id="defs8" />
-  <sodipodi:namedview
-     inkscape:current-layer="svg4"
-     inkscape:window-maximized="0"
-     inkscape:window-y="28"
-     inkscape:window-x="938"
-     inkscape:cy="12"
-     inkscape:cx="12.033566"
-     inkscape:zoom="29.791667"
-     showgrid="false"
-     id="namedview6"
-     inkscape:window-height="1372"
-     inkscape:window-width="1796"
-     inkscape:pageshadow="2"
-     inkscape:pageopacity="0"
-     guidetolerance="10"
-     gridtolerance="10"
-     objecttolerance="10"
-     borderopacity="1"
-     bordercolor="#666666"
-     pagecolor="#ffffff"
-     inkscape:pagecheckerboard="0" />
-  <path
-     style="fill:#838686;fill-opacity:1"
-     id="path2"
-     d="M 10.5,7 A -6.5,6.5 0 0 0 4,13.5 -6.5,6.5 0 0 0 10.5,20 H 14 V 18 H 10.5 C 8,18 6,16 6,13.5 6,11 8,9 10.5,9 h 5.67 L 13.09,12.09 14.5,13.5 20,8 14.5,2.5 13.08,3.91 16.17,7 H 10.5 M 18,18 h -2 v 2 h 2 z" />
-</svg>
diff --git a/GUI/images/undo-variant.svg b/GUI/images/undo-variant.svg
deleted file mode 100644
index a8a7cdf8b7b..00000000000
--- a/GUI/images/undo-variant.svg
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
-   sodipodi:docname="undo-variant.svg"
-   id="svg4"
-   viewBox="0 0 24 24"
-   height="24"
-   width="24"
-   version="1.1">
-  <metadata
-     id="metadata10">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <defs
-     id="defs8" />
-  <sodipodi:namedview
-     inkscape:current-layer="svg4"
-     inkscape:window-maximized="0"
-     inkscape:window-y="0"
-     inkscape:window-x="0"
-     inkscape:cy="12"
-     inkscape:cx="12"
-     inkscape:zoom="29.791667"
-     showgrid="false"
-     id="namedview6"
-     inkscape:window-height="1372"
-     inkscape:window-width="1796"
-     inkscape:pageshadow="2"
-     inkscape:pageopacity="0"
-     guidetolerance="10"
-     gridtolerance="10"
-     objecttolerance="10"
-     borderopacity="1"
-     bordercolor="#666666"
-     pagecolor="#ffffff" />
-  <path
-     style="fill:#838686;fill-opacity:1"
-     id="path2"
-     d="M13.5,7A6.5,6.5 0 0,1 20,13.5A6.5,6.5 0 0,1 13.5,20H10V18H13.5C16,18 18,16 18,13.5C18,11 16,9 13.5,9H7.83L10.91,12.09L9.5,13.5L4,8L9.5,2.5L10.92,3.91L7.83,7H13.5M6,18H8V20H6V18Z" />
-</svg>
-- 
GitLab