Bug 357901 - Control bar buttons span out of the window
Summary: Control bar buttons span out of the window
Status: RESOLVED FIXED
Alias: None
Product: gcompris
Classification: Applications
Component: general (other bugs)
Version First Reported In: git master
Platform: unspecified All
: NOR minor
Target Milestone: ---
Assignee: Stefan Toncu
URL: http://postimg.org/image/7ww84fy8b/
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-12 20:55 UTC by Bruno Coudoin
Modified: 2016-01-28 20:12 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Fix for the Bug (1.87 KB, patch)
2016-01-14 21:52 UTC, Stefan Toncu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Coudoin 2016-01-12 20:55:44 UTC
In portrait mode the buttons in the control bar may span out of the window in portrait mode. The buttons should shrink to avoid this case.

Reproducible: Always

Steps to Reproduce:
1. Start GCompris
2. Resize the window width at the max possible

Actual Results:  
The config button in the bar is cut

Expected Results:  
The button in the control bar should be shrinked to accomodate the small width.
Comment 1 Stefan Toncu 2016-01-14 21:52:59 UTC
Created attachment 96646 [details]
Fix for the Bug

I added some variables and a function in order to compute the values needed to resize the buttons.
It works both in home menu and in activities.

Observation: in some activities, in portrait mode, the "sublevel count" overrides the "next level" button (i.e. "Algorithm"), but its drawn in every activity that uses sublevels, so i couldn't make any changes regarding it from the "bar.qml" file.
Comment 2 Holger Kaelberer 2016-01-15 07:30:47 UTC
(In reply to Stefan Toncu from comment #1)
> Created attachment 96646 [details]
> Fix for the Bug
> 
> I added some variables and a function in order to compute the values needed
> to resize the buttons.

Best next step would be to open a review request on 
https://git.reviewboard.kde.org/
for gcompris and assign it to group gcompris. Reviewing code is better done there.

Anyway, some nitpicks on your diff:

+      * type: real
+      * Minimum size for BarZoom
+      */
+    property real minWidth: (parent.width-20- 10 * ApplicationInfo.ratio)/totalWidth

properties, that don't change should be readonly property and don't need to be documented (does no harm of course ;-)

+                totalWidth+=computeWidth(buttonList[def].bid)
+                noButtons++

You probably could use property binding for totalWidth (http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html) which is the recommended way to dynamically change such values. But well it works nicely, so fine for me to keep it as is.

> It works both in home menu and in activities.

Yeah looks nice!

Two things I noticed:

1. The levelText is the only element in the bar that is not yet scaled together with the other buttons. We could probably either use pixelSize and scale that down, or keep fontSize (== pointSize) and use a scale value.

2. When the buttons are already downscaled and you go from level 9 to level 10 the bar expands to display the additional digit in levelText and pushes the rightmost button out of the visible area.

> 
> Observation: in some activities, in portrait mode, the "sublevel count"
> overrides the "next level" button (i.e. "Algorithm"), but its drawn in every
> activity that uses sublevels, so i couldn't make any changes regarding it
> from the "bar.qml" file.

Ack, in these cases the Score element should be moved to another place (if necessary depending on orientation). Do you want to fix this also? ;-)
Comment 3 Stefan Toncu 2016-01-15 18:48:52 UTC
Hi! Thank you for your comment and for you advice. I will upload my patch on reviewBoard and try to make the changes you highlighted;

Regarding the Score element, i would like to do it, but i don't have time right now because i have to study for my exams. If it's possible, i would still want to work at it after i finish with my exams.
Comment 4 Stefan Toncu 2016-01-15 18:49:11 UTC
Hi! Thank you for your comment and for you advice. I will upload my patch on reviewBoard and try to make the changes you highlighted;

Regarding the Score element, i would like to do it, but i don't have time right now because i have to study for my exams. If it's possible, i would still want to work at it after i finish with my exams.
Comment 5 Jazeix Johnny 2016-01-28 20:12:38 UTC
commit aef8ab5