CWebTVSetup: fix menu handling

- width enlarged
- fix exit handling
- fix memory of item position
- adapted caption


Origin commit data
------------------
Commit: 90a29c598d
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-09-11 (Thu, 11 Sep 2014)
This commit is contained in:
2014-09-11 22:55:17 +02:00
committed by vanhofen
parent 78bd385f78
commit bfd4b17307
3 changed files with 17 additions and 10 deletions

View File

@@ -30,11 +30,12 @@
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <gui/widget/hintbox.h> #include <gui/widget/hintbox.h>
#include <neutrino_menue.h>
#include "webtv_setup.h" #include "webtv_setup.h"
CWebTVSetup::CWebTVSetup() CWebTVSetup::CWebTVSetup()
{ {
width = w_max (40, 10); width = w_max (55, 10);
selected = -1; selected = -1;
item_offset = 0; item_offset = 0;
changed = false; changed = false;
@@ -91,25 +92,26 @@ int CWebTVSetup::exec(CMenuTarget* parent, const std::string & actionKey)
if(parent) if(parent)
parent->hide(); parent->hide();
Show(); res = Show();
return res; return res;
} }
void CWebTVSetup::Show() int CWebTVSetup::Show()
{ {
item_offset = 0; item_offset = 0;
m = new CMenuWidget(LOCALE_WEBTV_HEAD, NEUTRINO_ICON_MOVIEPLAYER, width); m = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_MOVIEPLAYER, width, MN_WIDGET_ID_WEBTVSETUP);
m->addKey(CRCInput::RC_red, this, "d"); m->addKey(CRCInput::RC_red, this, "d");
m->addKey(CRCInput::RC_green, this, "a"); m->addKey(CRCInput::RC_green, this, "a");
m->setSelected(selected);
m->addIntroItems(LOCALE_EPGPLUS_OPTIONS, LOCALE_WEBTV_XML); m->addIntroItems(LOCALE_WEBTV_HEAD, LOCALE_WEBTV_XML);
item_offset = m->getItemsCount(); item_offset = m->getItemsCount();
for (std::list<std::string>::iterator it = g_settings.webtv_xml.begin(); it != g_settings.webtv_xml.end(); ++it) for (std::list<std::string>::iterator it = g_settings.webtv_xml.begin(); it != g_settings.webtv_xml.end(); ++it)
m->addItem(new CMenuForwarder(*it, true, NULL, this, "c")); m->addItem(new CMenuForwarder(*it, true, NULL, this, "c"));
m->setFooter(CWebTVSetupFooterButtons, CWebTVSetupFooterButtonCount); m->setFooter(CWebTVSetupFooterButtons, CWebTVSetupFooterButtonCount); //Why we need here an extra buttonbar?
m->exec(NULL, "");
int res = m->exec(NULL, "");
m->hide(); m->hide();
if (changed) { if (changed) {
g_settings.webtv_xml.clear(); g_settings.webtv_xml.clear();
@@ -121,7 +123,9 @@ void CWebTVSetup::Show()
g_Zapit->reinitChannels(); g_Zapit->reinitChannels();
changed = false; changed = false;
} }
selected = m->getSelected();
delete m; delete m;
return res;
} }
// vim:ts=4 // vim:ts=4

View File

@@ -38,6 +38,6 @@ class CWebTVSetup : public CMenuTarget
public: public:
CWebTVSetup(); CWebTVSetup();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
void Show(); int Show();
}; };
#endif #endif

View File

@@ -109,6 +109,9 @@ enum MN_WIDGET_ID
//audio setup //audio setup
MN_WIDGET_ID_AUDIOSETUP, MN_WIDGET_ID_AUDIOSETUP,
//web tv setup
MN_WIDGET_ID_WEBTVSETUP,
//misc settings //misc settings
MN_WIDGET_ID_MISCSETUP, MN_WIDGET_ID_MISCSETUP,
MN_WIDGET_ID_MISCSETUP_GENERAL, MN_WIDGET_ID_MISCSETUP_GENERAL,