src/gui/zapit_setup.cpp: use COnOffNotifier

This commit is contained in:
satbaby
2012-11-09 13:45:57 +01:00
parent 11b2242d2e
commit 8a89f09e64
2 changed files with 14 additions and 24 deletions

View File

@@ -39,8 +39,6 @@
CZapitSetup::CZapitSetup() CZapitSetup::CZapitSetup()
{ {
zapit1 = NULL;
zapit2 = NULL;
width = w_max (40, 10); //% width = w_max (40, 10); //%
} }
@@ -67,38 +65,32 @@ void 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);
zapit->addIntroItems(LOCALE_ZAPITSETUP_INFO); zapit->addIntroItems(LOCALE_ZAPITSETUP_INFO);
COnOffNotifier* miscZapitNotifier = new COnOffNotifier(0);
//zapit //zapit
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_ZAPITSETUP_LAST_USE, &g_settings.uselastchannel, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_ZAPITSETUP_LAST_USE, &g_settings.uselastchannel, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscZapitNotifier, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mc->setHint("", LOCALE_MENU_HINT_LAST_USE); mc->setHint("", LOCALE_MENU_HINT_LAST_USE);
zapit->addItem(mc);
CSelectChannelWidget select; CSelectChannelWidget select;
zapit->addItem(GenericMenuSeparatorLine); CMenuForwarder *zapit1 = new CMenuForwarder(LOCALE_ZAPITSETUP_LAST_TV , g_settings.uselastchannel, g_settings.StartChannelTV, &select, "tv", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN );
zapit1 = new CMenuForwarder(LOCALE_ZAPITSETUP_LAST_TV , !g_settings.uselastchannel, g_settings.StartChannelTV, &select, "tv", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN );
zapit1->setHint("", LOCALE_MENU_HINT_LAST_TV); zapit1->setHint("", LOCALE_MENU_HINT_LAST_TV);
zapit->addItem(zapit1);
zapit2 = new CMenuForwarder(LOCALE_ZAPITSETUP_LAST_RADIO , !g_settings.uselastchannel, g_settings.StartChannelRadio, &select, "radio", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW ); CMenuForwarder *zapit2 = new CMenuForwarder(LOCALE_ZAPITSETUP_LAST_RADIO , g_settings.uselastchannel, g_settings.StartChannelRadio, &select, "radio", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW );
zapit2->setHint("", LOCALE_MENU_HINT_LAST_RADIO); zapit2->setHint("", LOCALE_MENU_HINT_LAST_RADIO);
miscZapitNotifier->addItem(zapit1);
miscZapitNotifier->addItem(zapit2);
zapit->addItem(mc);
zapit->addItem(GenericMenuSeparatorLine);
zapit->addItem(zapit1);
zapit->addItem(zapit2); zapit->addItem(zapit2);
zapit->exec(NULL, ""); zapit->exec(NULL, "");
delete miscZapitNotifier;
delete zapit; delete zapit;
} }
bool CZapitSetup::changeNotify(const neutrino_locale_t OptionName, void *)
{
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_ZAPITSETUP_LAST_USE))
{
zapit1->setActive(!g_settings.uselastchannel);
zapit2->setActive(!g_settings.uselastchannel);
}
return false;
}
//select menu //select menu
CSelectChannelWidget::CSelectChannelWidget() CSelectChannelWidget::CSelectChannelWidget()
{ {

View File

@@ -31,10 +31,9 @@
#include <string> #include <string>
#include <zapit/client/zapitclient.h> #include <zapit/client/zapitclient.h>
class CZapitSetup : public CMenuTarget, CChangeObserver class CZapitSetup : public CMenuTarget
{ {
private: private:
CMenuForwarder *zapit1, *zapit2;
int width; int width;
@@ -44,7 +43,6 @@ public:
CZapitSetup(); CZapitSetup();
~CZapitSetup(); ~CZapitSetup();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
virtual bool changeNotify(const neutrino_locale_t , void *);
}; };
class CSelectChannelWidget : public CMenuWidget class CSelectChannelWidget : public CMenuWidget