Skip to content
Snippets Groups Projects
Commit 68cdae59 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rename LayerOrientedSampleEditor -> SampleEditor

parent 2960e7ad
No related branches found
No related tags found
1 merge request!2005rm unfinished undo/redo engine (#757)
......@@ -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);
......
......@@ -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
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment