gui/zapit_setup.cpp: filter bouquets channels,

fix return values to close all menus on menu key
This commit is contained in:
[CST] Focus
2013-01-30 11:39:51 +04:00
parent 55e3db20b8
commit 62529ede9c
2 changed files with 16 additions and 19 deletions

View File

@@ -44,23 +44,18 @@ CZapitSetup::CZapitSetup()
CZapitSetup::~CZapitSetup()
{
}
int CZapitSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{
printf("[neutrino] init zapit menu setup...\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
parent->hide();
showMenu();
return res;
return showMenu();
}
void CZapitSetup::showMenu()
int CZapitSetup::showMenu()
{
//menue init
CMenuWidget *zapit = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_ZAPIT);
@@ -86,9 +81,10 @@ void CZapitSetup::showMenu()
zapit->addItem(zapit1);
zapit->addItem(zapit2);
zapit->exec(NULL, "");
int res = zapit->exec(NULL, "");
delete miscZapitNotifier;
delete zapit;
return res;
}
//select menu
@@ -107,19 +103,15 @@ int CSelectChannelWidget::exec(CMenuTarget* parent, const std::string& actionKey
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
if(actionKey == "tv")
{
InitZapitChannelHelper(CZapitClient::MODE_TV);
return res;
return InitZapitChannelHelper(CZapitClient::MODE_TV);
}
else if(actionKey == "radio")
{
InitZapitChannelHelper(CZapitClient::MODE_RADIO);
return res;
return InitZapitChannelHelper(CZapitClient::MODE_RADIO);
}
else if (strncmp(actionKey.c_str(), "ZCT:", 4) == 0 || strncmp(actionKey.c_str(), "ZCR:", 4) == 0)
{
@@ -147,7 +139,7 @@ int CSelectChannelWidget::exec(CMenuTarget* parent, const std::string& actionKey
}
extern CBouquetManager *g_bouquetManager;
void CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mode)
int CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mode)
{
std::vector<CMenuWidget *> toDelete;
CMenuWidget mctv(LOCALE_TIMERLIST_BOUQUETSELECT, NEUTRINO_ICON_SETTINGS, width);
@@ -157,7 +149,11 @@ void CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mod
CMenuWidget* mwtv = new CMenuWidget(LOCALE_TIMERLIST_CHANNELSELECT, NEUTRINO_ICON_SETTINGS, width);
toDelete.push_back(mwtv);
mwtv->addIntroItems();
ZapitChannelList channels = (mode == CZapitClient::MODE_RADIO) ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels;
ZapitChannelList channels;
if (mode == CZapitClient::MODE_RADIO)
g_bouquetManager->Bouquets[i]->getRadioChannels(channels);
else
g_bouquetManager->Bouquets[i]->getTvChannels(channels);
for(int j = 0; j < (int) channels.size(); j++) {
CZapitChannel * channel = channels[j];
char cChannelId[60] = {0};
@@ -173,7 +169,7 @@ void CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mod
mctv.addItem(new CMenuForwarderNonLocalized(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwtv));
}
}
mctv.exec (NULL, "");
int res = mctv.exec (NULL, "");
// delete dynamic created objects
for(unsigned int count=0;count<toDelete.size();count++)
@@ -181,4 +177,5 @@ void CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mod
delete toDelete[count];
}
toDelete.clear();
return res;
}

View File

@@ -37,7 +37,7 @@ private:
int width;
void showMenu();
int showMenu();
public:
CZapitSetup();
@@ -49,7 +49,7 @@ class CSelectChannelWidget : public CMenuWidget
{
private:
int width;
void InitZapitChannelHelper(CZapitClient::channelsMode mode);
int InitZapitChannelHelper(CZapitClient::channelsMode mode);
public:
CSelectChannelWidget();