*neutrino: port personalize feature from tuxbox

This is a partial port of original neutrino personalize feature
and includes also moving of user menu settings from key setup into this setup,
but it's not completley yet in some details and so I think it's a lot to do.
I hope it works fine and the many user requests are justifying this feature.

TODO:
- doc into wiki
- adapt for yWeb
- some reworks for user menu settings and plugin management
- add timer and rework tv radio mode switch item(s)
and many more...

please report: http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/9565-diskussion-neutrino-goes-neutrinohd-welche-features-funktionen-aus-dem-tuxbox-cvs-%C3%BCbernehmen/

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2010 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2011-12-28 00:19:15 +00:00
parent 3c29473e7f
commit aaa988db5f
28 changed files with 1780 additions and 223 deletions

241
src/gui/personalize.h Normal file
View File

@@ -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 <gui/widget/menue.h>
#include "gui/plugins.h"
#include "gui/user_menue_setup.h"
#include "widget/stringinput.h"
#include "widget/stringinput_ext.h"
#include <string>
#include <vector>
#include <configfile.h>
#include <system/lastchannel.h>
#include <system/setting_helpers.h>
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<settings_int_t> v_int_settings;
std::vector<menu_item_t> v_item;
std::vector<CMenuWidget *> 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<CUserMenuSetup*> 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