33 m_transaction(transaction),
34 m_notificationsBlocked(0),
36 m_configChanged(false)
40 KConfigGroup group = KSharedConfig::openConfig()->group(
"KisToolTransform");
41 bool useInStackPreview = !group.readEntry(
"useOverlayPreviewStyle",
false);
42 bool forceLodMode = group.readEntry(
"forceLodMode",
true);
44 if (useInStackPreview && !forceLodMode) {
45 cmbPreviewMode->setCurrentIndex(0);
47 else if (useInStackPreview && forceLodMode) {
48 cmbPreviewMode->setCurrentIndex(1);
51 cmbPreviewMode->setCurrentIndex(2);
54 connect(cmbPreviewMode, SIGNAL(currentIndexChanged(
int)),
this, SLOT(
slotPreviewChanged(
int)));
63 changeGranularity->addItems(granularityValues);
64 changeGranularity->setCurrentIndex(1);
65 granularityPreview->addItems(granularityValues);
66 granularityPreview->setCurrentIndex(2);
68 connect(changeGranularity,SIGNAL(currentTextChanged(QString)),
70 connect(granularityPreview, SIGNAL(currentTextChanged(QString)),
75 cmbFilter->setCurrent(
"Bicubic");
76 cmbFilter->setToolTip(i18nc(
"@info:tooltip",
77 "<p>Select filtering mode:\n"
79 "<li><b>Nearest neighbor</b> for pixel art. Does not produce new color.</li>"
80 "<li><b>Bilinear</b> for areas with uniform color to avoid artifacts.</li>"
81 "<li><b>Bicubic</b> for smoother results.</li>"
82 "<li><b>Lanczos3</b> for sharp results. May produce aerials.</li>"
84 connect(cmbFilter, SIGNAL(activated(
KoID)),
92 connect(cmbWarpType, SIGNAL(currentIndexChanged(
int)),
this, SLOT(
slotWarpTypeChanged(
int)));
117 QToolButton *nothingSelected =
new QToolButton(0);
118 nothingSelected->setCheckable(
true);
119 nothingSelected->setAutoExclusive(
true);
120 nothingSelected->hide();
125 shearXBox->setSuffix(QStringLiteral(
"%"));
126 shearYBox->setSuffix(QStringLiteral(
"%"));
127 shearXBox->setRange(-500, 500, 2);
128 shearYBox->setRange(-500, 500, 2);
129 shearXBox->setSingleStep(1);
130 shearYBox->setSingleStep(1);
131 shearXBox->setValue(0.0);
132 shearYBox->setValue(0.0);
135 translateXBox->setSuffix(i18n(
" px"));
136 translateYBox->setSuffix(i18n(
" px"));
137 translateXBox->setRange(-10000, 10000);
138 translateYBox->setRange(-10000, 10000);
141 scaleXBox->setRange(-10000, 10000);
142 scaleYBox->setRange(-10000, 10000);
143 scaleXBox->setValue(100.0);
144 scaleYBox->setValue(100.0);
158 cameraHeightBox->setRange(1, 20000, 2);
164 connect(scaleXBox, SIGNAL(valueChanged(
int)),
this, SLOT(
slotSetScaleX(
int)));
165 connect(scaleYBox, SIGNAL(valueChanged(
int)),
this, SLOT(
slotSetScaleY(
int)));
166 connect(shearXBox, SIGNAL(valueChanged(qreal)),
this, SLOT(
slotSetShearX(qreal)));
167 connect(shearYBox, SIGNAL(valueChanged(qreal)),
this, SLOT(
slotSetShearY(qreal)));
168 connect(translateXBox, SIGNAL(valueChanged(
int)),
this, SLOT(
slotSetTranslateX(
int)));
169 connect(translateYBox, SIGNAL(valueChanged(
int)),
this, SLOT(
slotSetTranslateY(
int)));
170 connect(aXBox, SIGNAL(angleChanged(qreal)),
this, SLOT(
slotSetAX(qreal)));
171 connect(aYBox, SIGNAL(angleChanged(qreal)),
this, SLOT(
slotSetAY(qreal)));
172 connect(aZBox, SIGNAL(angleChanged(qreal)),
this, SLOT(
slotSetAZ(qreal)));
173 connect(cameraHeightBox, SIGNAL(valueChanged(qreal)),
this, SLOT(
slotSetCameraHeight(qreal)));
175 connect(flipXButton, SIGNAL(clicked(
bool)),
this, SLOT(
slotFlipX()));
176 connect(flipYButton, SIGNAL(clicked(
bool)),
this, SLOT(
slotFlipY()));
177 connect(rotateCWButton, SIGNAL(clicked(
bool)),
this, SLOT(
slotRotateCW()));
178 connect(rotateCCWButton, SIGNAL(clicked(
bool)),
this, SLOT(
slotRotateCCW()));
187 rotationGroup->hide();
195 alphaBox->setSingleStep(0.1);
196 alphaBox->setRange(0, 10, 1);
198 connect(alphaBox, SIGNAL(valueChanged(qreal)),
this, SLOT(
slotSetWarpAlpha(qreal)));
207 cageTransformButtonGroup->setId(cageAddEditRadio, 0);
208 cageTransformButtonGroup->setId(cageDeformRadio, 1);
214 liquifySizeSlider->setExponentRatio(3);
215 liquifySizeSlider->setValue(60.0);
216 connect(liquifySizeSlider, SIGNAL(valueChanged(qreal)),
this, SLOT(
liquifySizeChanged(qreal)));
218 liquifySizeSlider->setToolTip(i18nc(
"@info:tooltip",
"Size of the deformation brush"));
220 liquifyAmountSlider->setRange(0.0, 1.0, 2);
221 liquifyAmountSlider->setSingleStep(0.01);
222 liquifyAmountSlider->setValue(0.05);
223 connect(liquifyAmountSlider, SIGNAL(valueChanged(qreal)),
this, SLOT(
liquifyAmountChanged(qreal)));
225 liquifyAmountSlider->setToolTip(i18nc(
"@info:tooltip",
"Amount of the deformation you get"));
227 liquifyFlowSlider->setRange(0.0, 1.0, 2);
228 liquifyFlowSlider->setSingleStep(0.01);
229 liquifyFlowSlider->setValue(1.0);
230 connect(liquifyFlowSlider, SIGNAL(valueChanged(qreal)),
this, SLOT(
liquifyFlowChanged(qreal)));
232 liquifyFlowSlider->setToolTip(i18nc(
"@info:tooltip",
"When in non-buildup mode, shows how fast the deformation limit is reached."));
234 buildupModeComboBox->setCurrentIndex(0);
235 connect(buildupModeComboBox, SIGNAL(currentIndexChanged(
int)),
this, SLOT(
liquifyBuildUpChanged(
int)));
237 buildupModeComboBox->setToolTip(
"<p>" + i18nc(
"@info:tooltip",
"Switch between Build Up and Wash mode of painting. Build Up mode adds deformations one on top of the other without any limits. Wash mode gradually deforms the piece to the selected deformation level.") +
"</p>");
239 liquifySpacingSlider->setRange(0.0, 3.0, 2);
240 liquifySpacingSlider->setExponentRatio(3);
241 liquifySpacingSlider->setSingleStep(0.01);
242 liquifySpacingSlider->setValue(0.2);
243 connect(liquifySpacingSlider, SIGNAL(valueChanged(qreal)),
this, SLOT(
liquifySpacingChanged(qreal)));
245 liquifySpacingSlider->setToolTip(i18nc(
"@info:tooltip",
"Space between two sequential applications of the deformation"));
247 liquifySizePressureBox->setChecked(
true);
250 liquifySizePressureBox->setToolTip(i18nc(
"@info:tooltip",
"Scale <b>Size</b> value according to current stylus pressure"));
252 liquifyAmountPressureBox->setChecked(
true);
255 liquifyAmountPressureBox->setToolTip(i18nc(
"@info:tooltip",
"Scale <b>Amount</b> value according to current stylus pressure"));
257 liquifyReverseDirectionChk->setChecked(
false);
260 liquifyReverseDirectionChk->setToolTip(i18nc(
"@info:tooltip",
"Reverse direction of the current deformation tool"));
263 connect(liquifyMove, SIGNAL(clicked(
bool)), liquifyModeMapper, SLOT(map()));
264 connect(liquifyScale, SIGNAL(clicked(
bool)), liquifyModeMapper, SLOT(map()));
265 connect(liquifyRotate, SIGNAL(clicked(
bool)), liquifyModeMapper, SLOT(map()));
266 connect(liquifyOffset, SIGNAL(clicked(
bool)), liquifyModeMapper, SLOT(map()));
267 connect(liquifyUndo, SIGNAL(clicked(
bool)), liquifyModeMapper, SLOT(map()));
268 connect(liquifyRestoreShape, SIGNAL(clicked(
bool)), liquifyModeMapper, SLOT(map()));
278 liquifyMove->setToolTip(i18nc(
"@info:tooltip",
"Move: drag the image along the brush stroke"));
279 liquifyScale->setToolTip(i18nc(
"@info:tooltip",
"Scale: grow/shrink image under cursor"));
280 liquifyRotate->setToolTip(i18nc(
"@info:tooltip",
"Rotate: twirl image under cursor"));
281 liquifyOffset->setToolTip(i18nc(
"@info:tooltip",
"Offset: shift the image to the right of the stroke direction"));
282 liquifyUndo->setToolTip(i18nc(
"@info:tooltip",
"Undo: erase actions of other tools"));
283 liquifyRestoreShape->setToolTip(i18nc(
"@info:tooltip",
284 "Restore Shape: reduce local liquify stretching and bunching while keeping the affected area centered"));
304 liquifyRestoreShapeRotationOriginal->setToolTip(i18nc(
"@info:tooltip",
"Rotate the affected area back toward its original orientation"));
305 liquifyRestoreShapeRotationPreserve->setToolTip(i18nc(
"@info:tooltip",
"Keep the current rotation of the affected area"));
306 liquifyRestoreShapeScaleOriginal->setToolTip(i18nc(
"@info:tooltip",
"Scale the affected area back toward its original size"));
307 liquifyRestoreShapeScalePreserve->setToolTip(i18nc(
"@info:tooltip",
"Keep the current overall scale of the affected area"));
308 liquifyRestoreShapeStretchOriginal->setToolTip(i18nc(
"@info:tooltip",
"Remove simple stretch or squash from the affected area"));
309 liquifyRestoreShapeStretchPreserve->setToolTip(i18nc(
"@info:tooltip",
"Keep simple stretch or squash while removing shear-like distortion"));
311 const auto setRestoreShapeButtonStyle = [] (QToolButton *
button,
bool isLeftButton) {
312 button->setStyleSheet(QString::fromLatin1(
314 " border: 1px solid palette(mid);"
315 " background-color: palette(button);"
316 " color: palette(button-text);"
317 " padding: 4px 10px;"
320 "QToolButton:hover {"
321 " background-color: palette(light);"
323 "QToolButton:pressed {"
324 " background-color: palette(midlight);"
326 "QToolButton:checked {"
327 " background-color: palette(highlight);"
328 " color: palette(highlighted-text);"
329 " border-color: palette(highlight);"
331 "QToolButton:checked:hover {"
332 " background-color: palette(highlight);"
333 " color: palette(highlighted-text);"
336 QLatin1String(
"border-top-right-radius: 0px; border-bottom-right-radius: 0px;") :
337 QLatin1String(
"border-top-left-radius: 0px; border-bottom-left-radius: 0px;")));
340 setRestoreShapeButtonStyle(liquifyRestoreShapeRotationOriginal,
true);
341 setRestoreShapeButtonStyle(liquifyRestoreShapeRotationPreserve,
false);
342 setRestoreShapeButtonStyle(liquifyRestoreShapeScaleOriginal,
true);
343 setRestoreShapeButtonStyle(liquifyRestoreShapeScalePreserve,
false);
344 setRestoreShapeButtonStyle(liquifyRestoreShapeStretchOriginal,
true);
345 setRestoreShapeButtonStyle(liquifyRestoreShapeStretchPreserve,
false);
372 connect(buttonBox, SIGNAL(clicked(QAbstractButton*)),
this, SLOT(
slotButtonBoxClicked(QAbstractButton*)));
375 intNumRows->setRange(1, 999);
376 intNumColumns->setRange(1, 999);
395 tooBigLabelWidget->hide();
400 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Apply), KStandardGuiItem::apply());
401 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Reset), KStandardGuiItem::reset());