Skip to content
Snippets Groups Projects
Commit f86db8ae authored by t.knopff's avatar t.knopff
Browse files

Make JobItem::P_STATUS private

parent c5b6d68a
No related branches found
No related tags found
1 merge request!99Refactor model: JobItem
......@@ -278,6 +278,11 @@ void JobItem::setInstrumentName(const QString& name)
getItem(P_INSTRUMENT_NAME)->setValue(name);
}
bool JobItem::isStatusPropertyName(const QString& name)
{
return name == P_STATUS;
}
//! Updates the name of file to store intensity data.
void JobItem::updateIntensityDataFileName()
......
......@@ -37,9 +37,9 @@ private:
static const QString P_SAMPLE_NAME;
static const QString P_INSTRUMENT_NAME;
static const QString P_WITH_FITTING;
static const QString P_STATUS;
public:
static const QString P_STATUS;
static const QString P_BEGIN_TIME;
static const QString P_END_TIME;
static const QString P_DURATION;
......@@ -112,6 +112,8 @@ public:
void setInstrumentName(const QString& name);
static bool isStatusPropertyName(const QString& name);
private:
void updateIntensityDataFileName();
const SimulationOptionsItem* simulationOptionsItem() const;
......
......@@ -83,7 +83,7 @@ void FitComparisonWidget::subscribeToItem()
jobItem()->mapper()->setOnPropertyChange(
[this](const QString& name) {
if (name == JobItem::P_STATUS) {
if (JobItem::isStatusPropertyName(name)) {
if (jobItem()->isCompleted())
onResetViewAction();
}
......
......@@ -83,7 +83,7 @@ void FitComparisonWidget1D::subscribeToItem()
jobItem()->mapper()->setOnPropertyChange(
[this](const QString& name) {
if (name == JobItem::P_STATUS) {
if (JobItem::isStatusPropertyName(name)) {
if (jobItem()->isCompleted())
onResetViewAction();
}
......
......@@ -128,7 +128,7 @@ void RunFitControlWidget::subscribeToItem()
jobItem()->mapper()->setOnPropertyChange(
[this](const QString& name) {
if (name == JobItem::P_STATUS)
if (JobItem::isStatusPropertyName(name))
updateControlElements();
},
this);
......
......@@ -172,23 +172,13 @@ void ParameterTuningWidget::subscribeToItem()
jobItem()->mapper()->setOnPropertyChange(
[this](const QString& name) { onPropertyChanged(name); }, this);
onPropertyChanged(JobItem::P_STATUS);
updateJobStatus();
}
void ParameterTuningWidget::onPropertyChanged(const QString& property_name)
{
if (property_name == JobItem::P_STATUS) {
m_warningSign->clear();
if (jobItem()->isFailed()) {
QString message;
message.append("Current parameter values cause simulation failure.\n\n");
message.append(jobItem()->getComments());
m_warningSign->setWarningMessage(message);
}
updateDragAndDropSettings();
}
if (JobItem::isStatusPropertyName(property_name))
updateJobStatus();
}
JobItem* ParameterTuningWidget::jobItem()
......@@ -234,3 +224,17 @@ void ParameterTuningWidget::closeActiveEditors()
}
m_treeView->selectionModel()->clearSelection();
}
void ParameterTuningWidget::updateJobStatus()
{
m_warningSign->clear();
if (jobItem()->isFailed()) {
QString message;
message.append("Current parameter values cause simulation failure.\n\n");
message.append(jobItem()->getComments());
m_warningSign->setWarningMessage(message);
}
updateDragAndDropSettings();
}
......@@ -66,6 +66,7 @@ private:
void updateDragAndDropSettings();
void setTuningDelegateEnabled(bool enabled);
void closeActiveEditors();
void updateJobStatus();
JobRealTimeToolBar* m_toolBar;
JobModel* m_jobModel;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment