12#include <QInputDialog>
13#include <QItemSelectionModel>
15#include <QListWidgetItem>
17#include <QStackedWidget>
53template <
typename Type,
typename TypeSP = QSharedPo
inter<Type>>
57 if (signature.
type.isEmpty())
return nullptr;
59 auto source = resourcesInterface->source<Type>(signature.
type);
63 qWarning() <<
"WARNING: failed to find a resource for layer sytle" << signature;
64 resource =
source.fallbackResource();
67 return resource ? resource->clone().template dynamicCast<Type>() :
nullptr;
72 return fetchResourceLazy<KoAbstractGradient>(signature, resourcesInterface);
77 return fetchResourceLazy<KoPattern>(signature, resourcesInterface);
88 buf.open(QFile::WriteOnly);
89 clonedGradient->saveToDevice(&buf);
94 clonedGradient->updatePreview();
96 return clonedGradient;
101 , m_layerStyle(layerStyle)
103 , m_isSwitchingPredefinedStyle(false)
104 , m_sanityLayerStyleDirty(false)
105 , m_temporaryStorageLock(
"temporary layer style dependencies storage",
std::defer_lock)
115 QWidget *page =
new QWidget(
this);
186 SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
187 this, SLOT(
changePage(QListWidgetItem*,QListWidgetItem*)));
191 QPalette newPalette =
palette();
192 newPalette.setColor(QPalette::Active, QPalette::Window,
palette().text().color() );
246 QListWidgetItem *item;
248 if (
wdgLayerStyles.lstStyleSelector->item(6)->checkState() == Qt::Checked) {
251 Qt::ItemFlags currentFlags7 = item->flags();
252 item->setFlags(currentFlags7 | Qt::ItemIsEnabled);
256 Qt::ItemFlags currentFlags8 = item->flags();
257 item->setFlags(currentFlags8 | Qt::ItemIsEnabled);
262 Qt::ItemFlags currentFlags7 = item->flags();
263 item->setFlags(currentFlags7 & (~Qt::ItemIsEnabled));
267 Qt::ItemFlags currentFlags8 = item->flags();
268 item->setFlags(currentFlags8 & (~Qt::ItemIsEnabled));
291 const QString customName =
"CustomStyles.asl";
299 QString finalName = name;
307 finalName = QString(
"%1%2").arg(name).arg(i++);
317 QInputDialog::getText(
this,
318 i18nc(
"@title:window",
"Enter new style name"),
319 i18nc(
"@label:textbox",
"Name:"),
321 i18nc(
"Default name for a new style",
"New Style"),
328 clone->setName(styleName);
329 clone->setUuid(QUuid::createUuid());
330 clone->setFilename(clone->uuid().toString());
331 clone->setValid(
true);
333 const QString customStylesStorageLocation =
"asl/CustomStyles.asl";
335 QString storagePath = resourceDir +
"/" + customStylesStorageLocation;
337 bool resourceAdded =
false;
357 resourceAdded = bool(clone);
372 return resourceFolderPath +
'/' +
"asl" +
'/' + filename;
378 dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
379 dialog.setMimeTypeFilters({
"application/x-photoshop-style-library"});
380 dialog.setCaption(i18n(
"Select ASL file"));
382 const QString filename = dialog.filename();
390 if (!filename.isEmpty()) {
391 const QFileInfo oldFileInfo(filename);
398 if (!storage->valid()) {
399 qWarning() <<
"Attempted to import an invalid layer style library!" << filename;
400 QMessageBox::warning(
this,
401 i18nc(
"@title:window",
"Krita"),
402 i18n(
"Could not load layer style library %1.", filename));
409 const QString newName = oldFileInfo.fileName();
410 const QString newLocation = QStringLiteral(
"%1/%2").arg(newDir, newName);
412 const QFileInfo newFileInfo(newLocation);
414 if (newFileInfo.exists()) {
415 if (QMessageBox::warning(
this,
416 i18nc(
"@title:window",
"Warning"),
417 i18n(
"There is already a layer style library with this name installed. Do you "
418 "want to overwrite it?"),
419 QMessageBox::Ok | QMessageBox::Cancel)
420 == QMessageBox::Cancel) {
423 QFile::remove(newLocation);
427 QFile::copy(filename, newLocation);
433 qWarning() <<
"Could not add layer style library to the storages" << newLocation;
444 dialog.setCaption(i18n(
"Select ASL file"));
445 dialog.setMimeTypeFilters(
QStringList() <<
"application/x-photoshop-style-library",
"application/x-photoshop-style-library");
446 filename = dialog.filename();
451 newStyle->setName(QFileInfo(filename).completeBaseName());
454 serializer->setStyles(styles);
455 serializer->saveToFile(filename);
478 if (localResourcesInterface) {
481 Q_FOREACH (
KoResourceSP resource, localResourcesInterface->resources()) {
508 QListWidgetItem *item;
510 item->setCheckState(
m_layerStyle->dropShadow()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
513 item->setCheckState(
m_layerStyle->innerShadow()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
516 item->setCheckState(
m_layerStyle->outerGlow()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
519 item->setCheckState(
m_layerStyle->innerGlow()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
522 item->setCheckState(
m_layerStyle->bevelAndEmboss()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
525 item->setCheckState(
m_layerStyle->bevelAndEmboss()->contourEnabled() ? Qt::Checked : Qt::Unchecked);
528 item->setCheckState(
m_layerStyle->bevelAndEmboss()->textureEnabled() ? Qt::Checked : Qt::Unchecked);
531 item->setCheckState(
m_layerStyle->satin()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
534 item->setCheckState(
m_layerStyle->colorOverlay()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
537 item->setCheckState(
m_layerStyle->gradientOverlay()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
540 item->setCheckState(
m_layerStyle->patternOverlay()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
543 item->setCheckState(
m_layerStyle->stroke()->effectEnabled() ? Qt::Checked : Qt::Unchecked);
595 m_layerStyle->setResourcesInterface(newLocalStyleResources);
624 : QSortFilterProxyModel(parent)
631 m_enableFiltering = enableFiltering;
637 m_locationToFilter = location;
643 Q_UNUSED(source_parent);
644 if (!m_enableFiltering) {
648 QModelIndex idx = sourceModel()->index(source_row, 0);
652 return location == m_locationToFilter;
661 : QListWidgetItem(style->name())
685 ui.listStyles->setEditTriggers(QAbstractItemView::EditTrigger::NoEditTriggers);
687 connect(
ui.cmbStyleCollections, SIGNAL(textActivated(QString)),
this, SLOT(
loadStyles(QString)));
688 connect(
ui.listStyles, SIGNAL(clicked(QModelIndex)),
this, SLOT(
selectStyle(QModelIndex)));
692 if (
ui.cmbStyleCollections->count()) {
693 ui.cmbStyleCollections->setCurrentIndex(0);
705 if (!locationsList.contains(location)) {
706 locationsList << location;
709 ui.cmbStyleCollections->clear();
710 ui.cmbStyleCollections->addItems(locationsList);
754 qDebug() <<
"StylesSelector::selectStyle" << (resource.isNull() ?
"(null)" : resource->name()) << (layerStyle.isNull() ?
"(null)" : layerStyle->name());
771 warnKrita <<
"Collection cannot be loaded, because we do not use collections now; please use KisAslStorage instead.";
808 ui.listStyles->reset();
809 ui.cmbStyleCollections->setCurrentText(location);
830 ui.intDepth->setRange(0, 100);
833 ui.intSize->setRange(0, 250);
834 ui.intSize->setSuffix(i18n(
" px"));
835 ui.intSize->setExponentRatio(2.0);
837 ui.intSoften->setRange(0, 18);
838 ui.intSoften->setSuffix(i18n(
" px"));
840 connect(
ui.cmbStyle, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
841 connect(
ui.cmbTechnique, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
842 connect(
ui.intDepth, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
843 connect(
ui.cmbDirection, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
844 connect(
ui.intSize, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
845 connect(
ui.intSoften, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
848 ui.intOpacity->setRange(0, 100);
851 ui.intOpacity2->setRange(0, 100);
854 ui.angleSelector->enableGlobalLight(
true);
858 connect(
ui.intAltitude, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
859 connect(
ui.cmbContour, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
860 connect(
ui.chkAntiAliased, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
861 connect(
ui.cmbHighlightMode, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
863 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
864 connect(
ui.cmbShadowMode, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
866 connect(
ui.intOpacity2, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
871 i18nc(
"{n} is the number value, % is the percent sign",
"{n}%"));
880 i18nc(
"{n} is the number value, % is the percent sign",
"{n}%"));
884 i18nc(
"{n} is the number value, % is the percent sign",
"{n}%"));
895 ui.cmbStyle->setCurrentIndex((
int)bevelAndEmboss->
style());
896 ui.cmbTechnique->setCurrentIndex((
int)bevelAndEmboss->
technique());
897 ui.intDepth->setValue(bevelAndEmboss->
depth());
898 ui.cmbDirection->setCurrentIndex((
int)bevelAndEmboss->
direction());
899 ui.intSize->setValue(bevelAndEmboss->
size());
900 ui.intSoften->setValue(bevelAndEmboss->
soften());
902 ui.angleSelector->setValue(bevelAndEmboss->
angle());
905 ui.intAltitude->setValue(bevelAndEmboss->
altitude());
922 if (patternResource) {
923 m_texture->
ui.patternChooser->setCurrentPattern(patternResource);
935 bevelAndEmboss->
setDepth(
ui.intDepth->value());
937 bevelAndEmboss->
setSize(
ui.intSize->value());
940 bevelAndEmboss->
setAngle(
ui.angleSelector->value());
955 auto patternResource =
m_texture->
ui.patternChooser->currentResource(
true).staticCast<
KoPattern>();
956 if (patternResource) {
957 auto clonedPatternResource = patternResource->
clone().dynamicCast<
KoPattern>();
959 uploadResourcesInterface->addResource(clonedPatternResource);
1000 ui.grpBlendingOptions->setTitle(QString(
"%1 (%2)").arg(
ui.grpBlendingOptions->title()).arg(i18n(
"Not Implemented Yet")));
1001 ui.grpBlendingOptions->setEnabled(
false);
1016 ui.intOpacity->setRange(0, 100);
1019 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1020 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1026 ui.cmbCompositeOp->selectCompositeOp(
KoID(colorOverlay->
blendMode()));
1027 ui.intOpacity->setValue(colorOverlay->
opacity());
1028 ui.bnColor->setColor(colorOverlay->
color());
1033 colorOverlay->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1049 ui.intOpacity->setRange(0, 100);
1052 ui.intDistance->setRange(0, 500);
1053 ui.intDistance->setSuffix(i18n(
" px"));
1054 ui.intDistance->setExponentRatio(3.0);
1056 ui.intSpread->setRange(0, 100);
1059 ui.intSize->setRange(0, 250);
1060 ui.intSize->setSuffix(i18n(
" px"));
1061 ui.intSize->setExponentRatio(2.0);
1063 ui.intNoise->setRange(0, 100);
1066 ui.angleSelector->enableGlobalLight(
true);
1071 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1072 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1075 connect(
ui.intDistance, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1076 connect(
ui.intSpread, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1077 connect(
ui.intSize, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1079 connect(
ui.cmbContour, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1080 connect(
ui.chkAntiAliased, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1081 connect(
ui.intNoise, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1083 connect(
ui.chkLayerKnocksOutDropShadow, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1086 ui.chkLayerKnocksOutDropShadow->setVisible(
false);
1087 ui.grpMain->setTitle(i18n(
"Inner Shadow"));
1088 ui.lblSpread->setText(i18n(
"Choke:"));
1095 ui.intOpacity->setValue(shadow->
opacity());
1096 ui.bnColor->setColor(shadow->
color());
1098 ui.angleSelector->setValue(shadow->
angle());
1101 ui.intDistance->setValue(shadow->
distance());
1102 ui.intSpread->setValue(shadow->
spread());
1103 ui.intSize->setValue(shadow->
size());
1109 ui.intNoise->setValue(shadow->
noise());
1115 ui.chkLayerKnocksOutDropShadow->setChecked(shadow->
knocksOut());
1121 shadow->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1141 realDropShadow->
setKnocksOut(
ui.chkLayerKnocksOutDropShadow->isChecked());
1154 ui.intOpacity->setRange(0, 100);
1157 ui.intScale->setRange(0, 100);
1160 ui.angleSelector->angleSelector()->setResetAngle(90.0);
1165 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1166 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1168 connect(
ui.chkReverse, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1169 connect(
ui.cmbStyle, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1170 connect(
ui.chkAlignWithLayer, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1171 connect(
ui.intScale, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1172 connect(
ui.chkDither, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1178 ui.intOpacity->setValue(config->
opacity());
1182 ui.cmbGradient->setGradient(gradient);
1185 ui.chkReverse->setChecked(config->
reverse());
1186 ui.cmbStyle->setCurrentIndex((
int)config->
style());
1188 ui.chkAlignWithLayer->setCheckable(
true);
1189 ui.angleSelector->setValue(config->
angle());
1190 ui.intScale->setValue(config->
scale());
1191 ui.chkDither->setChecked(config->
dither());
1196 config->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1199 auto gradient =
ui.cmbGradient->gradient();
1202 uploadResourcesInterface->addResource(clonedGradient);
1225 ui.groupBox->setTitle(i18n(
"Outer Glow"));
1228 ui.intOpacity->setRange(0, 100);
1231 ui.intNoise->setRange(0, 100);
1234 ui.intChoke->setRange(0, 100);
1237 ui.intSize->setRange(0, 250);
1238 ui.intSize->setSuffix(i18n(
" px"));
1239 ui.intSize->setExponentRatio(2.0);
1241 ui.intRange->setRange(1, 100);
1244 ui.intJitter->setRange(0, 100);
1249 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1250 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1251 connect(
ui.intNoise, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1253 connect(
ui.radioColor, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1255 connect(
ui.radioGradient, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1258 connect(
ui.cmbTechnique, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1259 connect(
ui.cmbSource, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1260 connect(
ui.intChoke, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1261 connect(
ui.intSize, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1263 connect(
ui.cmbContour, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1264 connect(
ui.chkAntiAliased, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1265 connect(
ui.intRange, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1266 connect(
ui.intJitter, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1269 ui.cmbSource->hide();
1270 ui.lblSource->hide();
1271 ui.lblChoke->setText(i18nc(
"layer styles parameter",
"Spread:"));
1279 ui.intOpacity->setValue(config->
opacity());
1280 ui.intNoise->setValue(config->
noise());
1283 ui.bnColor->setColor(config->
color());
1288 ui.cmbGradient->setGradient(gradient);
1291 ui.cmbTechnique->setCurrentIndex((
int)config->
technique());
1292 ui.intChoke->setValue(config->
spread());
1293 ui.intSize->setValue(config->
size());
1307 ui.intRange->setValue(config->
range());
1308 ui.intJitter->setValue(config->
jitter());
1313 config->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1317 if (
ui.radioColor->isChecked()) {
1328 uploadResourcesInterface->addResource(clonedGradient);
1362 ui.intOpacity->setRange(0, 100);
1365 ui.intScale->setRange(0, 100);
1368 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1369 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1371 connect(
ui.chkLinkWithLayer, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1372 connect(
ui.intScale, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1378 ui.intOpacity->setValue(pattern->
opacity());
1380 if (patternResource) {
1381 ui.patternChooser->setCurrentPattern(patternResource);
1384 ui.intScale->setValue(pattern->
scale());
1389 pattern->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1392 auto patternResource =
ui.patternChooser->currentResource(
true).staticCast<
KoPattern>();
1393 if (patternResource) {
1394 auto clonedPatternResource = patternResource->
clone().dynamicCast<
KoPattern>();
1396 uploadResourcesInterface->addResource(clonedPatternResource);
1413 ui.intOpacity->setRange(0, 100);
1416 ui.intDistance->setRange(0, 250);
1417 ui.intDistance->setSuffix(i18n(
" px"));
1419 ui.intSize->setRange(0, 250);
1420 ui.intSize->setSuffix(i18n(
" px"));
1421 ui.intSize->setExponentRatio(2.0);
1423 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1425 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1428 connect(
ui.intDistance, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1429 connect(
ui.intSize, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1431 connect(
ui.cmbContour, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1432 connect(
ui.chkAntiAliased, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1433 connect(
ui.chkInvert, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1440 ui.bnColor->setColor(satin->
color());
1441 ui.intOpacity->setValue(satin->
opacity());
1443 ui.angleSelector->setValue(satin->
angle());
1446 ui.intSize->setValue(satin->
size());
1452 ui.chkInvert->setChecked(satin->
invert());
1458 satin->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1482 ui.intSize->setRange(0, 250);
1483 ui.intSize->setSuffix(i18n(
" px"));
1484 ui.intSize->setExponentRatio(2.0);
1486 ui.intOpacity->setRange(0, 100);
1489 ui.intScale->setRange(0, 100);
1492 ui.intScale_2->setRange(0, 100);
1497 connect(
ui.cmbFillType, SIGNAL(currentIndexChanged(
int)),
ui.fillStack, SLOT(setCurrentIndex(
int)));
1499 connect(
ui.intSize, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1500 connect(
ui.cmbPosition, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1501 connect(
ui.cmbCompositeOp, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1502 connect(
ui.intOpacity, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1504 connect(
ui.cmbFillType, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1509 connect(
ui.chkReverse, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1510 connect(
ui.cmbStyle, SIGNAL(currentIndexChanged(
int)), SIGNAL(
configChanged()));
1511 connect(
ui.chkAlignWithLayer, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1512 connect(
ui.intScale, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1517 connect(
ui.chkLinkWithLayer, SIGNAL(toggled(
bool)), SIGNAL(
configChanged()));
1518 connect(
ui.intScale_2, SIGNAL(valueChanged(
int)), SIGNAL(
configChanged()));
1521 ui.fillStack->setCurrentIndex(
ui.cmbFillType->currentIndex());
1526 ui.intSize->setValue(stroke->
size());
1527 ui.cmbPosition->setCurrentIndex((
int)stroke->
position());
1529 ui.intOpacity->setValue(stroke->
opacity());
1531 ui.cmbFillType->setCurrentIndex((
int)stroke->
fillType());
1532 ui.bnColor->setColor(stroke->
color());
1536 ui.cmbGradient->setGradient(gradient);
1540 ui.cmbStyle->setCurrentIndex((
int)stroke->
style());
1542 ui.chkAlignWithLayer->setCheckable(
true);
1543 ui.angleSelector->setValue(stroke->
angle());
1544 ui.intScale->setValue(stroke->
scale());
1548 ui.patternChooser->setCurrentPattern(pattern);
1552 ui.intScale_2->setValue(stroke->
scale());
1559 stroke->
setBlendMode(
ui.cmbCompositeOp->selectedCompositeOp().id());
1567 auto gradient =
ui.cmbGradient->gradient();
1570 uploadResourcesInterface->addResource(clonedGradient);
1583 auto pattern =
ui.patternChooser->currentResource(
true).staticCast<
KoPattern>();
1586 uploadResourcesInterface->addResource(clonedPattern);
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
QList< QString > QStringList
BevelAndEmboss(Contour *contour, Texture *texture, QWidget *parent)
void setBevelAndEmboss(const psd_layer_effects_bevel_emboss *bevelAndEmboss, KisResourcesInterfaceSP resourcesInterface)
void fetchBevelAndEmboss(psd_layer_effects_bevel_emboss *bevelAndEmboss, QSharedPointer< KisLocalStrokeResources > uploadResourcesInterface) const
void globalAngleChanged(int value)
Ui::WdgBlendingOptions ui
BlendingOptions(QWidget *parent)
ColorOverlay(QWidget *parent)
void setColorOverlay(const psd_layer_effects_color_overlay *colorOverlay)
void fetchColorOverlay(psd_layer_effects_color_overlay *colorOverlay) const
void globalAngleChanged(int value)
void setShadow(const psd_layer_effects_shadow_common *shadow)
void fetchShadow(psd_layer_effects_shadow_common *shadow) const
DropShadow(Mode mode, QWidget *parent)
Ui::WdgGradientOverlay ui
void fetchGradientOverlay(psd_layer_effects_gradient_overlay *gradient, QSharedPointer< KisLocalStrokeResources > uploadResourcesInterface) const
void setGradientOverlay(const psd_layer_effects_gradient_overlay *gradient, KisResourcesInterfaceSP resourcesInterface)
GradientOverlay(KisCanvasResourceProvider *resourceProvider, QWidget *parent)
InnerGlow(Mode mode, KisCanvasResourceProvider *resourceProvider, QWidget *parent)
void fetchConfig(psd_layer_effects_glow_common *innerGlow, QSharedPointer< KisLocalStrokeResources > uploadResourcesInterface) const
void setConfig(const psd_layer_effects_glow_common *innerGlow, KisResourcesInterfaceSP resourcesInterface)
The KisAllresourcesModel class provides access to the cache database for a particular resource type....
bool addResourceDeduplicateFileName(KoResourceSP resource, const QString &storageId=QString("")) override
addResource adds the given resource to the database and storage. If the resource already exists in th...
static void sideLoadLinkedResources(KisPSDLayerStyle *style, KisResourcesInterfaceSP resourcesInterface)
void setStyles(const QVector< KisPSDLayerStyleSP > &styles)
bool saveToFile(const QString &filename)
KoCanvasResourceProvider * resourceManager()
T readEntry(const QString &name, const T &defaultValue=T())
void changePage(QListWidgetItem *, QListWidgetItem *)
void notifyGuiConfigChanged()
KisDlgLayerStyle(KisPSDLayerStyleSP layerStyle, KisCanvasResourceProvider *resourceProvider, QWidget *parent=0)
KisPSDLayerStyleSP m_initialLayerStyle
void slotNotifyOnReject()
bool m_sanityLayerStyleDirty
void slotMasterFxSwitchChanged(bool value)
BevelAndEmboss * m_bevelAndEmboss
PatternOverlay * m_patternOverlay
DropShadow * m_dropShadow
bool m_isSwitchingPredefinedStyle
~KisDlgLayerStyle() override
GradientOverlay * m_gradientOverlay
void slotNotifyOnAccept()
KisTemporaryResourceStorageLock m_temporaryStorageLock
Ui::WdgStylesDialog wdgLayerStyles
BlendingOptions * m_blendingOptions
void slotBevelAndEmbossChanged(QListWidgetItem *)
void syncGlobalAngle(int angle)
ColorOverlay * m_colorOverlay
void setStyle(KisPSDLayerStyleSP style)
KisPSDLayerStyleSP style() const
KisPSDLayerStyleSP m_layerStyle
void notifyPredefinedStyleSelected(KisPSDLayerStyleSP style)
DropShadow * m_innerShadow
StylesSelector * m_stylesSelector
KisSignalCompressor * m_configChangedCompressor
static KisResourcesInterfaceSP instance()
a KisResourcesInterface-like resources storage for preloaded resources
bool addStorage(const QString &storageLocation, KisResourceStorageSP storage)
addStorage Adds a new resource storage to the database. The storage is will be marked as not pre-inst...
static KisResourceLocator * instance()
static KisAllResourcesModel * resourceModel(const QString &resourceType)
The KisResourceModel class provides the main access to resources. It is possible to filter the resour...
KoResourceSP resourceForId(int id) const
QModelIndex indexForResource(KoResourceSP resource) const override
indexFromResource
KoResourceSP resourceForIndex(QModelIndex index=QModelIndex()) const override
resourceForIndex returns a properly versioned and id'ed resource object
static KisResourceServerProvider * instance()
KoResourceServer< KisPSDLayerStyle > * layerStyleServer()
static bool addResourceWithUserInput(QWidget *widgetParent, KoResourceSP resource, QString storageLocation="")
QString storageLocation() const
KoCanvasResourcesInterfaceSP canvasResourcesInterface() const
A dialog base class with standard buttons and predefined layouts.
void setMainWidget(QWidget *widget)
virtual void setCaption(const QString &caption)
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)
static QString generateHash(const QString &filename)
generateHash reads the given file and generates a hex-encoded md5sum for the file.
KoResourceSP clone() const override
static QString getAppDataLocation()
QSharedPointer< T > resource(const QString &md5, const QString &fileName, const QString &name)
resource retrieves a resource. If the md5sum is not empty, the resource will only be retrieved if a r...
A simple wrapper object for the main information about the resource.
void fetchPatternOverlay(psd_layer_effects_pattern_overlay *pattern, QSharedPointer< KisLocalStrokeResources > uploadResourcesInterface) const
PatternOverlay(QWidget *parent)
void setPatternOverlay(const psd_layer_effects_pattern_overlay *pattern, KisResourcesInterfaceSP resourcesInterface)
void setSatin(const psd_layer_effects_satin *satin)
void fetchSatin(psd_layer_effects_satin *satin) const
Stroke(KisCanvasResourceProvider *resourceProvider, QWidget *parent)
void setStroke(const psd_layer_effects_stroke *stroke, KisResourcesInterfaceSP resourcesInterface)
void fetchStroke(psd_layer_effects_stroke *stroke, QSharedPointer< KisLocalStrokeResources > uploadResourcesInterface) const
KisPSDLayerStyleSP m_style
StyleItem(KisPSDLayerStyleSP style)
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
void setLocationToFilterBy(QString location)
void setEnableFiltering(bool enableFiltering)
LocationProxyModel(QObject *parent)
void addNewStyle(const QString &location, const KisPSDLayerStyleSP style)
void notifyExternalStyleChanged(const QString &name, const QUuid &uuid)
void loadStyles(const QString &name)
void loadCollection(const QString &fileName)
void selectStyle(QModelIndex current)
void slotResourceModelReset()
StylesSelector(QWidget *parent)
void styleSelected(KisPSDLayerStyleSP style)
LocationProxyModel * m_locationsProxyModel
KisResourceModel * m_resourceModel
void setSource(psd_glow_source value)
psd_glow_source source() const
void setGradient(KoAbstractGradientSP value)
void setColor(KoColor value)
void setRange(qint32 value)
bool useGlobalLight() const
QString blendMode() const
void setFillType(psd_fill_type value)
void setNoise(qint32 value)
void setUseGlobalLight(bool value)
psd_technique_type technique() const
void setTechnique(psd_technique_type value)
void setAntiAliased(bool value)
void setKnocksOut(bool value)
void setDistance(qint32 value)
void setAngle(qint32 value)
void setBlendMode(QString value)
void setJitter(qint32 value)
void setOpacity(qint32 value)
psd_fill_type fillType() const
void setSpread(qint32 value)
KoResourceSignature gradientLink() const
void setSize(qint32 value)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_NOOP(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
TypeSP fetchResourceLazy(KoResourceSignature signature, KisResourcesInterfaceSP resourcesInterface)
bool checkCustomNameAvailable(const QString &name)
QString createNewAslPath(QString resourceFolderPath, QString filename)
KoPatternSP fetchPatternLazy(KoResourceSignature signature, KisResourcesInterfaceSP resourcesInterface)
KoAbstractGradientSP fetchGradientLazy(KoResourceSignature signature, KisResourcesInterfaceSP resourcesInterface)
QString selectAvailableStyleName(const QString &name)
KoAbstractGradientSP cloneAndPrepareGradientFromGUI(KoAbstractGradientSP gradient)
void createLocalResourcesSnapshot(T *object, KisResourcesInterfaceSP globalResourcesInterface=nullptr)
bool hasLocalResourcesSnapshot(const T *object)
void setText(QSpinBox *spinBox, const QStringView textTemplate)
const QString LayerStyles
rgba palette[MAX_PALETTE]
The KisPSDLayerStyle class implements loading, saving and applying the PSD layer effects.
QString md5Sum(bool generateIfEmpty=true) const
void setTechnique(psd_technique_type value)
void setStyle(psd_bevel_style value)
void setTextureDepth(int value)
QString shadowBlendMode() const
psd_technique_type technique() const
KoResourceSignature texturePatternLink() const
void setShadowColor(KoColor value)
qint32 highlightOpacity() const
psd_bevel_style style() const
void setTextureScale(int value)
psd_direction direction() const
bool glossAntiAliased() const
void setDirection(psd_direction value)
void setTexturePattern(KoPatternSP value)
void setHighlightBlendMode(QString value)
void setAltitude(int value)
bool textureInvert() const
void setHighlightColor(KoColor value)
void setContourRange(int value)
qint32 shadowOpacity() const
bool textureAlignWithLayer() const
void setShadowBlendMode(QString value)
QString highlightBlendMode() const
void setGlossAntiAliased(bool value)
KoColor shadowColor() const
KoColor highlightColor() const
void setTextureAlignWithLayer(bool value)
void setShadowOpacity(qint32 value)
void setSoften(int value)
void setTextureInvert(bool value)
void setHighlightOpacity(qint32 value)
void setReverse(bool value)
void setAlignWithLayer(bool value)
KoResourceSignature patternLink() const
void setStyle(psd_gradient_style value)
bool alignWithLayer() const
void setDither(bool value)
psd_gradient_style style() const
void setPattern(KoPatternSP value)
void setInvert(bool value)
void setPosition(psd_stroke_position value)
psd_stroke_position position() const