Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLockedPropertiesProxy Class Reference

#include <kis_locked_properties_proxy.h>

+ Inheritance diagram for KisLockedPropertiesProxy:

Public Member Functions

void dump () const override
 
QList< QString > getPropertiesKeys () const override
 
virtual QVariant getProperty (const QString &name) const
 
QVariant getProperty (const QString &name) const override
 
virtual bool getProperty (const QString &name, QVariant &value) const
 
bool hasProperty (const QString &name) const override
 
 KisLockedPropertiesProxy (KisPropertiesConfiguration *, KisLockedPropertiesSP)
 
void setProperty (const QString &name, const QStringList &value)
 
virtual void setProperty (const QString &name, const QVariant &value)
 
void setProperty (const QString &name, const QVariant &value) override
 
 ~KisLockedPropertiesProxy () override
 
- Public Member Functions inherited from KisPropertiesConfiguration
void clearProperties ()
 Clear the map of properties.
 
virtual bool compareTo (const KisPropertiesConfiguration *rhs) const
 
void fromXML (const QDomElement &) override
 
bool fromXML (const QString &xml, bool clear=true) override
 
bool getBool (const QString &name, bool def=false) const
 
KoColor getColor (const QString &name, const KoColor &color=KoColor()) const
 getColor fetch the given property as a KoColor.
 
KisCubicCurve getCubicCurve (const QString &name, const KisCubicCurve &curve=KisCubicCurve()) const
 
double getDouble (const QString &name, double def=0.0) const
 
float getFloat (const QString &name, float def=0.0) const
 
int getInt (const QString &name, int def=0) const
 
void getPrefixedProperties (const QString &prefix, KisPropertiesConfiguration *config) const
 
void getPrefixedProperties (const QString &prefix, KisPropertiesConfigurationSP config) const
 
virtual QMap< QString, QVariant > getProperties () const
 
QString getPropertyLazy (const QString &name, const char *defaultValue) const
 
QStringList getPropertyLazy (const QString &name, const QStringList &defaultValue) const
 
template<typename T >
getPropertyLazy (const QString &name, const T &defaultValue) const
 
QString getString (const QString &name, const QString &def=QString()) const
 
QStringList getStringList (const QString &name, const QStringList &defaultValue=QStringList()) const
 
 KisPropertiesConfiguration ()
 
 KisPropertiesConfiguration (const KisPropertiesConfiguration &rhs)
 
KisPropertiesConfigurationoperator= (const KisPropertiesConfiguration &rhs)
 
void removeProperty (const QString &name)
 
void setPrefixedProperties (const QString &prefix, const KisPropertiesConfiguration *config)
 
void setPrefixedProperties (const QString &prefix, const KisPropertiesConfigurationSP config)
 
void setProperty (const QString &name, const QStringList &value)
 
void setPropertyNotSaved (const QString &name)
 Marks a property that should not be saved by toXML.
 
QString toXML () const override
 
void toXML (QDomDocument &, QDomElement &) const override
 
 ~KisPropertiesConfiguration () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisSerializableConfiguration
 KisSerializableConfiguration ()
 
 KisSerializableConfiguration (const KisSerializableConfiguration &rhs)
 
virtual ~KisSerializableConfiguration ()
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Private Attributes

KisLockedPropertiesSP m_lockedProperties
 
KisPropertiesConfigurationm_parent
 

Additional Inherited Members

- Static Public Member Functions inherited from KisPropertiesConfiguration
static QString escapeString (const QString &string)
 
static QString extractedPrefixKey ()
 
static QString unescapeString (const QString &string)
 
- Public Attributes inherited from KisPropertiesConfiguration
QSet< QString > notSavedProperties
 
QMap< QString, QVariant > properties
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Detailed Description

Definition at line 26 of file kis_locked_properties_proxy.h.

Constructor & Destructor Documentation

◆ KisLockedPropertiesProxy()

KisLockedPropertiesProxy::KisLockedPropertiesProxy ( KisPropertiesConfiguration * p,
KisLockedPropertiesSP l )

Definition at line 18 of file kis_locked_properties_proxy.cpp.

