Commit 9cc0f1b9 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Move current preset handling to KisCanvasResourceProvider

parent ae4ff6f2
......@@ -169,6 +169,41 @@ KisPaintOpPresetSP KisCanvasResourceProvider::currentPreset() const
return preset;
}
void KisCanvasResourceProvider::setPaintOpPreset(const KisPaintOpPresetSP preset)
{
Q_ASSERT(preset->valid());
Q_ASSERT(!preset->paintOp().id().isEmpty());
Q_ASSERT(preset->settings());
if (!preset) return;
dbgUI << "setPaintOpPreset" << preset->paintOp();
QVariant v;
v.setValue(preset);
m_resourceManager->setResource(CurrentPaintOpPreset, v);
}
KisPaintOpPresetSP KisCanvasResourceProvider::previousPreset() const
{
KisPaintOpPresetSP preset = m_resourceManager->resource(PreviousPaintOpPreset).value<KisPaintOpPresetSP>();
return preset;
}
void KisCanvasResourceProvider::setPreviousPaintOpPreset(const KisPaintOpPresetSP preset)
{
Q_ASSERT(preset->valid());
Q_ASSERT(!preset->paintOp().id().isEmpty());
Q_ASSERT(preset->settings());
if (!preset) return;
dbgUI << "setPreviousPaintOpPreset" << preset->paintOp();
QVariant v;
v.setValue(preset);
m_resourceManager->setResource(PreviousPaintOpPreset, v);
}
void KisCanvasResourceProvider::slotPatternActivated(KoResource * res)
{
......@@ -194,19 +229,6 @@ void KisCanvasResourceProvider::slotGradientActivated(KoResource *res)
emit sigGradientChanged(gradient);
}
void KisCanvasResourceProvider::setPaintOpPreset(const KisPaintOpPresetSP preset)
{
Q_ASSERT(preset->valid());
Q_ASSERT(!preset->paintOp().id().isEmpty());
Q_ASSERT(preset->settings());
if (!preset) return;
dbgUI << "setPaintOpPreset" << preset->paintOp();
QVariant v;
v.setValue(preset);
m_resourceManager->setResource(CurrentPaintOpPreset, v);
}
void KisCanvasResourceProvider::setBGColor(const KoColor& c)
{
......
......@@ -65,7 +65,8 @@ public:
MirrorAxisCenter,
Opacity,
HdrGamma,
GlobalAlphaLock
GlobalAlphaLock,
PreviousPaintOpPreset
};
......@@ -103,6 +104,9 @@ public:
KisPaintOpPresetSP currentPreset() const;
void setPaintOpPreset(const KisPaintOpPresetSP preset);
KisPaintOpPresetSP previousPreset() const;
void setPreviousPaintOpPreset(const KisPaintOpPresetSP preset);
KisFilterConfiguration* currentGeneratorConfiguration() const;
void setCurrentCompositeOp(const QString& compositeOp);
......
This diff is collapsed.
......@@ -100,7 +100,6 @@ public slots:
private:
KisPaintOpPresetSP paintOpPresetSP(KoID * = 0);
KoID currentPaintop();
void setCurrentPaintop(const KoID& paintop, KisPaintOpPresetSP preset=0);
QPixmap paintopPixmap(const KoID& paintop);
......@@ -155,8 +154,8 @@ private:
KisWidgetChooser* m_sliderChooser[2];
QMap<KoID,KisPaintOpSettingsWidget*> m_paintopOptionWidgets;
KisPaintOpPresetSP m_activePreset;
KisPaintOpPresetSP m_previousPreset;
// KisPaintOpPresetSP m_activePreset;
// KisPaintOpPresetSP m_previousPreset;
QString m_prevCompositeOpID;
QString m_currCompositeOpID;
KisNodeSP m_previousNode;
......
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