aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhaggi <sascha.woo@gmail.com>2015-06-28 08:59:43 +0200
committerxhaggi <sascha.woo@gmail.com>2015-06-28 08:59:43 +0200
commita4e2127657b220322de52fcc60787a01ea91a4ad (patch)
tree955b4a33dc268890db7bb7637cd51132912473d0
parent2add13b600847aedd1644d99006d961ecea98818 (diff)
[pvr] sort equal client channel numbers by name if not sub-channels
If client channel numbers are used for ordering the channels and you have more than one backend, it's possible that you end up with different channels holding the same client channel number. In that case the channels are sorted by its sub channel number which is zero for normal channels. To have a nicely sorted list this changes extends the comparator to compare the names of the channels in case there is no sub-channel number.
-rw-r--r--xbmc/pvr/channels/PVRChannelGroup.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/xbmc/pvr/channels/PVRChannelGroup.cpp b/xbmc/pvr/channels/PVRChannelGroup.cpp
index 58988a5f45..abef3f3fea 100644
--- a/xbmc/pvr/channels/PVRChannelGroup.cpp
+++ b/xbmc/pvr/channels/PVRChannelGroup.cpp
@@ -341,7 +341,12 @@ struct sortByClientChannelNumber
bool operator()(const PVRChannelGroupMember &channel1, const PVRChannelGroupMember &channel2) const
{
if (channel1.channel->ClientChannelNumber() == channel2.channel->ClientChannelNumber())
- return channel1.channel->ClientSubChannelNumber() < channel2.channel->ClientSubChannelNumber();
+ {
+ if (channel1.channel->ClientSubChannelNumber() > 0 || channel2.channel->ClientSubChannelNumber() > 0)
+ return channel1.channel->ClientSubChannelNumber() < channel2.channel->ClientSubChannelNumber();
+ else
+ return channel1.channel->ChannelName() < channel2.channel->ChannelName();
+ }
return channel1.channel->ClientChannelNumber() < channel2.channel->ClientChannelNumber();
}
};