19{
20 m_parent = p;
22}
const Params2D p
KisPropertiesConfiguration * m_parent
KisLockedPropertiesSP m_lockedProperties

References m_lockedProperties, m_parent, and p.

◆ ~KisLockedPropertiesProxy()

KisLockedPropertiesProxy::~KisLockedPropertiesProxy ( )
override

Definition at line 24 of file kis_locked_properties_proxy.cpp.

25{
26}

Member Function Documentation

◆ dump()

void KisLockedPropertiesProxy::dump ( ) const
overridevirtual

Reimplemented from KisPropertiesConfiguration.

Definition at line 121 of file kis_locked_properties_proxy.cpp.

122{
123 qDebug() << "=== KisLockedPropertiesProxy::dump() ===";
124 qDebug() << "parent properties:";
125 m_parent->dump();
126
128 qDebug() << "locked properties:";
130 }
131}
KisPropertiesConfigurationSP lockedProperties()

References KisPropertiesConfiguration::dump(), KisLockedProperties::lockedProperties(), m_lockedProperties, and m_parent.

◆ getPropertiesKeys()

QList< QString > KisLockedPropertiesProxy::getPropertiesKeys ( ) const
overridevirtual

Get the keys of all the properties in the object

Reimplemented from KisPropertiesConfiguration.

Definition at line 102 of file kis_locked_properties_proxy.cpp.

103{
106 if (!t->updateListener()) return m_parent->getPropertiesKeys();
107
109
110 if (m_lockedProperties->lockedProperties() && !m_lockedProperties->lockedProperties()->getPropertiesKeys().isEmpty()) {
111 QSet<QString> properties(result.begin(), result.end());
112 auto lockedPropertiesKeys = m_lockedProperties->lockedProperties()->getPropertiesKeys();
113 QSet<QString> lockedProperties(lockedPropertiesKeys.begin(), lockedPropertiesKeys.end());
114 properties += lockedProperties;
115 result = QList<QString>(properties.begin(), properties.end()) ;
116 }
117
118 return result;
119}
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129
UpdateListenerWSP updateListener
virtual QList< QString > getPropertiesKeys() const

References KisPropertiesConfiguration::getPropertiesKeys(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KisLockedProperties::lockedProperties(), m_lockedProperties, m_parent, KisPropertiesConfiguration::properties, and KisPaintOpSettings::updateListener.

◆ getProperty() [1/3]

QVariant KisPropertiesConfiguration::getProperty ( const QString & name) const
virtual

Reimplemented from KisPropertiesConfiguration.

Definition at line 103 of file kis_properties_configuration.cc.

162{
163 return d->properties.value(name, QVariant());
164}

◆ getProperty() [2/3]

QVariant KisLockedPropertiesProxy::getProperty ( const QString & name) const
overridevirtual

Reimplemented from KisPropertiesConfiguration.

Definition at line 28 of file kis_locked_properties_proxy.cpp.

29{
32 if (!t->updateListener()) return m_parent->getProperty(name);
33
34 // restores the dirty state on returns automagically
35 KisPaintOpSettings::UpdateListenerSP updateProxy = t->updateListener().toStrongRef();
37
39 if (m_lockedProperties->lockedProperties()->hasProperty(name)) {
41
42 if (!m_parent->hasProperty(name + "_previous")) {
43 m_parent->setProperty(name + "_previous", m_parent->getProperty(name));
44 m_parent->setPropertyNotSaved(name + "_previous");
45 }
46
47 const QVariant lockedProp = m_lockedProperties->lockedProperties()->getProperty(name);
48
49 if (m_parent->getProperty(name) != lockedProp) {
50 m_parent->setProperty(name, lockedProp);
51 }
52
53 return lockedProp;
54 } else {
55 if (m_parent->hasProperty(name + "_previous")) {
56 m_parent->setProperty(name, m_parent->getProperty(name + "_previous"));
57 m_parent->removeProperty(name + "_previous");
58 }
59 }
60 }
61
62 return m_parent->getProperty(name);
63}
static KisLockedPropertiesServer * instance()
void setPropertyNotSaved(const QString &name)
Marks a property that should not be saved by toXML.
virtual bool hasProperty(const QString &name) const
virtual void setProperty(const QString &name, const QVariant &value)
virtual bool getProperty(const QString &name, QVariant &value) const

