Allow users to define their own economy default settings

Bug #1827696 reported by GunChleoc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Wishlist
Unassigned

Bug Description

Introduce economy profiles that the player can define to set the default quantity of wares on game start.

With all bells and whistles, this would allow saving as many profiles as the player wants, coded by tribe. The player can then define their favorite setting too. There would also be a "factory reset" for the tribe's default target quantity as defined in the Lua files.

Tags: economy tribes ui

Related branches

Changed in widelands:
assignee: nobody → Benedikt Straub (nordfriese)
milestone: none → build21-rc1
status: Confirmed → In Progress
Revision history for this message
Benedikt Straub (nordfriese) wrote :

Two quick questions:
– Any suggestions how to improve the user interface? (screenshot attached)
– The dropdown on the worker panel behaves as it should, the one on the ware panel refuses to open when clicking on it. Which peculiarity of dropdowns am I overlooking?

Revision history for this message
Toni Förster (stonerl) wrote :

Would it be possible to have the [R] and [S] button next to the dropdown? and the [+][-] centred atop?

Like so:

| |
| [+] [-] |
|[Dropdown][R][S]|
|________________|

Revision history for this message
Toni Förster (stonerl) wrote :

Hmmm Launchpad butchered the Layout...

Revision history for this message
Toni Förster (stonerl) wrote :

I gimped your pic a little

Revision history for this message
GunChleoc (gunchleoc) wrote :

> The dropdown on the worker panel behaves as it should, the one on the ware panel refuses to open when clicking on it. Which peculiarity of dropdowns am I overlooking?

Check whether the ware panel is thinking, there might be a panel refresh in the way. Part fro that, it shouldn't disappear unless you move the mouse away or focus something else. We also can't rule out bugs - I recently fixed some in https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Hm, trying to found out who think()s too much led me to a nice chase in circles...

I found it easier to instead redesign the EconomyOptionsWindow in general. The buttons and dropdown now exist once and belong to the window rather than being created for each tab. This allows more flexibility in design and a (imho) more natural control flow. Screenshot attached.

While I´m already on it, if you want something else in this window to be redesigned, now is the chance ;)

Revision history for this message
Toni Förster (stonerl) wrote :

Is it somehow possible to remove the brown strip on the right hand side and let the content of the tab span over the complete width? Maybe by increasing the gaps between the icons?

Revision history for this message
Benedikt Straub (nordfriese) wrote :

The tab content´s width is set dynamically according to the number of columns to display. Previously this was solved by resizing the window when changing the tab so it completely filled the window, but the additional buttons give the window a fixed width.
The tab panel is an implementation of AbstractWaresDisplay which is used in many places, but I´ll check if I can add an optional hgap…

Revision history for this message
GunChleoc (gunchleoc) wrote :

The + and + buttons could be replaced by a spinbox.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have had another idea: How about arranging the wares/workers horizontally instead of vertically? This will avoid the problem with the blank space, allow us to put all buttons in 1 row and we can get rid of te layout code in Tribes::postload().

Revision history for this message
Benedikt Straub (nordfriese) wrote :

OK, I´ll change the buttons´ style to mimic a spinbox.

> How about arranging the wares/workers horizontally instead of vertically?

I don´t understand what you mean here. Rotating the panel by 90°, or arranging all in one long row, or …? Could you make a mockup please?

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Spinbox-Style is online :) Are the buttons good like this or should I make them smaller?

Revision history for this message
GunChleoc (gunchleoc) wrote :

Rotating by 90°

We now have:

granite
log

And afterwards, we would have:

granite | log

It actually used to be that way once:

https://wl.widelands.org/wlmedia/wlscreens/screens/Build%2017/Many%20statistics%20and%20messages.png

Revision history for this message
Benedikt Straub (nordfriese) wrote :

There´s a built-in way to set this easily, but I am not convinced it looks better...

Revision history for this message
Toni Förster (stonerl) wrote :

