// Version: $Id: 3276062b2cd320662e4cf64635febbab2091df8f $ // // // Commentary: // // // Change Log: // // // Code: #include "dtkComposerNodeLeafProcessSupport.h" #include #include // /////////////////////////////////////////////////////////////////// // dtkComposerNodeLeafProcessSupport implementation // /////////////////////////////////////////////////////////////////// dtkComposerNodeObject::dtkComposerNodeObject(void) : dtkComposerNodeLeafObject(), m_implementation(QString()), m_process(0) { } dtkComposerNodeObject::~dtkComposerNodeObject(void) { if (m_process) delete m_process; m_process = 0; } QVariant dtkComposerNodeObject::variant(void) const { if (this->object()) return dtkMetaType::variantFromValue(this->object()); else return QVariant(); } dtkAbstractProcess *dtkComposerNodeObject::object(void) const { return this->process(); } bool dtkComposerNodeObject::createObject(const QString& implementation) { if (implementation.isEmpty() || implementation == "Choose implementation") return false; if (implementation == "default") const_cast(implementation) = this->abstractProcessType(); if (!this->process()) { this->setProcess(dtkAbstractProcessFactory::instance()->create(implementation)); } else if (this->process()->identifier() != implementation) { this->setProcess(dtkAbstractProcessFactory::instance()->create(implementation)); } if (m_process != this->process()) { if (m_process) { delete m_process; } m_process = this->process(); if (m_process) m_implementation = this->process()->identifier(); } return (m_process != NULL); } QStringList dtkComposerNodeObject::implementations(void) const { QStringList implementations = dtkAbstractProcessFactory::instance()->implementations(this->abstractProcessType()); if (this->enableDefaultImplementation()) implementations.prepend("default"); return implementations; } QString dtkComposerNodeObject::currentImplementation(void) const { return m_implementation; } bool dtkComposerNodeObject::implementationHasChanged(const QString& implementation) const { return (m_implementation != implementation); } bool dtkComposerNodeObject::enableDefaultImplementation(void) const { return false; } bool dtkComposerNodeObject::isInteractive(void) { return false; } void dtkComposerNodeObject::clearProcess(void) { dtkAbstractProcess *p = this->process(); if (p) delete p; this->setProcess(NULL); } // // dtkComposerNodeLeafProcessSupport.cpp ends here