Commit 1a2623d9 authored by Felipe Peter's avatar Felipe Peter Committed by Nate Graham
Browse files

Change UI for setting jpeg quality to slider

Summary:
[[ https://phabricator.kde.org/D23106 | D23106 ]] added a spinner box to set a save quality for JPEG images. I changed it to a slider to be consistent with the same functionality in Spectacle, but I didn't use the ticks because it makes the slider me misaligned with the respective label. Also, I used % as the label unit. I think it is more clear and will therefore propose the same for Spectacle.

I did not really understand how in the [[ https://phabricator.kde.org/D23106 | original commit ]] the value from the spinner box was saved to the config, so I set it explicitly when the slider value changes.

Test Plan:
Set high quality in settings, don't change in save dialog -> Output image has high quality
Set high quality in settings, override in save dialog with low quality -> Output image has low quality
Set low quality in settings, don't change in save dialog -> Output image has low quality
Set low quality in settings, override in save dialog with high quality -> Output image has high quality

Reviewers: ngraham, #vdg, #gwenview

Reviewed By: ngraham, #vdg, #gwenview

Subscribers: #spectacle

Tags: #gwenview

Differential Revision: https://phabricator.kde.org/D24309
parent de3beda1
......@@ -62,7 +62,11 @@ ConfigDialog::ConfigDialog(QWidget* parent)
pageItem = addPage(widget, i18n("General"));
pageItem->setIcon(QIcon::fromTheme("gwenview"));
connect(mGeneralConfigPage.kcfg_ViewBackgroundValue, &QAbstractSlider::valueChanged, this, &ConfigDialog::updateViewBackgroundFrame);
connect(mGeneralConfigPage.kcfg_JPEGQuality, &QAbstractSlider::valueChanged, this, [=] (int value) {mGeneralConfigPage.jpegQualitySpinner->setValue(value);});
connect(mGeneralConfigPage.jpegQualitySpinner, QOverload<int>::of(&QSpinBox::valueChanged), this, [=] (int value) {mGeneralConfigPage.kcfg_JPEGQuality->setValue(value);});
mGeneralConfigPage.jpegQualitySpinner->setValue(mGeneralConfigPage.kcfg_JPEGQuality->value());
mGeneralConfigPage.backgroundValueFrame->setMinimumWidth(mGeneralConfigPage.jpegQualitySpinner->width());
// Image View
widget = setupPage(mImageViewConfigPage);
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<width>474</width>
<height>338</height>
</rect>
</property>
......@@ -76,7 +76,7 @@
</property>
<property name="minimumSize">
<size>
<width>40</width>
<width>70</width>
<height>0</height>
</size>
</property>
......@@ -122,27 +122,72 @@
</property>
</spacer>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>JPEG save quality:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="kcfg_JPEGQuality">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="kcfg_JPEGQuality">
<property name="minimumSize">
<size>
<width>256</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>90</number>
</property>
<property name="sliderPosition">
<number>90</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="jpegQualitySpinner">
<property name="suffix">
<string>%</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -158,28 +203,28 @@
</property>
</spacer>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Thumbnail actions:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QRadioButton" name="allButtonsThumbnailActionsRadioButton">
<property name="text">
<string>All buttons</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QRadioButton" name="selectionOnlyThumbnailActionsRadioButton">
<property name="text">
<string>Show selection button only</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QRadioButton" name="noneThumbnailActionsRadioButton">
<property name="text">
<string>None</string>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment