9#include <KStandardGuiItem>
30 , m_currentPreset(nullptr)
37 connect(clearPresetThumbnailButton, SIGNAL(clicked(
bool)), presetThumbnailWidget, SLOT(clear()));
39 KGuiItem::assign(
buttons->button(QDialogButtonBox::Save), KStandardGuiItem::save());
40 KGuiItem::assign(
buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
69 setWindowTitle(i18n(
"Save New SeExpr Preset"));
73 QString name = preset->name().replace(
"_",
" ");
74 if (preset->resourceId() > -1) {
75 name = QString(
"%1 %2").arg(name, i18n(
"Copy"));
77 newPresetNameTextField->setText(name);
78 newPresetNameTextField->setReadOnly(
false);
79 newPresetNameTextField->setEnabled(
true);
82 setWindowTitle(i18n(
"Save SeExpr Preset"));
85 const QString name(preset->name().replace(
"_",
" "));
86 newPresetNameTextField->setText(name);
87 newPresetNameTextField->setReadOnly(
true);
88 newPresetNameTextField->setEnabled(
false);
93 presetThumbnailWidget->setPixmap(QPixmap::fromImage(preset->image()));
104 dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
105 QString filename = dialog.filename();
107 if (!filename.isEmpty()) {
109 const QImage imageToLoad(filename);
111 presetThumbnailWidget->clear();
112 presetThumbnailWidget->setPixmap(QPixmap::fromImage(imageToLoad));
118 presetThumbnailWidget->setPixmap(QPixmap::fromImage(
m_currentPreset->image()));
127 src->setDefaultBounds(
bounds);
128 src->setSupportsWraparoundMode(
true);
132 QImage thumbnail = src->convertToQImage(
nullptr, 0, 0, 256, 256);
133 presetThumbnailWidget->setPixmap(QPixmap::fromImage(thumbnail));
147 const QString presetFileName =
m_currentPreset->name().split(
" ").join(
"_");
148#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
149 if (!presetThumbnailWidget->pixmap()->isNull()) {
153 if (!presetThumbnailWidget->pixmap().isNull()) {
170 const QString presetFileName = newPresetNameTextField->text().split(
" ").join(
"_");
171 newPreset->setName(newPresetNameTextField->text());
172 newPreset->setFilename(presetFileName + newPreset->defaultFileExtension());
173#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
174 if (!presetThumbnailWidget->pixmap()->isNull()) {
175 newPreset->setImage(presetThumbnailWidget->pixmap()->toImage());
178 if (!presetThumbnailWidget->pixmap().isNull()) {
179 newPreset->setImage(presetThumbnailWidget->pixmap().toImage());
183 newPreset->setValid(
true);
203#include "moc_kis_wdg_seexpr_presets_save.cpp"
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor &c, quint8 opacity)
static QStringList supportedMimeTypes(Direction direction)
The KisResourceModel class provides the main access to resources. It is possible to filter the resour...
QModelIndex indexForResourceId(int resourceId) const override
indexFromResource
static bool addResourceWithUserInput(QWidget *widgetParent, KoResourceSP resource, QString storageLocation="")
static bool updateResourceWithUserInput(QWidget *widgetParent, KoResourceSP resource)
KisFilterConfigurationSP m_currentConfiguration
void setCurrentPreset(KisSeExprScriptSP resource)
virtual ~KisWdgSeExprPresetsSave()
KisSeExprScriptSP m_currentPreset
void loadExistingThumbnail()
void resourceSelected(KoResourceSP resource)
void setCurrentRenderConfiguration(KisFilterConfigurationSP config)
bool m_useNewPresetDialog
KisWdgSeExprPresetsSave(QWidget *parent)
void renderScriptToThumbnail()
void useNewPresetDialog(bool show)
determines if we should show the save as dialog (true) or save in the background (false)
#define KIS_ASSERT_RECOVER_RETURN(cond)
QString buttons(const T &ev)
const QString SeExprScripts
The KisWrapAroundBoundsWrapper class wrapper around a KisDefaultBoundsBaseSP to enable wraparound....
static KoColorSpaceRegistry * instance()