I prefer the stock. What about using icons instead of text for save and apply/use and tooltip the text? For save the floppy disc icon and for apply/use the green start button we use in buildings.

We would have a narrower window.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I like the spinbox design from #13.

For #15, remove the code in Tribes::postload() first or switch to fullscreen before starting the game to get the full row length

+1 for the save profile window, very nice! :)

Revision history for this message
kaputtnik (franku) wrote :

I do also prefer the arrangements like we have in the stock.

If feasible get rid of the apply button: Change the values as soon one clicks on a pre-saved setting.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

I´ll stick with the stock-window-like layout then. Removed the apply button as in #18 and replaced the "Save" text with an icon.
The minimum width of the tab depends on the (tribe-specific) number of columns (which also depends on the screen height); I now optimized the window design for 8 columns.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Sounds good to me.

In case you feel like some refactoring, that code in Tribes::postload for shortening the columns to fit on screen is really ugly. The tribe should not care about this at all, it should be a function of the wares display only, which then subscribes to GraphicResolutionChanged and relayouts itself on fullscreen switch.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Good suggestion, will do that :)

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Um, another quick question: The AbstractWaresDisplay now recalculates its columns when notified of a GraphicResolutionChanged. This works already, but when it becomes wider due to lower yres, the additional columns disappear behind the window´s border.
Which method(s) do I now have to call to make sure the parent Window resizes itself? layout(), update_desired_size(), set_layout_toplevel(), ... , and on what object (this, get_parent(), ...)?

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Could now hack something together that works for most windows but not for all yet... Is this looking good so far (at least the stock menu)?

Revision history for this message
kaputtnik (franku) wrote :

Played around with this new feature, in the beginning it is a bit confusing:

The profiles do only apply, if i have marked some (or all) of the wares/workers. This confused me until i have read the tooltip :). In my opinion applying a profile should apply the values without marking them. So one can compare the values easily (without marking all wares/workers).

2 Issues:

1. Closing and reopen the economy settings displays always 'Default', whereas the values of the predefined wares/workers are shown. So one does not know which profile is actually used.

2. If you delete a profile, it is still shown in the dropdown menu. Choosing it then crashes the game.

Revision history for this message
kaputtnik (franku) wrote :

To clarify:

'So one can compare the values easily (without marking all wares/workers).' should be:

So one can compare the predefined values of the profiles easily (without marking all wares/workers).

Forgot:
This is a great feature, thanks for implementing!

Revision history for this message
Benedikt Straub (nordfriese) wrote :

> In my opinion applying a profile should apply the values without marking them

OK, I´ll implement that the profile will be applied to everything if nothing is marked. But if some values are marked, the profile will be applied to only those of course.

> Closing and reopen the economy settings displays always 'Default' … So one does not know which profile is actually used.

That cannot be fixed in an elegant way, because the economy window is newly created whenever you open it. The last applied profile name would have to be saved in the associated economy, which should not interact so closely with the user interface IMHO.
I could imagine that the dropdown is initially set to the name of a predefined profile if it matches the settings exactly, or no name is displayed if no such setting exists. Same whenever target settings get changed.

> If you delete a profile, it is still shown in the dropdown menu. Choosing it then crashes the game.

I´ll look into it

Revision history for this message
GunChleoc (gunchleoc) wrote :

Regarding #22, you can play around with set_size, set_desired_size and set_center_panel.

Revision history for this message
GunChleoc (gunchleoc) wrote :

And yes, implement the layouting into a layout() function. Classes like UI::Box call this.

Revision history for this message
Benedikt Straub (nordfriese) wrote :
Revision history for this message
Benedikt Straub (nordfriese) wrote :
Revision history for this message
Benedikt Straub (nordfriese) wrote :
Revision history for this message
Benedikt Straub (nordfriese) wrote :
Changed in widelands:
assignee: Benedikt Straub (nordfriese) → nobody
status: In Progress → Fix Committed
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.