BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Project document class handles all data related to the opened project (sample, job, project specific settings).
It also provides signaling regarding changes in the current document data.
e.g. if project file is /home/users/development/Untitled/Untitled.pro projectName() - 'Untitled' projectDir() - '/home/users/development/Untitled projectFileName() - '/home/users/development/Untitled/Untitled.pro'
Definition at line 43 of file ProjectDocument.h.
Public Types | |
enum | Functionality { None = 0x0 , Gisas = 0x1 , Offspec = 0x2 , Specular = 0x4 , DepthProbe = 0x8 , All = Gisas | Offspec | Specular | DepthProbe } |
enum class | ReadResult { ok , warning , error } |
Signals | |
void | functionalitiesChanged () |
Emitted when functionality has changed. More... | |
void | modified () |
Emitted for any modifications in the document. More... | |
void | singleInstrumentModeChanged () |
Emitted when single instrument mode has changed. More... | |
void | singleSampleModeChanged () |
Emitted when single sample mode has changed. More... | |
Public Member Functions | |
ProjectDocument () | |
void | clearModified () |
InstrumentCollection * | collectedItems () const |
QString | documentVersion () const |
Functionalities | functionalities () const |
bool | hasData () const |
bool | hasValidNameAndPath () |
InstrumentsEditController * | instrumentsEditController () |
The edit controller for the instruments in this project document. More... | |
bool | isModified () const |
JobModel * | jobModel () const |
LinkInstrumentManager * | linkInstrumentManager () |
ReadResult | loadProjectFile (const QString &project_file_name, MessageService &messageService) |
QString | projectDir () const |
QString | projectFileName () const |
QString | projectName () const |
RealDataModel * | realDataModel () const |
MultiLayerItems * | sampleItems () |
void | save (const QString &project_file_name, bool autoSave=false) |
void | saveProjectData (const QString &project_file_name) |
void | saveProjectFile (const QString &project_file_name, bool autoSave=false) |
void | setFunctionalities (const Functionalities &f) |
void | setModified () |
void | setProjectDir (const QString &text) |
void | setProjectFileName (const QString &projectFileName) |
void | setProjectName (const QString &text) |
void | setSingleInstrumentMode (bool b) |
void | setSingleSampleMode (bool b) |
SimulationOptionsItem * | simulationOptionsItem () |
bool | singleInstrumentMode () const |
bool | singleSampleMode () const |
QString | userExportDir () const |
Returns directory name suitable for saving plots. More... | |
QString | validProjectDir () const |
Private Member Functions | |
void | connectModels () |
void | disconnectModels () |
void | onModelChanged () |
ReadResult | readProject (QIODevice *device, MessageService &messageService) |
void | writeTo (QIODevice *device) |
Private Attributes | |
ApplicationModels | m_applicationModels |
QString | m_currentVersion |
DatafieldIOService * | m_dataService |
Functionalities | m_functionalities |
InstrumentsEditController | m_instrumentEditController |
InstrumentCollection | m_instruments |
std::unique_ptr< LinkInstrumentManager > | m_linkManager |
bool | m_modified |
QString | m_project_dir |
QString | m_project_name |
MultiLayerItems | m_sampleItems |
SimulationOptionsItem | m_simulationOptionsItem |
bool | m_singleInstrumentMode |
bool | m_singleSampleMode |
Enumerator | |
---|---|
None | |
Gisas | |
Offspec | |
Specular | |
DepthProbe | |
All |
Definition at line 49 of file ProjectDocument.h.
|
strong |
Enumerator | |
---|---|
ok | |
warning | |
error |
Definition at line 47 of file ProjectDocument.h.
ProjectDocument::ProjectDocument | ( | ) |
Definition at line 53 of file ProjectDocument.cpp.
References connectModels(), InstrumentsEditController::instrumentAddedOrRemoved(), InstrumentsEditController::instrumentChanged(), m_applicationModels, m_dataService, m_instrumentEditController, m_linkManager, onModelChanged(), and DatafieldIOService::setApplicationModels().
void ProjectDocument::clearModified | ( | ) |
Definition at line 247 of file ProjectDocument.cpp.
References m_modified.
InstrumentCollection * ProjectDocument::collectedItems | ( | ) | const |
Definition at line 126 of file ProjectDocument.cpp.
References m_instruments.
Referenced by LinkInstrumentManager::canLinkDataToInstrument(), SimulationView::collectedItems(), LinkInstrumentManager::onInstrumentAddedOrRemoved(), RealDataPropertiesWidget::onInstrumentComboIndexChanged(), ProjectSettingsView::onSingleInstrumentRadioToggled(), RealDataPropertiesWidget::updateInstrumentComboEntries(), and SimulationView::writeOptionsToUI().
|
private |
Definition at line 435 of file ProjectDocument.cpp.
References m_applicationModels, ApplicationModels::modelChanged(), and onModelChanged().
Referenced by ProjectDocument(), and loadProjectFile().
|
private |
Definition at line 429 of file ProjectDocument.cpp.
References m_applicationModels, ApplicationModels::modelChanged(), and onModelChanged().
Referenced by loadProjectFile().
QString ProjectDocument::documentVersion | ( | ) | const |
Definition at line 257 of file ProjectDocument.cpp.
References GUI::Util::Path::getBornAgainVersionString(), and m_currentVersion.
ProjectDocument::Functionalities ProjectDocument::functionalities | ( | ) | const |
Definition at line 295 of file ProjectDocument.cpp.
References m_functionalities.
Referenced by InstrumentListView::onLoadFromLibrary(), InstrumentListView::onStoreInLibrary(), RealDataSelectorWidget::updateFunctionalities(), ImportDataView::updateFunctionalityNarrowing(), InstrumentListView::updateFunctionalityNarrowing(), and ProjectSettingsView::writeFunctionalityToUI().
|
signal |
Emitted when functionality has changed.
Referenced by setFunctionalities().
bool ProjectDocument::hasData | ( | ) | const |
Definition at line 252 of file ProjectDocument.cpp.
References DatafieldIOService::dataInterfaces(), and m_dataService.
Referenced by SaveService::process_queue().
bool ProjectDocument::hasValidNameAndPath | ( | ) |
Definition at line 231 of file ProjectDocument.cpp.
References m_project_dir, and m_project_name.
Referenced by AutosaveController::assureAutoSaveDirExists(), AutosaveController::autosaveDir(), AutosaveController::autosaveName(), AutosaveController::onDocumentModified(), and ProjectSettingsView::updateInformation().
InstrumentsEditController * ProjectDocument::instrumentsEditController | ( | ) |
The edit controller for the instruments in this project document.
Use this to modify instrument list or instrument data. Listen to its signals to get notification about any changes.
Definition at line 156 of file ProjectDocument.cpp.
References m_instrumentEditController.
Referenced by InstrumentListView::InstrumentListView(), LinkInstrumentManager::LinkInstrumentManager(), RealDataPropertiesWidget::RealDataPropertiesWidget(), LinkInstrumentManager::canLinkDataToInstrument(), InstrumentView::createWidgetsForCurrentInstrument(), InstrumentView::hideEvent(), InstrumentView::onInstrumentChangedByEditor(), InstrumentView::onInstrumentNameEdited(), and InstrumentView::showEvent().
bool ProjectDocument::isModified | ( | ) | const |
Definition at line 236 of file ProjectDocument.cpp.
References m_modified.
Referenced by AutosaveController::onDocumentModified(), and AutosaveController::onTimerTimeout().
JobModel * ProjectDocument::jobModel | ( | ) | const |
Definition at line 141 of file ProjectDocument.cpp.
References ApplicationModels::jobModel(), and m_applicationModels.
Referenced by SessionModelView::SessionModelView(), JobView::connectJobRelated(), JobView::createSubWindows(), and SimulationView::simulate().
LinkInstrumentManager * ProjectDocument::linkInstrumentManager | ( | ) |
Definition at line 151 of file ProjectDocument.cpp.
References m_linkManager.
Referenced by RealDataPropertiesWidget::RealDataPropertiesWidget(), and RealDataPropertiesWidget::onInstrumentComboIndexChanged().
ProjectDocument::ReadResult ProjectDocument::loadProjectFile | ( | const QString & | project_file_name, |
MessageService & | messageService | ||
) |
Definition at line 199 of file ProjectDocument.cpp.
References MessageService::addError(), connectModels(), disconnectModels(), error, DatafieldIOService::loadDataFiles(), m_dataService, projectDir(), projectFileName(), readProject(), setProjectFileName(), warning, and MessageService::warnings().
|
signal |
Emitted for any modifications in the document.
Referenced by ImportDataView::ImportDataView(), InstrumentListView::InstrumentListView(), ProjectSettingsView::ProjectSettingsView(), RealDataSelectorWidget::RealDataSelectorWidget(), SimulationView::SimulationView(), ProjectManager::createNewProject(), onModelChanged(), saveProjectFile(), AutosaveController::setDocument(), setFunctionalities(), setModified(), setProjectName(), setSingleInstrumentMode(), and setSingleSampleMode().
|
private |
Definition at line 310 of file ProjectDocument.cpp.
References m_modified, and modified().
Referenced by ProjectDocument(), connectModels(), and disconnectModels().
QString ProjectDocument::projectDir | ( | ) | const |
Definition at line 87 of file ProjectDocument.cpp.
References m_project_dir.
Referenced by AutosaveController::assureAutoSaveDirExists(), loadProjectFile(), and projectFileName().
QString ProjectDocument::projectFileName | ( | ) | const |
Definition at line 113 of file ProjectDocument.cpp.
References projectDir(), GUI::Project::Utils::projectFileExtension, and projectName().
Referenced by AutosaveController::autosaveDir(), AutosaveController::autosaveName(), loadProjectFile(), setProjectFileName(), and ProjectSettingsView::updateInformation().
QString ProjectDocument::projectName | ( | ) | const |
Definition at line 74 of file ProjectDocument.cpp.
References m_project_name.
Referenced by projectFileName(), ProjectSettingsView::updateInformation(), and writeTo().
|
private |
Definition at line 316 of file ProjectDocument.cpp.
References MessageService::addError(), GUI::Session::XML::assertExpectedTag(), Streamer::assertVersion(), error, GUI::Util::Path::isVersionMatchMinimal(), m_applicationModels, m_currentVersion, m_instruments, m_sampleItems, m_simulationOptionsItem, ok, SimulationOptionsItem::readContentFrom(), ApplicationModels::readFrom(), InstrumentCollection::serialize(), MultiLayerItems::serialize(), DeserializationException::text(), warning, and MessageService::warnings().
Referenced by loadProjectFile().
RealDataModel * ProjectDocument::realDataModel | ( | ) | const |
Definition at line 136 of file ProjectDocument.cpp.
References m_applicationModels, and ApplicationModels::realDataModel().
Referenced by ImportDataView::ImportDataView(), SessionModelView::SessionModelView(), LinkInstrumentManager::onInstrumentAddedOrRemoved(), LinkInstrumentManager::onInstrumentChanged(), SimulationView::realDataItems(), saveProjectData(), and SimulationView::writeOptionsToUI().
MultiLayerItems * ProjectDocument::sampleItems | ( | ) |
Definition at line 131 of file ProjectDocument.cpp.
References m_sampleItems.
Referenced by SampleListView::SampleListView(), ProjectSettingsView::onSingleSampleRadioToggled(), SimulationView::sampleItems(), SampleListView::selectFirstSample(), and SimulationView::writeOptionsToUI().
void ProjectDocument::save | ( | const QString & | project_file_name, |
bool | autoSave = false |
||
) |
Definition at line 161 of file ProjectDocument.cpp.
References saveProjectData(), and saveProjectFile().
void ProjectDocument::saveProjectData | ( | const QString & | project_file_name | ) |
Definition at line 188 of file ProjectDocument.cpp.
References m_dataService, GUI::Project::Utils::projectDir(), realDataModel(), and DatafieldIOService::save().
Referenced by SaveThread::run(), and save().
void ProjectDocument::saveProjectFile | ( | const QString & | project_file_name, |
bool | autoSave = false |
||
) |
Definition at line 167 of file ProjectDocument.cpp.
References Error, m_modified, modified(), setProjectFileName(), and writeTo().
Referenced by SaveService::process_queue(), and save().
void ProjectDocument::setFunctionalities | ( | const Functionalities & | f | ) |
Definition at line 300 of file ProjectDocument.cpp.
References functionalitiesChanged(), m_functionalities, modified(), and setModified().
Referenced by ProjectSettingsView::onFunctionalityToggled().
void ProjectDocument::setModified | ( | ) |
Definition at line 241 of file ProjectDocument.cpp.
References m_modified, and modified().
Referenced by SampleView::SampleView(), SampleListView::createNewSample(), SampleListView::createSampleFromLibrary(), SampleListView::importSampleFromPython(), SampleListView::removeSample(), setFunctionalities(), setSingleInstrumentMode(), and setSingleSampleMode().
void ProjectDocument::setProjectDir | ( | const QString & | text | ) |
Definition at line 99 of file ProjectDocument.cpp.
References m_project_dir.
Referenced by setProjectFileName().
void ProjectDocument::setProjectFileName | ( | const QString & | projectFileName | ) |
Definition at line 120 of file ProjectDocument.cpp.
References GUI::Project::Utils::projectDir(), projectFileName(), GUI::Project::Utils::projectName(), setProjectDir(), and setProjectName().
Referenced by loadProjectFile(), and saveProjectFile().
void ProjectDocument::setProjectName | ( | const QString & | text | ) |
Definition at line 79 of file ProjectDocument.cpp.
References m_project_name, and modified().
Referenced by setProjectFileName().
void ProjectDocument::setSingleInstrumentMode | ( | bool | b | ) |
Definition at line 270 of file ProjectDocument.cpp.
References m_singleInstrumentMode, modified(), setModified(), and singleInstrumentModeChanged().
Referenced by ProjectSettingsView::onSingleInstrumentRadioToggled().
void ProjectDocument::setSingleSampleMode | ( | bool | b | ) |
Definition at line 285 of file ProjectDocument.cpp.
References m_singleSampleMode, modified(), setModified(), and singleSampleModeChanged().
Referenced by ProjectSettingsView::onSingleSampleRadioToggled().
SimulationOptionsItem * ProjectDocument::simulationOptionsItem | ( | ) |
Definition at line 146 of file ProjectDocument.cpp.
References m_simulationOptionsItem.
Referenced by SimulationView::optionsItem().
bool ProjectDocument::singleInstrumentMode | ( | ) | const |
Definition at line 265 of file ProjectDocument.cpp.
References m_singleInstrumentMode.
Referenced by InstrumentListView::updateFunctionalityNarrowing(), SimulationView::updateFunctionalityNarrowing(), InstrumentView::updateSingleInstrumentMode(), and ProjectSettingsView::writeOptionsToUI().
|
signal |
Emitted when single instrument mode has changed.
Referenced by InstrumentView::InstrumentView(), and setSingleInstrumentMode().
bool ProjectDocument::singleSampleMode | ( | ) | const |
Definition at line 280 of file ProjectDocument.cpp.
References m_singleSampleMode.
Referenced by SampleView::resetLayout(), SampleView::updateSingleSampleMode(), and ProjectSettingsView::writeOptionsToUI().
|
signal |
Emitted when single sample mode has changed.
Referenced by SampleView::SampleView(), and setSingleSampleMode().
QString ProjectDocument::userExportDir | ( | ) | const |
Returns directory name suitable for saving plots.
Definition at line 106 of file ProjectDocument.cpp.
References validProjectDir().
QString ProjectDocument::validProjectDir | ( | ) | const |
Definition at line 92 of file ProjectDocument.cpp.
References m_project_dir, and m_project_name.
Referenced by userExportDir().
|
private |
Definition at line 395 of file ProjectDocument.cpp.
References GUI::Util::Path::getBornAgainVersionString(), m_applicationModels, m_instruments, m_sampleItems, m_simulationOptionsItem, projectName(), InstrumentCollection::serialize(), MultiLayerItems::serialize(), SimulationOptionsItem::writeContentTo(), ApplicationModels::writeTo(), and Streamer::writeVersion().
Referenced by saveProjectFile().
|
private |
Definition at line 137 of file ProjectDocument.h.
Referenced by ProjectDocument(), connectModels(), disconnectModels(), jobModel(), readProject(), realDataModel(), and writeTo().
|
private |
Definition at line 139 of file ProjectDocument.h.
Referenced by documentVersion(), and readProject().
|
private |
Definition at line 140 of file ProjectDocument.h.
Referenced by ProjectDocument(), hasData(), loadProjectFile(), and saveProjectData().
|
private |
Definition at line 144 of file ProjectDocument.h.
Referenced by functionalities(), and setFunctionalities().
|
private |
Definition at line 147 of file ProjectDocument.h.
Referenced by ProjectDocument(), and instrumentsEditController().
|
private |
Definition at line 148 of file ProjectDocument.h.
Referenced by collectedItems(), readProject(), and writeTo().
|
private |
Definition at line 141 of file ProjectDocument.h.
Referenced by ProjectDocument(), and linkInstrumentManager().
|
private |
Definition at line 138 of file ProjectDocument.h.
Referenced by clearModified(), isModified(), onModelChanged(), saveProjectFile(), and setModified().
|
private |
Definition at line 135 of file ProjectDocument.h.
Referenced by hasValidNameAndPath(), projectDir(), setProjectDir(), and validProjectDir().
|
private |
Definition at line 136 of file ProjectDocument.h.
Referenced by hasValidNameAndPath(), projectName(), setProjectName(), and validProjectDir().
|
private |
Definition at line 146 of file ProjectDocument.h.
Referenced by readProject(), sampleItems(), and writeTo().
|
private |
Definition at line 145 of file ProjectDocument.h.
Referenced by readProject(), simulationOptionsItem(), and writeTo().
|
private |
Definition at line 142 of file ProjectDocument.h.
Referenced by setSingleInstrumentMode(), and singleInstrumentMode().
|
private |
Definition at line 143 of file ProjectDocument.h.
Referenced by setSingleSampleMode(), and singleSampleMode().