44 , m_basePath(basePath)
45 , m_filename(filename)
46 , m_scalingMethod(scaleToImageResolution)
47 , m_scalingFilter(scalingFilter)
119 if (property.
state.toBool() ==
false) {
132 auto fileNameOrPlaceholder =
134 return !
m_filename.isEmpty() ?
m_filename : i18nc(
"placeholder test for a warning when not file is set in the file layer",
"<No file name is set>");
139 "Linked file not found: %1", fileNameOrPlaceholder()));
142 "Failed to load linked file: %1", fileNameOrPlaceholder()));
158 QFileInfo fi(
path());
186 bool fileAlreadyOpen =
false;
188 if (doc->
path()==path()){
189 fileAlreadyOpen =
true;
192 if (qEnvironmentVariableIsSet(
"KRITA_ENABLE_ASSERT_TESTS")) {
194 if (
m_filename.toLower() ==
"crash_me_with_safe_assert") {
197 if (
m_filename.toLower() ==
"crash_me_with_normal_assert") {
200 if (
m_filename.toLower() ==
"crash_me_with_qfatal") {
201 qFatal(
"Testing fatal message");
204 if (
m_filename.toLower() ==
"crash_me_with_asan") {
205#if defined(__has_feature)
206#if __has_feature(address_sanitizer)
215 int *array =
new int[10];
216 qDebug() <<
"Reading past the end of the allocated array" << array[10];
219 qDebug() <<
"ASAN is not enabled for this build!";
225 if (!fileAlreadyOpen && QFile::exists(QFileInfo(
path()).absoluteFilePath())) {
234 if (oldState != newState) {
260 qreal xRes, qreal yRes,
295 sz.scale(
image->
size(), Qt::KeepAspectRatio);
296 qreal xscale = (qreal)sz.width() / (qreal)size.width();
297 qreal yscale = (qreal)sz.height() / (qreal)size.height();
332 return node->inherits(
"KisMask");
337 return visitor.
visit(
this);
342 return visitor.
visit(
this, undoAdapter);
347 QPoint oldPos(
x(),
y());
348 QPoint newPos = oldPos -
rect.topLeft();
355 warnKrita <<
"WARNING: File Layer does not support transformations!" <<
name();
396 bool canSkipReloading =
false;
399 canSkipReloading =
true;
406 canSkipReloading =
true;
409 if (!canSkipReloading) {
VertexDescriptor get(PredecessorMap const &m, VertexDescriptor v)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
The KisFileLayer class loads a particular file as a layer into the layer stack.
bool allowAsChild(KisNodeSP) const override
void slotImageResolutionChanged()
void slotImageSizeChanged()
KisBaseNode::PropertyList sectionModelProperties() const override
ScalingMethod m_scalingMethod
void resetCache(const KoColorSpace *colorSpace=0) override
KisPaintDeviceSP original() const override
void slotFileExistsStateChanged(bool exists)
void sigRequestOpenFile()
void setImage(KisImageWSP image) override
KisPaintDeviceSP m_paintDevice
KisSafeDocumentLoader m_loader
ScalingMethod scalingMethod() const
void slotLoadingFinished(KisPaintDeviceSP projection, qreal xRes, qreal yRes, const QSize &size)
QSize m_generatedForImageSize
KisFileLayer(KisImageWSP image, const QString &name, quint8 opacity)
KisNodeSP clone() const override
QString scalingFilter() const
bool accept(KisNodeVisitor &) override
void setScalingFilter(QString method)
void setFileName(const QString &basePath, const QString &filename)
setFileName replace the existing file with a new one
void setScalingMethod(ScalingMethod method)
KUndo2Command * crop(const QRect &rect) override
KUndo2Command * transform(const QTransform &transform) override
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override
KisSignalAutoConnectionsStore m_imageConnections
KisPaintDeviceSP paintDevice() const override
QIcon icon() const override
void changeState(State newState)
static KisFilterStrategyRegistry * instance()
const KoColorSpace * colorSpace() const
static KisBaseNode::Property getColorSpaceMismatchProperty(const KoColorSpace *cs)
static KisBaseNode::Property getErrorProperty(const QString &message)
static const KoID openFileLayerFile
static KisBaseNode::Property getProperty(const KoID &id, bool state)
virtual bool visit(KisNode *node)=0
void setDefaultBounds(KisDefaultBoundsBaseSP bounds)
const KoColorSpace * colorSpace() const
void makeCloneFrom(KisPaintDeviceSP src, const QRect &rect)
static KisPart * instance()
void openExistingFile(const QString &path)
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0
void setPath(const QString &path)
void addUniqueConnection(Sender sender, Signal signal, Receiver receiver, Method method)
static bool qFuzzyCompare(half p1, half p2)
#define KIS_ASSERT_RECOVER_NOOP(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
KisSharedPtr< KisNode > KisNodeSP
QIcon loadIcon(const QString &name)
virtual void setImage(KisImageWSP image)
virtual void setSectionModelProperties(const PropertyList &properties)
KisPaintDeviceSP projection() const override
qint32 y() const override
qint32 x() const override
const KoColorSpace * colorSpace() const override
returns the image's colorSpace or null, if there is no image
KisBaseNode::PropertyList sectionModelProperties() const override
void baseNodeChangedCallback() override