Those PRs contain much more detailed information and also screenshots:
-
Qt UI:
-
NCurses UI:
-
Abstract UI:
-
Auto-wrapping feature (8 months later): libyui/libyui-old#165
Have a scrollable selection widget that has for each item:
- A title
- A descriptive text with potentially multiple lines
- An optional icon
- Single or multi selection
- Custom states, not only on or off
- A custom icon (Qt) or status Text (NCurses) for each status
- Status 0 corresponds to "off",
- status 1 corresponds to "on",
- status 2..n are completely custom and application-defined
Those limitations were all agreed upon and accepted when we started it:
- No auto-wrapping, in particular not for the longer descriptive text
- No RichText / HTML
- The description is optional, but even then there will be one empty separator line between each item in NCurses
Just set QLabel::setWordWrap( true )
for the description QLabel for each item.
https://doc.qt.io/qt-5/qlabel.html#wordWrap-prop
The price of that is that the widget can no longer determine its initial preferred size since now it can trade less width for more height and vice versa. That means that the widget would need to be forced to a certain size with our usual MinSize()
/ MinWidth()
/ MinHeight()
widgets like similar scrollable widgets. That tradeoff should be acceptable enough.
In NCurses that's much harder. It might be possible, though: For each item, use the NCWordWrapper
class that was created for auto-wrapping YLabel
/ YQLabel
/ NCLabel
widgets to word-wrap the description into the desired width, then query the NCWordWrapper
how many lines that needs, then insert that number of description lines into the (NCTable
based) NCurses widget as items with each wrapped line of that NCWordWrapper
result.
That's not very elegant and probably quite wasteful in terms of performance, but doable.
Use the description QLabel
's setTextFormat()
to explicitly set it to RichText format or rely on Qt's autodetection (and make sure to add some markup in the Ruby part).
https://doc.qt.io/qt-5/qlabel.html#textFormat-prop
This would require quite some refactoring to extract the libyui-ncurses RichText formatting into a separate class for a similar approach to auto-wrapping above: Render to memory (i.e. to a multi-line string), count the lines of the result and then add line by line of that result to low-level items (sub-items of the real items).
This is possible, but risky, and it will be a larger job.
After a look into the NCRichText widget, that does not look like a viable option.
To be honest, I don't think that adding the inline descriptions (even if we can fix the RichText + break-line problems) would be the right solution for 15.4. It brings its own problems, specially taking into account we have around 20 items in the registration screen, potentially more. And reading this gist, the changes in implementation look to me risky enough to discard it for 15.4.
Unfortunately there is no time to completely rethink the whole screen with an alternative approach (likely not based on a long scrolled list of tri-state checkboxes that change dynamically on every action of the user). So if we do something for 15.4, it must be something that represents a smaller change compared to the current UI. Basically something that looks & feel the same but that improves the possibilities regarding theming and that reduces the usability problems (like crazy scroll jumps).