mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
api4: upgrade channel and bouquet edit (testing)
This commit is contained in:
@@ -193,7 +193,7 @@ bouqueteditor.lock Sperren
|
||||
bouqueteditor.move Bewegen
|
||||
bouqueteditor.move_to Bewegen zu
|
||||
bouqueteditor.name Bouquet-Verwaltung
|
||||
bouqueteditor.newbouquetname Neuer Name des Bouquets
|
||||
bouqueteditor.newbouquetname Neuer Name
|
||||
bouqueteditor.rename Umbenennen
|
||||
bouqueteditor.return Fertig
|
||||
bouqueteditor.savechanges? Sollen die Änderungen gespeichert werden?
|
||||
|
@@ -193,7 +193,7 @@ bouqueteditor.lock Lock
|
||||
bouqueteditor.move Move
|
||||
bouqueteditor.move_to Move to
|
||||
bouqueteditor.name Bouquet editor
|
||||
bouqueteditor.newbouquetname New name of bouquets
|
||||
bouqueteditor.newbouquetname New name
|
||||
bouqueteditor.rename Rename
|
||||
bouqueteditor.return ready
|
||||
bouqueteditor.savechanges? Do you want to save the changes?
|
||||
|
@@ -65,7 +65,6 @@ CBEBouquetWidget::CBEBouquetWidget()
|
||||
selected = 0;
|
||||
liststart = 0;
|
||||
state = beDefault;
|
||||
blueFunction = beRename;
|
||||
Bouquets = NULL;
|
||||
iheight = 0;
|
||||
ButtonHeight = 0;
|
||||
@@ -96,15 +95,22 @@ void CBEBouquetWidget::paintItem(int pos)
|
||||
|
||||
if(current < Bouquets->size()) {
|
||||
if ((current == selected) && (state == beMoving))
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 10, ypos, iheight);
|
||||
|
||||
if ((*Bouquets)[current]->bLocked != g_settings.parentallock_defaultlocked)
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 10, ypos, iheight);
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight);
|
||||
|
||||
if ((*Bouquets)[current]->bHidden)
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + 10, ypos, iheight);
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + 26, ypos, iheight);
|
||||
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+iconoffset+20, ypos + iheight - (iheight-fheight)/2, width-iconoffset-20, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color);
|
||||
if ((*Bouquets)[current]->bLocked != g_settings.parentallock_defaultlocked)
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 18 + iconoffset, ypos, iheight);
|
||||
|
||||
if (!(*Bouquets)[current]->tvChannels.empty() ) {
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + 20 + 2*iconoffset - 2, ypos, iheight);
|
||||
}
|
||||
|
||||
if (!(*Bouquets)[current]->radioChannels.empty()) {
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + 20+ 3*iconoffset - 4, ypos, iheight);
|
||||
}
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x +20 + 4*iconoffset, ypos + iheight - (iheight-fheight)/2, width-iconoffset-20, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,37 +142,19 @@ void CBEBouquetWidget::paintHead()
|
||||
header.paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
const struct button_label CBEBouquetWidgetButtons[4] =
|
||||
const struct button_label CBEBouquetWidgetButtons[6] =
|
||||
{
|
||||
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE },
|
||||
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD },
|
||||
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE },
|
||||
{ NEUTRINO_ICON_BUTTON_BLUE , NONEXISTANT_LOCALE /*dummy*/}
|
||||
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE },
|
||||
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME},
|
||||
{ NEUTRINO_ICON_BUTTON_PAUSE , LOCALE_BOUQUETEDITOR_HIDE },
|
||||
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK }
|
||||
};
|
||||
|
||||
void CBEBouquetWidget::paintFoot()
|
||||
{
|
||||
struct button_label Button[4];
|
||||
|
||||
Button[0] = CBEBouquetWidgetButtons[0];
|
||||
Button[1] = CBEBouquetWidgetButtons[1];
|
||||
Button[2] = CBEBouquetWidgetButtons[2];
|
||||
Button[3] = CBEBouquetWidgetButtons[3];
|
||||
|
||||
switch( blueFunction)
|
||||
{
|
||||
case beRename:
|
||||
Button[3].locale = LOCALE_BOUQUETEDITOR_RENAME;
|
||||
break;
|
||||
case beHide:
|
||||
Button[3].locale = LOCALE_BOUQUETEDITOR_HIDE;
|
||||
break;
|
||||
case beLock:
|
||||
Button[3].locale = LOCALE_BOUQUETEDITOR_LOCK;
|
||||
break;
|
||||
}
|
||||
|
||||
::paintButtons(x, y+height, width, 4, Button, width, ButtonHeight);
|
||||
::paintButtons(x, y+height, width, 6, CBEBouquetWidgetButtons, width, ButtonHeight);
|
||||
}
|
||||
|
||||
void CBEBouquetWidget::hide()
|
||||
@@ -345,36 +333,25 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
||||
if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
|
||||
{
|
||||
if (state == beDefault)
|
||||
switch (blueFunction)
|
||||
{
|
||||
case beRename:
|
||||
renameBouquet();
|
||||
break;
|
||||
case beHide:
|
||||
switchHideBouquet();
|
||||
break;
|
||||
case beLock:
|
||||
switchLockBouquet();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(msg==CRCInput::RC_setup)
|
||||
|
||||
else if(msg==CRCInput::RC_pause)
|
||||
{
|
||||
if (state == beDefault)
|
||||
switch (blueFunction)
|
||||
if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
|
||||
{
|
||||
case beRename:
|
||||
blueFunction = beHide;
|
||||
break;
|
||||
case beHide:
|
||||
blueFunction = beLock;
|
||||
break;
|
||||
case beLock:
|
||||
blueFunction = beRename;
|
||||
break;
|
||||
if (state == beDefault)
|
||||
switchHideBouquet();
|
||||
}
|
||||
}
|
||||
else if(msg==CRCInput::RC_stop)
|
||||
{
|
||||
if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
|
||||
{
|
||||
if (state == beDefault)
|
||||
switchLockBouquet();
|
||||
}
|
||||
paintFoot();
|
||||
}
|
||||
else if(msg==CRCInput::RC_ok)
|
||||
{
|
||||
@@ -382,7 +359,17 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
||||
{
|
||||
if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
|
||||
{
|
||||
CBEChannelWidget* channelWidget = new CBEChannelWidget((*Bouquets)[selected]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[selected]->Name, selected);
|
||||
std::string ChannelWidgetCaption=(*Bouquets)[selected]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[selected]->Name;
|
||||
if (!(*Bouquets)[selected]->tvChannels.empty() ) {
|
||||
ChannelWidgetCaption = ChannelWidgetCaption+ " => TV";
|
||||
if (!(*Bouquets)[selected]->radioChannels.empty())
|
||||
ChannelWidgetCaption = ChannelWidgetCaption+ "/Radio";
|
||||
}
|
||||
else if (!(*Bouquets)[selected]->radioChannels.empty()) {
|
||||
ChannelWidgetCaption = ChannelWidgetCaption+ " => Radio";
|
||||
}
|
||||
|
||||
CBEChannelWidget* channelWidget = new CBEChannelWidget(ChannelWidgetCaption, selected);
|
||||
channelWidget->exec( this, "");
|
||||
if (channelWidget->hasChanged())
|
||||
bouquetsChanged = true;
|
||||
@@ -467,7 +454,7 @@ void CBEBouquetWidget::finishMoveBouquet()
|
||||
if (newPosition != origPosition)
|
||||
{
|
||||
Bouquets = &g_bouquetManager->Bouquets;
|
||||
bouquetsChanged = true;
|
||||
bouquetsChanged = bouquetsChanged | true;
|
||||
}
|
||||
paint();
|
||||
}
|
||||
@@ -476,7 +463,7 @@ void CBEBouquetWidget::cancelMoveBouquet()
|
||||
{
|
||||
state = beDefault;
|
||||
internalMoveBouquet( newPosition, origPosition);
|
||||
bouquetsChanged = false;
|
||||
bouquetsChanged = bouquetsChanged | false;
|
||||
}
|
||||
|
||||
void CBEBouquetWidget::internalMoveBouquet( unsigned int fromPosition, unsigned int toPosition)
|
||||
@@ -486,7 +473,7 @@ void CBEBouquetWidget::internalMoveBouquet( unsigned int fromPosition, unsigned
|
||||
|
||||
g_bouquetManager->moveBouquet(fromPosition, toPosition);
|
||||
Bouquets = &g_bouquetManager->Bouquets;
|
||||
bouquetsChanged = true;
|
||||
//bouquetsChanged = true;
|
||||
selected = toPosition;
|
||||
newPosition = toPosition;
|
||||
paint();
|
||||
|
@@ -64,13 +64,6 @@ class CBEBouquetWidget : public CMenuTarget
|
||||
beMoving
|
||||
} state;
|
||||
|
||||
enum
|
||||
{
|
||||
beRename,
|
||||
beHide,
|
||||
beLock
|
||||
} blueFunction;
|
||||
|
||||
unsigned int selected;
|
||||
unsigned int origPosition;
|
||||
unsigned int newPosition;
|
||||
|
@@ -44,9 +44,10 @@
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <driver/screen_max.h>
|
||||
#include "bouqueteditor_chanselect.h"
|
||||
#include <gui/components/cc.h>
|
||||
#include <gui/widget/buttons.h>
|
||||
#include <gui/widget/icons.h>
|
||||
#include <gui/widget/stringinput.h>
|
||||
#include <gui/widget/keyboard_input.h>
|
||||
|
||||
#include <zapit/getservices.h>
|
||||
#include <zapit/femanager.h>
|
||||
@@ -76,7 +77,10 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
|
||||
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h);
|
||||
iheight = std::max(fheight, icol_h+2);
|
||||
iconoffset = std::max(iconoffset, icol_w);
|
||||
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icol_w, &icol_h);
|
||||
iheight = std::max(fheight, icol_h+2);
|
||||
iconoffset = std::max(iconoffset, icol_w);
|
||||
|
||||
liststart = 0;
|
||||
@@ -122,15 +126,16 @@ void CBEChannelWidget::paintItem(int pos)
|
||||
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor);
|
||||
}
|
||||
|
||||
if ((current == selected) && (state == beMoving))
|
||||
{
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 10, ypos, iheight);
|
||||
if ((current == selected) && (state == beMoving)) {
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight);
|
||||
}
|
||||
if(current < Channels->size())
|
||||
{
|
||||
if(current < Channels->size()) {
|
||||
if ((*Channels)[current]->bLocked) {
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 22, ypos, iheight);
|
||||
}
|
||||
//g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color);
|
||||
//FIXME numwidth ? we not show chan numbers
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 20 + iconoffset, ypos + iheight - (iheight-fheight)/2, width- iconoffset- 20, (*Channels)[current]->getName(), color);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 22 + iconoffset, ypos + iheight - (iheight-fheight)/2, width- iconoffset- 20, (*Channels)[current]->getName(), color);
|
||||
if((*Channels)[current]->scrambled)
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight);
|
||||
else if (!(*Channels)[current]->getUrl().empty())
|
||||
@@ -177,17 +182,20 @@ void CBEChannelWidget::paintHead()
|
||||
header.paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
const struct button_label CBEChannelWidgetButtons[4] =
|
||||
const struct button_label CBEChannelWidgetButtons[6] =
|
||||
{
|
||||
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE },
|
||||
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD },
|
||||
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE },
|
||||
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_SWITCHMODE }
|
||||
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME },
|
||||
{ NEUTRINO_ICON_BUTTON_DUMMY_SMALL, LOCALE_BOUQUETEDITOR_SWITCHMODE },
|
||||
//{ NEUTRINO_ICON_BUTTON_FORWARD , LOCALE_BOUQUETEDITOR_MOVE_TO }, // TODO upgrade
|
||||
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK }
|
||||
};
|
||||
|
||||
void CBEChannelWidget::paintFoot()
|
||||
{
|
||||
::paintButtons(x, y + (height-footerHeight), width, 4, CBEChannelWidgetButtons, width, footerHeight);
|
||||
::paintButtons(x, y + (height-footerHeight), width, 6, CBEChannelWidgetButtons, width, footerHeight);
|
||||
}
|
||||
|
||||
std::string CBEChannelWidget::getInfoText(int index)
|
||||
@@ -313,7 +321,14 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
||||
x = ConnectLineBox_Width;
|
||||
y = getScreenStartY(height + info_height);
|
||||
|
||||
|
||||
mode = CZapitClient::MODE_TV;
|
||||
if (g_bouquetManager->Bouquets[bouquet]->tvChannels.empty())
|
||||
mode = CZapitClient::MODE_RADIO;
|
||||
else if (g_bouquetManager->Bouquets[bouquet]->radioChannels.empty())
|
||||
mode = CZapitClient::MODE_TV;
|
||||
Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
|
||||
|
||||
paintHead();
|
||||
paint();
|
||||
paintFoot();
|
||||
@@ -389,21 +404,6 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
||||
if (state == beDefault)
|
||||
addChannel();
|
||||
}
|
||||
else if(msg==CRCInput::RC_blue)
|
||||
{
|
||||
if (state == beDefault)
|
||||
{
|
||||
if (mode == CZapitClient::MODE_TV)
|
||||
mode = CZapitClient::MODE_RADIO;
|
||||
else
|
||||
mode = CZapitClient::MODE_TV;
|
||||
|
||||
Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
|
||||
|
||||
selected = 0;
|
||||
paint();
|
||||
}
|
||||
}
|
||||
else if(msg==CRCInput::RC_yellow)
|
||||
{
|
||||
liststart = (selected/listmaxshow)*listmaxshow;
|
||||
@@ -411,6 +411,46 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
||||
beginMoveChannel();
|
||||
paintItem(selected - liststart);
|
||||
}
|
||||
else if(msg==CRCInput::RC_blue)
|
||||
{
|
||||
if (selected < Channels->size()) /* Channels->size() might be 0 */
|
||||
{
|
||||
if (state == beDefault)
|
||||
renameChannel();
|
||||
}
|
||||
}
|
||||
else if(msg==CRCInput::RC_stop)
|
||||
{
|
||||
if (selected < Channels->size()) /* Channels->size() might be 0 */
|
||||
{
|
||||
if (state == beDefault)
|
||||
switchLockChannel();
|
||||
}
|
||||
}
|
||||
/* TODO upgrade
|
||||
else if (msg == CRCInput::RC_forward )
|
||||
{
|
||||
if (selected < Channels->size())
|
||||
{
|
||||
if (state == beDefault)
|
||||
moveChannelToBouquet();
|
||||
}
|
||||
}
|
||||
*/
|
||||
else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode ) {
|
||||
if (mode == CZapitClient::MODE_TV)
|
||||
mode = CZapitClient::MODE_RADIO;
|
||||
else
|
||||
mode = CZapitClient::MODE_TV;
|
||||
|
||||
Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
|
||||
|
||||
selected = 0;
|
||||
paintHead();
|
||||
paint();
|
||||
paintFoot();
|
||||
}
|
||||
|
||||
else if(msg==CRCInput::RC_ok)
|
||||
{
|
||||
if (state == beDefault)
|
||||
@@ -465,6 +505,34 @@ void CBEChannelWidget::deleteChannel()
|
||||
paint();
|
||||
}
|
||||
|
||||
void CBEChannelWidget::renameChannel()
|
||||
{
|
||||
std::string newName= inputName((*Channels)[selected]->getName().c_str(), LOCALE_BOUQUETEDITOR_NEWBOUQUETNAME);
|
||||
|
||||
if (newName != (*Channels)[selected]->getName())
|
||||
{
|
||||
if(newName.empty())
|
||||
(*Channels)[selected]->setUserName("");
|
||||
else
|
||||
(*Channels)[selected]->setUserName(newName);
|
||||
|
||||
channelsChanged = true;
|
||||
}
|
||||
paintHead();
|
||||
paint();
|
||||
paintFoot();
|
||||
}
|
||||
|
||||
void CBEChannelWidget::switchLockChannel()
|
||||
{
|
||||
(*Channels)[selected]->bLocked = !(*Channels)[selected]->bLocked;
|
||||
channelsChanged = true;
|
||||
paintItem(selected - liststart);
|
||||
|
||||
if (selected + 1 < (*Channels).size())
|
||||
g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_down, 0);
|
||||
}
|
||||
|
||||
void CBEChannelWidget::addChannel()
|
||||
{
|
||||
CBEChannelSelectWidget* channelSelectWidget = new CBEChannelSelectWidget(caption, g_bouquetManager->Bouquets[bouquet], mode);
|
||||
@@ -491,6 +559,7 @@ void CBEChannelWidget::beginMoveChannel()
|
||||
void CBEChannelWidget::finishMoveChannel()
|
||||
{
|
||||
state = beDefault;
|
||||
channelsChanged = channelsChanged | true;
|
||||
paint();
|
||||
}
|
||||
|
||||
@@ -498,9 +567,19 @@ void CBEChannelWidget::cancelMoveChannel()
|
||||
{
|
||||
state = beDefault;
|
||||
internalMoveChannel( newPosition, origPosition);
|
||||
channelsChanged = false;
|
||||
channelsChanged = channelsChanged | false;
|
||||
}
|
||||
/* TODO upgrade (taken from channellist.cpp)
|
||||
void CBEChannelWidget::moveChannelToBouquet()
|
||||
{
|
||||
if (addChannelToBouquet())
|
||||
deleteChannel(false);
|
||||
else
|
||||
paint();
|
||||
|
||||
paintHead();
|
||||
}
|
||||
*/
|
||||
void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned int toPosition)
|
||||
{
|
||||
if ( (int) toPosition == -1 ) return;
|
||||
@@ -509,7 +588,7 @@ void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned
|
||||
g_bouquetManager->Bouquets[bouquet]->moveService(fromPosition, toPosition,
|
||||
mode == CZapitClient::MODE_TV ? 1 : 2);
|
||||
|
||||
channelsChanged = true;
|
||||
//channelsChanged = true;
|
||||
Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
|
||||
|
||||
selected = toPosition;
|
||||
@@ -517,6 +596,18 @@ void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned
|
||||
paint();
|
||||
}
|
||||
|
||||
std::string CBEChannelWidget::inputName(const char * const defaultName, const neutrino_locale_t _caption)
|
||||
{
|
||||
std::string Name = defaultName;
|
||||
|
||||
CKeyboardInput * nameInput = new CKeyboardInput(_caption, &Name);
|
||||
nameInput->exec(this, "");
|
||||
|
||||
delete nameInput;
|
||||
|
||||
return std::string(Name);
|
||||
}
|
||||
|
||||
bool CBEChannelWidget::hasChanged()
|
||||
{
|
||||
return (channelsChanged);
|
||||
|
@@ -94,12 +94,17 @@ class CBEChannelWidget : public CMenuTarget
|
||||
|
||||
void deleteChannel();
|
||||
void addChannel();
|
||||
void switchLockChannel();
|
||||
void renameChannel();
|
||||
void beginMoveChannel();
|
||||
void finishMoveChannel();
|
||||
void cancelMoveChannel();
|
||||
void moveChannelToBouquet();
|
||||
void internalMoveChannel( unsigned int fromPosition, unsigned int toPosition);
|
||||
|
||||
std::string getInfoText(int index);
|
||||
std::string inputName(const char * const defaultName, const neutrino_locale_t caption);
|
||||
|
||||
public:
|
||||
CBEChannelWidget( const std::string & Caption, unsigned int Bouquet);
|
||||
~CBEChannelWidget();
|
||||
|
@@ -47,6 +47,9 @@
|
||||
|
||||
#include <gui/color.h>
|
||||
#include <gui/osd_setup.h>
|
||||
#include <gui/components/cc.h>
|
||||
#include <gui/widget/stringinput.h>
|
||||
#include <gui/widget/keyboard_input.h>
|
||||
#include <gui/widget/buttons.h>
|
||||
#include <gui/widget/icons.h>
|
||||
#include <gui/widget/messagebox.h>
|
||||
@@ -846,9 +849,9 @@ int CChannelList::show()
|
||||
}
|
||||
else if (!empty && msg == CRCInput::RC_blue )
|
||||
{
|
||||
if (edit_state) {
|
||||
if (edit_state) { // rename
|
||||
if (move_state != beMoving)
|
||||
lockChannel();
|
||||
renameChannel();
|
||||
} else {
|
||||
if (g_settings.channellist_additional)
|
||||
displayList = !displayList;
|
||||
@@ -877,6 +880,10 @@ int CChannelList::show()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!empty && edit_state && move_state != beMoving && msg == CRCInput::RC_stop )
|
||||
{
|
||||
lockChannel();
|
||||
}
|
||||
else if (!empty && edit_state && move_state != beMoving && msg == CRCInput::RC_forward )
|
||||
{
|
||||
moveChannelToBouquet();
|
||||
@@ -1690,14 +1697,15 @@ struct button_label SChannelListButtons_SMode[NUM_LIST_BUTTONS_SORT] =
|
||||
{ NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, NONEXISTANT_LOCALE}
|
||||
};
|
||||
|
||||
#define NUM_LIST_BUTTONS_EDIT 5
|
||||
#define NUM_LIST_BUTTONS_EDIT 6
|
||||
const struct button_label SChannelListButtons_Edit[NUM_LIST_BUTTONS_EDIT] =
|
||||
{
|
||||
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE },
|
||||
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD },
|
||||
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE },
|
||||
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_LOCK },
|
||||
{ NEUTRINO_ICON_BUTTON_FORWARD , LOCALE_BOUQUETEDITOR_MOVE_TO }
|
||||
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME },
|
||||
{ NEUTRINO_ICON_BUTTON_FORWARD , LOCALE_BOUQUETEDITOR_MOVE_TO },
|
||||
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK }
|
||||
};
|
||||
|
||||
void CChannelList::paintButtonBar(bool is_current)
|
||||
@@ -2470,6 +2478,23 @@ void CChannelList::addChannel()
|
||||
paint();
|
||||
}
|
||||
|
||||
void CChannelList::renameChannel()
|
||||
{
|
||||
std::string newName= inputName((*chanlist)[selected]->getName().c_str(), LOCALE_BOUQUETEDITOR_NEWBOUQUETNAME);
|
||||
|
||||
if (newName != (*chanlist)[selected]->getName())
|
||||
{
|
||||
if(newName.empty())
|
||||
(*chanlist)[selected]->setUserName("");
|
||||
else
|
||||
(*chanlist)[selected]->setUserName(newName);
|
||||
|
||||
channelsChanged = true;
|
||||
}
|
||||
paintHead();
|
||||
paint();
|
||||
}
|
||||
|
||||
void CChannelList::lockChannel()
|
||||
{
|
||||
(*chanlist)[selected]->bLocked = !(*chanlist)[selected]->bLocked;
|
||||
@@ -2526,3 +2551,15 @@ void CChannelList::moveChannelToBouquet()
|
||||
|
||||
paintHead();
|
||||
}
|
||||
|
||||
std::string CChannelList::inputName(const char * const defaultName, const neutrino_locale_t caption)
|
||||
{
|
||||
std::string Name = defaultName;
|
||||
|
||||
CKeyboardInput * nameInput = new CKeyboardInput(caption, &Name);
|
||||
nameInput->exec(NULL, "");
|
||||
|
||||
delete nameInput;
|
||||
|
||||
return std::string(Name);
|
||||
}
|
||||
|
@@ -161,6 +161,8 @@ private:
|
||||
void internalMoveChannel(unsigned int fromPosition, unsigned int toPosition);
|
||||
void deleteChannel(bool ask = true);
|
||||
void addChannel();
|
||||
void renameChannel();
|
||||
std::string inputName(const char * const defaultName, const neutrino_locale_t caption);
|
||||
void lockChannel();
|
||||
void saveChanges(bool fav = true);
|
||||
bool addChannelToBouquet();
|
||||
@@ -237,6 +239,5 @@ public:
|
||||
};
|
||||
unsigned Size() { return (*chanlist).size(); }
|
||||
ZapitChannelList &getChannels() { return channels; };
|
||||
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user