BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobItem Class Reference

Description

Definition at line 43 of file JobItem.h.

Inheritance diagram for JobItem:
[legend]
Collaboration diagram for JobItem:
[legend]

Signals

void jobBeginTimeChanged (const QDateTime &begin_time)
 
void jobCommentsChanged (const QString &comments)
 
void jobDestroyed ()
 
void jobEndTimeChanged (const QDateTime &end_time)
 
void jobIdentifierChanged (const QString &identifier)
 
void jobInstrumentNameChanged (const QString &name)
 
void jobNameChanged (const QString &name)
 
void jobPresentationTypeChanged (const QString &type)
 
void jobProgressChanged (int progress)
 
void jobStatusChanged (const JobStatus status)
 

Public Member Functions

 JobItem ()
 
 ~JobItem ()
 
QVector< QString > acceptableDefaultItemTypes () const
 Returns vector of acceptable default tag types. More...
 
bool acceptsAsDefaultItem (const QString &item_name) const
 Returns true if model type can be added to default tag. More...
 
void addDataViewItem (Data1DViewItem *data_view)
 
SessionItemaddGroupProperty (const QString &groupTag, const GroupInfo &groupInfo)
 
template<typename T >
T * addProperty (const QString &name)
 
SessionItemaddProperty (const QString &name, const QVariant &variant)
 Add new property item and register new tag. name is the tag name and the display name. The property's value will be set to variant. More...
 
virtual bool allowWritingChildToXml (SessionItem *child) const
 
QDateTime beginTime () const
 
SessionItemchildAt (int row) const
 Returns the child at the given row. More...
 
QVector< SessionItem * > children () const
 Returns vector of all children. More...
 
template<typename T >
QVector< T * > childrenOfType () const
 
QVector< SessionItem * > childrenOfType (const QString &model_type) const
 Returns a vector of all children of the given type. More...
 
InstrumentItemcopyInstrumentIntoJob (const InstrumentItem *instrument)
 
RealDataItemcopyRealDataIntoJob (const RealDataItem *real_data)
 
MultiLayerItemcopySampleIntoJob (const MultiLayerItem *sample)
 
void copySimulationOptionsIntoJob (const SimulationOptionsItem &options)
 
Data1DViewItemcreateDataViewItem ()
 
FitSuiteItemcreateFitSuiteItem ()
 
RealDataItemcreateRealDataItem ()
 
DataItemdataItem ()
 
Data1DViewItemdataItemView ()
 
int decimals () const
 
QString defaultTag () const
 Get default tag. More...
 
virtual void deserializeBinaryData (const QByteArray &data)
 
QString displayName () const
 Get display name of item, append index if ambigue. More...
 
std::optional< size_t > duration () const
 if begin and end time are both available the duration in ms, otherwise empty More...
 
void emitDataChanged (int role=Qt::DisplayRole)
 Notify model about data changes. More...
 
QDateTime endTime () const
 
template<typename T >
T * firstChildOfType () const
 
FitParameterContainerItemfitParameterContainerItem ()
 
FitSuiteItemfitSuiteItem ()
 
SessionItemgetChildOfType (const QString &type) const
 Returns the first child of the given type. More...
 
QString getComments () const
 
SessionItemgetGroupItem (const QString &groupName) const
 Access subitem of group item. More...
 
QString getIdentifier () const
 
SessionItemgetItem (const QString &tag="", int row=0) const
 Returns item in given row of given tag. More...
 
QVector< SessionItem * > getItems (const QString &tag="") const
 Returns vector of all items of given tag. More...
 
QVariant getItemValue (const QString &tag) const
 Directly access value of item under given tag. More...
 
int getProgress () const
 
QVector< int > getRoles () const
 Returns vector of all present roles. More...
 
JobStatus getStatus () const
 
template<typename T >
T & groupItem (const QString &groupName) const
 
bool hasChildren () const
 Indicates whether this SessionItem has any child items. More...
 
template<typename T >
bool hasModelType () const
 
QModelIndex index () const
 Returns model index of this item. More...
 
void insertChild (int row, SessionItem *item, const QString &tag="")
 Insert item into given tag into given row. More...
 
Instrument2DIteminstrument2DItem ()
 
InstrumentIteminstrumentItem () const
 
QString instrumentName () const
 
IntensityDataItemintensityDataItem ()
 
bool isCanceled () const
 
bool isCompleted () const
 
bool isEditable () const
 
bool isEnabled () const
 
bool isFailed () const
 
bool isFitting () const
 
bool isIdle () const
 
bool isRunning () const
 
bool isSpecularJob () const
 
bool isTag (const QString &name) const
 Returns true if tag is available. More...
 
bool isValidForFitting ()
 
template<typename T >
T * item (const QString &tag) const
 
QString itemName () const
 Get item name, return display name if no name is set. More...
 
template<typename T >
QVector< T * > items (const QString &tag="") const
 
QString jobName () const
 
RealLimits limits () const
 
ModelMappermapper ()
 Returns the current model mapper of this item. Creates new one if necessary. More...
 
SessionModelmodel () const
 Returns model of this item. More...
 
QString modelType () const
 Get model type. More...
 
int numberOfChildren () const
 Returns total number of children. More...
 
ParameterContainerItemparameterContainerItem ()
 
const ParameterContainerItemparameterContainerItem () const
 
SessionItemparentItem () const
 Returns parent of this item. More...
 
int parentRow ()
 Returns the index of the given item within its parent. Returns -1 when no parent is set. More...
 
QString presentationType () const
 
void readNonSessionItems (QXmlStreamReader *reader) override
 
RealDataItemrealDataItem ()
 
bool registerTag (const QString &name, int min=0, int max=-1, QStringList modelTypes={})
 Add new tag to this item with given name, min, max and types. max = -1 -> unlimited, modelTypes empty -> all types allowed. More...
 
QVariant roleProperty (int role) const
 Returns corresponding variant under given role, invalid variant when role is not present. More...
 
int rowOfChild (SessionItem *child) const
 Returns row index of given child. More...
 
bool runImmediately () const
 
bool runInBackground () const
 
MultiLayerItemsampleItem ()
 
QString sampleName () const
 
virtual QByteArray serializeBinaryData () const
 
const SessionItemTagssessionItemTags () const
 
void setBeginTime (const QDateTime &begin_time)
 
void setComments (const QString &comments)
 
template<typename T >
T * setDataType ()
 
SessionItemsetDecimals (int n)
 
void setDefaultTag (const QString &tag)
 Set default tag. More...
 
void setDisplayName (const QString &display_name)
 Set display name. More...
 
void setEditable (bool enabled)
 
void setEnabled (bool enabled)
 Flags accessors. More...
 
void setEndTime (const QDateTime &end_time)
 
SessionItemsetGroupProperty (const QString &groupTag, const QString &modelType) const
 Set the current type of group item. More...
 
template<typename T >
T * setGroupPropertyType (const QString &groupTag)
 
void setIdentifier (const QString &identifier)
 
void setInstrumentName (const QString &name)
 
void setItemName (const QString &name)
 Set item name, add property if necessary. More...
 
void setItemValue (const QString &tag, const QVariant &variant) const
 Directly set value of item under given tag. More...
 
void setJobName (const QString &name)
 
SessionItemsetLimits (const RealLimits &value)
 
void setPresentationType (const QString &type)
 
void setProgress (int progress)
 
void setResults (const SimulationResult &result)
 
bool setRoleProperty (int role, const QVariant &value)
 Set the contained role property to the given value. See also setTranslatorForRolePropertySetter. More...
 
void setStatus (JobStatus status)
 
SessionItemsetToolTip (const QString &tooltip)
 
bool setValue (QVariant value)
 Set value, ensure that variant types match. More...
 
const SimulationOptionsItemsimulationOptionsItem () const
 
QString tagFromItem (const SessionItem *item) const
 Returns the tag name of given item when existing. More...
 
SessionItemtakeItem (int row, const QString &tag)
 Remove item from given row from given tag. More...
 
SessionItemtakeRow (int row)
 Removes row from item and returns the item. More...
 
QString toolTip () const
 
QVariant value () const
 Get value. More...
 
void writeNonSessionItems (QXmlStreamWriter *writer) const override
 

Static Public Member Functions

static bool isItemNamePropertyName (const QString &name)
 

Static Public Attributes

static constexpr auto M_TYPE {"JobItem"}
 

Private Member Functions

void changeFlags (bool enabled, int flag)
 internal More...
 
void childDeleted (SessionItem *child)
 
int flags () const
 
int getCopyNumberOfChild (const SessionItem *item) const
 internal More...
 
void setModel (SessionModel *model)
 
void setParentAndModel (SessionItem *parent, SessionModel *model)
 
void updateIntensityDataFileName ()
 Updates the name of file to store intensity data. More...
 

Private Attributes

QVector< SessionItem * > m_children
 
std::unique_ptr< InstrumentItemm_instrument
 
std::unique_ptr< ModelMapperm_mapper
 
SessionModelm_model
 
ParameterContainerItem m_parameterContainer
 
SessionItemm_parent
 
std::unique_ptr< SessionItemDatam_properties
 
MultiLayerItem m_sampleItem
 
SimulationOptionsItem m_simulationOptionsItem
 
std::unique_ptr< SessionItemTagsm_tags
 

Static Private Attributes

static constexpr auto P_BEGIN_TIME {"Begin time"}
 
static constexpr auto P_COMMENTS {"Comments"}
 
static constexpr auto P_END_TIME {"End time"}
 
static constexpr auto P_IDENTIFIER {"Identifier"}
 
static constexpr auto P_INSTRUMENT_NAME {"Instrument"}
 
static constexpr auto P_NAME {"Name"}
 
static constexpr auto P_PRESENTATION_TYPE {"Presentation type"}
 
static constexpr auto P_PROGRESS {"Progress"}
 
static constexpr auto P_STATUS {"Status"}
 
static constexpr auto P_WITH_FITTING {"With fitting"}
 
static constexpr auto T_DATAVIEW {"Data View tag"}
 
static constexpr auto T_FIT_SUITE {"Fit suite tag"}
 
static constexpr auto T_MATERIAL_CONTAINER {"Material container tag"}
 
static constexpr auto T_OUTPUT {"Output tag"}
 
static constexpr auto T_REALDATA {"Real Data tag"}
 

Friends

class JobModel
 

Constructor & Destructor Documentation

◆ JobItem()

JobItem::JobItem ( )

Definition at line 44 of file JobItem.cpp.

46 {
48  addProperty(P_IDENTIFIER, QString());
49  addProperty(P_INSTRUMENT_NAME, QString())->setEditable(false);
51 
53 
54  addProperty(P_BEGIN_TIME, QString())->setEditable(false);
55  addProperty(P_END_TIME, QString())->setEditable(false);
56 
57  addProperty(P_COMMENTS, QString());
59  addProperty(P_PRESENTATION_TYPE, QVariant::Type::Invalid);
60 
64 
66 }
QString jobStatusToString(JobStatus status)
get a string representation of the status
Definition: JobStatus.cpp:32
@ Idle
the job has not been started yet
static constexpr auto M_TYPE
static constexpr auto M_TYPE
Definition: FitSuiteItem.h:32
static constexpr auto M_TYPE
static constexpr auto P_END_TIME
Definition: JobItem.h:51
static constexpr auto M_TYPE
Definition: JobItem.h:62
static constexpr auto T_REALDATA
Definition: JobItem.h:57
static constexpr auto P_BEGIN_TIME
Definition: JobItem.h:50
static constexpr auto P_INSTRUMENT_NAME
Definition: JobItem.h:47
static constexpr auto P_STATUS
Definition: JobItem.h:49
static constexpr auto T_DATAVIEW
Definition: JobItem.h:58
static constexpr auto T_OUTPUT
Definition: JobItem.h:56
static constexpr auto T_FIT_SUITE
Definition: JobItem.h:59
static constexpr auto P_IDENTIFIER
Definition: JobItem.h:46
static constexpr auto P_PROGRESS
Definition: JobItem.h:53
static constexpr auto P_PRESENTATION_TYPE
Definition: JobItem.h:54
static constexpr auto P_COMMENTS
Definition: JobItem.h:52
static constexpr auto P_WITH_FITTING
Definition: JobItem.h:48
static constexpr auto M_TYPE
Definition: RealDataItem.h:45
void setItemName(const QString &name)
Set item name, add property if necessary.
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag. name is the tag name and the display name....
bool registerTag(const QString &name, int min=0, int max=-1, QStringList modelTypes={})
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited,...
SessionItem(const QString &modelType)
Constructs new item with given model type. The type must be defined.
Definition: SessionItem.cpp:25
void setEditable(bool enabled)
static constexpr auto M_TYPE

