Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI: Dynamic layouts #1988

Closed
wants to merge 2 commits into from
Closed

GUI: Dynamic layouts #1988

wants to merge 2 commits into from

Conversation

@bgK
Copy link
Member

bgK commented Dec 28, 2019

Prior to this PR, a GUI layout was only affected by the screen size.
Now, a layout can additionally be influenced by the GUI dialog and widgets
that use it. This capability is leveraged to implement the following
features:

  • Layout elements that are not bound to a GUI widget do not take space.
    This means that dialogs where the widgets shown depend on for example
    a feature being enabled at configure time no longer have blank spaces.
  • Widgets can define a minimal required size for their contents not to be
    cut. For now this is only used for buttons so their width is always
    sufficient for their caption not to be cut. This mechanism could be
    applied to other widget types in the future.

Before 1:
scummvm00015

After 1:
scummvm00016

Before 2:
scummvm00014

After 2:
scummvm00017

These changes also fix the remaining issue in PR #1942 which I've now rebased on top of this one.

bgK added 2 commits Dec 28, 2019
Previously it was only possible to specify whether items where aligned
to the start or centered in the cross direction of the layouts. It is
now additionally possible to align the items to the far end of the cross
direction or to resize them to match the size of the layout.

Terminology and behavior are loosely based on CSS's flexbox containers.
Prior to this change, a GUI layout was only affected by the screen size.
Now, a layout can additionally be influenced by the GUI dialog and widgets
that uses it. This capability is leveraged to implement the following
features:

* Layout elements that are not bound to a GUI widget do not take space.
   This means that dialogs where the widgets shown depend on for example
   a feature being enabled at configure time no longer have blank spaces.
* Widgets can define a minimal required size for their contents not to be
   cut. For now this is only used for buttons so their width is always
   sufficient for their caption not to be cut. This mechanism could be
   applied to other widget types in the future.
@bluegr

This comment has been minimized.

Copy link
Member

bluegr commented Dec 28, 2019

Very nice!
Since the new feature about the minimal size applies only to buttons for now, it would be preferable if a warning was shown, when somebody tries to use this feature with other widgets

@bgK

This comment has been minimized.

Copy link
Member Author

bgK commented Dec 28, 2019

Since the new feature about the minimal size applies only to buttons for now, it would be preferable if a warning was shown, when somebody tries to use this feature with other widgets

I'm not sure what you mean. The feature is implicitly enabled for all widget types that implement Widget::getMinSize. There is no way to use it for other widget types.

@bluegr

This comment has been minimized.

Copy link
Member

bluegr commented Dec 28, 2019

@bgK: great, thanks for clarifying this.

Looks good to me overall, +1 from me

Copy link
Member

sev- left a comment

This is an awesome change.

How does it behave when you switch between games with different number of GUIO? Does it still reflow the layout?

Also, the change is big, please bump the GUI theme version.

@bgK

This comment has been minimized.

Copy link
Member Author

bgK commented Dec 31, 2019

How does it behave when you switch between games with different number of GUIO? Does it still reflow the layout?

Yes, the layout is refreshed each time the dialog is opened.

Also, the change is big, please bump the GUI theme version.

I will merge #1942 at the same time as this along with a version bump.

@sev-

This comment has been minimized.

Copy link
Member

sev- commented Dec 31, 2019

Cool, please do.

@sev-
sev- approved these changes Dec 31, 2019
@bgK

This comment has been minimized.

Copy link
Member Author

bgK commented Jan 4, 2020

Merged manually.

@bgK bgK closed this Jan 4, 2020
@Tkachov

This comment has been minimized.

Copy link
Contributor

Tkachov commented Jan 6, 2020

Did anyone test how it works on Cloud tab (maybe LAN as well)? (I'm away from my desktop, so I won't be able to do it a couple more days.)

I'm a little bit worried about that tab, because it has ScrollContainer and hides and shows widgets in it depending on storage state. Also, lowres had some truncated labels, maybe "cloud.scummvm.org" button was also truncated.

@bgK

This comment has been minimized.

Copy link
Member Author

bgK commented Jan 6, 2020

Did anyone test how it works on Cloud tab (maybe LAN as well)?

I went trough all the dialogs that have a layout. The cloud tab does not seem to have major issues with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.