From 63cf1164956cfa84da68c9e82f9dd861c0e2acd5 Mon Sep 17 00:00:00 2001 From: satbaby Date: Fri, 11 May 2012 13:12:47 +0200 Subject: [PATCH] move unique sort to eventlist.cpp --- src/gui/eventlist.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 80011f60a..a3ee01741 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -87,6 +87,11 @@ inline static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& return a.startTime < b.startTime; } +inline static bool sortbyEventid (const CChannelEvent& a, const CChannelEvent& b) +{ + return (a.channelID == b.channelID && a.eventID == b.eventID); +} + CNeutrinoEventList::CNeutrinoEventList() { frameBuffer = CFrameBuffer::getInstance(); @@ -1043,7 +1048,12 @@ bool CNeutrinoEventList::findEvents(void) } box.hide(); } - sort(evtlist.begin(),evtlist.end(),sortByDateTime); + if(!evtlist.empty()){ + sort(evtlist.begin(),evtlist.end(),sortByDateTime); + unique(evtlist.begin(), evtlist.end(),sortbyEventid); + evtlist.erase(unique(evtlist.begin(), evtlist.end(),sortbyEventid), evtlist.end()); + } + current_event = (unsigned int)-1; time_t azeit=time(NULL);