40 if (abstractResource) {
41 const QVariant oldValue = abstractResource->value();
42 abstractResource->setValue(
value);
48 if (oldValue !=
value) {
51 }
else if (converter) {
52 const int sourceKey = converter->sourceKey();
53 const QVariant oldSourceValue =
m_resources.value(sourceKey, QVariant());
55 bool valueChanged =
false;
56 const QVariant newSourceValue = converter->writeToSource(
value, oldSourceValue, &valueChanged);
62 if (oldSourceValue != newSourceValue) {
67 const QVariant oldValue =
m_resources.value(key, QVariant());
74 if (oldValue !=
value) {
95 QMultiHash<int, KoDerivedResourceConverterSP>::const_iterator it =
m_derivedFromSource.constFind(key);
96 QMultiHash<int, KoDerivedResourceConverterSP>::const_iterator end =
m_derivedFromSource.constEnd();
98 while (it != end && it.key() == key) {
101 if (converter->notifySourceChanged(
value)) {
117 QMultiHash<int, KoDerivedResourceConverterSP>::const_iterator it =
m_derivedFromSource.constFind(key);
118 QMultiHash<int, KoDerivedResourceConverterSP>::const_iterator end =
m_derivedFromSource.constEnd();
120 while (it != end && it.key() == key) {
131 const int sourceKey = it.value()->sourceKey();
134 QVariant sourceValue =
resource(sourceKey);
137 if (it.value()->shouldUpdateSource(sourceValue, targetValue)) {
150 if (abstractResource) {
151 return abstractResource->value();
157 const int realKey = converter ? converter->sourceKey() : key;
160 return converter ? converter->readFromSource(
value) :
value;
227 return qvariant_cast<QString>(
resource(key));
236 return qvariant_cast<QSizeF>(
resource(key));
246 const int realKey = converter ? converter->sourceKey() : key;
269 qWarning() <<
"An abstract resource with the same resource ID exists!";
320 if (it.value()->targetKey() == targetKey) {
336 if (it.value()->targetKey() == targetKey) {
348 if (it.value()->sourceKey() == sourceKey) {
368 disconnect(resourceInterface.data(), SIGNAL(sigResourceChangedExternal(
int, QVariant)),
378 qWarning() <<
"A derived resource converter with the same resource ID exists!";
380 const QVariant oldValue = this->
resource(resourceInterface->key());
384 if (oldResourceInterface) {
385 disconnect(oldResourceInterface.data(), SIGNAL(sigResourceChangedExternal(
int, QVariant)),
391 connect(resourceInterface.data(), SIGNAL(sigResourceChangedExternal(
int, QVariant)),
394 if (oldValue != resourceInterface->value()) {
float value(const T *src, size_t ch)
QSharedPointer< KoAbstractCanvasResourceInterface > KoAbstractCanvasResourceInterfaceSP
QSharedPointer< KoDerivedResourceConverter > KoDerivedResourceConverterSP
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void addDerivedResourceConverter(KoDerivedResourceConverterSP converter)
QMultiHash< int, KoActiveCanvasResourceDependencySP > m_dependencyFromSource
void removeDerivedResourceConverter(int key)
bool hasResourceUpdateMediator(int key)
void slotResourceInternalsChanged(int key)
QHash< int, KoDerivedResourceConverterSP > m_derivedResources
bool boolResource(int key) const
bool hasActiveCanvasResourceDependency(int sourceKey, int targetKey) const
bool hasResource(int key) const
void setResource(int key, const QVariant &value)
void removeResourceUpdateMediator(int key)
int intResource(int key) const
void addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator)
void removeActiveCanvasResourceDependency(int sourceKey, int targetKey)
void resourceChangeAttempted(int key, const QVariant &value)
QSizeF sizeResource(int key) const
void notifyResourceChangeAttempted(int key, const QVariant &value)
bool hasAbstractResource(int key)
QHash< int, QVariant > m_resources
QMultiHash< int, KoDerivedResourceConverterSP > m_derivedFromSource
void notifyDependenciesAboutTargetChange(int targetKey, const QVariant &value)
bool hasDerivedResourceConverter(int key)
QMultiHash< int, KoActiveCanvasResourceDependencySP > m_dependencyFromTarget
QHash< int, KoAbstractCanvasResourceInterfaceSP > m_abstractResources
void notifyDerivedResourcesChangeAttempted(int key, const QVariant &value)
void clearResource(int key)
QString stringResource(int key) const
KoColor koColorResource(int key) const
void resourceChanged(int key, const QVariant &value)
KoShape * koShapeResource(int key) const
KoUnit unitResource(int key) const
void setAbstractResource(KoAbstractCanvasResourceInterfaceSP resource)
void notifyResourceChanged(int key, const QVariant &value)
void notifyDerivedResourcesChanged(int key, const QVariant &value)
void slotAbstractResourceChangedExternal(int key, const QVariant &value)
void addActiveCanvasResourceDependency(KoActiveCanvasResourceDependencySP dep)
void removeAbstractResource(int key)
QVariant resource(int key) const
QHash< int, KoResourceUpdateMediatorSP > m_updateMediators
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)