BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
A user defined data loader. More...
Signals | |
void | contentsProcessed () |
Emitted whenever contents have been processed. More... | |
void | importSettingsChanged () |
Emitted whenever an import setting changed. More... | |
Public Member Functions | |
UserDefinedDataLoader1D (AbstractDataLoader1D *wrappedLoader, const QString &name, const QByteArray &defaultProperties) | |
virtual void | applyImportSettings () |
Read all values from the properties UI into the internal variables. More... | |
virtual AbstractDataLoader * | clone () const override |
Create a complete clone, including all internal states. More... | |
virtual AbstractDataLoaderResultModel * | createResultModel () const |
Create a table model which contains the import information like original file content, raw content, processed content The returned pointer will be owned by the caller. More... | |
virtual QByteArray | defaultImportSettings () const |
Return the default import settings. More... | |
virtual void | deserialize (const QByteArray &data) override |
Initialize from serialization data. More... | |
virtual QByteArray | fileContent () const |
Returns the original file content. More... | |
virtual void | guessSettings () override |
Guess appropriate settings (for example the separator in a CSV file). More... | |
virtual void | initWithDefaultImportSettings () override |
Set import settings to defaults. More... | |
virtual QStringList | lineUnrelatedErrors () const |
Errors not related to a particular line. More... | |
virtual QString | name () const override |
The name shown in the format selection combo. More... | |
virtual int | numErrors () const |
Number of errors found while processing the content. More... | |
virtual int | numLineRelatedErrors () const |
Number of errors related to a specific line. More... | |
virtual QString | persistentClassName () const override |
A name which can be used for save/load purposes (which will not change ever more) More... | |
virtual void | populateImportSettingsWidget (QWidget *parent) override |
Fills the widget on the import dialog pane. More... | |
virtual void | processContents () override |
Process the file contents. More... | |
RealDataItem * | realDataItem () |
The real data item on which the import shall work. More... | |
const RealDataItem * | realDataItem () const |
The real data item on which the import shall work. More... | |
virtual QByteArray | serialize () const override |
Returns every internal setting so it can be restored completely. More... | |
virtual void | setFileContents (const QByteArray &fileContent) override |
Sets the file contents to be imported. More... | |
void | setRealDataItem (RealDataItem *item) |
Define the real data item on which the import shall work. More... | |
Protected Types | |
enum class | Error { DifferendNumberOfColumns } |
Protected Attributes | |
RealDataItem * | m_item |
Private Attributes | |
QByteArray | m_defaultProperties |
QString | m_name |
AbstractDataLoader1D * | m_wrappedLoader |
A user defined data loader.
This is a thin wrapper around the real loader implementation, storing the relevant settings to make it user definable (namely name and import settings).
Definition at line 23 of file UserDefinedDataLoader1D.h.
|
strongprotectedinherited |
Enumerator | |
---|---|
DifferendNumberOfColumns |
Definition at line 119 of file AbstractDataLoader.h.
UserDefinedDataLoader1D::UserDefinedDataLoader1D | ( | AbstractDataLoader1D * | wrappedLoader, |
const QString & | name, | ||
const QByteArray & | defaultProperties | ||
) |
Definition at line 17 of file UserDefinedDataLoader1D.cpp.
References AbstractDataLoader::importSettingsChanged(), and m_wrappedLoader.
Referenced by clone().
|
virtualinherited |
Read all values from the properties UI into the internal variables.
Reimplemented in QREDataLoader.
Definition at line 20 of file AbstractDataLoader.cpp.
Referenced by DataLoaders1D::cloneAsUserDefinedLoader(), and SpecularDataImportWidget::onPropertiesChanged().
|
overridevirtual |
Create a complete clone, including all internal states.
Implements AbstractDataLoader.
Definition at line 56 of file UserDefinedDataLoader1D.cpp.
References UserDefinedDataLoader1D(), AbstractDataLoader::clone(), m_defaultProperties, m_name, and m_wrappedLoader.
|
signalinherited |
Emitted whenever contents have been processed.
Referenced by AutomaticDataLoader1D::processContents(), QREDataLoader::processContents(), and RealDataItem::setDataLoader().
|
virtualinherited |
Create a table model which contains the import information like original file content, raw content, processed content The returned pointer will be owned by the caller.
This base class' implementation does nothing (return nullptr).
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 55 of file AbstractDataLoader.cpp.
Referenced by SpecularDataImportWidget::updatePreview().
|
virtualinherited |
Return the default import settings.
Definition at line 31 of file AbstractDataLoader.cpp.
References AbstractDataLoader::clone().
|
overridevirtual |
Initialize from serialization data.
If any error occurred, then a DeserializationException has to be thrown. The complete state has to be restored. Therefore if e.g. errors occurred in the former serialization, but errors are not serialized, then they have to be regenerated/recalculated in here.
Reimplemented from AbstractDataLoader.
Definition at line 51 of file UserDefinedDataLoader1D.cpp.
References AbstractDataLoader::deserialize(), and m_wrappedLoader.
Referenced by initWithDefaultImportSettings().
|
virtualinherited |
Returns the original file content.
If not available any more (like for legacy project file import), then an empty array will be returned.
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 60 of file AbstractDataLoader.cpp.
Referenced by SpecularDataImportWidget::onFormatSelectionChanged(), and setFileContents().
|
overridevirtual |
Guess appropriate settings (for example the separator in a CSV file).
Is called only once, directly after setting the file content.
Reimplemented from AbstractDataLoader.
Definition at line 68 of file UserDefinedDataLoader1D.cpp.
References AbstractDataLoader::guessSettings(), and m_wrappedLoader.
|
signalinherited |
Emitted whenever an import setting changed.
Referenced by UserDefinedDataLoader1D(), SpecularDataImportWidget::onFormatSelectionChanged(), and SpecularDataImportWidget::setItem().
|
overridevirtual |
Set import settings to defaults.
Reimplemented from AbstractDataLoader.
Definition at line 36 of file UserDefinedDataLoader1D.cpp.
References deserialize(), and m_defaultProperties.
|
virtualinherited |
Errors not related to a particular line.
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 50 of file AbstractDataLoader.cpp.
Referenced by SpecularDataImportWidget::updatePreview().
|
overridevirtual |
The name shown in the format selection combo.
Implements AbstractDataLoader.
Definition at line 26 of file UserDefinedDataLoader1D.cpp.
References m_name.
|
virtualinherited |
Number of errors found while processing the content.
An error means that either a particular content (line) can't be used or may be suspicious (line related error), or that the whole content can't be used (e.g. only 1 line present).
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 40 of file AbstractDataLoader.cpp.
Referenced by RealDataItem::hasImportErrors(), and SpecularDataImportWidget::updatePreview().
|
virtualinherited |
Number of errors related to a specific line.
Such an error means that a particular content (line) can't be used or may be suspicious.
Reimplemented in QREDataLoader.
Definition at line 45 of file AbstractDataLoader.cpp.
|
overridevirtual |
A name which can be used for save/load purposes (which will not change ever more)
Implements AbstractDataLoader.
Definition at line 41 of file UserDefinedDataLoader1D.cpp.
References m_wrappedLoader, and AbstractDataLoader::persistentClassName().
|
overridevirtual |
Fills the widget on the import dialog pane.
This base class' implementation does nothing (meaning "no editable properties")
Reimplemented from AbstractDataLoader.
Definition at line 31 of file UserDefinedDataLoader1D.cpp.
References m_wrappedLoader, and AbstractDataLoader::populateImportSettingsWidget().
|
overridevirtual |
Process the file contents.
Can be called more than once, e.g. if the import settings have changed. Any error has to be stored in the loader (see numErrors()).
Implements AbstractDataLoader.
Definition at line 73 of file UserDefinedDataLoader1D.cpp.
References m_wrappedLoader, and AbstractDataLoader::processContents().
|
inherited |
The real data item on which the import shall work.
Definition at line 70 of file AbstractDataLoader.cpp.
References AbstractDataLoader::m_item.
|
inherited |
The real data item on which the import shall work.
Definition at line 75 of file AbstractDataLoader.cpp.
References AbstractDataLoader::m_item.
|
overridevirtual |
Returns every internal setting so it can be restored completely.
Reimplemented from AbstractDataLoader.
Definition at line 46 of file UserDefinedDataLoader1D.cpp.
References m_wrappedLoader, and AbstractDataLoader::serialize().
|
overridevirtual |
Sets the file contents to be imported.
If the file was a compressed file, here already the decompressed content will be overhanded.
Implements AbstractDataLoader.
Definition at line 63 of file UserDefinedDataLoader1D.cpp.
References AbstractDataLoader::fileContent(), m_wrappedLoader, and AbstractDataLoader::setFileContents().
|
inherited |
Define the real data item on which the import shall work.
Definition at line 65 of file AbstractDataLoader.cpp.
References AbstractDataLoader::m_item.
Referenced by ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().
|
private |
Definition at line 43 of file UserDefinedDataLoader1D.h.
Referenced by clone(), and initWithDefaultImportSettings().
|
protectedinherited |
Definition at line 122 of file AbstractDataLoader.h.
Referenced by AutomaticDataLoader1D::createResultModel(), AutomaticDataLoader1D::processContents(), QREDataLoader::processContents(), AbstractDataLoader::realDataItem(), and AbstractDataLoader::setRealDataItem().
|
private |
Definition at line 41 of file UserDefinedDataLoader1D.h.
|
private |
Definition at line 42 of file UserDefinedDataLoader1D.h.
Referenced by UserDefinedDataLoader1D(), clone(), deserialize(), guessSettings(), persistentClassName(), populateImportSettingsWidget(), processContents(), serialize(), and setFileContents().