References SessionItem::addProperty(), Idle, jobStatusToString(), Data1DViewItem::M_TYPE, IntensityDataItem::M_TYPE, RealDataItem::M_TYPE, SpecularDataItem::M_TYPE, FitSuiteItem::M_TYPE, M_TYPE, P_BEGIN_TIME, P_COMMENTS, P_END_TIME, P_IDENTIFIER, P_INSTRUMENT_NAME, P_PRESENTATION_TYPE, P_PROGRESS, P_STATUS, P_WITH_FITTING, SessionItem::registerTag(), SessionItem::setEditable(), SessionItem::setItemName(), T_DATAVIEW, T_FIT_SUITE, T_OUTPUT, and T_REALDATA.

Here is the call graph for this function:

◆ ~JobItem()

JobItem::~JobItem ( )

Definition at line 68 of file JobItem.cpp.

69 {
70  emit jobDestroyed();
71 }
void jobDestroyed()

References jobDestroyed().

Member Function Documentation

◆ acceptableDefaultItemTypes()

QVector< QString > SessionItem::acceptableDefaultItemTypes ( ) const
inherited

Returns vector of acceptable default tag types.

Definition at line 193 of file SessionItem.cpp.

194 {
195  return m_tags->modelTypesForTag(defaultTag()).toVector();
196 }
QString defaultTag() const
Get default tag.
std::unique_ptr< SessionItemTags > m_tags
Definition: SessionItem.h:334

References SessionItem::defaultTag(), and SessionItem::m_tags.

Here is the call graph for this function:

◆ acceptsAsDefaultItem()

bool SessionItem::acceptsAsDefaultItem ( const QString &  item_name) const
inherited

Returns true if model type can be added to default tag.

Definition at line 186 of file SessionItem.cpp.

187 {
188  return m_tags->isValid(defaultTag(), item_name);
189 }

References SessionItem::defaultTag(), and SessionItem::m_tags.

Here is the call graph for this function:

◆ addDataViewItem()

void JobItem::addDataViewItem ( Data1DViewItem data_view)

Definition at line 310 of file JobItem.cpp.

311 {
312  insertChild(-1, data_view, T_DATAVIEW);
313 }
void insertChild(int row, SessionItem *item, const QString &tag="")
Insert item into given tag into given row.

References SessionItem::insertChild(), and T_DATAVIEW.

Here is the call graph for this function:

◆ addGroupProperty()

SessionItem * SessionItem::addGroupProperty ( const QString &  groupTag,
const GroupInfo groupInfo 
)
inherited

Definition at line 306 of file SessionItem.cpp.

307 {
310  ASSERT(groupItem);
311  groupItem->setGroupInfo(groupInfo);
312  registerTag(groupTag, 1, 1, {GroupItem::M_TYPE});
313  groupItem->setDisplayName(groupTag);
314  insertChild(0, groupItem, groupTag);
315  return groupItem;
316 }
static constexpr auto M_TYPE
Definition: GroupItem.h:30
T & groupItem(const QString &groupName) const
Definition: SessionItem.h:413
SessionItem * CreateItem(const QString &model_name, SessionItem *parent=nullptr)
create SessionItem of specific type and parent
Definition: ItemFactory.cpp:19

References GUI::Model::ItemFactory::CreateItem(), SessionItem::groupItem(), SessionItem::insertChild(), GroupItem::M_TYPE, and SessionItem::registerTag().

Referenced by MinimizerContainerItem::MinimizerContainerItem().

Here is the call graph for this function:

◆ addProperty() [1/2]

template<typename T >
T * SessionItem::addProperty ( const QString &  name)
inherited

Definition at line 394 of file SessionItem.h.

395 {
396  auto property = new T;
397  property->setDisplayName(tagname);
398  registerTag(tagname, 1, 1, QStringList() << property->modelType());
399  insertChild(0, property, tagname);
400  return property;
401 }

References SessionItem::insertChild(), SessionItem::registerTag(), and SessionItem::setDisplayName().

Here is the call graph for this function:

◆ addProperty() [2/2]

SessionItem * SessionItem::addProperty ( const QString &  name,
const QVariant &  variant 
)
inherited

Add new property item and register new tag. name is the tag name and the display name. The property's value will be set to variant.

Definition at line 278 of file SessionItem.cpp.

279 {
280  ASSERT(!isTag(name));
281 
283  property->setDisplayName(name);
285  insertChild(0, property, name);
286  property->setValue(variant);
287  return property;
288 }
static constexpr auto M_TYPE
Definition: PropertyItem.h:22
Base class for a GUI data item.
Definition: SessionItem.h:204
bool isTag(const QString &name) const
Returns true if tag is available.
QString const & name(EShape k)
Definition: particles.cpp:20

References GUI::Model::ItemFactory::CreateItem(), SessionItem::insertChild(), SessionItem::isTag(), PropertyItem::M_TYPE, GUI::RealSpace::Particles::name(), and SessionItem::registerTag().

Referenced by AmplitudeAxisItem::AmplitudeAxisItem(), BasicAxisItem::BasicAxisItem(), Data1DProperties::Data1DProperties(), Data1DViewItem::Data1DViewItem(), DataItem::DataItem(), DataProperties::DataProperties(), EllipseItem::EllipseItem(), FitParameterItem::FitParameterItem(), FitParameterLinkItem::FitParameterLinkItem(), FitSuiteItem::FitSuiteItem(), GeneticMinimizerItem::GeneticMinimizerItem(), GSLLMAMinimizerItem::GSLLMAMinimizerItem(), GSLMultiMinimizerItem::GSLMultiMinimizerItem(), HorizontalLineItem::HorizontalLineItem(), IntensityDataItem::IntensityDataItem(), JobItem(), MaskItem::MaskItem(), MinimizerContainerItem::MinimizerContainerItem(), MinuitMinimizerItem::MinuitMinimizerItem(), PointwiseAxisItem::PointwiseAxisItem(), PolygonItem::PolygonItem(), PolygonPointItem::PolygonPointItem(), RealDataItem::RealDataItem(), RectangleItem::RectangleItem(), SimAnMinimizerItem::SimAnMinimizerItem(), SpecularDataItem::SpecularDataItem(), VerticalLineItem::VerticalLineItem(), and SessionItem::setItemName().

Here is the call graph for this function:

◆ allowWritingChildToXml()

bool SessionItem::allowWritingChildToXml ( SessionItem child) const
virtualinherited

Definition at line 528 of file SessionItem.cpp.

529 {
530  return true;
531 }

Referenced by GUI::Session::XML::writeItemAndChildItems().

◆ beginTime()

QDateTime JobItem::beginTime ( ) const

Definition at line 159 of file JobItem.cpp.

160 {
161  return QDateTime::fromString(getItemValue(P_BEGIN_TIME).toString(), Qt::ISODateWithMs);
162 }
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
QString toString(const QModelIndex &index)
Provides string representation of index data.

References SessionItem::getItemValue(), P_BEGIN_TIME, and GUI::View::PropertyEditorFactory::toString().

Referenced by JobPropertiesTableModel::data(), and duration().

Here is the call graph for this function:

◆ changeFlags()

void SessionItem::changeFlags ( bool  enabled,
int  flag 
)
privateinherited

internal

Definition at line 568 of file SessionItem.cpp.

569 {
570  int flags = this->flags();
571  if (enabled)
572  flags |= flag;
573  else
574  flags &= ~flag;
575 
577 }
int flags() const
bool setRoleProperty(int role, const QVariant &value)
Set the contained role property to the given value. See also setTranslatorForRolePropertySetter.

References SessionFlags::FlagRole, SessionItem::flags(), and SessionItem::setRoleProperty().

Referenced by SessionItem::setEditable(), and SessionItem::setEnabled().

Here is the call graph for this function:

◆ childAt()

SessionItem * SessionItem::childAt ( int  row) const
inherited

Returns the child at the given row.

Definition at line 102 of file SessionItem.cpp.

103 {
104  return m_children.value(row, nullptr);
105 }
QVector< SessionItem * > m_children
Definition: SessionItem.h:332

References SessionItem::m_children.

Referenced by SessionModel::index(), and SessionItem::takeRow().

◆ childDeleted()

void SessionItem::childDeleted ( SessionItem child)
privateinherited

Definition at line 533 of file SessionItem.cpp.

534 {
535  int index = rowOfChild(child);
536  ASSERT(index != -1);
537  m_children.replace(index, nullptr);
538 }
int rowOfChild(SessionItem *child) const
Returns row index of given child.
QModelIndex index() const
Returns model index of this item.
Definition: SessionItem.cpp:74

References SessionItem::index(), SessionItem::m_children, and SessionItem::rowOfChild().

Referenced by SessionItem::~SessionItem().

Here is the call graph for this function:

◆ children()

QVector< SessionItem * > SessionItem::children ( ) const
inherited

Returns vector of all children.

Definition at line 95 of file SessionItem.cpp.

96 {
97  return m_children;
98 }

References SessionItem::m_children.

Referenced by MaskContainerItem::maskItems(), DataPropertyContainer::propertyItem(), and GUI::Session::XML::writeItemAndChildItems().

◆ childrenOfType() [1/2]

template<typename T >
QVector< T * > SessionItem::childrenOfType
inherited

Definition at line 372 of file SessionItem.h.

373 {
374  QVector<T*> result;
375  for (auto* child : m_children)
376  if (child->modelType() == T::M_TYPE)
377  result.append(dynamic_cast<T*>(child));
378 
379  return result;
380 }

References SessionItem::m_children.

◆ childrenOfType() [2/2]

QVector< SessionItem * > SessionItem::childrenOfType ( const QString &  model_type) const
inherited

Returns a vector of all children of the given type.

Definition at line 127 of file SessionItem.cpp.

128 {
129  QVector<SessionItem*> result;
130  for (auto* child : m_children)
131  if (child->modelType() == model_type)
132  result.append(child);
133 
134  return result;
135 }

References SessionItem::m_children.

Referenced by ProjectionsPlot::projectionItems(), and SaveProjectionsAssistant::projectionItems().

◆ copyInstrumentIntoJob()

InstrumentItem * JobItem::copyInstrumentIntoJob ( const InstrumentItem instrument)

Definition at line 245 of file JobItem.cpp.

246 {
247  m_instrument.reset(instrument->createCopy());
248  return m_instrument.get();
249 }
InstrumentItem * createCopy() const
Creates an exact copy; also ID is the same!
std::unique_ptr< InstrumentItem > m_instrument
Definition: JobItem.h:167

References InstrumentItem::createCopy(), and m_instrument.

Referenced by GUI::Model::JobFunctions::setupJobItemInstrument().

Here is the call graph for this function:

◆ copyRealDataIntoJob()

RealDataItem * JobItem::copyRealDataIntoJob ( const RealDataItem real_data)

Definition at line 295 of file JobItem.cpp.

296 {
297  return model()->copyItem(real_data, this, T_REALDATA);
298 }
SessionModel * model() const
Returns model of this item.
Definition: SessionItem.cpp:60
T * copyItem(const T *item_to_copy, SessionItem *new_parent=nullptr, const QString &tag="")
Definition: SessionModel.h:149

References SessionModel::copyItem(), SessionItem::model(), and T_REALDATA.

Referenced by GUI::Model::JobFunctions::copyRealDataItem().

Here is the call graph for this function:

◆ copySampleIntoJob()

MultiLayerItem * JobItem::copySampleIntoJob ( const MultiLayerItem sample)

Definition at line 227 of file JobItem.cpp.

228 {
229  m_sampleItem.initFrom(sample);
230  return &m_sampleItem;
231 }
MultiLayerItem m_sampleItem
Definition: JobItem.h:166
void initFrom(const MultiLayerItem *other)

References MultiLayerItem::initFrom(), and m_sampleItem.

Here is the call graph for this function:

◆ copySimulationOptionsIntoJob()

void JobItem::copySimulationOptionsIntoJob ( const SimulationOptionsItem options)

Definition at line 420 of file JobItem.cpp.

421 {
422  m_simulationOptionsItem = options;
423 }
SimulationOptionsItem m_simulationOptionsItem
Definition: JobItem.h:164

References m_simulationOptionsItem.

◆ createDataViewItem()

Data1DViewItem * JobItem::createDataViewItem ( )

Definition at line 315 of file JobItem.cpp.

316 {
317  return model()->insertItem<Data1DViewItem>(this, -1, T_DATAVIEW);
318 }
View model for 1D DataItem. Can represent several items at once. In current implementation the first ...
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:137

References SessionModel::insertItem(), SessionItem::model(), and T_DATAVIEW.

Referenced by GUI::Model::JobFunctions::initDataView().

Here is the call graph for this function:

◆ createFitSuiteItem()

FitSuiteItem * JobItem::createFitSuiteItem ( )

Definition at line 262 of file JobItem.cpp.

263 {
264  if (getItem(T_FIT_SUITE))
265  throw Error("JobItem::createFitSuiteItem() -> Error. Attempt to create "
266  "a second FitSuiteItem.");
267 
268  return model()->insertItem<FitSuiteItem>(this, -1, T_FIT_SUITE);
269 }
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.

References Error, SessionItem::getItem(), SessionModel::insertItem(), SessionItem::model(), and T_FIT_SUITE.

Here is the call graph for this function:

◆ createRealDataItem()

RealDataItem * JobItem::createRealDataItem ( )

Definition at line 300 of file JobItem.cpp.

301 {
302  return model()->insertItem<RealDataItem>(this, -1, T_REALDATA);
303 }
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Definition: RealDataItem.h:33

References SessionModel::insertItem(), SessionItem::model(), and T_REALDATA.

Here is the call graph for this function:

◆ dataItem()

DataItem * JobItem::dataItem ( )

Definition at line 101 of file JobItem.cpp.

102 {
103  return dynamic_cast<DataItem*>(getItem(T_OUTPUT));
104 }
Abstract base class for IntensityDataItem and SpecularDataItem. Owns one simulated data set of type D...
Definition: DataItem.h:34

References SessionItem::getItem(), and T_OUTPUT.

Referenced by GUI::Model::JobFunctions::initDataView(), FitSessionController::onObserverUpdate(), FitComparisonController2D::setItem(), setResults(), setStatus(), DiffItemController::subscribe(), DiffItemController::unsubscribe(), DiffItemController::updateDiffData(), and updateIntensityDataFileName().

Here is the call graph for this function:

◆ dataItemView()

Data1DViewItem * JobItem::dataItemView ( )

Definition at line 305 of file JobItem.cpp.

306 {
307  return dynamic_cast<Data1DViewItem*>(getItem(JobItem::T_DATAVIEW));
308 }

References SessionItem::getItem(), and T_DATAVIEW.

Referenced by FitComparison1DViewController::createDiffViewItem(), GUI::Model::JobFunctions::initDataView(), FitComparison1DViewController::setItem(), and FitComparisonWidget1D::viewItem().

Here is the call graph for this function:

◆ decimals()

int SessionItem::decimals ( ) const
inherited

Definition at line 484 of file SessionItem.cpp.

485 {
486  return roleProperty(SessionFlags::DecimalRole).toInt();
487 }
QVariant roleProperty(int role) const
Returns corresponding variant under given role, invalid variant when role is not present.

References SessionFlags::DecimalRole, and SessionItem::roleProperty().

Referenced by GUI::View::PropertyEditorFactory::CreateEditor().

Here is the call graph for this function:

◆ defaultTag()

QString SessionItem::defaultTag ( ) const
inherited

Get default tag.

Definition at line 390 of file SessionItem.cpp.

391 {
392  return roleProperty(SessionFlags::DefaultTagRole).toString();
393 }

References SessionFlags::DefaultTagRole, and SessionItem::roleProperty().

Referenced by SessionItem::acceptableDefaultItemTypes(), SessionItem::acceptsAsDefaultItem(), SessionModel::copy(), SessionItem::getItem(), SessionItem::getItems(), SessionItem::insertChild(), SessionModel::insertNewItem(), SessionModel::moveItem(), and SessionItem::takeItem().

Here is the call graph for this function:

◆ deserializeBinaryData()

void SessionItem::deserializeBinaryData ( const QByteArray &  data)
virtualinherited

Reimplemented in PointwiseAxisItem, and RealDataItem.

Definition at line 522 of file SessionItem.cpp.

522 {}

Referenced by GUI::Session::XML::readItems().

◆ displayName()

QString SessionItem::displayName ( ) const
inherited

Get display name of item, append index if ambigue.

Definition at line 404 of file SessionItem.cpp.

405 {
406  QString result = roleProperty(SessionFlags::DisplayNameRole).toString();
407 
408  if (hasModelType<PropertyItem>() || hasModelType<GroupItem>())
409  return result;
410 
411  if (m_parent) {
412  QString tag = m_parent->tagFromItem(this);
413  // if only one child of this type is allowed, return name without change
415  return result;
416 
417  int index = m_parent->getCopyNumberOfChild(this);
418  if (index >= 0)
419  return result + QString::number(index);
420  }
421  return result;
422 }
bool isSingleItemTag(const QString &tagName) const
const SessionItemTags * sessionItemTags() const
int getCopyNumberOfChild(const SessionItem *item) const
internal
QString tagFromItem(const SessionItem *item) const
Returns the tag name of given item when existing.
SessionItem * m_parent
Definition: SessionItem.h:330

References SessionFlags::DisplayNameRole, SessionItem::getCopyNumberOfChild(), SessionItem::index(), SessionItemTags::isSingleItemTag(), SessionItem::m_parent, SessionItem::roleProperty(), SessionItem::sessionItemTags(), and SessionItem::tagFromItem().

Referenced by SelectionDescriptor< T >::SelectionDescriptor(), and SessionItem::itemName().

Here is the call graph for this function:

◆ duration()

std::optional< size_t > JobItem::duration ( ) const

if begin and end time are both available the duration in ms, otherwise empty

Definition at line 181 of file JobItem.cpp.

182 {
183  QDateTime begin_time = beginTime();
184  QDateTime end_time = endTime();
185  if (begin_time.isValid() && end_time.isValid() && begin_time < end_time)
186  return begin_time.msecsTo(end_time);
187  return std::nullopt;
188 }
QDateTime endTime() const
Definition: JobItem.cpp:170
QDateTime beginTime() const
Definition: JobItem.cpp:159

References beginTime(), and endTime().

Referenced by JobPropertiesTableModel::data().

Here is the call graph for this function:

◆ emitDataChanged()

void SessionItem::emitDataChanged ( int  role = Qt::DisplayRole)
inherited

Notify model about data changes.

Definition at line 358 of file SessionItem.cpp.

359 {
360  if (m_model) {
361  QModelIndex index = m_model->indexOfItem(this);
362  m_model->dataChanged(index, index.sibling(index.row(), 1), QVector<int>() << role);
363  }
364 }
SessionModel * m_model
Definition: SessionItem.h:331
QModelIndex indexOfItem(SessionItem *item) const

References SessionItem::index(), SessionModel::indexOfItem(), and SessionItem::m_model.

Referenced by GroupItem::onValueChange(), IntensityDataItem::setDatafield(), SpecularDataItem::setDatafield(), SessionItem::setRoleProperty(), and PointwiseAxisItem::updateIndicators().

Here is the call graph for this function:

◆ endTime()

QDateTime JobItem::endTime ( ) const

Definition at line 170 of file JobItem.cpp.

171 {
172  return QDateTime::fromString(getItemValue(P_END_TIME).toString(), Qt::ISODateWithMs);
173 }

References SessionItem::getItemValue(), P_END_TIME, and GUI::View::PropertyEditorFactory::toString().

Referenced by JobPropertiesTableModel::data(), and duration().

Here is the call graph for this function:

◆ firstChildOfType()

template<typename T >
T * SessionItem::firstChildOfType
inherited

Definition at line 384 of file SessionItem.h.

385 {
386  for (auto* child : m_children)
387  if (child->modelType() == T::M_TYPE)
388  return dynamic_cast<T*>(child);
389 
390  return nullptr;
391 }

References SessionItem::m_children.

◆ fitParameterContainerItem()

FitParameterContainerItem * JobItem::fitParameterContainerItem ( )

Definition at line 282 of file JobItem.cpp.

283 {
284  if (FitSuiteItem* item = fitSuiteItem())
285  return item->fitParameterContainerItem();
286 
287  return nullptr;
288 }
FitSuiteItem * fitSuiteItem()
Definition: JobItem.cpp:257
T * item(const QString &tag) const
Definition: SessionItem.h:353

References fitSuiteItem(), and SessionItem::item().

Referenced by FitParameterWidget::onAddToFitParAction(), FitParameterWidget::onCreateFitParAction(), FitParameterWidget::onRemoveFitParAction(), FitParameterWidget::onRemoveFromFitParAction(), FitParameterWidget::onTuningWidgetContextMenu(), FitObjectiveBuilder::update_fit_parameters(), FitSessionController::updateFitParameterValues(), and FitSessionController::updateLog().

Here is the call graph for this function:

◆ fitSuiteItem()

FitSuiteItem * JobItem::fitSuiteItem ( )

◆ flags()

int SessionItem::flags ( ) const
privateinherited

Definition at line 557 of file SessionItem.cpp.

558 {
560 
561  if (!flags.isValid())
563 
564  return flags.toInt();
565 }

References SessionFlags::EDITABLE, SessionFlags::ENABLED, SessionFlags::FlagRole, SessionItem::roleProperty(), and SessionFlags::VISIBLE.

Referenced by SessionItem::changeFlags(), SessionItem::isEditable(), and SessionItem::isEnabled().

Here is the call graph for this function:

◆ getChildOfType()

SessionItem * SessionItem::getChildOfType ( const QString &  type) const
inherited

Returns the first child of the given type.

Definition at line 116 of file SessionItem.cpp.

117 {
118  for (auto* child : m_children)
119  if (child->modelType() == type)
120  return child;
121 
122  return nullptr;
123 }

