diff --git a/GUI/coregui/Models/JobModel.cpp b/GUI/coregui/Models/JobModel.cpp index d855ac967f15ce30d0eac6f65a375be71a092a34..5743f0579146e9516b4a137a85af009bf53bbff8 100644 --- a/GUI/coregui/Models/JobModel.cpp +++ b/GUI/coregui/Models/JobModel.cpp @@ -110,6 +110,16 @@ bool JobModel::hasUnfinishedJobs() return m_queue_data->hasUnfinishedJobs(); } +void JobModel::clear() +{ + QMap<QString, SessionItem *> jobs = getTopItemMap(Constants::JobItemType); + for(auto it = jobs.begin(); it!=jobs.end(); ++it) { + removeJob(it.value()->index()); + } + + SessionModel::clear(); +} + void JobModel::runJob(const QModelIndex &index) { m_queue_data->runJob(getJobItemForIndex(index)); @@ -125,6 +135,7 @@ void JobModel::removeJob(const QModelIndex &index) { qDebug() << "NJobModel::removeJob(const QModelIndex &index)"; JobItem *jobItem = getJobItemForIndex(index); + Q_ASSERT(jobItem); m_queue_data->removeJob(jobItem->getIdentifier()); emit aboutToDeleteJobItem(jobItem); diff --git a/GUI/coregui/Models/JobModel.h b/GUI/coregui/Models/JobModel.h index 235466e3596370d81680d2993efcc2a03ba6900d..7dd4002df34c689ddb157d40443af9f52421771e 100644 --- a/GUI/coregui/Models/JobModel.h +++ b/GUI/coregui/Models/JobModel.h @@ -48,6 +48,8 @@ public: bool hasUnfinishedJobs(); + void clear(); + signals: void selectionChanged(JobItem *item); void aboutToDeleteJobItem(JobItem *item); diff --git a/GUI/coregui/Models/SessionModel.h b/GUI/coregui/Models/SessionModel.h index f417a2df44128d8fdf83dd2de7ce813ebf213d74..7a2a84fab4eef73aabc0220dc5a205f177c267aa 100644 --- a/GUI/coregui/Models/SessionModel.h +++ b/GUI/coregui/Models/SessionModel.h @@ -79,7 +79,7 @@ public: QVector<QString> getAcceptableDefaultItemTypes(const QModelIndex &parent) const; - void clear(); + virtual void clear(); void load(const QString &filename = QString()); void save(const QString &filename = QString()); diff --git a/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp b/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp index 2dad456db999c402e3cb790967d70bc60dc1d6e4..b3fa9936e3883f11fc427631b0e8c043c4f4ca6c 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp @@ -74,31 +74,6 @@ void ColorMapPlot::setItem(IntensityDataItem *item) } - -// m_item = item; - -// if (!m_item) -// return; - -// plotItem(m_item); - -//// connect(m_item, SIGNAL(intensityModified()), this, -//// SLOT(onIntensityModified())); -// m_mapper.reset(new ModelMapper); - -// m_mapper->setItem(item); -// m_mapper->setOnPropertyChange( -// [this](const QString &name) -// { -// onPropertyChanged(name); -// onIntensityModified(); -// }); -// m_mapper->setOnChildPropertyChange( -// [this](SessionItem* item, const QString name) -// { -//// if (item->parent() && item->parent()->modelType() == Constants::GroupItemType) -// onSubItemPropertyChanged(item->itemName(), name); -// }); } //! returns string containing bin content information