diff --git a/GUI/coregui/Models/NIntensityDataItem.cpp b/GUI/coregui/Models/IntensityDataItem.cpp similarity index 69% rename from GUI/coregui/Models/NIntensityDataItem.cpp rename to GUI/coregui/Models/IntensityDataItem.cpp index 179e0dea7b836ef3c33bf28b6e9681925b27fe3d..724cd4c26bc07edd77295025cd8e24f570926b77 100644 --- a/GUI/coregui/Models/NIntensityDataItem.cpp +++ b/GUI/coregui/Models/IntensityDataItem.cpp @@ -13,27 +13,27 @@ // // ************************************************************************** // -#include "NIntensityDataItem.h" +#include "IntensityDataItem.h" #include "ComboProperty.h" #include "AngleProperty.h" #include <QDebug> -const QString NIntensityDataItem::P_XAXIS_MIN = "xmin"; -const QString NIntensityDataItem::P_XAXIS_MAX = "xmax"; -const QString NIntensityDataItem::P_YAXIS_MIN = "ymin"; -const QString NIntensityDataItem::P_YAXIS_MAX = "ymax"; -const QString NIntensityDataItem::P_ZAXIS_MIN = "zmin"; -const QString NIntensityDataItem::P_ZAXIS_MAX = "zmax"; -const QString NIntensityDataItem::P_GRADIENT = "Gradient"; -const QString NIntensityDataItem::P_IS_LOGZ = "Logz"; -const QString NIntensityDataItem::P_IS_INTERPOLATED = "Interpolation"; -const QString NIntensityDataItem::P_XAXIS_TITLE = "x-title"; -const QString NIntensityDataItem::P_YAXIS_TITLE = "y-title"; -const QString NIntensityDataItem::P_AXES_UNITS = "Axes Units"; -const QString NIntensityDataItem::P_PROPERTY_PANEL_FLAG = "Property Panel Flag"; -const QString NIntensityDataItem::P_PROJECTIONS_FLAG = "Projections Flag"; - -NIntensityDataItem::NIntensityDataItem(ParameterizedItem *parent) +const QString IntensityDataItem::P_XAXIS_MIN = "xmin"; +const QString IntensityDataItem::P_XAXIS_MAX = "xmax"; +const QString IntensityDataItem::P_YAXIS_MIN = "ymin"; +const QString IntensityDataItem::P_YAXIS_MAX = "ymax"; +const QString IntensityDataItem::P_ZAXIS_MIN = "zmin"; +const QString IntensityDataItem::P_ZAXIS_MAX = "zmax"; +const QString IntensityDataItem::P_GRADIENT = "Gradient"; +const QString IntensityDataItem::P_IS_LOGZ = "Logz"; +const QString IntensityDataItem::P_IS_INTERPOLATED = "Interpolation"; +const QString IntensityDataItem::P_XAXIS_TITLE = "x-title"; +const QString IntensityDataItem::P_YAXIS_TITLE = "y-title"; +const QString IntensityDataItem::P_AXES_UNITS = "Axes Units"; +const QString IntensityDataItem::P_PROPERTY_PANEL_FLAG = "Property Panel Flag"; +const QString IntensityDataItem::P_PROJECTIONS_FLAG = "Projections Flag"; + +IntensityDataItem::IntensityDataItem(ParameterizedItem *parent) : ParameterizedItem(Constants::IntensityDataType, parent) , m_data(0) { @@ -65,12 +65,12 @@ NIntensityDataItem::NIntensityDataItem(ParameterizedItem *parent) registerProperty(P_PROJECTIONS_FLAG, false); } -NIntensityDataItem::~NIntensityDataItem() +IntensityDataItem::~IntensityDataItem() { delete m_data; } -void NIntensityDataItem::setOutputData(OutputData<double> *data) +void IntensityDataItem::setOutputData(OutputData<double> *data) { // if(data != m_data) { qDebug() << "OutputDataItem::setOutputData(OutputData<double> *data)"; @@ -89,144 +89,144 @@ void NIntensityDataItem::setOutputData(OutputData<double> *data) // } } -double NIntensityDataItem::getXaxisMin() const +double IntensityDataItem::getXaxisMin() const { return getRegisteredProperty(P_XAXIS_MIN).toDouble(); } -double NIntensityDataItem::getXaxisMax() const +double IntensityDataItem::getXaxisMax() const { return getRegisteredProperty(P_XAXIS_MAX).toDouble(); } -double NIntensityDataItem::getYaxisMin() const +double IntensityDataItem::getYaxisMin() const { return getRegisteredProperty(P_YAXIS_MIN).toDouble(); } -double NIntensityDataItem::getYaxisMax() const +double IntensityDataItem::getYaxisMax() const { return getRegisteredProperty(P_YAXIS_MAX).toDouble(); } -double NIntensityDataItem::getZaxisMin() const +double IntensityDataItem::getZaxisMin() const { return getRegisteredProperty(P_ZAXIS_MIN).toDouble(); } -double NIntensityDataItem::getZaxisMax() const +double IntensityDataItem::getZaxisMax() const { return getRegisteredProperty(P_ZAXIS_MAX).toDouble(); } -QString NIntensityDataItem::getGradient() const +QString IntensityDataItem::getGradient() const { ComboProperty combo_property = getRegisteredProperty(P_GRADIENT).value<ComboProperty>(); return combo_property.getValue(); } -bool NIntensityDataItem::isLogz() const +bool IntensityDataItem::isLogz() const { return getRegisteredProperty(P_IS_LOGZ).toBool(); } -bool NIntensityDataItem::isInterpolated() const +bool IntensityDataItem::isInterpolated() const { return getRegisteredProperty(P_IS_INTERPOLATED).toBool(); } -QString NIntensityDataItem::getXaxisTitle() const +QString IntensityDataItem::getXaxisTitle() const { return getRegisteredProperty(P_XAXIS_TITLE).toString(); } -QString NIntensityDataItem::getYaxisTitle() const +QString IntensityDataItem::getYaxisTitle() const { return getRegisteredProperty(P_YAXIS_TITLE).toString(); } -QString NIntensityDataItem::getAxesUnits() const +QString IntensityDataItem::getAxesUnits() const { qDebug() << "NIntensityDataItem::getAxesUnits()"; Q_ASSERT(0); return QString(); } -bool NIntensityDataItem::axesInRadians() const +bool IntensityDataItem::axesInRadians() const { AngleProperty angle_property = getRegisteredProperty(P_AXES_UNITS).value<AngleProperty>(); return angle_property.inRadians(); } -void NIntensityDataItem::setXaxisMin(double xmin) +void IntensityDataItem::setXaxisMin(double xmin) { qDebug() << "NIntensityDataItem::setXaxisMin(double xmin)"; setRegisteredProperty(P_XAXIS_MIN, xmin); } -void NIntensityDataItem::setXaxisMax(double xmax) +void IntensityDataItem::setXaxisMax(double xmax) { qDebug() << "NIntensityDataItem::setXaxisMax(double xmax)"; setRegisteredProperty(P_XAXIS_MAX, xmax); } -void NIntensityDataItem::setYaxisMin(double ymin) +void IntensityDataItem::setYaxisMin(double ymin) { qDebug() << "NIntensityDataItem::setYaxisMin(double ymin)"; setRegisteredProperty(P_YAXIS_MIN, ymin); } -void NIntensityDataItem::setYaxisMax(double ymax) +void IntensityDataItem::setYaxisMax(double ymax) { qDebug() << "NIntensityDataItem::setYaxisMax(double ymax)"; setRegisteredProperty(P_YAXIS_MAX, ymax); } -void NIntensityDataItem::setZaxisRange(double zmin, double zmax) +void IntensityDataItem::setZaxisRange(double zmin, double zmax) { qDebug() << "NIntensityDataItem::setZaxisRange()"; setRegisteredProperty(P_ZAXIS_MIN, zmin); setRegisteredProperty(P_ZAXIS_MAX, zmax); } -void NIntensityDataItem::setZaxisMin(double zmin) +void IntensityDataItem::setZaxisMin(double zmin) { qDebug() << "NIntensityDataItem::setZaxisMin(double zmin)"; setRegisteredProperty(P_ZAXIS_MIN, zmin); } -void NIntensityDataItem::setZaxisMax(double zmax) +void IntensityDataItem::setZaxisMax(double zmax) { qDebug() << "NIntensityDataItem::setZaxisMax(double zmax)"; setRegisteredProperty(P_ZAXIS_MAX, zmax); } -void NIntensityDataItem::setLogz(bool logz) +void IntensityDataItem::setLogz(bool logz) { qDebug() << "NIntensityDataItem::setLogz(bool logz)"; setRegisteredProperty(P_IS_LOGZ, logz); } -void NIntensityDataItem::setInterpolated(bool interp) +void IntensityDataItem::setInterpolated(bool interp) { qDebug() << "NIntensityDataItem::setInterpolated(bool interp)"; setRegisteredProperty(P_IS_INTERPOLATED, interp); } -void NIntensityDataItem::setXaxisTitle(QString xtitle) +void IntensityDataItem::setXaxisTitle(QString xtitle) { qDebug() << "NIntensityDataItem::setXaxisTitle(QString xtitle)"; setRegisteredProperty(P_XAXIS_TITLE, xtitle); } -void NIntensityDataItem::setYaxisTitle(QString ytitle) +void IntensityDataItem::setYaxisTitle(QString ytitle) { qDebug() << "NIntensityDataItem::setYaxisTitle(QString ytitle)"; setRegisteredProperty(P_YAXIS_TITLE, ytitle); } -void NIntensityDataItem::setAxesUnits(const QString &units) +void IntensityDataItem::setAxesUnits(const QString &units) { qDebug() << "NIntensityDataItem::setAxesUnits(QString units)"; Q_UNUSED(units); diff --git a/GUI/coregui/Models/NIntensityDataItem.h b/GUI/coregui/Models/IntensityDataItem.h similarity index 91% rename from GUI/coregui/Models/NIntensityDataItem.h rename to GUI/coregui/Models/IntensityDataItem.h index 424cd6fce778eb395a3f04810991c0bee5a550af..8af6ffa8a8ca4c1694fdffcfdc6379cb7d5168bb 100644 --- a/GUI/coregui/Models/NIntensityDataItem.h +++ b/GUI/coregui/Models/IntensityDataItem.h @@ -13,14 +13,14 @@ // // ************************************************************************** // -#ifndef NINTENSITYDATAITEM_H -#define NINTENSITYDATAITEM_H +#ifndef INTENSITYDATAITEM_H +#define INTENSITYDATAITEM_H #include "ParameterizedItem.h" #include "OutputData.h" -class BA_CORE_API_ NIntensityDataItem : public ParameterizedItem +class BA_CORE_API_ IntensityDataItem : public ParameterizedItem { Q_OBJECT public: @@ -39,8 +39,8 @@ public: static const QString P_PROPERTY_PANEL_FLAG; static const QString P_PROJECTIONS_FLAG; - explicit NIntensityDataItem(ParameterizedItem *parent=0); - ~NIntensityDataItem(); + explicit IntensityDataItem(ParameterizedItem *parent=0); + ~IntensityDataItem(); OutputData<double> *getOutputData() { return m_data; } void setOutputData(OutputData<double> *data); diff --git a/GUI/coregui/Models/ItemFactory.cpp b/GUI/coregui/Models/ItemFactory.cpp index 8783f410f16ea9ec437bad77122f80b9b039ad48..4cfa281ca9318fb76fbaa424c6a777dcc82a05c2 100644 --- a/GUI/coregui/Models/ItemFactory.cpp +++ b/GUI/coregui/Models/ItemFactory.cpp @@ -37,8 +37,8 @@ #include "RefractiveIndexItem.h" #include "MagneticFieldItem.h" #include "FitParameterItem.h" -#include "NJobItem.h" -#include "NIntensityDataItem.h" +#include "JobItem.h" +#include "IntensityDataItem.h" #include <QDebug> namespace { @@ -123,9 +123,9 @@ ItemFactory::ItemMap_t initializeItemMap() { result[Constants::FitParameterType] = &createInstance<FitParameterItem>; - result[Constants::JobItemType] = &createInstance<NJobItem>; + result[Constants::JobItemType] = &createInstance<JobItem>; - result[Constants::IntensityDataType] = &createInstance<NIntensityDataItem>; + result[Constants::IntensityDataType] = &createInstance<IntensityDataItem>; return result; diff --git a/GUI/coregui/Models/JobItem.cpp b/GUI/coregui/Models/JobItem.cpp index b050cd30341b2d8cffc9b33f5673cd92e3d6f6fc..60e42f42679c0271128f39056847ebebd42968b0 100644 --- a/GUI/coregui/Models/JobItem.cpp +++ b/GUI/coregui/Models/JobItem.cpp @@ -1,11 +1,9 @@ -/* - // ************************************************************************** // // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file coregui/Models/JobItem.cpp -//! @brief Implements class JobItem +//! @file coregui/Models/NJobItem.cpp +//! @brief Implements class NJobItem //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -16,182 +14,94 @@ // ************************************************************************** // #include "JobItem.h" -#include "JobQueueModel.h" -#include "JobRunner.h" -#include "OutputDataItem.h" +#include "ComboProperty.h" +#include "IntensityDataItem.h" #include "SampleModel.h" #include "InstrumentModel.h" -#include "InstrumentItem.h" -#include "GUIHelpers.h" -#include "Simulation.h" -#include "AngleProperty.h" -#include "DetectorItems.h" -#include "InstrumentItem.h" -#include <QXmlStreamWriter> -#include <QDebug> -#include <QTimer> -#include <QThread> namespace { +const QString RUN_IMMEDIATELY = "Immediately"; +const QString RUN_IN_BACKGROUND = "In background"; +const QString RUN_SUBMIT_ONLY = "Submit only"; + QMap<QString, QString> initializeRunPolicies() { QMap<QString, QString> result; - result["Immediately"] = QString("Start simulation immediately, switch to Jobs view automatically when completed"); - result["In background"] = QString("Start simulation immediately, do not switch to Jobs view when completed"); - result["Submit only"] = QString("Only submit simulation for consequent execution, has to be started from Jobs view explicitely"); + result[RUN_IMMEDIATELY] = QString("Start simulation immediately, switch to Jobs view automatically when completed"); + result[RUN_IN_BACKGROUND] = QString("Start simulation immediately, do not switch to Jobs view when completed"); + result[RUN_SUBMIT_ONLY] = QString("Only submit simulation for consequent execution, has to be started from Jobs view explicitely"); return result; } } -QStringList JobItem::m_status_list = QStringList() - << QString("Idle") - << QString("Running") - << QString("Completed") - << QString("Canceled") - << QString("Failed"); - QMap<QString, QString> JobItem::m_run_policies = initializeRunPolicies(); -JobItem::JobItem(const QString &name) - : m_name(name) - , m_status(IDLE) - , m_progress(0) - , m_nthreads(0) - , m_run_policy(SUBMIT_ONLY) - , m_sampleModel(0) - , m_instrumentModel(0) -{ -// initOutputDataItem(); -} - -JobItem::JobItem(SampleModel *sampleModel, InstrumentModel *instrumentModel, const QString &run_policy) - : m_status(IDLE) - , m_progress(0) - , m_nthreads(0) - , m_run_policy(SUBMIT_ONLY) - , m_sampleModel(sampleModel) - , m_instrumentModel(instrumentModel) -{ -// initOutputDataItem(); - setRunPolicy(run_policy); -} - - -JobItem::~JobItem() -{ - clear(); -} - - -void JobItem::clear() -{ - qDeleteAll(m_data_items); - m_data_items.clear(); - delete m_sampleModel; - delete m_instrumentModel; -} - -void JobItem::initOutputDataItem() -{ - qDeleteAll(m_data_items); - m_data_items.clear(); - OutputDataItem *dataItem = new OutputDataItem(); - m_data_items.append(dataItem); - connect(dataItem, SIGNAL(modified()), this, SLOT(onDataItemModified())); -} +const QString JobItem::P_IDENTIFIER = "Identifier"; +const QString JobItem::P_SAMPLE_NAME = "Sample"; +const QString JobItem::P_INSTRUMENT_NAME = "Instrument"; +const QString JobItem::P_STATUS = "Status"; +const QString JobItem::P_BEGIN_TIME = "Begin Time"; +const QString JobItem::P_END_TIME = "End Time"; +const QString JobItem::P_COMMENTS = "Comments"; +const QString JobItem::P_PROGRESS = "Progress"; +const QString JobItem::P_NTHREADS = "Number of Threads"; +const QString JobItem::P_RUN_POLICY = "Run Policy"; -void JobItem::setResults(const Simulation *simulation) +JobItem::JobItem(ParameterizedItem *parent) + : ParameterizedItem(Constants::JobItemType, parent) + , m_sampleModel(0) + , m_instrumentModel(0) { - if(!simulation) - throw GUIHelpers::Error("JobItem::setResults() -> Error. Null simulation."); + setItemName(Constants::JobItemType); + registerProperty(P_IDENTIFIER, QString(), PropertyAttribute(PropertyAttribute::HIDDEN)); + registerProperty(P_SAMPLE_NAME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); + registerProperty(P_INSTRUMENT_NAME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); -// qDeleteAll(m_data_items); -// m_data_items.clear(); - if(m_data_items.isEmpty()) { - OutputDataItem *dataItem = new OutputDataItem(); - m_data_items.append(dataItem); - connect(dataItem, SIGNAL(modified()), this, SLOT(onDataItemModified())); + ComboProperty status; + status << Constants::STATUS_IDLE << Constants::STATUS_RUNNING << Constants::STATUS_COMPLETED + << Constants::STATUS_CANCELED << Constants::STATUS_FAILED; + registerProperty(P_STATUS, status.getVariant(), PropertyAttribute(PropertyAttribute::READONLY)); - } + registerProperty(P_BEGIN_TIME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); + registerProperty(P_END_TIME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); + registerProperty(P_COMMENTS, QString(), PropertyAttribute(PropertyAttribute::HIDDEN)); - OutputDataItem *outputDataItem = m_data_items.front(); + registerProperty(P_PROGRESS, 0, PropertyAttribute(PropertyAttribute::HIDDEN)); + registerProperty(P_NTHREADS, -1, PropertyAttribute(PropertyAttribute::HIDDEN)); - // propagatind angle units to OutputDataItem - if(m_instrumentModel) { - InstrumentItem *instrumentItem = dynamic_cast<InstrumentItem *>(m_instrumentModel->getInstrumentMap().begin().value()); - qDebug() << instrumentItem->modelType(); - Q_ASSERT(instrumentItem); - DetectorItem *detectorItem = instrumentItem->getDetectorItem(); - Q_ASSERT(detectorItem); - ParameterizedItem *subDetector = detectorItem->getSubItems()[DetectorItem::P_DETECTOR]; - Q_ASSERT(subDetector); - - if (subDetector->modelType() == Constants::PhiAlphaDetectorType) { - AngleProperty angle_property = subDetector->getRegisteredProperty(PhiAlphaDetectorItem::P_AXES_UNITS).value<AngleProperty>(); - if(angle_property.inDegrees()) - outputDataItem->setAxesUnits("Degrees"); - } + ComboProperty policy; + policy << RUN_IMMEDIATELY <<RUN_IN_BACKGROUND << RUN_SUBMIT_ONLY; + registerProperty(P_RUN_POLICY, policy.getVariant(), PropertyAttribute(PropertyAttribute::HIDDEN)); - } + addToValidChildren(Constants::IntensityDataType); - qDebug() << "JobItem::setResults()" << outputDataItem; + setPropertyAppearance(ParameterizedItem::P_NAME, PropertyAttribute::VISIBLE); - outputDataItem->setName(QString("data_%1_%2.int").arg(m_name, QString::number(0))); - outputDataItem->setOutputData(simulation->getIntensityData()); -} - -void JobItem::setName(QString name) -{ - m_name = name; - // setting names for OutputDataItem's - int n_data(0); - foreach(OutputDataItem *dataItem, m_data_items) { - QString dataFileName = QString("data_%1_%2.int").arg(m_name, QString::number(n_data)); - dataItem->setName(dataFileName); - ++n_data; - } - - emit modified(this); } - -QString JobItem::getStatusString() const +QString JobItem::getIdentifier() const { - return m_status_list.at(int(m_status)); + return getRegisteredProperty(P_IDENTIFIER).toString(); } - -OutputDataItem *JobItem::getOutputDataItem(int n_item) +void JobItem::setIdentifier(const QString &identifier) { - if(m_data_items.empty() || n_item < 0 || n_item >= m_data_items.size()) - return 0; - return m_data_items.at(n_item); + setRegisteredProperty(JobItem::P_IDENTIFIER, identifier); } - -// FIXME Make it nicer -void JobItem::setRunPolicy(const QString &run_policy) +IntensityDataItem *JobItem::getIntensityDataItem() { - if(run_policy == QString("Immediately")) { - m_run_policy = RUN_IMMEDIATELY; - } else if(run_policy == QString("In background")) { - m_run_policy = RUN_IN_BACKGROUND; - } else { - m_run_policy = SUBMIT_ONLY; + foreach(ParameterizedItem *item, childItems()) { + IntensityDataItem *data = dynamic_cast<IntensityDataItem *>(item); + if(data) return data; } -// if(run_policy ) -// int index = m_run_policies.indexOf(run_policy); -// if(index != -1) { -// m_run_policy = (RunPolicy)index; -// } else { -// m_run_policy = SubmitOnly; -// } + return 0; } SampleModel *JobItem::getSampleModel() @@ -199,91 +109,120 @@ SampleModel *JobItem::getSampleModel() return m_sampleModel; } - void JobItem::setSampleModel(SampleModel *sampleModel) { delete m_sampleModel; m_sampleModel = sampleModel; + if(m_sampleModel) { + setRegisteredProperty(P_SAMPLE_NAME, m_sampleModel->getSampleMap().firstKey()); + } } - InstrumentModel *JobItem::getInstrumentModel() { return m_instrumentModel; } - void JobItem::setInstrumentModel(InstrumentModel *instrumentModel) { delete m_instrumentModel; m_instrumentModel = instrumentModel; + if(m_instrumentModel) { + setRegisteredProperty(P_INSTRUMENT_NAME, m_instrumentModel->getInstrumentMap().firstKey()); + } } +QString JobItem::getStatus() const +{ + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + return combo_property.getValue(); +} -void JobItem::writeTo(QXmlStreamWriter *writer) +void JobItem::setStatus(const QString &status) { - Q_ASSERT(writer); - writer->writeStartElement(JobQueueXML::JobTag); - writer->writeAttribute(JobQueueXML::JobNameAttribute, getName()); - writer->writeAttribute(JobQueueXML::JobStatusAttribute, QString::number((int)getStatus())); - writer->writeAttribute(JobQueueXML::JobBeginTimeAttribute, getBeginTime()); - writer->writeAttribute(JobQueueXML::JobEndTimeAttribute, getEndTime()); - writer->writeAttribute(JobQueueXML::JobProgressAttribute, QString::number((int)getProgress())); - writer->writeAttribute(JobQueueXML::JobCommentsAttribute, getComments()); - foreach(OutputDataItem *item, m_data_items) { - item->writeTo(writer); - } - writer->writeEndElement(); // JobTag + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + combo_property.setValue(status); + setRegisteredProperty(P_STATUS, combo_property.getVariant()); } +bool JobItem::isIdle() const +{ + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + return combo_property.getValue() == Constants::STATUS_IDLE; +} -void JobItem::readFrom(QXmlStreamReader *reader) +bool JobItem::isRunning() const { - Q_ASSERT(reader); - clear(); + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + return combo_property.getValue() == Constants::STATUS_RUNNING; +} - qDebug() << "JobQueueItem::readFrom() -> " << reader->name(); - if(reader->name() != JobQueueXML::JobTag) { - throw GUIHelpers::Error("JobQueueItem::readFrom() -> Format error in p1"); - } +bool JobItem::isCompleted() const +{ + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + return combo_property.getValue() == Constants::STATUS_COMPLETED; +} - setName(reader->attributes() - .value(JobQueueXML::JobNameAttribute).toString()); +bool JobItem::isCanceled() const +{ + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + return combo_property.getValue() == Constants::STATUS_CANCELED; +} - setBeginTime(reader->attributes() - .value(JobQueueXML::JobBeginTimeAttribute).toString()); +bool JobItem::isFailed() const +{ + ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + return combo_property.getValue() == Constants::STATUS_FAILED; +} + +void JobItem::setBeginTime(const QString &begin_time) +{ + setRegisteredProperty(P_BEGIN_TIME, begin_time); +} - setEndTime(reader->attributes() - .value(JobQueueXML::JobEndTimeAttribute).toString()); +void JobItem::setEndTime(const QString &end_time) +{ + setRegisteredProperty(P_END_TIME, end_time); +} - setComments(reader->attributes() - .value(JobQueueXML::JobCommentsAttribute).toString()); +QString JobItem::getComments() const +{ + return getRegisteredProperty(P_COMMENTS).toString(); +} - EJobStatus status = (EJobStatus) (reader->attributes() - .value(JobQueueXML::JobStatusAttribute).toInt()); - setStatus(status); +void JobItem::setComments(const QString &comments) +{ + setRegisteredProperty(P_COMMENTS, comments); +} - setProgress(reader->attributes() - .value(JobQueueXML::JobProgressAttribute).toInt()); +int JobItem::getProgress() const +{ + return getRegisteredProperty(P_PROGRESS).toInt(); +} - while (!reader->atEnd()) { - reader->readNext(); - if (reader->isStartElement()) { +void JobItem::setProgress(int progress) +{ + setRegisteredProperty(P_PROGRESS, progress); +} - if (reader->name() == JobQueueXML::OutputDataTag) { - qDebug() << "JobItem::readFrom() -> output data"; - OutputDataItem *item = new OutputDataItem(); - item->readFrom(reader); - m_data_items.append(item); - } - } else if (reader->isEndElement()) { - if (reader->name() == JobQueueXML::JobTag) { - break; // end of xml of current Job - } - } - } +int JobItem::getNumberOfThreads() const +{ + return getRegisteredProperty(P_NTHREADS).toInt(); +} +void JobItem::setNumberOfThreads(int number_of_threads) +{ + setRegisteredProperty(P_NTHREADS, number_of_threads); } +bool JobItem::runImmediately() const +{ + ComboProperty combo_property = getRegisteredProperty(P_RUN_POLICY).value<ComboProperty>(); + return combo_property.getValue() == RUN_IMMEDIATELY; +} -*/ +bool JobItem::runInBackground() const +{ + ComboProperty combo_property = getRegisteredProperty(P_RUN_POLICY).value<ComboProperty>(); + return combo_property.getValue() == RUN_IN_BACKGROUND; +} diff --git a/GUI/coregui/Models/JobItem.h b/GUI/coregui/Models/JobItem.h index 982988eef3be82af59eb2e72b767ed975f4786f3..4addd8947e796fead30dafd4bff99831e523c552 100644 --- a/GUI/coregui/Models/JobItem.h +++ b/GUI/coregui/Models/JobItem.h @@ -1,11 +1,9 @@ -/* - // ************************************************************************** // // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file coregui/Models/JobItem.h -//! @brief Defines class JobItem +//! @file coregui/Models/NJobItem.h +//! @brief Defines class NJobItem //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -18,136 +16,72 @@ #ifndef JOBITEM_H #define JOBITEM_H -#include "WinDllMacros.h" -#include <QList> -#include <QVariant> -#include <QString> -#include <QStringList> - -class OutputDataItem; +#include "ParameterizedItem.h" +class IntensityDataItem; class SampleModel; class InstrumentModel; -class QXmlStreamWriter; -class QXmlStreamReader; class Simulation; - -//! Class to hold all job settings -//! -//! See also JobQueueItem which is stored in a list by JobQueueModel and serve -//! as an adapter for given JobItem. -class BA_CORE_API_ JobItem : public QObject +class BA_CORE_API_ JobItem : public ParameterizedItem { Q_OBJECT - public: - enum EJobStatus { IDLE, RUNNING, COMPLETED, CANCELLED, FAILED }; - - enum ERunPolicy { - RUN_IMMEDIATELY = 0x0001, - RUN_IN_BACKGROUND = 0x0002, - SUBMIT_ONLY = 0x0004 - }; - - JobItem(const QString &name); - JobItem(SampleModel *sampleModel, InstrumentModel *instrumentModel, - const QString &run_policy = QString()); + static const QString P_IDENTIFIER; + static const QString P_SAMPLE_NAME; + static const QString P_INSTRUMENT_NAME; + static const QString P_STATUS; + static const QString P_BEGIN_TIME; + static const QString P_END_TIME; + static const QString P_COMMENTS; + static const QString P_PROGRESS; + static const QString P_NTHREADS; + static const QString P_RUN_POLICY; + explicit JobItem(ParameterizedItem *parent=0); + ~JobItem(){} + + QString getIdentifier() const; + void setIdentifier(const QString &identifier); + + IntensityDataItem *getIntensityDataItem(); - virtual ~JobItem(); - - QString getName() const { return m_name; } - - QString getBeginTime() const { return m_begin_time; } - - QString getEndTime() const { return m_end_time; } - - QString getComments() const { return m_comments; } - - EJobStatus getStatus() const { return m_status; } + SampleModel *getSampleModel(); + void setSampleModel(SampleModel *sampleModel); - QString getStatusString() const; + InstrumentModel *getInstrumentModel(); + void setInstrumentModel(InstrumentModel *instrumentModel); - int getProgress() const { return m_progress; } + QString getStatus() const; + void setStatus(const QString &status); - void writeTo(QXmlStreamWriter *writer); - void readFrom(QXmlStreamReader *reader); + bool isIdle() const; + bool isRunning() const; + bool isCompleted() const; + bool isCanceled() const; + bool isFailed() const; - bool isRunning() const { return m_status == RUNNING; } + void setBeginTime(const QString &begin_time); - OutputDataItem *getOutputDataItem(int n_item = 0); + void setEndTime(const QString &end_time); - ERunPolicy getRunPolicy() const { return m_run_policy; } - void setRunPolicy(ERunPolicy run_policy) { m_run_policy = run_policy; } - void setRunPolicy(const QString &run_policy); + QString getComments() const; + void setComments(const QString &comments); - SampleModel *getSampleModel(); - void setSampleModel(SampleModel *sampleModel); + int getProgress() const; + void setProgress(int progress); - InstrumentModel *getInstrumentModel(); - void setInstrumentModel(InstrumentModel *instrumentModel); + int getNumberOfThreads() const; + void setNumberOfThreads(int number_of_threads); static QMap<QString, QString> getRunPolicies() { return m_run_policies; } - void initOutputDataItem(); - - void setResults(const Simulation *simulation); - - int getNumberOfThreads() const { return m_nthreads; } - void setNumberOfThreads(int nthreads) { m_nthreads = nthreads; } - -signals: - void modified(JobItem *); - -public slots: - void setName(QString name); - void setBeginTime(QString begin_time) { - m_begin_time = begin_time; - emit modified(this); - } - void setEndTime(QString end_time) { - m_end_time = end_time; - emit modified(this); - } - void setComments(QString comments) { - m_comments = comments; - emit modified(this); - } - void setStatus(EJobStatus status) { - m_status = status; - emit modified(this); - } - void setProgress(int progress) { - m_progress = progress; - emit modified(this); - } - - void onDataItemModified() { - emit modified(this); - } + bool runImmediately() const; + bool runInBackground() const; private: - void clear(); - - QString m_name; - QString m_begin_time; - QString m_end_time; - QString m_comments; - EJobStatus m_status; - int m_progress; - int m_nthreads; - - QList<OutputDataItem *> m_data_items; - ERunPolicy m_run_policy; - SampleModel *m_sampleModel; InstrumentModel *m_instrumentModel; - - static QStringList m_status_list; static QMap<QString, QString> m_run_policies; // run policy, policy description -}; +}; - -#endif // JOBITEM_H - -*/ +#endif // NJOBITEM_H diff --git a/GUI/coregui/Models/NJobModel.cpp b/GUI/coregui/Models/JobModel.cpp similarity index 75% rename from GUI/coregui/Models/NJobModel.cpp rename to GUI/coregui/Models/JobModel.cpp index 4b2e9e5d48cc77c51f579d13e794eb2f64921946..de9f23bceef9758a72bf8c50b7f4fb244ca87c98 100644 --- a/GUI/coregui/Models/NJobModel.cpp +++ b/GUI/coregui/Models/JobModel.cpp @@ -13,8 +13,8 @@ // // ************************************************************************** // -#include "NJobModel.h" -#include "NJobItem.h" +#include "JobModel.h" +#include "JobItem.h" #include "ComboProperty.h" #include "GUIHelpers.h" #include <QUuid> @@ -22,7 +22,7 @@ #include <QItemSelection> -NJobModel::NJobModel(QObject *parent) +JobModel::JobModel(QObject *parent) : SessionModel(SessionXML::JobModelTag, parent) , m_queue_data(0) { @@ -31,7 +31,7 @@ NJobModel::NJobModel(QObject *parent) connect(m_queue_data, SIGNAL(globalProgress(int)), this, SIGNAL(globalProgress(int))); } -NJobModel::~NJobModel() +JobModel::~JobModel() { delete m_queue_data; } @@ -41,43 +41,43 @@ NJobModel::~NJobModel() // return rowCount(QModelIndex()); //} -const NJobItem *NJobModel::getJobItemForIndex(const QModelIndex &index) const +const JobItem *JobModel::getJobItemForIndex(const QModelIndex &index) const { - const NJobItem *result = dynamic_cast<const NJobItem *>(itemForIndex(index)); + const JobItem *result = dynamic_cast<const JobItem *>(itemForIndex(index)); Q_ASSERT(result); return result; } -NJobItem *NJobModel::getJobItemForIndex(const QModelIndex &index) +JobItem *JobModel::getJobItemForIndex(const QModelIndex &index) { - NJobItem *result = dynamic_cast<NJobItem *>(itemForIndex(index)); + JobItem *result = dynamic_cast<JobItem *>(itemForIndex(index)); Q_ASSERT(result); return result; } -NJobItem *NJobModel::getJobItemForIdentifier(const QString &identifier) +JobItem *JobModel::getJobItemForIdentifier(const QString &identifier) { QModelIndex parentIndex; for(int i_row = 0; i_row < rowCount(parentIndex); ++i_row) { QModelIndex itemIndex = index( i_row, 0, parentIndex ); - NJobItem *jobItem = getJobItemForIndex(itemIndex); + JobItem *jobItem = getJobItemForIndex(itemIndex); if(jobItem->getIdentifier() == identifier) return jobItem; } return 0; } -NJobItem *NJobModel::addJob(SampleModel *sampleModel, InstrumentModel *instrumentModel, const QString &run_policy, int numberOfThreads) +JobItem *JobModel::addJob(SampleModel *sampleModel, InstrumentModel *instrumentModel, const QString &run_policy, int numberOfThreads) { - NJobItem *jobItem = dynamic_cast<NJobItem *>(insertNewItem(Constants::JobItemType)); + JobItem *jobItem = dynamic_cast<JobItem *>(insertNewItem(Constants::JobItemType)); jobItem->setItemName(generateJobName()); jobItem->setSampleModel(sampleModel); jobItem->setInstrumentModel(instrumentModel); jobItem->setIdentifier(generateJobIdentifier()); jobItem->setNumberOfThreads(numberOfThreads); - ComboProperty combo_property = jobItem->getRegisteredProperty(NJobItem::P_RUN_POLICY).value<ComboProperty>(); + ComboProperty combo_property = jobItem->getRegisteredProperty(JobItem::P_RUN_POLICY).value<ComboProperty>(); combo_property.setValue(run_policy); - jobItem->setRegisteredProperty(NJobItem::P_RUN_POLICY, combo_property.getVariant()); + jobItem->setRegisteredProperty(JobItem::P_RUN_POLICY, combo_property.getVariant()); if(jobItem->runImmediately() || jobItem->runInBackground()) m_queue_data->runJob(jobItem); @@ -88,29 +88,29 @@ NJobItem *NJobModel::addJob(SampleModel *sampleModel, InstrumentModel *instrumen return jobItem; } -void NJobModel::runJob(const QModelIndex &index) +void JobModel::runJob(const QModelIndex &index) { qDebug() << "NJobModel::runJob(const QModelIndex &index)"; m_queue_data->runJob(getJobItemForIndex(index)); } -void NJobModel::cancelJob(const QModelIndex &index) +void JobModel::cancelJob(const QModelIndex &index) { qDebug() << "NJobModel::cancelJob(const QModelIndex &index)"; m_queue_data->cancelJob(getJobItemForIndex(index)->getIdentifier()); } -void NJobModel::removeJob(const QModelIndex &index) +void JobModel::removeJob(const QModelIndex &index) { qDebug() << "NJobModel::removeJob(const QModelIndex &index)"; - NJobItem *jobItem = getJobItemForIndex(index); + JobItem *jobItem = getJobItemForIndex(index); m_queue_data->removeJob(jobItem->getIdentifier()); emit aboutToDeleteJobItem(jobItem); removeRows(index.row(), 1, QModelIndex()); } -void NJobModel::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) +void JobModel::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { Q_UNUSED(deselected); qDebug() << "NJobModel::onSelectionChanged" << selected; @@ -130,13 +130,13 @@ void NJobModel::onSelectionChanged(const QItemSelection &selected, const QItemSe } // called when jobQueueData asks for focus -void NJobModel::onFocusRequest(const QString &identifier) +void JobModel::onFocusRequest(const QString &identifier) { emit focusRequest(getJobItemForIdentifier(identifier)); } //! generates job name -QString NJobModel::generateJobName() +QString JobModel::generateJobName() { int glob_index = 0; QModelIndex parentIndex; @@ -158,7 +158,7 @@ QString NJobModel::generateJobName() //! generate unique job identifier -QString NJobModel::generateJobIdentifier() +QString JobModel::generateJobIdentifier() { return QUuid::createUuid().toString(); } diff --git a/GUI/coregui/Models/NJobModel.h b/GUI/coregui/Models/JobModel.h similarity index 70% rename from GUI/coregui/Models/NJobModel.h rename to GUI/coregui/Models/JobModel.h index 7850ccbf3d239dcb07e0c616e7f8b232a112b92c..caa1ad221261ce902f3e13d06a40989872fe7d1f 100644 --- a/GUI/coregui/Models/NJobModel.h +++ b/GUI/coregui/Models/JobModel.h @@ -12,38 +12,38 @@ //! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke // // ************************************************************************** // -#ifndef NJOBMODEL_H -#define NJOBMODEL_H +#ifndef JOBMODEL_H +#define JOBMODEL_H #include "SessionModel.h" #include "JobQueueData.h" -class NJobItem; +class JobItem; class SampleModel; class InstrumentModel; class QItemSelection; -class BA_CORE_API_ NJobModel : public SessionModel +class BA_CORE_API_ JobModel : public SessionModel { Q_OBJECT public: - explicit NJobModel(QObject *parent = 0); - ~NJobModel(); + explicit JobModel(QObject *parent = 0); + ~JobModel(); JobQueueData *getJobQueueData() { return m_queue_data; } - const NJobItem *getJobItemForIndex(const QModelIndex &index) const; - NJobItem *getJobItemForIndex(const QModelIndex &index); + const JobItem *getJobItemForIndex(const QModelIndex &index) const; + JobItem *getJobItemForIndex(const QModelIndex &index); - NJobItem *getJobItemForIdentifier(const QString &identifier); + JobItem *getJobItemForIdentifier(const QString &identifier); - NJobItem *addJob(SampleModel *sampleModel, InstrumentModel *instrumentModel, + JobItem *addJob(SampleModel *sampleModel, InstrumentModel *instrumentModel, const QString &run_policy = QString(), int numberOfThreads=-1); signals: - void selectionChanged(NJobItem *item); - void aboutToDeleteJobItem(NJobItem *item); - void focusRequest(NJobItem *item); + void selectionChanged(JobItem *item); + void aboutToDeleteJobItem(JobItem *item); + void focusRequest(JobItem *item); void globalProgress(int); public slots: diff --git a/GUI/coregui/Models/JobQueueData.cpp b/GUI/coregui/Models/JobQueueData.cpp index f2f1fa49617eb0f71d7a4e44019481a6eb330f98..e57a1a44cf8376fa34fd5b47d6331c2afe999821 100644 --- a/GUI/coregui/Models/JobQueueData.cpp +++ b/GUI/coregui/Models/JobQueueData.cpp @@ -18,13 +18,12 @@ #include "OutputDataItem.h" #include "Simulation.h" #include "AngleProperty.h" -//#include "JobItem.h" #include "InstrumentItem.h" #include "InstrumentModel.h" #include "DetectorItems.h" -#include "NIntensityDataItem.h" -#include "NJobItem.h" -#include "NJobModel.h" +#include "IntensityDataItem.h" +#include "JobItem.h" +#include "JobModel.h" #include "JobRunner.h" #include "DomainSimulationBuilder.h" #include "ThreadInfo.h" @@ -37,7 +36,7 @@ //! Creates JobQueueItem and corresponding JobItem. //! Created JobItem will be registered using unique identifier. -JobQueueData::JobQueueData(NJobModel *jobModel) +JobQueueData::JobQueueData(JobModel *jobModel) : m_jobModel(jobModel) { @@ -132,16 +131,16 @@ bool JobQueueData::hasUnfinishedJobs() return m_simulations.size(); } -void JobQueueData::setResults(NJobItem *jobItem, const Simulation *simulation) +void JobQueueData::setResults(JobItem *jobItem, const Simulation *simulation) { qDebug() << "JobQueueData::setResults(NJobItem *jobItem, const Simulation *simulation)"; if(!simulation) throw GUIHelpers::Error("NJobItem::setResults() -> Error. Null simulation."); - NIntensityDataItem *intensityItem = jobItem->getIntensityDataItem(); + IntensityDataItem *intensityItem = jobItem->getIntensityDataItem(); if(!intensityItem) { - intensityItem = static_cast<NIntensityDataItem *>(m_jobModel->insertNewItem(Constants::IntensityDataType, m_jobModel->indexOfItem(jobItem))); + intensityItem = static_cast<IntensityDataItem *>(m_jobModel->insertNewItem(Constants::IntensityDataType, m_jobModel->indexOfItem(jobItem))); } // propagatind angle units to OutputDataItem @@ -156,7 +155,7 @@ void JobQueueData::setResults(NJobItem *jobItem, const Simulation *simulation) if (subDetector->modelType() == Constants::PhiAlphaDetectorType) { AngleProperty angle_property = subDetector->getRegisteredProperty(PhiAlphaDetectorItem::P_AXES_UNITS).value<AngleProperty>(); - intensityItem->setRegisteredProperty(NIntensityDataItem::P_AXES_UNITS, angle_property.getVariant()); + intensityItem->setRegisteredProperty(IntensityDataItem::P_AXES_UNITS, angle_property.getVariant()); // if(angle_property.inDegrees()) // intensityItem->setAxesUnits(Constants::UnitsDegrees); } @@ -175,13 +174,13 @@ void JobQueueData::setResults(NJobItem *jobItem, const Simulation *simulation) void JobQueueData::runJob(const QString &identifier) { qDebug() << "JobQueueData::runJob(const QString &identifier)"; - NJobItem *jobItem = m_jobModel->getJobItemForIdentifier(identifier); + JobItem *jobItem = m_jobModel->getJobItemForIdentifier(identifier); runJob(jobItem); } //! submit job and run it in a thread -void JobQueueData::runJob(NJobItem *jobItem) +void JobQueueData::runJob(JobItem *jobItem) { QString identifier = jobItem->getIdentifier(); if(getThread(identifier)) { @@ -277,7 +276,7 @@ void JobQueueData::onStartedJob() qDebug() << "JobQueueData::onStartedJob()"; JobRunner *runner = qobject_cast<JobRunner *>(sender()); Q_ASSERT(runner); - NJobItem *jobItem = m_jobModel->getJobItemForIdentifier(runner->getIdentifier()); + JobItem *jobItem = m_jobModel->getJobItemForIdentifier(runner->getIdentifier()); jobItem->setProgress(0); jobItem->setStatus(Constants::STATUS_RUNNING); QString begin_time = QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss"); @@ -293,7 +292,7 @@ void JobQueueData::onFinishedJob() JobRunner *runner = qobject_cast<JobRunner *>(sender()); Q_ASSERT(runner); - NJobItem *jobItem = m_jobModel->getJobItemForIdentifier(runner->getIdentifier()); + JobItem *jobItem = m_jobModel->getJobItemForIdentifier(runner->getIdentifier()); QString end_time = QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss"); jobItem->setEndTime(end_time); @@ -337,7 +336,7 @@ void JobQueueData::onProgressUpdate() qDebug() << "JobQueueData::onProgressUpdate()"; JobRunner *runner = qobject_cast<JobRunner *>(sender()); Q_ASSERT(runner); - NJobItem *jobItem = m_jobModel->getJobItemForIdentifier(runner->getIdentifier()); + JobItem *jobItem = m_jobModel->getJobItemForIdentifier(runner->getIdentifier()); jobItem->setProgress(runner->getProgress()); updateGlobalProgress(); } @@ -352,7 +351,7 @@ void JobQueueData::updateGlobalProgress() QModelIndex parentIndex; for(int i_row = 0; i_row < m_jobModel->rowCount(parentIndex); ++i_row) { QModelIndex itemIndex = m_jobModel->index( i_row, 0, parentIndex ); - NJobItem *jobItem = m_jobModel->getJobItemForIndex(itemIndex); + JobItem *jobItem = m_jobModel->getJobItemForIndex(itemIndex); if(jobItem->isRunning()) { global_progress += jobItem->getProgress(); nRunningJobs++; diff --git a/GUI/coregui/Models/JobQueueData.h b/GUI/coregui/Models/JobQueueData.h index 142b35366edada0918b6f6fbb82393a014e87875..251febff2fcb3e1b4288c1137268eb59fb72bb15 100644 --- a/GUI/coregui/Models/JobQueueData.h +++ b/GUI/coregui/Models/JobQueueData.h @@ -21,8 +21,8 @@ #include <QMap> //class JobItem; -class NJobItem; -class NJobModel; +class JobItem; +class JobModel; //class JobQueueItem; class Simulation; class JobRunner; @@ -34,7 +34,7 @@ class BA_CORE_API_ JobQueueData : public QObject { Q_OBJECT public: - JobQueueData(NJobModel *jobModel); + JobQueueData(JobModel *jobModel); QThread *getThread(QString identifier); JobRunner *getRunner(QString identifier); @@ -42,7 +42,7 @@ public: bool hasUnfinishedJobs(); - void setResults(NJobItem *jobItem, const Simulation *simulation); + void setResults(JobItem *jobItem, const Simulation *simulation); signals: void globalProgress(int); @@ -57,7 +57,7 @@ public slots: void onCancelAllJobs(); void runJob(const QString &identifier); - void runJob(NJobItem *jobItem); + void runJob(JobItem *jobItem); void cancelJob(const QString &identifier); void removeJob(const QString &identifier); @@ -76,7 +76,7 @@ private: QMap<QString, JobRunner *> m_runners; //! correspondance of JobIdentifier and JobRunner's QMap<QString, Simulation *> m_simulations; //! correspondance of JobIdentifier and simulation - NJobModel *m_jobModel; + JobModel *m_jobModel; }; diff --git a/GUI/coregui/Models/JobQueueModel.cpp b/GUI/coregui/Models/JobQueueModel.cpp deleted file mode 100644 index 74009e38623c854ad8b12c5a52580f0938ccf7bf..0000000000000000000000000000000000000000 --- a/GUI/coregui/Models/JobQueueModel.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* - -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file coregui/Models/JobQueueModel.cpp -//! @brief Implements class JobQueueModel -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#include "JobQueueModel.h" -#include "JobItem.h" -#include "JobQueueItem.h" -#include "JobRunner.h" -//#include "mainwindow_constants.h" -#include "Exceptions.h" -#include "GUIHelpers.h" -#include <QMimeData> -#include <iostream> -#include <QDebug> -#include <QThread> -#include <QtGlobal> -#include <QFile> -#include <QtCore/QXmlStreamReader> -#include <QtCore/QXmlStreamWriter> -#include <QItemSelection> -#include <QUuid> - - -JobQueueModel::JobQueueModel(QObject *parent) - : QAbstractListModel(parent) - , m_queue_data(new JobQueueData) - , m_name("DefaultName") - -{ - -} - - -JobQueueModel::~JobQueueModel() -{ - qDeleteAll(m_jobs); - delete m_queue_data; -} - - -int JobQueueModel::rowCount(const QModelIndex &parent) const -{ - return m_jobs.size(); -} - - -QVariant JobQueueModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - if (index.row() >= m_jobs.size() || index.row() < 0) - return QVariant(); - - if (role == Qt::DisplayRole) { - return getJobItemForIndex(index)->getName(); - //return m_jobs.at(index.row())->getName(); - } - return QVariant(); -} - - -Qt::ItemFlags JobQueueModel::flags(const QModelIndex &index) const -{ - Qt::ItemFlags defaultFlags = QAbstractListModel::flags(index); - if(index.isValid()) - return Qt::ItemIsDragEnabled | defaultFlags; - //return Qt::ItemIsDragEnabled | Qt::ItemIsEditable | defaultFlags; - else - return Qt::ItemIsDropEnabled | defaultFlags; -} - - -bool JobQueueModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if (index.isValid() && role == Qt::EditRole) { - getJobItemForIndex(index)->setName(value.toString()); - return true; - } - return false; -} - - -//bool JobQueueModel::insertRows(int position, int rows, const QModelIndex & parent) -//{ -// qDebug() << "JobQueueModel::insertRows"; -// beginInsertRows(QModelIndex(), position, position+rows-1); - -// for (int row = 0; row < rows; ++row) { -// m_jobs.insert(position, new JobQueueItem("")); -// } - -// endInsertRows(); -// return true; -//} - - -//! Creates and adds JobQueueItem in the list of jobs. -//! Corresponding JobItem will be created too. -//! Returns unique identifier of created job. -QString JobQueueModel::addJob(QString jobName, Simulation *simulation, JobItem::ERunPolicy run_policy) -{ - int position = m_jobs.size(); - beginInsertRows(QModelIndex(), position, position); - QString identifier = m_queue_data->createJob(jobName, simulation, run_policy); - JobQueueItem *queue_item = new JobQueueItem(identifier); - m_jobs.append(queue_item); - endInsertRows(); - - JobItem *item = m_queue_data->getJobItem(queue_item->getIdentifier()); - connect(item, SIGNAL(modified(JobItem*)), this, SLOT(onJobItemIsModified(JobItem*))); - - if( item->getRunPolicy() & (JobItem::RUN_IMMEDIATELY | JobItem::RUN_IN_BACKGROUND) ) - runJob(queue_item->getIdentifier()); - - return queue_item->getIdentifier(); -} - - -QString JobQueueModel::addJob(JobItem *jobItem) -{ - Q_ASSERT(jobItem); - qDebug() << "JobQueueModel::addJob(JobItem *jobItem)" << jobItem->getRunPolicy(); - int position = m_jobs.size(); - beginInsertRows(QModelIndex(), position, position); - QString identifier = m_queue_data->createJob(jobItem); - JobQueueItem *queue_item = new JobQueueItem(identifier); - m_jobs.append(queue_item); - endInsertRows(); - - connect(jobItem, SIGNAL(modified(JobItem*)), this, SLOT(onJobItemIsModified(JobItem*))); - - if( jobItem->getRunPolicy() & (JobItem::RUN_IMMEDIATELY | JobItem::RUN_IN_BACKGROUND) && jobItem->getStatus()!=JobItem::COMPLETED) - runJob(queue_item->getIdentifier()); - - return queue_item->getIdentifier(); -} - - -bool JobQueueModel::removeRows(int position, int rows, const QModelIndex &parent) -{ - beginRemoveRows(QModelIndex(), position, position+rows-1); - for (int row = 0; row < rows; ++row) { - m_jobs.removeAt(position); - } - endRemoveRows(); - return true; -} - - -QStringList JobQueueModel::mimeTypes() const -{ - return QStringList() << JobQueueXML::MimeType; -} - - -QMimeData *JobQueueModel::mimeData(const QModelIndexList &indices) const -{ - if (indices.count() != 1) return 0; - - JobQueueItem *item = m_jobs.at(indices.at(0).row()); - Q_ASSERT(item); - - QMimeData *mimeData = new QMimeData(); - QByteArray encodedData; - QDataStream dataStream(&encodedData, QIODevice::WriteOnly); - dataStream << item->getIdentifier(); - mimeData->setData(JobQueueXML::MimeType, encodedData); - return mimeData; -} - - -bool JobQueueModel::dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) -{ - if (action == Qt::IgnoreAction) - return true; - - if(!data->hasFormat(JobQueueXML::MimeType) || column>0) - return false; - - int beginRow; - if(row != -1) - beginRow = row; - else if (parent.isValid()) - beginRow = parent.row(); - else - beginRow = rowCount(QModelIndex()); - - QByteArray encodedData = data->data(JobQueueXML::MimeType); - QDataStream dataStream(&encodedData, QIODevice::ReadOnly); - QString identifier; - dataStream >> identifier; - JobQueueItem *item = new JobQueueItem(identifier); - - beginInsertRows(QModelIndex(), beginRow, beginRow); - m_jobs.insert(beginRow, item); - endInsertRows(); - - return true; -} - - -void JobQueueModel::clear() -{ - beginResetModel(); - qDeleteAll(m_jobs); - m_jobs.clear(); - endResetModel(); -} - - -void JobQueueModel::save(const QString &filename) -{ - if (filename.isEmpty()) - throw GUIHelpers::Error(tr("no filename specified")); - QFile file(filename); - if (!file.open(QIODevice::WriteOnly|QIODevice::Text)) - throw GUIHelpers::Error(file.errorString()); - - QXmlStreamWriter writer(&file); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("BornAgain"); - writer.writeAttribute("Version", "1.9"); - - writeTo(&writer); - - writer.writeEndElement(); // BornAgain - writer.writeEndDocument(); -} - - -void JobQueueModel::writeTo(QXmlStreamWriter *writer) -{ - Q_ASSERT(writer); - - writer->writeStartElement(JobQueueXML::ModelTag); - writer->writeAttribute(JobQueueXML::ModelNameAttribute, getName()); - - foreach(JobQueueItem *queueItem, m_jobs) { - JobItem *jobItem = m_queue_data->getJobItem(queueItem->getIdentifier()); - jobItem->writeTo(writer); - } - writer->writeEndElement(); // ModelTag -} - - -void JobQueueModel::load(const QString &filename) -{ - if (filename.isEmpty()) - throw GUIHelpers::Error(tr("no filename specified")); - - QFile file(filename); - if (!file.open(QIODevice::ReadOnly)) - throw GUIHelpers::Error(file.errorString()); - - - QXmlStreamReader reader(&file); - -// readFrom(&reader); - while (!reader.atEnd()) { - reader.readNext(); - if (reader.isStartElement()) { - if (reader.name() == JobQueueXML::ModelTag) { - this->readFrom(&reader); - break; - } - } - } - - if (reader.hasError()) - throw GUIHelpers::Error(reader.errorString()); - -} - - -void JobQueueModel::readFrom(QXmlStreamReader *reader) -{ - Q_ASSERT(reader); - - if(reader->name() != JobQueueXML::ModelTag) { - throw GUIHelpers::Error("JJobQueueModel::readFrom() -> Format error in p1"); - } - - clear(); - beginResetModel(); - const QString name = reader->attributes() - .value(JobQueueXML::ModelNameAttribute).toString(); - qDebug() << "JobQueueModel::readFrom " << name; - setName(name); - - while (!reader->atEnd()) { - reader->readNext(); - if (reader->isStartElement()) { - if (reader->name() == JobQueueXML::JobTag) { - //QString identifier = addJob(0); - //m_queue_data->getJobItem(identifier)->readFrom(reader); - JobItem *jobItem = new JobItem(QString()); - jobItem->readFrom(reader); - addJob(jobItem); - } else { - throw GUIHelpers::Error("JobQueueModel::readFrom() -> Format error in p2"); - } - } else if (reader->isEndElement()) { - if (reader->name() == JobQueueXML::ModelTag) { - endResetModel(); - break; // end of xml of current Job - } - } - } - -} - - -void JobQueueModel::onSelectionChanged( const QItemSelection &selected, const QItemSelection & deselected) -{ - qDebug() << "JobQueueModel::onSelectionChanged" << selected; - if(!selected.empty() && !selected.first().indexes().empty()) { - QModelIndex index = selected.first().indexes().at(0); - emit selectionChanged(getJobItemForIndex(index)); - } -} - - -//! Method should be called to inform given model about changes in JobItem -void JobQueueModel::onJobItemIsModified(JobItem *modified_item) -{ - QModelIndex itemIndex = getIndexForJobItem(modified_item); - dataChanged(itemIndex, itemIndex); -// QString identifier = m_queue_data->getIdentifierForJobItem(modified_item); -// foreach(JobQueueItem *queue_item, m_jobs) { -// if(queue_item->getIdentifier() == identifier) { -// QModelIndex item_index = index(m_jobs.indexOf(queue_item), 0); -// dataChanged(item_index, item_index); -// } -// } -} - - -//! returns JobIdentifier for given model index -QString JobQueueModel::getIdentifier(const QModelIndex &index) const -{ - if(!index.isValid() || index.row() < 0 || index.row() >= rowCount()) - throw GUIHelpers::Error("JobQueueModel::getIdentifier() -> Wrong index"); - - return m_jobs.at(index.row())->getIdentifier(); -} - - -//! returns JobItem for given index (const version) -const JobItem *JobQueueModel::getJobItemForIndex(const QModelIndex &index) const -{ - return m_queue_data->getJobItem(getIdentifier(index)); -} - - -//! returns JobItem for given index -JobItem *JobQueueModel::getJobItemForIndex(const QModelIndex &index) -{ - return const_cast<JobItem *>(static_cast<const JobQueueModel &>(*this).getJobItemForIndex(index)); -} - - -QModelIndex JobQueueModel::getIndexForJobItem(const JobItem *item) -{ - QString identifier = m_queue_data->getIdentifierForJobItem(item); - foreach(JobQueueItem *queue_item, m_jobs) { - if(queue_item->getIdentifier() == identifier) { - return index(m_jobs.indexOf(queue_item), 0); - } - } - - return QModelIndex(); -} - - -//! runs corresponding job in a thread -void JobQueueModel::runJob(const QModelIndex &index) -{ - m_queue_data->runJob(getIdentifier(index)); -} - -//! runs corresponding job in a thread -void JobQueueModel::runJob(const QString &identifier) -{ - m_queue_data->runJob(identifier); -} - - -//! cancel corresponding job if it is running -void JobQueueModel::cancelJob(const QModelIndex &index) -{ - m_queue_data->cancelJob(getIdentifier(index)); -} - - -//! remove job completely from list and underlying m_queue_data -void JobQueueModel::removeJob(const QModelIndex &index) -{ - emit aboutToDeleteJobItem(getJobItemForIndex(index)); - QString identifier = getIdentifier(index); - removeRows(index.row(), 1, QModelIndex()); - m_queue_data->removeJob(identifier); -} - - -*/ - diff --git a/GUI/coregui/Models/JobQueueModel.h b/GUI/coregui/Models/JobQueueModel.h deleted file mode 100644 index 06f12b8c8e159f25b28495b9b2dee21bf57deb2c..0000000000000000000000000000000000000000 --- a/GUI/coregui/Models/JobQueueModel.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file coregui/Models/JobQueueModel.h -//! @brief Defines class JobQueueModel -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#ifndef JOBQUEUEMODEL_H -#define JOBQUEUEMODEL_H - -#include "JobQueueData.h" -#include "JobItem.h" -#include <QAbstractListModel> -#include <QList> -#include <QModelIndex> -#include <QMap> - -class JobItem; -class JobQueueItem; -class Simulation; -class SampleModel; -class SimulationModel; -class QXmlStreamWriter; -class QXmlStreamReader; -class QItemSelection; -class QThread; - - -namespace JobQueueXML -{ - const QString ModelTag("JobQueueModel"); - const QString ModelNameAttribute("Name"); - const QString JobTag("Job"); - const QString JobNameAttribute("Name"); - const QString JobBeginTimeAttribute("BeginTime"); - const QString JobEndTimeAttribute("EndTime"); - const QString JobCommentsAttribute("Comments"); - const QString JobStatusAttribute("Status"); - const QString JobProgressAttribute("Progress"); - const QString OutputDataTag("OutputData"); - const QString OutputDataNameAttribute("Name"); - const QString OutputDataXminAttribute("Xmin"); - const QString OutputDataXmaxAttribute("Xmax"); - const QString OutputDataYminAttribute("Ymin"); - const QString OutputDataYmaxAttribute("Ymax"); - const QString OutputDataZminAttribute("Zmin"); - const QString OutputDataZmaxAttribute("Zmax"); - const QString OutputDataLogzAttribute("Logz"); - const QString OutputDataInterpolatedAttribute("Interpolated"); - const QString OutputDataXtitleAttribute("Xtitle"); - const QString OutputDataYtitleAttribute("Ytitle"); - const QString MimeType("application/org.bornagainproject.jobqueue"); -} - - -//! The model for all jobs in a queue. Contains JobQueueItem in a list. -//! Provides interface to access real JobItem objects. -class BA_CORE_API_ JobQueueModel : public QAbstractListModel -{ - Q_OBJECT -public: - explicit JobQueueModel(QObject *parent = 0); - virtual ~JobQueueModel(); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); - -// bool insertRows(int position, int rows, const QModelIndex &parent); - bool removeRows(int position, int rows, const QModelIndex &parent); - - Qt::DropActions supportedDragActions() const { return Qt::MoveAction; } - Qt::DropActions supportedDropActions() const { return Qt::MoveAction; } - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &indexes) const; - bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - - QString addJob(QString jobName=QString(), Simulation *simulation=0, JobItem::ERunPolicy run_policy = JobItem::SUBMIT_ONLY); - QString addJob(JobItem *jobItem); - - void clear(); - - void save(const QString &filename=QString()); - void writeTo(QXmlStreamWriter *writer); - - void load(const QString &filename=QString()); - void readFrom(QXmlStreamReader *reader); - - QString getName() const { return m_name; } - void setName(QString name) { m_name = name; } - - QString getIdentifier(const QModelIndex &index) const; - - const JobItem *getJobItemForIndex(const QModelIndex &index) const; - JobItem *getJobItemForIndex(const QModelIndex &index); - - QModelIndex getIndexForJobItem(const JobItem *item); - - JobQueueData *getJobQueueData() { return m_queue_data; } - -signals: - void selectionChanged(JobItem *item); - void aboutToDeleteJobItem(JobItem *item); - -public slots: - void onJobItemIsModified(JobItem *); - void onSelectionChanged( const QItemSelection&, const QItemSelection& ); - void runJob(const QModelIndex &index); - void runJob(const QString &identifier); - void cancelJob(const QModelIndex &index); - void removeJob(const QModelIndex &index); - -private: - JobQueueData *m_queue_data; - QString m_name; - QList <JobQueueItem *> m_jobs; -}; - - -#endif - - -*/ diff --git a/GUI/coregui/Models/JobRunner.h b/GUI/coregui/Models/JobRunner.h index 54512bc3606035f68ef08e79382e05e3b1de0ea7..b09fad674bf56ebf94c5a19ee17d13b69b03f592 100644 --- a/GUI/coregui/Models/JobRunner.h +++ b/GUI/coregui/Models/JobRunner.h @@ -17,7 +17,6 @@ #define JOBRUNNER_H #include "WinDllMacros.h" -#include "JobItem.h" #include <QObject> #include <QString> diff --git a/GUI/coregui/Models/NJobItem.cpp b/GUI/coregui/Models/NJobItem.cpp deleted file mode 100644 index fa8cbe81f08e346f70cb34181c3947045f33a13e..0000000000000000000000000000000000000000 --- a/GUI/coregui/Models/NJobItem.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file coregui/Models/NJobItem.cpp -//! @brief Implements class NJobItem -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#include "NJobItem.h" -#include "ComboProperty.h" -#include "NIntensityDataItem.h" -#include "SampleModel.h" -#include "InstrumentModel.h" - - -namespace -{ -const QString RUN_IMMEDIATELY = "Immediately"; -const QString RUN_IN_BACKGROUND = "In background"; -const QString RUN_SUBMIT_ONLY = "Submit only"; - -QMap<QString, QString> initializeRunPolicies() -{ - QMap<QString, QString> result; - result[RUN_IMMEDIATELY] = QString("Start simulation immediately, switch to Jobs view automatically when completed"); - result[RUN_IN_BACKGROUND] = QString("Start simulation immediately, do not switch to Jobs view when completed"); - result[RUN_SUBMIT_ONLY] = QString("Only submit simulation for consequent execution, has to be started from Jobs view explicitely"); - return result; -} - -} - -QMap<QString, QString> NJobItem::m_run_policies = initializeRunPolicies(); - - -const QString NJobItem::P_IDENTIFIER = "Identifier"; -const QString NJobItem::P_SAMPLE_NAME = "Sample"; -const QString NJobItem::P_INSTRUMENT_NAME = "Instrument"; -const QString NJobItem::P_STATUS = "Status"; -const QString NJobItem::P_BEGIN_TIME = "Begin Time"; -const QString NJobItem::P_END_TIME = "End Time"; -const QString NJobItem::P_COMMENTS = "Comments"; -const QString NJobItem::P_PROGRESS = "Progress"; -const QString NJobItem::P_NTHREADS = "Number of Threads"; -const QString NJobItem::P_RUN_POLICY = "Run Policy"; - - -NJobItem::NJobItem(ParameterizedItem *parent) - : ParameterizedItem(Constants::JobItemType, parent) - , m_sampleModel(0) - , m_instrumentModel(0) -{ - setItemName(Constants::JobItemType); - registerProperty(P_IDENTIFIER, QString(), PropertyAttribute(PropertyAttribute::HIDDEN)); - registerProperty(P_SAMPLE_NAME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); - registerProperty(P_INSTRUMENT_NAME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); - - ComboProperty status; - status << Constants::STATUS_IDLE << Constants::STATUS_RUNNING << Constants::STATUS_COMPLETED - << Constants::STATUS_CANCELED << Constants::STATUS_FAILED; - registerProperty(P_STATUS, status.getVariant(), PropertyAttribute(PropertyAttribute::READONLY)); - - registerProperty(P_BEGIN_TIME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); - registerProperty(P_END_TIME, QString(), PropertyAttribute(PropertyAttribute::READONLY)); - registerProperty(P_COMMENTS, QString(), PropertyAttribute(PropertyAttribute::HIDDEN)); - - registerProperty(P_PROGRESS, 0, PropertyAttribute(PropertyAttribute::HIDDEN)); - registerProperty(P_NTHREADS, -1, PropertyAttribute(PropertyAttribute::HIDDEN)); - - ComboProperty policy; - policy << RUN_IMMEDIATELY <<RUN_IN_BACKGROUND << RUN_SUBMIT_ONLY; - registerProperty(P_RUN_POLICY, policy.getVariant(), PropertyAttribute(PropertyAttribute::HIDDEN)); - - addToValidChildren(Constants::IntensityDataType); - - setPropertyAppearance(ParameterizedItem::P_NAME, PropertyAttribute::VISIBLE); - - -} - -QString NJobItem::getIdentifier() const -{ - return getRegisteredProperty(P_IDENTIFIER).toString(); -} - -void NJobItem::setIdentifier(const QString &identifier) -{ - setRegisteredProperty(NJobItem::P_IDENTIFIER, identifier); -} - -NIntensityDataItem *NJobItem::getIntensityDataItem() -{ - foreach(ParameterizedItem *item, childItems()) { - NIntensityDataItem *data = dynamic_cast<NIntensityDataItem *>(item); - if(data) return data; - } - return 0; -} - -SampleModel *NJobItem::getSampleModel() -{ - return m_sampleModel; -} - -void NJobItem::setSampleModel(SampleModel *sampleModel) -{ - delete m_sampleModel; - m_sampleModel = sampleModel; - if(m_sampleModel) { - setRegisteredProperty(P_SAMPLE_NAME, m_sampleModel->getSampleMap().firstKey()); - } -} - -InstrumentModel *NJobItem::getInstrumentModel() -{ - return m_instrumentModel; -} - -void NJobItem::setInstrumentModel(InstrumentModel *instrumentModel) -{ - delete m_instrumentModel; - m_instrumentModel = instrumentModel; - if(m_instrumentModel) { - setRegisteredProperty(P_INSTRUMENT_NAME, m_instrumentModel->getInstrumentMap().firstKey()); - } -} - -QString NJobItem::getStatus() const -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - return combo_property.getValue(); -} - -void NJobItem::setStatus(const QString &status) -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - combo_property.setValue(status); - setRegisteredProperty(P_STATUS, combo_property.getVariant()); -} - -bool NJobItem::isIdle() const -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - return combo_property.getValue() == Constants::STATUS_IDLE; -} - -bool NJobItem::isRunning() const -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - return combo_property.getValue() == Constants::STATUS_RUNNING; -} - -bool NJobItem::isCompleted() const -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - return combo_property.getValue() == Constants::STATUS_COMPLETED; -} - -bool NJobItem::isCanceled() const -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - return combo_property.getValue() == Constants::STATUS_CANCELED; -} - -bool NJobItem::isFailed() const -{ - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); - return combo_property.getValue() == Constants::STATUS_FAILED; -} - -void NJobItem::setBeginTime(const QString &begin_time) -{ - setRegisteredProperty(P_BEGIN_TIME, begin_time); -} - -void NJobItem::setEndTime(const QString &end_time) -{ - setRegisteredProperty(P_END_TIME, end_time); -} - -QString NJobItem::getComments() const -{ - return getRegisteredProperty(P_COMMENTS).toString(); -} - -void NJobItem::setComments(const QString &comments) -{ - setRegisteredProperty(P_COMMENTS, comments); -} - -int NJobItem::getProgress() const -{ - return getRegisteredProperty(P_PROGRESS).toInt(); -} - -void NJobItem::setProgress(int progress) -{ - setRegisteredProperty(P_PROGRESS, progress); -} - -int NJobItem::getNumberOfThreads() const -{ - return getRegisteredProperty(P_NTHREADS).toInt(); -} - -void NJobItem::setNumberOfThreads(int number_of_threads) -{ - setRegisteredProperty(P_NTHREADS, number_of_threads); -} - -bool NJobItem::runImmediately() const -{ - ComboProperty combo_property = getRegisteredProperty(P_RUN_POLICY).value<ComboProperty>(); - return combo_property.getValue() == RUN_IMMEDIATELY; -} - -bool NJobItem::runInBackground() const -{ - ComboProperty combo_property = getRegisteredProperty(P_RUN_POLICY).value<ComboProperty>(); - return combo_property.getValue() == RUN_IN_BACKGROUND; -} diff --git a/GUI/coregui/Models/NJobItem.h b/GUI/coregui/Models/NJobItem.h deleted file mode 100644 index 4f377ba1897fb9c36a07f47f71280b247deea896..0000000000000000000000000000000000000000 --- a/GUI/coregui/Models/NJobItem.h +++ /dev/null @@ -1,87 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file coregui/Models/NJobItem.h -//! @brief Defines class NJobItem -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#ifndef NJOBITEM_H -#define NJOBITEM_H - -#include "ParameterizedItem.h" -class NIntensityDataItem; -class SampleModel; -class InstrumentModel; -class Simulation; - -class BA_CORE_API_ NJobItem : public ParameterizedItem -{ - Q_OBJECT -public: - static const QString P_IDENTIFIER; - static const QString P_SAMPLE_NAME; - static const QString P_INSTRUMENT_NAME; - static const QString P_STATUS; - static const QString P_BEGIN_TIME; - static const QString P_END_TIME; - static const QString P_COMMENTS; - static const QString P_PROGRESS; - static const QString P_NTHREADS; - static const QString P_RUN_POLICY; - explicit NJobItem(ParameterizedItem *parent=0); - ~NJobItem(){} - - QString getIdentifier() const; - void setIdentifier(const QString &identifier); - - NIntensityDataItem *getIntensityDataItem(); - - SampleModel *getSampleModel(); - void setSampleModel(SampleModel *sampleModel); - - InstrumentModel *getInstrumentModel(); - void setInstrumentModel(InstrumentModel *instrumentModel); - - QString getStatus() const; - void setStatus(const QString &status); - - bool isIdle() const; - bool isRunning() const; - bool isCompleted() const; - bool isCanceled() const; - bool isFailed() const; - - void setBeginTime(const QString &begin_time); - - void setEndTime(const QString &end_time); - - QString getComments() const; - void setComments(const QString &comments); - - int getProgress() const; - void setProgress(int progress); - - int getNumberOfThreads() const; - void setNumberOfThreads(int number_of_threads); - - static QMap<QString, QString> getRunPolicies() { return m_run_policies; } - - bool runImmediately() const; - bool runInBackground() const; - -private: - SampleModel *m_sampleModel; - InstrumentModel *m_instrumentModel; - static QMap<QString, QString> m_run_policies; // run policy, policy description - -}; - -#endif // NJOBITEM_H diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.cpp index 7fee7e2af99e9b9787195508213ab5bc48daa223..a354518aa08ccb97e30f7c9d5c3aa04f4a495f17 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.cpp @@ -14,10 +14,8 @@ // ************************************************************************** // #include "JobListViewDelegate.h" -//#include "JobQueueModel.h" -//#include "JobItem.h" -#include "NJobModel.h" -#include "NJobItem.h" +#include "JobModel.h" +#include "JobItem.h" #include "progressbar.h" #include <QDebug> #include <QPainter> @@ -49,10 +47,10 @@ void JobListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o if (option.state & QStyle::State_Selected) painter->fillRect(option.rect, option.palette.highlight()); - const NJobModel* model = static_cast<const NJobModel*>(index.model()); + const JobModel* model = static_cast<const JobModel*>(index.model()); Q_ASSERT(model); - const NJobItem *item = model->getJobItemForIndex(index); + const JobItem *item = model->getJobItemForIndex(index); Q_ASSERT(item); painter->save(); @@ -110,10 +108,10 @@ bool JobListViewDelegate::editorEvent(QEvent *event, } - const NJobModel* jqmodel = static_cast<const NJobModel*>(index.model()); + const JobModel* jqmodel = static_cast<const JobModel*>(index.model()); Q_ASSERT(model); - const NJobItem *item = jqmodel->getJobItemForIndex(index); + const JobItem *item = jqmodel->getJobItemForIndex(index); Q_ASSERT(item); if(!item->isRunning()) return false; @@ -137,7 +135,7 @@ bool JobListViewDelegate::editorEvent(QEvent *event, } -void JobListViewDelegate::drawCustomProjectBar(const NJobItem *item, QPainter *painter, const QStyleOptionViewItem &option) const +void JobListViewDelegate::drawCustomProjectBar(const JobItem *item, QPainter *painter, const QStyleOptionViewItem &option) const { int progress = item->getProgress(); QRect rect = getProgressBarRect(option.rect); diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.h index 69d68c96d68994c6f8696580ac39e5a3408afd5c..840884dd7226da7b89af287f538dff2daf9523dc 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobListViewDelegate.h @@ -21,7 +21,7 @@ #include <QRect> #include <QMap> -class NJobItem; +class JobItem; //! ViewDelegate to show progress bar JobQueuListView class BA_CORE_API_ JobListViewDelegate : public QItemDelegate @@ -41,7 +41,7 @@ signals: private: QStyle::State m_buttonState; - void drawCustomProjectBar(const NJobItem *item, QPainter *painter, const QStyleOptionViewItem &option) const; + void drawCustomProjectBar(const JobItem *item, QPainter *painter, const QStyleOptionViewItem &option) const; QRect getTextRect(QRect optionRect) const; QRect getProgressBarRect(QRect optionRect) const; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp index eb43702556208d91f87f6bd7b876487d3b713555..f222d950b90df218addd120b5b572433e72a74d0 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp @@ -14,10 +14,8 @@ // ************************************************************************** // #include "JobListWidget.h" -//#include "JobQueueModel.h" -//#include "JobItem.h" -#include "NJobModel.h" -#include "NJobItem.h" +#include "JobModel.h" +#include "JobItem.h" #include "JobListViewDelegate.h" #include "JobListToolBar.h" #include <QPushButton> @@ -78,7 +76,7 @@ JobListWidget::JobListWidget(QWidget *parent) } -void JobListWidget::setModel(NJobModel *model) +void JobListWidget::setModel(JobModel *model) { Q_ASSERT(model); if(model != m_jobModel) { @@ -136,7 +134,7 @@ bool JobListWidget::jobItemCanBeRun(const QModelIndex &index) { if(!index.isValid()) return false; - const NJobItem *jobItem = m_jobModel->getJobItemForIndex(index); + const JobItem *jobItem = m_jobModel->getJobItemForIndex(index); if(jobItem->isCompleted() || jobItem->isFailed()) return false; return true; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h index 4799d3786ee83b8e3c47f4dca67e1e34503b2e63..655e2b4b0e7b18c761cc0bf4034cabca4a0b9dec 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h @@ -21,7 +21,7 @@ #include <QModelIndex> //class JobQueueModel; -class NJobModel; +class JobModel; class JobListViewDelegate; class QListView; class QPushButton; @@ -39,7 +39,7 @@ class BA_CORE_API_ JobListWidget : public QWidget public: explicit JobListWidget(QWidget *parent = 0); - void setModel(NJobModel *model); + void setModel(JobModel *model); QSize sizeHint() const { return QSize(64, 768); } QSize minimumSizeHint() const { return QSize(64, 64); } @@ -61,7 +61,7 @@ private: void setupContextMenuActions(); bool jobItemCanBeRun(const QModelIndex &index); - NJobModel *m_jobModel; + JobModel *m_jobModel; JobListViewDelegate *m_listViewDelegate; QListView *m_listView; QAction *m_runJobAction; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.cpp index 291f365b2134270a9248b892c6845194a9bf0608..da7c77fe3046325d142c21a6074b8294804b71b5 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.cpp @@ -14,10 +14,8 @@ // ************************************************************************** // #include "JobOutputDataWidget.h" -//#include "JobQueueModel.h" -#include "NJobModel.h" -#include "NJobItem.h" -//#include "OutputDataWidget.h" +#include "JobModel.h" +#include "JobItem.h" #include "IntensityDataWidget.h" #include "JobOutputDataToolBar.h" #include "JobView.h" @@ -32,7 +30,7 @@ #include "GUIHelpers.h" -JobOutputDataWidget::JobOutputDataWidget(NJobModel *jobModel, ProjectManager *projectManager, QWidget *parent) +JobOutputDataWidget::JobOutputDataWidget(JobModel *jobModel, ProjectManager *projectManager, QWidget *parent) : QWidget(parent) , m_jobModel(0) , m_projectManager(projectManager) @@ -83,7 +81,7 @@ JobOutputDataWidget::JobOutputDataWidget(NJobModel *jobModel, ProjectManager *pr // } //} -void JobOutputDataWidget::setJobModel(NJobModel *jobModel) +void JobOutputDataWidget::setJobModel(JobModel *jobModel) { Q_ASSERT(jobModel); @@ -91,30 +89,30 @@ void JobOutputDataWidget::setJobModel(NJobModel *jobModel) if(m_jobModel) disconnect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); m_jobModel = jobModel; connect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); // connect(m_jobModel->getJobQueueData(), SIGNAL(jobIsFinished(QString)) // , this, SLOT(onJobItemFinished(QString))); - connect(m_jobModel, SIGNAL(aboutToDeleteJobItem(NJobItem*)) - , this, SLOT(onJobItemDelete(NJobItem*))); + connect(m_jobModel, SIGNAL(aboutToDeleteJobItem(JobItem*)) + , this, SLOT(onJobItemDelete(JobItem*))); } } -void JobOutputDataWidget::setItem(NJobItem * item) +void JobOutputDataWidget::setItem(JobItem * item) { qDebug() << "JobOutputDataWidget::setItem()" << item; if(!item) return; @@ -245,7 +243,7 @@ IntensityDataWidget *JobOutputDataWidget::getCurrentOutputDataWidget() } -void JobOutputDataWidget::onJobItemDelete(NJobItem *item) +void JobOutputDataWidget::onJobItemDelete(JobItem *item) { qDebug() << "JobOutputDataWidget::onJobItemDelete()"; IntensityDataWidget *widget = m_jobItemToPlotWidget[item]; @@ -255,7 +253,7 @@ void JobOutputDataWidget::onJobItemDelete(NJobItem *item) return; } - QMap<NJobItem *, IntensityDataWidget *>::iterator it = m_jobItemToPlotWidget.begin(); + QMap<JobItem *, IntensityDataWidget *>::iterator it = m_jobItemToPlotWidget.begin(); while(it!=m_jobItemToPlotWidget.end()) { if(it.value() == widget) { it = m_jobItemToPlotWidget.erase(it); diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.h index 6823547fc796c419d366570ae5f8c828c3cd2187..6361d56b2e8a72b8037a63af1ba895adac76394c 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobOutputDataWidget.h @@ -28,18 +28,18 @@ class QModelIndex; //class JobItem; class JobOutputDataToolBar; class ProjectManager; -class NJobModel; -class NJobItem; +class JobModel; +class JobItem; class BA_CORE_API_ JobOutputDataWidget : public QWidget { Q_OBJECT public: // explicit JobOutputDataWidget(JobQueueModel *jobQueueModel, ProjectManager *projectManager, QWidget *parent = 0); - explicit JobOutputDataWidget(NJobModel *joModel, ProjectManager *projectManager, QWidget *parent = 0); + explicit JobOutputDataWidget(JobModel *joModel, ProjectManager *projectManager, QWidget *parent = 0); // void setJobQueueModel(JobQueueModel *jobQueueModel); - void setJobModel(NJobModel *jobModel); + void setJobModel(JobModel *jobModel); JobOutputDataToolBar *getToolBar() { return m_toolBar; } @@ -47,8 +47,8 @@ signals: void jobViewActivityRequest(int activity); public slots: - void setItem(NJobItem *item); - void onJobItemDelete(NJobItem *item); + void setItem(JobItem *item); + void onJobItemDelete(JobItem *item); // void onJobItemFinished(const QString &identifier); void togglePropertyPanel(); void toggleProjections(); @@ -61,11 +61,11 @@ private: IntensityDataWidget *getCurrentOutputDataWidget(); // JobQueueModel *m_jobQueueModel; - NJobModel *m_jobModel; + JobModel *m_jobModel; ProjectManager *m_projectManager; - NJobItem *m_currentJobItem; + JobItem *m_currentJobItem; QStackedWidget *m_stack; - QMap<NJobItem *, IntensityDataWidget *> m_jobItemToPlotWidget; + QMap<JobItem *, IntensityDataWidget *> m_jobItemToPlotWidget; JobOutputDataToolBar *m_toolBar; }; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.cpp index 882044f4c2b4240f8cee6bdff5d5bbb9e2b5b0ba..ac67dfbdcc190e0f7b72782174618e4eaa9ae5ab 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.cpp @@ -15,8 +15,8 @@ #include "JobPropertiesWidget.h" #include "UniversalPropertyEditor.h" -#include "NJobModel.h" -#include "NJobItem.h" +#include "JobModel.h" +#include "JobItem.h" #include <QVBoxLayout> #include <QTabBar> #include <QTextEdit> @@ -60,22 +60,22 @@ JobPropertiesWidget::JobPropertiesWidget(QWidget *parent) } -void JobPropertiesWidget::setModel(NJobModel *model) +void JobPropertiesWidget::setModel(JobModel *model) { Q_ASSERT(model); if(model != m_jobModel) { if(m_jobModel) disconnect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); m_jobModel = model; connect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); // connect(m_jobModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)) @@ -84,7 +84,7 @@ void JobPropertiesWidget::setModel(NJobModel *model) } -void JobPropertiesWidget::setItem(NJobItem *jobItem) +void JobPropertiesWidget::setItem(JobItem *jobItem) { qDebug() << "JobPropertiesWidget::setItem" << jobItem; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.h index 766eb1c3fabb93c5a1d183c77bae7747fb1e049e..c441b189eeec46c022204bc1722362f2ab851c08 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobPropertiesWidget.h @@ -20,8 +20,8 @@ #include <QWidget> #include <QMap> -class NJobModel; -class NJobItem; +class JobModel; +class JobItem; class QTextEdit; class QTabWidget; class UniversalPropertyEditor; @@ -35,17 +35,17 @@ public: enum ETabId { JOB_PROPERTIES, JOB_COMMENTS }; explicit JobPropertiesWidget(QWidget *parent = 0); - void setModel(NJobModel *model); + void setModel(JobModel *model); QSize sizeHint() const { return QSize(64, 256); } QSize minimumSizeHint() const { return QSize(64, 64); } public slots: - void setItem(NJobItem *item); + void setItem(JobItem *item); private: - NJobModel *m_jobModel; - NJobItem *m_currentItem; + JobModel *m_jobModel; + JobItem *m_currentItem; QTabWidget *m_tabWidget; UniversalPropertyEditor *m_propertyEditor; QTextEdit *m_commentsEditor; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.cpp index a1348cc3e8bef737ec078d78c7689b5af21013b0..a54487a46c1556d7f759ed86acc609a48f2618b1 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.cpp @@ -14,9 +14,8 @@ // ************************************************************************** // #include "JobRealTimeWidget.h" -//#include "JobQueueModel.h" -#include "NJobModel.h" -#include "NJobItem.h" +#include "JobModel.h" +#include "JobItem.h" #include "ModelTuningWidget.h" #include "JobRealTimeToolBar.h" #include <QVBoxLayout> @@ -28,7 +27,7 @@ #include "GUIHelpers.h" -JobRealTimeWidget::JobRealTimeWidget(NJobModel *jobModel, QWidget *parent) +JobRealTimeWidget::JobRealTimeWidget(JobModel *jobModel, QWidget *parent) : QWidget(parent) , m_jobModel(0) , m_currentJobItem(0) @@ -60,15 +59,15 @@ JobRealTimeWidget::JobRealTimeWidget(NJobModel *jobModel, QWidget *parent) } -void JobRealTimeWidget::setJobModel(NJobModel *jobModel) +void JobRealTimeWidget::setJobModel(JobModel *jobModel) { Q_ASSERT(jobModel); if(jobModel != m_jobModel) { if(m_jobModel) { disconnect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); disconnect(m_jobModel->getJobQueueData(), SIGNAL(jobIsFinished(QString)) @@ -81,21 +80,21 @@ void JobRealTimeWidget::setJobModel(NJobModel *jobModel) m_jobModel = jobModel; connect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); connect(m_jobModel->getJobQueueData(), SIGNAL(jobIsFinished(QString)) , this, SLOT(onJobItemFinished(QString))); - connect(m_jobModel, SIGNAL(aboutToDeleteJobItem(NJobItem*)) - , this, SLOT(onJobItemDelete(NJobItem*))); + connect(m_jobModel, SIGNAL(aboutToDeleteJobItem(JobItem*)) + , this, SLOT(onJobItemDelete(JobItem*))); } } -void JobRealTimeWidget::setItem(NJobItem * item) +void JobRealTimeWidget::setItem(JobItem * item) { qDebug() << "JobOutputDataWidget::setItem()"; if(!item) return; @@ -132,7 +131,7 @@ void JobRealTimeWidget::setItem(NJobItem * item) void JobRealTimeWidget::onJobItemFinished(const QString &identifier) { qDebug() << "JobOutputDataWidget::onJobItemFinished()"; - NJobItem *jobItem = m_jobModel->getJobItemForIdentifier(identifier); + JobItem *jobItem = m_jobModel->getJobItemForIdentifier(identifier); if(jobItem == m_currentJobItem) { if((jobItem->isCompleted() || jobItem->isCanceled()) && jobItem->getIntensityDataItem()) { @@ -170,13 +169,13 @@ ModelTuningWidget *JobRealTimeWidget::getCurrentModelTuningWidget() //! Returns true if JobItem is valid for real time simulation, i.e. //! it is not already running and it has valid models -bool JobRealTimeWidget::isValidJobItem(NJobItem *item) +bool JobRealTimeWidget::isValidJobItem(JobItem *item) { return (item->isCompleted() || item->isCanceled()) && item->getSampleModel() && item->getInstrumentModel(); } -void JobRealTimeWidget::onJobItemDelete(NJobItem *item) +void JobRealTimeWidget::onJobItemDelete(JobItem *item) { qDebug() << "JobOutputDataWidget::onJobItemDelete()"; ModelTuningWidget *widget = m_jobItemToTuningWidget[item]; @@ -185,7 +184,7 @@ void JobRealTimeWidget::onJobItemDelete(NJobItem *item) return; } - QMap<NJobItem *, ModelTuningWidget *>::iterator it = m_jobItemToTuningWidget.begin(); + QMap<JobItem *, ModelTuningWidget *>::iterator it = m_jobItemToTuningWidget.begin(); while(it!=m_jobItemToTuningWidget.end()) { if(it.value() == widget) { it = m_jobItemToTuningWidget.erase(it); diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.h index cb977c8db035e2569d310f75eb2d0df234f2577e..8349c3788e61cd23585f497bf63f85b41ca32edc 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobRealTimeWidget.h @@ -21,8 +21,8 @@ #include <QMap> //class JobQueueModel; -class NJobModel; -class NJobItem; +class JobModel; +class JobItem; class QStackedWidget; class QModelIndex; //class JobItem; @@ -35,25 +35,25 @@ class BA_CORE_API_ JobRealTimeWidget : public QWidget { Q_OBJECT public: - explicit JobRealTimeWidget(NJobModel *jobModel, QWidget *parent = 0); + explicit JobRealTimeWidget(JobModel *jobModel, QWidget *parent = 0); - void setJobModel(NJobModel *jobModel); + void setJobModel(JobModel *jobModel); public slots: - void setItem(NJobItem *item); - void onJobItemDelete(NJobItem *item); + void setItem(JobItem *item); + void onJobItemDelete(JobItem *item); void onJobItemFinished(const QString &identifier); void onResetParameters(); void updateCurrentItem(); private: ModelTuningWidget *getCurrentModelTuningWidget(); - bool isValidJobItem(NJobItem *item); + bool isValidJobItem(JobItem *item); - NJobModel *m_jobModel; - NJobItem *m_currentJobItem; + JobModel *m_jobModel; + JobItem *m_currentJobItem; QStackedWidget *m_stack; - QMap<NJobItem *, ModelTuningWidget *> m_jobItemToTuningWidget; + QMap<JobItem *, ModelTuningWidget *> m_jobItemToTuningWidget; JobRealTimeToolBar *m_toolBar; }; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp index fcaff0fce2a36ad5a66d712f98c3178a03873850..9cf0343aa1d285994fa9711520f1c9a6450c2c4a 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp @@ -14,10 +14,8 @@ // ************************************************************************** // #include "JobSelectorWidget.h" -//#include "JobQueueModel.h" -//#include "JobItem.h" -#include "NJobModel.h" -#include "NJobItem.h" +#include "JobModel.h" +#include "JobItem.h" #include "JobPropertiesWidget.h" #include "JobListWidget.h" #include "styledbar.h" @@ -32,7 +30,7 @@ -JobSelectorWidget::JobSelectorWidget(NJobModel *model, QWidget *parent) +JobSelectorWidget::JobSelectorWidget(JobModel *model, QWidget *parent) : QWidget(parent) , m_jobModel(0) , m_splitter(new Manhattan::MiniSplitter(this)) @@ -61,7 +59,7 @@ JobSelectorWidget::JobSelectorWidget(NJobModel *model, QWidget *parent) } -void JobSelectorWidget::setModel(NJobModel *model) +void JobSelectorWidget::setModel(JobModel *model) { if(model != m_jobModel) { m_jobModel = model; @@ -71,7 +69,7 @@ void JobSelectorWidget::setModel(NJobModel *model) } -void JobSelectorWidget::makeJobItemSelected(NJobItem *item) +void JobSelectorWidget::makeJobItemSelected(JobItem *item) { Q_ASSERT(item); qDebug() << "JobSelectorWidget::makeJobItemSelected(NJobItem *item)" << item; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h index 578f2865ba8bcc299cc98350991532fda408a5f3..9fd14ae29307b18ed01d4687b65a430197bdf250 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h @@ -20,8 +20,8 @@ #include <QWidget> //class JobQueueModel; -class NJobModel; -class NJobItem; +class JobModel; +class JobItem; class JobPropertiesWidget; class QSplitter; class QPushButton; @@ -33,19 +33,19 @@ class JobListWidget; class BA_CORE_API_ JobSelectorWidget : public QWidget { public: - explicit JobSelectorWidget(NJobModel *model, QWidget *parent = 0); + explicit JobSelectorWidget(JobModel *model, QWidget *parent = 0); - void setModel(NJobModel *model); + void setModel(JobModel *model); QSize sizeHint() const { return QSize(210, 600); } QSize minimumSizeHint() const { return QSize(64, 300); } public slots: - void makeJobItemSelected(NJobItem *); + void makeJobItemSelected(JobItem *); private: // JobQueueModel *m_jobQueueModel; - NJobModel *m_jobModel; + JobModel *m_jobModel; QSplitter *m_splitter; JobListWidget *m_jobListWidget; JobPropertiesWidget *m_jobProperties; diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.cpp index 5ba12abbfa6f95cd812df937ff12a09cf6ad21fc..77a94c2f210b3da8489bb814389e77c1e494116c 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.cpp @@ -14,8 +14,7 @@ // ************************************************************************** // #include "ModelTuningWidget.h" -//#include "JobItem.h" -#include "NJobItem.h" +#include "JobItem.h" #include "SliderSettingsWidget.h" #include "ParameterModelBuilder.h" #include "GUIHelpers.h" @@ -76,7 +75,7 @@ ModelTuningWidget::~ModelTuningWidget() } -void ModelTuningWidget::setCurrentItem(NJobItem *item) +void ModelTuningWidget::setCurrentItem(JobItem *item) { qDebug() << "ModelTuningWidget::setCurrentItem" << item; if(m_currentJobItem != item) { diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.h index 6feffcaea261dcf2f6e23d441999b7f0707d6fee..463fb89e6b7eba4e82fc9df32f36a0f368749ab3 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/ModelTuningWidget.h @@ -19,7 +19,7 @@ #include "ItemLink.h" #include <QWidget> -class NJobItem; +class JobItem; class SliderSettingsWidget; class ModelTuningDelegate; class JobQueueData; @@ -38,7 +38,7 @@ public: ModelTuningWidget(JobQueueData *jobQueueData, QWidget *parent = 0); virtual ~ModelTuningWidget(); - void setCurrentItem(NJobItem *item); + void setCurrentItem(JobItem *item); public slots: void onCurrentLinkChanged(ItemLink link); @@ -50,7 +50,7 @@ private: void backupModels(); JobQueueData *m_jobQueueData; - NJobItem *m_currentJobItem; + JobItem *m_currentJobItem; SliderSettingsWidget *m_sliderSettingsWidget; QTreeView *m_treeView; QStandardItemModel *m_parameterModel; diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.cpp index ffae95049359fee38daa0ee1fe786c43537e46cf..4e59b0a298ed7e380c587fc47cb684c4a6f53cf7 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.cpp +++ b/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.cpp @@ -14,7 +14,7 @@ // ************************************************************************** // #include "ColorMapPlot.h" -#include "NIntensityDataItem.h" +#include "IntensityDataItem.h" #include "GUIHelpers.h" #include "Units.h" #include <QDebug> @@ -37,7 +37,7 @@ ColorMapPlot::ColorMapPlot(QWidget *parent) } //! initializes everything with new IntensityDataItem or plot it, if it was already the case -void ColorMapPlot::setItem(NIntensityDataItem *item) +void ColorMapPlot::setItem(IntensityDataItem *item) { if (m_item == item) { //qDebug() << "ColorMapPlot::setItem(NIntensityDataItem *item) item==m_item"; @@ -228,15 +228,15 @@ void ColorMapPlot::onPropertyChanged(const QString &property_name) { if(m_block_update) return; - if(property_name == NIntensityDataItem::P_GRADIENT) { + if(property_name == IntensityDataItem::P_GRADIENT) { m_colorMap->setGradient(m_gradient_map[m_item->getGradient()]); m_customPlot->replot(); - } else if(property_name == NIntensityDataItem::P_IS_LOGZ) { + } else if(property_name == IntensityDataItem::P_IS_LOGZ) { setLogz(m_item->isLogz()); - } else if(property_name == NIntensityDataItem::P_IS_INTERPOLATED) { + } else if(property_name == IntensityDataItem::P_IS_INTERPOLATED) { m_colorMap->setInterpolate(m_item->isInterpolated()); m_customPlot->replot(); - } else if(property_name == NIntensityDataItem::P_ZAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_ZAXIS_MIN) { QCPRange range = m_colorMap->dataRange(); double zmin = m_item->getZaxisMin(); if(zmin != range.lower) { @@ -244,7 +244,7 @@ void ColorMapPlot::onPropertyChanged(const QString &property_name) m_colorMap->setDataRange(range); m_customPlot->replot(); } - } else if(property_name == NIntensityDataItem::P_ZAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_ZAXIS_MAX) { QCPRange range = m_colorMap->dataRange(); double zmax = m_item->getZaxisMax(); if(zmax != range.upper) { @@ -252,8 +252,8 @@ void ColorMapPlot::onPropertyChanged(const QString &property_name) m_colorMap->setDataRange(range); m_customPlot->replot(); } - } else if(property_name == NIntensityDataItem::P_PROJECTIONS_FLAG) { - showLinesOverTheMap(m_item->getRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + } else if(property_name == IntensityDataItem::P_PROJECTIONS_FLAG) { + showLinesOverTheMap(m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); } } @@ -325,7 +325,7 @@ void ColorMapPlot::initColorMap() } //! plot IntensityDataItem -void ColorMapPlot::plotItem(NIntensityDataItem *intensityItem) +void ColorMapPlot::plotItem(IntensityDataItem *intensityItem) { m_block_update = true; Q_ASSERT(intensityItem == m_item); @@ -385,7 +385,7 @@ void ColorMapPlot::plotItem(NIntensityDataItem *intensityItem) } //! calculate zmin, zmax for nicely looking linear, and logariphic z-axis -QCPRange ColorMapPlot::calculateDataRange(NIntensityDataItem *intensityItem) +QCPRange ColorMapPlot::calculateDataRange(IntensityDataItem *intensityItem) { const OutputData<double> *data = intensityItem->getOutputData(); OutputData<double>::const_iterator it_max = std::max_element(data->begin(), data->end()); diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.h b/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.h index f6f2ab68e0a9b5abec166950ebdf29572455bc43..b1def2d15a614bbe30ae7eb214483c8ba3607204 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.h +++ b/GUI/coregui/Views/Components/OutputDataWidgets/ColorMapPlot.h @@ -22,7 +22,7 @@ #include <QMap> #include <QPoint> -class NIntensityDataItem; +class IntensityDataItem; class QCustomPlot; class QCPColorMap; class QCPColorScale; @@ -37,7 +37,7 @@ public: QSize sizeHint() const { return QSize(500, 400); } QSize minimumSizeHint() const { return QSize(128, 128); } - void setItem(NIntensityDataItem *item); + void setItem(IntensityDataItem *item); QString getStatusString(); @@ -86,14 +86,14 @@ private: }; void initColorMap(); - void plotItem(NIntensityDataItem *intensityItem); - QCPRange calculateDataRange(NIntensityDataItem *intensityItem); + void plotItem(IntensityDataItem *intensityItem); + QCPRange calculateDataRange(IntensityDataItem *intensityItem); QCustomPlot *m_customPlot; QCPColorMap *m_colorMap; QCPColorScale *m_colorScale; - NIntensityDataItem *m_item; + IntensityDataItem *m_item; QMap<QString, QCPColorGradient > m_gradient_map; bool m_block_update; diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.cpp index 671a35932ab7b5ea983318290577a9c468c37519..d6f6a785eda41541a76241515ba2b8992325f40f 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.cpp +++ b/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.cpp @@ -14,7 +14,7 @@ // ************************************************************************** // #include "HorizontalSlicePlot.h" -#include "NIntensityDataItem.h" +#include "IntensityDataItem.h" #include "qcustomplot.h" #include "Units.h" #include <QVBoxLayout> @@ -37,7 +37,7 @@ HorizontalSlicePlot::HorizontalSlicePlot(QWidget *parent) } -void HorizontalSlicePlot::setItem(NIntensityDataItem *item) +void HorizontalSlicePlot::setItem(IntensityDataItem *item) { if (m_item == item) return; @@ -68,24 +68,24 @@ void HorizontalSlicePlot::onPropertyChanged(const QString &property_name) { //qDebug() << "NHistogramPlot::onPropertyChanged(const QString &property_name)"; - if(property_name == NIntensityDataItem::P_IS_LOGZ) { + if(property_name == IntensityDataItem::P_IS_LOGZ) { setLogz(m_item->isLogz(), true); - } else if(property_name == NIntensityDataItem::P_XAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_XAXIS_MIN) { setXmin(m_item->getXaxisMin()); - } else if(property_name == NIntensityDataItem::P_XAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_XAXIS_MAX) { setXmax(m_item->getXaxisMax()); - } else if(property_name == NIntensityDataItem::P_YAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_YAXIS_MIN) { setYmin(m_item->getYaxisMin()); - } else if(property_name == NIntensityDataItem::P_YAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_YAXIS_MAX) { setYmax(m_item->getYaxisMax()); - } else if(property_name == NIntensityDataItem::P_ZAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_ZAXIS_MIN) { setZmin(m_item->getZaxisMin()); - } else if(property_name == NIntensityDataItem::P_ZAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_ZAXIS_MAX) { setZmax(m_item->getZaxisMax()); } } -void HorizontalSlicePlot::plotItem(NIntensityDataItem *intensityItem) +void HorizontalSlicePlot::plotItem(IntensityDataItem *intensityItem) { //qDebug() << "NHistogramPlot::plotItem(NIntensityDataItem *intensityItem)"; Q_ASSERT(intensityItem); diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.h b/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.h index edc95265ae8d16f2b9efad0c2db5c6a9659ea93c..c25164af4d3a1fad0aee9a0a07e8f2f2f3523ae0 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.h +++ b/GUI/coregui/Views/Components/OutputDataWidgets/HorizontalSlicePlot.h @@ -18,7 +18,7 @@ #include "WinDllMacros.h" #include <QWidget> -class NIntensityDataItem; +class IntensityDataItem; class QCustomPlot; class QCPBars; @@ -33,7 +33,7 @@ public: QSize sizeHint() const { return QSize(128, 128); } QSize minimumSizeHint() const { return QSize(64, 64); } - void setItem(NIntensityDataItem *item); + void setItem(IntensityDataItem *item); public slots: void plotData(const QVector<double> &x, const QVector<double> &y); @@ -42,7 +42,7 @@ private slots: void onPropertyChanged(const QString &property_name); private: - void plotItem(NIntensityDataItem *intensityItem); + void plotItem(IntensityDataItem *intensityItem); void setLogz(bool logz, bool isReplot = false); void setXmin(double value); void setXmax(double value); @@ -53,7 +53,7 @@ private: QCustomPlot *m_customPlot; QCPBars *m_bars; - NIntensityDataItem *m_item; + IntensityDataItem *m_item; }; #endif diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.cpp index 5b274e71a2c82a98032e9cd0ff0605add2f43800..922421750255b07557017b7aeea077c9e91eed3f 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.cpp +++ b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.cpp @@ -17,7 +17,7 @@ #include "ColorMapPlot.h" #include "HorizontalSlicePlot.h" #include "VerticalSlicePlot.h" -#include "NIntensityDataItem.h" +#include "IntensityDataItem.h" #include "qcustomplot.h" #include <QSplitter> #include <QVBoxLayout> @@ -80,7 +80,7 @@ IntensityDataPlotWidget::IntensityDataPlotWidget(QWidget *parent) } //! initializes the class with NIntensityDataItem -void IntensityDataPlotWidget::setItem(NIntensityDataItem *item) +void IntensityDataPlotWidget::setItem(IntensityDataItem *item) { //qDebug() << "IntensityDataPlotWidget::setItem(NIntensityDataItem *item)"; @@ -164,7 +164,7 @@ void IntensityDataPlotWidget::savePlot(const QString &dirname) //qDebug() << "IntensityDataPlotWidget::savePlot(const QString &dirname)" << dirname; Q_ASSERT(m_item); - bool projections_flag = m_item->getRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG).toBool(); + bool projections_flag = m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool(); if(projections_flag) m_centralPlot->showLinesOverTheMap(false); @@ -198,8 +198,8 @@ void IntensityDataPlotWidget::savePlot(const QString &dirname) void IntensityDataPlotWidget::onPropertyChanged(const QString &property_name) { //qDebug() << "IntensityDataPlotWidget::onPropertyChanged(const QString &property_name)" << property_name; - if(property_name == NIntensityDataItem::P_PROJECTIONS_FLAG) { - showProjections(m_item->getRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + if(property_name == IntensityDataItem::P_PROJECTIONS_FLAG) { + showProjections(m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); } } @@ -231,13 +231,13 @@ void IntensityDataPlotWidget::showProjections(bool flag) void IntensityDataPlotWidget::onPropertyPanelAction(bool flag) { Q_ASSERT(m_item); - m_item->setRegisteredProperty(NIntensityDataItem::P_PROPERTY_PANEL_FLAG, flag); + m_item->setRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG, flag); } void IntensityDataPlotWidget::onProjectionsAction(bool flag) { Q_ASSERT(m_item); - m_item->setRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG, flag); + m_item->setRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG, flag); } @@ -246,8 +246,8 @@ void IntensityDataPlotWidget::showContextMenu(const QPoint &point) Q_ASSERT(m_item); QMenu menu; - m_propertyPanelAction->setChecked(m_item->getRegisteredProperty(NIntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); - m_projectionsAction->setChecked(m_item->getRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + m_propertyPanelAction->setChecked(m_item->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); + m_projectionsAction->setChecked(m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); menu.addAction(m_propertyPanelAction); menu.addAction(m_projectionsAction); @@ -281,9 +281,9 @@ void IntensityDataPlotWidget::setupContextMenuActions() } -void IntensityDataPlotWidget::updateItem(NIntensityDataItem *item) +void IntensityDataPlotWidget::updateItem(IntensityDataItem *item) { - showProjections(item->getRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + showProjections(item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); } //! sets sizes of top and bottom splitters to have correct sizes of vertical histogram (on the left) and color map diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.h b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.h index e9862bef637139291d023ed5be8aefeb3638059f..141447e5b08d56c8616e4daab2ceed336d8bb968 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.h +++ b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPlotWidget.h @@ -24,7 +24,7 @@ class HorizontalSlicePlot; class VerticalSlicePlot; class ColorMapPlot; class QLabel; -class NIntensityDataItem; +class IntensityDataItem; //! The widget contains IntensityDataItem color map, two projections and all //! logic. Belongs to IntensityDataWidget. @@ -37,7 +37,7 @@ public: QSize sizeHint() const { return QSize(800, 800); } QSize minimumSizeHint() const { return QSize(512, 512); } - void setItem(NIntensityDataItem *item); + void setItem(IntensityDataItem *item); signals: void savePlotRequest(); @@ -59,7 +59,7 @@ private slots: private: void setupContextMenuActions(); - void updateItem(NIntensityDataItem *item); + void updateItem(IntensityDataItem *item); void initLeftRightAreaSize(int left_size, int right_size); void initTopBottomAreaSize(int bottom_size, int top_size); bool isBottomAreaVisible(); @@ -78,7 +78,7 @@ private: QLabel *m_statusLabel; int m_leftHistogramArea; int m_bottomHistogramArea; - NIntensityDataItem *m_item; + IntensityDataItem *m_item; }; #endif diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.cpp index e426e5aeafcdde5f29525780d5a4b77d2487467d..9a0cfa8679630e552d6f7b3cd47cf126cab6f627 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.cpp +++ b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.cpp @@ -15,8 +15,8 @@ #include "IntensityDataPropertyWidget.h" #include "UniversalPropertyEditor.h" -#include "NJobModel.h" -#include "NIntensityDataItem.h" +#include "JobModel.h" +#include "IntensityDataItem.h" #include <QVBoxLayout> #include <QDebug> @@ -42,27 +42,27 @@ IntensityDataPropertyWidget::IntensityDataPropertyWidget(QWidget *parent) setLayout(mainLayout); } -void IntensityDataPropertyWidget::setModel(NJobModel *model) +void IntensityDataPropertyWidget::setModel(JobModel *model) { Q_ASSERT(model); if(model != m_jobModel) { if(m_jobModel) disconnect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); m_jobModel = model; connect(m_jobModel, - SIGNAL( selectionChanged(NJobItem *) ), + SIGNAL( selectionChanged(JobItem *) ), this, - SLOT( setItem(NJobItem *) ) + SLOT( setItem(JobItem *) ) ); } } -void IntensityDataPropertyWidget::setItem(NIntensityDataItem *jobItem) +void IntensityDataPropertyWidget::setItem(IntensityDataItem *jobItem) { m_propertyEditor->setItem(jobItem); } diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.h b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.h index 2512fc63dc56eb868aa50201c5a0f4bf2008b212..6e40d147029a125882011efe378ef08193a59262 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.h +++ b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataPropertyWidget.h @@ -19,8 +19,8 @@ #include "WinDllMacros.h" #include <QWidget> -class NJobModel; -class NIntensityDataItem; +class JobModel; +class IntensityDataItem; class UniversalPropertyEditor; //! Widget to show and change properties of currently selected JobItem @@ -31,17 +31,17 @@ class BA_CORE_API_ IntensityDataPropertyWidget : public QWidget public: explicit IntensityDataPropertyWidget(QWidget *parent = 0); - void setModel(NJobModel *model); + void setModel(JobModel *model); QSize sizeHint() const { return QSize(230, 256); } QSize minimumSizeHint() const { return QSize(230, 64); } public slots: - void setItem(NIntensityDataItem *item); + void setItem(IntensityDataItem *item); private: - NJobModel *m_jobModel; - NIntensityDataItem *m_currentItem; + JobModel *m_jobModel; + IntensityDataItem *m_currentItem; UniversalPropertyEditor *m_propertyEditor; }; diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.cpp index 00d641698f635264b52e2c5a2b8976df19cd5759..1873c6a0f9cdd7510f25a68db2c50351a9239e7b 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.cpp +++ b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.cpp @@ -16,7 +16,7 @@ #include "IntensityDataWidget.h" #include "IntensityDataPlotWidget.h" #include "IntensityDataPropertyWidget.h" -#include "NIntensityDataItem.h" +#include "IntensityDataItem.h" #include <QVBoxLayout> #include <QDebug> @@ -52,7 +52,7 @@ IntensityDataWidget::IntensityDataWidget(QWidget *parent) setLayout(mainLayout); } -void IntensityDataWidget::setItem(NIntensityDataItem *item) +void IntensityDataWidget::setItem(IntensityDataItem *item) { m_plotWidget->setItem(item); m_propertyWidget->setItem(item); @@ -77,8 +77,8 @@ void IntensityDataWidget::setItem(NIntensityDataItem *item) void IntensityDataWidget::togglePropertyPanel() { if(m_currentItem) { - bool current_flag = m_currentItem->getRegisteredProperty(NIntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool(); - m_currentItem->setRegisteredProperty(NIntensityDataItem::P_PROPERTY_PANEL_FLAG, !current_flag); + bool current_flag = m_currentItem->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool(); + m_currentItem->setRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG, !current_flag); } } @@ -94,21 +94,21 @@ void IntensityDataWidget::setPropertyPanelVisible(bool visible) void IntensityDataWidget::onPropertyChanged(const QString &property_name) { - if(property_name == NIntensityDataItem::P_PROPERTY_PANEL_FLAG) { - setPropertyPanelVisible(m_currentItem->getRegisteredProperty(NIntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); + if(property_name == IntensityDataItem::P_PROPERTY_PANEL_FLAG) { + setPropertyPanelVisible(m_currentItem->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); } } -void IntensityDataWidget::updateItem(NIntensityDataItem *item) +void IntensityDataWidget::updateItem(IntensityDataItem *item) { - setPropertyPanelVisible(item->getRegisteredProperty(NIntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); + setPropertyPanelVisible(item->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); } void IntensityDataWidget::toggleProjections() { if(m_currentItem) { - bool current_flag = m_currentItem->getRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG).toBool(); - m_currentItem->setRegisteredProperty(NIntensityDataItem::P_PROJECTIONS_FLAG, !current_flag); + bool current_flag = m_currentItem->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool(); + m_currentItem->setRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG, !current_flag); } } diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.h b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.h index af0d198536b8c6f532546cb245c771a4ef77f57e..39f67d4f9037f08f9110c3db50357902f6c87231 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.h +++ b/GUI/coregui/Views/Components/OutputDataWidgets/IntensityDataWidget.h @@ -20,7 +20,7 @@ #include <QWidget> class IntensityDataPropertyWidget; -class NIntensityDataItem; +class IntensityDataItem; class IntensityDataPlotWidget; //! The widget presents IntensityData color map and property editor. @@ -31,7 +31,7 @@ class BA_CORE_API_ IntensityDataWidget : public QWidget public: explicit IntensityDataWidget(QWidget *parent = 0); - void setItem(NIntensityDataItem *item); + void setItem(IntensityDataItem *item); QSize sizeHint() const { return QSize(500, 400); } QSize minimumSizeHint() const { return QSize(128, 128); } @@ -50,11 +50,11 @@ private slots: void onPropertyChanged(const QString &property_name); private: - void updateItem(NIntensityDataItem *item); + void updateItem(IntensityDataItem *item); IntensityDataPlotWidget *m_plotWidget; IntensityDataPropertyWidget *m_propertyWidget; - NIntensityDataItem *m_currentItem; + IntensityDataItem *m_currentItem; }; diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.cpp index 4531137fcff5102773603925f21f60fd793a2208..5e65bdee48308a852c9ab29e71bcfeca531c27b7 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.cpp +++ b/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.cpp @@ -14,7 +14,7 @@ // ************************************************************************** // #include "VerticalSlicePlot.h" -#include "NIntensityDataItem.h" +#include "IntensityDataItem.h" #include "qcustomplot.h" #include "Units.h" #include <QVBoxLayout> @@ -37,7 +37,7 @@ VerticalSlicePlot::VerticalSlicePlot(QWidget *parent) } -void VerticalSlicePlot::setItem(NIntensityDataItem *item) +void VerticalSlicePlot::setItem(IntensityDataItem *item) { if (m_item == item) return; @@ -68,24 +68,24 @@ void VerticalSlicePlot::onPropertyChanged(const QString &property_name) { //qDebug() << "NHistogramPlot::onPropertyChanged(const QString &property_name)"; - if(property_name == NIntensityDataItem::P_IS_LOGZ) { + if(property_name == IntensityDataItem::P_IS_LOGZ) { setLogz(m_item->isLogz(), true); - } else if(property_name == NIntensityDataItem::P_XAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_XAXIS_MIN) { setXmin(m_item->getXaxisMin()); - } else if(property_name == NIntensityDataItem::P_XAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_XAXIS_MAX) { setXmax(m_item->getXaxisMax()); - } else if(property_name == NIntensityDataItem::P_YAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_YAXIS_MIN) { setYmin(m_item->getYaxisMin()); - } else if(property_name == NIntensityDataItem::P_YAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_YAXIS_MAX) { setYmax(m_item->getYaxisMax()); - } else if(property_name == NIntensityDataItem::P_ZAXIS_MIN) { + } else if(property_name == IntensityDataItem::P_ZAXIS_MIN) { setZmin(m_item->getZaxisMin()); - } else if(property_name == NIntensityDataItem::P_ZAXIS_MAX) { + } else if(property_name == IntensityDataItem::P_ZAXIS_MAX) { setZmax(m_item->getZaxisMax()); } } -void VerticalSlicePlot::plotItem(NIntensityDataItem *intensityItem) +void VerticalSlicePlot::plotItem(IntensityDataItem *intensityItem) { //qDebug() << "NHistogramPlot::plotItem(NIntensityDataItem *intensityItem)"; Q_ASSERT(intensityItem); diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.h b/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.h index a7efb28442552fbf3653f8fb63ab81ab1703fe4e..7c4a57268d453d6d8c490f4712b795af1478329f 100644 --- a/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.h +++ b/GUI/coregui/Views/Components/OutputDataWidgets/VerticalSlicePlot.h @@ -18,7 +18,7 @@ #include "WinDllMacros.h" #include <QWidget> -class NIntensityDataItem; +class IntensityDataItem; class QCustomPlot; class QCPBars; @@ -32,7 +32,7 @@ public: QSize sizeHint() const { return QSize(128, 128); } QSize minimumSizeHint() const { return QSize(64, 64); } - void setItem(NIntensityDataItem *item); + void setItem(IntensityDataItem *item); public slots: void plotData(const QVector<double> &x, const QVector<double> &y); @@ -41,7 +41,7 @@ private slots: void onPropertyChanged(const QString &property_name); private: - void plotItem(NIntensityDataItem *intensityItem); + void plotItem(IntensityDataItem *intensityItem); void setLogz(bool logz, bool isReplot = false); void setXmin(double value); void setXmax(double value); @@ -52,7 +52,7 @@ private: QCustomPlot *m_customPlot; QCPBars *m_bars; - NIntensityDataItem *m_item; + IntensityDataItem *m_item; }; diff --git a/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.cpp b/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.cpp index d3462afe17aee38be248ff956c4db01096724155..db09ba191f54a961844fc96502b1ec26b568369d 100644 --- a/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.cpp +++ b/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.cpp @@ -17,11 +17,10 @@ #include "Simulation.h" #include "mainwindow.h" #include "PythonScriptSampleBuilder.h" -//#include "JobQueueModel.h" -#include "NJobModel.h" +#include "JobModel.h" #include "SampleModel.h" #include "InstrumentModel.h" -#include "NJobItem.h" +#include "JobItem.h" #include "SampleValidator.h" #include "Utils.h" #include <QGroupBox> @@ -67,9 +66,9 @@ SimulationSetupWidget::SimulationSetupWidget(QWidget *parent) runPolicyLabel->setToolTip("Defines run policy for the simulation"); runPolicySelectionBox = new QComboBox; runPolicySelectionBox->setToolTip("Defines run policy for the simulation"); - runPolicySelectionBox->addItems(NJobItem::getRunPolicies().keys()); + runPolicySelectionBox->addItems(JobItem::getRunPolicies().keys()); int index(0); - foreach(QString descr, NJobItem::getRunPolicies().values()) + foreach(QString descr, JobItem::getRunPolicies().values()) runPolicySelectionBox->setItemData(index++, descr, Qt::ToolTipRole); // selection of number of threads @@ -126,7 +125,7 @@ SimulationSetupWidget::SimulationSetupWidget(QWidget *parent) // m_jobQueueModel = model; // } //} -void SimulationSetupWidget::setJobModel(NJobModel *model) +void SimulationSetupWidget::setJobModel(JobModel *model) { Q_ASSERT(model); if(model != m_jobModel) { diff --git a/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.h b/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.h index df330a5e2086e778cb8682161b0c5845fe53ff69..67569c99d2562e48c3888d4c04125684c285df1e 100644 --- a/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.h +++ b/GUI/coregui/Views/Components/SimulationWidgets/SimulationSetupWidget.h @@ -25,7 +25,7 @@ class QPushButton; //class JobQueueModel; class SampleModel; class InstrumentModel; -class NJobModel; +class JobModel; class BA_CORE_API_ SimulationSetupWidget : public QWidget { @@ -35,7 +35,7 @@ public: SimulationSetupWidget(QWidget *parent = 0); void updateViewElements(); // void setJobQueueModel(JobQueueModel *model); - void setJobModel(NJobModel *model); + void setJobModel(JobModel *model); void setSampleModel(SampleModel *model); void setInstrumentModel(InstrumentModel *model); @@ -55,7 +55,7 @@ private: SampleModel *getJobSampleModel(); // JobQueueModel *m_jobQueueModel; - NJobModel *m_jobModel; + JobModel *m_jobModel; SampleModel *m_sampleModel; InstrumentModel *m_instrumentModel; QComboBox *instrumentSelectionBox; diff --git a/GUI/coregui/Views/JobView.cpp b/GUI/coregui/Views/JobView.cpp index 4c8ad158551304dbca41cb118a5ddca59ebbbc2c..9f056e8bedf6220c52d5171cc7a68892aa31731c 100644 --- a/GUI/coregui/Views/JobView.cpp +++ b/GUI/coregui/Views/JobView.cpp @@ -17,8 +17,7 @@ #include "TestView.h" #include "JobSelectorWidget.h" #include "JobOutputDataWidget.h" -//#include "JobQueueModel.h" -#include "NJobModel.h" +#include "JobModel.h" #include "JobRealTimeWidget.h" #include "projectmanager.h" #include "mainwindow.h" @@ -30,11 +29,11 @@ struct JobViewPrivate { - JobViewPrivate(NJobModel *jobModel, ProjectManager *projectManager); + JobViewPrivate(JobModel *jobModel, ProjectManager *projectManager); QWidget *m_subWindows[JobView::NUMBER_OF_DOCKS]; QDockWidget *m_dockWidgets[JobView::NUMBER_OF_DOCKS]; // JobQueueModel *m_jobQueueModel; - NJobModel *m_jobModel; + JobModel *m_jobModel; JobSelectorWidget *m_jobSelector; JobOutputDataWidget *m_jobOutputDataWidget; JobRealTimeWidget *m_jobRealTimeWidget; @@ -43,7 +42,7 @@ struct JobViewPrivate }; -JobViewPrivate::JobViewPrivate(NJobModel *jobModel, ProjectManager *projectManager) +JobViewPrivate::JobViewPrivate(JobModel *jobModel, ProjectManager *projectManager) : m_jobModel(jobModel) , m_jobSelector(0) , m_jobOutputDataWidget(0) @@ -57,7 +56,7 @@ JobViewPrivate::JobViewPrivate(NJobModel *jobModel, ProjectManager *projectManag } -JobView::JobView(NJobModel *jobModel, ProjectManager *projectManager, QWidget *parent) +JobView::JobView(JobModel *jobModel, ProjectManager *projectManager, QWidget *parent) : Manhattan::FancyMainWindow(parent) , m_d(new JobViewPrivate(jobModel, projectManager)) { @@ -119,7 +118,7 @@ void JobView::updateGlobalProgressBar(int progress) } -void JobView::onFocusRequest(NJobItem *item) +void JobView::onFocusRequest(JobItem *item) { m_d->m_jobSelector->makeJobItemSelected(item); emit focusRequest(MainWindow::JOB); @@ -182,7 +181,7 @@ void JobView::connectSignals() { connect(this, SIGNAL(resetLayout()), this, SLOT(resetToDefaultLayout())); connect(m_d->m_jobModel, SIGNAL(globalProgress(int)), this, SLOT(updateGlobalProgressBar(int))); - connect(m_d->m_jobModel, SIGNAL(focusRequest(NJobItem*)), this, SLOT(onFocusRequest(NJobItem*))); + connect(m_d->m_jobModel, SIGNAL(focusRequest(JobItem*)), this, SLOT(onFocusRequest(JobItem*))); connect(m_d->m_jobOutputDataWidget, SIGNAL(jobViewActivityRequest(int)), this, SLOT(setActivity(int))); connect(this, SIGNAL(activityChanged(int)), m_d->m_jobOutputDataWidget, SLOT(onActivityChanged(int))); } diff --git a/GUI/coregui/Views/JobView.h b/GUI/coregui/Views/JobView.h index b4d2056ba3629e72912781832753f48273473663..22f527117774ee9f3892d90848c4aa056cd74a76 100644 --- a/GUI/coregui/Views/JobView.h +++ b/GUI/coregui/Views/JobView.h @@ -21,8 +21,8 @@ struct JobViewPrivate; //class JobQueueModel; -class NJobModel; -class NJobItem; +class JobModel; +class JobItem; class ProjectManager; namespace Manhattan { @@ -41,7 +41,7 @@ public: enum EActivities { JOB_VIEW_ACTIVITY, REAL_TIME_ACTIVITY }; // JobView(JobQueueModel *jobQueueModel, ProjectManager *projectManager, QWidget *parent = 0); - JobView(NJobModel *jobModel, ProjectManager *projectManager, QWidget *parent = 0); + JobView(JobModel *jobModel, ProjectManager *projectManager, QWidget *parent = 0); virtual ~JobView(); void setProgressBar(Manhattan::ProgressBar *progressBar); @@ -52,7 +52,7 @@ signals: public slots: void updateGlobalProgressBar(int); - void onFocusRequest(NJobItem *); + void onFocusRequest(JobItem *); void resetToDefaultLayout(); void setActivity(int activity); diff --git a/GUI/coregui/Views/SimulationView.cpp b/GUI/coregui/Views/SimulationView.cpp index 43f138a9ad66215f21e9389508a676b47c2949fd..933abc2669ecc404bcce3ca0c59084b85bb66993 100644 --- a/GUI/coregui/Views/SimulationView.cpp +++ b/GUI/coregui/Views/SimulationView.cpp @@ -18,7 +18,6 @@ #include "styledtoolbar.h" #include "SampleModel.h" #include "InstrumentModel.h" -#include "JobQueueModel.h" #include "mainwindow.h" #include <QTabWidget> #include <QVBoxLayout> diff --git a/GUI/coregui/Views/SimulationView.h b/GUI/coregui/Views/SimulationView.h index b7c6c07c8b96950d47d7bbf5b45ec27f2597b12a..294d247fae3a805eeb1dad5f9aa03f24872e9c18 100644 --- a/GUI/coregui/Views/SimulationView.h +++ b/GUI/coregui/Views/SimulationView.h @@ -25,7 +25,7 @@ class SampleModel; class InstrumentModel; class SimulationSetupWidget; class StyledToolBar; -class NJobModel; +class JobModel; class BA_CORE_API_ SimulationView : public QWidget { @@ -42,7 +42,7 @@ public slots: private: // JobQueueModel *m_jobQueueModel; - NJobModel *m_jobModel; + JobModel *m_jobModel; SampleModel *m_sampleModel; InstrumentModel *m_instrumentModel; diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 11bf7fdc3cb275fe4fcc933d27d9a1ebb0e70ae2..f3b59370eb509179f78062c902bf6af73af35c86 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -25,7 +25,7 @@ #include "MaterialEditorWidget.h" #include "stylehelper.h" //#include "JobQueueModel.h" -#include "NJobModel.h" +#include "JobModel.h" #include "MaterialModel.h" #include "InstrumentModel.h" #include "MaterialEditor.h" @@ -305,7 +305,7 @@ void MainWindow::initJobQueueModel() // m_jobQueueModel = new JobQueueModel(this); delete m_jobModel; - m_jobModel = new NJobModel(this); + m_jobModel = new JobModel(this); // ParameterizedItem *jobItem = m_jobModel->insertNewItem(Constants::JobItemType); // m_jobModel->insertNewItem(Constants::IntensityDataType, m_jobModel->indexOfItem(jobItem)); // m_jobModel->save("jobmodel.txt"); diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index b770a8ccb615b7048b2935117f3dcce38944dd38..b9205ab13c153ba6bba1be8da6a5364c98ff65e3 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -46,7 +46,7 @@ class MaterialModel; class SampleModel; class FitProxyModel; class FitView; -class NJobModel; +class JobModel; class BA_CORE_API_ MainWindow : public Manhattan::FancyMainWindow @@ -63,7 +63,7 @@ public: InstrumentModel *getInstrumentModel() { return m_instrumentModel; } SampleModel *getSampleModel() { return m_sampleModel; } // JobQueueModel *getJobQueueModel() { return m_jobQueueModel; } - NJobModel *getJobModel() { return m_jobModel; } + JobModel *getJobModel() { return m_jobModel; } Manhattan::ProgressBar *getProgressBar() { return m_progressBar; } QSettings *getSettings() const { return m_settings; } ActionManager *getActionManager() { return m_actionManager; } @@ -99,7 +99,7 @@ private: QSettings *m_settings; //!< application wide settings // JobQueueModel *m_jobQueueModel; //!< model for all jobs - NJobModel *m_jobModel; //!< model for all jobs + JobModel *m_jobModel; //!< model for all jobs SampleModel *m_sampleModel; //!< model for all samples InstrumentModel *m_instrumentModel; //!< model for all instruments MaterialModel *m_materialModel; //!< model for all materials diff --git a/GUI/coregui/mainwindow/projectdocument.cpp b/GUI/coregui/mainwindow/projectdocument.cpp index 6bcb7557066cb4bcf23797d671bdd5ff15e04ca2..1f376783ec6e65c389fc7c710d7771b052d071f2 100644 --- a/GUI/coregui/mainwindow/projectdocument.cpp +++ b/GUI/coregui/mainwindow/projectdocument.cpp @@ -19,9 +19,9 @@ //#include "JobQueueModel.h" //#include "JobItem.h" //#include "OutputDataItem.h" -#include "NJobModel.h" -#include "NJobItem.h" -#include "NIntensityDataItem.h" +#include "JobModel.h" +#include "JobItem.h" +#include "IntensityDataItem.h" #include "SampleModel.h" #include "IntensityDataIOFactory.h" #include <QFile> @@ -130,7 +130,7 @@ void ProjectDocument::setSampleModel(SampleModel *model) } -void ProjectDocument::setJobModel(NJobModel *model) +void ProjectDocument::setJobModel(JobModel *model) { if(model != m_jobModel) { if(m_jobModel) { @@ -323,8 +323,8 @@ void ProjectDocument::saveOutputData() // } // } for(int i=0; i<m_jobModel->rowCount(QModelIndex()); ++i) { - NJobItem *jobItem = m_jobModel->getJobItemForIndex(m_jobModel->index(i,0, QModelIndex())); - NIntensityDataItem *dataItem = jobItem->getIntensityDataItem(); + JobItem *jobItem = m_jobModel->getJobItemForIndex(m_jobModel->index(i,0, QModelIndex())); + IntensityDataItem *dataItem = jobItem->getIntensityDataItem(); if(dataItem) { QString filename = getProjectDir() + "/" + dataItem->itemName(); const OutputData<double> *data = dataItem->getOutputData(); @@ -354,8 +354,8 @@ void ProjectDocument::loadOutputData() // } // } for(int i=0; i<m_jobModel->rowCount(QModelIndex()); ++i) { - NJobItem *jobItem = m_jobModel->getJobItemForIndex(m_jobModel->index(i,0, QModelIndex())); - NIntensityDataItem *dataItem = jobItem->getIntensityDataItem(); + JobItem *jobItem = m_jobModel->getJobItemForIndex(m_jobModel->index(i,0, QModelIndex())); + IntensityDataItem *dataItem = jobItem->getIntensityDataItem(); if(dataItem) { QString filename = getProjectDir() + "/" + dataItem->itemName(); QFileInfo info(filename); diff --git a/GUI/coregui/mainwindow/projectdocument.h b/GUI/coregui/mainwindow/projectdocument.h index 803a04a6c7548c877cf085551f8a3d9af1b859ba..a0a67ad484946c20818f37b06d294b0fafeaa24d 100644 --- a/GUI/coregui/mainwindow/projectdocument.h +++ b/GUI/coregui/mainwindow/projectdocument.h @@ -27,7 +27,7 @@ class JobItem; class InstrumentModel; class MaterialModel; class SampleModel; -class NJobModel; +class JobModel; namespace ProjectDocumentXML { @@ -71,7 +71,7 @@ public: void setInstrumentModel(InstrumentModel *model); void setSampleModel(SampleModel *model); // void setJobQueueModel(JobQueueModel *model); - void setJobModel(NJobModel *model); + void setJobModel(JobModel *model); bool hasValidNameAndPath(); @@ -95,7 +95,7 @@ private: InstrumentModel *m_instrumentModel; SampleModel *m_sampleModel; // JobQueueModel *m_jobQueueModel; - NJobModel *m_jobModel; + JobModel *m_jobModel; bool m_modified; };