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

pointerize member, fwd decl

parent 1b30d69d
No related branches found
No related tags found
1 merge request!2263make full use of gDoc being global
......@@ -13,6 +13,7 @@
// ************************************************************************************************
#include "GUI/View/Instrument/InstrumentListing.h"
#include "GUI/Model/Device/InstrumentLibrary.h"
#include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/View/Instrument/InstrumentLibraryEditor.h"
#include "GUI/View/Instrument/InstrumentListModel.h"
......@@ -22,11 +23,12 @@
#include <QVBoxLayout>
InstrumentListing::InstrumentListing()
: m_model(new InstrumentListModel(this, gDoc->multiNotifier()))
: m_instrumentLibrary(std::make_unique<InstrumentLibrary>())
, m_model(new InstrumentListModel(this, gDoc->multiNotifier()))
, m_separatorAction1(new QAction(this))
, m_separatorAction2(new QAction(this))
{
m_instrumentLibrary.load();
m_instrumentLibrary->load();
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
setViewMode(QListView::IconMode);
......@@ -104,7 +106,7 @@ InstrumentListing::InstrumentListing()
InstrumentListing::~InstrumentListing()
{
m_instrumentLibrary.saveIfModified();
m_instrumentLibrary->saveIfModified();
}
QSize InstrumentListing::sizeHint() const
......@@ -199,19 +201,19 @@ void InstrumentListing::onStoreInLibrary()
QModelIndex idx = selectionModel()->selectedIndexes().front();
InstrumentItem* instrument = m_model->instrumentItemForIndex(idx);
InstrumentLibraryEditor dlg(GUI::Global::mainWindow, &m_instrumentLibrary);
InstrumentLibraryEditor dlg(GUI::Global::mainWindow, m_instrumentLibrary.get());
dlg.execAdd(*instrument);
}
void InstrumentListing::onLoadFromLibrary()
{
if (m_instrumentLibrary.isEmpty()) {
if (m_instrumentLibrary->isEmpty()) {
QMessageBox::information(GUI::Global::mainWindow, "Select from library",
"The library does not contain instruments so far.");
return;
}
InstrumentLibraryEditor dlg(GUI::Global::mainWindow, &m_instrumentLibrary);
InstrumentLibraryEditor dlg(GUI::Global::mainWindow, m_instrumentLibrary.get());
auto* instrumentToCopy = dlg.execChoose();
if (instrumentToCopy == nullptr)
......
......@@ -15,10 +15,10 @@
#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTING_H
#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTING_H
#include "GUI/Model/Device/InstrumentLibrary.h"
#include <QListView>
class InstrumentItem;
class InstrumentLibrary;
class InstrumentListModel;
//! Instrument selector on the left side of InstrumentView.
......@@ -58,7 +58,7 @@ private:
void restoreSelection();
private:
InstrumentLibrary m_instrumentLibrary;
std::unique_ptr<InstrumentLibrary> m_instrumentLibrary;
InstrumentListModel* m_model;
QAction* m_newGisasAction;
QAction* m_newOffspecAction;
......
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