Merge lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic into lp:widelands

Proposed by Jens Beyer
Status: Merged
Merged at revision: 6132
Proposed branch: lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic
Merge into: lp:widelands
Diff against target: 24 lines (+6/-2)
1 file modified
src/ui_basic/spinbox.cc (+6/-2)
To merge this branch: bzr merge lp:~qcumber-some/widelands/alocritani-896879-change_button_enable_logic
Reviewer Review Type Date Requested Status
Nicolai Hähnle Approve
Tino Approve
Review via email: mp+83533@code.launchpad.net

Description of the change

On behalf of alocritani (see bug comments).

To post a comment you must log in.
Revision history for this message
Tino (tino79) :
review: Approve
Revision history for this message
Nicolai Hähnle (nha) wrote :

Approve.

Side note: I'm not a huge fan of the type of alignment that is done in the hunk at line 172. Yes, the original code does it that way, so this is not a comment against the patch. I just don't think it's good practice, because it makes code maintenance more painful.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/ui_basic/spinbox.cc'
--- src/ui_basic/spinbox.cc 2011-11-23 17:05:46 +0000
+++ src/ui_basic/spinbox.cc 2011-11-27 21:31:29 +0000
@@ -172,8 +172,8 @@
172 sbi->butMinus->set_enabled(sbi->min < sbi->value);172 sbi->butMinus->set_enabled(sbi->min < sbi->value);
173 sbi->butPlus ->set_enabled (sbi->value < sbi->max);173 sbi->butPlus ->set_enabled (sbi->value < sbi->max);
174 if (m_big) {174 if (m_big) {
175 sbi->butTenMinus->set_enabled(sbi->min + 10 < sbi->value);175 sbi->butTenMinus->set_enabled(sbi->min < sbi->value);
176 sbi->butTenPlus->set_enabled(sbi->value < sbi->max - 10);176 sbi->butTenPlus ->set_enabled (sbi->value < sbi->max);
177 }177 }
178}178}
179179
@@ -193,6 +193,10 @@
193void SpinBox::setValue(int32_t const value)193void SpinBox::setValue(int32_t const value)
194{194{
195 sbi->value = value;195 sbi->value = value;
196 if (sbi->value > sbi->max)
197 sbi->value = sbi->max;
198 else if (sbi->value < sbi->min)
199 sbi->value = sbi->min;
196 update();200 update();
197}201}
198202

Subscribers

People subscribed via source and target branches

to status/vote changes: