summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Fehlauer <[email protected]>2018-03-22 23:17:40 +0100
committerHenrik Fehlauer <[email protected]>2018-03-23 00:50:58 +0100
commitd3f4793e390a691dcca3d0be054c8501c8660611 (patch)
tree8bab9b9d653fd6ec8d49d201e9a8d88b436d3d64
parent9558f487078422bb8bc39706bdbcdbcb5a4702e9 (diff)
Adapt code to new crop terminology toov18.03.80
Summary: D11578 changes UI strings from "Restrict to image ratio" to "Preserve aspect ratio". Here we adapt the naming of functions and config variables too, to lessen developer confusion. Test Plan: Compile, grep for "restrict" Reviewers: #gwenview, ngraham, huoni Reviewed By: huoni Differential Revision: https://phabricator.kde.org/D11589
-rw-r--r--lib/crop/croptool.cpp4
-rw-r--r--lib/crop/cropwidget.cpp16
-rw-r--r--lib/crop/cropwidget.h4
-rw-r--r--lib/crop/cropwidget.ui2
-rw-r--r--lib/gwenviewconfig.kcfg2
5 files changed, 14 insertions, 14 deletions
diff --git a/lib/crop/croptool.cpp b/lib/crop/croptool.cpp
index c0b3ddd..82451b1 100644
--- a/lib/crop/croptool.cpp
+++ b/lib/crop/croptool.cpp
@@ -427,7 +427,7 @@ void CropTool::toolActivated()
{
imageView()->setCursor(Qt::CrossCursor);
d->mCropWidget->setAdvancedSettingsEnabled(GwenviewConfig::cropAdvancedSettingsEnabled());
- d->mCropWidget->setRestrictToImageRatio(GwenviewConfig::cropRestrictToImageRatio());
+ d->mCropWidget->setPreserveAspectRatio(GwenviewConfig::cropPreserveAspectRatio());
const int index = GwenviewConfig::cropRatioIndex();
if (index >= 0) {
// Preset ratio
@@ -442,7 +442,7 @@ void CropTool::toolActivated()
void CropTool::toolDeactivated()
{
GwenviewConfig::setCropAdvancedSettingsEnabled(d->mCropWidget->advancedSettingsEnabled());
- GwenviewConfig::setCropRestrictToImageRatio(d->mCropWidget->restrictToImageRatio());
+ GwenviewConfig::setCropPreserveAspectRatio(d->mCropWidget->preserveAspectRatio());
GwenviewConfig::setCropRatioIndex(d->mCropWidget->cropRatioIndex());
const QSizeF ratio = d->mCropWidget->cropRatio();
GwenviewConfig::setCropRatioWidth(ratio.width());
diff --git a/lib/crop/cropwidget.cpp b/lib/crop/cropwidget.cpp
index 128fa2d..9d2d175 100644
--- a/lib/crop/cropwidget.cpp
+++ b/lib/crop/cropwidget.cpp
@@ -137,7 +137,7 @@ struct CropWidgetPrivate : public Ui_CropWidget
return size.height() / size.width();
}
- if (q->restrictToImageRatio()) {
+ if (q->preserveAspectRatio()) {
QSizeF size = ratio(mDocument->size());
return size.height() / size.width();
}
@@ -267,7 +267,7 @@ CropWidget::CropWidget(QWidget* parent, RasterImageView* imageView, CropTool* cr
d->advancedWidget->setVisible(false);
d->advancedWidget->layout()->setMargin(0);
- connect(d->restrictToImageRatioCheckBox, &QCheckBox::toggled, this, &CropWidget::applyRatioConstraint);
+ connect(d->preserveAspectRatioCheckBox, &QCheckBox::toggled, this, &CropWidget::applyRatioConstraint);
d->initRatioComboBox();
@@ -309,14 +309,14 @@ bool CropWidget::advancedSettingsEnabled() const
return d->advancedCheckBox->isChecked();
}
-void CropWidget::setRestrictToImageRatio(bool restrict)
+void CropWidget::setPreserveAspectRatio(bool preserve)
{
- d->restrictToImageRatioCheckBox->setChecked(restrict);
+ d->preserveAspectRatioCheckBox->setChecked(preserve);
}
-bool CropWidget::restrictToImageRatio() const
+bool CropWidget::preserveAspectRatio() const
{
- return d->restrictToImageRatioCheckBox->isChecked();
+ return d->preserveAspectRatioCheckBox->isChecked();
}
void CropWidget::setCropRatio(QSizeF size)
@@ -405,7 +405,7 @@ void CropWidget::applyRatioConstraint()
void CropWidget::slotAdvancedCheckBoxToggled(bool checked)
{
d->advancedWidget->setVisible(checked);
- d->restrictToImageRatioCheckBox->setVisible(!checked);
+ d->preserveAspectRatioCheckBox->setVisible(!checked);
applyRatioConstraint();
}
@@ -439,7 +439,7 @@ void CropWidget::updateCropRatio()
d->ratioComboBox->setItemData(d->mCurrentImageComboBoxIndex, QVariant(ratio(d->mDocument->size())));
// Always re-apply the constraint, even though we only need to when the user has "Current Image"
- // selected or the "Restrict to current image" checked, since there's no harm
+ // selected or the "Preserve aspect ratio" checked, since there's no harm
applyRatioConstraint();
// If the ratio is unrestricted, calling applyRatioConstraint doesn't update the rect, so we call
// this manually to make sure the rect is adjusted to fit within the image
diff --git a/lib/crop/cropwidget.h b/lib/crop/cropwidget.h
index dc721c7..601753d 100644
--- a/lib/crop/cropwidget.h
+++ b/lib/crop/cropwidget.h
@@ -47,8 +47,8 @@ public:
void setAdvancedSettingsEnabled(bool enable);
bool advancedSettingsEnabled() const;
- void setRestrictToImageRatio(bool restrict);
- bool restrictToImageRatio() const;
+ void setPreserveAspectRatio(bool preserve);
+ bool preserveAspectRatio() const;
void setCropRatio(QSizeF size);
int cropRatioIndex() const;
void setCropRatioIndex(int index);
diff --git a/lib/crop/cropwidget.ui b/lib/crop/cropwidget.ui
index 6c4b5b8..bacff8c 100644
--- a/lib/crop/cropwidget.ui
+++ b/lib/crop/cropwidget.ui
@@ -161,7 +161,7 @@
</spacer>
</item>
<item>
- <widget class="QCheckBox" name="restrictToImageRatioCheckBox">
+ <widget class="QCheckBox" name="preserveAspectRatioCheckBox">
<property name="text">
<string>Preserve aspect ratio</string>
</property>
diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg
index ca4ca22..417b4ad 100644
--- a/lib/gwenviewconfig.kcfg
+++ b/lib/gwenviewconfig.kcfg
@@ -300,7 +300,7 @@
<entry name="CropAdvancedSettingsEnabled" type="Bool">
<default>false</default>
</entry>
- <entry name="CropRestrictToImageRatio" type="Bool">
+ <entry name="CropPreserveAspectRatio" type="Bool">
<label>Restrict crop to image ratio when Advanced Settings disabled</label>
<default>false</default>
</entry>