~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to imageplugins/filters/imageplugin_fxfilters.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2010-04-09 21:30:01 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100409213001-4bfyibrd359rn7o3
Tags: 2:1.2.0-0ubuntu1
* New upstream release (LP: #560576)
* Remove all patches, fixed upstream
  - Remove quilt build-depend

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2004-02-14
 
7
 * Description : a digiKam image plugin to apply special effects.
 
8
 *
 
9
 * Copyright (C) 2004-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 *
 
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)
 
15
 * any later version.
 
16
 *
 
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.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
#include "imageplugin_fxfilters.moc"
 
25
 
 
26
// KDE includes
 
27
 
 
28
#include <klocale.h>
 
29
#include <kgenericfactory.h>
 
30
#include <klibloader.h>
 
31
#include <kaction.h>
 
32
#include <kactioncollection.h>
 
33
#include <kapplication.h>
 
34
#include <kdebug.h>
 
35
 
 
36
// Local includes
 
37
 
 
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"
 
46
 
 
47
using namespace DigikamFxFiltersImagePlugin;
 
48
 
 
49
K_PLUGIN_FACTORY( FxFiltersFactory, registerPlugin<ImagePlugin_FxFilters>(); )
 
50
K_EXPORT_PLUGIN ( FxFiltersFactory("digikamimageplugin_fxfilters") )
 
51
 
 
52
ImagePlugin_FxFilters::ImagePlugin_FxFilters(QObject* parent, const QVariantList&)
 
53
                     : ImagePlugin(parent, "ImagePlugin_FxFilters")
 
54
{
 
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()));
 
59
 
 
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()));
 
64
 
 
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()));
 
69
 
 
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()));
 
74
 
 
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()));
 
79
 
 
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()));
 
84
 
 
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()));
 
89
            
 
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()));            
 
94
 
 
95
    setXMLFile( "digikamimageplugin_fxfilters_ui.rc" );
 
96
 
 
97
    kDebug() << "ImagePlugin_FxFilters plugin loaded";
 
98
}
 
99
 
 
100
ImagePlugin_FxFilters::~ImagePlugin_FxFilters()
 
101
{
 
102
}
 
103
 
 
104
void ImagePlugin_FxFilters::setEnabledActions(bool b)
 
105
{
 
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);    
 
114
}
 
115
 
 
116
void ImagePlugin_FxFilters::slotColorEffects()
 
117
{
 
118
    ColorFxTool* tool = new ColorFxTool(this);
 
119
    loadTool(tool);
 
120
}
 
121
 
 
122
void ImagePlugin_FxFilters::slotCharcoal()
 
123
{
 
124
    CharcoalTool* tool = new CharcoalTool(this);
 
125
    loadTool(tool);
 
126
}
 
127
 
 
128
void ImagePlugin_FxFilters::slotEmboss()
 
129
{
 
130
    EmbossTool* tool = new EmbossTool(this);
 
131
    loadTool(tool);
 
132
}
 
133
 
 
134
void ImagePlugin_FxFilters::slotOilPaint()
 
135
{
 
136
    OilPaintTool* tool = new OilPaintTool(this);
 
137
    loadTool(tool);
 
138
}
 
139
 
 
140
void ImagePlugin_FxFilters::slotBlurFX()
 
141
{
 
142
    BlurFXTool* tool = new BlurFXTool(this);
 
143
    loadTool(tool);
 
144
}
 
145
 
 
146
void ImagePlugin_FxFilters::slotDistortionFX()
 
147
{
 
148
    DistortionFXTool* tool = new DistortionFXTool(this);
 
149
    loadTool(tool);
 
150
}
 
151
 
 
152
void ImagePlugin_FxFilters::slotRainDrop()
 
153
{
 
154
    RainDropTool* tool = new RainDropTool(this);
 
155
    loadTool(tool);
 
156
}
 
157
 
 
158
void ImagePlugin_FxFilters::slotFilmGrain()
 
159
{
 
160
    FilmGrainTool* tool = new FilmGrainTool(this);
 
161
    loadTool(tool);
 
162
}