xbmc/xbmc — pull request #5959 by Montellese (2014-12-16 18:03:56+00:00)
Title: sorting: cleanup and refactor to allow different sort orders for the different sort methods

The first two commits are merely cosmetics and clean up the GUI view related code to better follow our coding style guidelines.
The last commit changes the behaviour of sorting in GUI listings from using a single sort order for all available sort methods to using a separate sort order for every available sort method.

Right now when a user sorts a list of items by title in descending order and moves on to sorting by year the list will also be sorted in descending order. While that doesn't sound completely wrong (even though it feels unintuitive to me) when moving on to sorting by rating the list will be sorted in ascending order. The reason for this is that there's some code that inverts the sort order for specific sort methods which make better sense with a descending sort order by default.

With this change when a user sorts a a list of items by title in descending order and moves on to sorting by year the list will be sorted in ascending order. And when he moves on to sorting by rating the list will be sorted in descending order (because that makes more sense by default).

Apart from changing the IMO ackward behaviour when switching between sort methods this also fixes an issue with smartplaylists. There a user can define a default sort method and order. If that sort method is e.g. set to sorting by rating and the sort order is set to descending the resulting GUI list will be sorted by rating in ascending order because the above mentioned logic inverts the sort order of certain sort methods.