/* $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; int 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