Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3278 closed enhancement (duplicate)

Lobby - sortable lists

Reported by: elexis Owned by:
Priority: Nice to Have Milestone:
Component: Multiplayer lobby Keywords:
Cc: Patch:

Description

(1) Enhancement: The list of players and games in the lobby should be sortable.

An arrow icon would be nice to indicate that function. If you click it it should change between ascending and descending order.

It could use the ModernDropDownArrow sprite (defined in binaries/data/mods/mod/gui/common/modern/sprites.xml). This sprite uses global/modern/dropdown-arrow.png. This icon could be mirrored to indicate the other order.

The lists should be sortable by each attribute.

(2) Bugfix: When the playerlist is refreshed, it is replaced with a alphabetically sorted list. But if another player joins, he/she is appended to the end of the list, instead of the correct place.

Attachments (1)

sorted_list.png (168.5 KB ) - added by Vladislav Belov 9 years ago.

Download all attachments as: .zip

Change History (13)

by Vladislav Belov, 9 years ago

Attachment: sorted_list.png added

comment:1 by Vladislav Belov, 9 years ago

It should look like this? And how highlight the attribute, which was selected?

in reply to:  1 ; comment:2 by elexis, 9 years ago

Replying to vladislavbelov:

It should look like this?

Yes, that is what I had in mind. I'm not sure if its better if the icon is displayed at the left or at the right side of the column (might look like the arrow is on the left side when it is actually on the right on that screenshot).


And how highlight the attribute, which was selected?

This ticket is somewhat related to that question: #3244, in particular attachment:t3244_keep_gamelist_selection_r16665.patch:ticket:3244. You just have to set the gamesBox.selected variable to the index you want to select. If that patch is committed, then you know the previously selected server by the g_selectedGameIP variable (I used the IP address as a unique identifier for the selected server).

Thanks for taking a look at this.

in reply to:  2 ; comment:3 by Vladislav Belov, 9 years ago

Replying to elexis:

This ticket is somewhat related to that question: #3244, in particular attachment:t3244_keep_gamelist_selection_r16665.patch:ticket:3244. You just have to set the gamesBox.selected variable to the index you want to select. If that patch is committed, then you know the previously selected server by the g_selectedGameIP variable (I used the IP address as a unique identifier for the selected server).

I mean not a row, but a column selection with attribute, which was selected for sorting.

in reply to:  3 ; comment:4 by elexis, 9 years ago

Replying to vladislavbelov:

I mean not a row, but a column selection with attribute, which was selected for sorting.

If you click that icon, then you know the row, you can save it to a variable. If a gamelist update arrives, then you know by that variable which column was selected.

You are also welcome to https://webchat.quakenet.org/?channels=0ad-dev if you want to ask more questions.

in reply to:  4 comment:5 by Vladislav Belov, 9 years ago

Replying to elexis: Maybe create style like ModernButtonOrder, instead of using sprite in lobby.xml?

comment:6 by scythetwirler, 9 years ago

Related: #2405

Last edited 9 years ago by scythetwirler (previous) (diff)

comment:7 by elexis, 9 years ago

The "sortable list" feature could be implemented for all lists, so that you have to do it only once and not for each list object.

In the xml files the list is defined by the type="olist" attribute. You could add an sortable="true" attribute to the lobby.xml lists.

The behavior of the olist is defined in source/gui/COList.cpp.

In the c++ part, you can find out if it is sortable with: GUI<bool>::GetSetting(this, "sortable", sortable);

You can add some calls to debug_printf to find out which part is called when (I don't know anything about that code part either for now).

Last edited 9 years ago by elexis (previous) (diff)

in reply to:  7 comment:8 by Vladislav Belov, 9 years ago

Replying to elexis:

The "sortable list" feature could be implemented for all lists, so that you have to do it only once and not for each list object.

In the xml files the list is defined by the type="olist" attribute. You could add an sortable="true" attribute to the lobby.xml lists.

The behavior of the olist is defined in source/gui/COList.cpp.

In the c++ part, you can find out if it is sortable with: GUI<bool>::GetSetting(this, "sortable", sortable);

You can add some calls to debug_printf to find out which part is called when (I don't know anything about that code part either for now).

Yep, I know about behavior of the olist, and I'm already thinking about adding this feature to olist. But need show an order near the title of attribute. It's can be the arrow text or image (e.g. "Name (Asc.)").

Last edited 9 years ago by Vladislav Belov (previous) (diff)

comment:9 by elexis, 9 years ago

A button ModernButtonOrder would be nice indeed.

in reply to:  9 comment:10 by Vladislav Belov, 9 years ago

Replying to elexis:

A button ModernButtonOrder would be nice indeed.

I have realized feature from #2405. But there is very interesting moment of naming: What we selected: heading, columnt or def? Now I just set "selected_def" (olist attribute) to def id, which was selected.

comment:11 by leper, 9 years ago

Milestone: Backlog
Resolution: duplicate
Status: newclosed

Dupe of #2405.

Icons should just be defined in the style properties of the list. Icons used might just be placeholders which we can fix later on. If we go with an arrow that should be to the right of the column heading (as it is for every other gui I've encountered).

in reply to:  11 comment:12 by Vladislav Belov, 9 years ago

Replying to leper:

Dupe of #2405.

Icons should just be defined in the style properties of the list. Icons used might just be placeholders which we can fix later on. If we go with an arrow that should be to the right of the column heading (as it is for every other gui I've encountered).

Yep, it's duplicate, but more common ticket. The question about COList I have moved to #2405.

Note: See TracTickets for help on using tickets.