Changeset View
Changeset View
Standalone View
Standalone View
widgets/imagelib/effects/kpEffectToneEnhanceWidget.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
42 | 42 | | |||
43 | kpEffectToneEnhanceWidget::kpEffectToneEnhanceWidget (bool actOnSelection, | 43 | kpEffectToneEnhanceWidget::kpEffectToneEnhanceWidget (bool actOnSelection, | ||
44 | QWidget *parent) | 44 | QWidget *parent) | ||
45 | : kpEffectWidgetBase (actOnSelection, parent), | 45 | : kpEffectWidgetBase (actOnSelection, parent), | ||
46 | m_granularityInput (nullptr), | 46 | m_granularityInput (nullptr), | ||
47 | m_amountInput (nullptr) | 47 | m_amountInput (nullptr) | ||
48 | 48 | | |||
49 | { | 49 | { | ||
50 | QGridLayout *lay = new QGridLayout (this); | 50 | auto *lay = new QGridLayout (this); | ||
51 | lay->setContentsMargins(0, 0, 0, 0); | 51 | lay->setContentsMargins(0, 0, 0, 0); | ||
52 | 52 | | |||
53 | | ||||
54 | // See kpEffectToneEnhance::applyEffect(). | 53 | // See kpEffectToneEnhance::applyEffect(). | ||
55 | { | | |||
56 | QLabel *granularityLabel = new QLabel (i18n ("&Granularity:"), this); | | |||
57 | 54 | | |||
58 | QLabel *amountLabel = new QLabel (i18n ("&Amount:"), this); | 55 | auto *granularityLabel = new QLabel (i18n ("&Granularity:"), this); | ||
56 | | ||||
57 | auto *amountLabel = new QLabel (i18n ("&Amount:"), this); | ||||
59 | 58 | | |||
60 | m_granularityInput = new kpDoubleNumInput (this); | 59 | m_granularityInput = new kpDoubleNumInput (this); | ||
61 | m_granularityInput->setRange (0, 1, 0.1/*step*/); | 60 | m_granularityInput->setRange (0, 1, 0.1/*step*/); | ||
62 | 61 | | |||
63 | m_amountInput = new kpDoubleNumInput (this); | 62 | m_amountInput = new kpDoubleNumInput (this); | ||
64 | m_amountInput->setRange (0, 1, 0.1/*step*/); | 63 | m_amountInput->setRange (0, 1, 0.1/*step*/); | ||
65 | 64 | | |||
66 | granularityLabel->setBuddy (m_granularityInput); | 65 | granularityLabel->setBuddy (m_granularityInput); | ||
Show All 9 Lines | |||||
76 | lay->setColumnStretch (1, 1); | 75 | lay->setColumnStretch (1, 1); | ||
77 | 76 | | |||
78 | 77 | | |||
79 | connect (m_granularityInput, &kpDoubleNumInput::valueChanged, | 78 | connect (m_granularityInput, &kpDoubleNumInput::valueChanged, | ||
80 | this, &kpEffectToneEnhanceWidget::settingsChangedDelayed); | 79 | this, &kpEffectToneEnhanceWidget::settingsChangedDelayed); | ||
81 | 80 | | |||
82 | connect (m_amountInput, &kpDoubleNumInput::valueChanged, | 81 | connect (m_amountInput, &kpDoubleNumInput::valueChanged, | ||
83 | this, &kpEffectToneEnhanceWidget::settingsChangedDelayed); | 82 | this, &kpEffectToneEnhanceWidget::settingsChangedDelayed); | ||
84 | } | | |||
85 | } | | |||
86 | 83 | | |||
87 | kpEffectToneEnhanceWidget::~kpEffectToneEnhanceWidget () | | |||
88 | { | | |||
89 | } | 84 | } | ||
90 | 85 | | |||
86 | kpEffectToneEnhanceWidget::~kpEffectToneEnhanceWidget () = default; | ||||
87 | | ||||
91 | 88 | | |||
92 | // public virtual [base kpEffectWidgetBase] | 89 | // public virtual [base kpEffectWidgetBase] | ||
93 | QString kpEffectToneEnhanceWidget::caption () const | 90 | QString kpEffectToneEnhanceWidget::caption () const | ||
94 | { | 91 | { | ||
95 | // TODO: Why doesn't this have a caption? Ditto for the other effects. | 92 | // TODO: Why doesn't this have a caption? Ditto for the other effects. | ||
96 | return QString(); | 93 | return QString(); | ||
97 | } | 94 | } | ||
98 | 95 | | |||
Show All 12 Lines | |||||
111 | 108 | | |||
112 | 109 | | |||
113 | // public virtual [base kpEffectWidgetBase] | 110 | // public virtual [base kpEffectWidgetBase] | ||
114 | bool kpEffectToneEnhanceWidget::isNoOp () const | 111 | bool kpEffectToneEnhanceWidget::isNoOp () const | ||
115 | { | 112 | { | ||
116 | // If the "amount" is 0, nothing happens regardless of the granularity. | 113 | // If the "amount" is 0, nothing happens regardless of the granularity. | ||
117 | // Note that if "granularity" is 0 but "amount" > 0, the effect _is_ active. | 114 | // Note that if "granularity" is 0 but "amount" > 0, the effect _is_ active. | ||
118 | // Therefore, "granularity" should have no involvement in this check. | 115 | // Therefore, "granularity" should have no involvement in this check. | ||
119 | if (amount () == 0) | 116 | if (amount () == 0) { | ||
120 | return true; | 117 | return true; | ||
121 | else | 118 | } | ||
119 | | ||||
122 | return false; | 120 | return false; | ||
123 | } | 121 | } | ||
124 | 122 | | |||
125 | // public virtual [base kpEffectWidgetBase] | 123 | // public virtual [base kpEffectWidgetBase] | ||
126 | kpImage kpEffectToneEnhanceWidget::applyEffect (const kpImage &image) | 124 | kpImage kpEffectToneEnhanceWidget::applyEffect (const kpImage &image) | ||
127 | { | 125 | { | ||
128 | return kpEffectToneEnhance::applyEffect (image, | 126 | return kpEffectToneEnhance::applyEffect (image, | ||
129 | granularity (), amount ()); | 127 | granularity (), amount ()); | ||
Show All 12 Lines |