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

« back to all changes in this revision

Viewing changes to imageplugins/transform/imageplugin_transform.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-24 00:20:43 UTC
  • mfrom: (1.2.31 upstream)
  • Revision ID: james.westby@ubuntu.com-20101024002043-y7y9fg4rvxy0obcc
Tags: 2:1.5.0-0ubuntu1
* New upstream release
  - Bump build-dependencies
  - Build against libkipi-dev 1.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
#ifdef HAVE_GLIB2
47
47
#include "contentawareresizetool.h"
48
 
#endif /* HAVE_GLIB2 */            
 
48
#endif /* HAVE_GLIB2 */
49
49
 
50
50
using namespace DigikamTransformImagePlugin;
51
51
 
52
52
K_PLUGIN_FACTORY( TransformFactory, registerPlugin<ImagePlugin_Transform>(); )
53
53
K_EXPORT_PLUGIN ( TransformFactory("digikamimageplugin_transform") )
54
54
 
 
55
class ImagePlugin_Transform::ImagePlugin_TransformPriv
 
56
{
 
57
public:
 
58
 
 
59
    ImagePlugin_TransformPriv()
 
60
    {
 
61
        aspectRatioCropAction      = 0;
 
62
        resizeAction               = 0;
 
63
        contentAwareResizingAction = 0;
 
64
        sheartoolAction            = 0;
 
65
        freerotationAction         = 0;
 
66
        perspectiveAction          = 0;
 
67
    }
 
68
 
 
69
    KAction* aspectRatioCropAction;
 
70
    KAction* resizeAction;
 
71
    KAction* contentAwareResizingAction;
 
72
    KAction* sheartoolAction;
 
73
    KAction* freerotationAction;
 
74
    KAction* perspectiveAction;
 
75
};
 
76
 
55
77
ImagePlugin_Transform::ImagePlugin_Transform(QObject* parent, const QVariantList&)
56
 
                     : ImagePlugin(parent, "ImagePlugin_Transform")
 
78
                     : ImagePlugin(parent, "ImagePlugin_Transform"),
 
79
                       d(new ImagePlugin_TransformPriv)
57
80
{
58
 
    m_perspectiveAction = new KAction(KIcon("perspective"), i18n("Perspective Adjustment..."), this);
59
 
    actionCollection()->addAction("imageplugin_perspective", m_perspectiveAction);
60
 
    connect(m_perspectiveAction, SIGNAL(triggered(bool)),
 
81
    d->perspectiveAction = new KAction(KIcon("perspective"), i18n("Perspective Adjustment..."), this);
 
82
    actionCollection()->addAction("imageplugin_perspective", d->perspectiveAction);
 
83
    connect(d->perspectiveAction, SIGNAL(triggered(bool)),
61
84
            this, SLOT(slotPerspective()));
62
85
 
63
 
    m_sheartoolAction = new KAction(KIcon("shear"), i18n("Shear..."), this);
64
 
    actionCollection()->addAction("imageplugin_sheartool", m_sheartoolAction);
65
 
    connect(m_sheartoolAction, SIGNAL(triggered(bool)),
 
86
    d->sheartoolAction = new KAction(KIcon("shear"), i18n("Shear..."), this);
 
87
    actionCollection()->addAction("imageplugin_sheartool", d->sheartoolAction);
 
88
    connect(d->sheartoolAction, SIGNAL(triggered(bool)),
66
89
            this, SLOT(slotShearTool()));
67
90
 
68
 
    m_resizeAction = new KAction(KIcon("transform-scale"), i18n("&Resize..."), this);
69
 
    actionCollection()->addAction("imageplugin_resize", m_resizeAction);
70
 
    connect(m_resizeAction, SIGNAL(triggered()),
 
91
    d->resizeAction = new KAction(KIcon("transform-scale"), i18n("&Resize..."), this);
 
92
    actionCollection()->addAction("imageplugin_resize", d->resizeAction);
 
93
    connect(d->resizeAction, SIGNAL(triggered()),
71
94
            this, SLOT(slotResize()));
72
 
            
73
 
    m_aspectRatioCropAction = new KAction(KIcon("ratiocrop"), i18n("Aspect Ratio Crop..."), this);
74
 
    actionCollection()->addAction("imageplugin_ratiocrop", m_aspectRatioCropAction);
75
 
    connect(m_aspectRatioCropAction, SIGNAL(triggered(bool) ),
76
 
            this, SLOT(slotRatioCrop()));            
77
 
            
 
95
 
 
96
    d->aspectRatioCropAction = new KAction(KIcon("ratiocrop"), i18n("Aspect Ratio Crop..."), this);
 
97
    actionCollection()->addAction("imageplugin_ratiocrop", d->aspectRatioCropAction);
 
98
    connect(d->aspectRatioCropAction, SIGNAL(triggered(bool) ),
 
99
            this, SLOT(slotRatioCrop()));
 
100
 
78
101
#ifdef HAVE_GLIB2
79
102
 
80
 
    m_contentAwareResizingAction = new KAction(KIcon("transform-scale"), i18n("Liquid Rescale..."), this);
81
 
    // m_contentAwareResizingAction->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
82
 
    actionCollection()->addAction("imageplugin_contentawareresizing", m_contentAwareResizingAction);
83
 
    connect(m_contentAwareResizingAction, SIGNAL(triggered(bool)),
 
103
    d->contentAwareResizingAction = new KAction(KIcon("transform-scale"), i18n("Liquid Rescale..."), this);
 
104
    // d->contentAwareResizingAction->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
 
105
    actionCollection()->addAction("imageplugin_contentawareresizing", d->contentAwareResizingAction);
 
106
    connect(d->contentAwareResizingAction, SIGNAL(triggered(bool)),
84
107
            this, SLOT(slotContentAwareResizing()));
85
108
 
86
 
#endif /* HAVE_GLIB2 */            
 
109
#endif /* HAVE_GLIB2 */
87
110
 
88
111
    //-----------------------------------------------------------------------------------
89
 
    
 
112
 
90
113
    QString pluginName(i18n("Free Rotation"));
91
114
 
92
115
    // we want to have an actionCategory for this plugin (if possible), set a name for it
93
116
    setActionCategory(pluginName);
94
117
 
95
 
    m_freerotationAction = new KAction(KIcon("freerotation"), QString("%1...").arg(pluginName), this);
96
 
    actionCollection()->addAction("imageplugin_freerotation", m_freerotationAction );
97
 
    connect(m_freerotationAction, SIGNAL(triggered(bool) ), 
 
118
    d->freerotationAction = new KAction(KIcon("freerotation"), QString("%1...").arg(pluginName), this);
 
119
    actionCollection()->addAction("imageplugin_freerotation", d->freerotationAction );
 
120
    connect(d->freerotationAction, SIGNAL(triggered(bool) ), 
98
121
            this, SLOT(slotFreeRotation()));
99
122
 
100
123
    KAction* point1Action = new KAction(i18n("Set Point 1"), this);
122
145
 
123
146
ImagePlugin_Transform::~ImagePlugin_Transform()
124
147
{
 
148
    delete d;
125
149
}
126
150
 
127
151
void ImagePlugin_Transform::setEnabledActions(bool b)
128
152
{
129
 
    m_resizeAction->setEnabled(b);
130
 
    m_perspectiveAction->setEnabled(b);
131
 
    m_freerotationAction->setEnabled(b);
132
 
    m_sheartoolAction->setEnabled(b);
133
 
    m_aspectRatioCropAction->setEnabled(b);
134
 
    
 
153
    d->resizeAction->setEnabled(b);
 
154
    d->perspectiveAction->setEnabled(b);
 
155
    d->freerotationAction->setEnabled(b);
 
156
    d->sheartoolAction->setEnabled(b);
 
157
    d->aspectRatioCropAction->setEnabled(b);
 
158
 
135
159
#ifdef HAVE_GLIB2
136
 
    m_contentAwareResizingAction->setEnabled(b);
137
 
#endif /* HAVE_GLIB2 */            
 
160
    d->contentAwareResizingAction->setEnabled(b);
 
161
#endif /* HAVE_GLIB2 */
138
162
}
139
163
 
140
164
void ImagePlugin_Transform::slotPerspective()
166
190
#ifdef HAVE_GLIB2
167
191
    ContentAwareResizeTool* tool = new ContentAwareResizeTool(this);
168
192
    loadTool(tool);
169
 
#endif /* HAVE_GLIB2 */            
 
193
#endif /* HAVE_GLIB2 */
170
194
}
171
195
 
172
196
void ImagePlugin_Transform::slotFreeRotation()