18#include <QDialogButtonBox>
20#include <kstandardguiitem.h>
66 setWindowTitle(caption);
68 QVBoxLayout* layout =
new QVBoxLayout();
69 QHBoxLayout* hLayout =
new QHBoxLayout();
73 m_preview->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
75 m_preview->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
80 QLabel* sourceLabel =
new QLabel(i18nc(
"@label:listbox image source",
"Source:"));
81 hLayout->addWidget(sourceLabel);
83 QComboBox* sourceBox =
new QComboBox();
84 sourceBox->addItem(i18nc(
"@item:inlistbox",
"Image"),
Source::Image);
86 hLayout->addWidget(sourceBox);
88 QPushButton* reloadButton =
new QPushButton(i18nc(
"@action:button reload image",
"Reload"));
89 hLayout->addWidget(reloadButton);
91 layout->addLayout(hLayout);
93 const QString mimetype =
"image/x-gimp-brush";
96 m_brushWidget = filter->createConfigurationWidget(0, 0, mimetype.toLatin1());
99 const QString animMimetype =
"image/x-gimp-brush-animated";
102 m_animBrushWidget = animFilter->createConfigurationWidget(0, 0, animMimetype.toLatin1());
110 m_buttonBox =
new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
111 KGuiItem::assign(
m_buttonBox->button(QDialogButtonBox::Save), KStandardGuiItem::save());
112 KGuiItem::assign(
m_buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
114 connect(
m_buttonBox, SIGNAL(accepted()),
this, SLOT(accept()));
115 connect(
m_buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
120 connect(reloadButton, SIGNAL(clicked()),
this, SLOT(
slotReload()));
166 return QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
"/" + name.split(
" ").join(
"_") + suffix;
172 if (!mainWin) {
return nullptr; }
174 if (!viewManager) {
return nullptr; }
178 return viewManager->
image();
242 static_cast<KisGbrBrush*
>(brush.data())->makeMaskImage(preserveAlpha);
247 brushImage = brush->brushTipImage();
250 if (brushImage.isNull()) {
251 m_preview->setText(i18nc(
"@info empty image",
"Empty"));
254 brushImage = brushImage.scaled(w, w, Qt::KeepAspectRatio);
255 m_preview->setPixmap(QPixmap::fromImage(brushImage));
273 if (!needsUpdate) {
return; }
277 if (QFileInfo(exportFilename).exists()) {
278 m_buttonBox->button(QDialogButtonBox::Save)->setText(i18nc(
"@action:button",
"Overwrite"));
280 m_buttonBox->button(QDialogButtonBox::Save)->setText(i18nc(
"@action:button",
"Save"));
358 for (qint32 y = r.top(); y <= r.bottom(); ++y) {
361 }
while (pixelIt->nextPixel() && maskIt->
nextPixel());
380 KisImageReadOnlyBarrierLock lock(image);
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
QList< QString > QStringList
const QString KEY_BRUSH_STYLE
const QString KEY_PRESERVE_ALPHA
const quint8 OPACITY_OPAQUE_U8
virtual const quint8 * oldRawData() const =0
virtual bool nextPixel()=0
static KisBrushServerProvider * instance()
KoResourceServer< KisBrush > * brushServer()
static KisClipboard * instance()
KisImageSP clipImage(bool showPopup, int overridePasteBehaviour=-1) const
void setFileBatchMode(const bool batchMode)
bool exportDocumentSync(const QString &path, const QByteArray &mimeType, KisPropertiesConfigurationSP exportConfiguration=0)
void setCurrentImage(KisImageSP image, bool forceInitialUpdate=true, KisNodeSP preActivatedNode=nullptr)
const KoColorSpace * colorSpace() const
void barrierLock(bool readOnly=false)
Wait until all the queued background jobs are completed and lock the image.
KisPaintDeviceSP projection() const
KisSelectionSP globalSelection() const
static KisImportExportFilter * filterForMimeType(const QString &mimetype, Direction direction)
filterForMimeType loads the relevant import/export plugin and returns it. The caller is responsible f...
KisViewManager * viewManager
void crop(qint32 x, qint32 y, qint32 w, qint32 h)
QRect exactBounds() const
KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w)
const KoColorSpace * colorSpace() const
static KisPart * instance()
KisMainWindow * currentMainwindow() const
KisDocument * createTemporaryDocument() const
static KoResourceSP importResourceFileWithUserInput(QWidget *widgetParent, QString storageLocation, QString resourceType, QString resourceFilepath)
KisImageWSP image() const
Return the image this view is displaying.
virtual void applyAlphaU8Mask(quint8 *pixels, const quint8 *alpha, qint32 nPixels) const =0
void setProperty(const QString &name, const QVariant &value)
QString saveLocation()
Returns path where to save user defined and imported resources to.
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
QSharedPointer< KisBrush > KisBrushSP
virtual KisPaintDeviceSP projection() const =0
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
QList< KisNodeSP > childNodes(const QStringList &nodeTypes, const KoProperties &properties) const
KisPixelSelectionSP projection() const
QRect selectedExactRect() const
Slow, but exact way of determining the rectangle that encloses the selection.