References KisPropertiesConfiguration::getProperty(), KisPropertiesConfiguration::hasProperty(), KisLockedPropertiesServer::instance(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KisLockedProperties::lockedProperties(), m_lockedProperties, m_parent, KisPropertiesConfiguration::removeProperty(), KisLockedPropertiesServer::setPropertiesFromLocked(), KisPropertiesConfiguration::setProperty(), KisPropertiesConfiguration::setPropertyNotSaved(), and KisPaintOpSettings::updateListener.

◆ getProperty() [3/3]

bool KisPropertiesConfiguration::getProperty ( const QString & name,
QVariant & value ) const
virtual

Set value to the value associated with property name

XXX: API alert: a setter that is prefixed with get?

Returns
false if the specified property did not exist.

Reimplemented from KisPropertiesConfiguration.

Definition at line 101 of file kis_properties_configuration.cc.

152{
153 if (d->properties.constFind(name) == d->properties.constEnd()) {
154 return false;
155 } else {
156 value = d->properties.value(name);
157 return true;
158 }
159}
float value(const T *src, size_t ch)

◆ hasProperty()

bool KisLockedPropertiesProxy::hasProperty ( const QString & name) const
overridevirtual

◆ setProperty() [1/3]

void KisPropertiesConfiguration::setProperty ( const QString & name,
const QStringList & value )

Definition at line 193 of file kis_properties_configuration.cc.

392{
393 QStringList escapedList;
394 escapedList.reserve(value.size());
395
396 Q_FOREACH (const QString &str, value) {
397 escapedList << escapeString(str);
398 }
399
400 setProperty(name, escapedList.join(';'));
401}
void setProperty(const QString &name, const QVariant &value) override
static QString escapeString(const QString &string)

◆ setProperty() [2/3]

void KisPropertiesConfiguration::setProperty ( const QString & name,
const QVariant & value )
virtual

Set the property with name to value.

Reimplemented from KisPropertiesConfiguration.

Definition at line 92 of file kis_properties_configuration.cc.

143{
144 if (d->properties.find(name) == d->properties.end()) {
145 d->properties.insert(name, value);
146 } else {
147 d->properties[name] = value;
148 }
149}
const char * name(StandardAction id)

◆ setProperty() [3/3]

void KisLockedPropertiesProxy::setProperty ( const QString & name,
const QVariant & value )
overridevirtual

Set the property with name to value.

Reimplemented from KisPropertiesConfiguration.

Definition at line 65 of file kis_locked_properties_proxy.cpp.

66{
69 if (!t->updateListener()) return;
70
72 if (m_lockedProperties->lockedProperties()->hasProperty(name)) {
73 m_lockedProperties->lockedProperties()->setProperty(name, value);
75
76 if (!m_parent->hasProperty(name + "_previous")) {
77 // restores the dirty state on returns automagically
78 KisPaintOpSettings::UpdateListenerSP updateProxy = t->updateListener().toStrongRef();
80 m_parent->setProperty(name + "_previous", m_parent->getProperty(name));
81 m_parent->setPropertyNotSaved(name + "_previous");
82 }
83 return;
84 }
85 }
86
88}
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References KisPropertiesConfiguration::getProperty(), KisPropertiesConfiguration::hasProperty(), KIS_SAFE_ASSERT_RECOVER_RETURN, KisLockedProperties::lockedProperties(), m_lockedProperties, m_parent, KisPropertiesConfiguration::setProperty(), KisPropertiesConfiguration::setPropertyNotSaved(), KisPaintOpSettings::updateListener, and value().

Member Data Documentation

◆ m_lockedProperties

KisLockedPropertiesSP KisLockedPropertiesProxy::m_lockedProperties
mutableprivate

Definition at line 45 of file kis_locked_properties_proxy.h.

◆ m_parent

KisPropertiesConfiguration* KisLockedPropertiesProxy::m_parent
private

Definition at line 46 of file kis_locked_properties_proxy.h.


The documentation for this class was generated from the following files: