diff --git a/lib/redeyereduction/redeyereductiontool.h b/lib/redeyereduction/redeyereductiontool.h --- a/lib/redeyereduction/redeyereductiontool.h +++ b/lib/redeyereduction/redeyereductiontool.h @@ -59,15 +59,16 @@ void toolActivated() override; + void slotApplyClicked(); + QWidget* widget() const override; Q_SIGNALS: void done(); void imageOperationRequested(AbstractImageOperation*); private Q_SLOTS: void setDiameter(int); - void slotApplyClicked(); private: RedEyeReductionToolPrivate* const d; diff --git a/lib/redeyereduction/redeyereductiontool.cpp b/lib/redeyereduction/redeyereductiontool.cpp --- a/lib/redeyereduction/redeyereductiontool.cpp +++ b/lib/redeyereduction/redeyereductiontool.cpp @@ -46,17 +46,21 @@ 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 @@ 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,21 +177,23 @@ return; } event->accept(); - d->mToolWidget->dialogButtonBox->accepted(); + d->mToolWidget->mainDialogButtonBox->accepted(); } void RedEyeReductionTool::keyPressEvent(QKeyEvent* event) { - QDialogButtonBox *buttons = d->mToolWidget->findChild(); + QDialogButtonBox *buttons = d->mToolWidget->mainDialogButtonBox; switch (event->key()) { case Qt::Key_Escape: event->accept(); buttons->rejected(); break; 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/redeyereductionwidget.ui b/lib/redeyereduction/redeyereductionwidget.ui --- a/lib/redeyereduction/redeyereductionwidget.ui +++ b/lib/redeyereduction/redeyereductionwidget.ui @@ -10,26 +10,57 @@ 56 - + - 0 + 1 - + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - Size + Size: diameterSlider + + + 0 + 0 + + + + + 120 + 0 + + 2 @@ -51,31 +82,112 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 12 + 20 + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - diameterSpinBox - label - diameterSlider - + + + 0 + + + 0 + - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + Click on a red eye and choose a size, or double-click to correct instantly. + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 12 + 20 + + + + + + + + QDialogButtonBox::Close + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - QDialogButtonBox::Close|QDialogButtonBox::Ok - - -