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

@@ -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);
}