Commit 681b2ab8 authored by Halla Rempt's avatar Halla Rempt
Browse files

Rename KoCanvasResourceManager::resourceChanged

Rename KoCanvasResourceManager::resourceChanged to canvasResourceChanged.
This distinguishes this signal from KoDocumentResourceManager::resourceChanged,
Plan::Project::ResourceChanged, KoAbstractResourceServerAdapter::resourceChanged
and possibly others.
parent 9c496643
......@@ -41,6 +41,8 @@ protected:
static const QRect infiniteRect;
private:
Q_DISABLE_COPY(KisDefaultBounds)
struct Private;
Private * const m_d;
};
......@@ -54,6 +56,8 @@ public:
QRect bounds() const;
private:
Q_DISABLE_COPY(KisSelectionDefaultBounds);
struct Private;
Private * const m_d;
};
......
......@@ -50,9 +50,9 @@ public:
KisPaintDeviceSP getDeviceLazy(KisPaintDeviceSP prototype) {
QMutexLocker locker(&m_lock);
if(!m_reusablePaintDevice)
if (!m_reusablePaintDevice) {
m_reusablePaintDevice = new KisPaintDevice(*prototype);
}
if(!m_projection ||
!(*m_projection->colorSpace() == *prototype->colorSpace())) {
m_projection = m_reusablePaintDevice;
......@@ -452,7 +452,6 @@ QRect KisLayer::updateProjection(const QRect& rect)
{
QRect updatedRect = rect;
KisPaintDeviceSP originalDevice = original();
if (!rect.isValid() ||
!visible() ||
!originalDevice) return QRect();
......@@ -460,6 +459,7 @@ QRect KisLayer::updateProjection(const QRect& rect)
if (!needProjection() && !hasEffectMasks()) {
m_d->safeProjection.freeDevice();
} else {
if (!updatedRect.isEmpty()) {
KisPaintDeviceSP projection =
m_d->safeProjection.getDeviceLazy(originalDevice);
......
......@@ -380,6 +380,7 @@ QRect KisPaintDevice::extent() const
extent = QRect(x, y, w, h);
quint8 defaultOpacity = colorSpace()->opacityU8(defaultPixel());
if (defaultOpacity != OPACITY_TRANSPARENT_U8)
extent |= m_d->defaultBounds->bounds();
......
......@@ -47,14 +47,13 @@ KisPaintLayer::KisPaintLayer(KisImageWSP image, const QString& name, quint8 opac
: KisLayer(image, name, opacity)
, m_d(new Private())
{
Q_ASSERT(dev);
m_d->paintDevice = dev;
m_d->paintDevice->setParentNode(this);
// fixme: overwriting the default bounds is unexpected behaviour.
// maybe something like if(dynamic_cast<KisDefaultBounds*>(dev.defaultBounds())) {..} is better.
m_d->paintDevice->setDefaultBounds(new KisDefaultBounds(image));
// maybe something like {..} is better.
//m_d->paintDevice->setDefaultBounds(new KisDefaultBounds(image));
}
......
......@@ -171,8 +171,8 @@ void KisColorSelectorBase::setCanvas(KisCanvas2 *canvas)
}
m_canvas = canvas;
if (m_canvas) {
connect(m_canvas->resourceManager(), SIGNAL(resourceChanged(int, const QVariant&)),
this, SLOT(resourceChanged(int, const QVariant&)), Qt::UniqueConnection);
connect(m_canvas->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
this, SLOT(canvasResourceChanged(int, const QVariant&)), Qt::UniqueConnection);
}
update();
......@@ -441,7 +441,7 @@ void KisColorSelectorBase::updateColorPreview(const QColor& color)
m_colorPreviewPopup->setColor(color);
}
void KisColorSelectorBase::resourceChanged(int key, const QVariant &v)
void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v)
{
if (key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) {
QColor c = findGeneratingColor(v.value<KoColor>());
......
......@@ -71,7 +71,7 @@ protected slots:
void hidePopup();
/// if you overwrite this, keep in mind, that you should set the colour only, if m_colorUpdateAllowed is true
virtual void resourceChanged(int key, const QVariant& v);
virtual void canvasResourceChanged(int key, const QVariant& v);
private:
void privateCreatePopup();
......
......@@ -135,7 +135,7 @@ void KisMinimalShadeSelector::mouseReleaseEvent(QMouseEvent * e)
KisColorSelectorBase::mouseReleaseEvent(e);
}
void KisMinimalShadeSelector::resourceChanged(int key, const QVariant &v)
void KisMinimalShadeSelector::canvasResourceChanged(int key, const QVariant &v)
{
if(m_colorUpdateAllowed==false)
return;
......
......@@ -38,7 +38,7 @@ public slots:
void mouseReleaseEvent(QMouseEvent *);
protected slots:
void resourceChanged(int key, const QVariant& v);
void canvasResourceChanged(int key, const QVariant& v);
protected:
void paintEvent(QPaintEvent *);
......
......@@ -246,7 +246,7 @@ void KisMyPaintShadeSelector::setColor(const QColor &c) {
m_updateTimer->start();
}
void KisMyPaintShadeSelector::resourceChanged(int key, const QVariant &v)
void KisMyPaintShadeSelector::canvasResourceChanged(int key, const QVariant &v)
{
if(m_colorUpdateAllowed==false)
return;
......
......@@ -41,7 +41,7 @@ public slots:
void setColor(const QColor& c);
protected slots:
void resourceChanged(int key, const QVariant& v);
void canvasResourceChanged(int key, const QVariant& v);
protected:
void paintEvent(QPaintEvent *);
......
......@@ -116,10 +116,10 @@ void ArtisticColorSelectorDock::setCanvas(KoCanvasBase* canvas)
m_canvas = canvas;
m_selectorUI->colorSelector->setFgColor(m_canvas->resourceManager()->foregroundColor().toQColor());
m_selectorUI->colorSelector->setBgColor(m_canvas->resourceManager()->backgroundColor().toQColor());
connect(m_canvas->resourceManager(), SIGNAL(resourceChanged(int, const QVariant&)), SLOT(slotResourceChanged(int, const QVariant&)));
connect(m_canvas->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)), SLOT(slotCanvasResourceChanged(int, const QVariant&)));
}
void ArtisticColorSelectorDock::slotResourceChanged(int key, const QVariant& value)
void ArtisticColorSelectorDock::slotCanvasResourceChanged(int key, const QVariant& value)
{
if(key == KoCanvasResourceManager::ForegroundColor)
m_selectorUI->colorSelector->setFgColor(value.value<KoColor>().toQColor());
......
......@@ -39,7 +39,7 @@ public:
virtual void unsetCanvas() { m_canvas = 0; }
private slots:
void slotResourceChanged(int key, const QVariant& value);
void slotCanvasResourceChanged(int key, const QVariant& value);
void slotFgColorChanged(const KisColor& color);
void slotBgColorChanged(const KisColor& color);
void slotColorSpaceSelected(int type);
......
......@@ -105,8 +105,8 @@ void DigitalMixerDock::setCanvas(KoCanvasBase * canvas)
}
m_canvas = canvas;
connect(m_canvas->resourceManager(), SIGNAL(resourceChanged(int, const QVariant&)),
this, SLOT(resourceChanged(int, const QVariant&)));
connect(m_canvas->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
this, SLOT(canvasResourceChanged(int, const QVariant&)));
m_tellCanvas=false;
setCurrentColor(m_canvas->resourceManager()->foregroundColor());
......@@ -146,7 +146,7 @@ void DigitalMixerDock::setCurrentColor(const KoColor& color)
}
}
void DigitalMixerDock::resourceChanged(int key, const QVariant& v)
void DigitalMixerDock::canvasResourceChanged(int key, const QVariant& v)
{
m_tellCanvas = false;
if (key == KoCanvasResourceManager::ForegroundColor)
......
......@@ -36,7 +36,7 @@ public:
virtual void unsetCanvas() { m_canvas = 0; }
public slots:
void setCurrentColor(const KoColor& );
void resourceChanged(int, const QVariant&);
void canvasResourceChanged(int, const QVariant&);
private slots:
void popupColorChanged(int i);
void colorSliderChanged(int i);
......
......@@ -49,8 +49,8 @@ void SmallColorSelectorDock::setCanvas(KoCanvasBase * canvas)
{
if (m_canvas) m_canvas->disconnectCanvasObserver(this);
m_canvas = canvas;
connect(m_canvas->resourceManager(), SIGNAL(resourceChanged(int, const QVariant&)),
this, SLOT(resourceChanged(int, const QVariant&)));
connect(m_canvas->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
this, SLOT(canvasResourceChanged(int, const QVariant&)));
m_smallColorWidget->setQColor(m_canvas->resourceManager()->foregroundColor().toQColor());
}
......@@ -60,7 +60,7 @@ void SmallColorSelectorDock::colorChangedProxy(const QColor& c)
m_canvas->resourceManager()->setForegroundColor(KoColor(c , KoColorSpaceRegistry::instance()->rgb8()));
}
void SmallColorSelectorDock::resourceChanged(int key, const QVariant& v)
void SmallColorSelectorDock::canvasResourceChanged(int key, const QVariant& v)
{
if (key == KoCanvasResourceManager::ForegroundColor) {
m_smallColorWidget->setQColor(v.value<KoColor>().toQColor());
......
......@@ -35,7 +35,7 @@ public:
virtual void unsetCanvas() { m_canvas = 0; }
public slots:
void colorChangedProxy(const QColor&);
void resourceChanged(int, const QVariant&);
void canvasResourceChanged(int, const QVariant&);
private:
KisSmallColorWidget* m_smallColorWidget;
KoCanvasBase* m_canvas;
......
......@@ -145,9 +145,9 @@ void KisToolCrop::deactivate()
KisTool::deactivate();
}
void KisToolCrop::resourceChanged(int key, const QVariant &res)
void KisToolCrop::canvasResourceChanged(int key, const QVariant &res)
{
KisTool::resourceChanged(key, res);
KisTool::canvasResourceChanged(key, res);
if(m_optWidget==0 || m_optWidget->cmbType==0) return;
//pixel layer
......
......@@ -74,7 +74,7 @@ public:
virtual void mouseReleaseEvent(KoPointerEvent *e);
virtual void mouseDoubleClickEvent(KoPointerEvent *e);
virtual void keyReleaseEvent(QKeyEvent* event);
virtual void resourceChanged(int key, const QVariant &res);
virtual void canvasResourceChanged(int key, const QVariant &res);
virtual void paint(QPainter &painter, const KoViewConverter &converter);
......
......@@ -80,8 +80,8 @@ void KisCanvasResourceProvider::setResourceManager(KoCanvasResourceManager *reso
m_resourceManager->setResource(HdrExposure, 0.0);
m_resourceManager->setResource(HdrGamma, 1.0);
connect(m_resourceManager, SIGNAL(resourceChanged(int,QVariant)),
this, SLOT(slotResourceChanged(int,QVariant)));
connect(m_resourceManager, SIGNAL(canvasResourceChanged(int,QVariant)),
this, SLOT(slotCanvasResourceChanged(int,QVariant)));
m_resourceManager->setResource(KoCanvasResourceManager::ApplicationSpeciality, KoCanvasResourceManager::NoAdvancedText);
}
......@@ -281,7 +281,7 @@ void KisCanvasResourceProvider::slotOnScreenResolutionChanged()
emit sigOnScreenResolutionChanged(scaleX, scaleY);
}
void KisCanvasResourceProvider::slotResourceChanged(int key, const QVariant & res)
void KisCanvasResourceProvider::slotCanvasResourceChanged(int key, const QVariant & res)
{
if(key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) {
KoAbstractGradient* resource = KoResourceServerProvider::instance()->gradientServer()->resources()[0];
......
......@@ -157,7 +157,7 @@ public slots:
private slots:
void slotResourceChanged(int key, const QVariant & res);
void slotCanvasResourceChanged(int key, const QVariant & res);
signals:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment