From 0a83f0a7ef5a122111d0f35be8de3d57d712d91e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 15:38:04 +0100 Subject: [PATCH] eventlist: use CListHelpers::UpDownKey Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/99453de557eeed8195d3df85eee0a1ddba8e1a0e Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 27 ++++----------------------- src/gui/eventlist.h | 3 ++- src/gui/widget/listhelpers.cpp | 1 + 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 49f76757d..7f6560d49 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2009-2014 Stefan Seyfried + Copyright (C) 2009-2016 Stefan Seyfried License: GPL @@ -359,7 +359,6 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { bool paint_buttonbar = false; //function bar - int step = 0; int prev_selected = selected; // TODO: do we need this at all? Search button is always painted IIUC... if ((g_settings.key_channelList_addremind != (int)CRCInput::RC_nokey) || @@ -367,27 +366,9 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna ((g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) && (g_settings.key_channelList_addrecord != (int)CRCInput::RC_nokey))) paint_buttonbar = true; - - if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) - { - step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - selected -= step; - if((prev_selected-step) < 0) // because of uint - selected = evtlist.size() - 1; - paintDescription(selected); - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - selected += step; - - if(selected >= evtlist.size()) - { - if (((evtlist.size() / listmaxshow) + 1) * listmaxshow == evtlist.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == (int)listmaxshow) && (selected < (((evtlist.size() / listmaxshow) + 1) * listmaxshow))) ? (evtlist.size() - 1) : 0; - } + int new_sel = UpDownKey(evtlist, msg, listmaxshow, selected); + if (new_sel >= 0) { + selected = new_sel; paintDescription(selected); } paintItem(prev_selected - liststart, channel_id); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 9bda01658..a5d9b9737 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -40,11 +40,12 @@ #include "infoviewer.h" #include "widget/menue.h" +#include "widget/listhelpers.h" #include -class CEventList +class CEventList : public CListHelpers { // Eventfinder start public: diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 0f368a698..7ad2e1cec 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -69,3 +69,4 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int);