diff --git a/GUI/Views/SessionModelView.cpp b/GUI/Views/SessionModelView.cpp index 1685c3f67caf344a7c2dd844b3c3ed2ab01e7346..edc3b642a029579b4a0f41044e157c1d6b9517d0 100644 --- a/GUI/Views/SessionModelView.cpp +++ b/GUI/Views/SessionModelView.cpp @@ -22,6 +22,7 @@ #include "GUI/Views/SessionModelDelegate.h" #include "GUI/Views/TestView.h" #include "GUI/mainwindow/mainwindow.h" +#include "GUI/mainwindow/projectmanager.h" #include <QToolBar> #include <QToolButton> #include <QVBoxLayout> @@ -83,11 +84,12 @@ void SessionModelView::init_tabs() QList<SessionModel*> SessionModelView::modelsForTabs() { - QList<SessionModel*> result = QList<SessionModel*>() - << m_mainWindow->instrumentModel() << m_mainWindow->sampleModel() - << m_mainWindow->realDataModel() << m_mainWindow->materialModel() - << m_mainWindow->jobModel(); - return result; + auto doc = ProjectManager::instance()->document(); + if (!doc) + return {}; + + return {doc->instrumentModel(), doc->sampleModel(), doc->realDataModel(), doc->materialModel(), + doc->jobModel()}; } void SessionModelView::init_test_view() diff --git a/GUI/mainwindow/mainwindow.cpp b/GUI/mainwindow/mainwindow.cpp index 31f60fd659f8f19a8a5badb1ac8123740d724d76..bb02ee956a1db12ad4e7be7fe608c7a58847a8ca 100644 --- a/GUI/mainwindow/mainwindow.cpp +++ b/GUI/mainwindow/mainwindow.cpp @@ -137,21 +137,11 @@ MainWindow* MainWindow::instance() return s_instance; } -MaterialModel* MainWindow::materialModel() -{ - return models()->materialModel(); -} - InstrumentModel* MainWindow::instrumentModel() { return models()->instrumentModel(); } -SampleModel* MainWindow::sampleModel() -{ - return models()->sampleModel(); -} - RealDataModel* MainWindow::realDataModel() { return models()->realDataModel(); diff --git a/GUI/mainwindow/mainwindow.h b/GUI/mainwindow/mainwindow.h index 01567edc6cc4c64b40946cdfcea0db35a799f901..71ff463dea3c656903469306531df3b8e67880e7 100644 --- a/GUI/mainwindow/mainwindow.h +++ b/GUI/mainwindow/mainwindow.h @@ -55,9 +55,7 @@ public: //! Returns the one and only instance of this class static MainWindow* instance(); - MaterialModel* materialModel(); InstrumentModel* instrumentModel(); - SampleModel* sampleModel(); RealDataModel* realDataModel(); JobModel* jobModel(); ApplicationModels* models(); diff --git a/GUI/mainwindow/projectdocument.cpp b/GUI/mainwindow/projectdocument.cpp index b8d3a46c6c44210417d42a48610892b247227b46..7735bca154598b55f9a76a29727ac945f9e75bef 100644 --- a/GUI/mainwindow/projectdocument.cpp +++ b/GUI/mainwindow/projectdocument.cpp @@ -115,6 +115,16 @@ MaterialModel* ProjectDocument::materialModel() const return m_applicationModels != nullptr ? m_applicationModels->materialModel() : nullptr; } +RealDataModel* ProjectDocument::realDataModel() const +{ + return m_applicationModels != nullptr ? m_applicationModels->realDataModel() : nullptr; +} + +JobModel* ProjectDocument::jobModel() const +{ + return m_applicationModels != nullptr ? m_applicationModels->jobModel() : nullptr; +} + void ProjectDocument::save(const QString& project_file_name, bool autoSave) { saveProjectData(project_file_name); diff --git a/GUI/mainwindow/projectdocument.h b/GUI/mainwindow/projectdocument.h index 727aeba832bde77cec6181d775c0b34ebbfe3c43..34a43c0c1473200e20cb07d49f07b74d5fb82a7d 100644 --- a/GUI/mainwindow/projectdocument.h +++ b/GUI/mainwindow/projectdocument.h @@ -24,6 +24,8 @@ class OutputDataIOService; class InstrumentModel; class SampleModel; class MaterialModel; +class RealDataModel; +class JobModel; //! Project document class handles all data related to the opened project //! (sample, jobModel, project specific windows settings) @@ -56,6 +58,9 @@ public: InstrumentModel* instrumentModel() const; SampleModel* sampleModel() const; MaterialModel* materialModel() const; + RealDataModel* realDataModel() const; + JobModel* jobModel() const; + void save(const QString& project_file_name, bool autoSave = false);