diff --git a/GUI/coregui/Models/DomainObjectBuilder.cpp b/GUI/coregui/Models/DomainObjectBuilder.cpp index e7708bb957587d41b5dae0495e05bffe34244f5f..08468964764c26ce31c9410471d8d97f67502463 100644 --- a/GUI/coregui/Models/DomainObjectBuilder.cpp +++ b/GUI/coregui/Models/DomainObjectBuilder.cpp @@ -274,10 +274,10 @@ ParticleCoreShell *DomainObjectBuilder::buildParticleCoreShell(const Parameteriz for (int i=0; i<children.size(); ++i) { double tmp_depth(0), tmp_abundance(0); int port = children[i]->getRegisteredProperty(ParameterizedItem::P_PORT).toInt(); - if(port == ParameterizedItem::PortInfo::Port0) { + if(port == ParameterizedItem::PortInfo::PORT_0) { coreParticle = buildParticle(*children[i], tmp_depth, tmp_abundance); } - else if(port == ParameterizedItem::PortInfo::Port1) { + else if(port == ParameterizedItem::PortInfo::PORT_1) { shellParticle = buildParticle(*children[i], tmp_depth, tmp_abundance); } else { diff --git a/GUI/coregui/Models/GUIObjectBuilder.cpp b/GUI/coregui/Models/GUIObjectBuilder.cpp index 1c42f576c5db8583ff5ba198d89fe05157579bee..8de04c501f8f41d66babb17c4892a0a5da1a1ee6 100644 --- a/GUI/coregui/Models/GUIObjectBuilder.cpp +++ b/GUI/coregui/Models/GUIObjectBuilder.cpp @@ -208,7 +208,7 @@ void GUIObjectBuilder::visit(const Particle *sample) if(sample == coreshell->getCoreParticle()) { particleItem = m_sampleModel->insertNewItem(Constants::ParticleType, m_sampleModel->indexOfItem(parent), -1, - ParameterizedItem::PortInfo::Port0); + ParameterizedItem::PortInfo::PORT_0); const Geometry::Transform3D *p_transformation = sample->getPTransform3D(); if (p_transformation) { @@ -222,7 +222,7 @@ void GUIObjectBuilder::visit(const Particle *sample) else if(sample == coreshell->getShellParticle()) { particleItem = m_sampleModel->insertNewItem(Constants::ParticleType, m_sampleModel->indexOfItem(parent), -1, - ParameterizedItem::PortInfo::Port1); + ParameterizedItem::PortInfo::PORT_1); const Geometry::Transform3D *p_transformation = sample->getPTransform3D(); if (p_transformation) { diff --git a/GUI/coregui/Models/InterferenceFunctionItems.cpp b/GUI/coregui/Models/InterferenceFunctionItems.cpp index e6c20434801900d74c6cd2e6b023b05023ce6fc7..4fbd89f50b28f6617427da4bc2b927f96d8c8b03 100644 --- a/GUI/coregui/Models/InterferenceFunctionItems.cpp +++ b/GUI/coregui/Models/InterferenceFunctionItems.cpp @@ -39,7 +39,7 @@ InterferenceFunction1DParaCrystalItem::InterferenceFunction1DParaCrystalItem( parent) { setItemName(Constants::InterferenceFunction1DParaCrystalType); - setItemPort(ParameterizedItem::PortInfo::Port1); + setItemPort(ParameterizedItem::PortInfo::PORT_1); registerProperty(P_PEAK_DISTANCE, 20.0*Units::nanometer); registerProperty(P_DAMPING_LENGTH, 1000.0*Units::micrometer); registerProperty(P_DOMAIN_SIZE, 20.0*Units::micrometer); @@ -54,7 +54,7 @@ InterferenceFunction2DParaCrystalItem::InterferenceFunction2DParaCrystalItem( parent) { setItemName(Constants::InterferenceFunction2DParaCrystalType); - setItemPort(ParameterizedItem::PortInfo::Port1); + setItemPort(ParameterizedItem::PortInfo::PORT_1); registerGroupProperty(P_LATTICE_TYPE, Constants::LatticeGroup); registerProperty(P_DAMPING_LENGTH, 0.0); @@ -87,7 +87,7 @@ InterferenceFunction2DLatticeItem::InterferenceFunction2DLatticeItem( parent) { setItemName(Constants::InterferenceFunction2DLatticeType); - setItemPort(ParameterizedItem::PortInfo::Port1); + setItemPort(ParameterizedItem::PortInfo::PORT_1); registerGroupProperty(P_LATTICE_TYPE, Constants::LatticeGroup); registerProperty(P_ROTATION_ANGLE, 0.0); diff --git a/GUI/coregui/Models/JobItem.h b/GUI/coregui/Models/JobItem.h index 1e57dc79e109b41a340a1e5650d25dabf74b59f6..cc2244bfd04f0c36c790776b0135a2e07550f4dd 100644 --- a/GUI/coregui/Models/JobItem.h +++ b/GUI/coregui/Models/JobItem.h @@ -33,7 +33,8 @@ public: }; JobItem(const QString &name); - JobItem(SampleModel *sampleModel, InstrumentModel *instrumentModel, const QString &run_policy = QString()); + JobItem(SampleModel *sampleModel, InstrumentModel *instrumentModel, + const QString &run_policy = QString()); virtual ~JobItem(); @@ -82,13 +83,30 @@ signals: 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); } + 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); + } private: void clear(); diff --git a/GUI/coregui/Models/LayerItem.cpp b/GUI/coregui/Models/LayerItem.cpp index 233263e95109b5ffb135d6d699eb23844901cee2..f8625a060583e08a7f832368054799a661ad5211 100644 --- a/GUI/coregui/Models/LayerItem.cpp +++ b/GUI/coregui/Models/LayerItem.cpp @@ -29,5 +29,5 @@ LayerItem::LayerItem(ParameterizedItem *parent) registerGroupProperty(P_ROUGHNESS, Constants::LayerRoughnessGroup); setGroupProperty(P_ROUGHNESS, Constants::LayerZeroRoughnessType); - addToValidChildren(Constants::ParticleLayoutType, PortInfo::Port0); + addToValidChildren(Constants::ParticleLayoutType, PortInfo::PORT_0); } diff --git a/GUI/coregui/Models/ParameterizedItem.cpp b/GUI/coregui/Models/ParameterizedItem.cpp index ebd2bdb01e6f33a4b4c65da14e7cb7e1693b1095..45de23c3526c188b96b431e16d539129d4027ef7 100644 --- a/GUI/coregui/Models/ParameterizedItem.cpp +++ b/GUI/coregui/Models/ParameterizedItem.cpp @@ -138,7 +138,7 @@ ParameterizedItem *ParameterizedItem::getCandidateForRemoval(ParameterizedItem * return 0; } -void ParameterizedItem::setItemPort(ParameterizedItem::PortInfo::Keys nport) +void ParameterizedItem::setItemPort(ParameterizedItem::PortInfo::EPorts nport) { setRegisteredProperty(P_PORT, nport); } @@ -163,7 +163,7 @@ void ParameterizedItem::onPropertyItemChanged(const QString & /*propertyName*/) } -void ParameterizedItem::addToValidChildren(const QString &name, PortInfo::Keys nport, int nmax_items) +void ParameterizedItem::addToValidChildren(const QString &name, PortInfo::EPorts nport, int nmax_items) { m_valid_children.append(name); diff --git a/GUI/coregui/Models/ParameterizedItem.h b/GUI/coregui/Models/ParameterizedItem.h index e7a80a5e092fbf511991f4719b39390830ed0b4d..64795b87646175a58b35e9124d8dbd84be874461 100644 --- a/GUI/coregui/Models/ParameterizedItem.h +++ b/GUI/coregui/Models/ParameterizedItem.h @@ -110,13 +110,18 @@ public: class PortInfo { public: - enum Keys { PortDef=-1, Port0=0, Port1=1, Port2=2}; + enum EPorts { + DEFAULT = -1, + PORT_0 = 0, + PORT_1 = 1, + PORT_2 = 2 + }; PortInfo(const QString &name=QString(), int nmax_items=0) : m_item_names(name), m_item_max_number(nmax_items){} QStringList m_item_names; int m_item_max_number; }; - void setItemPort(PortInfo::Keys nport); + void setItemPort(PortInfo::EPorts nport); virtual QString getItemLabel() const { return QString("no label"); } @@ -134,7 +139,7 @@ signals: void propertyItemChanged(const QString &propertyName); protected: - void addToValidChildren(const QString &name, PortInfo::Keys nport = PortInfo::Port0, int nmax_children = 0); + void addToValidChildren(const QString &name, PortInfo::EPorts nport = PortInfo::PORT_0, int nmax_children = 0); void setPropertyAttribute(const QString &name, const PropertyAttribute &attribute); QStringList m_registered_properties; diff --git a/GUI/coregui/Models/ParticleCoreShellItem.cpp b/GUI/coregui/Models/ParticleCoreShellItem.cpp index 8963dac36256f66e63710317307f22f1f1ae898e..9df31938f053faadf34b4824bddedd488b24e154 100644 --- a/GUI/coregui/Models/ParticleCoreShellItem.cpp +++ b/GUI/coregui/Models/ParticleCoreShellItem.cpp @@ -10,14 +10,14 @@ ParticleCoreShellItem::ParticleCoreShellItem(ParameterizedItem *parent) : ParameterizedGraphicsItem(Constants::ParticleCoreShellType, parent) { setItemName(Constants::ParticleCoreShellType); - setItemPort(ParameterizedItem::PortInfo::Port0); + setItemPort(ParameterizedItem::PortInfo::PORT_0); registerProperty(ParticleItem::P_DEPTH, 0.0); registerProperty(ParticleItem::P_ABUNDANCE, 1.0, PropertyAttribute(AttLimits::limited(0.0, 1.0),3)); registerGroupProperty(P_CORE_POS, Constants::VectorType); - addToValidChildren(Constants::ParticleType, PortInfo::Port0, 1); - addToValidChildren(Constants::ParticleType, PortInfo::Port1, 1); + addToValidChildren(Constants::ParticleType, PortInfo::PORT_0, 1); + addToValidChildren(Constants::ParticleType, PortInfo::PORT_1, 1); } void ParticleCoreShellItem::insertChildItem(int row, ParameterizedItem *item) diff --git a/GUI/coregui/Models/ParticleDistributionItem.cpp b/GUI/coregui/Models/ParticleDistributionItem.cpp index b3129eb4c8d4dfd34ca17e762df5ca50cb54a11e..57ebdd8bb98f8661041cf850705d8d09941ae3f8 100644 --- a/GUI/coregui/Models/ParticleDistributionItem.cpp +++ b/GUI/coregui/Models/ParticleDistributionItem.cpp @@ -30,14 +30,14 @@ ParticleDistributionItem::ParticleDistributionItem(ParameterizedItem *parent) : ParameterizedGraphicsItem(Constants::ParticleDistributionType, parent) { setItemName(Constants::ParticleDistributionType); - setItemPort(ParameterizedItem::PortInfo::Port0); + setItemPort(ParameterizedItem::PortInfo::PORT_0); registerGroupProperty(P_DISTRIBUTION, Constants::DistributionGroup); registerProperty(P_SAMPLE_NUMBER, 5); registerProperty(P_SIGMA_FACTOR, 2.0); - addToValidChildren(Constants::ParticleType, PortInfo::Port0); - addToValidChildren(Constants::ParticleCoreShellType, PortInfo::Port0); + addToValidChildren(Constants::ParticleType, PortInfo::PORT_0); + addToValidChildren(Constants::ParticleCoreShellType, PortInfo::PORT_0); registerProperty(P_CACHED_SELECTED_PARAMETER, QString("None"), PropertyAttribute::hiddenProperty()); diff --git a/GUI/coregui/Models/ParticleItem.cpp b/GUI/coregui/Models/ParticleItem.cpp index 2e4735da3bece962af97c674bf20deca6db09181..626146e78bfed4e72a3b24b254d6fdb4821a7a70 100644 --- a/GUI/coregui/Models/ParticleItem.cpp +++ b/GUI/coregui/Models/ParticleItem.cpp @@ -28,7 +28,7 @@ ParticleItem::ParticleItem(ParameterizedItem *parent) : ParameterizedGraphicsItem(Constants::ParticleType, parent) { setItemName(Constants::ParticleType); - setItemPort(ParameterizedItem::PortInfo::Port0); + setItemPort(ParameterizedItem::PortInfo::PORT_0); registerGroupProperty(P_FORM_FACTOR, Constants::FormFactorGroup); registerProperty(P_MATERIAL, MaterialUtils::getDefaultMaterialProperty().getVariant()); @@ -36,7 +36,7 @@ ParticleItem::ParticleItem(ParameterizedItem *parent) registerProperty(P_ABUNDANCE, 1.0, PropertyAttribute(AttLimits::limited(0.0, 1.0),3)); - addToValidChildren(Constants::TransformationType, PortInfo::Port0, 1); + addToValidChildren(Constants::TransformationType, PortInfo::PORT_0, 1); setPropertyAppearance(ParameterizedItem::P_NAME, PropertyAttribute::VisibleProperty); diff --git a/GUI/coregui/Models/ParticleLayoutItem.cpp b/GUI/coregui/Models/ParticleLayoutItem.cpp index ab8cc01fca3233eb2b77fb05f3a5c598344af2ef..ec3d5ccaa1afc23820065011d7eec8ab1c0c3aa0 100644 --- a/GUI/coregui/Models/ParticleLayoutItem.cpp +++ b/GUI/coregui/Models/ParticleLayoutItem.cpp @@ -24,18 +24,18 @@ ParticleLayoutItem::ParticleLayoutItem(ParameterizedItem *parent) : ParameterizedGraphicsItem(Constants::ParticleLayoutType, parent) { setItemName(Constants::ParticleLayoutType); - setItemPort(ParameterizedItem::PortInfo::Port0); + setItemPort(ParameterizedItem::PortInfo::PORT_0); ComboProperty approx; approx << "Decoupling Approximation" << "Size Space Coupling Approximation"; registerProperty(P_APPROX, approx.getVariant()); - addToValidChildren(Constants::ParticleType, PortInfo::Port0); - addToValidChildren(Constants::ParticleCoreShellType, PortInfo::Port0); - addToValidChildren(Constants::ParticleDistributionType, PortInfo::Port0); - addToValidChildren(Constants::InterferenceFunction1DParaCrystalType, PortInfo::Port1, 1); - addToValidChildren(Constants::InterferenceFunction2DParaCrystalType, PortInfo::Port1, 1); - addToValidChildren(Constants::InterferenceFunction2DLatticeType, PortInfo::Port1, 1); + addToValidChildren(Constants::ParticleType, PortInfo::PORT_0); + addToValidChildren(Constants::ParticleCoreShellType, PortInfo::PORT_0); + addToValidChildren(Constants::ParticleDistributionType, PortInfo::PORT_0); + addToValidChildren(Constants::InterferenceFunction1DParaCrystalType, PortInfo::PORT_1, 1); + addToValidChildren(Constants::InterferenceFunction2DParaCrystalType, PortInfo::PORT_1, 1); + addToValidChildren(Constants::InterferenceFunction2DLatticeType, PortInfo::PORT_1, 1); } ParticleLayoutItem::~ParticleLayoutItem() diff --git a/GUI/coregui/Models/SessionModel.cpp b/GUI/coregui/Models/SessionModel.cpp index 286826a14aeba549c0605226900d918f9d1bc0bb..125c54e47cc7e7cac8d33d9e417f2a0e1fb7c3a4 100644 --- a/GUI/coregui/Models/SessionModel.cpp +++ b/GUI/coregui/Models/SessionModel.cpp @@ -249,7 +249,7 @@ QModelIndex SessionModel::indexOfItem(ParameterizedItem *item) const ParameterizedItem *SessionModel::insertNewItem(QString model_type, const QModelIndex &parent, int row, - ParameterizedItem::PortInfo::Keys port) + ParameterizedItem::PortInfo::EPorts port) { if (!m_root_item) { m_root_item = ItemFactory::createEmptyItem(); @@ -413,7 +413,7 @@ SessionModel *SessionModel::createCopy(ParameterizedItem *parent) ParameterizedItem *SessionModel::insertNewItem(QString model_type, ParameterizedItem *parent, int row, - ParameterizedItem::PortInfo::Keys port) + ParameterizedItem::PortInfo::EPorts port) { if (!m_root_item) { m_root_item = ItemFactory::createEmptyItem(); @@ -427,7 +427,7 @@ ParameterizedItem *SessionModel::insertNewItem(QString model_type, } ParameterizedItem *new_item = ItemFactory::createItem(model_type); - if(port != ParameterizedItem::PortInfo::PortDef) + if(port != ParameterizedItem::PortInfo::DEFAULT) new_item->setItemPort(port); if(!new_item) diff --git a/GUI/coregui/Models/SessionModel.h b/GUI/coregui/Models/SessionModel.h index c051f14cccb988b6d355474b65f9e162f51edc5f..c6c9b8413c98954b4e441e1eb8e1cd6732823d00 100644 --- a/GUI/coregui/Models/SessionModel.h +++ b/GUI/coregui/Models/SessionModel.h @@ -90,7 +90,7 @@ public: QModelIndex indexOfItem(ParameterizedItem *item) const; ParameterizedItem *insertNewItem(QString model_type, const QModelIndex &parent=QModelIndex(), - int row=-1, ParameterizedItem::PortInfo::Keys port = ParameterizedItem::PortInfo::PortDef); + int row=-1, ParameterizedItem::PortInfo::EPorts port = ParameterizedItem::PortInfo::DEFAULT); QString getModelTag() const { return m_model_tag; } QString getModelName() const { return m_name; } @@ -138,7 +138,7 @@ private: ParameterizedItem *insertNewItem(QString model_type, ParameterizedItem *parent, int row=-1, - ParameterizedItem::PortInfo::Keys port = ParameterizedItem::PortInfo::PortDef); + ParameterizedItem::PortInfo::EPorts port = ParameterizedItem::PortInfo::DEFAULT); void readItems(QXmlStreamReader *reader, ParameterizedItem *item, int row=-1); QString readProperty(QXmlStreamReader *reader, ParameterizedItem *item); diff --git a/GUI/coregui/Models/TransformationItem.cpp b/GUI/coregui/Models/TransformationItem.cpp index b3bb5d6aaca987eb7130a832ec96b7c8bf0a6fae..36de07f1ec25bfdd19cd7c4ce0998277e2df8079 100644 --- a/GUI/coregui/Models/TransformationItem.cpp +++ b/GUI/coregui/Models/TransformationItem.cpp @@ -11,7 +11,7 @@ TransformationItem::TransformationItem(ParameterizedItem *parent) : ParameterizedGraphicsItem(Constants::TransformationType, parent) { setItemName(Constants::TransformationType); - setItemPort(ParameterizedItem::PortInfo::Port0); + setItemPort(ParameterizedItem::PortInfo::PORT_0); registerGroupProperty(P_POS, Constants::VectorType); registerGroupProperty(P_ROT, Constants::RotationGroup );