[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [gwenview] lib/redeyereduction: Polish Reduce Red Eye UI
From: Henrik Fehlauer <null () kde ! org>
Date: 2018-08-16 19:52:37
Message-ID: E1fqOJx-0006iw-IW () code ! kde ! org
[Download RAW message or body]
Git commit 0c678376131d9f4f034df52e6846b8643f39f803 by Henrik Fehlauer.
Committed on 16/08/2018 at 19:52.
Pushed by rkflx into branch 'master'.
Polish Reduce Red Eye UI
Summary:
The bottom toolbar of the {nav Reduce Red Eye} tool sports a couple of
glitches and inconsistencies:
- The vertical height is too large compared to the {nav Crop} tool.
- After {nav Size} the colon is missing.
- For some languages the slider can become quite long.
- After accepting, sometimes the left text flickers, since it is updated before the \
layout changes back.
- The {nav OK} button is missing a more descriptive text and more fitting icon as \
featured by the {nav Crop} tool.
- {nav Crop} uses the standard {nav Cancel} wording, but here a confusing {nav Close} \
button is placed next to {nav OK}.
- When proceeding to fix the second eye after clicking on {nav OK}, the {nav Close} \
button suddenly gains focus and thus turns blue, which was not the case for the first \
eye.
- When pressing {key Enter} without having clicked first, `invalid rect` is printed.
Let's fix all of those issues.
Test Plan:
Issues are gone, no functional or visual regressions when playing around
with the tool.
Before: {F6193619}
After: {F6193618}
Reviewers: #gwenview, muhlenpfordt
Reviewed By: #gwenview, muhlenpfordt
Subscribers: muhlenpfordt
Differential Revision: https://phabricator.kde.org/D14846
M +17 -9 lib/redeyereduction/redeyereductiontool.cpp
M +2 -1 lib/redeyereduction/redeyereductiontool.h
M +128 -16 lib/redeyereduction/redeyereductionwidget.ui
https://commits.kde.org/gwenview/0c678376131d9f4f034df52e6846b8643f39f803
diff --git a/lib/redeyereduction/redeyereductiontool.cpp \
b/lib/redeyereduction/redeyereductiontool.cpp index 3c070fe6..2d7e51e0 100644
--- a/lib/redeyereduction/redeyereductiontool.cpp
+++ b/lib/redeyereduction/redeyereductiontool.cpp
@@ -46,17 +46,21 @@ struct RedEyeReductionWidget : public QWidget, public \
Ui_RedEyeReductionWidget RedEyeReductionWidget()
{
setupUi(this);
+ QPushButton* okButton = mainDialogButtonBox->button(QDialogButtonBox::Ok);
+ okButton->setIcon(QIcon::fromTheme(QStringLiteral("redeyes")));
+ okButton->setText(i18n("Reduce Red Eye"));
}
void showNotSetPage()
{
- dialogButtonBox->button(QDialogButtonBox::Ok)->hide();
+ // Prevent Close button from turning blue upon accepting
+ helpTextLabel->setFocus();
+
stackedWidget->setCurrentWidget(notSetPage);
}
void showMainPage()
{
- dialogButtonBox->button(QDialogButtonBox::Ok)->show();
stackedWidget->setCurrentWidget(mainPage);
}
};
@@ -75,10 +79,12 @@ struct RedEyeReductionToolPrivate
mToolWidget->showNotSetPage();
QObject::connect(mToolWidget->diameterSpinBox, SIGNAL(valueChanged(int)),
q, SLOT(setDiameter(int)));
- QObject::connect(mToolWidget->dialogButtonBox, SIGNAL(accepted()),
- q, SLOT(slotApplyClicked()));
- QObject::connect(mToolWidget->dialogButtonBox, SIGNAL(rejected()),
- q, SIGNAL(done()));
+ QObject::connect(mToolWidget->mainDialogButtonBox, \
&QDialogButtonBox::accepted, + q, \
&RedEyeReductionTool::slotApplyClicked); + \
QObject::connect(mToolWidget->mainDialogButtonBox, &QDialogButtonBox::rejected, + \
q, &RedEyeReductionTool::done); + \
QObject::connect(mToolWidget->helpDialogButtonBox, &QDialogButtonBox::rejected, + \
q, &RedEyeReductionTool::done); }
QRectF rectF() const
@@ -171,12 +177,12 @@ void \
RedEyeReductionTool::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) return;
}
event->accept();
- d->mToolWidget->dialogButtonBox->accepted();
+ d->mToolWidget->mainDialogButtonBox->accepted();
}
void RedEyeReductionTool::keyPressEvent(QKeyEvent* event)
{
- QDialogButtonBox *buttons = d->mToolWidget->findChild<QDialogButtonBox *>();
+ QDialogButtonBox *buttons = d->mToolWidget->mainDialogButtonBox;
switch (event->key()) {
case Qt::Key_Escape:
event->accept();
@@ -185,7 +191,9 @@ void RedEyeReductionTool::keyPressEvent(QKeyEvent* event)
case Qt::Key_Return:
case Qt::Key_Enter:
event->accept();
- buttons->accepted();
+ if (d->mStatus == Adjusting) {
+ buttons->accepted();
+ }
break;
default:
break;
diff --git a/lib/redeyereduction/redeyereductiontool.h \
b/lib/redeyereduction/redeyereductiontool.h index 0e6088e9..3dfe8850 100644
--- a/lib/redeyereduction/redeyereductiontool.h
+++ b/lib/redeyereduction/redeyereductiontool.h
@@ -59,6 +59,8 @@ public:
void toolActivated() override;
+ void slotApplyClicked();
+
QWidget* widget() const override;
Q_SIGNALS:
@@ -67,7 +69,6 @@ Q_SIGNALS:
private Q_SLOTS:
void setDiameter(int);
- void slotApplyClicked();
private:
RedEyeReductionToolPrivate* const d;
diff --git a/lib/redeyereduction/redeyereductionwidget.ui \
b/lib/redeyereduction/redeyereductionwidget.ui index ed8e1708..61611a3d 100644
--- a/lib/redeyereduction/redeyereductionwidget.ui
+++ b/lib/redeyereduction/redeyereductionwidget.ui
@@ -10,18 +10,37 @@
<height>56</height>
</rect>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="mainPage">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item>
<widget class="QLabel" name="label">
<property name="text">
- <string>Size</string>
+ <string>Size:</string>
</property>
<property name="buddy">
<cstring>diameterSlider</cstring>
@@ -30,6 +49,18 @@
</item>
<item>
<widget class="QSlider" name="diameterSlider">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="minimum">
<number>2</number>
</property>
@@ -51,31 +82,112 @@
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>12</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="mainDialogButtonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <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>
- <zorder>diameterSpinBox</zorder>
- <zorder>label</zorder>
- <zorder>diameterSlider</zorder>
</widget>
<widget class="QWidget" name="notSetPage">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<item>
- <widget class="QLabel" name="label_2">
+ <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>
+ <item>
+ <widget class="QLabel" name="helpTextLabel">
<property name="text">
<string>Click on a red eye and choose a size, or double-click to correct \
instantly.</string> </property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>12</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="helpDialogButtonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <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>
</widget>
</widget>
</item>
- <item>
- <widget class="QDialogButtonBox" name="dialogButtonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<resources/>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic