From ed0166e600c7f2bd0d2b58ef5fa1680f276c625b Mon Sep 17 00:00:00 2001 From: thilo Date: Tue, 20 Dec 2011 21:56:44 +0000 Subject: [PATCH] *neutrino: rework clock and radio/tv switch functionality - move clock function from red button (main menu) into features menu - ...so it's customizable in all user menus - switching between tv and radio only with red button (main menu) depend of current mode - add timerlist into main menu git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1985 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/deutsch.locale | 4 +- data/locale/english.locale | 4 +- src/gui/user_menue.cpp | 13 +++++- src/gui/user_menue_setup.cpp | 3 +- src/neutrino.cpp | 77 ++++++++++++++++-------------------- src/neutrino.h | 3 ++ src/neutrino_menue.cpp | 11 ++++-- src/system/locals.h | 2 + src/system/locals_intern.h | 2 + src/system/settings.h | 7 ++-- 10 files changed, 72 insertions(+), 54 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 1d0db09bc..a8244caf7 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -223,6 +223,8 @@ ci.reset_standby Reset nach Standby ci.settings Zugangskontrolle ci.timeout CAM antwortet nicht ci.waiting Warte auf CAM-Antwort +clock_switch_off Uhr ausblenden +clock_switch_on Uhr einblenden colorchooser.alpha alpha colorchooser.blue blau colorchooser.green grĂ¼n @@ -646,7 +648,7 @@ mainmenu.service Service mainmenu.settings Einstellungen mainmenu.shutdown Ausschalten mainmenu.sleeptimer SleepTimer -mainmenu.tvmode TV-Modus/Uhr +mainmenu.tvmode TV/Radio Umschaltung mainsettings.audio Audio mainsettings.head Einstellungen mainsettings.keybinding Tasten diff --git a/data/locale/english.locale b/data/locale/english.locale index 270364e94..a474ad329 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -223,6 +223,8 @@ ci.reset_standby Reset after standby ci.settings Conditional access ci.timeout Timeout waiting CI menu ready ci.waiting Waiting for CI answer +clock_switch_off Clock off +clock_switch_on Clock on colorchooser.alpha alpha colorchooser.blue blue colorchooser.green green @@ -646,7 +648,7 @@ mainmenu.service Service mainmenu.settings Settings mainmenu.shutdown Shutdown mainmenu.sleeptimer SleepTimer -mainmenu.tvmode TV-Mode +mainmenu.tvmode TV/Radio-Mode mainsettings.audio Audio mainsettings.head Settings mainsettings.keybinding Key Setup diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 7d84cc1a5..d14fe1ae1 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -119,7 +119,8 @@ bool CUserMenu::showUserMenu(int button) CRCLock *rcLock = NULL; CStreamFeaturesChangeExec *StreamFeaturesChanger = NULL; CImageInfo *imageinfo = NULL; - CDBoxInfoWidget *boxinfo = NULL; + CDBoxInfoWidget *boxinfo = NULL; + CNeutrinoApp * neutrino = NULL; std::string txt = g_settings.usermenu_text[button]; neutrino_locale_t caption = user_menu[button].caption; @@ -335,6 +336,16 @@ bool CUserMenu::showUserMenu(int button) menu->addItem(new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon)); } break; + case SNeutrinoSettings::ITEM_CLOCK: + { + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_CLOCK; + keyhelper.get(&key,&icon, CRCInput::RC_green); + neutrino = CNeutrinoApp::getInstance(); + menu_item = new CMenuForwarder(!g_settings.mode_clock ? LOCALE_CLOCK_SWITCH_ON:LOCALE_CLOCK_SWITCH_OFF, true, NULL, neutrino, "clock_switch", key, icon); + menu->addItem(menu_item, false); + } + break; #if 0 // FIXME not supported yet case SNeutrinoSettings::ITEM_MOVIEPLAYER_TS: diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index d65a90d1d..7e6f8e0b0 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -83,7 +83,8 @@ const CMenuOptionChooser::keyval USERMENU_ITEM_OPTIONS[USERMENU_ITEM_OPTION_COUN { SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT }, { SNeutrinoSettings::ITEM_IMAGEINFO, LOCALE_SERVICEMENU_IMAGEINFO }, { SNeutrinoSettings::ITEM_BOXINFO, LOCALE_EXTRA_DBOXINFO }, - { SNeutrinoSettings::ITEM_CAM, LOCALE_CI_SETTINGS } + { SNeutrinoSettings::ITEM_CAM, LOCALE_CI_SETTINGS }, + { SNeutrinoSettings::ITEM_CLOCK, LOCALE_CLOCK_SWITCH_ON } }; int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 31d8452dc..63a63be5d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -768,7 +768,7 @@ int CNeutrinoApp::loadSetup(const char * fname) "2,3,4,13", // RED "6", // GREEN "7", // YELLOW - "12,10,11,14,15" // BLUE + "12,10,11,19,14,15" // BLUE }; char txt1[81]; std::string txt2; @@ -2095,19 +2095,11 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) saveSetup(NEUTRINO_SETTINGS_FILE); } } - else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode ) { - if( mode == mode_tv ) - radioMode(); - else if( mode == mode_radio ) - tvMode(); - } else if( ((msg == CRCInput::RC_tv) || (msg == CRCInput::RC_radio)) && ((neutrino_msg_t)g_settings.key_tvradio_mode == CRCInput::RC_nokey)) { - if(mode == mode_radio ) { - tvMode(); - } - else if(mode == mode_tv) { - radioMode(); - } + switchTvRadioMode();//used with defined default tv/radio rc key + } + else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode ) { + switchTvRadioMode(); //used with defined rc key TODO: do we really need this, because we already have a specified key on the remote control } else if( msg == (neutrino_msg_t) g_settings.key_subchannel_up ) { if(g_RemoteControl->subChannels.size() > 0) { @@ -3337,18 +3329,7 @@ void CNeutrinoApp::tvMode( bool rezap ) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowIcon(VFD_ICON_TV, true); - if( mode == mode_tv ) { - if(g_settings.mode_clock) { - InfoClock->StopClock(); - g_settings.mode_clock=false; - } else { - InfoClock->StartClock(); - g_settings.mode_clock=true; - } - return; - } else if( mode == mode_scart ) { - //g_Controld->setScartMode( 0 ); - } else if( mode == mode_standby ) { + if( mode == mode_standby ) { CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); videoDecoder->Standby(false); } @@ -3552,20 +3533,7 @@ void CNeutrinoApp::radioMode( bool rezap) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowIcon(VFD_ICON_RADIO, true); - if( mode==mode_radio ) { - if(g_settings.mode_clock) { - InfoClock->StopClock(); - g_settings.mode_clock=false; - } else { - InfoClock->StartClock(); - g_settings.mode_clock=true; - } - return; - } - else if( mode == mode_scart ) { - //g_Controld->setScartMode( 0 ); - } - else if( mode == mode_standby ) { + if( mode == mode_standby ) { CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); videoDecoder->Standby(false); } @@ -3587,6 +3555,27 @@ void CNeutrinoApp::radioMode( bool rezap) } } +//switching from current mode to next mode between tv or radio +void CNeutrinoApp::switchTvRadioMode() +{ + if (mode == mode_radio ) + tvMode(); + else if(mode == mode_tv) + radioMode(); +} + +//switching clock on or off depends of current displayed or not +void CNeutrinoApp::switchClockOnOff() +{ + if(g_settings.mode_clock) { + InfoClock->StopClock(); + g_settings.mode_clock=false; + } else { + InfoClock->StartClock(); + g_settings.mode_clock=true; + } +} + /************************************************************************************** * CNeutrinoApp - exec, menuitem callback (shutdown) * **************************************************************************************/ @@ -3611,12 +3600,14 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) unlink("/tmp/.reboot"); returnval = menu_return::RETURN_NONE; } - else if(actionKey=="tv") { - tvMode(); + else if (actionKey=="clock_switch") + { + switchClockOnOff(); returnval = menu_return::RETURN_EXIT_ALL; } - else if(actionKey=="radio") { - radioMode(); + else if (actionKey=="tv_radio_switch")//used in mainmenu + { + switchTvRadioMode(); returnval = menu_return::RETURN_EXIT_ALL; } else if(actionKey=="scart") { diff --git a/src/neutrino.h b/src/neutrino.h index 3d4620a5d..df6124801 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -206,6 +206,9 @@ public: int getLastMode() { return lastMode; } + void switchTvRadioMode(); + void switchClockOnOff(); + bool isMuted() { return current_muted; } diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 37952b70b..e4a2dfc8d 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -101,11 +101,14 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings dprintf(DEBUG_DEBUG, "init mainmenue\n"); mainMenu.addItem(GenericMenuSeparator); - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_TVMODE, true, NULL, this, "tv", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED), true); - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_RADIOMODE, true, NULL, this, "radio", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); - //mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SCARTMODE, true, NULL, this, "scart", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); + mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_TVMODE, true, NULL, this, "tv_radio_switch", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED), true); + + //games if (g_PluginList->hasPlugin(CPlugins::P_TYPE_GAME)) - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_GAMES, true, NULL, new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME), "", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); + mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_GAMES, true, NULL, new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME), "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); + + //timer + mainMenu.addItem(new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, new CTimerList(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); //multimedia menu mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_MEDIA, true, NULL, CMediaPlayerMenu::getInstance(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); diff --git a/src/system/locals.h b/src/system/locals.h index 9a34a5735..84273b982 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -250,6 +250,8 @@ typedef enum LOCALE_CI_SETTINGS, LOCALE_CI_TIMEOUT, LOCALE_CI_WAITING, + LOCALE_CLOCK_SWITCH_OFF, + LOCALE_CLOCK_SWITCH_ON, LOCALE_COLORCHOOSER_ALPHA, LOCALE_COLORCHOOSER_BLUE, LOCALE_COLORCHOOSER_GREEN, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index f8ef05cad..97f9e71d6 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -250,6 +250,8 @@ const char * locale_real_names[] = "ci.settings", "ci.timeout", "ci.waiting", + "clock_switch_off", + "clock_switch_on", "colorchooser.alpha", "colorchooser.blue", "colorchooser.green", diff --git a/src/system/settings.h b/src/system/settings.h index 7ca4c9990..20cb2a3c6 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -506,9 +506,10 @@ struct SNeutrinoSettings ITEM_TECHINFO = 13, ITEM_REMOTE = 14, ITEM_PLUGIN = 15, - ITEM_IMAGEINFO, - ITEM_BOXINFO, - ITEM_CAM, + ITEM_IMAGEINFO = 16, + ITEM_BOXINFO = 17, + ITEM_CAM = 18, + ITEM_CLOCK = 19, #if 0 ITEM_MOVIEPLAYER_TS, ITEM_RESTART_CAMD,