References SessionItem::m_children.

Referenced by GroupItemController::currentItem(), GroupItemController::getItemOfType(), and GroupItemController::setCurrentType().

◆ getComments()

QString JobItem::getComments ( ) const

Definition at line 190 of file JobItem.cpp.

191 {
192  return getItemValue(P_COMMENTS).toString();
193 }

References SessionItem::getItemValue(), and P_COMMENTS.

Referenced by JobPropertiesWidget::notifyJobPropertyChange(), and JobPropertiesWidget::setItem().

Here is the call graph for this function:

◆ getCopyNumberOfChild()

int SessionItem::getCopyNumberOfChild ( const SessionItem item) const
privateinherited

internal

Definition at line 580 of file SessionItem.cpp.

581 {
582  if (!item)
583  return -1;
584  int result = -1;
585  int count = 0;
586  QString model_type = item->modelType();
587  // check child items:
588  for (auto* p_child_item : m_children) {
589  QString child_type = p_child_item->modelType();
590  if (p_child_item == item)
591  result = count;
592  if (child_type == model_type && !p_child_item->isTag(P_NAME))
593  ++count;
594  }
595  if (count > 1)
596  return result;
597  return -1;
598 }
static constexpr auto P_NAME
Definition: SessionItem.h:208

References SessionItem::item(), SessionItem::m_children, and SessionItem::P_NAME.

Referenced by SessionItem::displayName().

Here is the call graph for this function:

◆ getGroupItem()

SessionItem * SessionItem::getGroupItem ( const QString &  groupName) const
inherited

Access subitem of group item.

Definition at line 327 of file SessionItem.cpp.

328 {
329  return item<GroupItem>(groupName)->currentItem();
330 }

Referenced by SessionItem::groupItem(), and SessionItem::setGroupPropertyType().

◆ getIdentifier()

QString JobItem::getIdentifier ( ) const

Definition at line 73 of file JobItem.cpp.

74 {
75  return getItemValue(P_IDENTIFIER).toString();
76 }

References SessionItem::getItemValue(), and P_IDENTIFIER.

Referenced by JobModel::cancelJob(), GUI::Model::JobFunctions::copyRealDataItem(), JobModel::removeJob(), JobQueueData::runJob(), and updateIntensityDataFileName().

Here is the call graph for this function:

◆ getItem()

SessionItem * SessionItem::getItem ( const QString &  tag = "",
int  row = 0 
) const
inherited

Returns item in given row of given tag.

Definition at line 200 of file SessionItem.cpp.

201 {
202  const QString tagName = tag.isEmpty() ? defaultTag() : tag;
203 
204  if (!m_tags->isValid(tagName))
205  return nullptr;
206 
207  if (m_tags->childCount(tagName) == 0)
208  return nullptr;
209 
210  if (row < 0 || row >= m_tags->childCount(tagName))
211  return nullptr;
212 
213  int index = m_tags->indexFromTagRow(tagName, row);
214  ASSERT(index >= 0);
215  ASSERT(index < m_children.size());
216  return m_children[index];
217 }

References SessionItem::defaultTag(), SessionItem::index(), SessionItem::m_children, and SessionItem::m_tags.

Referenced by FitParameterItem::FitParameterItem(), EllipseItem::angle(), DataItem::axesUnits(), Data1DViewItem::axesUnitsDescriptor(), BasicAxisItem::binsItem(), FitSuiteItem::createFitParametersContainer(), createFitSuiteItem(), FitSuiteItem::createMinimizerContainer(), dataItem(), RealDataItem::dataItem(), dataItemView(), fitSuiteItem(), DataItem::getAxesUnitsItem(), SessionItem::getItemValue(), IntensityDataItem::gradient(), RealDataItem::initDataItem(), FitParameterItem::initMinMaxValues(), intensityDataItem(), isValidForFitting(), SessionItem::item(), FitParameterLinkItem::linkItem(), AmplitudeAxisItem::logScaleItem(), IntensityDataItem::maskContainerItem(), MaskItem::maskValueItem(), BasicAxisItem::max(), FitParameterItem::maximumItem(), BasicAxisItem::maxItem(), BasicAxisItem::min(), FitParameterItem::minimumItem(), BasicAxisItem::minItem(), RealDataItem::nativeData(), MinimizerContainerItem::normFunction(), MinimizerContainerItem::objectiveMetric(), VerticalLineItem::posX(), HorizontalLineItem::posY(), IntensityDataItem::projectionContainerItem(), realDataItem(), BasicAxisItem::serialize(), PolygonPointItem::serialize(), AmplitudeAxisItem::serialize(), RectangleItem::serialize(), PolygonItem::serialize(), VerticalLineItem::serialize(), HorizontalLineItem::serialize(), EllipseItem::serialize(), MaskAllItem::serialize(), PointwiseAxisItem::serialize(), SessionItem::setItemValue(), FitParameterItem::setLimitEnabled(), RealDataItem::setNativeDataUnits(), FitParameterItem::startValueItem(), BasicAxisItem::titleItem(), FitParameterItem::typeItem(), MinuitMinimizerItem::valueDescriptorsForUI(), GSLMultiMinimizerItem::valueDescriptorsForUI(), GeneticMinimizerItem::valueDescriptorsForUI(), SimAnMinimizerItem::valueDescriptorsForUI(), GSLLMAMinimizerItem::valueDescriptorsForUI(), BasicAxisItem::visibilityItem(), EllipseItem::xCenter(), RectangleItem::xLow(), EllipseItem::xRadius(), RectangleItem::xUp(), EllipseItem::yCenter(), RectangleItem::yLow(), EllipseItem::yRadius(), and RectangleItem::yUp().

Here is the call graph for this function:

◆ getItems()

QVector< SessionItem * > SessionItem::getItems ( const QString &  tag = "") const
inherited

Returns vector of all items of given tag.

Definition at line 221 of file SessionItem.cpp.

222 {
223  const QString tagName = tag.isEmpty() ? defaultTag() : tag;
224  if (!m_tags->isValid(tagName))
225  return QVector<SessionItem*>();
226 
227  int index = m_tags->tagStartIndex(tagName);
228  ASSERT(index >= 0 && index <= m_children.size());
229  return m_children.mid(index, m_tags->childCount(tagName));
230 }

References SessionItem::defaultTag(), SessionItem::index(), SessionItem::m_children, and SessionItem::m_tags.

Referenced by MaskUnitsConverter::convertIntensityDataItem(), SessionModel::copy(), GroupItem::groupItems(), SessionItem::items(), SessionModel::moveItem(), DataPropertyContainer::propertyItem(), DataPropertyContainer::propertyItems(), and SessionItem::takeRow().

Here is the call graph for this function:

◆ getItemValue()

QVariant SessionItem::getItemValue ( const QString &  tag) const
inherited

Directly access value of item under given tag.

Definition at line 292 of file SessionItem.cpp.

293 {
294  ASSERT(isTag(tag));
295  return getItem(tag)->value();
296 }
QVariant value() const
Get value.

References SessionItem::getItem(), SessionItem::isTag(), and SessionItem::value().

Referenced by FitParameterItem::attLimits(), Data1DViewItem::axesUnits(), beginTime(), BasicAxisItem::binCount(), FitSuiteItem::chi2(), Data1DProperties::color(), Data1DProperties::colorName(), MaskUnitsConverter::convertCoordinate(), MinimizerContainerItem::createMetric(), MinuitMinimizerItem::createMinimizer(), GSLMultiMinimizerItem::createMinimizer(), GeneticMinimizerItem::createMinimizer(), SimAnMinimizerItem::createMinimizer(), GSLLMAMinimizerItem::createMinimizer(), RectangleItem::createShape(), VerticalLineItem::createShape(), HorizontalLineItem::createShape(), EllipseItem::createShape(), DataProperties::dataItem(), endTime(), DataItem::fileName(), getComments(), IntensityDataItem::getGradient(), getIdentifier(), getProgress(), getStatus(), PointwiseAxisItem::getUnitsLabel(), FitParameterItem::initMinMaxValues(), RealDataItem::instrumentId(), instrumentName(), PolygonItem::isClosed(), IntensityDataItem::isInterpolated(), AmplitudeAxisItem::isLocked(), AmplitudeAxisItem::isLogScale(), BasicAxisItem::isTitleVisible(), FitParameterItem::isValid(), MaskItem::isVisibleValue(), SessionItem::itemName(), FitSuiteItem::iterationCount(), Data1DProperties::line(), FitParameterLinkItem::link(), MaskItem::maskValue(), FitParameterItem::maximum(), FitParameterItem::minimum(), RealDataItem::nativeDataUnits(), Data1DProperties::nextColorName(), PropertyRepeater::onPropertyChanged(), FitParameterItem::parameterType(), PolygonPointItem::posX(), PolygonPointItem::posY(), presentationType(), Data1DProperties::scatter(), DataItem::selectedCoords(), PropertyRepeater::setOnChildPropertyChange(), FitParameterItem::startValue(), BasicAxisItem::title(), FitParameterLinkItem::title(), and FitSuiteItem::updateInterval().

Here is the call graph for this function:

◆ getProgress()

int JobItem::getProgress ( ) const

Definition at line 201 of file JobItem.cpp.

202 {
203  return getItemValue(P_PROGRESS).toInt();
204 }

References SessionItem::getItemValue(), and P_PROGRESS.

Referenced by JobListViewDelegate::drawCustomProjectBar().

Here is the call graph for this function:

◆ getRoles()

QVector< int > SessionItem::getRoles ( ) const
inherited

Returns vector of all present roles.

Definition at line 351 of file SessionItem.cpp.

352 {
353  return m_properties->roles();
354 }
std::unique_ptr< SessionItemData > m_properties
Definition: SessionItem.h:333

References SessionItem::m_properties.

Referenced by GUI::Session::XML::writeItemAndChildItems().

◆ getStatus()

JobStatus JobItem::getStatus ( ) const

Definition at line 106 of file JobItem.cpp.

107 {
109 }
JobStatus jobStatusFromString(const QString &name)
get status value for given string representation
Definition: JobStatus.cpp:39

References SessionItem::getItemValue(), jobStatusFromString(), P_STATUS, and GUI::View::PropertyEditorFactory::toString().

Referenced by JobPropertiesTableModel::data(), JobListViewDelegate::drawCustomProjectBar(), isCanceled(), isCompleted(), isFailed(), isFitting(), isIdle(), isRunning(), and FitSessionController::onFittingFinished().

Here is the call graph for this function:

◆ groupItem()

template<typename T >
T & SessionItem::groupItem ( const QString &  groupName) const
inherited

Definition at line 413 of file SessionItem.h.

414 {
415  auto* t = dynamic_cast<T*>(getGroupItem(groupName));
416  ASSERT(t);
417  return *t;
418 }
SessionItem * getGroupItem(const QString &groupName) const
Access subitem of group item.

References SessionItem::getGroupItem().

Referenced by SessionItem::addGroupProperty().

Here is the call graph for this function:

◆ hasChildren()

bool SessionItem::hasChildren ( ) const
inherited

Indicates whether this SessionItem has any child items.

Definition at line 81 of file SessionItem.cpp.

82 {
83  return numberOfChildren() > 0;
84 }
int numberOfChildren() const
Returns total number of children.
Definition: SessionItem.cpp:88

References SessionItem::numberOfChildren().

Referenced by IntensityDataItem::hasProjections().

Here is the call graph for this function:

◆ hasModelType()

template<typename T >
bool SessionItem::hasModelType
inherited

Definition at line 421 of file SessionItem.h.

422 {
423  return modelType() == T::M_TYPE;
424 }
QString modelType() const
Get model type.

References SessionItem::modelType().

Referenced by MaskViewFactory::createMaskView(), FitParameterModel::flags(), FitParameterModel::index(), FitParameterModel::indexOfItem(), FitParameterWidget::onFitParametersSelectionChanged(), FitParameterModel::rowCount(), and MaskGraphicsScene::updateViews().

Here is the call graph for this function:

◆ index()

QModelIndex SessionItem::index ( ) const
inherited

◆ insertChild()

void SessionItem::insertChild ( int  row,
SessionItem item,
const QString &  tag = "" 
)
inherited

Insert item into given tag into given row.

Definition at line 233 of file SessionItem.cpp.

234 {
235  ASSERT(item);
236  ASSERT(!item->parentItem());
237 
238  const QString tagName = tag.isEmpty() ? defaultTag() : tag;
239  ASSERT(m_tags->isValid(tagName, item->modelType()));
240 
241  int index = m_tags->insertIndexFromTagRow(tagName, row);
242  ASSERT(index >= 0);
243  ASSERT(index <= m_children.size());
244 
245  if (m_model)
246  m_model->beginInsertRows(this->index(), index, index);
247 
248  item->setParentAndModel(this, m_model);
249  m_children.insert(index, item);
250 
251  m_tags->addChild(tagName);
252  if (m_model)
253  m_model->endInsertRows();
254 }

References SessionItem::defaultTag(), SessionItem::index(), SessionItem::item(), SessionItem::m_children, SessionItem::m_model, and SessionItem::m_tags.

Referenced by GroupItemController::GroupItemController(), addDataViewItem(), SessionItem::addGroupProperty(), DataPropertyContainer::addItem(), MaskContainerItem::addMask(), PolygonItem::addPoint(), SessionItem::addProperty(), GUI::Model::ItemFactory::CreateItem(), GroupItemController::getItemOfType(), MaskItems::insertMask(), MaskContainerItem::insertMask(), SessionModel::insertNewItem(), SessionModel::moveItem(), and GroupItemController::setCurrentType().

Here is the call graph for this function:

◆ instrument2DItem()

Instrument2DItem * JobItem::instrument2DItem ( )

Definition at line 238 of file JobItem.cpp.

239 {
240  auto* result = dynamic_cast<Instrument2DItem*>(m_instrument.get());
241  ASSERT(result);
242  return result;
243 }

References m_instrument.

◆ instrumentItem()

◆ instrumentName()

QString JobItem::instrumentName ( ) const

Definition at line 325 of file JobItem.cpp.

326 {
327  return getItemValue(P_INSTRUMENT_NAME).toString();
328 }

References SessionItem::getItemValue(), and P_INSTRUMENT_NAME.

Referenced by JobPropertiesTableModel::data().

Here is the call graph for this function:

◆ intensityDataItem()

IntensityDataItem * JobItem::intensityDataItem ( )

Definition at line 96 of file JobItem.cpp.

97 {
98  return dynamic_cast<IntensityDataItem*>(getItem(T_OUTPUT));
99 }

References SessionItem::getItem(), and T_OUTPUT.

Referenced by JobListView::equalizeSelectedToJob(), and FitComparisonWidget::simulatedDataItem().

Here is the call graph for this function:

◆ isCanceled()

bool JobItem::isCanceled ( ) const

Definition at line 139 of file JobItem.cpp.

140 {
141  return getStatus() == JobStatus::Canceled;
142 }
@ Canceled
the job was stopped by the user
JobStatus getStatus() const
Definition: JobItem.cpp:106

References Canceled, and getStatus().

Referenced by JobRealTimeWidget::isValidJobItem().

Here is the call graph for this function:

◆ isCompleted()

bool JobItem::isCompleted ( ) const

Definition at line 134 of file JobItem.cpp.

135 {
136  return getStatus() == JobStatus::Completed;
137 }
@ Completed
the job was successfully completed

References Completed, and getStatus().

Referenced by JobRealTimeWidget::isValidJobItem(), FitSessionController::onFittingFinished(), and JobQueueData::processFinishedJob().

Here is the call graph for this function:

◆ isEditable()

bool SessionItem::isEditable ( ) const
inherited

Definition at line 468 of file SessionItem.cpp.

469 {
470  return flags() & SessionFlags::EDITABLE;
471 }

References SessionFlags::EDITABLE, and SessionItem::flags().

Referenced by SessionModel::flags().

Here is the call graph for this function:

◆ isEnabled()

bool SessionItem::isEnabled ( ) const
inherited

Definition at line 463 of file SessionItem.cpp.

464 {
465  return flags() & SessionFlags::ENABLED;
466 }

References SessionFlags::ENABLED, and SessionItem::flags().

Referenced by SessionModel::flags().

Here is the call graph for this function:

◆ isFailed()

bool JobItem::isFailed ( ) const

Definition at line 144 of file JobItem.cpp.

145 {
146  return getStatus() == JobStatus::Failed;
147 }
@ Failed
the job aborted because it hit an error

References Failed, and getStatus().

Referenced by JobRealTimeWidget::isValidJobItem(), and JobPropertiesWidget::setItem().

Here is the call graph for this function:

◆ isFitting()

bool JobItem::isFitting ( ) const

Definition at line 149 of file JobItem.cpp.

150 {
151  return getStatus() == JobStatus::Fitting;
152 }
@ Fitting
the job is busy fitting

References Fitting, and getStatus().

Referenced by JobListView::updateActions().

Here is the call graph for this function:

◆ isIdle()

bool JobItem::isIdle ( ) const

Definition at line 124 of file JobItem.cpp.

125 {
126  return getStatus() == JobStatus::Idle;
127 }

References getStatus(), and Idle.

Here is the call graph for this function:

◆ isItemNamePropertyName()

bool SessionItem::isItemNamePropertyName ( const QString &  name)
staticinherited

Definition at line 446 of file SessionItem.cpp.

447 {
448  return P_NAME == name;
449 }

References GUI::RealSpace::Particles::name(), and SessionItem::P_NAME.

Here is the call graph for this function:

◆ isRunning()

bool JobItem::isRunning ( ) const

Definition at line 129 of file JobItem.cpp.

130 {
131  return getStatus() == JobStatus::Running;
132 }
@ Running
the job is busy calculating

References getStatus(), and Running.

Referenced by JobListViewDelegate::editorEvent(), JobListViewDelegate::paint(), and JobListView::updateActions().

Here is the call graph for this function:

◆ isSpecularJob()

bool JobItem::isSpecularJob ( ) const

Definition at line 394 of file JobItem.cpp.

395 {
397 }
bool is() const
InstrumentItem * instrumentItem() const
Definition: JobItem.cpp:233

References instrumentItem(), and InstrumentItem::is().

Referenced by ParameterTreeBuilder::allowMagneticFields().

Here is the call graph for this function:

◆ isTag()

bool SessionItem::isTag ( const QString &  name) const
inherited

Returns true if tag is available.

Definition at line 166 of file SessionItem.cpp.

167 {
168  return m_tags->isValid(name);
169 }

References SessionItem::m_tags, and GUI::RealSpace::Particles::name().

Referenced by SessionItem::addProperty(), MaskUnitsConverter::convertCoordinate(), SessionItem::getItemValue(), isValidForFitting(), SessionItem::itemName(), SessionItem::setItemName(), SessionItem::setItemValue(), and FitParameterItem::setLimitEnabled().

Here is the call graph for this function:

◆ isValidForFitting()

bool JobItem::isValidForFitting ( )

Definition at line 154 of file JobItem.cpp.

155 {
156  return isTag(T_REALDATA) && getItem(T_REALDATA);
157 }

References SessionItem::getItem(), SessionItem::isTag(), and T_REALDATA.

Referenced by GUI::Model::JobFunctions::initDataView(), RunFitControlWidget::isValidJobItem(), FitActivityPanel::isValidJobItem(), and JobView::setAppropriateActivityForJob().

Here is the call graph for this function:

◆ item()

◆ itemName()

QString SessionItem::itemName ( ) const
inherited

Get item name, return display name if no name is set.

Definition at line 432 of file SessionItem.cpp.

433 {
434  return isTag(P_NAME) ? getItemValue(P_NAME).toString() : displayName();
435 }
QString displayName() const
Get display name of item, append index if ambigue.

References SessionItem::displayName(), SessionItem::getItemValue(), SessionItem::isTag(), and SessionItem::P_NAME.

Referenced by SessionModel::data(), RealDataItem::dataName(), jobName(), MaskItem::maskName(), GUI::Session::XML::readItems(), MaskGraphicsScene::setItemName(), Plot1D::subscribeToItem(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), ProjectionsPlot::subscribeToItem(), and updateIntensityDataFileName().

Here is the call graph for this function:

◆ items()

template<typename T >
QVector< T * > SessionItem::items ( const QString &  tag = "") const
inherited

Definition at line 361 of file SessionItem.h.

362 {
363  QVector<T*> result;
364 
365  for (SessionItem* item : getItems(tag))
366  if (auto* titem = dynamic_cast<T*>(item))
367  result.push_back(titem);
368  return result;
369 }
QVector< SessionItem * > getItems(const QString &tag="") const
Returns vector of all items of given tag.

References SessionItem::getItems(), and SessionItem::item().

Referenced by DataPropertyContainer::dataItems(), SessionItem::takeRow(), and SessionModel::topItem().

Here is the call graph for this function:

◆ jobBeginTimeChanged

void JobItem::jobBeginTimeChanged ( const QDateTime &  begin_time)
signal

◆ jobCommentsChanged

void JobItem::jobCommentsChanged ( const QString &  comments)
signal

◆ jobDestroyed

void JobItem::jobDestroyed ( )
signal

◆ jobEndTimeChanged

void JobItem::jobEndTimeChanged ( const QDateTime &  end_time)
signal

◆ jobIdentifierChanged

void JobItem::jobIdentifierChanged ( const QString &  identifier)
signal

Referenced by setIdentifier().

◆ jobInstrumentNameChanged

void JobItem::jobInstrumentNameChanged ( const QString &  name)
signal

Referenced by setInstrumentName().

◆ jobName()

QString JobItem::jobName ( ) const

Definition at line 84 of file JobItem.cpp.

85 {
86  return itemName();
87 }
QString itemName() const
Get item name, return display name if no name is set.

References SessionItem::itemName().

Referenced by GUI::Model::JobFunctions::copyRealDataItem(), JobListModel::data(), JobPropertiesTableModel::data(), JobListViewDelegate::paint(), and JobListView::showContextMenu().

Here is the call graph for this function:

◆ jobNameChanged

void JobItem::jobNameChanged ( const QString &  name)
signal

◆ jobPresentationTypeChanged

void JobItem::jobPresentationTypeChanged ( const QString &  type)
signal

Referenced by setPresentationType().

◆ jobProgressChanged

void JobItem::jobProgressChanged ( int  progress)
signal

◆ jobStatusChanged

◆ limits()

RealLimits SessionItem::limits ( ) const
inherited

Definition at line 473 of file SessionItem.cpp.

474 {
475  return roleProperty(SessionFlags::LimitsRole).value<RealLimits>();
476 }

References SessionFlags::LimitsRole, and SessionItem::roleProperty().

Referenced by GUI::View::PropertyEditorFactory::CreateEditor(), FitParameterContainerItem::createParameters(), and FitParameterItem::initMinMaxValues().

Here is the call graph for this function:

◆ mapper()

ModelMapper * SessionItem::mapper ( )
inherited

◆ model()

◆ modelType()

◆ numberOfChildren()

int SessionItem::numberOfChildren ( ) const
inherited

◆ parameterContainerItem() [1/2]

ParameterContainerItem * JobItem::parameterContainerItem ( )

Definition at line 271 of file JobItem.cpp.

272 {
273  return const_cast<ParameterContainerItem*>(
274  static_cast<const JobItem*>(this)->parameterContainerItem());
275 }
ParameterContainerItem * parameterContainerItem()
Definition: JobItem.cpp:271
The ParameterContainerItem is a top item to hold all ParameterItem, represents an entry point to para...

Referenced by ParameterTreeBuilder::addParameterItem(), ParameterTreeBuilder::parameterContainer(), JobModel::restore(), FitObjectiveBuilder::update_fit_parameters(), and FitSessionController::updateFitParameterValues().

◆ parameterContainerItem() [2/2]

const ParameterContainerItem * JobItem::parameterContainerItem ( ) const

Definition at line 277 of file JobItem.cpp.

278 {
279  return &m_parameterContainer;
280 }
ParameterContainerItem m_parameterContainer
Definition: JobItem.h:165

References m_parameterContainer.

◆ parentItem()

◆ parentRow()

int SessionItem::parentRow ( )
inherited

Returns the index of the given item within its parent. Returns -1 when no parent is set.

Definition at line 148 of file SessionItem.cpp.

149 {
150  if (parentItem())
151  return parentItem()->rowOfChild(this);
152  return -1;
153 }
SessionItem * parentItem() const
Returns parent of this item.
Definition: SessionItem.cpp:67

References SessionItem::parentItem(), and SessionItem::rowOfChild().

Referenced by FitParameterModel::indexOfItem(), and FitParameterModel::parent().

Here is the call graph for this function:

◆ presentationType()

QString JobItem::presentationType ( ) const

Definition at line 336 of file JobItem.cpp.

337 {
338  return getItemValue(P_PRESENTATION_TYPE).toString();
339 }

References SessionItem::getItemValue(), and P_PRESENTATION_TYPE.

Here is the call graph for this function:

◆ readNonSessionItems()

void JobItem::readNonSessionItems ( QXmlStreamReader *  reader)
overridevirtual

Reimplemented from SessionItem.

Definition at line 366 of file JobItem.cpp.

367 {
368  const int version = reader->attributes().value(GUI::Session::XML::Version).toInt();
369 
370  if (version < 1)
372 
373  if (version > 1)
375 
376  while (reader->readNextStartElement()) {
377  if (reader->name() == Tags::SimulationOptions) {
379  GUI::Session::XML::gotoEndElementOfTag(reader, Tags::SimulationOptions);
380  } else if (reader->name() == Tags::Instrument) {
381  InstrumentItem* p = nullptr;
382  Streamer(reader).read<InstrumentItemCatalog>(Tags::Instrument, p);
383  m_instrument.reset(p);
384  } else if (reader->name() == Tags::ParameterContainer) {
386  GUI::Session::XML::gotoEndElementOfTag(reader, Tags::ParameterContainer);
387  } else if (reader->name() == Tags::Sample) {
389  GUI::Session::XML::gotoEndElementOfTag(reader, Tags::Sample);
390  }
391  }
392 }
static DeserializationException tooOld()
static DeserializationException tooNew()
Abstract base class for instrument-specific item classes.
void readContentFrom(QXmlStreamReader *reader)
void readContentFrom(QXmlStreamReader *reader)
void readContentFrom(QXmlStreamReader *reader)
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36
void read(const QString &tag, typename Catalog::CatalogedType *&p, Args... argsForConstructor)
Definition: Streamer.h:93
constexpr auto Version("Version")
void gotoEndElementOfTag(QXmlStreamReader *reader, const QString &tag)
Definition: UtilXML.cpp:49

References GUI::Session::XML::gotoEndElementOfTag(), m_instrument, m_parameterContainer, m_sampleItem, m_simulationOptionsItem, Streamer::read(), ParameterContainerItem::readContentFrom(), MultiLayerItem::readContentFrom(), SimulationOptionsItem::readContentFrom(), DeserializationException::tooNew(), DeserializationException::tooOld(), and GUI::Session::XML::Version().

Here is the call graph for this function:

◆ realDataItem()

RealDataItem * JobItem::realDataItem ( )

Definition at line 290 of file JobItem.cpp.

291 {
292  return dynamic_cast<RealDataItem*>(getItem(JobItem::T_REALDATA));
293 }

References SessionItem::getItem(), and T_REALDATA.

Referenced by FitObjectiveBuilder::createFitObjective(), GUI::Model::JobFunctions::initDataView(), FitComparisonWidget::realDataItem(), FitComparisonController2D::setItem(), DiffItemController::updateDiffData(), and updateIntensityDataFileName().

Here is the call graph for this function:

◆ registerTag()

bool SessionItem::registerTag ( const QString &  name,
int  min = 0,
int  max = -1,
QStringList  modelTypes = {} 
)
inherited

Add new tag to this item with given name, min, max and types. max = -1 -> unlimited, modelTypes empty -> all types allowed.

Definition at line 159 of file SessionItem.cpp.

160 {
161  return m_tags->registerTag(name, min, max, modelTypes);
162 }

References SessionItem::m_tags, and GUI::RealSpace::Particles::name().

Referenced by Data1DViewItem::Data1DViewItem(), DataPropertyContainer::DataPropertyContainer(), FitParameterContainerItem::FitParameterContainerItem(), FitParameterItem::FitParameterItem(), FitSuiteItem::FitSuiteItem(), GroupItem::GroupItem(), IntensityDataItem::IntensityDataItem(), JobItem(), MaskContainerItem::MaskContainerItem(), PolygonItem::PolygonItem(), ProjectionContainerItem::ProjectionContainerItem(), RealDataItem::RealDataItem(), SessionItem::addGroupProperty(), SessionItem::addProperty(), and SessionModel::createRootItem().

Here is the call graph for this function:

◆ roleProperty()

QVariant SessionItem::roleProperty ( int  role) const
inherited

◆ rowOfChild()

int SessionItem::rowOfChild ( SessionItem child) const
inherited

Returns row index of given child.

Definition at line 109 of file SessionItem.cpp.

110 {
111  return m_children.indexOf(child);
112 }

Referenced by SessionItem::childDeleted(), SessionModel::indexOfItem(), SessionModel::moveItem(), ProjectionsEditorCanvas::onLeavingColorMap(), and SessionItem::parentRow().

◆ runImmediately()

bool JobItem::runImmediately ( ) const

Definition at line 212 of file JobItem.cpp.

213 {
215 }
const SimulationOptionsItem & simulationOptionsItem() const
Definition: JobItem.cpp:415

References SimulationOptionsItem::runImmediately(), and simulationOptionsItem().

Here is the call graph for this function:

◆ runInBackground()

bool JobItem::runInBackground ( ) const

Definition at line 217 of file JobItem.cpp.

218 {
220 }

References SimulationOptionsItem::runInBackground(), and simulationOptionsItem().

Referenced by JobView::onFocusRequest().

Here is the call graph for this function:

◆ sampleItem()

MultiLayerItem * JobItem::sampleItem ( )

◆ sampleName()

QString JobItem::sampleName ( ) const

Definition at line 320 of file JobItem.cpp.

321 {
322  return m_sampleItem.sampleName();
323 }
QString sampleName() const

References m_sampleItem, and MultiLayerItem::sampleName().

Referenced by JobPropertiesTableModel::data().

Here is the call graph for this function:

◆ serializeBinaryData()

QByteArray SessionItem::serializeBinaryData ( ) const
virtualinherited

Reimplemented in PointwiseAxisItem, and RealDataItem.

Definition at line 517 of file SessionItem.cpp.

518 {
519  return QByteArray();
520 }

Referenced by GUI::Session::XML::writeItemAndChildItems().

◆ sessionItemTags()

const SessionItemTags * SessionItem::sessionItemTags ( ) const
inherited

Definition at line 171 of file SessionItem.cpp.

172 {
173  return m_tags.get();
174 }

References SessionItem::m_tags.

Referenced by SessionItem::displayName(), SessionModel::insertNewItem(), and SessionModel::moveItem().

◆ setBeginTime()

void JobItem::setBeginTime ( const QDateTime &  begin_time)

Definition at line 164 of file JobItem.cpp.

165 {
166  setItemValue(P_BEGIN_TIME, begin_time.toString(Qt::ISODateWithMs));
167  emit jobBeginTimeChanged(begin_time);
168 }
void jobBeginTimeChanged(const QDateTime &begin_time)
void setItemValue(const QString &tag, const QVariant &variant) const
Directly set value of item under given tag.

References jobBeginTimeChanged(), P_BEGIN_TIME, and SessionItem::setItemValue().

Referenced by FitSessionController::onFittingStarted().

Here is the call graph for this function:

◆ setComments()

void JobItem::setComments ( const QString &  comments)

Definition at line 195 of file JobItem.cpp.

196 {
197  setItemValue(P_COMMENTS, comments);
198  emit jobCommentsChanged(comments);
199 }
void jobCommentsChanged(const QString &comments)

References jobCommentsChanged(), P_COMMENTS, and SessionItem::setItemValue().

Referenced by JobPropertiesWidget::onCommentsEdited(), JobQueueData::processFinishedJob(), and JobQueueData::runJob().

Here is the call graph for this function:

◆ setDataType()

template<typename T >
T * JobItem::setDataType

Definition at line 171 of file JobItem.h.

172 {
173  static_assert(std::is_base_of<DataItem, T>::value, "Class must be derived from DataItem");
174 
175  return model()->insertItem<T>(this, -1, T_OUTPUT);
176 }

References SessionModel::insertItem(), SessionItem::model(), and T_OUTPUT.

Referenced by GUI::Model::JobFunctions::setupJobItemOutput().

Here is the call graph for this function:

◆ setDecimals()

SessionItem & SessionItem::setDecimals ( int  n)
inherited

Definition at line 489 of file SessionItem.cpp.

490 {
492  return *this;
493 }

References SessionFlags::DecimalRole, and SessionItem::setRoleProperty().

Referenced by BasicAxisItem::BasicAxisItem(), and SessionItem::SessionItem().

Here is the call graph for this function:

◆ setDefaultTag()

void SessionItem::setDefaultTag ( const QString &  tag)
inherited

◆ setDisplayName()

void SessionItem::setDisplayName ( const QString &  display_name)
inherited

Set display name.

Definition at line 426 of file SessionItem.cpp.

427 {
429 }

References SessionFlags::DisplayNameRole, and SessionItem::setRoleProperty().

Referenced by SessionItem::SessionItem(), SessionItem::addProperty(), FitParameterContainerItem::createFitParameter(), and GUI::Session::XML::readItems().

Here is the call graph for this function:

◆ setEditable()

void SessionItem::setEditable ( bool  enabled)
inherited

Definition at line 458 of file SessionItem.cpp.

459 {
461 }
void changeFlags(bool enabled, int flag)
internal

References SessionItem::changeFlags(), and SessionFlags::EDITABLE.

Referenced by JobItem(), and FitParameterItem::setLimitEnabled().

Here is the call graph for this function:

◆ setEnabled()

void SessionItem::setEnabled ( bool  enabled)
inherited

Flags accessors.

Definition at line 453 of file SessionItem.cpp.

454 {
456 }

References SessionItem::changeFlags(), and SessionFlags::ENABLED.

Referenced by FitParameterItem::FitParameterItem(), MaskAllItem::MaskAllItem(), PointwiseAxisItem::PointwiseAxisItem(), GroupItemController::getItemOfType(), and FitParameterItem::setLimitEnabled().

Here is the call graph for this function:

◆ setEndTime()

void JobItem::setEndTime ( const QDateTime &  end_time)

Definition at line 175 of file JobItem.cpp.

176 {
177  setItemValue(P_END_TIME, end_time.toString(Qt::ISODateWithMs));
178  emit jobEndTimeChanged(end_time);
179 }
void jobEndTimeChanged(const QDateTime &end_time)

References jobEndTimeChanged(), P_END_TIME, and SessionItem::setItemValue().

Referenced by FitSessionController::onFittingError(), FitSessionController::onFittingFinished(), FitSessionController::onFittingStarted(), and JobQueueData::processFinishedJob().

Here is the call graph for this function:

◆ setGroupProperty()

SessionItem * SessionItem::setGroupProperty ( const QString &  groupTag,
const QString &  modelType 
) const
inherited

Set the current type of group item.

Definition at line 320 of file SessionItem.cpp.

321 {
322  return item<GroupItem>(groupTag)->setCurrentType(modelType);
323 }

References SessionItem::modelType().

Referenced by SessionItem::setGroupPropertyType().

Here is the call graph for this function:

◆ setGroupPropertyType()

template<typename T >
T * SessionItem::setGroupPropertyType ( const QString &  groupTag)
inherited

Definition at line 404 of file SessionItem.h.

405 {
406  SessionItem* item = getGroupItem(groupTag);
407  if (!item->hasModelType<T>())
408  return dynamic_cast<T*>(setGroupProperty(groupTag, T::M_TYPE));
409  return dynamic_cast<T*>(item);
410 }
SessionItem * setGroupProperty(const QString &groupTag, const QString &modelType) const
Set the current type of group item.

References SessionItem::getGroupItem(), SessionItem::item(), and SessionItem::setGroupProperty().

Here is the call graph for this function:

◆ setIdentifier()

void JobItem::setIdentifier ( const QString &  identifier)

Definition at line 78 of file JobItem.cpp.

79 {
80  setItemValue(P_IDENTIFIER, identifier);
81  emit jobIdentifierChanged(identifier);
82 }
void jobIdentifierChanged(const QString &identifier)

References jobIdentifierChanged(), P_IDENTIFIER, and SessionItem::setItemValue().

Here is the call graph for this function:

◆ setInstrumentName()

void JobItem::setInstrumentName ( const QString &  name)

Definition at line 330 of file JobItem.cpp.

331 {
334 }
void jobInstrumentNameChanged(const QString &name)

References jobInstrumentNameChanged(), GUI::RealSpace::Particles::name(), P_INSTRUMENT_NAME, and SessionItem::setItemValue().

Referenced by GUI::Model::JobFunctions::setupJobItemInstrument().

Here is the call graph for this function:

◆ setItemName()

void SessionItem::setItemName ( const QString &  name)
inherited

◆ setItemValue()

void SessionItem::setItemValue ( const QString &  tag,
const QVariant &  variant 
) const
inherited

Directly set value of item under given tag.

Definition at line 300 of file SessionItem.cpp.

301 {
302  ASSERT(isTag(tag));
303  getItem(tag)->setValue(variant);
304 }
bool setValue(QVariant value)
Set value, ensure that variant types match.

References SessionItem::getItem(), SessionItem::isTag(), and SessionItem::setValue().

Referenced by MaskUnitsConverter::convertCoordinate(), PointwiseAxisItem::init(), FitParameterItem::initMinMaxValues(), RealDataItem::linkToInstrument(), EllipseItem::setAngle(), Data1DViewItem::setAxesUnits(), DataItem::setAxesUnits(), setBeginTime(), BasicAxisItem::setBinCount(), FitSuiteItem::setChi2(), Data1DProperties::setColorProperty(), setComments(), DataProperties::setDataItem(), setEndTime(), DataItem::setFileName(), IntensityDataItem::setGradient(), setIdentifier(), setInstrumentName(), IntensityDataItem::setInterpolated(), PolygonItem::setIsClosed(), MaskItem::setIsVisibleValue(), SessionItem::setItemName(), FitSuiteItem::setIterationCount(), Data1DProperties::setLineProperty(), FitParameterLinkItem::setLink(), AmplitudeAxisItem::setLocked(), AmplitudeAxisItem::setLogScale(), BasicAxisItem::setLowerBound(), MaskItem::setMaskValue(), FitParameterItem::setMaximum(), FitParameterItem::setMinimum(), PolygonPointItem::setPosX(), VerticalLineItem::setPosX(), PolygonPointItem::setPosY(), HorizontalLineItem::setPosY(), setPresentationType(), setProgress(), Data1DProperties::setScatterProperty(), FitParameterItem::setStartValue(), setStatus(), BasicAxisItem::setTitle(), FitParameterLinkItem::setTitle(), FitSuiteItem::setUpdateInterval(), BasicAxisItem::setUpperBound(), BasicAxisItem::setVisibilityValue(), EllipseItem::setXCenter(), RectangleItem::setXLow(), EllipseItem::setXRadius(), RectangleItem::setXUp(), EllipseItem::setYCenter(), RectangleItem::setYLow(), EllipseItem::setYRadius(), RectangleItem::setYUp(), and RealDataItem::unlinkFromInstrument().

Here is the call graph for this function:

◆ setJobName()

void JobItem::setJobName ( const QString &  name)

Definition at line 89 of file JobItem.cpp.

90 {
93  emit jobNameChanged(name);
94 }
void jobNameChanged(const QString &name)
void updateIntensityDataFileName()
Updates the name of file to store intensity data.
Definition: JobItem.cpp:401

References jobNameChanged(), GUI::RealSpace::Particles::name(), SessionItem::setItemName(), and updateIntensityDataFileName().

Referenced by JobPropertiesTableModel::setData().

Here is the call graph for this function:

◆ setLimits()

SessionItem & SessionItem::setLimits ( const RealLimits &  value)
inherited

Definition at line 478 of file SessionItem.cpp.

479 {
480  setRoleProperty(SessionFlags::LimitsRole, QVariant::fromValue<RealLimits>(value));
481  return *this;
482 }

References SessionFlags::LimitsRole, SessionItem::setRoleProperty(), and SessionItem::value().

Referenced by BasicAxisItem::BasicAxisItem(), EllipseItem::EllipseItem(), FitParameterItem::FitParameterItem(), HorizontalLineItem::HorizontalLineItem(), PolygonPointItem::PolygonPointItem(), RectangleItem::RectangleItem(), SessionItem::SessionItem(), VerticalLineItem::VerticalLineItem(), and FitParameterItem::initMinMaxValues().

Here is the call graph for this function:

◆ setModel()

void SessionItem::setModel ( SessionModel model)
privateinherited

Definition at line 546 of file SessionItem.cpp.

547 {
548  m_model = model;
549 
550  if (m_mapper)
551  m_mapper->setItem(this);
552 
553  for (auto& child : m_children)
554  child->setModel(model);
555 }

References SessionItem::m_children, SessionItem::m_mapper, SessionItem::m_model, and SessionItem::model().

Referenced by SessionItem::~SessionItem(), SessionModel::createRootItem(), and SessionItem::setParentAndModel().

Here is the call graph for this function:

◆ setParentAndModel()

void SessionItem::setParentAndModel ( SessionItem parent,
SessionModel model 
)
privateinherited

Definition at line 540 of file SessionItem.cpp.

541 {
542  setModel(model);
543  m_parent = parent;
544 }
void setModel(SessionModel *model)

References SessionItem::m_parent, SessionItem::model(), and SessionItem::setModel().

Referenced by SessionItem::takeItem().

Here is the call graph for this function:

◆ setPresentationType()

void JobItem::setPresentationType ( const QString &  type)

Definition at line 341 of file JobItem.cpp.

342 {
344  emit jobPresentationTypeChanged(type);
345 }
void jobPresentationTypeChanged(const QString &type)

References jobPresentationTypeChanged(), P_PRESENTATION_TYPE, and SessionItem::setItemValue().

Referenced by JobResultsPresenter::setPresentation().

Here is the call graph for this function:

◆ setProgress()

void JobItem::setProgress ( int  progress)

Definition at line 206 of file JobItem.cpp.

207 {
208  setItemValue(P_PROGRESS, progress);
209  emit jobProgressChanged(progress);
210 }
void jobProgressChanged(int progress)

References jobProgressChanged(), P_PROGRESS, and SessionItem::setItemValue().

Referenced by FitSessionController::onFittingFinished(), FitSessionController::onFittingStarted(), JobQueueData::onProgressUpdate(), JobQueueData::onStartedJob(), JobQueueData::processFinishedJob(), and JobQueueData::runJob().

Here is the call graph for this function:

◆ setResults()

void JobItem::setResults ( const SimulationResult &  result)

Definition at line 251 of file JobItem.cpp.

252 {
255 }
DataItem * dataItem()
Definition: JobItem.cpp:101
void setResults(DataItem *intensityItem, const SimulationResult &result)
Sets simulation results into the DataItem.

References dataItem(), GUI::Model::JobItemUtils::setResults(), and updateIntensityDataFileName().

Referenced by JobQueueData::processFinishedJob().

Here is the call graph for this function:

◆ setRoleProperty()

bool SessionItem::setRoleProperty ( int  role,
const QVariant &  value 
)
inherited

Set the contained role property to the given value. See also setTranslatorForRolePropertySetter.

Set variant to role, create role if not present yet.

Definition at line 341 of file SessionItem.cpp.

342 {
343  bool result = m_properties->setData(role, value);
344  if (result)
345  emitDataChanged(role);
346  return result;
347 }
void emitDataChanged(int role=Qt::DisplayRole)
Notify model about data changes.

References SessionItem::emitDataChanged(), SessionItem::m_properties, and SessionItem::value().

Referenced by SessionItem::SessionItem(), SessionItem::changeFlags(), GUI::Session::XML::readProperty(), SessionModel::setData(), SessionItem::setDecimals(), SessionItem::setDefaultTag(), SessionItem::setDisplayName(), SessionItem::setLimits(), SessionItem::setToolTip(), and SessionItem::setValue().

Here is the call graph for this function:

◆ setStatus()

void JobItem::setStatus ( JobStatus  status)

Definition at line 111 of file JobItem.cpp.

112 {
114  if (status == JobStatus::Failed) {
115  if (DataItem* intensityItem = dataItem()) {
116  if (intensityItem->getDatafield())
117  intensityItem->getDatafield()->setAllTo(0.0);
118  emit intensityItem->emitDataChanged();
119  }
120  }
121  emit jobStatusChanged(status);
122 }
void jobStatusChanged(const JobStatus status)

References dataItem(), Failed, jobStatusChanged(), jobStatusToString(), P_STATUS, and SessionItem::setItemValue().

Referenced by FitSessionController::onFittingFinished(), FitSessionController::onFittingStarted(), FitSessionController::onStartFittingRequest(), JobQueueData::processFinishedJob(), and JobQueueData::runJob().

Here is the call graph for this function:

◆ setToolTip()

SessionItem & SessionItem::setToolTip ( const QString &  tooltip)
inherited

Definition at line 500 of file SessionItem.cpp.

501 {
502  setRoleProperty(Qt::ToolTipRole, tooltip);
503  return *this;
504 }

References SessionItem::setRoleProperty().

Referenced by GeneticMinimizerItem::GeneticMinimizerItem(), GSLLMAMinimizerItem::GSLLMAMinimizerItem(), GSLMultiMinimizerItem::GSLMultiMinimizerItem(), MinimizerContainerItem::MinimizerContainerItem(), MinuitMinimizerItem::MinuitMinimizerItem(), and SimAnMinimizerItem::SimAnMinimizerItem().

Here is the call graph for this function:

◆ setValue()

bool SessionItem::setValue ( QVariant  value)
inherited

Set value, ensure that variant types match.

Definition at line 382 of file SessionItem.cpp.

383 {
385  return setRoleProperty(Qt::DisplayRole, value);
386 }
bool CompatibleVariantTypes(const QVariant &oldValue, const QVariant &newValue)
Returns true if variants has compatible types.
Definition: VariantUtil.cpp:25

References GUI::Util::Variant::CompatibleVariantTypes(), SessionItem::setRoleProperty(), and SessionItem::value().

Referenced by DoubleDescriptor::DoubleDescriptor(), SelectionDescriptor< T >::SelectionDescriptor(), UIntDescriptor::UIntDescriptor(), IntensityDataPropertyWidget::createCheckBox(), SpecularDataPropertyWidget::createCheckBox(), IntensityDataPropertyWidget::createTextEdit(), SpecularDataPropertyWidget::createTextEdit(), SessionItem::setItemValue(), RealDataItem::setNativeDataUnits(), and GroupItem::updateComboValue().

Here is the call graph for this function:

◆ simulationOptionsItem()

const SimulationOptionsItem & JobItem::simulationOptionsItem ( ) const

◆ tagFromItem()

QString SessionItem::tagFromItem ( const SessionItem item) const
inherited

Returns the tag name of given item when existing.

Definition at line 178 of file SessionItem.cpp.

179 {
180  int index = m_children.indexOf(const_cast<SessionItem*>(item));
181  return m_tags->tagFromIndex(index);
182 }

References SessionItem::index(), SessionItem::item(), SessionItem::m_children, and SessionItem::m_tags.

Referenced by SessionItem::displayName(), ModelMapper::onDataChanged(), PropertyRepeater::setOnChildPropertyChange(), SessionItem::takeRow(), and GUI::Session::XML::writeItemAndChildItems().

Here is the call graph for this function:

◆ takeItem()

SessionItem * SessionItem::takeItem ( int  row,
const QString &  tag 
)
inherited

Remove item from given row from given tag.

Definition at line 258 of file SessionItem.cpp.

259 {
260  const QString tagName = tag.isEmpty() ? defaultTag() : tag;
261  ASSERT(m_tags->isValid(tagName));
262  ASSERT(!m_tags->isSingleItemTag(tagName));
263 
264  int index = m_tags->indexFromTagRow(tagName, row);
265  ASSERT(index >= 0 && index <= m_children.size());
266 
267  if (m_model)
268  m_model->beginRemoveRows(this->index(), index, index);
269  SessionItem* result = m_children.takeAt(index);
270  result->setParentAndModel(nullptr, nullptr);
271 
272  m_tags->removeChild(tagName);
273  if (m_model)
274  m_model->endRemoveRows();
275  return result;
276 }
void setParentAndModel(SessionItem *parent, SessionModel *model)

References SessionItem::defaultTag(), SessionItem::index(), SessionItem::m_children, SessionItem::m_model, SessionItem::m_tags, and SessionItem::setParentAndModel().

Referenced by SessionModel::moveItem(), and SessionItem::takeRow().

Here is the call graph for this function:

◆ takeRow()

SessionItem * SessionItem::takeRow ( int  row)
inherited

Removes row from item and returns the item.

Definition at line 139 of file SessionItem.cpp.

140 {
141  SessionItem* item = childAt(row);
142  QString tag = tagFromItem(item);
143  auto items = getItems(tag);
144  return takeItem(items.indexOf(item), tag);
145 }
SessionItem * takeItem(int row, const QString &tag)
Remove item from given row from given tag.
QVector< T * > items(const QString &tag="") const
Definition: SessionItem.h:361
SessionItem * childAt(int row) const
Returns the child at the given row.

References SessionItem::childAt(), SessionItem::getItems(), SessionItem::item(), SessionItem::items(), SessionItem::tagFromItem(), and SessionItem::takeItem().

Referenced by FitComparison1DViewController::deleteDiffViewItem(), SessionModel::moveItem(), ProjectionsEditorCanvas::onLeavingColorMap(), and SessionModel::removeRows().

Here is the call graph for this function:

◆ toolTip()

QString SessionItem::toolTip ( ) const
inherited

Definition at line 495 of file SessionItem.cpp.

496 {
497  return roleProperty(Qt::ToolTipRole).toString();
498 }

References SessionItem::roleProperty().

Referenced by SelectionDescriptor< T >::SelectionDescriptor().

Here is the call graph for this function:

◆ updateIntensityDataFileName()

void JobItem::updateIntensityDataFileName ( )
private

Updates the name of file to store intensity data.

Definition at line 401 of file JobItem.cpp.

402 {
403  if (DataItem* item = dataItem())
405 
406  if (RealDataItem* realItem = realDataItem()) {
407  if (DataItem* item = realItem->dataItem())
409 
410  if (DataItem* item = realItem->nativeData())
412  }
413 }
RealDataItem * realDataItem()
Definition: JobItem.cpp:290
QString getIdentifier() const
Definition: JobItem.cpp:73
QString jobReferenceFileName(const QString &itemName)
Constructs the name of the file with reference data.
QString jobResultsFileName(const QString &itemName)
Constructs the name of the file with simulated intensities.
QString jobNativeDataFileName(const QString &id)

References dataItem(), getIdentifier(), SessionItem::item(), SessionItem::itemName(), GUI::Model::FilenameUtils::jobNativeDataFileName(), GUI::Model::FilenameUtils::jobReferenceFileName(), GUI::Model::FilenameUtils::jobResultsFileName(), and realDataItem().

Referenced by setJobName(), and setResults().

Here is the call graph for this function:

◆ value()

◆ writeNonSessionItems()

void JobItem::writeNonSessionItems ( QXmlStreamWriter *  writer) const
overridevirtual

Reimplemented from SessionItem.

Definition at line 347 of file JobItem.cpp.

348 {
350 
351  writer->writeStartElement(Tags::SimulationOptions);
353  writer->writeEndElement();
354 
355  Streamer(writer).write<InstrumentItemCatalog>(Tags::Instrument, m_instrument.get());
356 
357  writer->writeStartElement(Tags::Sample);
359  writer->writeEndElement();
360 
361  writer->writeStartElement(Tags::ParameterContainer);
363  writer->writeEndElement();
364 }
void writeContentTo(QXmlStreamWriter *writer) const
void writeContentTo(QXmlStreamWriter *writer) const
void writeContentTo(QXmlStreamWriter *writer) const
void write(const QString &tag, typename Catalog::CatalogedType *p)
Definition: Streamer.h:82
void writeAttribute(QXmlStreamWriter *writer, const QString &attributeName, const QVariant &variant)
Write the variant's value as an attribute.
Definition: UtilXML.cpp:65

References m_instrument, m_parameterContainer, m_sampleItem, m_simulationOptionsItem, GUI::Session::XML::Version(), Streamer::write(), GUI::Session::XML::writeAttribute(), ParameterContainerItem::writeContentTo(), MultiLayerItem::writeContentTo(), and SimulationOptionsItem::writeContentTo().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ JobModel

friend class JobModel
friend

Definition at line 147 of file JobItem.h.

Member Data Documentation

◆ m_children

◆ m_instrument

std::unique_ptr<InstrumentItem> JobItem::m_instrument
private

◆ m_mapper

std::unique_ptr<ModelMapper> SessionItem::m_mapper
privateinherited

◆ m_model

◆ m_parameterContainer

ParameterContainerItem JobItem::m_parameterContainer
private

Definition at line 165 of file JobItem.h.

Referenced by parameterContainerItem(), readNonSessionItems(), and writeNonSessionItems().

◆ m_parent

SessionItem* SessionItem::m_parent
privateinherited

◆ m_properties

std::unique_ptr<SessionItemData> SessionItem::m_properties
privateinherited

◆ m_sampleItem

MultiLayerItem JobItem::m_sampleItem
private

◆ m_simulationOptionsItem

SimulationOptionsItem JobItem::m_simulationOptionsItem
private

◆ m_tags

◆ M_TYPE

constexpr auto JobItem::M_TYPE {"JobItem"}
staticconstexpr

◆ P_BEGIN_TIME

constexpr auto JobItem::P_BEGIN_TIME {"Begin time"}
staticconstexprprivate

Definition at line 50 of file JobItem.h.

Referenced by JobItem(), beginTime(), and setBeginTime().

◆ P_COMMENTS

constexpr auto JobItem::P_COMMENTS {"Comments"}
staticconstexprprivate

Definition at line 52 of file JobItem.h.

Referenced by JobItem(), getComments(), and setComments().

◆ P_END_TIME

constexpr auto JobItem::P_END_TIME {"End time"}
staticconstexprprivate

Definition at line 51 of file JobItem.h.

Referenced by JobItem(), endTime(), and setEndTime().

◆ P_IDENTIFIER

constexpr auto JobItem::P_IDENTIFIER {"Identifier"}
staticconstexprprivate

Definition at line 46 of file JobItem.h.

Referenced by JobItem(), getIdentifier(), and setIdentifier().

◆ P_INSTRUMENT_NAME

constexpr auto JobItem::P_INSTRUMENT_NAME {"Instrument"}
staticconstexprprivate

Definition at line 47 of file JobItem.h.

Referenced by JobItem(), instrumentName(), and setInstrumentName().

◆ P_NAME

constexpr auto SessionItem::P_NAME {"Name"}
staticconstexprprivateinherited

◆ P_PRESENTATION_TYPE

constexpr auto JobItem::P_PRESENTATION_TYPE {"Presentation type"}
staticconstexprprivate

Definition at line 54 of file JobItem.h.

Referenced by JobItem(), presentationType(), and setPresentationType().

◆ P_PROGRESS

constexpr auto JobItem::P_PROGRESS {"Progress"}
staticconstexprprivate

Definition at line 53 of file JobItem.h.

Referenced by JobItem(), getProgress(), and setProgress().

◆ P_STATUS

constexpr auto JobItem::P_STATUS {"Status"}
staticconstexprprivate

Definition at line 49 of file JobItem.h.

Referenced by JobItem(), getStatus(), and setStatus().

◆ P_WITH_FITTING

constexpr auto JobItem::P_WITH_FITTING {"With fitting"}
staticconstexprprivate

Definition at line 48 of file JobItem.h.

Referenced by JobItem().

◆ T_DATAVIEW

constexpr auto JobItem::T_DATAVIEW {"Data View tag"}
staticconstexprprivate

Definition at line 58 of file JobItem.h.

Referenced by JobItem(), addDataViewItem(), createDataViewItem(), and dataItemView().

◆ T_FIT_SUITE

constexpr auto JobItem::T_FIT_SUITE {"Fit suite tag"}
staticconstexprprivate

Definition at line 59 of file JobItem.h.

Referenced by JobItem(), createFitSuiteItem(), and fitSuiteItem().

◆ T_MATERIAL_CONTAINER

constexpr auto JobItem::T_MATERIAL_CONTAINER {"Material container tag"}
staticconstexprprivate

Definition at line 55 of file JobItem.h.

◆ T_OUTPUT

constexpr auto JobItem::T_OUTPUT {"Output tag"}
staticconstexprprivate

Definition at line 56 of file JobItem.h.

Referenced by JobItem(), dataItem(), intensityDataItem(), and setDataType().

◆ T_REALDATA

constexpr auto JobItem::T_REALDATA {"Real Data tag"}
staticconstexprprivate

The documentation for this class was generated from the following files: