~ubuntu-branches/ubuntu/maverick/digikam/maverick

« back to all changes in this revision

Viewing changes to imageplugins/perspective/perspectivetool.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luka Renko
  • Date: 2009-03-17 23:07:56 UTC
  • mfrom: (1.2.20 upstream) (3.1.4 experimental)
  • Revision ID: james.westby@ubuntu.com-20090317230756-db5b8rqjwb2j35e5
Tags: 2:0.10.0-1ubuntu1
* Remaining changes to Debian (committed to Debian SVN):
  - Depends: kde-icons-oxygen dropped (included through kdelibs)
  - Recommends: kipi-plugins added (provides major functionality)
  - debian/digikamthemedesigner.manpage: add missing manpage
* Remaning change to Debian:
  - Section: devel for -dbg package (no debug in Jaunty)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Date        : 2005-02-17
7
7
 * Description : a plugin to change image perspective .
8
8
 *
9
 
 * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
 
 * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
 
9
 * Copyright (C) 2005-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 * Copyright (C) 2006-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11
11
 *
12
12
 * This program is free software; you can redistribute it
13
13
 * and/or modify it under the terms of the GNU General
22
22
 *
23
23
 * ============================================================ */
24
24
 
25
 
 
26
25
#include "perspectivetool.h"
27
26
#include "perspectivetool.moc"
28
27
 
108
107
 
109
108
    // -------------------------------------------------------------
110
109
 
111
 
    KSeparator *line = new KSeparator (Qt::Horizontal, m_gboxSettings->plainPage());
 
110
    KSeparator *line        = new KSeparator (Qt::Horizontal, m_gboxSettings->plainPage());
112
111
 
113
 
    QLabel *angleLabel = new QLabel(i18n("Angles (in degrees):"), m_gboxSettings->plainPage());
114
 
    QLabel *label3 = new QLabel(i18n("  Top left:"), m_gboxSettings->plainPage());
115
 
    m_topLeftAngleLabel = new QLabel(m_gboxSettings->plainPage());
116
 
    QLabel *label4 = new QLabel(i18n("  Top right:"), m_gboxSettings->plainPage());
117
 
    m_topRightAngleLabel = new QLabel(m_gboxSettings->plainPage());
118
 
    QLabel *label5 = new QLabel(i18n("  Bottom left:"), m_gboxSettings->plainPage());
119
 
    m_bottomLeftAngleLabel = new QLabel(m_gboxSettings->plainPage());
120
 
    QLabel *label6 = new QLabel(i18n("  Bottom right:"), m_gboxSettings->plainPage());
 
112
    QLabel *angleLabel      = new QLabel(i18n("Angles (in degrees):"), m_gboxSettings->plainPage());
 
113
    QLabel *label3          = new QLabel(i18n("  Top left:"), m_gboxSettings->plainPage());
 
114
    m_topLeftAngleLabel     = new QLabel(m_gboxSettings->plainPage());
 
115
    QLabel *label4          = new QLabel(i18n("  Top right:"), m_gboxSettings->plainPage());
 
116
    m_topRightAngleLabel    = new QLabel(m_gboxSettings->plainPage());
 
117
    QLabel *label5          = new QLabel(i18n("  Bottom left:"), m_gboxSettings->plainPage());
 
118
    m_bottomLeftAngleLabel  = new QLabel(m_gboxSettings->plainPage());
 
119
    QLabel *label6          = new QLabel(i18n("  Bottom right:"), m_gboxSettings->plainPage());
121
120
    m_bottomRightAngleLabel = new QLabel(m_gboxSettings->plainPage());
122
121
 
123
122
    // -------------------------------------------------------------
125
124
    KSeparator *line2         = new KSeparator (Qt::Horizontal, m_gboxSettings->plainPage());
126
125
    m_drawWhileMovingCheckBox = new QCheckBox(i18n("Draw preview while moving"), m_gboxSettings->plainPage());
127
126
    m_drawGridCheckBox        = new QCheckBox(i18n("Draw grid"), m_gboxSettings->plainPage());
 
127
    m_inverseTransformation   = new QCheckBox(i18n("Inverse transformation"), m_gboxSettings->plainPage());
128
128
 
129
129
    // -------------------------------------------------------------
130
130
 
136
136
    space->setFixedHeight(m_gboxSettings->spacingHint());
137
137
 
138
138
    QLabel *label8 = new QLabel(i18n("Guide width:"), m_gboxSettings->plainPage());
139
 
    m_guideSize = new QSpinBox(m_gboxSettings->plainPage());
 
139
    m_guideSize    = new QSpinBox(m_gboxSettings->plainPage());
140
140
    m_guideSize->setRange(1, 5);
141
141
    m_guideSize->setSingleStep(1);
142
142
    m_guideSize->setWhatsThis(i18n("Set here the width in pixels used to draw guides dashed-lines."));
160
160
    gridLayout->addWidget(line2,                        8, 0, 1, 3);
161
161
    gridLayout->addWidget(m_drawWhileMovingCheckBox,    9, 0, 1, 3);
162
162
    gridLayout->addWidget(m_drawGridCheckBox,          10, 0, 1, 3);
163
 
    gridLayout->addWidget(label7,                      11, 0, 1, 1);
164
 
    gridLayout->addWidget(m_guideColorBt,              11, 2, 1, 1);
165
 
    gridLayout->addWidget(space,                       12, 0, 1, 3);
166
 
    gridLayout->addWidget(label8,                      13, 0, 1, 1);
167
 
    gridLayout->addWidget(m_guideSize,                 13, 2, 1, 1);
 
163
    gridLayout->addWidget(m_inverseTransformation,     11, 0, 1, 3);
 
164
    gridLayout->addWidget(label7,                      12, 0, 1, 1);
 
165
    gridLayout->addWidget(m_guideColorBt,              12, 2, 1, 1);
 
166
    gridLayout->addWidget(space,                       13, 0, 1, 3);
 
167
    gridLayout->addWidget(label8,                      14, 0, 1, 1);
 
168
    gridLayout->addWidget(m_guideSize,                 14, 2, 1, 1);
168
169
    gridLayout->setColumnStretch(1, 10);
169
 
    gridLayout->setRowStretch(14, 10);
 
170
    gridLayout->setRowStretch(15, 10);
170
171
 
171
172
    setToolSettings(m_gboxSettings);
172
173
    init();
173
174
 
174
175
    // -------------------------------------------------------------
175
176
 
176
 
    connect(m_previewWidget, SIGNAL(signalPerspectiveChanged(QRect, float, float, float, float)),
177
 
            this, SLOT(slotUpdateInfo(QRect, float, float, float, float)));
 
177
    connect(m_previewWidget, SIGNAL(signalPerspectiveChanged(const QRect&, float, float, float, float)),
 
178
            this, SLOT(slotUpdateInfo(const QRect&, float, float, float, float)));
178
179
 
179
180
    connect(m_drawWhileMovingCheckBox, SIGNAL(toggled(bool)),
180
181
            m_previewWidget, SLOT(slotToggleDrawWhileMoving(bool)));
187
188
 
188
189
    connect(m_guideSize, SIGNAL(valueChanged(int)),
189
190
            m_previewWidget, SLOT(slotChangeGuideSize(int)));
 
191
 
 
192
    connect(m_inverseTransformation, SIGNAL(toggled(bool)),
 
193
            this, SLOT(slotInverseTransformationChanged(bool)));
190
194
}
191
195
 
192
196
PerspectiveTool::~PerspectiveTool()
202
206
    m_drawGridCheckBox->setChecked(group.readEntry("Draw Grid", false));
203
207
    m_guideColorBt->setColor(group.readEntry("Guide Color", defaultGuideColor));
204
208
    m_guideSize->setValue(group.readEntry("Guide Width", 1));
 
209
    m_inverseTransformation->setChecked(group.readEntry("Inverse Transformation", false));
205
210
    m_previewWidget->slotToggleDrawWhileMoving(m_drawWhileMovingCheckBox->isChecked());
206
211
    m_previewWidget->slotToggleDrawGrid(m_drawGridCheckBox->isChecked());
207
212
    m_previewWidget->slotChangeGuideColor(m_guideColorBt->color());
216
221
    group.writeEntry("Draw Grid", m_drawGridCheckBox->isChecked());
217
222
    group.writeEntry("Guide Color", m_guideColorBt->color());
218
223
    group.writeEntry("Guide Width", m_guideSize->value());
 
224
    group.writeEntry("Inverse Transformation", m_inverseTransformation->isChecked());
219
225
    config->sync();
220
226
}
221
227
 
231
237
    kapp->restoreOverrideCursor();
232
238
}
233
239
 
234
 
void PerspectiveTool::slotUpdateInfo(QRect newSize, float topLeftAngle, float topRightAngle,
235
 
                                             float bottomLeftAngle, float bottomRightAngle)
 
240
void PerspectiveTool::slotUpdateInfo(const QRect& newSize, float topLeftAngle, float topRightAngle,
 
241
                                     float bottomLeftAngle, float bottomRightAngle)
236
242
{
237
243
    QString temp;
238
244
    m_newWidthLabel->setText(temp.setNum(newSize.width()) + i18n(" px"));
244
250
    m_bottomRightAngleLabel->setText(temp.setNum(bottomRightAngle, 'f', 1));
245
251
}
246
252
 
 
253
void PerspectiveTool::slotInverseTransformationChanged(bool b)
 
254
{
 
255
    m_drawWhileMovingCheckBox->setEnabled(!b);
 
256
    m_drawGridCheckBox->setEnabled(!b);
 
257
    m_previewWidget->slotInverseTransformationChanged(b);
 
258
}
 
259
 
247
260
}  // namespace DigikamPerspectiveImagesPlugin