Commit a9e39f7c authored by Sven Langkamp's avatar Sven Langkamp

add ability to select and use presets

svn path=/trunk/koffice/; revision=1078119
parent 8bac8133
......@@ -46,6 +46,7 @@
#include <kis_paintop.h>
#include <kis_layer.h>
#include <kis_resource_server_provider.h>
#include <kis_paintop_preset.h>
#include <kis_paintop_settings.h>
#include <kis_config_widget.h>
#include <kis_image.h>
......@@ -109,6 +110,9 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
connect(m_cmbPaintops, SIGNAL(activated(int)), this, SLOT(slotItemSelected(int)));
connect(m_presetsPopup, SIGNAL(savePresetClicked()), this, SLOT(slotSaveActivePreset()));
connect(m_presetsPopup, SIGNAL(resourceSelected(KoResource*)),
this, SLOT(resourceSelected(KoResource*)));
}
KisPaintopBox::~KisPaintopBox()
......@@ -175,6 +179,15 @@ void KisPaintopBox::updatePaintops()
}
void KisPaintopBox::resourceSelected(KoResource* resource)
{
KisPaintOpPreset* preset = static_cast<KisPaintOpPreset*>(resource);
dbgUI << "preset " << preset->name() << "selected";
m_optionWidget->setConfiguration(preset->settings());
slotUpdatePreset();
}
QPixmap KisPaintopBox::paintopPixmap(const KoID & paintop)
{
QString pixmapName = KisPaintOpRegistry::instance()->pixmap(paintop);
......
......@@ -39,6 +39,7 @@ class QHBoxLayout;
class KoID;
class KoColorSpace;
class KoResourceSelector;
class KoResource;
class KisView2;
class KisCanvasResourceProvider;
......@@ -89,6 +90,7 @@ private:
private slots:
void updatePaintops();
void resourceSelected( KoResource * resource );
private:
......
......@@ -29,6 +29,7 @@
#include <kglobalsettings.h>
#include <kis_paintop_preset.h>
#include <widgets/kis_preset_widget.h>
#include <widgets/kis_preset_chooser.h>
#include <ui_wdgpaintoppresets.h>
......@@ -73,6 +74,9 @@ KisPaintOpPresetsPopup::KisPaintOpPresetsPopup(QWidget * parent)
connect(m_d->uiWdgPaintOpPresets.bnSave, SIGNAL(clicked()),
this, SIGNAL(savePresetClicked()));
connect(m_d->uiWdgPaintOpPresets.wdgPresetChooser, SIGNAL(resourceSelected(KoResource*)),
this, SIGNAL(resourceSelected(KoResource*)));
}
......
......@@ -22,6 +22,7 @@
#include <QWidget>
class QString;
class KoResource;
class KisPaintOpPreset;
class KisPropertiesConfiguration;
class KisPresetWidget;
......@@ -54,6 +55,7 @@ public:
QString getPresetName() const;
signals:
void savePresetClicked();
void resourceSelected( KoResource * resource );
private:
......
......@@ -81,7 +81,9 @@ KisPresetChooser::KisPresetChooser(QWidget *parent, const char *name)
m_chooser->setRowHeight(60);
m_chooser->setItemDelegate(new KisPresetDelegate(this));
layout->addWidget(m_chooser);
connect(m_chooser, SIGNAL(resourceSelected(KoResource*)),
this, SIGNAL(resourceSelected(KoResource*)));
}
KisPresetChooser::~KisPresetChooser()
......
......@@ -18,15 +18,11 @@
#ifndef KIS_ITEM_CHOOSER_H_
#define KIS_ITEM_CHOOSER_H_
#include <QList>
#include <QWidget>
#include <kvbox.h>
#include <krita_export.h>
class KHBox;
class KoResourceItemChooser;
class KoResourceItem;
class KoResource;
/**
* A special type of item chooser that can contain extra widgets that show
......@@ -43,6 +39,8 @@ public:
KisPresetChooser(QWidget *parent = 0, const char *name = 0);
virtual ~KisPresetChooser();
signals:
void resourceSelected( KoResource * resource );
private:
KoResourceItemChooser *m_chooser;
......
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