api4: upgrade channel and bouquet edit (testing)

This commit is contained in:
Janus
2015-01-22 13:08:03 +01:00
committed by Jacek Jendrzej
parent ecff984432
commit df1db3cfad
8 changed files with 215 additions and 101 deletions

View File

@@ -193,7 +193,7 @@ bouqueteditor.lock Sperren
bouqueteditor.move Bewegen bouqueteditor.move Bewegen
bouqueteditor.move_to Bewegen zu bouqueteditor.move_to Bewegen zu
bouqueteditor.name Bouquet-Verwaltung bouqueteditor.name Bouquet-Verwaltung
bouqueteditor.newbouquetname Neuer Name des Bouquets bouqueteditor.newbouquetname Neuer Name
bouqueteditor.rename Umbenennen bouqueteditor.rename Umbenennen
bouqueteditor.return Fertig bouqueteditor.return Fertig
bouqueteditor.savechanges? Sollen die Änderungen gespeichert werden? bouqueteditor.savechanges? Sollen die Änderungen gespeichert werden?

View File

@@ -193,7 +193,7 @@ bouqueteditor.lock Lock
bouqueteditor.move Move bouqueteditor.move Move
bouqueteditor.move_to Move to bouqueteditor.move_to Move to
bouqueteditor.name Bouquet editor bouqueteditor.name Bouquet editor
bouqueteditor.newbouquetname New name of bouquets bouqueteditor.newbouquetname New name
bouqueteditor.rename Rename bouqueteditor.rename Rename
bouqueteditor.return ready bouqueteditor.return ready
bouqueteditor.savechanges? Do you want to save the changes? bouqueteditor.savechanges? Do you want to save the changes?

View File

@@ -65,7 +65,6 @@ CBEBouquetWidget::CBEBouquetWidget()
selected = 0; selected = 0;
liststart = 0; liststart = 0;
state = beDefault; state = beDefault;
blueFunction = beRename;
Bouquets = NULL; Bouquets = NULL;
iheight = 0; iheight = 0;
ButtonHeight = 0; ButtonHeight = 0;
@@ -96,15 +95,22 @@ void CBEBouquetWidget::paintItem(int pos)
if(current < Bouquets->size()) { if(current < Bouquets->size()) {
if ((current == selected) && (state == beMoving)) if ((current == selected) && (state == beMoving))
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 10, ypos, iheight); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight);
if ((*Bouquets)[current]->bLocked != g_settings.parentallock_defaultlocked)
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 10, ypos, iheight);
if ((*Bouquets)[current]->bHidden) 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); 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_RED , LOCALE_BOUQUETEDITOR_DELETE },
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD }, { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD },
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE },
{ NEUTRINO_ICON_BUTTON_BLUE , NONEXISTANT_LOCALE /*dummy*/} { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME},
{ NEUTRINO_ICON_BUTTON_PAUSE , LOCALE_BOUQUETEDITOR_HIDE },
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK }
}; };
void CBEBouquetWidget::paintFoot() void CBEBouquetWidget::paintFoot()
{ {
struct button_label Button[4]; ::paintButtons(x, y+height, width, 6, CBEBouquetWidgetButtons, width, ButtonHeight);
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);
} }
void CBEBouquetWidget::hide() 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 (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
{ {
if (state == beDefault) if (state == beDefault)
switch (blueFunction)
{
case beRename:
renameBouquet(); renameBouquet();
break;
case beHide:
switchHideBouquet();
break;
case beLock:
switchLockBouquet();
break;
} }
} }
}
else if(msg==CRCInput::RC_setup) else if(msg==CRCInput::RC_pause)
{
if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
{ {
if (state == beDefault) if (state == beDefault)
switch (blueFunction) switchHideBouquet();
{ }
case beRename: }
blueFunction = beHide; else if(msg==CRCInput::RC_stop)
break; {
case beHide: if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */
blueFunction = beLock; {
break; if (state == beDefault)
case beLock: switchLockBouquet();
blueFunction = beRename;
break;
} }
paintFoot();
} }
else if(msg==CRCInput::RC_ok) 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 */ 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, ""); channelWidget->exec( this, "");
if (channelWidget->hasChanged()) if (channelWidget->hasChanged())
bouquetsChanged = true; bouquetsChanged = true;
@@ -467,7 +454,7 @@ void CBEBouquetWidget::finishMoveBouquet()
if (newPosition != origPosition) if (newPosition != origPosition)
{ {
Bouquets = &g_bouquetManager->Bouquets; Bouquets = &g_bouquetManager->Bouquets;
bouquetsChanged = true; bouquetsChanged = bouquetsChanged | true;
} }
paint(); paint();
} }
@@ -476,7 +463,7 @@ void CBEBouquetWidget::cancelMoveBouquet()
{ {
state = beDefault; state = beDefault;
internalMoveBouquet( newPosition, origPosition); internalMoveBouquet( newPosition, origPosition);
bouquetsChanged = false; bouquetsChanged = bouquetsChanged | false;
} }
void CBEBouquetWidget::internalMoveBouquet( unsigned int fromPosition, unsigned int toPosition) 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); g_bouquetManager->moveBouquet(fromPosition, toPosition);
Bouquets = &g_bouquetManager->Bouquets; Bouquets = &g_bouquetManager->Bouquets;
bouquetsChanged = true; //bouquetsChanged = true;
selected = toPosition; selected = toPosition;
newPosition = toPosition; newPosition = toPosition;
paint(); paint();

View File

@@ -64,13 +64,6 @@ class CBEBouquetWidget : public CMenuTarget
beMoving beMoving
} state; } state;
enum
{
beRename,
beHide,
beLock
} blueFunction;
unsigned int selected; unsigned int selected;
unsigned int origPosition; unsigned int origPosition;
unsigned int newPosition; unsigned int newPosition;

View File

@@ -44,9 +44,10 @@
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include "bouqueteditor_chanselect.h" #include "bouqueteditor_chanselect.h"
#include <gui/components/cc.h>
#include <gui/widget/buttons.h> #include <gui/widget/buttons.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/keyboard_input.h>
#include <zapit/getservices.h> #include <zapit/getservices.h>
#include <zapit/femanager.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); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h);
iheight = std::max(fheight, icol_h+2); 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); iconoffset = std::max(iconoffset, icol_w);
liststart = 0; liststart = 0;
@@ -122,15 +126,16 @@ void CBEChannelWidget::paintItem(int pos)
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor);
} }
if ((current == selected) && (state == beMoving)) if ((current == selected) && (state == beMoving)) {
{ frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 10, ypos, iheight); }
if(current < Channels->size()) {
if ((*Channels)[current]->bLocked) {
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 22, ypos, iheight);
} }
if(current < Channels->size())
{
//g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color); //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 //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) if((*Channels)[current]->scrambled)
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight); frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight);
else if (!(*Channels)[current]->getUrl().empty()) else if (!(*Channels)[current]->getUrl().empty())
@@ -177,17 +182,20 @@ void CBEChannelWidget::paintHead()
header.paint(CC_SAVE_SCREEN_NO); 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_RED , LOCALE_BOUQUETEDITOR_DELETE },
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD }, { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD },
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, { 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() 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) std::string CBEChannelWidget::getInfoText(int index)
@@ -313,7 +321,14 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
x = ConnectLineBox_Width; x = ConnectLineBox_Width;
y = getScreenStartY(height + info_height); 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); Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
paintHead(); paintHead();
paint(); paint();
paintFoot(); paintFoot();
@@ -389,10 +404,40 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
if (state == beDefault) if (state == beDefault)
addChannel(); addChannel();
} }
else if(msg==CRCInput::RC_yellow)
{
liststart = (selected/listmaxshow)*listmaxshow;
if (state == beDefault)
beginMoveChannel();
paintItem(selected - liststart);
}
else if(msg==CRCInput::RC_blue) else if(msg==CRCInput::RC_blue)
{ {
if (state == beDefault) 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) if (mode == CZapitClient::MODE_TV)
mode = CZapitClient::MODE_RADIO; mode = CZapitClient::MODE_RADIO;
else else
@@ -401,16 +446,11 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
selected = 0; selected = 0;
paintHead();
paint(); paint();
paintFoot();
} }
}
else if(msg==CRCInput::RC_yellow)
{
liststart = (selected/listmaxshow)*listmaxshow;
if (state == beDefault)
beginMoveChannel();
paintItem(selected - liststart);
}
else if(msg==CRCInput::RC_ok) else if(msg==CRCInput::RC_ok)
{ {
if (state == beDefault) if (state == beDefault)
@@ -465,6 +505,34 @@ void CBEChannelWidget::deleteChannel()
paint(); 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() void CBEChannelWidget::addChannel()
{ {
CBEChannelSelectWidget* channelSelectWidget = new CBEChannelSelectWidget(caption, g_bouquetManager->Bouquets[bouquet], mode); CBEChannelSelectWidget* channelSelectWidget = new CBEChannelSelectWidget(caption, g_bouquetManager->Bouquets[bouquet], mode);
@@ -491,6 +559,7 @@ void CBEChannelWidget::beginMoveChannel()
void CBEChannelWidget::finishMoveChannel() void CBEChannelWidget::finishMoveChannel()
{ {
state = beDefault; state = beDefault;
channelsChanged = channelsChanged | true;
paint(); paint();
} }
@@ -498,9 +567,19 @@ void CBEChannelWidget::cancelMoveChannel()
{ {
state = beDefault; state = beDefault;
internalMoveChannel( newPosition, origPosition); 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) void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned int toPosition)
{ {
if ( (int) toPosition == -1 ) return; if ( (int) toPosition == -1 ) return;
@@ -509,7 +588,7 @@ void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned
g_bouquetManager->Bouquets[bouquet]->moveService(fromPosition, toPosition, g_bouquetManager->Bouquets[bouquet]->moveService(fromPosition, toPosition,
mode == CZapitClient::MODE_TV ? 1 : 2); 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); Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
selected = toPosition; selected = toPosition;
@@ -517,6 +596,18 @@ void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned
paint(); 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() bool CBEChannelWidget::hasChanged()
{ {
return (channelsChanged); return (channelsChanged);

View File

@@ -94,12 +94,17 @@ class CBEChannelWidget : public CMenuTarget
void deleteChannel(); void deleteChannel();
void addChannel(); void addChannel();
void switchLockChannel();
void renameChannel();
void beginMoveChannel(); void beginMoveChannel();
void finishMoveChannel(); void finishMoveChannel();
void cancelMoveChannel(); void cancelMoveChannel();
void moveChannelToBouquet();
void internalMoveChannel( unsigned int fromPosition, unsigned int toPosition); void internalMoveChannel( unsigned int fromPosition, unsigned int toPosition);
std::string getInfoText(int index); std::string getInfoText(int index);
std::string inputName(const char * const defaultName, const neutrino_locale_t caption);
public: public:
CBEChannelWidget( const std::string & Caption, unsigned int Bouquet); CBEChannelWidget( const std::string & Caption, unsigned int Bouquet);
~CBEChannelWidget(); ~CBEChannelWidget();

View File

@@ -47,6 +47,9 @@
#include <gui/color.h> #include <gui/color.h>
#include <gui/osd_setup.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/buttons.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <gui/widget/messagebox.h> #include <gui/widget/messagebox.h>
@@ -846,9 +849,9 @@ int CChannelList::show()
} }
else if (!empty && msg == CRCInput::RC_blue ) else if (!empty && msg == CRCInput::RC_blue )
{ {
if (edit_state) { if (edit_state) { // rename
if (move_state != beMoving) if (move_state != beMoving)
lockChannel(); renameChannel();
} else { } else {
if (g_settings.channellist_additional) if (g_settings.channellist_additional)
displayList = !displayList; 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 ) else if (!empty && edit_state && move_state != beMoving && msg == CRCInput::RC_forward )
{ {
moveChannelToBouquet(); moveChannelToBouquet();
@@ -1690,14 +1697,15 @@ struct button_label SChannelListButtons_SMode[NUM_LIST_BUTTONS_SORT] =
{ NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, NONEXISTANT_LOCALE} { 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] = const struct button_label SChannelListButtons_Edit[NUM_LIST_BUTTONS_EDIT] =
{ {
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE }, { NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE },
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD }, { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD },
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE },
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_LOCK }, { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME },
{ NEUTRINO_ICON_BUTTON_FORWARD , LOCALE_BOUQUETEDITOR_MOVE_TO } { NEUTRINO_ICON_BUTTON_FORWARD , LOCALE_BOUQUETEDITOR_MOVE_TO },
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK }
}; };
void CChannelList::paintButtonBar(bool is_current) void CChannelList::paintButtonBar(bool is_current)
@@ -2470,6 +2478,23 @@ void CChannelList::addChannel()
paint(); 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() void CChannelList::lockChannel()
{ {
(*chanlist)[selected]->bLocked = !(*chanlist)[selected]->bLocked; (*chanlist)[selected]->bLocked = !(*chanlist)[selected]->bLocked;
@@ -2526,3 +2551,15 @@ void CChannelList::moveChannelToBouquet()
paintHead(); 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);
}

View File

@@ -161,6 +161,8 @@ private:
void internalMoveChannel(unsigned int fromPosition, unsigned int toPosition); void internalMoveChannel(unsigned int fromPosition, unsigned int toPosition);
void deleteChannel(bool ask = true); void deleteChannel(bool ask = true);
void addChannel(); void addChannel();
void renameChannel();
std::string inputName(const char * const defaultName, const neutrino_locale_t caption);
void lockChannel(); void lockChannel();
void saveChanges(bool fav = true); void saveChanges(bool fav = true);
bool addChannelToBouquet(); bool addChannelToBouquet();
@@ -237,6 +239,5 @@ public:
}; };
unsigned Size() { return (*chanlist).size(); } unsigned Size() { return (*chanlist).size(); }
ZapitChannelList &getChannels() { return channels; }; ZapitChannelList &getChannels() { return channels; };
}; };
#endif #endif