diff --git a/GUI/coregui/Models/GUIExamplesFactory.cpp b/GUI/coregui/Models/GUIExamplesFactory.cpp index fc9233456e9bc2f72ef4b09b05d443a06c18f426..3a81190cce92663bf3c4e814de36fc165f7a3544 100644 --- a/GUI/coregui/Models/GUIExamplesFactory.cpp +++ b/GUI/coregui/Models/GUIExamplesFactory.cpp @@ -2,7 +2,7 @@ #include "GUIObjectBuilder.h" #include "SampleBuilderFactory.h" #include "SimulationRegistry.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "SampleModel.h" #include "GUIHelpers.h" #include <QDebug> @@ -47,7 +47,7 @@ ParameterizedItem *GUIExamplesFactory::createSampleItems(const QString &name, Sa //return guiBuilder.getTopItem(); } -ParameterizedItem *GUIExamplesFactory::createInstrumentItems(const QString &name, SessionModel *instrumentModel) +ParameterizedItem *GUIExamplesFactory::createInstrumentItems(const QString &name, InstrumentModel *instrumentModel) { if(instrumentModel->getModelTag() != SessionXML::InstrumentModelTag ) { throw GUIHelpers::Error("GUIExamplesFactory::createInstrumentItems() -> Error. Not an InstrumentModelTag"); diff --git a/GUI/coregui/Models/GUIExamplesFactory.h b/GUI/coregui/Models/GUIExamplesFactory.h index 3c525dc6234ddef308ad3c5abf31fd0fa72ed68f..4b00ac5540ee7b03407067ac6b95d396befdd81d 100644 --- a/GUI/coregui/Models/GUIExamplesFactory.h +++ b/GUI/coregui/Models/GUIExamplesFactory.h @@ -5,7 +5,7 @@ #include <QString> class ParameterizedItem; -class SessionModel; +class InstrumentModel; class SampleModel; //! Class that generates GUI model from @@ -15,7 +15,7 @@ public: static bool isValidExampleName(const QString &name); static ParameterizedItem *createSampleItems(const QString &name, SampleModel *sampleModel); - static ParameterizedItem *createInstrumentItems(const QString &name, SessionModel *instrumentModel); + static ParameterizedItem *createInstrumentItems(const QString &name, InstrumentModel *instrumentModel); private: diff --git a/GUI/coregui/Models/GUIObjectBuilder.cpp b/GUI/coregui/Models/GUIObjectBuilder.cpp index fe67b6cc3585a9d330e9a7eaf24d1d69c8e27307..77304f969e7409bc6a640ee4f4cdb9239b2316c7 100644 --- a/GUI/coregui/Models/GUIObjectBuilder.cpp +++ b/GUI/coregui/Models/GUIObjectBuilder.cpp @@ -1,5 +1,5 @@ #include "GUIObjectBuilder.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "SampleModel.h" #include "Units.h" #include "LayerItem.h" @@ -44,8 +44,7 @@ ParameterizedItem *GUIObjectBuilder::populateSampleModel(SampleModel *sampleMode return m_levelToParent[0]; } -ParameterizedItem *GUIObjectBuilder::populateInstrumentModel( - SessionModel *instrumentModel, Instrument *instrument) +ParameterizedItem *GUIObjectBuilder::populateInstrumentModel(InstrumentModel *instrumentModel, Instrument *instrument) { Q_UNUSED(instrumentModel); Q_UNUSED(instrument); diff --git a/GUI/coregui/Models/GUIObjectBuilder.h b/GUI/coregui/Models/GUIObjectBuilder.h index d65c9101025c700df07987df78b89ed6e83bbb1a..8a539e308bd0f6aab4c85e464d60cdcbc2b2376d 100644 --- a/GUI/coregui/Models/GUIObjectBuilder.h +++ b/GUI/coregui/Models/GUIObjectBuilder.h @@ -22,11 +22,11 @@ #include "MaterialProperty.h" #include <QMap> -class SessionModel; +class InstrumentModel; class SampleModel; class ParameterizedItem; -//! Class to build SessionModel from domain's ISample +//! Class to build SampleModel and InstrumentModel from domain's ISample class GUIObjectBuilder : public ISampleVisitor { public: @@ -35,7 +35,7 @@ public: ParameterizedItem *populateSampleModel(SampleModel *sampleModel, ISample *sample); - ParameterizedItem *populateInstrumentModel(SessionModel *instrumentModel, + ParameterizedItem *populateInstrumentModel(InstrumentModel *instrumentModel, Instrument *instrument); using ISampleVisitor::visit; diff --git a/GUI/coregui/Models/InstrumentModel.cpp b/GUI/coregui/Models/InstrumentModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d96164990ab82db76bc862e848a74d1ac82c0dc4 --- /dev/null +++ b/GUI/coregui/Models/InstrumentModel.cpp @@ -0,0 +1,7 @@ +#include "InstrumentModel.h" + +InstrumentModel::InstrumentModel(QObject *parent) + : SessionModel(SessionXML::InstrumentModelTag, parent) +{ + +} diff --git a/GUI/coregui/Models/InstrumentModel.h b/GUI/coregui/Models/InstrumentModel.h new file mode 100644 index 0000000000000000000000000000000000000000..a44b80c001d37f9ff481cf5e3e5a0a4c1c8c796d --- /dev/null +++ b/GUI/coregui/Models/InstrumentModel.h @@ -0,0 +1,19 @@ +#ifndef INSTRUMENTMODEL_H +#define INSTRUMENTMODEL_H + +#include "SessionModel.h" + +class InstrumentModel : public SessionModel +{ + Q_OBJECT + +public: + explicit InstrumentModel(QObject *parent = 0); + ~InstrumentModel(){} + +}; + + + + +#endif diff --git a/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.cpp b/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.cpp index 3c836c164871f10858e4ad98ffdcd48a3290a2d7..f90472054278e7b439164d69f26a55c3d3f4e0e6 100644 --- a/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.cpp +++ b/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.cpp @@ -1,5 +1,5 @@ #include "InstrumentSelectorWidget.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "ParameterizedItem.h" #include <QListView> #include <QVBoxLayout> @@ -8,7 +8,7 @@ #include <QAction> #include <QDebug> -InstrumentSelectorWidget::InstrumentSelectorWidget(SessionModel *model, QWidget *parent) +InstrumentSelectorWidget::InstrumentSelectorWidget(InstrumentModel *model, QWidget *parent) : QWidget(parent) , m_instrumentModel(0) , m_listView(0) @@ -69,7 +69,7 @@ InstrumentSelectorWidget::InstrumentSelectorWidget(SessionModel *model, QWidget -void InstrumentSelectorWidget::setInstrumentModel(SessionModel *model) +void InstrumentSelectorWidget::setInstrumentModel(InstrumentModel *model) { Q_ASSERT(model); Q_ASSERT(m_listView); diff --git a/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.h b/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.h index 31a038784a77d5d8a204e44f43697b9d233a28c1..2607cecad02e92cb98946819a0ee9c2e7015bee8 100644 --- a/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.h +++ b/GUI/coregui/Views/Components/InstrumentWidgets/InstrumentSelectorWidget.h @@ -3,7 +3,7 @@ #include <QWidget> -class SessionModel; +class InstrumentModel; class QListView; class QAction; class QItemSelectionModel; @@ -14,12 +14,12 @@ class InstrumentSelectorWidget : public QWidget Q_OBJECT public: - InstrumentSelectorWidget(SessionModel *model, QWidget *parent = 0); + InstrumentSelectorWidget(InstrumentModel *model, QWidget *parent = 0); QSize sizeHint() const { return QSize(200, 600); } QSize minimumSizeHint() const { return QSize(128, 300); } - void setInstrumentModel(SessionModel *model); + void setInstrumentModel(InstrumentModel *model); QItemSelectionModel *getSelectionModel(); QListView *getListView() { return m_listView; } @@ -31,7 +31,7 @@ public slots: // void onRowsInserted(const QModelIndex &parent, int first, int last); private: - SessionModel *m_instrumentModel; + InstrumentModel *m_instrumentModel; QListView *m_listView; }; diff --git a/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.cpp b/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.cpp index 13ce718178766325fc9b20924a4920e83f7301cd..b245376e98e05a493df294ef09029f2521a670b8 100644 --- a/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.cpp +++ b/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.cpp @@ -1,6 +1,6 @@ #include "DesignerScene.h" #include "DesignerHelper.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "SampleModel.h" #include "SampleViewFactory.h" #include "SampleViewAligner.h" @@ -75,7 +75,7 @@ void DesignerScene::setSampleModel(SampleModel *sampleModel) } } -void DesignerScene::setInstrumentModel(SessionModel *instrumentModel) +void DesignerScene::setInstrumentModel(InstrumentModel *instrumentModel) { m_instrumentModel = instrumentModel; } diff --git a/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.h b/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.h index 9db249cc52de4878f2a528a41e689c3bb7ed0220..18377660b6f8018bea91a18624ba1a55f7733022 100644 --- a/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.h +++ b/GUI/coregui/Views/Components/SampleDesigner/DesignerScene.h @@ -6,7 +6,7 @@ #include <QModelIndex> #include <QMap> -class SessionModel; +class InstrumentModel; class SampleModel; class ParameterizedItem; class ParameterizedGraphicsItem; @@ -29,7 +29,7 @@ public: virtual ~DesignerScene(); void setSampleModel(SampleModel *sampleModel); - void setInstrumentModel(SessionModel *instrumentModel); + void setInstrumentModel(InstrumentModel *instrumentModel); void setSelectionModel(QItemSelectionModel *model); SampleModel *getSampleModel() { return m_sampleModel; } @@ -79,7 +79,7 @@ private: // ParameterizedItem *dropCompleteSample(const QString &name); SampleModel *m_sampleModel; - SessionModel *m_instrumentModel; + InstrumentModel *m_instrumentModel; QItemSelectionModel *m_selectionModel; bool m_block_selection; diff --git a/GUI/coregui/Views/Components/SampleDesigner/ILayerView.cpp b/GUI/coregui/Views/Components/SampleDesigner/ILayerView.cpp index 01580e3d705e43dab18f7c1091922c4653721f5b..e0bb87e95655c07e82d981bcfe5840d402ee8abc 100644 --- a/GUI/coregui/Views/Components/SampleDesigner/ILayerView.cpp +++ b/GUI/coregui/Views/Components/SampleDesigner/ILayerView.cpp @@ -56,7 +56,7 @@ void ILayerView::onPropertyChange(const QString &propertyName) void ILayerView::setParameterizedItem(ParameterizedItem *item) { - QVariant v = item->property("Material"); + QVariant v = item->property(LayerItem::P_MATERIAL.toUtf8().constData()); if(v.isValid()) { MaterialProperty mp = v.value<MaterialProperty>(); setColor(mp.getColor()); diff --git a/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.cpp b/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.cpp index da6f3761749560a9833dc63c4d429c0010dfe8fb..68b23a87111ea2eeb070668a93445d06bd0b6b9e 100644 --- a/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.cpp +++ b/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.cpp @@ -25,7 +25,7 @@ void SampleDesigner::setSampleModel(SampleModel *sampleModel) if(sampleModel) m_designerScene->setSampleModel(sampleModel); } -void SampleDesigner::setInstrumentModel(SessionModel *instrumentModel) +void SampleDesigner::setInstrumentModel(InstrumentModel *instrumentModel) { if(instrumentModel) m_designerScene->setInstrumentModel(instrumentModel); } diff --git a/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.h b/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.h index 58f683458f132edfe76b13ae2e0ca7ebf2dcdf9e..2224792e4244e1739630c32c99dc80cedb5eab34 100644 --- a/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.h +++ b/GUI/coregui/Views/Components/SampleDesigner/SampleDesigner.h @@ -9,7 +9,8 @@ class DesignerScene; class SamplePropertyEditor; class DesignerWidgetFactory; -class SessionModel; +class InstrumentModel; +class SampleModel; //! sample designer interface class SampleDesignerInterface : public QObject @@ -41,7 +42,7 @@ public: QWidget *getCentralWidget() { return m_designerView; } void setSampleModel(SampleModel *sampleModel); - void setInstrumentModel(SessionModel *instrumentModel); + void setInstrumentModel(InstrumentModel *instrumentModel); void setSelectionModel(QItemSelectionModel *model); public slots: diff --git a/GUI/coregui/Views/InstrumentView.cpp b/GUI/coregui/Views/InstrumentView.cpp index 26806a859c9f5ef9f215a23b5ed086617bd52023..f4901fa876f6b8154d2d588ba82f038d48bba748 100644 --- a/GUI/coregui/Views/InstrumentView.cpp +++ b/GUI/coregui/Views/InstrumentView.cpp @@ -1,5 +1,5 @@ #include "InstrumentView.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "InstrumentSelectorWidget.h" #include "InstrumentEditorWidget.h" #include "styledbar.h" @@ -16,7 +16,7 @@ #include <QToolBar> -InstrumentView::InstrumentView(SessionModel *model, QWidget *parent) +InstrumentView::InstrumentView(InstrumentModel *model, QWidget *parent) : QWidget(parent) , m_instrumentModel(model) , m_toolBar(new QToolBar(this)) diff --git a/GUI/coregui/Views/InstrumentView.h b/GUI/coregui/Views/InstrumentView.h index a46f89bd946687bcfa7eedb17314c17d701314dd..0fcd512a17b7b28e4046d824acaddc07919fe5b7 100644 --- a/GUI/coregui/Views/InstrumentView.h +++ b/GUI/coregui/Views/InstrumentView.h @@ -5,7 +5,7 @@ #include <QMap> class InstrumentSelectorWidget; class InstrumentEditorWidget; -class SessionModel; +class InstrumentModel; class QListView; class QStackedWidget; class QMenu; @@ -23,7 +23,7 @@ class InstrumentView : public QWidget Q_OBJECT public: - InstrumentView(SessionModel *model, QWidget *parent = 0); + InstrumentView(InstrumentModel *model, QWidget *parent = 0); public slots: void onSelectionChanged(const QItemSelection&, const QItemSelection&); @@ -34,7 +34,7 @@ public slots: private: void createActions(); - SessionModel *m_instrumentModel; + InstrumentModel *m_instrumentModel; QToolBar *m_toolBar; InstrumentSelectorWidget *m_instrumentSelector; QStackedWidget *m_stackWidget; diff --git a/GUI/coregui/Views/SampleView.cpp b/GUI/coregui/Views/SampleView.cpp index 7e7adb339c3df113932086f06a639f886a0b29c3..fcb990ea44533157355c75d1a457917c4b692856 100644 --- a/GUI/coregui/Views/SampleView.cpp +++ b/GUI/coregui/Views/SampleView.cpp @@ -21,7 +21,7 @@ #endif -SampleView::SampleView(SampleModel *sampleModel, SessionModel *instrumentModel, QWidget *parent) +SampleView::SampleView(SampleModel *sampleModel, InstrumentModel *instrumentModel, QWidget *parent) : Manhattan::FancyMainWindow(parent) // , m_materialBrowser(MaterialBrowser::instance()) , m_sampleDesigner(new SampleDesigner(this)) diff --git a/GUI/coregui/Views/SampleView.h b/GUI/coregui/Views/SampleView.h index 26c55cfafbf7ba20e45f04961311d614f27020c7..30c54ede15817bb4416f99c9b7d654dfc0dd6503 100644 --- a/GUI/coregui/Views/SampleView.h +++ b/GUI/coregui/Views/SampleView.h @@ -10,9 +10,9 @@ #include <QSignalMapper> #include <QItemSelectionModel> -#include "SampleModel.h" - +class SampleModel; +class InstrumentModel; class SampleDesignerInterface; class SampleDesigner; class SampleToolBar; @@ -34,7 +34,7 @@ public: NumberOfSubWindows }; - SampleView(SampleModel *sampleModel, SessionModel *instrumentModel, QWidget *parent = 0); + SampleView(SampleModel *sampleModel, InstrumentModel *instrumentModel, QWidget *parent = 0); virtual ~SampleView(); public slots: @@ -70,7 +70,7 @@ private: QAction *m_delete_item_action; SampleModel *m_sampleModel; - SessionModel *m_instrumentModel; + InstrumentModel *m_instrumentModel; QTreeView *m_tree_view; QItemSelectionModel *m_selection_model; diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 3f7e9ad68e207db22238d7ffc8462c54fa67a1b3..0b47ad962a794141fbd0001e48a097f1be81d1b1 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -14,6 +14,7 @@ #include "SimulationDataModel.h" #include "JobQueueModel.h" #include "MaterialModel.h" +#include "InstrumentModel.h" #include "MaterialEditor.h" #include "Instrument.h" #include "Units.h" @@ -40,6 +41,7 @@ #include "ParticleCoreShellItem.h" #include "FancyGroupProperty.h" #include "ScientificDoubleProperty.h" +#include "SampleModel.h" #include <QApplication> #include <QStatusBar> @@ -263,7 +265,7 @@ void MainWindow::initJobQueueModel() void MainWindow::initInstrumentModel() { delete m_instrumentModel; - m_instrumentModel = new SessionModel(SessionXML::InstrumentModelTag); + m_instrumentModel = new InstrumentModel(); m_instrumentModel->setIconProvider(new IconProvider()); ParameterizedItem *instrument1 = m_instrumentModel->insertNewItem(Constants::InstrumentType); diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index 35ef224ee0854c17a976311b920380afc525303d..823c8ed64214a20f5505ac1a47f8a2d5e9a3cf08 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -25,7 +25,7 @@ class ProjectManager; class QCloseEvent; class QSettings; class JobQueueModel; -class SessionModel; +class InstrumentModel; class MaterialEditor; class ToolTipDataBase; class TestView; @@ -45,7 +45,7 @@ public: SimulationDataModel *getSimulationDataModel() { return mp_sim_data_model; } MaterialModel *getMaterialModel() { return m_materialModel; } - SessionModel *getInstrumentModel() { return m_instrumentModel; } + InstrumentModel *getInstrumentModel() { return m_instrumentModel; } SampleModel *getSampleModel() { return m_sampleModel; } JobQueueModel *getJobQueueModel() { return m_jobQueueModel; } Manhattan::ProgressBar *getProgressBar() { return m_progressBar; } @@ -80,7 +80,7 @@ private: SimulationDataModel *mp_sim_data_model; JobQueueModel *m_jobQueueModel; //!< model for all jobs SampleModel *m_sampleModel; //!< model for all samples - SessionModel *m_instrumentModel; //!< model for all instruments + InstrumentModel *m_instrumentModel; //!< model for all instruments MaterialModel *m_materialModel; //!< model for all materials MaterialEditor *m_materialEditor; ToolTipDataBase *m_toolTipDataBase; diff --git a/GUI/coregui/mainwindow/projectdocument.cpp b/GUI/coregui/mainwindow/projectdocument.cpp index d79973a697b6bfbd7dec11d66db531668ada8ea8..f7f5de1b89a61e965bada592902cc1127362484b 100644 --- a/GUI/coregui/mainwindow/projectdocument.cpp +++ b/GUI/coregui/mainwindow/projectdocument.cpp @@ -1,6 +1,6 @@ #include "projectdocument.h" #include "MaterialModel.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "JobQueueModel.h" #include "JobItem.h" #include "OutputDataItem.h" @@ -77,7 +77,7 @@ void ProjectDocument::setMaterialModel(MaterialModel *materialModel) } } -void ProjectDocument::setInstrumentModel(SessionModel *model) +void ProjectDocument::setInstrumentModel(InstrumentModel *model) { if(model != m_instrumentModel) { if(m_instrumentModel) disconnect(m_instrumentModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(onDataChanged(QModelIndex, QModelIndex)) ); diff --git a/GUI/coregui/mainwindow/projectdocument.h b/GUI/coregui/mainwindow/projectdocument.h index 31b75410830a915ca0c8ef07b1ad12e616594986..eed6eda69b95221c6a010beadf9203887a0e4e37 100644 --- a/GUI/coregui/mainwindow/projectdocument.h +++ b/GUI/coregui/mainwindow/projectdocument.h @@ -8,7 +8,7 @@ class JobQueueModel; class QIODevice; class QModelIndex; class JobItem; -class SessionModel; +class InstrumentModel; class MaterialModel; class SampleModel; @@ -51,7 +51,7 @@ public: bool isModified() { return m_modified; } void setMaterialModel(MaterialModel *materialModel); - void setInstrumentModel(SessionModel *model); + void setInstrumentModel(InstrumentModel *model); void setSampleModel(SampleModel *model); void setJobQueueModel(JobQueueModel *model); @@ -73,7 +73,7 @@ private: QString m_project_path; QString m_project_name; MaterialModel *m_materialModel; - SessionModel *m_instrumentModel; + InstrumentModel *m_instrumentModel; SampleModel *m_sampleModel; JobQueueModel *m_jobQueueModel; bool m_modified; diff --git a/GUI/coregui/utils/GUIFunctionalTest.cpp b/GUI/coregui/utils/GUIFunctionalTest.cpp index 59b863d8d9d7e3f68d27f1ab2d93e4602bb683c2..57b6ce0e230d761efaf6ebc47c56d810c2368364 100644 --- a/GUI/coregui/utils/GUIFunctionalTest.cpp +++ b/GUI/coregui/utils/GUIFunctionalTest.cpp @@ -1,7 +1,7 @@ #include "GUIFunctionalTest.h" #include "SimulationRegistry.h" #include "GUIObjectBuilder.h" -#include "SessionModel.h" +#include "InstrumentModel.h" #include "SampleModel.h" #include "MaterialEditor.h" #include "MaterialModel.h" @@ -61,7 +61,7 @@ void GUIFunctionalTest::createDomainSimulation() assert(m_reference_simulation->getSample()); // initializing necessary GUI boost::scoped_ptr<SampleModel> sampleModel(new SampleModel()); - boost::scoped_ptr<SessionModel> instrumentModel(new SessionModel(SessionXML::InstrumentModelTag)); + boost::scoped_ptr<InstrumentModel> instrumentModel(new InstrumentModel()); boost::scoped_ptr<MaterialModel> materialModel(new MaterialModel()); boost::scoped_ptr<MaterialEditor> materialEditor(new MaterialEditor(materialModel.get()));