本文整理汇总了C++中KstCPluginPtr::setPlugin方法的典型用法代码示例。如果您正苦于以下问题:C++ KstCPluginPtr::setPlugin方法的具体用法?C++ KstCPluginPtr::setPlugin怎么用?C++ KstCPluginPtr::setPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstCPluginPtr
的用法示例。
在下文中一共展示了KstCPluginPtr::setPlugin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeDuplicate
KstDataObjectPtr KstCPlugin::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
KstCPluginPtr plugin = new KstCPlugin;
// use same inputs
for (KstVectorMap::ConstIterator iter = _inputVectors.begin(); iter != _inputVectors.end(); ++iter) {
plugin->inputVectors().insert(iter.key(), iter.data());
}
for (KstScalarMap::ConstIterator iter = _inputScalars.begin(); iter != _inputScalars.end(); ++iter) {
plugin->inputScalars().insert(iter.key(), iter.data());
}
for (KstStringMap::ConstIterator iter = _inputStrings.begin(); iter != _inputStrings.end(); ++iter) {
plugin->inputStrings().insert(iter.key(), iter.data());
}
// create new outputs
for (KstVectorMap::ConstIterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
KstWriteLocker blockVectorUpdates(&KST::vectorList.lock());
KstVectorPtr v = new KstVector(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), 0, plugin.data()); // FIXME: unique tag generation
plugin->outputVectors().insert(iter.key(), v);
}
for (KstScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) {
KstScalarPtr s = new KstScalar(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), plugin.data()); // FIXME: unique tag generation
plugin->outputScalars().insert(iter.key(), s);
}
for (KstStringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) {
KstStringPtr s = new KstString(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), plugin.data()); // FIXME: unique tag generation
plugin->outputStrings().insert(iter.key(), s);
}
// set the same plugin
plugin->setPlugin(_plugin);
plugin->setTagName(KstObjectTag(tag().tag() + "'", tag().context())); // FIXME: unique tag generation method
duplicatedMap.insert(this, KstDataObjectPtr(plugin));
return KstDataObjectPtr(plugin);
}
示例2: editObject
bool KstPluginDialogI::editObject() {
KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
if (!pp) { // something is dreadfully wrong - this should never happen
return false;
}
pp->writeLock();
if (_tagName->text() != pp->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) {
_tagName->setFocus();
pp->unlock();
return false;
}
pp->setTagName(_tagName->text());
int pitem = _w->PluginCombo->currentItem();
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
// Must unlock before clear()
for (KstVectorMap::Iterator i = pp->inputVectors().begin(); i != pp->inputVectors().end(); ++i) {
(*i)->unlock();
}
for (KstScalarMap::Iterator i = pp->inputScalars().begin(); i != pp->inputScalars().end(); ++i) {
(*i)->unlock();
}
for (KstStringMap::Iterator i = pp->inputStrings().begin(); i != pp->inputStrings().end(); ++i) {
(*i)->unlock();
}
pp->inputVectors().clear();
pp->inputScalars().clear();
pp->inputStrings().clear();
// Save the vectors and scalars
if (!saveInputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
pp->unlock();
return false;
}
if (pitem >= 0 && _w->PluginCombo->count() > 0) {
pp->setPlugin(pPtr);
}
if (!saveOutputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
pp->unlock();
return false;
}
if (!pp->isValid()) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
pp->unlock();
return false;
}
pp->setDirty();
pp->unlock();
emit modified();
return true;
}
示例3: makeDuplicate
KstDataObjectPtr KstCPlugin::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
KstCPluginPtr plugin = new KstCPlugin;
// use same inputs
for (KstVectorMap::ConstIterator iter = _inputVectors.begin(); iter != _inputVectors.end(); ++iter) {
plugin->inputVectors().insert(iter.key(), iter.data());
}
for (KstScalarMap::ConstIterator iter = _inputScalars.begin(); iter != _inputScalars.end(); ++iter) {
plugin->inputScalars().insert(iter.key(), iter.data());
}
for (KstStringMap::ConstIterator iter = _inputStrings.begin(); iter != _inputStrings.end(); ++iter) {
plugin->inputStrings().insert(iter.key(), iter.data());
}
// create new outputs
for (KstVectorMap::ConstIterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
KstVectorPtr v = new KstVector(iter.data()->tagName() + "'", 0, plugin.data());
plugin->outputVectors().insert(iter.key(), v);
KST::addVectorToList(v);
}
for (KstScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) {
KstScalarPtr s = new KstScalar(iter.data()->tagName() + "'", plugin.data());
plugin->outputScalars().insert(iter.key(), s);
}
for (KstStringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) {
KstStringPtr s = new KstString(iter.data()->tagName() + "'", plugin.data());
plugin->outputStrings().insert(iter.key(), s);
}
// set the same plugin
plugin->setPlugin(_plugin);
plugin->setTagName(tagName() + "'");
duplicatedMap.insert(this, KstDataObjectPtr(plugin));
return KstDataObjectPtr(plugin);
}
示例4: editObject
bool KstPluginDialogI::editObject() {
KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
if (!pp) { // something is dreadfully wrong - this should never happen
return false;
}
KstWriteLocker pl(pp);
if (_tagName->text() != pp->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) {
_tagName->setFocus();
return false;
}
pp->setTagName(KstObjectTag(_tagName->text(), KstObjectTag::globalTagContext)); // FIXME: tag context always global?
int pitem = _w->PluginCombo->currentItem();
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
pp->setRecursed(false);
pp->inputVectors().clear();
pp->inputScalars().clear();
pp->inputStrings().clear();
// Save the vectors and scalars
if (!saveInputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the inputs you entered."));
return false;
}
if (pitem >= 0 && _w->PluginCombo->count() > 0) {
pp->setPlugin(pPtr);
}
if (!saveOutputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the outputs you entered."));
return false;
}
if (!pp->isValid()) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
return false;
}
pp->setRecursed(false);
if (pp->recursion()) {
pp->setRecursed(true);
KMessageBox::sorry(this, i18n("There is a recursion resulting from the plugin you entered."));
return false;
}
pp->setDirty();
emit modified();
return true;
}
示例5: newObject
bool KstFilterDialogI::newObject() {
QString tagName = _tagName->text();
if (KstData::self()->dataTagNameNotUnique(tagName, true, this)) {
_tagName->setFocus();
return false;
} else {
int pitem = _w->PluginCombo->currentItem();
if (pitem >= 0 && _w->PluginCombo->count() > 0) {
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
if (pPtr) {
KstCPluginPtr plugin = new KstCPlugin;
KstWriteLocker pl(plugin);
plugin->setDirty();
if (saveInputs(plugin, pPtr)) {
if (tagName == plugin_defaultTag) {
tagName = KST::suggestPluginName(_pluginList[pitem], KstObjectTag::fromString(_yvector));
}
plugin->setTagName(KstObjectTag(tagName, KstObjectTag::globalTagContext)); // FIXME: tag context always global?
plugin->setPlugin(pPtr);
if (saveOutputs(plugin, pPtr)) {
if (plugin->isValid()) {
if (!createCurve(plugin)) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
return false;
} else {
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(plugin.data());
KST::dataObjectList.lock().unlock();
}
} else {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
return false;
}
} else {
KMessageBox::sorry(this, i18n("There is an error in the outputs you entered."));
return false;
}
} else {
KMessageBox::sorry(this, i18n("There is an error in the inputs you entered."));
return false;
}
}
}
emit modified();
}
return true;
}
示例6: newObject
bool KstPluginDialogI::newObject() {
QString tagName = _tagName->text();
if (tagName != plugin_defaultTag && KstData::self()->dataTagNameNotUnique(tagName, true, this)) {
_tagName->setFocus();
return false;
}
KstCPluginPtr plugin;
int pitem = _w->PluginCombo->currentItem();
if (pitem >= 0 && _w->PluginCombo->count() > 0) {
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
if (pPtr) {
plugin = new KstCPlugin;
KstWriteLocker pl(plugin);
// set the tag name before any dependents are created
if (tagName == plugin_defaultTag) {
tagName = KST::suggestPluginName(_pluginList[pitem]);
}
plugin->setTagName(KstObjectTag(tagName, KstObjectTag::globalTagContext));
if (!saveInputs(plugin, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the inputs you entered."));
plugin = 0L;
return false;
}
plugin->setPlugin(pPtr);
if (!saveOutputs(plugin, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the outputs you entered."));
plugin = 0L;
return false;
}
}
}
if (!plugin || !plugin->isValid()) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
return false;
}
plugin->setDirty();
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(plugin.data());
KST::dataObjectList.lock().unlock();
plugin = 0L;
emit modified();
return true;
}