mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
use CListHelpers to remove duplicated code
CListHelpers::UpDownKey() allows to remove duplicated
code from channellist, bouquetlist and bouqueteditor.
Origin commit data
------------------
Branch: ni/coolstream
Commit: c9e72e654f
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2016-01-16 (Sat, 16 Jan 2016)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -2,15 +2,7 @@
|
|||||||
Neutrino-GUI - DBoxII-Project
|
Neutrino-GUI - DBoxII-Project
|
||||||
|
|
||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Copyright (C) 2009,2011,2013,2016 Stefan Seyfried
|
||||||
|
|
||||||
Kommentar:
|
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -166,7 +158,7 @@ void CBEBouquetWidget::hide()
|
|||||||
|
|
||||||
void CBEBouquetWidget::updateSelection(unsigned int newpos)
|
void CBEBouquetWidget::updateSelection(unsigned int newpos)
|
||||||
{
|
{
|
||||||
if(newpos == selected)
|
if (newpos == selected || newpos == (unsigned int)-1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int prev_selected = selected;
|
unsigned int prev_selected = selected;
|
||||||
@@ -272,35 +264,12 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
|||||||
cancelMoveBouquet();
|
cancelMoveBouquet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup)
|
else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup ||
|
||||||
|
msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown)
|
||||||
{
|
{
|
||||||
if (!(Bouquets->empty())) {
|
int new_selected = UpDownKey(*Bouquets, msg, listmaxshow, selected);
|
||||||
int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected - step;
|
|
||||||
|
|
||||||
if (new_selected < 0) {
|
|
||||||
if (selected != 0 && step != 1)
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
|
||||||
new_selected = Bouquets->size() - 1;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown)
|
|
||||||
{
|
|
||||||
if (!(Bouquets->empty())) {
|
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected + step;
|
|
||||||
if (new_selected > (int) Bouquets->size() - 1) {
|
|
||||||
if ((selected != Bouquets->size() - 1))
|
|
||||||
new_selected = Bouquets->size() - 1;
|
|
||||||
else
|
|
||||||
new_selected = 0;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) {
|
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) {
|
||||||
if (!(Bouquets->empty())) {
|
if (!(Bouquets->empty())) {
|
||||||
int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Bouquets->size() - 1;
|
int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Bouquets->size() - 1;
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include <zapit/channel.h>
|
#include <zapit/channel.h>
|
||||||
#include <zapit/bouquets.h>
|
#include <zapit/bouquets.h>
|
||||||
#include <gui/components/cc.h>
|
#include <gui/components/cc.h>
|
||||||
|
#include <gui/widget/listhelpers.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/* class for handling when bouquets changed. */
|
/* class for handling when bouquets changed. */
|
||||||
@@ -51,7 +52,7 @@ public:
|
|||||||
virtual void onBouquetsChanged() {};
|
virtual void onBouquetsChanged() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBEBouquetWidget : public CMenuTarget
|
class CBEBouquetWidget : public CMenuTarget, public CListHelpers
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -5,14 +5,7 @@
|
|||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Copyright (C) 2011 CoolStream International Ltd
|
Copyright (C) 2011 CoolStream International Ltd
|
||||||
|
Copyright (C) 2009,2011,2013,2016 Stefan Seyfried
|
||||||
Kommentar:
|
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -283,7 +276,7 @@ void CBEChannelWidget::hide()
|
|||||||
|
|
||||||
void CBEChannelWidget::updateSelection(unsigned int newpos)
|
void CBEChannelWidget::updateSelection(unsigned int newpos)
|
||||||
{
|
{
|
||||||
if(newpos == selected)
|
if (newpos == selected || newpos == (unsigned int)-1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int prev_selected = selected;
|
unsigned int prev_selected = selected;
|
||||||
@@ -360,35 +353,12 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
|||||||
cancelMoveChannel();
|
cancelMoveChannel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup)
|
else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup ||
|
||||||
|
msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown)
|
||||||
{
|
{
|
||||||
if (!(Channels->empty())) {
|
int new_selected = UpDownKey(*Channels, msg, listmaxshow, selected);
|
||||||
int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected - step;
|
|
||||||
|
|
||||||
if (new_selected < 0) {
|
|
||||||
if (selected != 0 && step != 1)
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
|
||||||
new_selected = Channels->size() - 1;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown)
|
|
||||||
{
|
|
||||||
if (!(Channels->empty())) {
|
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected + step;
|
|
||||||
if (new_selected > (int) Channels->size() - 1) {
|
|
||||||
if ((selected != Channels->size() - 1))
|
|
||||||
new_selected = Channels->size() - 1;
|
|
||||||
else
|
|
||||||
new_selected = 0;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) {
|
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) {
|
||||||
if (!(Channels->empty())) {
|
if (!(Channels->empty())) {
|
||||||
int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Channels->size() - 1;
|
int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Channels->size() - 1;
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <driver/framebuffer.h>
|
#include <driver/framebuffer.h>
|
||||||
#include <gui/widget/menue.h>
|
#include <gui/widget/menue.h>
|
||||||
|
#include <gui/widget/listhelpers.h>
|
||||||
#include <gui/components/cc.h>
|
#include <gui/components/cc.h>
|
||||||
#include <zapit/client/zapitclient.h>
|
#include <zapit/client/zapitclient.h>
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
#include <zapit/channel.h>
|
#include <zapit/channel.h>
|
||||||
#include <zapit/bouquets.h>
|
#include <zapit/bouquets.h>
|
||||||
|
|
||||||
class CBEChannelWidget : public CMenuTarget
|
class CBEChannelWidget : public CMenuTarget, public CListHelpers
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -2,15 +2,7 @@
|
|||||||
Neutrino-GUI - DBoxII-Project
|
Neutrino-GUI - DBoxII-Project
|
||||||
|
|
||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Copyright (C) 2009,2011,2013,2015-2016 Stefan Seyfried
|
||||||
|
|
||||||
Kommentar:
|
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -391,6 +383,8 @@ const struct button_label CBouquetListButtons[4] =
|
|||||||
|
|
||||||
void CBouquetList::updateSelection(int newpos)
|
void CBouquetList::updateSelection(int newpos)
|
||||||
{
|
{
|
||||||
|
if (newpos < 0) /* to avoid all callers having to check */
|
||||||
|
return;
|
||||||
if((int) selected != newpos) {
|
if((int) selected != newpos) {
|
||||||
int prev_selected = selected;
|
int prev_selected = selected;
|
||||||
unsigned int oldliststart = liststart;
|
unsigned int oldliststart = liststart;
|
||||||
@@ -528,34 +522,12 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
if (!Bouquets.empty())
|
if (!Bouquets.empty())
|
||||||
updateSelection(Bouquets.size()-1);
|
updateSelection(Bouquets.size()-1);
|
||||||
}
|
}
|
||||||
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup)
|
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup ||
|
||||||
|
msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)
|
||||||
{
|
{
|
||||||
if (!Bouquets.empty()) {
|
int new_selected = UpDownKey(Bouquets, msg, listmaxshow, selected);
|
||||||
int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected - step;
|
|
||||||
if (new_selected < 0) {
|
|
||||||
if (selected != 0 && step != 1)
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
|
||||||
new_selected = Bouquets.size() - 1;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)
|
|
||||||
{
|
|
||||||
if (!Bouquets.empty()) {
|
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected + step;
|
|
||||||
if (new_selected > (int) Bouquets.size() - 1) {
|
|
||||||
if ((selected != Bouquets.size() - 1))
|
|
||||||
new_selected = Bouquets.size() - 1;
|
|
||||||
else
|
|
||||||
new_selected = 0;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down) {
|
else if(msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down) {
|
||||||
if(bShowChannelList) {
|
if(bShowChannelList) {
|
||||||
int mode = CNeutrinoApp::getInstance()->GetChannelMode();
|
int mode = CNeutrinoApp::getInstance()->GetChannelMode();
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#define __bouquetlist__
|
#define __bouquetlist__
|
||||||
|
|
||||||
#include <gui/channellist.h>
|
#include <gui/channellist.h>
|
||||||
|
#include <gui/widget/listhelpers.h>
|
||||||
|
|
||||||
#include <driver/framebuffer.h>
|
#include <driver/framebuffer.h>
|
||||||
#include <system/lastchannel.h>
|
#include <system/lastchannel.h>
|
||||||
@@ -77,7 +78,7 @@ class CBouquet
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CBouquetList
|
class CBouquetList : public CListHelpers
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CFrameBuffer *frameBuffer;
|
CFrameBuffer *frameBuffer;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
Neutrino-GUI - DBoxII-Project
|
Neutrino-GUI - DBoxII-Project
|
||||||
|
|
||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Copyright (C) 2007-2015 Stefan Seyfried
|
Copyright (C) 2007-2016 Stefan Seyfried
|
||||||
|
|
||||||
Kommentar:
|
Kommentar:
|
||||||
|
|
||||||
@@ -728,30 +728,12 @@ int CChannelList::show()
|
|||||||
else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_end) {
|
else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_end) {
|
||||||
actzap = updateSelection((*chanlist).size()-1);
|
actzap = updateSelection((*chanlist).size()-1);
|
||||||
}
|
}
|
||||||
else if (!empty && (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup))
|
else if (!empty && (msg == CRCInput::RC_up || (int)msg == g_settings.key_pageup ||
|
||||||
|
msg == CRCInput::RC_down || (int)msg == g_settings.key_pagedown))
|
||||||
{
|
{
|
||||||
displayList = 1;
|
displayList = 1;
|
||||||
int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1
|
int new_selected = UpDownKey((*chanlist), msg, listmaxshow, selected);
|
||||||
int new_selected = selected - step;
|
if (new_selected >= 0)
|
||||||
if (new_selected < 0) {
|
|
||||||
if (selected != 0 && step != 1)
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
|
||||||
new_selected = (*chanlist).size() - 1;
|
|
||||||
}
|
|
||||||
actzap = updateSelection(new_selected);
|
|
||||||
}
|
|
||||||
else if (!empty && (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown))
|
|
||||||
{
|
|
||||||
displayList = 1;
|
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
|
||||||
int new_selected = selected + step;
|
|
||||||
if (new_selected > (int) (*chanlist).size() - 1) {
|
|
||||||
if ((selected != (*chanlist).size() - 1))
|
|
||||||
new_selected = (*chanlist).size() - 1;
|
|
||||||
else
|
|
||||||
new_selected = 0;
|
|
||||||
}
|
|
||||||
actzap = updateSelection(new_selected);
|
actzap = updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
else if (!edit_state && (msg == (neutrino_msg_t)g_settings.key_bouquet_up ||
|
else if (!edit_state && (msg == (neutrino_msg_t)g_settings.key_bouquet_up ||
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <driver/framebuffer.h>
|
#include <driver/framebuffer.h>
|
||||||
#include <gui/widget/menue.h>
|
#include <gui/widget/menue.h>
|
||||||
|
#include <gui/widget/listhelpers.h>
|
||||||
#include <gui/components/cc.h>
|
#include <gui/components/cc.h>
|
||||||
#include <system/lastchannel.h>
|
#include <system/lastchannel.h>
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ enum {
|
|||||||
|
|
||||||
class CBouquet;
|
class CBouquet;
|
||||||
|
|
||||||
class CChannelList
|
class CChannelList : public CListHelpers
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum state_
|
enum state_
|
||||||
|
Reference in New Issue
Block a user