From caa345b8c5a2e71e81f2f2f633e33bbfca49971f Mon Sep 17 00:00:00 2001 From: thilo Date: Wed, 31 Aug 2011 16:24:57 +0000 Subject: [PATCH] *neutrino usermenu: move user menu to it's own modul git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1640 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/Makefile.am | 1 + src/gui/user_menue.cpp | 448 +++++++++++++++++++++++++++++++++++++++++ src/gui/user_menue.h | 46 +++-- src/neutrino.cpp | 37 ++-- src/neutrino.h | 12 +- src/neutrino_menue.cpp | 331 ------------------------------ 6 files changed, 504 insertions(+), 371 deletions(-) create mode 100644 src/gui/user_menue.cpp diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 173c1effe..fc3871fb6 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -86,6 +86,7 @@ libneutrino_gui_a_SOURCES = \ themes.cpp \ timeosd.cpp \ update.cpp \ + user_menue.cpp \ user_menue_setup.cpp \ vfd_setup.cpp \ videosettings.cpp \ diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp new file mode 100644 index 000000000..47fc80612 --- /dev/null +++ b/src/gui/user_menue.cpp @@ -0,0 +1,448 @@ +/* + + user_menue setup implementation - Neutrino-GUI + based up implementation by Günther + + Copyright (C) 2001 Steffen Hehn 'McClean' + and some other guys + Homepage: http://dbox.cyberphoria.org/ + + Rework + Copyright (C) 2011 T. Graf 'dbt' + Homepage: http://www.dbox2-tuning.net/ + + + License: GPL + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU + General Public License as published by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; + if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA + + + NOTE for ignorant distributors: + It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL. + Please read it and understand it right! + This means for you: Hold it, if not, leave it! You could face legal action! + Otherwise ask the copyright owners, anything else would be theft! +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "gui/user_menue.h" +#include "gui/user_menue_setup.h" +#include "gui/subchannel_select.h" +#include "gui/favorites.h" +#include "gui/audio_select.h" +#include "gui/streaminfo2.h" +#include "gui/epgplus.h" +#include "gui/movieplayer.h" +#include "gui/timerlist.h" +#include "gui/plugins.h" +#include "gui/imageinfo.h" +#include "gui/dboxinfo.h" +#include "gui/cam_menu.h" + +#include +#include +#include + +#include + +#include +#include + +#include +extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ +extern CPlugins * g_PluginList; +extern CCAMMenuHandler * g_CamHandler; +// +#include + +CUserMenu::CUserMenu() +{ + width = 0; +} + +CUserMenu::~CUserMenu() +{ + +} + +#define MAINMENU_RECORDING_OPTION_COUNT 2 +const CMenuOptionChooser::keyval MAINMENU_RECORDING_OPTIONS[MAINMENU_RECORDING_OPTION_COUNT] = +{ + { 0, LOCALE_MAINMENU_RECORDING_START }, + { 1, LOCALE_MAINMENU_RECORDING_STOP } +}; + +// USERMENU +bool CUserMenu::showUserMenu(int button) +{ + // set width + width = w_max (40, 10); + + if (button < 0 || button >= COL_BUTTONMAX) + return false; + + CMenuItem* menu_item = NULL; + CColorKeyHelper keyhelper; + + //set default feature key + neutrino_msg_t key = CRCInput::RC_nokey; + + const char * icon = NULL; + int dummy; + + int menu_items = 0; + int menu_prev = -1; + + // define classes + CFavorites* tmpFavorites = NULL; + CPauseSectionsdNotifier* tmpPauseSectionsdNotifier = NULL; + CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; + CMenuWidget* tmpNVODSelector = NULL; + CSubChannelSelectMenu subchanselect; + CStreamInfo2Handler* tmpStreamInfo2Handler = NULL; + CEventListHandler* tmpEventListHandler = NULL; + CEPGplusHandler* tmpEPGplusHandler = NULL; + CEPGDataHandler* tmpEPGDataHandler = NULL; + CTimerList* Timerlist = NULL; + CRCLock *rcLock = NULL; + CStreamFeaturesChangeExec *StreamFeaturesChanger = NULL; + CImageInfo *imageinfo = NULL; + CDBoxInfoWidget *boxinfo = NULL; + + std::string txt = g_settings.usermenu_text[button]; + neutrino_locale_t caption = user_menu[button].caption; + + //ensure correct caption for yellow menue + if ( button == SNeutrinoSettings::BUTTON_YELLOW) + caption = g_RemoteControl->are_subchannels ? LOCALE_INFOVIEWER_SUBSERVICE : LOCALE_INFOVIEWER_SELECTTIME; + + //ensure no empty caption + if ( txt.empty() ) + txt = g_Locale->getText(caption); + + CMenuWidget *menu = new CMenuWidget(txt.c_str() , user_menu[button].menu_icon_def, width); + if (menu == NULL) + return 0; + + menu->setSelected(user_menu[button].selected); + + //menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); + menu->addItem(GenericMenuSeparator); + + // go through any postition number + for (int pos = 0; pos < SNeutrinoSettings::ITEM_MAX ; pos++) { + // now compare pos with the position of any item. Add this item if position is the same + switch (g_settings.usermenu[button][pos]) { + case SNeutrinoSettings::ITEM_NONE: + // do nothing + break; + case SNeutrinoSettings::ITEM_BAR: + if (menu_prev == -1 || menu_prev == SNeutrinoSettings::ITEM_BAR ) + break; + + menu->addItem(GenericMenuSeparatorLine); + menu_prev = SNeutrinoSettings::ITEM_BAR; + break; + + case SNeutrinoSettings::ITEM_FAVORITS: + { + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_FAVORITS; + tmpFavorites = new CFavorites; + keyhelper.get(&key,&icon,CRCInput::RC_green); + menu_item = new CMenuForwarder(LOCALE_FAVORITES_MENUEADD, true, NULL, tmpFavorites, "-1", key, icon); + menu->addItem(menu_item, false); + break; + } + case SNeutrinoSettings::ITEM_RECORD: + { + if (g_settings.recording_type == RECORDING_OFF) + break; + + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_RECORD; + keyhelper.get(&key,&icon,CRCInput::RC_red); +#if 1 //NEW, show menu, how better ? + menu_item = new CMenuForwarder(LOCALE_MAINMENU_RECORDING, true, NULL, CRecordManager::getInstance(), "-1", key, icon); +#else //OLD, show start/stop chooser + menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_RECORDING, &CRecordManager::getInstance()->recordingstatus, + MAINMENU_RECORDING_OPTIONS, MAINMENU_RECORDING_OPTION_COUNT, true, + CRecordManager::getInstance(), key, icon); +#endif + + menu->addItem(menu_item, false); + //if(has_hdd) + // menu->addItem(new CMenuForwarder(LOCALE_EXTRA_AUTO_TO_RECORD, autoshift, NULL, CNeutrinoApp::getInstance(), "autolink"), false); + break; + } + case SNeutrinoSettings::ITEM_MOVIEPLAYER_MB: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_MB; + keyhelper.get(&key,&icon,CRCInput::RC_green); + menu_item = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, &CMoviePlayerGui::getInstance(), "tsmoviebrowser", key, icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_TIMERLIST: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_TIMERLIST; + keyhelper.get(&key,&icon,CRCInput::RC_yellow); + Timerlist = new CTimerList(); + menu_item = new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, Timerlist, "-1", key, icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_REMOTE: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_REMOTE; + keyhelper.get(&key,&icon,CRCInput::RC_nokey); + rcLock = new CRCLock(); + menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1" , key, icon ); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_EPG_SUPER: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_EPG_SUPER; + tmpEPGplusHandler = new CEPGplusHandler(); + keyhelper.get(&key,&icon,CRCInput::RC_green); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS , true, NULL, tmpEPGplusHandler , "-1", key, icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_EPG_LIST: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_EPG_LIST; + tmpEventListHandler = new CEventListHandler(); + keyhelper.get(&key,&icon,CRCInput::RC_red); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, tmpEventListHandler, "-1", key, icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_EPG_INFO: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_EPG_INFO; + tmpEPGDataHandler = new CEPGDataHandler(); + keyhelper.get(&key,&icon,CRCInput::RC_yellow); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, tmpEPGDataHandler , "-1", key, icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_EPG_MISC: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_EPG_MISC; + dummy = g_Sectionsd->getIsScanningActive(); + //dummy = sectionsd_scanning; + tmpPauseSectionsdNotifier = new CPauseSectionsdNotifier; + keyhelper.get(&key,&icon); + menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, tmpPauseSectionsdNotifier , key, icon ); + menu->addItem(menu_item, false); + menu_items++; + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_MAINMENU_CLEARSECTIONSD, true, NULL, CNeutrinoApp::getInstance(), "clearSectionsd", key,icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_AUDIO_SELECT: + //g_settings.audio_left_right_selectable || g_RemoteControl->current_PIDs.APIDs.size() > 1) + if (1) { + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_AUDIO_SELECT; + tmpAudioSelectMenuHandler = new CAudioSelectMenuHandler; + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_AUDIOSELECTMENUE_HEAD, true, NULL, tmpAudioSelectMenuHandler, "-1", key,icon); + menu->addItem(menu_item, false); + } + break; + + case SNeutrinoSettings::ITEM_SUBCHANNEL: + if (!(g_RemoteControl->subChannels.empty())) { + // NVOD/SubService- Kanal! + tmpNVODSelector = new CMenuWidget(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, NEUTRINO_ICON_VIDEO); + if (subchanselect.getNVODMenu(tmpNVODSelector)) { + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_SUBCHANNEL; + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, true, NULL, tmpNVODSelector, "-1", key,icon); + menu->addItem(menu_item, false); + } + } + break; + + case SNeutrinoSettings::ITEM_TECHINFO: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_TECHINFO; + tmpStreamInfo2Handler = new CStreamInfo2Handler(); + keyhelper.get(&key,&icon,CRCInput::RC_blue); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, tmpStreamInfo2Handler , "-1", key, icon ); + menu->addItem(menu_item, false); + break; + case SNeutrinoSettings::ITEM_PLUGIN: + { + char id[5]; + int cnt = 0; + for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++) + { + if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count)) + { + sprintf(id, "%d", count); + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_PLUGIN; + //keyhelper.get(&key,&icon,CRCInput::RC_blue); + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); + //menu->addItem(menu_item, (cnt == 0)); + menu->addItem(menu_item, 0); + cnt++; + } + } + } + break; + + case SNeutrinoSettings::ITEM_VTXT: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_VTXT; + keyhelper.get(&key,&icon, CRCInput::RC_blue); + StreamFeaturesChanger = new CStreamFeaturesChangeExec(); + menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, StreamFeaturesChanger, "teletext", key, icon); + menu->addItem(menu_item, 0); + break; + case SNeutrinoSettings::ITEM_IMAGEINFO: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_IMAGEINFO; + imageinfo = new CImageInfo(); + keyhelper.get(&key,&icon); + menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, imageinfo, NULL, key, icon ), false); + break; + case SNeutrinoSettings::ITEM_BOXINFO: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_BOXINFO; + boxinfo = new CDBoxInfoWidget(); + keyhelper.get(&key,&icon); + menu->addItem( new CMenuForwarder(LOCALE_EXTRA_DBOXINFO, true, NULL, boxinfo, NULL, key, icon)); + break; + case SNeutrinoSettings::ITEM_CAM: + //if(cs_get_revision() != 10) + { + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_CAM; + keyhelper.get(&key,&icon); + menu->addItem(new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon)); + } + break; + +#if 0 // FIXME not supported yet + case SNeutrinoSettings::ITEM_MOVIEPLAYER_TS: + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_TS; + keyhelper.get(&key,&icon,CRCInput::RC_green); + menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_TSPLAYBACK, true, NULL, moviePlayerGui, "tsplayback", key, icon); + menu->addItem(menu_item, false); + break; + + case SNeutrinoSettings::ITEM_VTXT: + for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++) + { + std::string tmp = g_PluginList->getName(count); + if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count) && tmp.find("Teletext") != std::string::npos) + { + sprintf(id, "%d", count); + menu_items++; + menu_prev = SNeutrinoSettings::ITEM_VTXT; + + //keyhelper.get(&key,&icon,CRCInput::RC_blue); + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); + menu->addItem(menu_item, 0); + } + } + break; +#endif + default: + printf("[neutrino] WARNING! menu wrong item!!\n"); + break; + } + } + + // Allow some tailoring for privat image bakers ;) + if (button == SNeutrinoSettings::BUTTON_RED) { + } + else if ( button == SNeutrinoSettings::BUTTON_GREEN) { + } + else if ( button == SNeutrinoSettings::BUTTON_YELLOW) { + } + else if ( button == SNeutrinoSettings::BUTTON_BLUE) { +#ifdef _EXPERIMENTAL_SETTINGS_ + //Experimental Settings + if (menu_prev != -1) + menu->addItem(GenericMenuSeparatorLine); + menu_items ++; + menu_key++; + // FYI: there is a memory leak with 'new CExperimentalSettingsMenuHandler() + menu_item = new CMenuForwarder(LOCALE_EXPERIMENTALSETTINGS, true, NULL, new CExperimentalSettingsMenuHandler(), "-1", CRCInput::convertDigitToKey(menu_key)); + menu->addItem(menu_item, false); +#endif + } + + // show menu if there are more than 2 items only + // otherwise, we start the item directly (must be the last one) + if (menu_items > 1 ) { + menu->exec(NULL,""); + } + else if (menu_item != NULL) + menu_item->exec( NULL ); + + user_menu[button].selected = menu->getSelected(); + + // restore mute symbol + //AudioMute(current_muted, true); + + // clear the heap + if (tmpFavorites) delete tmpFavorites; + if (tmpPauseSectionsdNotifier) delete tmpPauseSectionsdNotifier; + if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; + if (tmpNVODSelector) delete tmpNVODSelector; + if (tmpStreamInfo2Handler) delete tmpStreamInfo2Handler; + if (tmpEventListHandler) delete tmpEventListHandler; + if (tmpEPGplusHandler) delete tmpEPGplusHandler; + if (tmpEPGDataHandler) delete tmpEPGDataHandler; + if (Timerlist) delete Timerlist; + if (rcLock) delete rcLock; + if (StreamFeaturesChanger) delete StreamFeaturesChanger; + if (imageinfo) delete imageinfo; + if (boxinfo) delete boxinfo; + if (menu) delete menu; + return 0; +} + +/************************************************************************************** +* changeNotify - features menu recording start / stop * +**************************************************************************************/ +bool CUserMenu::changeNotify(const neutrino_locale_t OptionName, void * /*Data*/) +{ + bool res = !CRecordManager::getInstance()->RecordingStatus() ? false:true; + + if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_MAINMENU_RECORDING_START)) || (ARE_LOCALES_EQUAL(OptionName, LOCALE_MAINMENU_RECORDING))) + { + CNeutrinoApp::getInstance()->exec(NULL, "handle_record"); + + if (CRecordManager::getInstance()->RecordingStatus()) + res = false; + else + res = true; + } + + return res; +} diff --git a/src/gui/user_menue.h b/src/gui/user_menue.h index c09248566..5e0feea37 100644 --- a/src/gui/user_menue.h +++ b/src/gui/user_menue.h @@ -1,6 +1,4 @@ /* - $id$ - user_menue setup implementation - Neutrino-GUI based up implementation by Günther @@ -8,25 +6,29 @@ and some other guys Homepage: http://dbox.cyberphoria.org/ + Rework Copyright (C) 2011 T. Graf 'dbt' Homepage: http://www.dbox2-tuning.net/ License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU + General Public License as published by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; + if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA + + + NOTE for ignorant distributors: + It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL. + Please read it and understand it right! + This means for you: Hold it, if not, leave it! You could face legal action! + Otherwise ask the copyright owners, anything else would be theft! */ #ifndef __user_menue__ @@ -57,6 +59,22 @@ static user_menu_data_t user_menu[COL_BUTTONMAX]= {LOCALE_INFOVIEWER_STREAMINFO , CRCInput::RC_blue , NEUTRINO_ICON_BUTTON_BLUE , NEUTRINO_ICON_FEATURES, -1} }; +// #define COL_BUTTONMAX SNeutrinoSettings::BUTTON_MAX +// const neutrino_msg_t col_key_helper_msg_def[COL_BUTTONMAX]={CRCInput::RC_red,CRCInput::RC_green,CRCInput::RC_yellow,CRCInput::RC_blue}; +// const char * col_key_helper_icon_def[COL_BUTTONMAX]={NEUTRINO_ICON_BUTTON_RED,NEUTRINO_ICON_BUTTON_GREEN,NEUTRINO_ICON_BUTTON_YELLOW,NEUTRINO_ICON_BUTTON_BLUE}; + +class CUserMenu : public CChangeObserver +{ + private: + int width; + bool changeNotify(const neutrino_locale_t OptionName, void *); + + public: + CUserMenu(); + ~CUserMenu(); + bool showUserMenu(int button); +}; + // This is just a quick helper for the usermenu only. class CColorKeyHelper diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 30b34ee3b..695cad276 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1974,12 +1974,8 @@ int CNeutrinoApp::run(int argc, char **argv) g_PluginList->loadPlugins(); APIDChanger = new CAPIDChangeExec; - StreamFeaturesChanger = new CStreamFeaturesChangeExec; MoviePluginChanger = new CMoviePluginChangeExec; ConsoleDestinationChanger = new CConsoleDestChangeNotifier; - rcLock = new CRCLock(); - //USERMENU - Timerlist = new CTimerList; // setup recording device setupRecordingDevice(); @@ -2167,7 +2163,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) { neutrino_msg_t msg; neutrino_msg_data_t data; - + dprintf(DEBUG_NORMAL, "initialized everything\n"); g_PluginList->startPlugin("startup.cfg"); @@ -2326,25 +2322,26 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if(CRecordManager::getInstance()->RecordingStatus()) CRecordManager::getInstance()->ShowMenu(); } + else if( msg == CRCInput::RC_red ) { StopSubtitles(); - showUserMenu(SNeutrinoSettings::BUTTON_RED); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_RED); StartSubtitles(); } else if( (msg == CRCInput::RC_green) || ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) ) { StopSubtitles(); - showUserMenu(SNeutrinoSettings::BUTTON_GREEN); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); StartSubtitles(); } else if( msg == CRCInput::RC_yellow ) { // NVODs StopSubtitles(); - showUserMenu(SNeutrinoSettings::BUTTON_YELLOW); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_YELLOW); StartSubtitles(); } else if( msg == CRCInput::RC_blue ) { StopSubtitles(); - showUserMenu(SNeutrinoSettings::BUTTON_BLUE); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_BLUE); StartSubtitles(); } else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { @@ -2392,8 +2389,10 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) showInfo(); } } - else if (msg == CRCInput::RC_timer) { - Timerlist->exec(NULL, ""); + else if (msg == CRCInput::RC_timer) + { + CTimerList Timerlist; + Timerlist.exec(NULL, ""); } else { if (msg == CRCInput::RC_home) { @@ -3014,8 +3013,10 @@ _repeat: delete[] (unsigned char*) data; return messages_return::handled; } - else if (msg == NeutrinoMessages::LOCK_RC) { - this->rcLock->exec(NULL,CRCLock::NO_USER_INPUT); + else if (msg == NeutrinoMessages::LOCK_RC) + { + CRCLock rcLock; + rcLock.exec(NULL,CRCLock::NO_USER_INPUT); return messages_return::handled; } else if( msg == NeutrinoMessages::CHANGEMODE ) { @@ -3711,7 +3712,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) { // printf("ac: %s\n", actionKey.c_str()); int returnval = menu_return::RETURN_REPAINT; - + if(actionKey == "help_recording") { ShowLocalizedMessage(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMessageBox::mbrBack, CMessageBox::mbBack); } @@ -3871,7 +3872,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) g_Sectionsd->freeMemory(); } - return returnval; } @@ -3880,11 +3880,12 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) **************************************************************************************/ bool CNeutrinoApp::changeNotify(const neutrino_locale_t OptionName, void * /*data*/) { - if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LANGUAGESETUP_SELECT)) { + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LANGUAGESETUP_SELECT)) + { g_Locale->loadLocale(g_settings.language); return true; - } - return false; + } + return false; } /************************************************************************************** diff --git a/src/neutrino.h b/src/neutrino.h index f8e6c7656..d29c73a68 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -46,6 +46,7 @@ #include #include /* st_rmsg */ +#include #include #include @@ -115,6 +116,7 @@ private: CConfigFile configfile; CScanSettings scanSettings; + CUserMenu usermenu; int network_dhcp; int network_automatic_start; @@ -138,16 +140,10 @@ private: bool pbBlinkChange; CColorSetupNotifier *colorSetupNotifier; CNetworkSetup *networksetup; - CStreamFeaturesChangeExec *StreamFeaturesChanger; CMoviePluginChangeExec *MoviePluginChanger; COnekeyPluginChangeExec *OnekeyPluginChanger; CIPChangeNotifier *MyIPChanger; CConsoleDestChangeNotifier *ConsoleDestinationChanger; - CRCLock *rcLock; - // USERMENU - CTimerList *Timerlist; - - bool showUserMenu(int button); void firstChannel(); void setupNetwork( bool force= false ); @@ -201,8 +197,8 @@ public: //callback stuff only.... int exec(CMenuTarget* parent, const std::string & actionKey); - //onchange - bool changeNotify(const neutrino_locale_t OptionName, void *); +// //onchange + bool changeNotify(const neutrino_locale_t OptionName, void *); int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 5a1d13499..d6639cf51 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -73,17 +73,13 @@ #include "gui/sleeptimer.h" #include "gui/software_update.h" #include -#include "gui/subchannel_select.h" #ifdef TEST_MENU #include "gui/test_menu.h" #endif /*TEST_MENU*/ #include "gui/update.h" -#include "gui/user_menue.h" #include "gui/vfd_setup.h" #include -//#include "gui/widget/stringinput.h" -//#include "gui/widget/stringinput_ext.h" extern CPlugins * g_PluginList; extern CRemoteControl * g_RemoteControl; @@ -275,330 +271,3 @@ void CNeutrinoApp::InitServiceSettings(CMenuWidget &service) -#define MAINMENU_RECORDING_OPTION_COUNT 2 -const CMenuOptionChooser::keyval MAINMENU_RECORDING_OPTIONS[MAINMENU_RECORDING_OPTION_COUNT] = -{ - { 0, LOCALE_MAINMENU_RECORDING_START }, - { 1, LOCALE_MAINMENU_RECORDING_STOP } -}; - - -// USERMENU -bool CNeutrinoApp::showUserMenu(int button) -{ - if (button < 0 || button >= COL_BUTTONMAX) - return false; - - CMenuItem* menu_item = NULL; - CColorKeyHelper keyhelper; - neutrino_msg_t key = CRCInput::RC_nokey; - const char * icon = NULL; - int dummy; - - int menu_items = 0; - int menu_prev = -1; - - // define classes - CFavorites* tmpFavorites = NULL; - CPauseSectionsdNotifier* tmpPauseSectionsdNotifier = NULL; - CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; - CMenuWidget* tmpNVODSelector = NULL; - CSubChannelSelectMenu subchanselect; - CStreamInfo2Handler* tmpStreamInfo2Handler = NULL; - CEventListHandler* tmpEventListHandler = NULL; - CEPGplusHandler* tmpEPGplusHandler = NULL; - CEPGDataHandler* tmpEPGDataHandler = NULL; - - std::string txt = g_settings.usermenu_text[button]; - neutrino_locale_t caption = user_menu[button].caption; - - //ensure correct caption for yellow menue - if ( button == SNeutrinoSettings::BUTTON_YELLOW) - caption = g_RemoteControl->are_subchannels ? LOCALE_INFOVIEWER_SUBSERVICE : LOCALE_INFOVIEWER_SELECTTIME; - - if ( txt.empty() ) - txt = g_Locale->getText(caption); - - CMenuWidget *menu = new CMenuWidget(txt.c_str() , user_menu[button].menu_icon_def, 35); - if (menu == NULL) - return 0; - - menu->setSelected(user_menu[button].selected); - - //menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); - menu->addItem(GenericMenuSeparator); - // go through any postition number - for (int pos = 0; pos < SNeutrinoSettings::ITEM_MAX ; pos++) { - // now compare pos with the position of any item. Add this item if position is the same - switch (g_settings.usermenu[button][pos]) { - case SNeutrinoSettings::ITEM_NONE: - // do nothing - break; - case SNeutrinoSettings::ITEM_BAR: - if (menu_prev == -1 || menu_prev == SNeutrinoSettings::ITEM_BAR ) - break; - - menu->addItem(GenericMenuSeparatorLine); - menu_prev = SNeutrinoSettings::ITEM_BAR; - break; - - case SNeutrinoSettings::ITEM_FAVORITS: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_FAVORITS; - tmpFavorites = new CFavorites; - keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_FAVORITES_MENUEADD, true, NULL, tmpFavorites, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_RECORD: - if (g_settings.recording_type == RECORDING_OFF) - break; - - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_RECORD; - keyhelper.get(&key,&icon,CRCInput::RC_red); -#if 1 //NEW, show menu, how better ? - menu_item = new CMenuForwarder(LOCALE_MAINMENU_RECORDING, true, NULL, CRecordManager::getInstance(), "-1", key, icon); -#else //OLD, show start/stop chooser - menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_RECORDING, &CRecordManager::getInstance()->recordingstatus, - MAINMENU_RECORDING_OPTIONS, MAINMENU_RECORDING_OPTION_COUNT, true, - CRecordManager::getInstance(), key, icon); -#endif - menu->addItem(menu_item, false); - //if(has_hdd) - // menu->addItem(new CMenuForwarder(LOCALE_EXTRA_AUTO_TO_RECORD, autoshift, NULL, this, "autolink"), false); - break; - - case SNeutrinoSettings::ITEM_MOVIEPLAYER_MB: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_MB; - keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, &CMoviePlayerGui::getInstance(), "tsmoviebrowser", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_TIMERLIST: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_TIMERLIST; - keyhelper.get(&key,&icon,CRCInput::RC_yellow); - menu_item = new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, Timerlist, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_REMOTE: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_REMOTE; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, this->rcLock, "-1" , key, icon ); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_SUPER: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_SUPER; - tmpEPGplusHandler = new CEPGplusHandler(); - keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS , true, NULL, tmpEPGplusHandler , "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_LIST: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_LIST; - tmpEventListHandler = new CEventListHandler(); - keyhelper.get(&key,&icon,CRCInput::RC_red); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, tmpEventListHandler, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_INFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_INFO; - tmpEPGDataHandler = new CEPGDataHandler(); - keyhelper.get(&key,&icon,CRCInput::RC_yellow); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, tmpEPGDataHandler , "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_MISC: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_MISC; - dummy = g_Sectionsd->getIsScanningActive(); - //dummy = sectionsd_scanning; - tmpPauseSectionsdNotifier = new CPauseSectionsdNotifier; - keyhelper.get(&key,&icon); - menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, tmpPauseSectionsdNotifier , key, icon ); - menu->addItem(menu_item, false); - menu_items++; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MAINMENU_CLEARSECTIONSD, true, NULL, this, "clearSectionsd", key,icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_AUDIO_SELECT: - //g_settings.audio_left_right_selectable || g_RemoteControl->current_PIDs.APIDs.size() > 1) - if (1) { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_AUDIO_SELECT; - tmpAudioSelectMenuHandler = new CAudioSelectMenuHandler; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_AUDIOSELECTMENUE_HEAD, true, NULL, tmpAudioSelectMenuHandler, "-1", key,icon); - menu->addItem(menu_item, false); - } - break; - - case SNeutrinoSettings::ITEM_SUBCHANNEL: - if (!(g_RemoteControl->subChannels.empty())) { - // NVOD/SubService- Kanal! - tmpNVODSelector = new CMenuWidget(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, NEUTRINO_ICON_VIDEO); - if (subchanselect.getNVODMenu(tmpNVODSelector)) { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_SUBCHANNEL; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, true, NULL, tmpNVODSelector, "-1", key,icon); - menu->addItem(menu_item, false); - } - } - break; - - case SNeutrinoSettings::ITEM_TECHINFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_TECHINFO; - tmpStreamInfo2Handler = new CStreamInfo2Handler(); - keyhelper.get(&key,&icon,CRCInput::RC_blue); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, tmpStreamInfo2Handler , "-1", key, icon ); - menu->addItem(menu_item, false); - break; - case SNeutrinoSettings::ITEM_PLUGIN: - { - char id[5]; - int cnt = 0; - for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++) - { - std::string tmp = g_PluginList->getName(count); - if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count) && tmp.find("Teletext") == std::string::npos) - { - sprintf(id, "%d", count); - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_PLUGIN; - - //keyhelper.get(&key,&icon,CRCInput::RC_blue); - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); - //menu->addItem(menu_item, (cnt == 0)); - menu->addItem(menu_item, 0); - cnt++; - } - } - } - break; - - case SNeutrinoSettings::ITEM_VTXT: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_VTXT; - keyhelper.get(&key,&icon,CRCInput::RC_blue); - menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, StreamFeaturesChanger, "teletext", key, icon); - menu->addItem(menu_item, 0); - break; - case SNeutrinoSettings::ITEM_IMAGEINFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_IMAGEINFO; - keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, new CImageInfo(), NULL, key, icon ), false); - break; - case SNeutrinoSettings::ITEM_BOXINFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_BOXINFO; - keyhelper.get(&key,&icon); - menu->addItem( new CMenuForwarder(LOCALE_EXTRA_DBOXINFO, true, NULL, new CDBoxInfoWidget, NULL, key, icon)); - break; - case SNeutrinoSettings::ITEM_CAM: - //if(cs_get_revision() != 10) - { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_CAM; - keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon)); - } - break; - -#if 0 // FIXME not supported yet - case SNeutrinoSettings::ITEM_MOVIEPLAYER_TS: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_TS; - keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_TSPLAYBACK, true, NULL, moviePlayerGui, "tsplayback", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_VTXT: - for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++) - { - std::string tmp = g_PluginList->getName(count); - if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count) && tmp.find("Teletext") != std::string::npos) - { - sprintf(id, "%d", count); - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_VTXT; - - //keyhelper.get(&key,&icon,CRCInput::RC_blue); - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); - menu->addItem(menu_item, 0); - } - } - break; -#endif - default: - printf("[neutrino] WARNING! menu wrong item!!\n"); - break; - } - } - - // Allow some tailoring for privat image bakers ;) - if (button == SNeutrinoSettings::BUTTON_RED) { - } - else if ( button == SNeutrinoSettings::BUTTON_GREEN) { - } - else if ( button == SNeutrinoSettings::BUTTON_YELLOW) { - } - else if ( button == SNeutrinoSettings::BUTTON_BLUE) { -#ifdef _EXPERIMENTAL_SETTINGS_ - //Experimental Settings - if (menu_prev != -1) - menu->addItem(GenericMenuSeparatorLine); - menu_items ++; - menu_key++; - // FYI: there is a memory leak with 'new CExperimentalSettingsMenuHandler() - menu_item = new CMenuForwarder(LOCALE_EXPERIMENTALSETTINGS, true, NULL, new CExperimentalSettingsMenuHandler(), "-1", CRCInput::convertDigitToKey(menu_key)); - menu->addItem(menu_item, false); -#endif - } - - // show menu if there are more than 2 items only - // otherwise, we start the item directly (must be the last one) - if (menu_items > 1 ) { - menu->exec(NULL,""); - } - else if (menu_item != NULL) - menu_item->exec( NULL ); - - user_menu[button].selected = menu->getSelected(); - - // restore mute symbol - //AudioMute(current_muted, true); - - // clear the heap - if (tmpFavorites) delete tmpFavorites; - if (tmpPauseSectionsdNotifier) delete tmpPauseSectionsdNotifier; - if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; - if (tmpNVODSelector) delete tmpNVODSelector; - if (tmpStreamInfo2Handler) delete tmpStreamInfo2Handler; - if (tmpEventListHandler) delete tmpEventListHandler; - if (tmpEPGplusHandler) delete tmpEPGplusHandler; - if (tmpEPGDataHandler) delete tmpEPGDataHandler; - if (menu) delete menu; - return 0; -} -