diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index bb3848036..3e5c281ab 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -85,6 +85,7 @@ install_DATA = \ left.png \ local.png \ lock.png \ + lock_passive.png \ mainmenue.png \ menu.png \ menu_small.png \ @@ -121,6 +122,7 @@ install_DATA = \ notyet.png \ numericpad.png \ ok.png \ + personalize.png \ polski.png \ portugues.png \ power.png \ diff --git a/data/icons/lock.png b/data/icons/lock.png index b82741970..868786dfd 100644 Binary files a/data/icons/lock.png and b/data/icons/lock.png differ diff --git a/data/icons/lock_passive.png b/data/icons/lock_passive.png new file mode 100644 index 000000000..4ec3bdc5f Binary files /dev/null and b/data/icons/lock_passive.png differ diff --git a/data/icons/personalize.png b/data/icons/personalize.png new file mode 100644 index 000000000..b067dbc06 Binary files /dev/null and b/data/icons/personalize.png differ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index e051c2514..f4063ab46 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -988,6 +988,40 @@ parentallock.never Nie parentallock.onsignal Bei gesendeter Vorsperre parentallock.parentallock Jugendschutz parentallock.prompt PIN-Eingabe +personalize.access Zugangsoptionen +personalize.apply_settings Änderungen übernehmen? +personalize.button_auto Auto +personalize.button_blue Blau +personalize.button_green Grün +personalize.button_red Rot +personalize.button_yellow Gelb +personalize.disabled deaktiviert +personalize.enabled aktiviert +personalize.features Erweiterungen +personalize.head Menüs anpassen +personalize.help Hilfe +personalize.help_line1 Die Personalisierung ermöglicht es, die wichtigsten +personalize.help_line2 Menüs Ihren Bedürfnissen anzupassen. Menüs +personalize.help_line3 können auf sichtbar, unsichtbar, aktiviert, deaktiviert +personalize.help_line4 gestellt oder mit PIN gesichert werden. +personalize.help_line5 Der Zugang zur Personalisierung selbst kann mit PIN +personalize.help_line6 gesichert werden. Die PIN ist dann für alle anderen +personalize.help_line7 Menüs identisch (nicht Jugendschutz-PIN). +personalize.help_line8 Die Standard-PIN lautet 0000. +personalize.menuconfiguration Menüeinstellungen +personalize.menudisabledhint Das angeforderte Menü ist nicht aktiviert!\nNutzen sie die Personalisierung im\nMenü 'Einstellungen', um es zu aktivieren! +personalize.notprotected nein +personalize.notvisible nicht sichtbar +personalize.pin PIN +personalize.pincode PIN Code +personalize.pinhint Personalisierungs PIN Code eingeben +personalize.pinprotect ja +personalize.pinstatus mit PIN +personalize.plugins Plugins +personalize.setupmenuwithpin Einstellungen-Menü mit PIN +personalize.usermenu_preferred_buttons Bevorzugte Tasten zuweisen +personalize.usermenu_show_cancel Zeige Schalter "Abbrechen" +personalize.visible sichtbar pictureviewer.defdir Start-Verz. pictureviewer.head Bildbetrachter pictureviewer.help1 Menü-Modus @@ -1289,8 +1323,9 @@ usermenu.button_yellow Benutzermenü 'gelb' usermenu.head Benutzermenü usermenu.item_bar ---- Trennung ---- usermenu.item_epg_misc EPG Funktionen -usermenu.item_none +usermenu.item_none (frei) usermenu.item_vtxt Teletext +usermenu.msg_info_is_empty Es wurde kein Name für dieses Menü vergeben.\nVerwende Standardname:\n usermenu.name Name video_mode_ok Video-Einstellungen OK? videomenu.43mode 4:3 Anzeigeverhalten diff --git a/data/locale/english.locale b/data/locale/english.locale index 102b09944..ebe88132d 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -988,6 +988,40 @@ parentallock.never never parentallock.onsignal on broadcasted lock parentallock.parentallock Youth protection parentallock.prompt prompt for PIN +personalize.access Access options +personalize.apply_settings Apply changes? +personalize.button_auto auto +personalize.button_blue blue +personalize.button_green green +personalize.button_red red +personalize.button_yellow yellow +personalize.disabled Disabled +personalize.enabled Enabled +personalize.features Features menue +personalize.head Personalization +personalize.help Help +personalize.help_line1 Personalization makes it possible to adapt the most +personalize.help_line2 important menus you need. Menus +personalize.help_line3 can be set to visible, not visible, activate, deactivate +personalize.help_line4 or PIN-protected. +personalize.help_line5 The access to personalization can be protected +personalize.help_line6 with PIN. The PIN is identical for all protected menus +personalize.help_line7 (not for youth protection). +personalize.help_line8 Default PIN is: 0000 +personalize.menuconfiguration Menu Configuration +personalize.menudisabledhint The requested menu is currently disabled!\nFor activation please open menu 'Personalize'\nto find in menu 'Settings'! +personalize.notprotected No +personalize.notvisible Not Visible +personalize.pin PIN +personalize.pincode PIN Code +personalize.pinhint Enter the Personalization PIN Code +personalize.pinprotect Yes +personalize.pinstatus Require PIN +personalize.plugins Plugins +personalize.setupmenuwithpin Settings Menu with PIN +personalize.usermenu_preferred_buttons Assigning of preferred keys +personalize.usermenu_show_cancel Show "Cancel"-Button +personalize.visible Visible pictureviewer.defdir start dir. pictureviewer.head Picture viewer pictureviewer.help1 menu mode @@ -1289,8 +1323,9 @@ usermenu.button_yellow User menu yellow usermenu.head User menu usermenu.item_bar ---- Boarder ---- usermenu.item_epg_misc EPG functions -usermenu.item_none Nothing +usermenu.item_none (empty) usermenu.item_vtxt Videotext +usermenu.msg_info_is_empty You don't have definied a name for this menu!\nUsing default name:\n usermenu.name Name video_mode_ok Is this video mode working ok ? videomenu.43mode 4:3 Content mode diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index c6665e6ac..1527aa0d9 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -66,6 +66,7 @@ libneutrino_gui_a_SOURCES = \ osd_setup.cpp \ osdlang_setup.cpp \ parentallock_setup.cpp \ + personalize.cpp \ pictureviewer.cpp \ pictureviewer_setup.cpp \ pluginlist.cpp \ diff --git a/src/gui/audio_select.cpp b/src/gui/audio_select.cpp index 906fee43e..e75e74742 100644 --- a/src/gui/audio_select.cpp +++ b/src/gui/audio_select.cpp @@ -95,7 +95,11 @@ int CAudioSelectMenuHandler::doMenu () CSubtitleChangeExec SubtitleChanger; - AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); + //show cancel button if configured in usermenu settings + if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL]) + AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); + else + AudioSelector.addItem(GenericMenuSeparator); unsigned int shortcut_num = 1; diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index c799beca5..b98edeb5b 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -35,7 +35,6 @@ #include "gui/keybind_setup.h" -#include "gui/user_menue_setup.h" #include #include @@ -191,12 +190,6 @@ int CKeybindSetup::showKeySetup() keySettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, true, g_settings.repeat_genericblocker, keySettings_repeat_genericblocker)); keySettings->addItem(new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_REMOTECONTROL, &g_settings.remote_control_hardware, KEYBINDINGMENU_REMOTECONTROL_OPTIONS, KEYBINDINGMENU_REMOTECONTROL_OPTION_COUNT, true)); - //user menues - keySettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_HEAD)); - keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_RED, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_RED,0), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); - keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_GREEN, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_GREEN,1), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); - keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_YELLOW, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_YELLOW,2), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); - keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_BLUE, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_BLUE,3), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); int res = keySettings->exec(NULL, ""); keySettings->hide(); diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index 5855f590d..5df2aac8f 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -102,16 +102,29 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } - int res = showMenu(); + int res = initMenuMedia(); return res; } -//show selectable mediaplayer items -int CMediaPlayerMenu::showMenu() -{ - CMenuWidget *media = new CMenuWidget(menu_title, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA); +//show selectable mediaplayer items +int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) +{ + CPersonalizeGui *personalize = p; + CMenuWidget *media = m; + + bool show = (personalize == NULL || media == NULL); + + if (personalize == NULL) + personalize = new CPersonalizeGui(); + + if (media == NULL) + media = new CMenuWidget(menu_title, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA); + + personalize->addWidget(media); + personalize->addIntroItems(media); + CMenuForwarder *fw_audio = NULL; CMenuForwarder *fw_inet = NULL; CMenuForwarder *fw_mp = NULL; @@ -127,6 +140,7 @@ int CMediaPlayerMenu::showMenu() neutrino_msg_t audio_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_audio:CRCInput::RC_red; const char* audio_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_RED; fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, this, "audioplayer", audio_rc, audio_btn); + //internet player neutrino_msg_t inet_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_www : CRCInput::RC_green; const char* inet_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_GREEN; @@ -136,67 +150,83 @@ int CMediaPlayerMenu::showMenu() if (usage_mode == MODE_DEFAULT) { //movieplayer - moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER); + moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MOVIEPLAYER, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER); + personalize->addWidget(moviePlayer); fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, moviePlayer, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); - //pictureviewer - fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); - + //pictureviewer + fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); #if ENABLE_UPNP //upnp browser fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, true, NULL, new CUpnpBrowserGui(), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0); #endif - media->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, usage_mode == MODE_AUDIO ? CMenuWidget::BTN_TYPE_CANCEL : CMenuWidget::BTN_TYPE_BACK); +// media->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, usage_mode == MODE_AUDIO ? CMenuWidget::BTN_TYPE_CANCEL : CMenuWidget::BTN_TYPE_BACK); } if (usage_mode == MODE_AUDIO) { - //audio player - media->addItem(fw_audio); - - //internet player - media->addItem(fw_inet); + //audio player + personalize->addItem(media, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]); + + //internet player + personalize->addItem(media, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]); } else if (usage_mode == MODE_VIDEO) { - showMoviePlayer(media); + showMoviePlayer(media, personalize); } else { //audio player - media->addItem(fw_audio); + personalize->addItem(media, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]); //internet player - media->addItem(fw_inet); + personalize->addItem(media, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]); //movieplayer - showMoviePlayer(moviePlayer); - media->addItem(fw_mp); + showMoviePlayer(moviePlayer, personalize); + personalize->addItem(media, fw_mp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_MPLAYER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); - //pictureviewer - media->addItem(fw_pviewer); -#if ENABLE_UPNP + //picture viewer + personalize->addItem(media, fw_pviewer, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_PVIEWER]); +#if ENABLE_UPNP //upnp browser - media->addItem(fw_upnp); + personalize->addItem(media, fw_upnp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_UPNP]); #endif } - int res = media->exec(NULL, ""); - media->hide(); - delete media; - setUsageMode();//set default usage_mode + int res = menu_return::RETURN_NONE; + + if (show) + { + //adding personalized items + personalize->addPersonalizedItems(); + + res = media->exec(NULL, ""); + media->hide(); + delete media; + delete personalize; + + setUsageMode();//set default usage_mode + } return res; } //show movieplayer submenu with selectable items for moviebrowser or filebrowser -void CMediaPlayerMenu::showMoviePlayer(CMenuWidget *moviePlayer) +void CMediaPlayerMenu::showMoviePlayer(CMenuWidget *moviePlayer, CPersonalizeGui *p) { CMoviePlayerGui *movieplayer_gui = &CMoviePlayerGui::getInstance(); - - moviePlayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER); - moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, movieplayer_gui, "tsmoviebrowser", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); - moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, movieplayer_gui, "fileplayback", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); + CMenuForwarder *fw_mbrowser = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, movieplayer_gui, "tsmoviebrowser", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + CMenuForwarder *fw_file = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, movieplayer_gui, "fileplayback", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + + p->addIntroItems(moviePlayer); + + //moviebrowser + p->addItem(moviePlayer, fw_mbrowser, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_MBROWSER]); + + //fileplayback + p->addItem(moviePlayer, fw_file, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY]); // #if 0 // //moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_PESPLAYBACK, true, NULL, moviePlayerGui, "pesplayback")); diff --git a/src/gui/mediaplayer.h b/src/gui/mediaplayer.h index 50d1694c6..d2cfe042e 100644 --- a/src/gui/mediaplayer.h +++ b/src/gui/mediaplayer.h @@ -31,20 +31,20 @@ #include #include "gui/audioplayer.h" +#include "gui/personalize.h" #include class CMediaPlayerMenu : public CMenuTarget { private: + int width, usage_mode; + neutrino_locale_t menu_title; + CAudioPlayerGui *audioPlayer; CAudioPlayerGui *inetPlayer; - int width, usage_mode; - neutrino_locale_t menu_title; - - int showMenu(); - void showMoviePlayer(CMenuWidget *menu_movieplayer); + void showMoviePlayer(CMenuWidget *menu_movieplayer, CPersonalizeGui *p); public: enum MM_MENU_MODES @@ -58,6 +58,8 @@ class CMediaPlayerMenu : public CMenuTarget ~CMediaPlayerMenu(); static CMediaPlayerMenu* getInstance(); + int initMenuMedia(CMenuWidget *m = NULL, CPersonalizeGui *p = NULL); + int exec(CMenuTarget* parent, const std::string & actionKey); void setMenuTitel(const neutrino_locale_t title = LOCALE_MAINMENU_MEDIA){menu_title = title;}; void setUsageMode(const int& mm_mode = MODE_DEFAULT){usage_mode = mm_mode;}; diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp new file mode 100644 index 000000000..83fa1843c --- /dev/null +++ b/src/gui/personalize.cpp @@ -0,0 +1,788 @@ +/* + $Id: personalize.cpp,1.43 2011/04/26 19:45:31 tuxbox-cvs Exp $ + + Customization Menu - Neutrino-GUI + + Copyright (C) 2007 Speed2206 + and some other guys + + Reworked by dbt (Thilo Graf) + Copyright (C) 2010, 2011 dbt + + Comment: + + This is the customization menu, as originally showcased in + Oxygen. It is a more advanced version of the 'user levels' + patch currently available. + + The reworked version >1.24 works more dynamicly with input objects + and their parameters and it's more code reduced. It's also independent + from #ifdefs of items. + The personalize-object collects all incomming forwarder item objects. + These will be handled here and will be shown after evaluation. + + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, 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! + + + Parameters: + addItem(CMenuWidget *widget, CMenuItem *menuItem, const int *personalize_mode, const bool defaultselected, const bool item_mode), + addItem(const int& widget_id, CMenuItem *menuItem, const int *personalize_mode, const bool defaultselected, const bool item_mode), + + CMenuWidget *widget = pointer to menue widget object, also to get with 'getWidget(const int& id)' + const int& widget_id = index of widget (overloaded), this index is definied in vector 'v_widget', to get with 'getWidgetId()' + CMenuItem *menuItem = pointer to a menuitem object, can be forwarders, locked forwarders and separators...NO CHOOSERS! + const int *personalize_mode = optional, default NULL, pointer to a specified personalize setting look at: PERSONALIZE_MODE, this regulates the personalize mode + const bool item_mode = optional, default true, if you don't want to see this item in personalize menue, then set it to false + + Icon handling: + If you define an icon in the item object, this will be shown in the personalized menu but not the personilazitions menue itself, otherwise a shortcut will be create + + Shortcuts (optional): default is set to '1': + A default start-shortcut you can create with personalize.setShortcut(), + this sets default value '1', e.g.personalize.setShortcut(0) sets value '0' + Only values 0-9 are possible, others will be ignored! + + Separators: + Add separators with + addSeparator(CMenuWidget &widget, const neutrino_locale_t locale_text, const bool item_mode) + OR + addSeparator(const int& widget_id, const neutrino_locale_t locale_text, const bool item_mode) + + Parameters: + CMenuWidget &widget = rev to menue widget object + const int& widget_id = index of widget (overloaded), this index is definied in vector 'v_widget', to get with 'getWidgetId(widget_object)' + + const neutrino_locale_t locale_text = optional, default NONEXISTANT_LOCALE, adds a line separator, is defined a locale then adds a text separator + const bool item_mode = optional, default true, if you don't want to see this sparator also in personalize menue, then set it to false, usefull for to much separtors ;-) + + Usage: + It's possible to personalize only forwarders, locked forwarders and separators! + + Example: + //we need an instance of CPersonalizeGUI() + CPersonalizeGui personalize; + + //do you need a start shortcut !=1 then set a start number for shortcuts with + personalize.setShortcut(0...9); + + //create a menue widget object, this will be automaticly shown as menu item in your peronalize menu + CMenuWidget * mn = new CMenuWidget(LOCALE_MAINMENU_HEAD, ICON ,width); + OR + create a widget struct: + const mn_widget_struct_t menu_widgets[count of available widgets] = + { + {LOCALE_1, NEUTRINO_ICON_1, width1}, + {LOCALE_2, NEUTRINO_ICON_2, width2}, + {LOCALE_3, NEUTRINO_ICON_3, width3}, + }; + + //add it to widget collection as single + personalize.addWidget(mn); + OR as struct + personalize.addWidgets(widget_struct, count of available widgets); + + //create a forwarder object: + CMenuItem *item = new CMenuForwarder(LOCALE_MAINMENU_TVMODE, true, NULL, this, "tv", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + + //now you can add this to personalization + personalize.addItem(&mn, tvswitch, &g_settings.personalize_tvmode); + OR with widget id + personalize.addItem(0, tvswitch, &g_settings.personalize_tvmode); + + //if you want to add a non personalized separator use this function, you must use this anstead addItem(GenericMenuSeparatorLine) + personalize.addSeparator(mn); + OR with widget id + personalize.addSeparator(0); + //otherwise you can add a separator at this kind: + personalize.addItem(&mn, GenericMenuSeparatorLine); + OR with widget id + personalize.addItem(0, GenericMenuSeparatorLine); + + //finally add the menue items + personalize.addPersonalizedItems(); + //this member makes the same like mn->addItem(...) known from CMenuWidget()-class for all collected and evaluated objects + + //reset shortcuts: + personalize.setShortcut(); + + Enums: + PERSONALIZE_MODE: use as parameter 'personalize_mode' + PERSONALIZE_MODE_NOTVISIBLE : not visible in your personalized menue + PERSONALIZE_MODE_VISIBLE : visible in your personalized menue + PERSONALIZE_MODE_PIN : visible in your personalized menue with PIN access + + PERSONALIZE_PROTECT_MODE: used also as parameter 'personalize_mode' + PERSONALIZE_MODE_NOT_PROTECTED : visible in personalize settings menue with PIN setup, option 'no' + PERSONALIZE_MODE_PIN_PROTECTED : visible in personalize settings menue with PIN setup, option 'yes' + + PERSONALIZE_ITEM_MODE: use as as parameter 'item_mode items in personalize settings menu + PERSONALIZE_SHOW_NO : dont'show this item in personalize settings menu + PERSONALIZE_SHOW_AS_ITEM_OPTION : show as item with options 'visible, not visible or PIN' + PERSONALIZE_SHOW_AS_ACCESS_OPTION: show as item with options 'PIN' with 'yes' or 'no' + PERSONALIZE_SHOW_ONLY_IN_PERSONALIZE_MENU :usefull to hide separators in menu, but visible only in personalizing menu + + +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "widget/messagebox.h" +#include "widget/hintbox.h" +#include "widget/lcdcontroler.h" +#include "widget/keychooser.h" +#include "color.h" +#include "personalize.h" + +#include + +using namespace std; + +const CMenuOptionChooser::keyval PERSONALIZE_MODE_OPTIONS[CPersonalizeGui::PERSONALIZE_MODE_MAX] = +{ + { CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE , LOCALE_PERSONALIZE_NOTVISIBLE },// The option is NOT visible on the menu's + { CPersonalizeGui::PERSONALIZE_MODE_VISIBLE , LOCALE_PERSONALIZE_VISIBLE },// The option is visible on the menu's + { CPersonalizeGui::PERSONALIZE_MODE_PIN , LOCALE_PERSONALIZE_PIN },// PIN Protect the item on the menu +}; + +const CMenuOptionChooser::keyval PERSONALIZE_ACTIVE_MODE_OPTIONS[CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_MAX] = +{ + { CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_DISABLED , LOCALE_PERSONALIZE_DISABLED },// The option is NOT enabled / accessible + { CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED , LOCALE_PERSONALIZE_ENABLED },// The option is enabled / accessible +}; + +const CMenuOptionChooser::keyval PERSONALIZE_PROTECT_MODE_OPTIONS[CPersonalizeGui::PERSONALIZE_PROTECT_MODE_MAX] = +{ + { CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED , LOCALE_PERSONALIZE_NOTPROTECTED },// The menu/option is NOT protected + { CPersonalizeGui::PERSONALIZE_PROTECT_MODE_PIN_PROTECTED , LOCALE_PERSONALIZE_PINPROTECT },// The menu/option is protected by a PIN +}; + + + +CPersonalizeGui::CPersonalizeGui() +{ + width = 0; + widget_count = 0; + shortcut = 1; + show_usermenu = false; + show_pin_setup = false; + pers_notifier = NULL; + fkeyMenu = NULL; + plMenu = NULL; +} + +CPersonalizeGui::~CPersonalizeGui() +{ + v_widget.clear(); +} + +int CPersonalizeGui::exec(CMenuTarget* parent, const string & actionKey) +{ + int res = menu_return::RETURN_REPAINT; + + if (parent) + parent->hide(); + + for (int i = 0; i<(widget_count); i++) + { + ostringstream i_str; + i_str << i; + string s(i_str.str()); + string a_key = s; + + if(actionKey == a_key) + { // Personalize options menu + ShowMenuOptions(i); + return res; + } + } + + if (actionKey=="personalize_help") { // Personalize help + ShowHelpPersonalize(); + return res; + } + + if (actionKey=="restore") { + ShowPersonalizationMenu (); + return menu_return::RETURN_EXIT_ALL; + } + + ShowPersonalizationMenu(); // Show main Personalization Menu + SaveAndExit(); + return res; +} + +const CMenuOptionChooser::keyval OPTIONS_FEAT_KEY_OPTIONS[CPersonalizeGui::PERSONALIZE_FEAT_KEY_MAX] = +{ + { CPersonalizeGui::PERSONALIZE_FEAT_KEY_RED , LOCALE_PERSONALIZE_BUTTON_RED }, + { CPersonalizeGui::PERSONALIZE_FEAT_KEY_GREEN , LOCALE_PERSONALIZE_BUTTON_GREEN }, + { CPersonalizeGui::PERSONALIZE_FEAT_KEY_YELLOW , LOCALE_PERSONALIZE_BUTTON_YELLOW }, + { CPersonalizeGui::PERSONALIZE_FEAT_KEY_BLUE , LOCALE_PERSONALIZE_BUTTON_BLUE }, + { CPersonalizeGui::PERSONALIZE_FEAT_KEY_AUTO , LOCALE_PERSONALIZE_BUTTON_AUTO } +}; +//This is the main personalization menu. From here we can go to the other sub-menu's and enable/disable +//the PIN code feature, as well as determine whether or not the EPG menu/Features menu is accessible. +void CPersonalizeGui::ShowPersonalizationMenu() +{ + width = w_max (40, 10); + + CMenuWidget* pMenu = new CMenuWidget(LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width, MN_WIDGET_ID_PERSONALIZE); + pMenu->addIntroItems(NONEXISTANT_LOCALE, LOCALE_PERSONALIZE_ACCESS); + + //pin + CPINChangeWidget *pinChangeWidget = NULL; + if (show_pin_setup) + ShowPinSetup(pMenu, pinChangeWidget); + + //personalized menues + CMenuForwarderNonLocalized *p_mn[widget_count]; + for (int i = 0; i<(widget_count); i++) + { + ostringstream i_str; + i_str << i; + string s(i_str.str()); + string action_key = s; + string mn_name = v_widget[i]->getName(); + p_mn[i] = new CMenuForwarderNonLocalized(mn_name.c_str(), true, NULL, this, action_key.c_str(), CRCInput::convertDigitToKey(i+1)); + pMenu->addItem(p_mn[i]); + } + + + //usermenu + CMenuWidget* uMenu = NULL; + vector v_userMenuSetup; + if (show_usermenu) + { + pMenu->addItem(GenericMenuSeparatorLine); + uMenu = new CMenuWidget(LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width, MN_WIDGET_ID_PERSONALIZE_USERMENU); + pMenu->addItem(new CMenuForwarder(LOCALE_USERMENU_HEAD, true, NULL, uMenu, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); + + ShowUserMenu(uMenu, v_userMenuSetup); + } + + + //help + pMenu->addItem(GenericMenuSeparatorLine); + pMenu->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_HELP, true, NULL, this, "personalize_help", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP)); + + pMenu->exec(NULL, ""); + pMenu->hide(); + delete pMenu; + delete uMenu; + delete pinChangeWidget; + delete fkeyMenu; + delete plMenu; + v_userMenuSetup.clear(); + delete pers_notifier; +} + +//init pin setup dialog +void CPersonalizeGui::ShowPinSetup(CMenuWidget* p_widget, CPINChangeWidget *pin_widget) +{ + pin_widget = new CPINChangeWidget(LOCALE_PERSONALIZE_PINCODE, g_settings.personalize_pincode, 4, LOCALE_PERSONALIZE_PINHINT); + p_widget->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_PINCODE, true, g_settings.personalize_pincode, pin_widget, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); + p_widget->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_PERSONALIZE_MENUCONFIGURATION)); +} + + + +//init preverred key setup +void CPersonalizeGui::ShowPreverredKeySetup(CMenuWidget* p_widget) +{ + p_widget->addIntroItems(LOCALE_PERSONALIZE_USERMENU_PREFERRED_BUTTONS); + + p_widget->addItem(new CMenuOptionChooser(LOCALE_FAVORITES_MENUEADD, &g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_FAVORIT], OPTIONS_FEAT_KEY_OPTIONS, CPersonalizeGui::PERSONALIZE_FEAT_KEY_MAX, true)); + p_widget->addItem(new CMenuOptionChooser(LOCALE_TIMERLIST_NAME, &g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_TIMERLIST], OPTIONS_FEAT_KEY_OPTIONS, CPersonalizeGui::PERSONALIZE_FEAT_KEY_MAX, true)); + p_widget->addItem(new CMenuOptionChooser(LOCALE_USERMENU_ITEM_VTXT, &g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT], OPTIONS_FEAT_KEY_OPTIONS, CPersonalizeGui::PERSONALIZE_FEAT_KEY_MAX, true)); + p_widget->addItem(new CMenuOptionChooser(LOCALE_RCLOCK_MENUEADD, &g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK], OPTIONS_FEAT_KEY_OPTIONS, CPersonalizeGui::PERSONALIZE_FEAT_KEY_MAX, true)); + +// //plugins +// plMenu = new CMenuWidget(LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width); +// CMenuForwarder *fw_plugins = new CMenuForwarder(LOCALE_PERSONALIZE_PLUGINS, true, NULL, plMenu, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); +// p_widget->addItem(GenericMenuSeparatorLine); +// p_widget->addItem(fw_plugins); +// ShowPluginMenu(plMenu); +} + + +//init usermenu items +void CPersonalizeGui::ShowUserMenu(CMenuWidget* p_widget, vector v_umenu) +{ + p_widget->addIntroItems(LOCALE_USERMENU_HEAD); + + //define usermenu items + vector v_umenu_fw; + for (uint i = 0; igetText(usermenu[i].def_name) : g_settings.usermenu_text[i].c_str(); + + v_umenu_fw.push_back(new CMenuForwarder(usermenu[i].menue_title, true, g_settings.usermenu_text[i], v_umenu[i], NULL, usermenu[i].DirectKey, usermenu[i].IconName)); + } + + //feature keys + fkeyMenu = new CMenuWidget(LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width, MN_WIDGET_ID_PERSONALIZE_FEATUREKEYS); + CMenuForwarder *fw_fkeys = new CMenuForwarder(LOCALE_PERSONALIZE_USERMENU_PREFERRED_BUTTONS, true, NULL, fkeyMenu, NULL, CRCInput::RC_1); + + //enable/disable epg/features + pers_notifier = new CPersonalizeNotifier(v_umenu_fw[0], v_umenu_fw[3]); + //red + p_widget->addItem(new CMenuOptionChooser(usermenu[0].menue_title, &g_settings.personalize[SNeutrinoSettings::P_MAIN_RED_BUTTON], PERSONALIZE_ACTIVE_MODE_OPTIONS, PERSONALIZE_ACTIVE_MODE_MAX, true, pers_notifier));/*LOCALE_INFOVIEWER_EVENTLIST*/ + //blue + p_widget->addItem(new CMenuOptionChooser(usermenu[3].menue_title, &g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON], PERSONALIZE_ACTIVE_MODE_OPTIONS, PERSONALIZE_ACTIVE_MODE_MAX, true, pers_notifier));/*LOCALE_INFOVIEWER_STREAMINFO*/ + + //add usermenu items + p_widget->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_RIGHT | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_NAME)); + pers_notifier->changeNotify(); + for (uint j = 0; jaddItem(v_umenu_fw[j]); + + p_widget->addItem(GenericMenuSeparator); + + //preverred keys + p_widget->addItem(GenericMenuSeparatorLine); + p_widget->addItem(fw_fkeys); + ShowPreverredKeySetup(fkeyMenu); + + p_widget->addItem(GenericMenuSeparatorLine); + p_widget->addItem(new CMenuOptionChooser(LOCALE_PERSONALIZE_USERMENU_SHOW_CANCEL, &g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +} + + +//init plugin settings +void CPersonalizeGui::ShowPluginMenu(CMenuWidget* p_widget) +{ + p_widget->addIntroItems(LOCALE_PERSONALIZE_PLUGINS); + + uint d_key = 1; + for (int i = 0; igetNumberOfPlugins(); i++) + { + if( g_PluginList->getType(i)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(i)) //don't show hidden plugins an games + { + p_widget->addItem(new CMenuForwarderNonLocalized(g_PluginList->getName(i), true, g_PluginList->getDescription(i), NULL, NULL, getShortcut(d_key))); + d_key++; + } + } +} + +//Here we give the user the option to enable, disable, or PIN protect items on the Main Menu. +//We also provide a means of PIN protecting the menu itself. +void CPersonalizeGui::ShowMenuOptions(const int& widget) +{ + string mn_name = v_widget[widget]->getName(); + printf("[neutrino-personalize] exec %s...\n", __FUNCTION__); + + mn_widget_id_t w_index = widget+MN_WIDGET_ID_PERSONALIZE_MAIN; + CMenuWidget* pm = new CMenuWidget(LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width, w_index); + + //subhead + CMenuSeparator * pm_subhead = new CMenuSeparator(CMenuSeparator::ALIGN_LEFT | CMenuSeparator::SUB_HEAD | CMenuSeparator::STRING); + string s_sh = g_Locale->getText(LOCALE_PERSONALIZE_ACCESS); + s_sh += ": " + mn_name; + pm_subhead->setString(s_sh); + + pm->addItem(pm_subhead); + pm->addIntroItems(); + + //add all needed items + for (uint i = 0; igetName()) + { + int i_mode = v_item[i].item_mode; + + if (i_mode != PERSONALIZE_SHOW_NO) + { + if (i_mode == PERSONALIZE_SHOW_AS_ITEM_OPTION) + { + if (v_item[i].personalize_mode != NULL) //option chooser + pm->addItem(new CMenuOptionChooser(v_item[i].locale_name, v_item[i].personalize_mode, PERSONALIZE_MODE_OPTIONS, PERSONALIZE_MODE_MAX, v_item[i].menuItem->active)); + else + pm->addItem(v_item[i].menuItem); //separator + } + + //pin protected items only + if (i_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION) + { + string itm_name = g_Locale->getText(v_item[i].locale_name); + itm_name += " "; + itm_name += g_Locale->getText(LOCALE_PERSONALIZE_PINSTATUS); + + if (v_item[i].personalize_mode != NULL) + pm->addItem(new CMenuOptionChooser(itm_name.c_str(), v_item[i].personalize_mode, PERSONALIZE_PROTECT_MODE_OPTIONS, PERSONALIZE_PROTECT_MODE_MAX, v_item[i].menuItem->active)); + } + + //only show in personalize menu, usefull to hide separators in menu, but visible only in personalizing menu + if (i_mode == PERSONALIZE_SHOW_ONLY_IN_PERSONALIZE_MENU) + pm->addItem(v_item[i].menuItem); + } + } + } + + pm->exec (NULL, ""); + pm->hide (); + delete pm; + +} + +//shows a short help message +void CPersonalizeGui::ShowHelpPersonalize() +{ + Helpbox helpbox; + + for (int i = (int)LOCALE_PERSONALIZE_HELP_LINE1; i<= (int)LOCALE_PERSONALIZE_HELP_LINE8; i++) + helpbox.addLine(g_Locale->getText((neutrino_locale_t)i)); + + + helpbox.show(LOCALE_PERSONALIZE_HELP); +} + +void CPersonalizeGui::SaveAndExit() +{ + // Save the settings and left menu, if user wants to! + if (haveChangedSettings()) + { + if (ShowMsgUTF(LOCALE_PERSONALIZE_HEAD, g_Locale->getText(LOCALE_PERSONALIZE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_QUESTION) == CMessageBox::mbrYes) + { + CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_MAINSETTINGS_SAVESETTINGSNOW_HINT)); // UTF-8 + hintBox.paint(); + // replace old settings with new settings + for (uint i = 0; i < v_int_settings.size(); i++) + v_int_settings[i].old_val = *v_int_settings[i].p_val; + //CNeutrinoApp::getInstance()->saveSetup(); + + for (int i = 0; i<(widget_count); i++) + v_widget[i]->resetWidget(); + + addPersonalizedItems(); + hintBox.hide(); + } + else + { + if (ShowMsgUTF(LOCALE_PERSONALIZE_HEAD, g_Locale->getText(LOCALE_MESSAGEBOX_DISCARD), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_QUESTION) == CMessageBox::mbrYes) + exec(NULL, "restore"); + } + } +} + + + +//adds a menu widget to v_widget and sets the count of available widgets +void CPersonalizeGui::addWidget(CMenuWidget *widget) +{ + v_widget.push_back(widget); + widget_count = v_widget.size(); +} + +//adds a group of menu widgets to v_widget and sets the count of available widgets +void CPersonalizeGui::addWidgets(const struct mn_widget_t * const widget, const int& widgetCount) +{ + for (int i = 0; i<(widgetCount); i++) + addWidget(new CMenuWidget(widget[i].locale_text, widget[i].icon, widget[i].width)); +} + +//returns a menu widget from v_widget +CMenuWidget& CPersonalizeGui::getWidget(const int& id) +{ + return *v_widget[id]; +} + +//returns index of menu widget from 'v_widget' +int CPersonalizeGui::getWidgetId(CMenuWidget *widget) +{ + for (int i = 0; i (menu_Item); + + menu_item_t item = {widget, menu_Item, defaultselected, fw->getTextLocale(), (int*)personalize_mode, item_mode}; + + if (item_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION) + { + v_item.push_back(item); + handleSetting((int*)personalize_mode); + } + else if (personalize_mode != NULL) + { + v_item.push_back(item); + if (item_mode != PERSONALIZE_SHOW_NO) //handle only relevant items + handleSetting((int*)personalize_mode); + } + else if (personalize_mode == NULL) + v_item.push_back(item); +} + +//overloaded version from 'addSeparator', first parameter is an id from widget collection 'v_widget', +void CPersonalizeGui::addSeparator(const int& widget_id, const neutrino_locale_t locale_text, const int& item_mode) +{ + addSeparator(*v_widget[widget_id], locale_text, item_mode); +} + +//adds a menu separator to menue, based upon GenericMenuSeparatorLine or CMenuSeparator objects with locale +//expands with parameter within you can show or hide this item in personalize options +void CPersonalizeGui::addSeparator(CMenuWidget &widget, const neutrino_locale_t locale_text, const int& item_mode) +{ + menu_item_t to_add_sep[2] = { {&widget, GenericMenuSeparatorLine, false, locale_text, NULL, item_mode}, + {&widget, new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, locale_text), false, locale_text, NULL, item_mode}}; + + if (locale_text == NONEXISTANT_LOCALE) + v_item.push_back(to_add_sep[0]); + else + v_item.push_back(to_add_sep[1]); +} + +//returns available count of personalized item for definied widget +int CPersonalizeGui::getItemsCount(CMenuWidget *widget) +{ + int ret = 0; + + for (uint i = 0; i < v_item.size(); i++) + if (v_item[i].widget == widget) + ret++; + + return ret; +} + +int CPersonalizeGui::getItemsCount(const int& widget_id) +{ + return getItemsCount(v_widget[widget_id]); +} + +//paint all available personalized menu items and separators to menu +//this replaces all collected actual and handled "widget->addItem()" tasks at once +void CPersonalizeGui::addPersonalizedItems() +{ + bool allow_sep = true; + int old_w_id = 0; + int widget_id = 0; + int short_cut = shortcut; + int old_p_mode = PERSONALIZE_MODE_NOTVISIBLE; + + //get current mode of personlize itself + int in_pinmode = hasPinItems() ? PERSONALIZE_PROTECT_MODE_PIN_PROTECTED : PERSONALIZE_PROTECT_MODE_NOT_PROTECTED; + + for (uint i = 0; i < v_item.size(); i++) + { + int i_mode = v_item[i].item_mode; + + if (i_mode != PERSONALIZE_SHOW_ONLY_IN_PERSONALIZE_MENU) //skip if item only used in personalize settings + { + widget_id = getWidgetId(v_item[i].widget); + + if (old_w_id != widget_id) + { + //reset shortcut if widget has changed + short_cut = shortcut; + + //normalize previous widget: remove last item, if it is a separator line + uint items_count = v_item[old_w_id].widget->getItemsCount(); + if (v_item[old_w_id].widget->getItem(items_count-1) == GenericMenuSeparatorLine) + v_item[old_w_id].widget->removeItem(items_count-1); + + allow_sep = true; + } + + if (v_item[i].personalize_mode != NULL) //handle personalized item and non separator + { + CMenuForwarder *fw = static_cast (v_item[i].menuItem); + + bool use_pin = false; + int p_mode = *v_item[i].personalize_mode; + neutrino_msg_t d_key = fw->directKey; + bool add_shortcut = false; + + //get shortcut + if (fw->iconName.empty() && fw->active ) //if no icon is defined and item is active, allow to generate a shortcut, + { + add_shortcut = true; + d_key = getShortcut(short_cut); + } + + //set pin mode if required + const char* lock_icon = NULL; + if (p_mode == PERSONALIZE_MODE_PIN || (p_mode == PERSONALIZE_PROTECT_MODE_PIN_PROTECTED && i_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)) + use_pin = true; + + //set pinmode for personalize menu or for settings manager menu and if any item is pin protected + if (in_pinmode && !use_pin) + if (v_item[i].personalize_mode == &g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS] || v_item[i].personalize_mode == &g_settings.personalize[SNeutrinoSettings::P_MSET_SETTINGS_MANAGER]) + { + use_pin = true; + lock_icon = NEUTRINO_ICON_LOCK_PASSIVE; + } + + //convert item to locked forwarder and use generated pin mode for usage as ask parameter + v_item[i].menuItem = new CLockedMenuForwarder(fw->getTextLocale(), g_settings.personalize_pincode, use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey().c_str(), d_key, fw->iconName.c_str(), lock_icon); + + //add item if it's set to visible or pin protected and allow to add an forwarder as next + if (v_item[i].menuItem->active && (p_mode != PERSONALIZE_MODE_NOTVISIBLE || i_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)) + { + //add item + v_item[i].widget->addItem(v_item[i].menuItem, v_item[i].default_selected); //forwarders... + allow_sep = true; + + //generate shortcut for next item + if (add_shortcut) + short_cut++; + } + else if (p_mode == PERSONALIZE_MODE_NOTVISIBLE) + { + //allow separator as next if personalize mode was changed + if (p_mode != old_p_mode) + { + old_p_mode = p_mode; + allow_sep = true; + } + } + + delete fw; + } + else //handle and add separator as non personalized item and don't allow to add a separator as next but allow back button as next + { + if (allow_sep || v_item[i].menuItem == GenericMenuBack) + { + v_item[i].widget->addItem(v_item[i].menuItem, v_item[i].default_selected); //separators + allow_sep = v_item[i].menuItem == GenericMenuBack ? true : false; + } + } + } + old_w_id = widget_id; + } +} + + +// returns RC_key depends of shortcut between key number 1 to 0, 10 returns 0, >10 returns no key +// parameter alternate_rc_key allows using an alternate key, default key is RC_nokey +neutrino_msg_t CPersonalizeGui::getShortcut(const int & shortcut_num, neutrino_msg_t alternate_rc_key) +{ + if (shortcut_num < 10) + return CRCInput::convertDigitToKey(shortcut_num); + else if (shortcut_num == 10) + return CRCInput::RC_0; + else + return alternate_rc_key; +} + +//handle/collects old int settings +void CPersonalizeGui::handleSetting(int *setting) +{ + settings_int_t val = {*setting, setting}; + v_int_settings.push_back(val); +} + +//check for setup changes +bool CPersonalizeGui::haveChangedSettings() +{ + //compare old settings with current settings + for (uint i = 0; i < v_int_settings.size(); i++) + if (v_int_settings[i].old_val != *v_int_settings[i].p_val) + return true; + + return false; +} + +//checks for pin protected item +bool CPersonalizeGui::hasPinItems() +{ + for (uint i = 0; i < v_int_settings.size(); i++) + if (*v_int_settings[i].p_val == PERSONALIZE_MODE_PIN || *v_int_settings[i].p_val == PERSONALIZE_PROTECT_MODE_PIN_PROTECTED) + { + printf("[neutrino personalize] %s found pin protected item...[item %d]\n", __FUNCTION__, i); + return true; + } + + return false; +} + +//restore old settings +void CPersonalizeGui::restoreSettings() +{ + //restore settings with current settings + for (uint i = 0; i < v_int_settings.size(); i++) + *v_int_settings[i].p_val = v_int_settings[i].old_val; + + exec(NULL, "restore"); +} + + +//helper class to enable/disable some items in usermenu setup +CPersonalizeNotifier::CPersonalizeNotifier( CMenuItem* i1, CMenuItem* i2) +{ + toDisable[0]=i1; + toDisable[1]=i2; +} + +bool CPersonalizeNotifier::changeNotify(const neutrino_locale_t, void *) +{ + toDisable[0]->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_RED_BUTTON]); + toDisable[1]->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON]); + + return true; +} + diff --git a/src/gui/personalize.h b/src/gui/personalize.h new file mode 100644 index 000000000..a49a65d81 --- /dev/null +++ b/src/gui/personalize.h @@ -0,0 +1,241 @@ +/* + $Id: personalize.h,v 1.19 2011/04/25 19:32:46 tuxbox-cvs Exp $ + + Customization Menu - Neutrino-GUI + + Copyright (C) 2007 Speed2206 + and some other guys + + Reworked by dbt (Thilo Graf) + Copyright (C) 2010, 2011 dbt + + Comment: + + This is the customization menu, as originally showcased in + Oxygen. It is a more advanced version of the 'user levels' + patch currently available. + + The reworked version >1.24 works more dynamicly with input objects + and their parameters and it's more code reduced. It's also independent + from #ifdefs of items. + The personalize-object collects all incomming forwarder item objects. + These will be handled here and will be shown after evaluation. + + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, 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 __personalize__ +#define __personalize__ + +#include +#include "gui/plugins.h" +#include "gui/user_menue_setup.h" +#include "widget/stringinput.h" +#include "widget/stringinput_ext.h" +#include +#include +#include +#include +#include + +extern CPlugins * g_PluginList; /* neutrino.cpp */ + +//helper class to enable/disable some items in usermenu setup +class CPersonalizeNotifier : public CChangeObserver +{ + private: + CMenuItem* toDisable[2]; + public: + CPersonalizeNotifier( CMenuItem*, CMenuItem*); + bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL); +}; + + +//some required typedefs +typedef struct mn_widget_t +{ + const neutrino_locale_t locale_text; + const std::string icon; + const int width; +} mn_widget_struct_t; + +typedef struct settings_int_t +{ + int old_val; + int *p_val; +}settings_int_struct_t; + +typedef struct menu_item_t +{ + CMenuWidget *widget; + CMenuItem* menuItem; + bool default_selected; + neutrino_locale_t locale_name; + int* personalize_mode; + int item_mode; +}menu_item_struct_t; + +typedef struct raw_item_t +{ + CMenuItem* menuItem; + bool default_selected; + int* personalize_mode; + int item_mode; +}raw_item_struct_t; + +typedef struct personalize_settings_t +{ + const char* personalize_settings_name; + int personalize_default_val; +} personalize_settings_struct_t; + + +class CPersonalizeGui : public CMenuTarget +{ + private: + CPersonalizeNotifier *pers_notifier; + CMenuWidget* fkeyMenu; + CMenuWidget* plMenu; + + int width, widget_count, shortcut; + bool show_usermenu, show_pin_setup; + + //stuff for settings handlers + void handleSetting(int *setting); + void restoreSettings(); + bool haveChangedSettings(); + + std::vector v_int_settings; + + std::vector v_item; + std::vector v_widget; + + void ShowPersonalizationMenu(); + void ShowMenuOptions(const int& menu); + void ShowHelpPersonalize(); + void ShowPinSetup(CMenuWidget* p_widget, CPINChangeWidget *pin_widget); + void ShowUserMenu(CMenuWidget* p_widget, std::vector v_umenu); + void ShowPluginMenu(CMenuWidget* p_widget); + void ShowPreverredKeySetup(CMenuWidget* p_widget); + void SaveAndExit(); + + bool hasPinItems(); + + neutrino_msg_t getShortcut(const int & shortcut_num, neutrino_msg_t alternate_rc_key = CRCInput::RC_nokey); + + public: + //general options for personalized items + enum PERSONALIZE_MODE + { + PERSONALIZE_MODE_NOTVISIBLE = 0, + PERSONALIZE_MODE_VISIBLE = 1, + PERSONALIZE_MODE_PIN = 2, + + PERSONALIZE_MODE_MAX + }; + + //options for personalized items with pin protection + enum PERSONALIZE_PROTECT_MODE + { + PERSONALIZE_PROTECT_MODE_NOT_PROTECTED = 0, + PERSONALIZE_PROTECT_MODE_PIN_PROTECTED = 2, + + PERSONALIZE_PROTECT_MODE_MAX + }; + + //options for show_epg_feat options + enum PERSONALIZE_ACTIVE_MODE + { + PERSONALIZE_ACTIVE_MODE_DISABLED = 0, + PERSONALIZE_ACTIVE_MODE_ENABLED = 1, + + PERSONALIZE_ACTIVE_MODE_MAX + }; + + //internal display modes for items in personalize settings menue + enum PERSONALIZE_ITEM_MODE + { + PERSONALIZE_SHOW_NO = 0, + PERSONALIZE_SHOW_AS_ITEM_OPTION = 1, + PERSONALIZE_SHOW_AS_ACCESS_OPTION = 2, + PERSONALIZE_SHOW_ONLY_IN_PERSONALIZE_MENU = 3 //usefull to hide separators in menu, but visible only in personalizing menu + }; + + //options for features key + enum PERSONALIZE_FEAT_KEY + { + PERSONALIZE_FEAT_KEY_RED, + PERSONALIZE_FEAT_KEY_GREEN, + PERSONALIZE_FEAT_KEY_YELLOW, + PERSONALIZE_FEAT_KEY_BLUE, + PERSONALIZE_FEAT_KEY_AUTO, + + PERSONALIZE_FEAT_KEY_MAX + }; + + CPersonalizeGui(); + ~CPersonalizeGui(); + + int exec(CMenuTarget* parent, const std::string & actionKey); + + CMenuWidget& getWidget(const int& id); + + void addWidget(CMenuWidget *widget); + void addWidgets(const struct mn_widget_t * const widget, const int& widget_count); + int getWidgetCount() {return widget_count;}; + int getWidgetId(CMenuWidget *widget); + int getItemsCount(CMenuWidget *widget); + int getItemsCount(const int& widget_id); + void setShortcut(const int& short_cut = 1) {shortcut = short_cut;}; + void addItem(CMenuWidget *widget, CMenuItem *menu_Item, const int *personalize_mode = NULL, const bool defaultselected = false, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION); + void addItem(const int& widget_id, CMenuItem *menu_Item, const int *personalize_mode = NULL, const bool defaultselected = false, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION); + void addIntroItems(CMenuWidget *widget); + void addIntroItems(const int& widget_id); + void addSeparator(CMenuWidget &menu, const neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION); + void addSeparator(const int& widget_id, const neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION); + void addPersonalizedItems(); + void enableUsermenu(bool show = true){show_usermenu = show;}; + void enablePinSetup(bool show = true){show_pin_setup = show;}; +}; + +typedef struct feat_keys_t +{ + neutrino_locale_t locale_name; + neutrino_msg_t key; +}feat_keys_struct_t; + +const struct feat_keys_t feat_key[CPersonalizeGui::PERSONALIZE_FEAT_KEY_MAX] = +{ + {LOCALE_PERSONALIZE_BUTTON_RED , CRCInput::RC_red }, + {LOCALE_PERSONALIZE_BUTTON_GREEN , CRCInput::RC_green }, + {LOCALE_PERSONALIZE_BUTTON_YELLOW , CRCInput::RC_yellow }, + {LOCALE_PERSONALIZE_BUTTON_BLUE , CRCInput::RC_blue }, + {LOCALE_PERSONALIZE_BUTTON_AUTO , CRCInput::RC_nokey } +}; + +#endif + diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 33a46693a..427fef33a 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -207,7 +207,7 @@ bool CPlugins::parseCfg(plugin *plugin_data) { plugin_data->index = atoi(parm.c_str()); } - else if (cmd == "key") + else if (cmd == "pluginversion") { plugin_data->key = atoi(parm.c_str()); } diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index d14fe1ae1..1e59c7b46 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -12,19 +12,23 @@ Homepage: http://www.dbox2-tuning.net/ - License: GPL + 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 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library 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. + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. - 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. @@ -62,7 +66,7 @@ #include extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -extern CPlugins * g_PluginList; +// extern CPlugins * g_PluginList; extern CCAMMenuHandler * g_CamHandler; // #include @@ -97,7 +101,7 @@ bool CUserMenu::showUserMenu(int button) CColorKeyHelper keyhelper; //set default feature key - neutrino_msg_t key = CRCInput::RC_nokey; + neutrino_msg_t key = feat_key[CPersonalizeGui::PERSONALIZE_FEAT_KEY_AUTO].key; //CRCInput::RC_nokey const char * icon = NULL; int dummy; @@ -139,8 +143,11 @@ bool CUserMenu::showUserMenu(int button) menu->setSelected(user_menu[button].selected); - //menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); - menu->addItem(GenericMenuSeparator); + //show cancel button if configured + if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL]) + menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); + else + menu->addItem(GenericMenuSeparator); // go through any postition number for (int pos = 0; pos < SNeutrinoSettings::ITEM_MAX ; pos++) { @@ -162,7 +169,7 @@ bool CUserMenu::showUserMenu(int button) menu_items++; menu_prev = SNeutrinoSettings::ITEM_FAVORITS; tmpFavorites = new CFavorites; - keyhelper.get(&key,&icon,CRCInput::RC_green); + keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_FAVORIT]].key); //CRCInput::RC_green menu_item = new CMenuForwarder(LOCALE_FAVORITES_MENUEADD, true, NULL, tmpFavorites, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -190,7 +197,7 @@ bool CUserMenu::showUserMenu(int button) case SNeutrinoSettings::ITEM_TIMERLIST: menu_items++; menu_prev = SNeutrinoSettings::ITEM_TIMERLIST; - keyhelper.get(&key,&icon,CRCInput::RC_yellow); + keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_TIMERLIST]].key); //CRCInput::RC_yellow Timerlist = new CTimerList(); menu_item = new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, Timerlist, "-1", key, icon); menu->addItem(menu_item, false); @@ -199,7 +206,7 @@ bool CUserMenu::showUserMenu(int button) case SNeutrinoSettings::ITEM_REMOTE: menu_items++; menu_prev = SNeutrinoSettings::ITEM_REMOTE; - keyhelper.get(&key,&icon,CRCInput::RC_nokey); + keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK]].key); //CRCInput::RC_nokey); rcLock = new CRCLock(); menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1" , key, icon ); menu->addItem(menu_item, false); @@ -308,7 +315,7 @@ bool CUserMenu::showUserMenu(int button) case SNeutrinoSettings::ITEM_VTXT: menu_items++; menu_prev = SNeutrinoSettings::ITEM_VTXT; - keyhelper.get(&key,&icon, CRCInput::RC_blue); + keyhelper.get(&key,&icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT]].key); //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); diff --git a/src/gui/user_menue.h b/src/gui/user_menue.h index 5e0feea37..98ddf204e 100644 --- a/src/gui/user_menue.h +++ b/src/gui/user_menue.h @@ -1,6 +1,6 @@ /* user_menue setup implementation - Neutrino-GUI - based up implementation by Günther + based up implementation by Günther Copyright (C) 2001 Steffen Hehn 'McClean' and some other guys @@ -10,19 +10,23 @@ Copyright (C) 2011 T. Graf 'dbt' Homepage: http://www.dbox2-tuning.net/ - License: GPL + 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 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library 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. + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. - 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. diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index 7e6f8e0b0..85fdfd975 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -52,7 +52,7 @@ CUserMenuSetup::CUserMenuSetup(neutrino_locale_t menue_title, int menue_button) { local = menue_title; button = menue_button; - + max_char = 24; width = w_max (40, 10); } @@ -91,8 +91,11 @@ int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &) { if(parent != NULL) parent->hide(); - - return showSetup(); + + int res = showSetup(); + checkItem(); + + return res; } int CUserMenuSetup::showSetup() @@ -104,25 +107,38 @@ int CUserMenuSetup::showSetup() CStringInputSMS name(LOCALE_USERMENU_NAME, &g_settings.usermenu_text[button], 11, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüß/- "/*, notify*/); CMenuForwarder *mf = new CMenuForwarder(LOCALE_USERMENU_NAME, true, g_settings.usermenu_text[button],&name); -// notify->setItem(mf); - + //------------------------------------- ums->addIntroItems(); //------------------------------------- ums->addItem(mf); ums->addItem(GenericMenuSeparatorLine); //------------------------------------- - char text[10]; + char text[max_char]; for(int item = 0; item < SNeutrinoSettings::ITEM_MAX && item <13; item++) // Do not show more than 13 items { - snprintf(text,10,"%d:",item); - text[9]=0;// terminate for sure - ums->addItem( new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true)); + snprintf(text,max_char,"%d.",item+1); + text[max_char-1]=0;// terminate for sure + ums->addItem( new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT,true, NULL, CRCInput::RC_nokey, "", true )); } - + int res = ums->exec(NULL, ""); ums->hide(); delete ums; return res; } +//check item for details like empty string and show an user message +void CUserMenuSetup::checkItem() +{ + bool is_empty = g_settings.usermenu_text[button].empty(); + if (is_empty) + { + std::string msg = g_Locale->getText(LOCALE_USERMENU_MSG_INFO_IS_EMPTY); + msg += g_Locale->getText(usermenu[button].def_name); + DisplayInfoMessage(msg.c_str()); + g_settings.usermenu_text[button] = is_empty ? g_Locale->getText(usermenu[button].def_name) : g_settings.usermenu_text[button].c_str(); + } +} + + diff --git a/src/gui/user_menue_setup.h b/src/gui/user_menue_setup.h index ff61f3dbe..adfc3292d 100644 --- a/src/gui/user_menue_setup.h +++ b/src/gui/user_menue_setup.h @@ -33,18 +33,40 @@ #define __user_menue_setup__ #include +#include #include +typedef struct usermenu_props_t +{ + neutrino_locale_t menue_title; + const int menue_button; + const neutrino_msg_t DirectKey; + const char* IconName; + neutrino_locale_t def_name; + +}usermenu_props_struct_t; + +#define USERMENU_ITEMS_COUNT 4 +const struct usermenu_props_t usermenu[USERMENU_ITEMS_COUNT] = +{ + {LOCALE_USERMENU_BUTTON_RED , SNeutrinoSettings::BUTTON_RED , CRCInput::RC_red ,NEUTRINO_ICON_BUTTON_RED ,LOCALE_INFOVIEWER_EVENTLIST }, + {LOCALE_USERMENU_BUTTON_GREEN , SNeutrinoSettings::BUTTON_GREEN , CRCInput::RC_green ,NEUTRINO_ICON_BUTTON_GREEN ,LOCALE_AUDIOSELECTMENUE_HEAD }, + {LOCALE_USERMENU_BUTTON_YELLOW , SNeutrinoSettings::BUTTON_YELLOW , CRCInput::RC_yellow ,NEUTRINO_ICON_BUTTON_YELLOW ,LOCALE_INFOVIEWER_SUBSERVICE }, + {LOCALE_USERMENU_BUTTON_BLUE , SNeutrinoSettings::BUTTON_BLUE , CRCInput::RC_blue ,NEUTRINO_ICON_BUTTON_BLUE ,LOCALE_INFOVIEWER_STREAMINFO } +}; + + class CUserMenuSetup : public CMenuTarget { private: int width; - + int max_char; int button; neutrino_locale_t local; int showSetup(); + void checkItem(); public: CUserMenuSetup(neutrino_locale_t menue_title, int menue_button); diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index c6e86b6c4..698d54011 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -89,6 +89,7 @@ #define NEUTRINO_ICON_IMPORTANT "important" #define NEUTRINO_ICON_KEYBINDING "keybinding" #define NEUTRINO_ICON_LOCK "lock" +#define NEUTRINO_ICON_LOCK_PASSIVE "lock_passive" #define NEUTRINO_ICON_HIDDEN "hidden" #define NEUTRINO_ICON_MOUNTED "mounted" #define NEUTRINO_ICON_MP3 "mp3" @@ -153,6 +154,7 @@ #define NEUTRINO_ICON_RESOLUTION_000 "res_000" #define NEUTRINO_ICON_RESOLUTION_HD "res_hd" #define NEUTRINO_ICON_RESOLUTION_SD "res_sd" +#define NEUTRINO_ICON_PERSONALIZE "personalize" #define NEUTRINO_ICON_RECORDING_EVENT_MARKER "rec_event_marker" #define NEUTRINO_ICON_ZAP "zap" diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 3f81a1b87..b91181960 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -514,7 +514,7 @@ class CLockedMenuForwarder : public CMenuForwarder, public CPINProtection //if we in ask mode then show NEUTRINO_ICON_SCRAMBLED as default info icon or no icon, //but use always an info icon if defined in parameter 'IconName_Info_right' if (IconName_Info_right || ask) - iconName_Info_right = IconName_Info_right ? IconName_Info_right : NEUTRINO_ICON_SCRAMBLED; + iconName_Info_right = IconName_Info_right ? IconName_Info_right : NEUTRINO_ICON_LOCK; else iconName_Info_right = ""; }; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 56651b26d..b51f9d24c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -189,6 +189,7 @@ bool parentallocked = false; static char **global_argv; extern const char * locale_real_names[]; /* #include */ + // USERMENU const char* usermenu_button_def[SNeutrinoSettings::BUTTON_MAX]={"red","green","yellow","blue"}; @@ -400,7 +401,6 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.volume_pos = configfile.getInt32("volume_pos", 0 ); g_settings.menu_pos = configfile.getInt32("menu_pos", CMenuWidget::MENU_POS_CENTER); g_settings.infobar_show_var_hdd = configfile.getBool("infobar_show_var_hdd" , true ); - g_settings.show_infomenu = configfile.getInt32("show_infomenu", 0 ); g_settings.show_mute_icon = configfile.getInt32("show_mute_icon" ,0); g_settings.infobar_show_res = configfile.getInt32("infobar_show_res", 0 ); g_settings.radiotext_enable = configfile.getBool("radiotext_enable" , false); @@ -495,6 +495,11 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infobar_Text_red = configfile.getInt32( "infobar_Text_red", 0x64 ); g_settings.infobar_Text_green = configfile.getInt32( "infobar_Text_green", 0x64 ); g_settings.infobar_Text_blue = configfile.getInt32( "infobar_Text_blue", 0x64 ); + + //personalize + strcpy( g_settings.personalize_pincode, configfile.getString( "personalize_pincode", "0000" ).c_str() ); + for (int i = 0; i < SNeutrinoSettings::P_SETTINGS_MAX; i++)//settings.h, settings.cpp + g_settings.personalize[i] = configfile.getInt32( personalize_settings[i].personalize_settings_name, personalize_settings[i].personalize_default_val ); g_settings.colored_events_channellist = configfile.getInt32( "colored_events_channellist" , 0 ); g_settings.colored_events_infobar = configfile.getInt32( "colored_events_infobar" , 0 ); @@ -705,10 +710,10 @@ int CNeutrinoApp::loadSetup(const char * fname) { snprintf(txt1,80,"usermenu_tv_%s_text",usermenu_button_def[button]); txt1[80] = 0; // terminate for sure - g_settings.usermenu_text[button] = configfile.getString(txt1, "" ); - + g_settings.usermenu_text[button] = configfile.getString(txt1, ""); + snprintf(txt1,80,"usermenu_tv_%s",usermenu_button_def[button]); - txt2 = configfile.getString(txt1,usermenu_default[button]); + txt2 = configfile.getString(txt1,usermenu_default[button]); txt2ptr = txt2.c_str(); for( int pos = 0; pos < SNeutrinoSettings::ITEM_MAX; pos++) { @@ -830,7 +835,6 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("volume_pos" , g_settings.volume_pos ); configfile.setInt32("menu_pos" , g_settings.menu_pos); configfile.setInt32("infobar_show_var_hdd" , g_settings.infobar_show_var_hdd ); - configfile.setInt32("show_infomenu" , g_settings.show_infomenu ); configfile.setInt32("show_mute_icon" , g_settings.show_mute_icon); configfile.setInt32("infobar_show_res" , g_settings.infobar_show_res ); configfile.setBool("radiotext_enable" , g_settings.radiotext_enable); @@ -921,6 +925,11 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "infobar_Text_red", g_settings.infobar_Text_red ); configfile.setInt32( "infobar_Text_green", g_settings.infobar_Text_green ); configfile.setInt32( "infobar_Text_blue", g_settings.infobar_Text_blue ); + + //personalize + configfile.setString("personalize_pincode", g_settings.personalize_pincode); + for (int i = 0; i < SNeutrinoSettings::P_SETTINGS_MAX; i++) //settings.h, settings.cpp + configfile.setInt32(personalize_settings[i].personalize_settings_name, g_settings.personalize[i]); configfile.setInt32( "colored_events_channellist", g_settings.colored_events_channellist ); configfile.setInt32( "colored_events_infobar", g_settings.colored_events_infobar ); @@ -1745,15 +1754,8 @@ int CNeutrinoApp::run(int argc, char **argv) setupRecordingDevice(); dprintf( DEBUG_NORMAL, "menue setup\n"); - - //Main settings - CMenuWidget mainMenu (LOCALE_MAINMENU_HEAD , NEUTRINO_ICON_MAINMENU/*, 22*/); - CMenuWidget mainSettings (LOCALE_MAINSETTINGS_HEAD , NEUTRINO_ICON_SETTINGS); - CMenuWidget service (LOCALE_SERVICEMENU_HEAD , NEUTRINO_ICON_SETTINGS); - - InitMainMenu(mainMenu, mainSettings, service); - - InitServiceSettings(service); + //init Menues + InitMenu(); /* wait for sectionsd to be able to process our registration */ time_t t = time_monotonic_ms(); @@ -1836,7 +1838,7 @@ int CNeutrinoApp::run(int argc, char **argv) //open video settings in wizardmode g_videoSettings->setWizardMode(CVideoSettings::V_SETUP_MODE_WIZARD); - COsdSetup osdSettings(true); + COsdSetup osdSettings(COsdSetup::OSD_SETUP_MODE_WIZARD); bool ret = g_videoSettings->exec(NULL, ""); g_videoSettings->setWizardMode(CVideoSettings::V_SETUP_MODE_WIZARD_NO); @@ -1891,7 +1893,7 @@ int CNeutrinoApp::run(int argc, char **argv) hintBox->hide(); delete hintBox; - RealRun(mainMenu); + RealRun(personalize.getWidget(0)/**main**/); ExitRun(true, (cs_get_revision() > 7)); @@ -2083,9 +2085,15 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) CRecordManager::getInstance()->exec(NULL, "Stop_record"); } else if( msg == CRCInput::RC_red ) { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_RED); - StartSubtitles(); + // eventlist + if (g_settings.personalize[SNeutrinoSettings::P_MAIN_RED_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// EventList Menu - Personalization Check + { + StopSubtitles(); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_RED); + StartSubtitles(); + } + else + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); } else if( (msg == CRCInput::RC_green) || ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) ) { @@ -2099,9 +2107,14 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) StartSubtitles(); } else if( msg == CRCInput::RC_blue ) { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_BLUE); - StartSubtitles(); + if (g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// Features Menu - Personalization Check + { + StopSubtitles(); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_BLUE); + StartSubtitles(); + } + else + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT), 450, 10); } else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { //open mediaplayer menu in audio mode, user can select between audioplayer and internetradio diff --git a/src/neutrino.h b/src/neutrino.h index 4dee54cb1..76da39e1a 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -45,7 +45,7 @@ #include /* CChannelList */ #include #include /* st_rmsg */ - +#include #include #include @@ -117,6 +117,7 @@ private: CConfigFile configfile; CScanSettings scanSettings; + CPersonalizeGui personalize; CUserMenu usermenu; int network_dhcp; int network_automatic_start; @@ -160,10 +161,13 @@ private: void ExitRun(const bool write_si = true, int retcode = 0); void RealRun(CMenuWidget &mainSettings); void InitZapper(); - void InitServiceSettings(CMenuWidget &); - void InitScreenSettings(CMenuWidget &); - void InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings, CMenuWidget &service); - + + //menues + void InitMenu(); + void InitMenuMain(); + void InitMenuSettings(); + void InitMenuService(); + void SetupFrameBuffer(); void CmdParser(int argc, char **argv); CNeutrinoApp(); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index e5758dd76..c4860686f 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -88,111 +88,260 @@ extern CCAMMenuHandler * g_CamHandler; // extern char current_timezone[50]; // extern bool autoshift; - -/************************************************************************************** -* CNeutrinoApp - init main menu * -**************************************************************************************/ -void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings, CMenuWidget &service) +enum { - unsigned int system_rev = cs_get_revision(); + MENU_MAIN, + MENU_SETTINGS, + MENU_SERVICE, + + MENU_MAX //3 +}; - int shortcut = 1; +#define MENU_WIDTH 40 +const mn_widget_struct_t menu_widgets[MENU_MAX] = +{ + {LOCALE_MAINMENU_HEAD, NEUTRINO_ICON_MAINMENU, MENU_WIDTH}, /** 0 = MENU_MAIN*/ + {LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, MENU_WIDTH}, /** 1 = MENU_SETTINGS*/ + {LOCALE_SERVICEMENU_HEAD, NEUTRINO_ICON_SETTINGS, MENU_WIDTH}, /** 2 = MENU_SERVICE*/ +}; + +//init all menues +void CNeutrinoApp::InitMenu() +{ + printf("[neutrino] init menus...\n"); + + //personalize: neutrino.h, neutrino.cpp + personalize.enableUsermenu(); + personalize.enablePinSetup(); + personalize.addWidgets(menu_widgets, MENU_MAX); + + InitMenuMain(); + InitMenuSettings(); + InitMenuService(); + //add submenu for media + CMediaPlayerMenu::getInstance()->initMenuMedia(new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, MENU_WIDTH), &personalize); + + personalize.addPersonalizedItems(); +} + +//init main menu +void CNeutrinoApp::InitMenuMain() +{ 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)); - - //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)); + unsigned int system_rev = cs_get_revision(); + // Dynamic renumbering + personalize.setShortcut(); + + ///CMenuWidget &menu = personalize.getWidget(MENU_MAIN)/**main**/; + + //top + personalize.addItem(MENU_MAIN, GenericMenuSeparator, NULL, false, CPersonalizeGui::PERSONALIZE_SHOW_NO); + + ///1st section*************************************************************************************************** + + //tv-mode + CMenuItem *tvswitch = new CMenuForwarder(LOCALE_MAINMENU_TVMODE, true, NULL, this, "tv", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + personalize.addItem(MENU_MAIN, tvswitch, &g_settings.personalize[SNeutrinoSettings::P_MAIN_TV_MODE]); + + //radio-mode + CMenuItem *radioswitch = new CMenuForwarder(LOCALE_MAINMENU_RADIOMODE, true, NULL, this, "radio", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + personalize.addItem(MENU_MAIN, radioswitch, &g_settings.personalize[SNeutrinoSettings::P_MAIN_RADIO_MODE]); + + //games + bool show_games = g_PluginList->hasPlugin(CPlugins::P_TYPE_GAME); + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_GAMES, show_games, NULL, new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), &g_settings.personalize[SNeutrinoSettings::P_MAIN_GAMES]); + // //TODO: timer -// mainMenu.addItem(new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, new CTimerList(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); - +// CMenuItem *timerlist = new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, new CTimerList(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); +// personalize.addItem(MENU_MAIN, timerlist, &g_settings.personalize[SNeutrinoSettings::P_MAIN_TIMER]); + //multimedia menu - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_MEDIA, true, NULL, CMediaPlayerMenu::getInstance(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); + CMenuItem *media = new CMenuForwarder(LOCALE_MAINMENU_MEDIA, true, NULL, CMediaPlayerMenu::getInstance(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + personalize.addItem(MENU_MAIN, media, &g_settings.personalize[SNeutrinoSettings::P_MAIN_MEDIA]); + + + //separator + personalize.addSeparator(MENU_MAIN); + + ///2nd section*************************************************************************************************** - if (g_PluginList->hasPlugin(CPlugins::P_TYPE_SCRIPT)) - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SCRIPTS, true, NULL, new CPluginList(LOCALE_MAINMENU_SCRIPTS,CPlugins::P_TYPE_SCRIPT), "", - CRCInput::convertDigitToKey(shortcut++))); - mainMenu.addItem(GenericMenuSeparatorLine); + //scripts + bool show_scripts = g_PluginList->hasPlugin(CPlugins::P_TYPE_SCRIPT); + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_SCRIPTS, show_scripts, NULL, new CPluginList(LOCALE_MAINMENU_SCRIPTS,CPlugins::P_TYPE_SCRIPT)), &g_settings.personalize[SNeutrinoSettings::P_MAIN_SCRIPTS]); + + // settings, also as pin protected option in personalize menu, as a result of parameter value CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, &personalize.getWidget(MENU_SETTINGS)/**settings**/), &g_settings.personalize[SNeutrinoSettings::P_MAIN_SETTINGS], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, &mainSettings, NULL, - CRCInput::convertDigitToKey(shortcut++))); - mainMenu.addItem(new CLockedMenuForwarder(LOCALE_MAINMENU_SERVICE, g_settings.parentallock_pincode, false, true, NULL, &service, NULL, CRCInput::convertDigitToKey(shortcut++))); - mainMenu.addItem(GenericMenuSeparatorLine); + // service, also as pin protected option in personalize menu, as a result of parameter value CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_SERVICE, true, NULL, &personalize.getWidget(MENU_SERVICE)/**service**/), &g_settings.personalize[SNeutrinoSettings::P_MAIN_SERVICE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); + + //separator + personalize.addSeparator(MENU_MAIN); + + ///3rd section*************************************************************************************************** + + //10. -- only 10 shortcuts (1-9, 0), the next could be the last also!(10. => 0) + //sleeptimer + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_SLEEPTIMER, true, NULL, new CSleepTimerWidget), &g_settings.personalize[SNeutrinoSettings::P_MAIN_SLEEPTIMER]); - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SLEEPTIMER, true, NULL, new CSleepTimerWidget, "", - CRCInput::convertDigitToKey(shortcut++))); - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_REBOOT, true, NULL, this, "reboot", - CRCInput::convertDigitToKey(shortcut++))); + //reboot + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_REBOOT, true, NULL, this, "reboot"), &g_settings.personalize[SNeutrinoSettings::P_MAIN_REBOOT]); + //shutdown if(system_rev >= 8) - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SHUTDOWN, true, NULL, this, "shutdown", CRCInput::RC_standby, NEUTRINO_ICON_BUTTON_POWER)); + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MAINMENU_SHUTDOWN, true, NULL, this, "shutdown", CRCInput::RC_standby, NEUTRINO_ICON_BUTTON_POWER), &g_settings.personalize[SNeutrinoSettings::P_MAIN_SHUTDOWN]); - mainMenu.addItem( new CMenuSeparator(CMenuSeparator::LINE) ); - // start of infomenu - if (g_settings.show_infomenu == 0) - mainMenu.addItem(new CMenuForwarder(LOCALE_MESSAGEBOX_INFO, true, NULL, new CInfoMenu(), NULL, CRCInput::RC_info, NEUTRINO_ICON_BUTTON_INFO_SMALL )); + //separator + personalize.addSeparator(MENU_MAIN); - // end of infomenu + ///4th section*************************************************************************************************** + + //infomenu + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_MESSAGEBOX_INFO, true, NULL, new CInfoMenu(), NULL, CRCInput::RC_info, NEUTRINO_ICON_BUTTON_INFO_SMALL), &g_settings.personalize[SNeutrinoSettings::P_MAIN_INFOMENU]); + + //cisettings if (cCA::GetInstance()->GetNumberCISlots() > 0 || cCA::GetInstance()->GetNumberSmartCardSlots() > 0) - mainMenu.addItem( new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, CRCInput::convertDigitToKey(0))); - - //settings menu - int sett_count =1; - mainSettings.addIntroItems(); - - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_SAVESETTINGSNOW, true, NULL, this, "savesettings", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); - - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_MANAGE, true, NULL, new CSettingsManager())); - - mainSettings.addItem(GenericMenuSeparatorLine); + personalize.addItem(MENU_MAIN, new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler), &g_settings.personalize[SNeutrinoSettings::P_MAIN_CISETTINGS]); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_VIDEO , true, NULL, g_videoSettings, NULL, CRCInput::convertDigitToKey(sett_count++))); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_AUDIO , true, NULL, new CAudioSetup() , NULL, CRCInput::convertDigitToKey(sett_count++))); - mainSettings.addItem(new CLockedMenuForwarder(LOCALE_PARENTALLOCK_PARENTALLOCK, g_settings.parentallock_pincode, true, true, NULL, new CParentalSetup()/*&parentallockSettings*/, NULL, CRCInput::convertDigitToKey(sett_count++))); - -#if 0 - if (g_settings.parentallock_prompt) - mainSettings.addItem(new CLockedMenuForwarder(LOCALE_PARENTALLOCK_PARENTALLOCK, g_settings.parentallock_pincode, true, true, NULL, &parentallockSettings, NULL, CRCInput::convertDigitToKey(sett_count++))); - else - mainSettings.addItem(new CMenuForwarder(LOCALE_PARENTALLOCK_PARENTALLOCK, true, NULL, &parentallockSettings, NULL, CRCInput::convertDigitToKey(sett_count++))); -#endif - if(networksetup == NULL) - networksetup = new CNetworkSetup(); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_NETWORK , true, NULL, networksetup , NULL, CRCInput::convertDigitToKey(sett_count++))); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_RECORDING , true, NULL, new CRecordSetup(), NULL, CRCInput::convertDigitToKey(sett_count++))); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_LANGUAGE , true, NULL, new COsdLangSetup(), NULL, CRCInput::convertDigitToKey(sett_count++))); - - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_OSD , true, NULL, new COsdSetup() , NULL, CRCInput::convertDigitToKey(sett_count++))); - - if (CVFD::getInstance()->has_lcd) - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_LCD , true, NULL, new CVfdSetup(), NULL, CRCInput::convertDigitToKey(sett_count++))); - - mainSettings.addItem(new CMenuForwarder(LOCALE_HDD_SETTINGS, true, NULL, new CHDDMenuHandler(), NULL, CRCInput::convertDigitToKey(sett_count++))); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_KEYBINDING, true, NULL, new CKeybindSetup(), NULL, CRCInput::RC_green , NEUTRINO_ICON_BUTTON_GREEN )); - mainSettings.addItem(new CMenuForwarder(LOCALE_AUDIOPLAYERPICSETTINGS_GENERAL , true, NULL, new CMediaPlayerSetup(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_MISC , true, NULL, new CMiscMenue() , NULL, CRCInput::RC_blue , NEUTRINO_ICON_BUTTON_BLUE )); - - //mainSettings.addItem(new CMenuForwarder(LOCALE_CAM_SETTINGS, true, NULL, g_CamHandler)); - #ifdef TEST_MENU - mainMenu.addItem(new CMenuForwarderNonLocalized("Test menu", true, NULL, new CTestMenu())); + personalize.addItem(MENU_MAIN, new CMenuForwarderNonLocalized("Test menu", true, NULL, new CTestMenu(), CPersonalizeGui::PERSONALIZE_SHOW_NO)); #endif } -#define FLASHUPDATE_UPDATEMODE_OPTION_COUNT 2 -const CMenuOptionChooser::keyval FLASHUPDATE_UPDATEMODE_OPTIONS[FLASHUPDATE_UPDATEMODE_OPTION_COUNT] = +//settings menue +void CNeutrinoApp::InitMenuSettings() { - { 0, LOCALE_FLASHUPDATE_UPDATEMODE_MANUAL }, - { 1, LOCALE_FLASHUPDATE_UPDATEMODE_INTERNET } -}; + dprintf(DEBUG_DEBUG, "init settings menue...\n"); + + ///CMenuWidget &menu = personalize.getWidget(MENU_SETTINGS)/**settings**/; + + // Dynamic renumbering + personalize.setShortcut(); + + // back button, no personalized + personalize.addIntroItems(MENU_SETTINGS); + + ///*************************************************************************************************** + // save + int show_save = CPersonalizeGui::PERSONALIZE_MODE_VISIBLE; + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_SAVESETTINGSNOW, true, NULL, this, "savesettings", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED), &show_save, false, CPersonalizeGui::PERSONALIZE_SHOW_NO); + + // separator line + personalize.addItem(MENU_SETTINGS, GenericMenuSeparatorLine, NULL, false, CPersonalizeGui::PERSONALIZE_SHOW_NO); + + ///1st section*************************************************************************************************** + + // video. + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_VIDEO, true, NULL, g_videoSettings), &g_settings.personalize[SNeutrinoSettings::P_MSET_VIDEO]); + // audio + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_AUDIO, true, NULL, new CAudioSetup()), &g_settings.personalize[SNeutrinoSettings::P_MSET_AUDIO]); + + // parental lock + personalize.addItem(MENU_SETTINGS, new CLockedMenuForwarder(LOCALE_PARENTALLOCK_PARENTALLOCK, g_settings.parentallock_pincode, g_settings.parentallock_prompt, true, NULL, new CParentalSetup()), &g_settings.personalize[SNeutrinoSettings::P_MSET_YOUTH]); + // network + if(networksetup == NULL) + networksetup = new CNetworkSetup(); + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_NETWORK, true, NULL, networksetup), &g_settings.personalize[SNeutrinoSettings::P_MSET_NETWORK]); + + // record settings + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_RECORDING, true, NULL, new CRecordSetup()), &g_settings.personalize[SNeutrinoSettings::P_MSET_RECORDING]); + + // osdlang + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_LANGUAGE, true, NULL, new COsdLangSetup()), &g_settings.personalize[SNeutrinoSettings::P_MSET_OSDLANG]); + + // osd + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_OSD, true, NULL, new COsdSetup()), &g_settings.personalize[SNeutrinoSettings::P_MSET_OSD]); + + // lcd + if (CVFD::getInstance()->has_lcd) + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_LCD, true, NULL, new CVfdSetup()), &g_settings.personalize[SNeutrinoSettings::P_MSET_VFD]); + + // drive settings + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_HDD_SETTINGS, true, NULL, new CHDDMenuHandler()), &g_settings.personalize[SNeutrinoSettings::P_MSET_DRIVES]); + + // cisettings + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler), &g_settings.personalize[SNeutrinoSettings::P_MSET_CISETTINGS]); + + //separator + personalize.addSeparator(MENU_SETTINGS); + + ///*************************************************************************************************** + //10. -- only 10 shortcuts (1-9, 0), the next could be the last also!(10. => 0) + // settings manager + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_MANAGE, true, NULL, new CSettingsManager()), &g_settings.personalize[SNeutrinoSettings::P_MSET_SETTINGS_MANAGER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); + + // personalize + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_PERSONALIZE_HEAD, true, NULL, &personalize), &g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); + + // separator + personalize.addSeparator(MENU_SETTINGS); + + ///*************************************************************************************************** + + // keybindings + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_KEYBINDING, true, NULL, new CKeybindSetup(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN), &g_settings.personalize[SNeutrinoSettings::P_MSET_KEYBINDING]); + + // audioplayer/pictureviewer settings + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_AUDIOPLAYERPICSETTINGS_GENERAL, true, NULL, new CMediaPlayerSetup(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), &g_settings.personalize[SNeutrinoSettings::P_MSET_MEDIAPLAYER]); + + // miscSettings + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_MISC, true, NULL, new CMiscMenue() , NULL, CRCInput::RC_blue , NEUTRINO_ICON_BUTTON_BLUE), &g_settings.personalize[SNeutrinoSettings::P_MSET_MISC]); + +} + +/* service menu*/ +void CNeutrinoApp::InitMenuService() +{ + dprintf(DEBUG_DEBUG, "init service menu...\n"); + + ///CMenuWidget &menu = personalize.getWidget(MENU_SERVICE)/**service**/; + + // Dynamic renumbering + personalize.setShortcut(); + + // back button, no personalized + personalize.addIntroItems(MENU_SERVICE); + + ///1st section*************************************************************************************************** + + // channel scan + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_SERVICEMENU_SCANTS , true, NULL, CScanSetup::getInstance(), "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED) , &g_settings.personalize[SNeutrinoSettings::P_MSER_SCANTS]); + + //reload channels + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_SERVICEMENU_RELOAD , true, NULL, CScanSetup::getInstance(), "reloadchannels", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN) , &g_settings.personalize[SNeutrinoSettings::P_MSER_RELOAD_CHANNELS]); + + //bouquet edit + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_BOUQUETEDITOR_NAME , true, NULL, new CBEBouquetWidget(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW) , &g_settings.personalize[SNeutrinoSettings::P_MSER_BOUQUET_EDIT]); + + //channel reset + CDataResetNotifier *resetNotifier = new CDataResetNotifier(); + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_RESET_CHANNELS , true, NULL, resetNotifier, "channels", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE) , &g_settings.personalize[SNeutrinoSettings::P_MSER_RESET_CHANNELS]); + + //restart neutrino + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_SERVICEMENU_RESTART , true, NULL, this, "restart", CRCInput::RC_standby, NEUTRINO_ICON_BUTTON_POWER) , &g_settings.personalize[SNeutrinoSettings::P_MSER_RESTART]); + + //reload plugins + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_SERVICEMENU_GETPLUGINS, true, NULL, this, "reloadplugins") , &g_settings.personalize[SNeutrinoSettings::P_MSER_RELOAD_PLUGINS]); + + //separator + personalize.addSeparator(MENU_SERVICE); + + ///2nd section*************************************************************************************************** + + //infomenu + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_MESSAGEBOX_INFO, true, NULL, new CInfoMenu(), NULL, CRCInput::RC_info, NEUTRINO_ICON_BUTTON_INFO_SMALL) , &g_settings.personalize[SNeutrinoSettings::P_MSER_SERVICE_INFOMENU]); + + //firmware update + personalize.addItem(MENU_SERVICE, new CMenuForwarder(LOCALE_SERVICEMENU_UPDATE, true, NULL, new CSoftwareUpdate()) , &g_settings.personalize[SNeutrinoSettings::P_MSER_SOFTUPDATE]); + +} + +#if 0 //please remove following lines for the case of that we need these lines never again void CNeutrinoApp::InitServiceSettings(CMenuWidget &service) { dprintf(DEBUG_DEBUG, "init serviceSettings\n"); @@ -227,29 +376,7 @@ void CNeutrinoApp::InitServiceSettings(CMenuWidget &service) zapit_menu->addItem(new CMenuForwarder(LOCALE_EXTRA_ZAPIT_BACKUP, true, "", zexec /*new CZapitDestExec*/, "backup")); zapit_menu->addItem(new CMenuForwarder(LOCALE_EXTRA_ZAPIT_RESTORE, true, "", zexec /*new CZapitDestExec*/, "restore")); #endif - - service.addIntroItems(); - - service.addItem(new CMenuForwarder(LOCALE_SERVICEMENU_SCANTS , true, NULL, CScanSetup::getInstance(), "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED) ); - // service.addItem(new CMenuForwarder(LOCALE_EXTRA_ZAPIT_MENU , true, NULL, zapit_menu, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); - service.addItem(new CMenuForwarder(LOCALE_SERVICEMENU_RELOAD , true, NULL, CScanSetup::getInstance(), "reloadchannels", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN )); - service.addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_NAME , true, NULL, new CBEBouquetWidget(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW )); - - CDataResetNotifier * resetNotifier = new CDataResetNotifier(); - service.addItem(new CMenuForwarder(LOCALE_RESET_CHANNELS , true, NULL, resetNotifier, "channels", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); - - service.addItem(GenericMenuSeparatorLine); - service.addItem(new CMenuForwarder(LOCALE_SERVICEMENU_RESTART , true, NULL, this, "restart", CRCInput::RC_standby, NEUTRINO_ICON_BUTTON_POWER)); - service.addItem(new CMenuForwarder(LOCALE_SERVICEMENU_GETPLUGINS, true, NULL, this, "reloadplugins")); - -// // start infomenu in service - if (g_settings.show_infomenu == 1) - service.addItem(new CMenuForwarder(LOCALE_MESSAGEBOX_INFO, true, NULL, new CInfoMenu(), NULL, CRCInput::RC_info, NEUTRINO_ICON_BUTTON_INFO_SMALL )); - - // end of infomenu in service - //softupdate - service.addItem(new CMenuForwarder(LOCALE_SERVICEMENU_UPDATE, true, NULL, new CSoftwareUpdate())); } - +#endif//************************************************************************************** diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 5c42cc55a..1c6892622 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -125,6 +125,18 @@ enum MN_WIDGET_ID //infomenue MN_WIDGET_ID_INFOMENUE, + //personalize + MN_WIDGET_ID_PERSONALIZE, + //personalize: to personalize option menues + MN_WIDGET_ID_PERSONALIZE_MAIN, + MN_WIDGET_ID_PERSONALIZE_SETTINGS, + MN_WIDGET_ID_PERSONALIZE_SERVICE, + MN_WIDGET_ID_PERSONALIZE_MEDIA, + MN_WIDGET_ID_PERSONALIZE_MOVIEPLAYER, + //personalize: to personalize sub menues + MN_WIDGET_ID_PERSONALIZE_USERMENU, + MN_WIDGET_ID_PERSONALIZE_FEATUREKEYS, + //user menu setup MN_WIDGET_ID_USERMENU_RED, MN_WIDGET_ID_USERMENU_GREEN, diff --git a/src/system/locals.h b/src/system/locals.h index 4b13afc5a..82d6abaf0 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1015,6 +1015,40 @@ typedef enum LOCALE_PARENTALLOCK_ONSIGNAL, LOCALE_PARENTALLOCK_PARENTALLOCK, LOCALE_PARENTALLOCK_PROMPT, + LOCALE_PERSONALIZE_ACCESS, + LOCALE_PERSONALIZE_APPLY_SETTINGS, + LOCALE_PERSONALIZE_BUTTON_AUTO, + LOCALE_PERSONALIZE_BUTTON_BLUE, + LOCALE_PERSONALIZE_BUTTON_GREEN, + LOCALE_PERSONALIZE_BUTTON_RED, + LOCALE_PERSONALIZE_BUTTON_YELLOW, + LOCALE_PERSONALIZE_DISABLED, + LOCALE_PERSONALIZE_ENABLED, + LOCALE_PERSONALIZE_FEATURES, + LOCALE_PERSONALIZE_HEAD, + LOCALE_PERSONALIZE_HELP, + LOCALE_PERSONALIZE_HELP_LINE1, + LOCALE_PERSONALIZE_HELP_LINE2, + LOCALE_PERSONALIZE_HELP_LINE3, + LOCALE_PERSONALIZE_HELP_LINE4, + LOCALE_PERSONALIZE_HELP_LINE5, + LOCALE_PERSONALIZE_HELP_LINE6, + LOCALE_PERSONALIZE_HELP_LINE7, + LOCALE_PERSONALIZE_HELP_LINE8, + LOCALE_PERSONALIZE_MENUCONFIGURATION, + LOCALE_PERSONALIZE_MENUDISABLEDHINT, + LOCALE_PERSONALIZE_NOTPROTECTED, + LOCALE_PERSONALIZE_NOTVISIBLE, + LOCALE_PERSONALIZE_PIN, + LOCALE_PERSONALIZE_PINCODE, + LOCALE_PERSONALIZE_PINHINT, + LOCALE_PERSONALIZE_PINPROTECT, + LOCALE_PERSONALIZE_PINSTATUS, + LOCALE_PERSONALIZE_PLUGINS, + LOCALE_PERSONALIZE_SETUPMENUWITHPIN, + LOCALE_PERSONALIZE_USERMENU_PREFERRED_BUTTONS, + LOCALE_PERSONALIZE_USERMENU_SHOW_CANCEL, + LOCALE_PERSONALIZE_VISIBLE, LOCALE_PICTUREVIEWER_DEFDIR, LOCALE_PICTUREVIEWER_HEAD, LOCALE_PICTUREVIEWER_HELP1, @@ -1318,6 +1352,7 @@ typedef enum LOCALE_USERMENU_ITEM_EPG_MISC, LOCALE_USERMENU_ITEM_NONE, LOCALE_USERMENU_ITEM_VTXT, + LOCALE_USERMENU_MSG_INFO_IS_EMPTY, LOCALE_USERMENU_NAME, LOCALE_VIDEO_MODE_OK, LOCALE_VIDEOMENU_43MODE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index ce636b9b4..89b23513a 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1015,6 +1015,40 @@ const char * locale_real_names[] = "parentallock.onsignal", "parentallock.parentallock", "parentallock.prompt", + "personalize.access", + "personalize.apply_settings", + "personalize.button_auto", + "personalize.button_blue", + "personalize.button_green", + "personalize.button_red", + "personalize.button_yellow", + "personalize.disabled", + "personalize.enabled", + "personalize.features", + "personalize.head", + "personalize.help", + "personalize.help_line1", + "personalize.help_line2", + "personalize.help_line3", + "personalize.help_line4", + "personalize.help_line5", + "personalize.help_line6", + "personalize.help_line7", + "personalize.help_line8", + "personalize.menuconfiguration", + "personalize.menudisabledhint", + "personalize.notprotected", + "personalize.notvisible", + "personalize.pin", + "personalize.pincode", + "personalize.pinhint", + "personalize.pinprotect", + "personalize.pinstatus", + "personalize.plugins", + "personalize.setupmenuwithpin", + "personalize.usermenu_preferred_buttons", + "personalize.usermenu_show_cancel", + "personalize.visible", "pictureviewer.defdir", "pictureviewer.head", "pictureviewer.help1", @@ -1318,6 +1352,7 @@ const char * locale_real_names[] = "usermenu.item_epg_misc", "usermenu.item_none", "usermenu.item_vtxt", + "usermenu.msg_info_is_empty", "usermenu.name", "video_mode_ok", "videomenu.43mode", diff --git a/src/system/settings.cpp b/src/system/settings.cpp index 773414cdf..21e7dd606 100644 --- a/src/system/settings.cpp +++ b/src/system/settings.cpp @@ -26,7 +26,78 @@ #include #include +#include +//enum PERSONALIZE_SETTINGS to find in settings.h +const struct personalize_settings_t personalize_settings[SNeutrinoSettings::P_SETTINGS_MAX] = +{ + {"personalize_pinstatus" , CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED}, + + //user menu + {"personalize_bluebutton" , CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED}, // features + {"personalize_redbutton" , CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED}, // epg/info + + //main menu + {"personalize_tv_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_games" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_media" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_scripts" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_settings" , CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED}, + {"personalize_service" , CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED}, + {"personalize_sleeptimer" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_reboot" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_shutdown" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_infomenu_main" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_cisettings_main" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + + //main menu->settings menu + {"personalize_settingsmager" , CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED}, + {"personalize_video" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_audio" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_youth" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_network" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_recording" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_osdlang" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_osd" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_vfd" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_drives" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_cisettings_settings" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE}, + {"personalize_keybindings" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_mediaplayer" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_misc" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + + //main menu->service menu + {"personalize_scants" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_reload_channels" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_bouquet_edit" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_reset_channels" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_restart" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_reload_plugins" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_infomenu_service" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE}, + {"personalize_softupdate" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + + //media menu + {"personalize_media_menu" , CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED}, + {"personalize_media_audio" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_media_intetplay" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_media_movieplayer" , CPersonalizeGui::PERSONALIZE_PROTECT_MODE_NOT_PROTECTED}, + {"personalize_media_pviewer" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_media_upnp" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + + //media menu->movieplayer + {"personalize_mplayer_mbrowswer" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_mplayer_fileplay" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + + //key + {"personalize_feat_key_fav" , CPersonalizeGui::PERSONALIZE_FEAT_KEY_GREEN}, + {"personalize_feat_key_timerlist" , CPersonalizeGui::PERSONALIZE_FEAT_KEY_YELLOW}, + {"personalize_feat_key_vtxt" , CPersonalizeGui::PERSONALIZE_FEAT_KEY_BLUE}, + {"personalize_feat_key_rclock" , CPersonalizeGui::PERSONALIZE_FEAT_KEY_AUTO}, + + //user menu + {"personalize_usermenu_show_cancel" , true}, +}; CScanSettings::CScanSettings(void) : configfile('\t') { diff --git a/src/system/settings.h b/src/system/settings.h index c95e21bcc..7a153d3f4 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -66,7 +66,6 @@ struct SNeutrinoSettings int infobar_subchan_disp_pos; int fan_speed; int infobar_show; - int show_infomenu; int infobar_show_channellogo; int progressbar_color; int casystem_display; @@ -127,9 +126,86 @@ struct SNeutrinoSettings std::string network_ntprefresh; int network_ntpenable; char ifname[10]; + + //personalize + enum PERSONALIZE_SETTINGS //settings.h + { + P_MAIN_PINSTATUS, + + //user menu + P_MAIN_BLUE_BUTTON, + P_MAIN_RED_BUTTON, + + //main menu + P_MAIN_TV_MODE, + P_MAIN_RADIO_MODE, + P_MAIN_GAMES, + P_MAIN_MEDIA, + P_MAIN_SCRIPTS, + P_MAIN_SETTINGS, + P_MAIN_SERVICE, + P_MAIN_SLEEPTIMER, + P_MAIN_REBOOT, + P_MAIN_SHUTDOWN, + P_MAIN_INFOMENU, + P_MAIN_CISETTINGS, + + //settings menu + P_MSET_SETTINGS_MANAGER, + P_MSET_VIDEO, + P_MSET_AUDIO, + P_MSET_YOUTH, + P_MSET_NETWORK, + P_MSET_RECORDING, + P_MSET_OSDLANG, + P_MSET_OSD, + P_MSET_VFD, + P_MSET_DRIVES, + P_MSET_CISETTINGS, + P_MSET_KEYBINDING, + P_MSET_MEDIAPLAYER, + P_MSET_MISC, + + //service menu + P_MSER_SCANTS, + P_MSER_RELOAD_CHANNELS, + P_MSER_BOUQUET_EDIT, + P_MSER_RESET_CHANNELS, + P_MSER_RESTART, + P_MSER_RELOAD_PLUGINS, + P_MSER_SERVICE_INFOMENU, + P_MSER_SOFTUPDATE, + + //media menu + P_MEDIA_MENU, + P_MEDIA_AUDIO, + P_MEDIA_INETPLAY, + P_MEDIA_MPLAYER, + P_MEDIA_PVIEWER, + P_MEDIA_UPNP, + + //movieplayer menu + P_MPLAYER_MBROWSER, + P_MPLAYER_FILEPLAY, + + //feature keys + P_FEAT_KEY_FAVORIT, + P_FEAT_KEY_TIMERLIST, + P_FEAT_KEY_VTXT, + P_FEAT_KEY_RC_LOCK, + + //user menu + P_UMENU_SHOW_CANCEL, + + P_SETTINGS_MAX + }; + + int personalize[P_SETTINGS_MAX]; + char personalize_pincode[5]; //timing - enum TIMING_SETTINGS { + enum TIMING_SETTINGS + { TIMING_MENU = 0, TIMING_CHANLIST = 1, TIMING_EPG = 2, @@ -489,6 +565,8 @@ struct SNeutrinoSettings /* some default Values */ +extern const struct personalize_settings_t personalize_settings[SNeutrinoSettings::P_SETTINGS_MAX]; + typedef struct time_settings_t { const int default_timing;