gui/zapit_setup.cpp: filter bouquets channels,

fix return values to close all menus on menu key


Origin commit data
------------------
Branch: ni/coolstream
Commit: 62529ede9c
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-01-30 (Wed, 30 Jan 2013)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2013-01-30 11:39:51 +04:00
parent 0f2d592367
commit 58f7a4b46e
2 changed files with 16 additions and 19 deletions

View File

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

View File

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