diff --git a/GUI/View/Setup/FrameActions.cpp b/GUI/View/Setup/FrameActions.cpp index a08225d2ab719f7a33649c4bd570286116dcb062..36a35eea15159cb3987971c0e471ad0a6fe6aaec 100644 --- a/GUI/View/Setup/FrameActions.cpp +++ b/GUI/View/Setup/FrameActions.cpp @@ -76,22 +76,6 @@ FrameActions::FrameActions() cycle_data2d_edit_mode->setIcon(QIcon(":/images/sprocket3.svg")); cycle_data2d_edit_mode->setToolTip("Cycle data 2d edit mode: Data, Mask, Projection"); - new_gisas_instrument = new QAction("New GISAS"); - new_gisas_instrument->setIcon(QIcon(":/images/shape-square-plus.svg")); - new_gisas_instrument->setToolTip("Add new GISAS instrument with default settings"); - - new_offspec_instrument = new QAction("New off-specular"); - new_offspec_instrument->setIcon(QIcon(":/images/shape-square-plus.svg")); - new_offspec_instrument->setToolTip("Add new off-specular instrument with default settings"); - - new_specular_instrument = new QAction("New specular"); - new_specular_instrument->setIcon(QIcon(":/images/shape-square-plus.svg")); - new_specular_instrument->setToolTip("Add new specular instrument with default settings"); - - new_depthprobe_instrument = new QAction("New depth probe"); - new_depthprobe_instrument->setIcon(QIcon(":/images/shape-square-plus.svg")); - new_depthprobe_instrument->setToolTip("Add new depth probe instrument with default settings"); - remove_instrument = ActionFactory::createRemoveAction("instrument"); copy_instrument = ActionFactory::createCopyAction("instrument"); diff --git a/GUI/View/Setup/FrameActions.h b/GUI/View/Setup/FrameActions.h index e2cf29951fb5a4cc4ec61066719816055ef1dbe9..8b738a199603dd32740575d44ca545ab1e5315a4 100644 --- a/GUI/View/Setup/FrameActions.h +++ b/GUI/View/Setup/FrameActions.h @@ -46,10 +46,6 @@ public: QAction* cycle_data2d_edit_mode; - QAction* new_gisas_instrument; - QAction* new_offspec_instrument; - QAction* new_specular_instrument; - QAction* new_depthprobe_instrument; QAction* remove_instrument; QAction* copy_instrument; QAction* store_in_library_instrument; diff --git a/GUI/View/Views/InstrumentView.cpp b/GUI/View/Views/InstrumentView.cpp index 0ea19abff94fd5ae1bd1f868f806be317fab150c..7804888a8275d02d764976f559dd0447109c33a7 100644 --- a/GUI/View/Views/InstrumentView.cpp +++ b/GUI/View/Views/InstrumentView.cpp @@ -45,10 +45,26 @@ InstrumentView::InstrumentView() layout->addWidget(toolbar); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - toolbar->addAction(gActions->new_gisas_instrument); - toolbar->addAction(gActions->new_offspec_instrument); - toolbar->addAction(gActions->new_specular_instrument); - toolbar->addAction(gActions->new_depthprobe_instrument); + auto new_action = [toolbar](const QString& name, const QString& description) { + QAction* a = new QAction("New " + name); + a->setIcon(QIcon(":/images/shape-square-plus.svg")); + a->setToolTip("Add new " + description + " instrument with default settings"); + toolbar->addAction(a); + return a; + }; + + connect(new_action("GISAS", "2D scattering"), &QAction::triggered, + [this] { m_qlistmodel->pushInstrument(new Scatter2DInstrumentItem); }); + + connect(new_action("offspec", "off-specular"), &QAction::triggered, + [this] { m_qlistmodel->pushInstrument(new OffspecInstrumentItem); }); + + connect(new_action("specular", "specular reflectivity"), &QAction::triggered, + [this] { m_qlistmodel->pushInstrument(new SpecularInstrumentItem); }); + + connect(new_action("depthprobe", "depth intensity profile"), &QAction::triggered, + [this] { m_qlistmodel->pushInstrument(new DepthprobeInstrumentItem); }); + toolbar->addAction(gActions->remove_instrument); toolbar->addAction(gActions->copy_instrument); toolbar->addAction(gActions->store_in_library_instrument); @@ -74,18 +90,6 @@ InstrumentView::InstrumentView() //... Finalize - connect(gActions->new_gisas_instrument, &QAction::triggered, - [this] { m_qlistmodel->pushInstrument(new Scatter2DInstrumentItem); }); - - connect(gActions->new_offspec_instrument, &QAction::triggered, - [this] { m_qlistmodel->pushInstrument(new OffspecInstrumentItem); }); - - connect(gActions->new_specular_instrument, &QAction::triggered, - [this] { m_qlistmodel->pushInstrument(new SpecularInstrumentItem); }); - - connect(gActions->new_depthprobe_instrument, &QAction::triggered, - [this] { m_qlistmodel->pushInstrument(new DepthprobeInstrumentItem); }); - connect(gActions->remove_instrument, &QAction::triggered, m_qlistmodel, &InstrumentsQModel::removeInstrument);