35 Ui::WdgChangeCloneSource
ui;
56 for (
KisNodeSP childNode = node->
lastChild(); childNode; childNode = childNode->prevSibling()) {
57 KisLayerSP childLayer(qobject_cast<KisLayer *>(childNode.data()));
67 validTargets.removeOne(layer);
71 filterOutAncestorsAndClonesRecursively(parent);
76 filterOutAncestorsAndClonesRecursively(clone);
82 int index = ui.cmbSourceLayer->currentIndex();
84 return validTargets.
at(index);
102 this, &KisDlgChangeCloneSource::reject);
104 this, &KisDlgChangeCloneSource::reject);
106 this, &KisDlgChangeCloneSource::accept);
111 QWidget *widget =
new QWidget(
this);
112 d->ui.setupUi(widget);
115 connect(
d->ui.cmbSourceLayer, QOverload<int>::of(&QComboBox::currentIndexChanged),
123 dbgUI <<
"dialog destroyed";
125 if (result() == QDialog::Accepted &&
d->modified) {
127 d->applicator->end();
130 d->applicator->cancel();
143 d->validTargets.clear();
144 d->addToTargetListRecursively(root,
false);
146 KisLayerSP commonCopyFrom(
d->cloneLayers.first()->copyFrom());
152 d->filterOutAncestorsAndClonesRecursively(clone);
155 if (clone->copyFrom() != commonCopyFrom) {
160 d->ui.cmbSourceLayer->clear();
162 d->ui.cmbSourceLayer->addItem(node->
name());
165 if (commonCopyFrom) {
166 d->ui.cmbSourceLayer->setCurrentIndex(
d->validTargets.indexOf(commonCopyFrom));
168 d->ui.cmbSourceLayer->setCurrentIndex(-1);
174 KisLayerSP targetLayer =
d->getSelectedTargetLayer();
176 d->applicator->applyCommand(
d->createCommand(targetLayer));
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
~KisDlgChangeCloneSource() override
KisDlgChangeCloneSource(QList< KisCloneLayerSP > layers, KisViewManager *view, QWidget *parent=0)
void slotCancelChangesAndSetNewTarget()
const QScopedPointer< Private > d
void updateTargetLayerList()
void sigStrokeCancellationRequested()
void sigStrokeEndRequested()
void sigUndoDuringStrokeRequested()
A dialog base class with standard buttons and predefined layouts.
void setMainWidget(QWidget *widget)
void setButtons(ButtonCodes buttonMask)
void setDefaultButton(ButtonCode id)
@ Ok
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)
@ Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
KUndo2MagicString kundo2_i18n(const char *text)
KisLayerSP getSelectedTargetLayer()
Private(QList< KisCloneLayerSP > layers, KisViewManager *view)
QList< KisCloneLayerSP > cloneLayers
KUndo2Command * createCommand(KisLayerSP targetLayer)
void addToTargetListRecursively(KisNodeSP node, bool addSelf=true)
QList< KisLayerSP > validTargets
Ui::WdgChangeCloneSource ui
QScopedPointer< KisProcessingApplicator > applicator
void filterOutAncestorsAndClonesRecursively(KisLayerSP layer)
const QList< KisCloneLayerWSP > registeredClones() const
KisNodeSP lastChild() const
KisNodeSP at(quint32 index) const