1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : a digiKam image plugin to apply special effects.
9
* Copyright (C) 2004-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
#include "imageplugin_fxfilters.moc"
29
#include <kgenericfactory.h>
30
#include <klibloader.h>
32
#include <kactioncollection.h>
33
#include <kapplication.h>
38
#include "colorfxtool.h"
39
#include "charcoaltool.h"
40
#include "embosstool.h"
41
#include "oilpainttool.h"
42
#include "blurfxtool.h"
43
#include "distortionfxtool.h"
44
#include "raindroptool.h"
45
#include "filmgraintool.h"
47
using namespace DigikamFxFiltersImagePlugin;
49
K_PLUGIN_FACTORY( FxFiltersFactory, registerPlugin<ImagePlugin_FxFilters>(); )
50
K_EXPORT_PLUGIN ( FxFiltersFactory("digikamimageplugin_fxfilters") )
52
ImagePlugin_FxFilters::ImagePlugin_FxFilters(QObject* parent, const QVariantList&)
53
: ImagePlugin(parent, "ImagePlugin_FxFilters")
55
m_colorEffectsAction = new KAction(KIcon("colorfx"), i18n("Color Effects..."), this);
56
actionCollection()->addAction("imageplugin_colorfx", m_colorEffectsAction);
57
connect(m_colorEffectsAction, SIGNAL(triggered(bool) ),
58
this, SLOT(slotColorEffects()));
60
m_charcoalAction = new KAction(KIcon("charcoaltool"), i18n("Charcoal Drawing..."), this);
61
actionCollection()->addAction("imageplugin_charcoal", m_charcoalAction);
62
connect(m_charcoalAction, SIGNAL(triggered(bool)),
63
this, SLOT(slotCharcoal()));
65
m_embossAction = new KAction(KIcon("embosstool"), i18n("Emboss..."), this);
66
actionCollection()->addAction("imageplugin_emboss", m_embossAction);
67
connect(m_embossAction, SIGNAL(triggered(bool)),
68
this, SLOT(slotEmboss()));
70
m_oilpaintAction = new KAction(KIcon("oilpaint"), i18n("Oil Paint..."), this);
71
actionCollection()->addAction("imageplugin_oilpaint", m_oilpaintAction);
72
connect(m_oilpaintAction, SIGNAL(triggered(bool) ),
73
this ,SLOT(slotOilPaint()));
75
m_blurfxAction = new KAction(KIcon("blurfx"), i18n("Blur Effects..."), this);
76
actionCollection()->addAction("imageplugin_blurfx", m_blurfxAction);
77
connect(m_blurfxAction, SIGNAL(triggered(bool)),
78
this, SLOT(slotBlurFX()));
80
m_distortionfxAction = new KAction(KIcon("distortionfx"), i18n("Distortion Effects..."), this);
81
actionCollection()->addAction("imageplugin_distortionfx", m_distortionfxAction );
82
connect(m_distortionfxAction, SIGNAL(triggered(bool) ),
83
this, SLOT(slotDistortionFX()));
85
m_raindropAction = new KAction(KIcon("raindrop"), i18n("Raindrops..."), this);
86
actionCollection()->addAction("imageplugin_raindrop", m_raindropAction);
87
connect(m_raindropAction, SIGNAL(triggered(bool) ),
88
this, SLOT(slotRainDrop()));
90
m_filmgrainAction = new KAction(KIcon("filmgrain"), i18n("Add Film Grain..."), this);
91
actionCollection()->addAction("imageplugin_filmgrain", m_filmgrainAction);
92
connect(m_filmgrainAction, SIGNAL(triggered(bool)),
93
this, SLOT(slotFilmGrain()));
95
setXMLFile( "digikamimageplugin_fxfilters_ui.rc" );
97
kDebug() << "ImagePlugin_FxFilters plugin loaded";
100
ImagePlugin_FxFilters::~ImagePlugin_FxFilters()
104
void ImagePlugin_FxFilters::setEnabledActions(bool b)
106
m_charcoalAction->setEnabled(b);
107
m_colorEffectsAction->setEnabled(b);
108
m_embossAction->setEnabled(b);
109
m_oilpaintAction->setEnabled(b);
110
m_blurfxAction->setEnabled(b);
111
m_distortionfxAction->setEnabled(b);
112
m_raindropAction->setEnabled(b);
113
m_filmgrainAction->setEnabled(b);
116
void ImagePlugin_FxFilters::slotColorEffects()
118
ColorFxTool* tool = new ColorFxTool(this);
122
void ImagePlugin_FxFilters::slotCharcoal()
124
CharcoalTool* tool = new CharcoalTool(this);
128
void ImagePlugin_FxFilters::slotEmboss()
130
EmbossTool* tool = new EmbossTool(this);
134
void ImagePlugin_FxFilters::slotOilPaint()
136
OilPaintTool* tool = new OilPaintTool(this);
140
void ImagePlugin_FxFilters::slotBlurFX()
142
BlurFXTool* tool = new BlurFXTool(this);
146
void ImagePlugin_FxFilters::slotDistortionFX()
148
DistortionFXTool* tool = new DistortionFXTool(this);
152
void ImagePlugin_FxFilters::slotRainDrop()
154
RainDropTool* tool = new RainDropTool(this);
158
void ImagePlugin_FxFilters::slotFilmGrain()
160
FilmGrainTool* tool = new FilmGrainTool(this);