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 01/20] 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 From 8a98aa5f587e4a74e93c6cc1c726e8a7d01db937 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 12:32:03 +0200 Subject: [PATCH 02/20] . --- GUI/View/SampleDesigner/LayerOrientedSampleEditor.h | 1 - 1 file changed, 1 deletion(-) diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h index 1310e778d2a..65a417b87da 100644 --- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h +++ b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h @@ -47,7 +47,6 @@ private: //! Create empty widget with a button for sample creation QWidget* createEmptyWidget(); -private: SampleForm* m_currentSampleWidget; QScrollArea* m_scrollArea; SampleItem* m_currentSample = nullptr; -- GitLab From 16d843deb7ff235ce0638106cf6139c3985eccb7 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 13:35:47 +0200 Subject: [PATCH 03/20] rm fct --- GUI/View/SampleDesigner/SampleEditorController.cpp | 5 ----- GUI/View/SampleDesigner/SampleEditorController.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index 0020e2f6353..cd5a1568139 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -399,11 +399,6 @@ void SampleEditorController::setCurrentIndex(ISelectionContainerForm* widget, in emit modified(); } -QUndoStack* SampleEditorController::undoStack() -{ - return &m_undoStack; -} - MaterialModel* SampleEditorController::materialModel() const { return &m_sampleItem->materialModel(); diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 2a2c6d3937f..99f26c55faa 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -62,9 +62,6 @@ public: //! The item on which this controller operates. SampleItem* sampleItem() const; - //! The contained undo stack. - QUndoStack* undoStack(); - //! The materials of the current document MaterialModel* materialModel() const; -- GitLab From b8b4311f9fd0df96f71baffac2c933963822f186 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 13:37:23 +0200 Subject: [PATCH 04/20] sort --- GUI/View/SampleDesigner/SampleEditorController.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 99f26c55faa..22f71cbc438 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -19,11 +19,11 @@ #include "GUI/Model/Sample/ItemWithParticlesCatalog.h" #include <QUndoStack> -class ISelectionContainerForm; -class ISelectionProperty; class CompoundItem; class CoreAndShellForm; class DoubleProperty; +class ISelectionContainerForm; +class ISelectionProperty; class InterferenceForm; class InterferenceItem; class Item3D; @@ -34,10 +34,10 @@ class LayerForm; class LayerItem; class MaterialModel; class MesocrystalForm; -class SampleForm; -class SampleItem; class ParticleLayoutItem; class ProjectDocument; +class SampleForm; +class SampleItem; class SelectionContainerForm; //! Class to modify a sample from the layer oriented sample editor. -- GitLab From 94bae7df21d3f7329bda1f0f8c8f98c7f8b61527 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:02:26 +0200 Subject: [PATCH 05/20] rm AddLayer from SampleEditorCommands --- .../SampleDesigner/SampleEditorCommands.cpp | 22 +------------------ .../SampleDesigner/SampleEditorCommands.h | 13 ----------- .../SampleDesigner/SampleEditorController.cpp | 6 ++--- 3 files changed, 4 insertions(+), 37 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.cpp b/GUI/View/SampleDesigner/SampleEditorCommands.cpp index f152d2a6ded..2304d3c2c28 100644 --- a/GUI/View/SampleDesigner/SampleEditorCommands.cpp +++ b/GUI/View/SampleDesigner/SampleEditorCommands.cpp @@ -19,6 +19,7 @@ #include "GUI/View/SampleDesigner/SampleEditorController.h" #include "GUI/View/SampleDesigner/SampleForm.h" #include <utility> +#include <iostream> namespace { @@ -52,27 +53,6 @@ void CommandRemoveLayer::undo() // --------------------------------------------------------------------------------------------- // -CommandAddLayer::CommandAddLayer(SampleEditorController* ec, int atIndex, QUndoCommand* /*parent*/) - : m_ec(ec) - , m_atIndex(atIndex) -{ - setText("Add layer"); -} - -void CommandAddLayer::redo() -{ - m_ec->addLayerItemFromUndo(m_atIndex); -} - -void CommandAddLayer::undo() -{ - // no backup of the layer has to be stored, since redo always creates the layer - // from scratch - no contents required for this - m_ec->removeLayerItemFromUndo(m_atIndex); -} - -// --------------------------------------------------------------------------------------------- // - CommandChangeValue::CommandChangeValue(const QString& label, SampleEditorController* ec, double oldValue, double newValue, const QString& path, QUndoCommand* parent /*= nullptr*/) diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.h b/GUI/View/SampleDesigner/SampleEditorCommands.h index 0a58d850da7..a53900e9d38 100644 --- a/GUI/View/SampleDesigner/SampleEditorCommands.h +++ b/GUI/View/SampleDesigner/SampleEditorCommands.h @@ -40,19 +40,6 @@ private: bool m_isFirst = true; }; -//! Command to add a layer to a sample -class CommandAddLayer : public QUndoCommand { -public: - CommandAddLayer(SampleEditorController* ec, int atIndex, QUndoCommand* parent = nullptr); - - void redo() override; - void undo() override; - -private: - SampleEditorController* m_ec; - int m_atIndex; -}; - //! Command to remove a layer from a sample class CommandRemoveLayer : public QUndoCommand { public: diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index cd5a1568139..e8a1f29e922 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -63,9 +63,9 @@ SampleItem* SampleEditorController::sampleItem() const void SampleEditorController::addLayerItem(LayerItem* before) { - const int newIndex = (before != nullptr) ? m_sampleItem->layerItems().indexOf(before) - : m_sampleItem->layerItems().size(); - m_undoStack.push(new CommandAddLayer(this, newIndex)); + const int i = (before != nullptr) ? m_sampleItem->layerItems().indexOf(before) + : m_sampleItem->layerItems().size(); + addLayerItemFromUndo(i); } QColor SampleEditorController::findColor(int atIndex) -- GitLab From 583ec9cae57378ee2f52d928da04c65b8ae58956 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:04:37 +0200 Subject: [PATCH 06/20] rm RemoveLayer from SampleEditorCommands --- .../SampleDesigner/SampleEditorCommands.cpp | 27 ------------------- .../SampleDesigner/SampleEditorCommands.h | 16 ----------- .../SampleDesigner/SampleEditorController.cpp | 3 ++- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.cpp b/GUI/View/SampleDesigner/SampleEditorCommands.cpp index 2304d3c2c28..e41824df701 100644 --- a/GUI/View/SampleDesigner/SampleEditorCommands.cpp +++ b/GUI/View/SampleDesigner/SampleEditorCommands.cpp @@ -19,7 +19,6 @@ #include "GUI/View/SampleDesigner/SampleEditorController.h" #include "GUI/View/SampleDesigner/SampleForm.h" #include <utility> -#include <iostream> namespace { @@ -27,32 +26,6 @@ constexpr int COMMAND_ID_CHANGE_VALUE = 11; } // namespace - -CommandRemoveLayer::CommandRemoveLayer(SampleEditorController* ec, LayerItem* layerItem, - QUndoCommand* parent /*= nullptr*/) - : QUndoCommand(parent) - , m_ec(ec) -{ - setText("Remove layer"); - m_indexOfLayer = ec->sampleItem()->layerItems().indexOf(layerItem); - m_layerItemBackup = GUI::Util::createBackup(layerItem); -} - -void CommandRemoveLayer::redo() -{ - m_ec->removeLayerItemFromUndo(m_indexOfLayer); -} - -void CommandRemoveLayer::undo() -{ - LayerItem* restoredLayer = m_ec->sampleItem()->createLayerItemAt(m_indexOfLayer); - GUI::Util::restoreBackup(restoredLayer, m_layerItemBackup); - m_ec->sampleForm()->onLayerAdded(restoredLayer); - emit m_ec->modified(); -} - -// --------------------------------------------------------------------------------------------- // - CommandChangeValue::CommandChangeValue(const QString& label, SampleEditorController* ec, double oldValue, double newValue, const QString& path, QUndoCommand* parent /*= nullptr*/) diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.h b/GUI/View/SampleDesigner/SampleEditorCommands.h index a53900e9d38..09b30a89217 100644 --- a/GUI/View/SampleDesigner/SampleEditorCommands.h +++ b/GUI/View/SampleDesigner/SampleEditorCommands.h @@ -40,20 +40,4 @@ private: bool m_isFirst = true; }; -//! Command to remove a layer from a sample -class CommandRemoveLayer : public QUndoCommand { -public: - CommandRemoveLayer(SampleEditorController* ec, LayerItem* layerItem, - QUndoCommand* parent = nullptr); - - void redo() override; - void undo() override; - -private: - SampleEditorController* m_ec; - QByteArray m_layerItemBackup; - int m_indexOfLayer; -}; - - #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITORCOMMANDS_H diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index e8a1f29e922..c670b3b3c99 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -142,7 +142,8 @@ void SampleEditorController::duplicateLayerItem(const LayerItem* layer) void SampleEditorController::removeLayerItem(LayerItem* layer) { - m_undoStack.push(new CommandRemoveLayer(this, layer)); + const int i = sampleItem()->layerItems().indexOf(layer); + removeLayerItemFromUndo(i); } void SampleEditorController::removeLayerItemFromUndo(int atIndex) -- GitLab From c001d5422a130d067477c0e963c64651619212d7 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:05:26 +0200 Subject: [PATCH 07/20] rm unused fct --- GUI/View/SampleDesigner/SampleEditorCommands.cpp | 14 -------------- GUI/View/SampleDesigner/SampleEditorCommands.h | 1 - 2 files changed, 15 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.cpp b/GUI/View/SampleDesigner/SampleEditorCommands.cpp index e41824df701..c911cc03f8b 100644 --- a/GUI/View/SampleDesigner/SampleEditorCommands.cpp +++ b/GUI/View/SampleDesigner/SampleEditorCommands.cpp @@ -43,20 +43,6 @@ int CommandChangeValue::id() const return COMMAND_ID_CHANGE_VALUE; } -bool CommandChangeValue::mergeWith(const QUndoCommand* command) -{ - if (command->id() != id()) // make sure other is also a changeValue command - return false; - - const auto* const other = dynamic_cast<const CommandChangeValue*>(command); - - if (m_path != other->m_path) - return false; - - m_newValue = other->m_newValue; - return true; -} - void CommandChangeValue::redo() { if (m_isFirst) diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.h b/GUI/View/SampleDesigner/SampleEditorCommands.h index 09b30a89217..db7764d6fbb 100644 --- a/GUI/View/SampleDesigner/SampleEditorCommands.h +++ b/GUI/View/SampleDesigner/SampleEditorCommands.h @@ -27,7 +27,6 @@ public: double newValue, const QString& path, QUndoCommand* parent = nullptr); int id() const override; - bool mergeWith(const QUndoCommand* command) override; void redo() override; void undo() override; -- GitLab From 689c18ac70fcfc27283d46c826e62749f3f18b89 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:07:40 +0200 Subject: [PATCH 08/20] rename arg --- .../SampleDesigner/SampleEditorController.cpp | 26 +++++++++---------- .../SampleDesigner/SampleEditorController.h | 10 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index c670b3b3c99..01e5b711c98 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -64,7 +64,7 @@ SampleItem* SampleEditorController::sampleItem() const void SampleEditorController::addLayerItem(LayerItem* before) { const int i = (before != nullptr) ? m_sampleItem->layerItems().indexOf(before) - : m_sampleItem->layerItems().size(); + : m_sampleItem->layerItems().size(); addLayerItemFromUndo(i); } @@ -360,14 +360,14 @@ void SampleEditorController::removeParticle(ItemWithParticles* itemToRemove) } } -void SampleEditorController::setDouble(double newValue, DoubleProperty& d) +void SampleEditorController::setDouble(double value, DoubleProperty& d) { - m_undoStack.push(new CommandChangeValue(d.label(), this, d.value(), newValue, d.uid())); - d.setValue(newValue); + m_undoStack.push(new CommandChangeValue(d.label(), this, d.value(), value, d.uid())); + d.setValue(value); emit modified(); } -void SampleEditorController::setDoubleFromUndo(double newValue, const QString& path) +void SampleEditorController::setDoubleFromUndo(double value, const QString& path) { ASSERT(m_sampleForm); @@ -382,10 +382,10 @@ void SampleEditorController::setDoubleFromUndo(double newValue, const QString& p if (!spinBox) return; - spinBox->setPropertyValue(newValue); + spinBox->setPropertyValue(value); QSignalBlocker _(spinBox); - spinBox->setBaseValue(newValue); + spinBox->setBaseValue(value); spinBox->setFocus(); spinBox->selectAll(); @@ -425,10 +425,10 @@ void SampleEditorController::selectMaterial(ItemWithMaterial* item, emit modified(); } -void SampleEditorController::setMaterialValue(ItemWithMaterial* item, double newValue, +void SampleEditorController::setMaterialValue(ItemWithMaterial* item, double value, DoubleProperty& d) { - setDouble(newValue, d); + setDouble(value, d); // -- notify all other users of this material (update values in the UI) ASSERT(m_sampleForm); @@ -440,9 +440,9 @@ void SampleEditorController::setMaterialValue(ItemWithMaterial* item, double new } void SampleEditorController::setDensityRelatedValue(InterferenceItem* interferenceItem, - double newValue, DoubleProperty& d) + double value, DoubleProperty& d) { - setDouble(newValue, d); + setDouble(value, d); // -- notify the containing particle layout UI about changed value ASSERT(m_sampleForm); @@ -519,9 +519,9 @@ void SampleEditorController::selectInterference(InterferenceForm* widget, int ne emit modified(); } -void SampleEditorController::setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool newValue) +void SampleEditorController::setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool value) { - widget->interferenceItem()->setXiIntegration(newValue); + widget->interferenceItem()->setXiIntegration(value); widget->onIntegrateOverXiChanged(); emit modified(); } diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 22f71cbc438..41c602daf4c 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -100,15 +100,15 @@ public: void setMesocrystalBasis(MesocrystalForm* widget, ItemWithParticlesCatalog::Type type); void setMesocrystalBasis(MesocrystalForm* widget, FormFactorItemCatalog::Type type); void selectInterference(InterferenceForm* widget, int newIndex); - void setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool newValue); + void setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool value); - void setDouble(double newValue, DoubleProperty& d); - void setDoubleFromUndo(double newValue, const QString& path); + void setDouble(double value, DoubleProperty& d); + void setDoubleFromUndo(double value, const QString& path); void setCurrentIndex(ISelectionContainerForm* widget, int index, ISelectionProperty& d); void selectMaterial(ItemWithMaterial* item, const QString& newMaterialIdentifier); - void setMaterialValue(ItemWithMaterial* item, double newValue, DoubleProperty& d); + void setMaterialValue(ItemWithMaterial* item, double value, DoubleProperty& d); //! Set an interference function's value which affects the total particle density of the //! containing particle layout. @@ -116,7 +116,7 @@ public: //! Some values in interference settings affect the total density in the particle layout which //! contains this interference function. Call this method to provide all the related updating //! (data & UI). - void setDensityRelatedValue(InterferenceItem* interferenceItem, double newValue, + void setDensityRelatedValue(InterferenceItem* interferenceItem, double value, DoubleProperty& d); void onStoppedToMoveLayer(QWidget* widgetToMove, QWidget* moveAboveThisWidget); -- GitLab From 17bc57a23073f5e3190cc120994735003254dd4f Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:15:02 +0200 Subject: [PATCH 09/20] rm SampleEditorCommands --- .../SampleDesigner/SampleEditorCommands.cpp | 57 ------------------- .../SampleDesigner/SampleEditorCommands.h | 42 -------------- .../SampleDesigner/SampleEditorController.cpp | 3 +- 3 files changed, 1 insertion(+), 101 deletions(-) delete mode 100644 GUI/View/SampleDesigner/SampleEditorCommands.cpp delete mode 100644 GUI/View/SampleDesigner/SampleEditorCommands.h diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.cpp b/GUI/View/SampleDesigner/SampleEditorCommands.cpp deleted file mode 100644 index c911cc03f8b..00000000000 --- a/GUI/View/SampleDesigner/SampleEditorCommands.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/View/SampleDesigner/SampleEditorCommands.cpp -//! @brief Implements command classes for LayerOrientedSampleEditor -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2021 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "GUI/View/SampleDesigner/SampleEditorCommands.h" -#include "GUI/Model/Sample/LayerItem.h" -#include "GUI/Model/Sample/SampleItem.h" -#include "GUI/Support/XML/Backup.h" -#include "GUI/View/SampleDesigner/SampleEditorController.h" -#include "GUI/View/SampleDesigner/SampleForm.h" -#include <utility> - -namespace { - -constexpr int COMMAND_ID_CHANGE_VALUE = 11; - -} // namespace - -CommandChangeValue::CommandChangeValue(const QString& label, SampleEditorController* ec, - double oldValue, double newValue, const QString& path, - QUndoCommand* parent /*= nullptr*/) - : QUndoCommand(parent) - , m_ec(ec) - , m_oldValue(oldValue) - , m_newValue(newValue) - , m_path(path) -{ - setText("change " + label + "\n"); -} - -int CommandChangeValue::id() const -{ - return COMMAND_ID_CHANGE_VALUE; -} - -void CommandChangeValue::redo() -{ - if (m_isFirst) - m_isFirst = false; - else - m_ec->setDoubleFromUndo(m_newValue, m_path); -} - -void CommandChangeValue::undo() -{ - m_ec->setDoubleFromUndo(m_oldValue, m_path); -} diff --git a/GUI/View/SampleDesigner/SampleEditorCommands.h b/GUI/View/SampleDesigner/SampleEditorCommands.h deleted file mode 100644 index db7764d6fbb..00000000000 --- a/GUI/View/SampleDesigner/SampleEditorCommands.h +++ /dev/null @@ -1,42 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/View/SampleDesigner/SampleEditorCommands.h -//! @brief Defines command classes for LayerOrientedSampleEditor -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2021 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITORCOMMANDS_H -#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITORCOMMANDS_H - -#include <QUndoCommand> - -class SampleEditorController; -class LayerItem; - -//! Command to change a double value -class CommandChangeValue : public QUndoCommand { -public: - CommandChangeValue(const QString& label, SampleEditorController* ec, double oldValue, - double newValue, const QString& path, QUndoCommand* parent = nullptr); - - int id() const override; - - void redo() override; - void undo() override; - -private: - SampleEditorController* m_ec; - double m_oldValue; - double m_newValue; - QString m_path; - bool m_isFirst = true; -}; - -#endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITORCOMMANDS_H diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index 01e5b711c98..f6fe8db06f5 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -35,7 +35,6 @@ #include "GUI/View/SampleDesigner/MaterialInplaceForm.h" #include "GUI/View/SampleDesigner/MesocrystalForm.h" #include "GUI/View/SampleDesigner/ParticleLayoutForm.h" -#include "GUI/View/SampleDesigner/SampleEditorCommands.h" #include "GUI/View/SampleDesigner/SampleForm.h" #include "Sample/HardParticle/Cylinder.h" @@ -362,7 +361,7 @@ void SampleEditorController::removeParticle(ItemWithParticles* itemToRemove) void SampleEditorController::setDouble(double value, DoubleProperty& d) { - m_undoStack.push(new CommandChangeValue(d.label(), this, d.value(), value, d.uid())); + setDoubleFromUndo(value, d.uid()); d.setValue(value); emit modified(); } -- GitLab From 675bcc91122e3a370a8be5774e1c4e42853d3a0e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:15:29 +0200 Subject: [PATCH 10/20] cleanup --- GUI/View/SampleDesigner/SampleEditorController.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 41c602daf4c..41eab2eef33 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -17,7 +17,6 @@ #include "GUI/Model/Sample/FormFactorItemCatalog.h" #include "GUI/Model/Sample/ItemWithParticlesCatalog.h" -#include <QUndoStack> class CompoundItem; class CoreAndShellForm; @@ -134,7 +133,6 @@ private: ItemWithParticles* createAndInitItem(ItemWithParticlesCatalog::Type itemType) const; private: - QUndoStack m_undoStack; SampleItem* m_sampleItem; SampleForm* m_sampleForm; ProjectDocument* m_document; -- GitLab From 2960e7ad2c9aeb37fcfbb7561bf01136cd8ba739 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:18:44 +0200 Subject: [PATCH 11/20] privatize --- GUI/View/SampleDesigner/SampleEditorController.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 41eab2eef33..d8a440b3138 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -17,6 +17,7 @@ #include "GUI/Model/Sample/FormFactorItemCatalog.h" #include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include <QObject> class CompoundItem; class CoreAndShellForm; @@ -70,10 +71,8 @@ public: void addLayerItem(LayerItem* before); QColor findColor(int atIndex); void onLayerAdded(LayerItem* layer); - void addLayerItemFromUndo(int atIndex); void duplicateLayerItem(const LayerItem* layer); void removeLayerItem(LayerItem* layer); - void removeLayerItemFromUndo(int atIndex); void onLayoutAdded(LayerForm* layerForm, ParticleLayoutItem* layout); void addLayoutItem(LayerForm* layerForm); @@ -102,7 +101,6 @@ public: void setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool value); void setDouble(double value, DoubleProperty& d); - void setDoubleFromUndo(double value, const QString& path); void setCurrentIndex(ISelectionContainerForm* widget, int index, ISelectionProperty& d); @@ -132,7 +130,10 @@ private: ItemWithParticles* createAndInitItem(FormFactorItemCatalog::Type formFactorType) const; ItemWithParticles* createAndInitItem(ItemWithParticlesCatalog::Type itemType) const; -private: + void addLayerItemFromUndo(int atIndex); + void removeLayerItemFromUndo(int atIndex); + void setDoubleFromUndo(double value, const QString& path); + SampleItem* m_sampleItem; SampleForm* m_sampleForm; ProjectDocument* m_document; -- GitLab From 68cdae59a3ef9d95348d8765c8b084db885e89f1 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:20:16 +0200 Subject: [PATCH 12/20] rename LayerOrientedSampleEditor -> SampleEditor --- ...entedSampleEditor.cpp => SampleEditor.cpp} | 24 +++++++++---------- ...rOrientedSampleEditor.h => SampleEditor.h} | 16 ++++++------- GUI/View/SampleDesigner/SampleView.cpp | 20 ++++++++-------- 3 files changed, 30 insertions(+), 30 deletions(-) rename GUI/View/SampleDesigner/{LayerOrientedSampleEditor.cpp => SampleEditor.cpp} (78%) rename GUI/View/SampleDesigner/{LayerOrientedSampleEditor.h => SampleEditor.h} (72%) diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp b/GUI/View/SampleDesigner/SampleEditor.cpp similarity index 78% rename from GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp rename to GUI/View/SampleDesigner/SampleEditor.cpp index 14fc3c072e7..7ff5299f361 100644 --- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp +++ b/GUI/View/SampleDesigner/SampleEditor.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp -//! @brief Implements class LayerOrientedSampleEditor +//! @file GUI/View/SampleDesigner/SampleEditor.cpp +//! @brief Implements class SampleEditor //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "GUI/View/SampleDesigner/LayerOrientedSampleEditor.h" +#include "GUI/View/SampleDesigner/SampleEditor.h" #include "GUI/Model/Project/ProjectDocument.h" #include "GUI/Model/Sample/LayerItem.h" #include "GUI/Model/Sample/SampleItem.h" @@ -25,7 +25,7 @@ #include <QBoxLayout> #include <QPushButton> -LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent, ProjectDocument* document) +SampleEditor::SampleEditor(QWidget* parent, ProjectDocument* document) : QWidget(parent) , m_currentSampleWidget(nullptr) , m_currentSample(nullptr) @@ -41,12 +41,12 @@ LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent, ProjectDoc mainLayout->addWidget(m_scrollArea); } -LayerOrientedSampleEditor::~LayerOrientedSampleEditor() +SampleEditor::~SampleEditor() { qDeleteAll(m_editControllers.values()); } -void LayerOrientedSampleEditor::setCurrentSample(SampleItem* sampleItem) +void SampleEditor::setCurrentSample(SampleItem* sampleItem) { if (m_currentSample != nullptr) m_editControllers[m_currentSample]->setSampleForm(nullptr); @@ -65,10 +65,10 @@ void LayerOrientedSampleEditor::setCurrentSample(SampleItem* sampleItem) new SampleEditorController(m_document, m_currentSample)); auto* ec = m_editControllers[m_currentSample]; connect(ec, &SampleEditorController::requestViewInRealspace, this, - &LayerOrientedSampleEditor::requestViewInRealspace); + &SampleEditor::requestViewInRealspace); connect(ec, &SampleEditorController::aboutToRemoveItem, this, - &LayerOrientedSampleEditor::aboutToRemoveItem); - connect(ec, &SampleEditorController::modified, this, &LayerOrientedSampleEditor::modified); + &SampleEditor::aboutToRemoveItem); + connect(ec, &SampleEditorController::modified, this, &SampleEditor::modified); createLayerColors(); @@ -78,7 +78,7 @@ void LayerOrientedSampleEditor::setCurrentSample(SampleItem* sampleItem) m_scrollArea->setWidget(m_currentSampleWidget); } -void LayerOrientedSampleEditor::createLayerColors() // #baLayerEditor move to better place +void SampleEditor::createLayerColors() // #baLayerEditor move to better place { if (!m_currentSample) return; @@ -95,12 +95,12 @@ void LayerOrientedSampleEditor::createLayerColors() // #baLayerEditor move to be } } -QWidget* LayerOrientedSampleEditor::createEmptyWidget() +QWidget* SampleEditor::createEmptyWidget() { auto* emptyWidget = new QWidget(this); auto* btn = new QPushButton("Create sample", emptyWidget); - connect(btn, &QPushButton::clicked, this, &LayerOrientedSampleEditor::requestCreateNewSample); + connect(btn, &QPushButton::clicked, this, &SampleEditor::requestCreateNewSample); auto* layout = new QHBoxLayout(emptyWidget); layout->setContentsMargins(10, 20, 10, 20); diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h b/GUI/View/SampleDesigner/SampleEditor.h similarity index 72% rename from GUI/View/SampleDesigner/LayerOrientedSampleEditor.h rename to GUI/View/SampleDesigner/SampleEditor.h index 65a417b87da..25e1c321113 100644 --- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h +++ b/GUI/View/SampleDesigner/SampleEditor.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/SampleDesigner/LayerOrientedSampleEditor.h -//! @brief Defines class LayerOrientedSampleEditor +//! @file GUI/View/SampleDesigner/SampleEditor.h +//! @brief Defines class SampleEditor //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYERORIENTEDSAMPLEEDITOR_H -#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYERORIENTEDSAMPLEEDITOR_H +#ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITOR_H +#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITOR_H #include <QMap> #include <QScrollArea> @@ -27,11 +27,11 @@ class ProjectDocument; class SampleEditorController; //! Sample editor with layer oriented presentation of a sample -class LayerOrientedSampleEditor : public QWidget { +class SampleEditor : public QWidget { Q_OBJECT public: - LayerOrientedSampleEditor(QWidget* parent, ProjectDocument* document); - ~LayerOrientedSampleEditor() override; + SampleEditor(QWidget* parent, ProjectDocument* document); + ~SampleEditor() override; void setCurrentSample(SampleItem* sampleItem); @@ -55,4 +55,4 @@ private: }; -#endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYERORIENTEDSAMPLEEDITOR_H +#endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEEDITOR_H diff --git a/GUI/View/SampleDesigner/SampleView.cpp b/GUI/View/SampleDesigner/SampleView.cpp index 4b4e0f86d92..fe128580acd 100644 --- a/GUI/View/SampleDesigner/SampleView.cpp +++ b/GUI/View/SampleDesigner/SampleView.cpp @@ -19,7 +19,7 @@ #include "GUI/Model/Sample/ParticleLayoutItem.h" #include "GUI/Model/Sample/SampleItem.h" #include "GUI/Support/Style/ApplicationSettings.h" -#include "GUI/View/SampleDesigner/LayerOrientedSampleEditor.h" +#include "GUI/View/SampleDesigner/SampleEditor.h" #include "GUI/View/SampleDesigner/SampleListView.h" #include "GUI/View/SampleDesigner/ScriptPanel.h" #include "GUI/View/SampleView/RealspacePanel.h" @@ -46,7 +46,7 @@ SampleView::SampleView(QWidget* parent, ProjectDocument* document) m_docks = new DocksController(this); - auto* editor = new LayerOrientedSampleEditor(this, document); + auto* editor = new SampleEditor(this, document); auto* sampleSelectionPane = new QWidget(this); auto* sampleSelectionLayout = new QVBoxLayout(sampleSelectionPane); @@ -80,7 +80,7 @@ SampleView::SampleView(QWidget* parent, ProjectDocument* document) m_docks->addWidget(PYTHONPANEL, scriptPanel, Qt::BottomDockWidgetArea); connect(m_sampleSelectionView, &SampleListView::currentSampleChanged, editor, - &LayerOrientedSampleEditor::setCurrentSample); + &SampleEditor::setCurrentSample); connect(m_sampleSelectionView, &SampleListView::currentSampleChanged, [&](SampleItem* m) { onRequestViewInRealspace(m); }); @@ -88,25 +88,25 @@ SampleView::SampleView(QWidget* parent, ProjectDocument* document) connect(m_sampleSelectionView, &SampleListView::currentSampleChanged, scriptPanel, &ScriptPanel::setCurrentSample); - connect(editor, &LayerOrientedSampleEditor::modified, scriptPanel, + connect(editor, &SampleEditor::modified, scriptPanel, &ScriptPanel::onSampleModified); - connect(editor, &LayerOrientedSampleEditor::modified, m_sampleSelectionView, + connect(editor, &SampleEditor::modified, m_sampleSelectionView, &SampleListView::onSampleModified); - connect(editor, &LayerOrientedSampleEditor::requestViewInRealspace, this, + connect(editor, &SampleEditor::requestViewInRealspace, this, &SampleView::onRequestViewInRealspace); - connect(editor, &LayerOrientedSampleEditor::aboutToRemoveItem, this, + connect(editor, &SampleEditor::aboutToRemoveItem, this, &SampleView::onAboutToRemoveItem); - connect(editor, &LayerOrientedSampleEditor::requestCreateNewSample, + connect(editor, &SampleEditor::requestCreateNewSample, m_sampleSelectionView->newSampleAction(), &QAction::trigger, Qt::QueuedConnection); - connect(editor, &LayerOrientedSampleEditor::modified, m_realspacePanel->widget(), + connect(editor, &SampleEditor::modified, m_realspacePanel->widget(), &RealspaceWidget::updateScene); - connect(editor, &LayerOrientedSampleEditor::modified, m_document, &ProjectDocument::setModified, + connect(editor, &SampleEditor::modified, m_document, &ProjectDocument::setModified, Qt::UniqueConnection); setCentralWidget(editor); -- GitLab From cd86c9b6c84e16295e89032041976cb22267c449 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:21:50 +0200 Subject: [PATCH 13/20] sort code --- .../SampleDesigner/SampleEditorController.cpp | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index f6fe8db06f5..2bc79bc0bdb 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -66,6 +66,16 @@ void SampleEditorController::addLayerItem(LayerItem* before) : m_sampleItem->layerItems().size(); addLayerItemFromUndo(i); } +void SampleEditorController::addLayerItemFromUndo(int atIndex) +{ + QColor color = findColor(atIndex); // before adding layer + + LayerItem* layer = m_sampleItem->createLayerItemAt(atIndex); + layer->setMaterial(materialModel()->defaultMaterialItem()); + layer->setColor(color); + + onLayerAdded(layer); +} QColor SampleEditorController::findColor(int atIndex) { @@ -116,17 +126,6 @@ void SampleEditorController::onLayerAdded(LayerItem* layer) c->expand(); } -void SampleEditorController::addLayerItemFromUndo(int atIndex) -{ - QColor color = findColor(atIndex); // before adding layer - - LayerItem* layer = m_sampleItem->createLayerItemAt(atIndex); - layer->setMaterial(materialModel()->defaultMaterialItem()); - layer->setColor(color); - - onLayerAdded(layer); -} - void SampleEditorController::duplicateLayerItem(const LayerItem* layer) { int atIndex = m_sampleItem->layerItems().indexOf(layer) + 1; @@ -144,7 +143,6 @@ void SampleEditorController::removeLayerItem(LayerItem* layer) const int i = sampleItem()->layerItems().indexOf(layer); removeLayerItemFromUndo(i); } - void SampleEditorController::removeLayerItemFromUndo(int atIndex) { auto* layer = m_sampleItem->layerItems()[atIndex]; @@ -365,7 +363,6 @@ void SampleEditorController::setDouble(double value, DoubleProperty& d) d.setValue(value); emit modified(); } - void SampleEditorController::setDoubleFromUndo(double value, const QString& path) { ASSERT(m_sampleForm); -- GitLab From 27ef935dba9a00466b3fe8945cabd377b4b1cde6 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:32:00 +0200 Subject: [PATCH 14/20] inline ..FromUndo fcts --- .../SampleDesigner/SampleEditorController.cpp | 24 ++++--------------- .../SampleDesigner/SampleEditorController.h | 4 ---- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index 2bc79bc0bdb..1c981a4b0a3 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -64,13 +64,8 @@ void SampleEditorController::addLayerItem(LayerItem* before) { const int i = (before != nullptr) ? m_sampleItem->layerItems().indexOf(before) : m_sampleItem->layerItems().size(); - addLayerItemFromUndo(i); -} -void SampleEditorController::addLayerItemFromUndo(int atIndex) -{ - QColor color = findColor(atIndex); // before adding layer - - LayerItem* layer = m_sampleItem->createLayerItemAt(atIndex); + QColor color = findColor(i); // before adding layer + LayerItem* layer = m_sampleItem->createLayerItemAt(i); layer->setMaterial(materialModel()->defaultMaterialItem()); layer->setColor(color); @@ -140,12 +135,6 @@ void SampleEditorController::duplicateLayerItem(const LayerItem* layer) void SampleEditorController::removeLayerItem(LayerItem* layer) { - const int i = sampleItem()->layerItems().indexOf(layer); - removeLayerItemFromUndo(i); -} -void SampleEditorController::removeLayerItemFromUndo(int atIndex) -{ - auto* layer = m_sampleItem->layerItems()[atIndex]; emit aboutToRemoveItem(layer); m_sampleForm->onAboutToRemoveLayer(layer); m_sampleItem->removeLayer(layer); @@ -358,18 +347,12 @@ void SampleEditorController::removeParticle(ItemWithParticles* itemToRemove) } void SampleEditorController::setDouble(double value, DoubleProperty& d) -{ - setDoubleFromUndo(value, d.uid()); - d.setValue(value); - emit modified(); -} -void SampleEditorController::setDoubleFromUndo(double value, const QString& path) { ASSERT(m_sampleForm); DoubleSpinBox* spinBox = nullptr; for (auto* s : m_sampleForm->findChildren<DoubleSpinBox*>()) { - if (s->uid() == path) { + if (s->uid() == d.uid()) { spinBox = s; break; } @@ -385,6 +368,7 @@ void SampleEditorController::setDoubleFromUndo(double value, const QString& path spinBox->setFocus(); spinBox->selectAll(); + d.setValue(value); emit modified(); } diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index d8a440b3138..395410ef7dc 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -130,10 +130,6 @@ private: ItemWithParticles* createAndInitItem(FormFactorItemCatalog::Type formFactorType) const; ItemWithParticles* createAndInitItem(ItemWithParticlesCatalog::Type itemType) const; - void addLayerItemFromUndo(int atIndex); - void removeLayerItemFromUndo(int atIndex); - void setDoubleFromUndo(double value, const QString& path); - SampleItem* m_sampleItem; SampleForm* m_sampleForm; ProjectDocument* m_document; -- GitLab From 7ff3bc3377816e308cc9546e2419b6c9fb3fb5a9 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:34:48 +0200 Subject: [PATCH 15/20] rm DoubleSpinBox::setPropertyValue --- GUI/View/Numeric/DoubleSpinBox.cpp | 8 -------- GUI/View/Numeric/DoubleSpinBox.h | 1 - GUI/View/SampleDesigner/SampleEditorController.cpp | 4 +--- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/GUI/View/Numeric/DoubleSpinBox.cpp b/GUI/View/Numeric/DoubleSpinBox.cpp index 0b7e6007263..c05af8522d2 100644 --- a/GUI/View/Numeric/DoubleSpinBox.cpp +++ b/GUI/View/Numeric/DoubleSpinBox.cpp @@ -40,14 +40,6 @@ QString DoubleSpinBox::uid() const return m_valueProperty.uid(); } -// This method is only used in undo/redo functionality in SampleEditorController -// On its removal the input arguments of DoubleSpinbox and GUI::Util::createDoubleSpinBoxRow -// can be changed to "const DoubleProperty&" -void DoubleSpinBox::setPropertyValue(double value) -{ - m_valueProperty.setValue(value); -} - void DoubleSpinBox::setBaseValue(double value) { QDoubleSpinBox::setValue(value); diff --git a/GUI/View/Numeric/DoubleSpinBox.h b/GUI/View/Numeric/DoubleSpinBox.h index 52a12504d06..f0592914ac6 100644 --- a/GUI/View/Numeric/DoubleSpinBox.h +++ b/GUI/View/Numeric/DoubleSpinBox.h @@ -31,7 +31,6 @@ public: //! Set the value void setBaseValue(double value); - void setPropertyValue(double v); QString uid() const; diff --git a/GUI/View/SampleDesigner/SampleEditorController.cpp b/GUI/View/SampleDesigner/SampleEditorController.cpp index 1c981a4b0a3..951f1f9c80e 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.cpp +++ b/GUI/View/SampleDesigner/SampleEditorController.cpp @@ -361,14 +361,12 @@ void SampleEditorController::setDouble(double value, DoubleProperty& d) if (!spinBox) return; - spinBox->setPropertyValue(value); + d.setValue(value); QSignalBlocker _(spinBox); spinBox->setBaseValue(value); spinBox->setFocus(); spinBox->selectAll(); - - d.setValue(value); emit modified(); } -- GitLab From b49b8fcfe50d14e5519c53747d9d0a3c2719aaa8 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:35:36 +0200 Subject: [PATCH 16/20] DoubleSpinBox::m_valueProperty now const --- GUI/View/Numeric/DoubleSpinBox.cpp | 2 +- GUI/View/Numeric/DoubleSpinBox.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/View/Numeric/DoubleSpinBox.cpp b/GUI/View/Numeric/DoubleSpinBox.cpp index c05af8522d2..eb6b067f540 100644 --- a/GUI/View/Numeric/DoubleSpinBox.cpp +++ b/GUI/View/Numeric/DoubleSpinBox.cpp @@ -16,7 +16,7 @@ #include "GUI/View/Numeric/NumberUtil.h" #include <QWheelEvent> -DoubleSpinBox::DoubleSpinBox(DoubleProperty& d, bool easyScrollable, QWidget* parent) +DoubleSpinBox::DoubleSpinBox(const DoubleProperty& d, bool easyScrollable, QWidget* parent) : QDoubleSpinBox(parent) , m_valueProperty(d) , m_easyScrollable(easyScrollable) diff --git a/GUI/View/Numeric/DoubleSpinBox.h b/GUI/View/Numeric/DoubleSpinBox.h index f0592914ac6..d891e84a74b 100644 --- a/GUI/View/Numeric/DoubleSpinBox.h +++ b/GUI/View/Numeric/DoubleSpinBox.h @@ -27,7 +27,7 @@ public: //! policy). Furthermore, the spin box will prohibit accidental changes by the mouse wheel. //! Otherwise it would be dangerous if the spin box is on a scrollable form - unintended and //! unnoticed changes would take place when just scrolling through the form. - DoubleSpinBox(DoubleProperty& d, bool easyScrollable = false, QWidget* parent = nullptr); + DoubleSpinBox(const DoubleProperty& d, bool easyScrollable = false, QWidget* parent = nullptr); //! Set the value void setBaseValue(double value); @@ -47,7 +47,7 @@ private: void wheelEvent(QWheelEvent* event) override; void onDisplayValueChanged(double newDisplayValue); - DoubleProperty& m_valueProperty; + const DoubleProperty& m_valueProperty; bool m_easyScrollable; }; -- GitLab From 47bb447d56f1d5c03fec64db7a92da5b6f36eeac Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:38:04 +0200 Subject: [PATCH 17/20] restore undo icon, used elsewhere --- .../FitObjective/ParameterTuningWidget.cpp | 2 +- GUI/gui.qrc | 107 +++++++++--------- GUI/images/undo.svg | 54 +++++++++ 3 files changed, 109 insertions(+), 54 deletions(-) create mode 100644 GUI/images/undo.svg diff --git a/GUI/View/FitObjective/ParameterTuningWidget.cpp b/GUI/View/FitObjective/ParameterTuningWidget.cpp index 0091910368c..0c593f35322 100644 --- a/GUI/View/FitObjective/ParameterTuningWidget.cpp +++ b/GUI/View/FitObjective/ParameterTuningWidget.cpp @@ -42,7 +42,7 @@ ParameterTuningWidget::ParameterTuningWidget(QWidget* parent) m_treeView->setDragDropMode(QAbstractItemView::NoDragDrop); m_treeView->setAttribute(Qt::WA_MacShowFocusRect, false); - auto* resetValuesAction = new QAction(QIcon(":/images/undo-variant.svg"), "Reset values", this); + auto* resetValuesAction = new QAction(QIcon(":/images/undo.svg"), "Reset values", this); resetValuesAction->setToolTip("Reset parameter tree to initial values"); connect(resetValuesAction, &QAction::triggered, this, &ParameterTuningWidget::restoreModelsOfCurrentJobItem); diff --git a/GUI/gui.qrc b/GUI/gui.qrc index 5683f2bf002..e61c21b021c 100644 --- a/GUI/gui.qrc +++ b/GUI/gui.qrc @@ -1,78 +1,79 @@ <RCC> <qresource prefix="/"> - <file>images/mode_script.png</file> - <file>images/reset.png</file> - <file>images/treeview-branch-closed.png</file> - <file>images/treeview-branch-end.png</file> - <file>images/treeview-branch-more.png</file> - <file>images/treeview-branch-open.png</file> - <file>images/treeview-vline.png</file> + <file>images/1D_Error.png</file> + <file>images/1D_OK.png</file> + <file>images/2D_OK.png</file> <file>images/BornAgain.ico</file> + <file>images/about_icon.awk</file> + <file>images/about_icon.png</file> + <file>images/alpha-f-box.svg</file> + <file>images/camera-metering-center.svg</file> + <file>images/caret-down.svg</file> + <file>images/caret-right.svg</file> + <file>images/caret-up.svg</file> + <file>images/checkbox-checked.svg</file> <file>images/collapse_arrow.png</file> - <file>images/library.svg</file> + <file>images/content-copy.svg</file> + <file>images/content-save-outline.svg</file> + <file>images/dark-angle-down.svg</file> + <file>images/dark-angle-up.svg</file> + <file>images/dark-close.svg</file> + <file>images/delete.svg</file> + <file>images/depth_instrument.svg</file> + <file>images/depth_instrument_new.svg</file> + <file>images/depth_instrument_shaded.svg</file> + <file>images/dock-close.svg</file> + <file>images/dock-float.svg</file> + <file>images/dock-right.svg</file> <file>images/expand_arrow.png</file> - <file>images/splashscreen.png</file> - <file>images/about_icon.png</file> - <file>images/warning@2x.png</file> + <file>images/gisas_instrument.svg</file> + <file>images/gisas_instrument_new.svg</file> + <file>images/gisas_instrument_shaded.svg</file> + <file>images/hand-right.svg</file> + <file>images/import.svg</file> + <file>images/library.svg</file> <file>images/magnifier.png</file> - <file>images/warning_64x64.png</file> - <file>images/statusbar_dockmenu.svg</file> - <file>images/statusbar_joblist.svg</file> - <file>images/main_sessionmodel.svg</file> - <file>images/toolbar_expand_collapse_tree.svg</file> <file>images/main_importview.svg</file> <file>images/main_instrumentview.svg</file> <file>images/main_jobview.svg</file> <file>images/main_sampleview.svg</file> + <file>images/main_sessionmodel.svg</file> <file>images/main_simulationview.svg</file> - <file>images/main_welcomeview.svg</file> <file>images/main_testview.svg</file> - <file>images/about_icon.awk</file> - <file>images/caret-down.svg</file> - <file>images/caret-up.svg</file> - <file>images/caret-right.svg</file> - <file>images/dock-close.svg</file> - <file>images/dock-float.svg</file> - <file>images/checkbox-checked.svg</file> - <file>images/radio-checked.svg</file> - <file>images/gisas_instrument.svg</file> - <file>images/gisas_instrument_new.svg</file> - <file>images/gisas_instrument_shaded.svg</file> + <file>images/main_welcomeview.svg</file> + <file>images/menu-open.svg</file> + <file>images/mode_script.png</file> + <file>images/move_up_down.svg</file> <file>images/offspec_instrument.svg</file> <file>images/offspec_instrument_new.svg</file> <file>images/offspec_instrument_shaded.svg</file> + <file>images/palette.svg</file> + <file>images/play.svg</file> + <file>images/radio-checked.svg</file> + <file>images/reset.png</file> + <file>images/rotate-left.svg</file> + <file>images/shape-square-plus.svg</file> <file>images/specular_instrument.svg</file> <file>images/specular_instrument_new.svg</file> <file>images/specular_instrument_shaded.svg</file> - <file>images/dark-angle-up.svg</file> - <file>images/dark-angle-down.svg</file> - <file>images/dark-close.svg</file> - <file>images/depth_instrument.svg</file> - <file>images/depth_instrument_new.svg</file> - <file>images/depth_instrument_shaded.svg</file> - <file>images/toolbar24dark_hambar.svg</file> - <file>images/import.svg</file> - <file>images/delete.svg</file> - <file>images/shape-square-plus.svg</file> - <file>images/content-copy.svg</file> - <file>images/palette.svg</file> - <file>images/play.svg</file> + <file>images/splashscreen.png</file> + <file>images/statusbar_dockmenu.svg</file> + <file>images/statusbar_joblist.svg</file> <file>images/stop.svg</file> - <file>images/alpha-f-box.svg</file> - <file>images/dock-right.svg</file> - <file>images/content-save-outline.svg</file> - <file>images/camera-metering-center.svg</file> - <file>images/hand-right.svg</file> - <file>images/menu-open.svg</file> - <file>images/move_up_down.svg</file> - <file>images/rotate-left.svg</file> - <file>images/1D_Error.png</file> - <file>images/1D_OK.png</file> - <file>images/2D_OK.png</file> + <file>images/toolbar24dark_hambar.svg</file> + <file>images/toolbar_expand_collapse_tree.svg</file> + <file>images/treeview-branch-closed.png</file> + <file>images/treeview-branch-end.png</file> + <file>images/treeview-branch-more.png</file> + <file>images/treeview-branch-open.png</file> + <file>images/treeview-vline.png</file> + <file>images/undo.svg</file> + <file>images/warning@2x.png</file> <file>images/warning_16x16.png</file> - <file>styles/Native.stylesheet</file> + <file>images/warning_64x64.png</file> <file>styles/Base.stylesheet</file> <file>styles/Dark.stylesheet</file> <file>styles/Light.stylesheet</file> + <file>styles/Native.stylesheet</file> </qresource> </RCC> diff --git a/GUI/images/undo.svg b/GUI/images/undo.svg new file mode 100644 index 00000000000..a8a7cdf8b7b --- /dev/null +++ b/GUI/images/undo.svg @@ -0,0 +1,54 @@ +<?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 From 7e6b886e7d75e29ff19de7168192569f1f00d68e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:40:56 +0200 Subject: [PATCH 18/20] update --- GUI/View/SampleDesigner/SampleEditorController.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 395410ef7dc..bc280a83121 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -42,9 +42,11 @@ class SelectionContainerForm; //! Class to modify a sample from the layer oriented sample editor. //! -//! Use this class to modify the sample model. It takes care of notifications and creating undo/redo -//! commands. +//! Use this class to modify the sample model. It takes care of notifications. //! It operates on one SampleItem. +//! +//! Originally, it also supported undo/redo (never completed, withdrawn in release 22). + class SampleEditorController : public QObject { Q_OBJECT public: -- GitLab From d1591b29859be70ad2efa1ef573f3c0ef5353b44 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:41:51 +0200 Subject: [PATCH 19/20] CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 28c2a43d5c3..58b32a06e4c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ BornAgain-22.0, in preparation > GUI changes: * Examples DepthProfile, Transmission: flattened DepthProbeSimulation * In sample model, removed possibility to set lengths in angstrom instead of nm (#756) + * Removed unfinished undo/redo support (#757) > Examples and documentation: > Bug fixes: > Internal refactoring: -- GitLab From 4101f26fc64453f1aa796d151b37af9f25a17a37 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 10 Oct 2023 14:49:42 +0200 Subject: [PATCH 20/20] clang-format --- GUI/View/SampleDesigner/SampleEditor.cpp | 3 +-- GUI/View/SampleDesigner/SampleView.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/GUI/View/SampleDesigner/SampleEditor.cpp b/GUI/View/SampleDesigner/SampleEditor.cpp index 7ff5299f361..57d67d970e6 100644 --- a/GUI/View/SampleDesigner/SampleEditor.cpp +++ b/GUI/View/SampleDesigner/SampleEditor.cpp @@ -66,8 +66,7 @@ void SampleEditor::setCurrentSample(SampleItem* sampleItem) auto* ec = m_editControllers[m_currentSample]; connect(ec, &SampleEditorController::requestViewInRealspace, this, &SampleEditor::requestViewInRealspace); - connect(ec, &SampleEditorController::aboutToRemoveItem, this, - &SampleEditor::aboutToRemoveItem); + connect(ec, &SampleEditorController::aboutToRemoveItem, this, &SampleEditor::aboutToRemoveItem); connect(ec, &SampleEditorController::modified, this, &SampleEditor::modified); createLayerColors(); diff --git a/GUI/View/SampleDesigner/SampleView.cpp b/GUI/View/SampleDesigner/SampleView.cpp index fe128580acd..20f32178d76 100644 --- a/GUI/View/SampleDesigner/SampleView.cpp +++ b/GUI/View/SampleDesigner/SampleView.cpp @@ -88,8 +88,7 @@ SampleView::SampleView(QWidget* parent, ProjectDocument* document) connect(m_sampleSelectionView, &SampleListView::currentSampleChanged, scriptPanel, &ScriptPanel::setCurrentSample); - connect(editor, &SampleEditor::modified, scriptPanel, - &ScriptPanel::onSampleModified); + connect(editor, &SampleEditor::modified, scriptPanel, &ScriptPanel::onSampleModified); connect(editor, &SampleEditor::modified, m_sampleSelectionView, &SampleListView::onSampleModified); @@ -97,11 +96,10 @@ SampleView::SampleView(QWidget* parent, ProjectDocument* document) connect(editor, &SampleEditor::requestViewInRealspace, this, &SampleView::onRequestViewInRealspace); - connect(editor, &SampleEditor::aboutToRemoveItem, this, - &SampleView::onAboutToRemoveItem); + connect(editor, &SampleEditor::aboutToRemoveItem, this, &SampleView::onAboutToRemoveItem); - connect(editor, &SampleEditor::requestCreateNewSample, - m_sampleSelectionView->newSampleAction(), &QAction::trigger, Qt::QueuedConnection); + connect(editor, &SampleEditor::requestCreateNewSample, m_sampleSelectionView->newSampleAction(), + &QAction::trigger, Qt::QueuedConnection); connect(editor, &SampleEditor::modified, m_realspacePanel->widget(), &RealspaceWidget::updateScene); -- GitLab