30 , m_queue_data(nullptr)
45 if (jobItem->getIdentifier() == identifier)
56 ASSERT(instrumentItem);
58 auto* jobItem = insertItem<JobItem>();
60 jobItem->setIdentifier(QUuid::createUuid().
toString());
62 jobItem->copySampleIntoJob(sampleItem);
65 jobItem->copySimulationOptionsIntoJob(optionItem);
79 return topItems<JobItem>();
110 QVector<SessionItem*> result;
112 for (
auto* jobItem : topItems<JobItem>()) {
113 if (
auto* intensityItem = jobItem->dataItem())
114 result.push_back(intensityItem);
116 if (
auto* real_data =
dynamic_cast<RealDataItem*
>(jobItem->realDataItem())) {
117 if (
auto* data_item = real_data->dataItem())
118 result.push_back(data_item);
119 if (
auto* native_data = real_data->nativeData())
120 result.push_back(native_data);
135 refItem->linkToInstrument(jobItem->instrumentItem());
163 for (
const auto* jobItem :
jobItems()) {
164 if (jobItem->itemName().startsWith(
"job"))
165 maxJobIndex = std::max(maxJobIndex, jobItem->itemName().mid(3).toInt());
167 return QString(
"job%1").arg(maxJobIndex + 1);
Defines class InstrumentItem and all its children.
Defines class IntensityDataItem.
Defines abstract item with a material property.
Defines auxiliary functions in namespace GUI::Model::JobModelFunctions.
Defines class JobQueueData.
@ Fitting
the job is busy fitting
Defines class MultiLayerItem.
Defines namespace GUI::Model::ParameterTreeUtils.
Defines pointwise axis item.
Defines class RealDataItem.
Defines reader and writer classes for SessionModel.
Abstract base class for instrument-specific item classes.
QString getIdentifier() const
ParameterContainerItem * parameterContainerItem()
void focusRequest(JobItem *item)
QVector< JobItem * > jobItems() const
void runJob(JobItem *jobItem)
void removeJob(JobItem *jobItem)
void restore(JobItem *jobItem)
restore instrument and sample model from backup for given JobItem
JobQueueData * m_queue_data
JobModel(QObject *parent=nullptr)
JobItem * getJobItemForIdentifier(const QString &identifier)
QString generateJobName()
generates numbered job name with new/unused number
void cancelJob(JobItem *jobItem)
void readFrom(QXmlStreamReader *reader, MessageService *messageService=nullptr) override
QVector< SessionItem * > nonXMLItems() const override
JobItem * addJob(const MultiLayerItem *sampleItem, const InstrumentItem *instrumentItem, const RealDataItem *realDataItem, const SimulationOptionsItem &optionItem)
Main method to add a job.
The JobQueueData class holds all objects/logic to run simulation in a thread.
void focusRequest(JobItem *jobItem)
void removeJob(const QString &identifier)
Remove job from list completely.
void cancelJob(const QString &identifier)
Cancels running job.
void runJob(JobItem *jobItem)
Submits job and run it in a thread.
The service to collect messages from different senders.
void restoreBackupValues()
The ParameterTreeBuilder contains helper functions to create container with ParameterItems....
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
QModelIndex index() const
Returns model index of this item.
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
virtual void readFrom(QXmlStreamReader *reader, MessageService *messageService=nullptr)
bool removeRows(int row, int count, const QModelIndex &parent) override
The SimulationOptionsItem class holds simulation status (run policy, number of threads,...
void setupJobItemOutput(JobItem *jobItem)
Setup items intended for storing results of the job.
void setupJobItemForFit(JobItem *jobItem, const RealDataItem *realDataItem)
Setups JobItem for fit.
void setupJobItemInstrument(JobItem *jobItem, const InstrumentItem *from)
Properly copies instrument into job item.
constexpr auto JobModelTag("JobModel")
QString toString(const QModelIndex &index)
Provides string representation of index data.