Merge remote-tracking branch 'check/cst-next'

needs build- and functional fixes

Conflicts:
	configure.ac
	data/icons/shutdown.jpg
	data/icons/start.jpg
	data/locale/deutsch.locale
	data/locale/english.locale
	lib/libmd5sum/md5.c
	src/driver/scanepg.cpp
	src/driver/streamts.cpp
	src/driver/vfd.cpp
	src/driver/vfd.h
	src/driver/volume.cpp
	src/eitd/dmx.cpp
	src/eitd/xmlutil.cpp
	src/gui/Makefile.am
	src/gui/audiomute.cpp
	src/gui/channellist.cpp
	src/gui/dboxinfo.cpp
	src/gui/epgview.cpp
	src/gui/eventlist.cpp
	src/gui/filebrowser.cpp
	src/gui/hdd_menu.cpp
	src/gui/infoviewer.cpp
	src/gui/infoviewer_bb.cpp
	src/gui/infoviewer_bb.h
	src/gui/keybind_setup.cpp
	src/gui/luainstance.cpp
	src/gui/luainstance.h
	src/gui/miscsettings_menu.cpp
	src/gui/moviebrowser.cpp
	src/gui/movieplayer.cpp
	src/gui/osd_progressbar_setup.cpp
	src/gui/osd_progressbar_setup.h
	src/gui/osd_setup.cpp
	src/gui/osdlang_setup.cpp
	src/gui/personalize.cpp
	src/gui/plugins.cpp
	src/gui/plugins.h
	src/gui/scan.cpp
	src/gui/scan_setup.cpp
	src/gui/update_settings.cpp
	src/gui/user_menue.cpp
	src/gui/user_menue_setup.cpp
	src/gui/videosettings.cpp
	src/gui/widget/buttons.cpp
	src/gui/widget/menue.cpp
	src/gui/widget/menue.h
	src/gui/widget/progresswindow.cpp
	src/neutrino.cpp
	src/neutrino_menue.cpp
	src/nhttpd/yhttpd.cpp
	src/system/helpers.cpp
	src/system/locals.h
	src/system/locals_intern.h
	src/system/setting_helpers.cpp
	src/zapit/lib/zapitclient.cpp
	src/zapit/src/fastscan.cpp
	src/zapit/src/frontend.cpp
	src/zapit/src/getservices.cpp
	src/zapit/src/scan.cpp
	src/zapit/src/scannit.cpp
	src/zapit/src/scanpmt.cpp
	src/zapit/src/transponder.cpp
	src/zapit/src/zapit.cpp


Origin commit data
------------------
Commit: 69c4dbbdba
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2014-12-25 (Thu, 25 Dec 2014)
This commit is contained in:
Stefan Seyfried
2014-12-25 18:03:08 +01:00
423 changed files with 23934 additions and 12351 deletions

View File

@@ -176,6 +176,7 @@
#include "plugins.h"
#include <system/settings.h>
#include <system/helpers.h>
using namespace std;
@@ -204,11 +205,10 @@ CPersonalizeGui::CPersonalizeGui() : CPINProtection(g_settings.personalize_pinco
widget_count = 0;
shortcut = 1;
show_usermenu = false;
show_pluginmenu = false;
show_pin_setup = false;
user_menu_notifier = NULL;
pin_setup_notifier = NULL;
fkeyMenu = NULL;
plMenu = NULL;
tmpW = NULL;
v_observ.clear();
options_count = 0;
@@ -224,39 +224,90 @@ int CPersonalizeGui::exec(CMenuTarget* parent, const string & actionKey)
{
int res = menu_return::RETURN_REPAINT;
if (actionKey == ">d") {
int selected = uMenu->getSelected();
if (selected >= customkey_offset) {
if(parent)
parent->hide();
const char *ak = (static_cast<CMenuForwarder*>(uMenu->getItem(selected)))->getActionKey();
if (ak && *ak && std::string(ak).find_first_not_of("0123456789") == std::string::npos) {
int i = atoi(ak);
if (i > -1) {
for (unsigned int j = 4; j < g_settings.usermenu.size(); j++) {
std::string name = to_string(j);
std::string usermenu_key("usermenu_key_");
usermenu_key += name;
CNeutrinoApp::getInstance()->getConfigFile()->deleteKey(usermenu_key);
std::string txt1("usermenu_tv_");
txt1 += name;
CNeutrinoApp::getInstance()->getConfigFile()->deleteKey(txt1);
txt1 += "_text";
CNeutrinoApp::getInstance()->getConfigFile()->deleteKey(txt1);
}
delete g_settings.usermenu[i];
g_settings.usermenu[i] = NULL;
}
}
uMenu->removeItem(selected);
uMenu->hide();
return menu_return::RETURN_REPAINT;
}
return menu_return::RETURN_NONE;
}
if (parent)
parent->hide();
if (actionKey == ">a") {
unsigned int i = g_settings.usermenu.size();
CUserMenuSetup *cms = new CUserMenuSetup(LOCALE_USERMENU_HEAD, i);
SNeutrinoSettings::usermenu_t *um = new SNeutrinoSettings::usermenu_t;
um->key = CRCInput::RC_nokey;
g_settings.usermenu.push_back(um);
CMenuDForwarder *fw = new CMenuDForwarder(CRCInput::getKeyName(um->key), true, um->title, cms, to_string(i).c_str());
cms->setCaller(fw);
#if 0
int selected = uMenu->getSelected();
if (selected >= customkey_offset)
uMenu->insertItem(selected, fw);
else
#endif
uMenu->addItem(fw, true);
uMenu->hide();
return menu_return::RETURN_REPAINT;
}
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
if(actionKey == a_key)
{
res = ShowMenuOptions(i);
return res;
}
}
if (actionKey=="personalize_help") { // Personalize help
if (actionKey=="personalize_help") {
ShowHelpPersonalize();
return res;
}
if (actionKey=="restore") {
if (actionKey=="restore") {
ShowPersonalizationMenu ();
return menu_return::RETURN_EXIT_ALL;
}
//also handle pin access
//also handle pin access
handleSetting(&g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS]);
//pin protected access to personalize menu also if found any pin protected items
//pin protected access to personalize menu also if found any pin protected items
bool is_pin_protected = g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS];
if (!g_settings.easymenu && (is_pin_protected || hasPinItems())) {
setHint(LOCALE_PERSONALIZE_PINHINT); //from CPINProtection
is_pin_protected = true;
@@ -264,30 +315,22 @@ int CPersonalizeGui::exec(CMenuTarget* parent, const string & actionKey)
is_pin_protected = false;
}
if (!is_pin_protected){
res = ShowPersonalizationMenu(); // Show main Personalization Menu
res = ShowPersonalizationMenu();
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.
int CPersonalizeGui::ShowPersonalizationMenu()
{
width = w_max (40, 10);
CMenuWidget* pMenu = new CMenuWidget(g_settings.easymenu ? LOCALE_PARENTALLOCK_MENU : LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width, MN_WIDGET_ID_PERSONALIZE);
pMenu->addIntroItems(NONEXISTANT_LOCALE, LOCALE_PERSONALIZE_ACCESS);
//pin
CPINChangeWidget *pinChangeWidget = NULL;
if (!g_settings.easymenu && show_pin_setup)
@@ -297,14 +340,10 @@ int CPersonalizeGui::ShowPersonalizationMenu()
if (g_settings.easymenu) {
int count = 0;
for (uint j = 0; j<v_item.size(); j++) {
printf("v_item[i].widget [%s]\n", v_item[j].widget->getName().c_str());
printf("v_item[i].widget [%s]\n", v_item[j].widget->getName());
//pin protected items only
if (v_item[j].item_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
{
const char* icon = (count == 0) ? NEUTRINO_ICON_BUTTON_RED :
(count == 1) ? NEUTRINO_ICON_BUTTON_GREEN :
(count == 2) ? NEUTRINO_ICON_BUTTON_YELLOW :
(count == 3) ? NEUTRINO_ICON_BUTTON_BLUE : NULL;
const neutrino_msg_t key = (count == 0) ? CRCInput::RC_red :
(count == 1) ? CRCInput::RC_green :
(count == 2) ? CRCInput::RC_yellow :
@@ -315,7 +354,7 @@ int CPersonalizeGui::ShowPersonalizationMenu()
itm_name += g_Locale->getText(LOCALE_PERSONALIZE_PINSTATUS);
if (v_item[j].personalize_mode != NULL)
pMenu->addItem(new CMenuOptionChooser(itm_name.c_str(), v_item[j].personalize_mode, PERSONALIZE_PROTECT_MODE_OPTIONS, PERSONALIZE_PROTECT_MODE_MAX, v_item[j].menuItem->active, NULL, key, icon));
pMenu->addItem(new CMenuOptionChooser(itm_name.c_str(), v_item[j].personalize_mode, PERSONALIZE_PROTECT_MODE_OPTIONS, PERSONALIZE_PROTECT_MODE_MAX, v_item[j].menuItem->active, NULL, key));
}
}
res = pMenu->exec(NULL, "");
@@ -336,37 +375,89 @@ int CPersonalizeGui::ShowPersonalizationMenu()
p_mn[i] = new CMenuForwarder(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<CUserMenuSetup*> v_userMenuSetup;
uMenu = NULL;
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);
pMenu->addItem(new CMenuForwarder(LOCALE_USERMENU_HEAD, true, NULL, uMenu, NULL, CRCInput::RC_green));
ShowUserMenu();
}
CMenuWidget* plMenu = NULL;
int pcount = g_PluginList->getNumberOfPlugins();
std::string pldesc[pcount];
int pltype[pcount];
if (show_pluginmenu)
{
if (!show_usermenu)
pMenu->addItem(GenericMenuSeparatorLine);
plMenu = new CMenuWidget(LOCALE_PERSONALIZE_HEAD, NEUTRINO_ICON_PERSONALIZE, width, MN_WIDGET_ID_PERSONALIZE_PLUGINS);
pMenu->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_PLUGINS, true, NULL, plMenu, NULL, CRCInput::RC_blue));
ShowPluginMenu(plMenu, pldesc, pltype);
}
//help
pMenu->addItem(GenericMenuSeparatorLine);
pMenu->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_HELP, true, NULL, this, "personalize_help", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP));
pMenu->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_HELP, true, NULL, this, "personalize_help", CRCInput::RC_help));
res = pMenu->exec(NULL, "");
if (show_pluginmenu) {
g_settings.plugins_disabled = "";
g_settings.plugins_game = "";
g_settings.plugins_tool = "";
g_settings.plugins_script = "";
g_settings.plugins_lua = "";
for (int i = 0; i < pcount; i++) {
if (pltype[i] & CPlugins::P_TYPE_DISABLED) {
if (g_settings.plugins_disabled != "")
g_settings.plugins_disabled += ",";
g_settings.plugins_disabled += g_PluginList->getFileName(i);
g_PluginList->setType(i, CPlugins::P_TYPE_DISABLED);
} else if (pltype[i] & CPlugins::P_TYPE_GAME) {
if (g_settings.plugins_game != "")
g_settings.plugins_game += ",";
g_settings.plugins_game += g_PluginList->getFileName(i);
g_PluginList->setType(i, CPlugins::P_TYPE_GAME);
} else if (pltype[i] & CPlugins::P_TYPE_TOOL) {
if (g_settings.plugins_tool != "")
g_settings.plugins_tool += ",";
g_settings.plugins_tool += g_PluginList->getFileName(i);
g_PluginList->setType(i, CPlugins::P_TYPE_TOOL);
} else if (pltype[i] & CPlugins::P_TYPE_SCRIPT) {
if (g_settings.plugins_script != "")
g_settings.plugins_script += ",";
g_settings.plugins_script += g_PluginList->getFileName(i);
g_PluginList->setType(i, CPlugins::P_TYPE_SCRIPT);
} else if (pltype[i] & CPlugins::P_TYPE_LUA) {
if (g_settings.plugins_lua != "")
g_settings.plugins_lua += ",";
g_settings.plugins_lua += g_PluginList->getFileName(i);
g_PluginList->setType(i, CPlugins::P_TYPE_LUA);
}
}
g_PluginList->loadPlugins();
}
if (show_usermenu)
for(std::vector<SNeutrinoSettings::usermenu_t *>::iterator it = g_settings.usermenu.begin(); it != g_settings.usermenu.end();) {
if (!*it)
it = g_settings.usermenu.erase(it);
else
++it;
}
delete pMenu;
delete uMenu;
delete pinChangeWidget;
delete fkeyMenu;
delete plMenu;
for(vector<CUserMenuSetup*>::iterator it = v_userMenuSetup.begin(); it != v_userMenuSetup.end(); ++it)
delete *it;
v_userMenuSetup.clear();
delete user_menu_notifier;
delete pin_setup_notifier;
return res;
}
@@ -374,95 +465,56 @@ int CPersonalizeGui::ShowPersonalizationMenu()
void CPersonalizeGui::ShowPinSetup(CMenuWidget* p_widget, CPINChangeWidget * &pin_widget)
{
pin_widget = new CPINChangeWidget(LOCALE_PERSONALIZE_PINCODE, &g_settings.personalize_pincode, 4, LOCALE_PERSONALIZE_PINHINT);
CMenuForwarder * fw_pin_setup = new CMenuForwarder(LOCALE_PERSONALIZE_PINCODE, true, g_settings.personalize_pincode, pin_widget, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
CMenuForwarder * fw_pin_setup = new CMenuForwarder(LOCALE_PERSONALIZE_PINCODE, true, g_settings.personalize_pincode, pin_widget, NULL, CRCInput::RC_red);
pin_setup_notifier = new CPinSetupNotifier(fw_pin_setup);
p_widget->addItem(new CMenuOptionChooser(LOCALE_PERSONALIZE_PIN_IN_USE, &g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, pin_setup_notifier));
pin_setup_notifier->changeNotify();
p_widget->addItem(fw_pin_setup);
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);
}
static const struct button_label footerButtons[2] = {
{ NEUTRINO_ICON_BUTTON_RED, LOCALE_BOUQUETEDITOR_DELETE },
{ NEUTRINO_ICON_BUTTON_GREEN, LOCALE_BOUQUETEDITOR_ADD }
};
//init usermenu items
void CPersonalizeGui::ShowUserMenu(CMenuWidget* p_widget, vector<CUserMenuSetup*> &v_umenu)
void CPersonalizeGui::ShowUserMenu()
{
p_widget->addIntroItems(LOCALE_USERMENU_HEAD);
int uMenu_shortcut = 1;
uMenu->addIntroItems(LOCALE_USERMENU_HEAD);
uMenu->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));
uMenu->addItem(GenericMenuSeparatorLine);
//define usermenu items
vector<CMenuForwarder*> v_umenu_fw;
std::vector<CMenuForwarder*> v_umenu_fw;
for (uint i = 0; i<USERMENU_ITEMS_COUNT; i++)
{
v_umenu.push_back(new CUserMenuSetup(usermenu[i].menue_title, usermenu[i].menue_button));
//ensure correct default string, e.g: required after settings reset
if (v_umenu[i]->getUsedItemsCount() > 0)
g_settings.usermenu_text[i] = g_settings.usermenu_text[i].empty() ? g_Locale->getText(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));
CUserMenuSetup *cms = new CUserMenuSetup(usermenu[i].menue_title, usermenu[i].menue_button);
CMenuDForwarder *fw = new CMenuDForwarder(usermenu[i].menue_title, true, g_settings.usermenu[i]->title, cms, g_settings.usermenu[i]->name.c_str(), /*usermenu[i].DirectKey*/CRCInput::RC_nokey /*, usermenu[i].IconName*/);
cms->setCaller(fw);
v_umenu_fw.push_back(fw);
}
#if 0
//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);
#endif
//enable/disable epg/features
user_menu_notifier = new CUserMenuNotifier(v_umenu_fw[0], v_umenu_fw[1], v_umenu_fw[2], 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, user_menu_notifier));/*LOCALE_INFOVIEWER_EVENTLIST*/
//green
p_widget->addItem(new CMenuOptionChooser(usermenu[1].menue_title, &g_settings.personalize[SNeutrinoSettings::P_MAIN_GREEN_BUTTON], PERSONALIZE_ACTIVE_MODE_OPTIONS, PERSONALIZE_ACTIVE_MODE_MAX, true, user_menu_notifier));
//yellow
p_widget->addItem(new CMenuOptionChooser(usermenu[2].menue_title, &g_settings.personalize[SNeutrinoSettings::P_MAIN_YELLOW_BUTTON], PERSONALIZE_ACTIVE_MODE_OPTIONS, PERSONALIZE_ACTIVE_MODE_MAX, true, user_menu_notifier));
//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, user_menu_notifier));/*LOCALE_INFOVIEWER_STREAMINFO*/
int buttons[USERMENU_ITEMS_COUNT] = { SNeutrinoSettings::P_MAIN_RED_BUTTON, SNeutrinoSettings::P_MAIN_GREEN_BUTTON, SNeutrinoSettings::P_MAIN_YELLOW_BUTTON, SNeutrinoSettings::P_MAIN_BLUE_BUTTON };
for (int i = 0; i < USERMENU_ITEMS_COUNT; i++)
uMenu->addItem(new CMenuOptionChooser(usermenu[i].menue_title, &g_settings.personalize[buttons[i]], PERSONALIZE_ACTIVE_MODE_OPTIONS, PERSONALIZE_ACTIVE_MODE_MAX, true, user_menu_notifier));
//add usermenu items
p_widget->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_RIGHT | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_NAME));
uMenu->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_RIGHT | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_NAME));
user_menu_notifier->changeNotify();
for (uint j = 0; j<USERMENU_ITEMS_COUNT; j++)
p_widget->addItem(v_umenu_fw[j]);
p_widget->addItem(GenericMenuSeparator);
#if 0
//preverred keys
p_widget->addItem(GenericMenuSeparatorLine);
p_widget->addItem(fw_fkeys);
ShowPreverredKeySetup(fkeyMenu);
#endif
p_widget->addItem(GenericMenuSeparatorLine);
p_widget->addItem(GenericMenuSeparator);
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));
uMenu->addItem(v_umenu_fw[j]);
#if 0
/* distinguishing between plugin types is useful for what?
* maybe disabling games / eveything else might make sense,
* but why distinguish between scripts / "tools" (binaries) / LUA?
*/
pluginSelectionMenu = new CMenuWidget(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, NEUTRINO_ICON_SETTINGS);
uMenu->addItem(GenericMenuSeparatorLine);
//add plugin selection menu
CMenuWidget *pluginSelectionMenu = new CMenuWidget(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, NEUTRINO_ICON_SETTINGS);
pluginSelectionMenu->addIntroItems(LOCALE_MAINMENU_SETTINGS);
CMenuOptionChooser * /*oc = NULL;*/
@@ -482,24 +534,53 @@ void CPersonalizeGui::ShowUserMenu(CMenuWidget* p_widget, vector<CUserMenuSetup*
oc->setHint(NEUTRINO_ICON_HINT_PERSONALIZE, LOCALE_MENU_HINT_PLUGIN_TYPE_LUA);
pluginSelectionMenu->addItem(oc);
p_widget->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, true, NULL, pluginSelectionMenu));
#endif
uMenu->addItem(new CMenuDForwarder(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, true, NULL, pluginSelectionMenu, NULL, CRCInput::convertDigitToKey(uMenu_shortcut++)));
uMenu->addItem(GenericMenuSeparatorLine);
//non-standard usermenu keys
customkey_offset = uMenu->getItemsCount();
unsigned int ums = g_settings.usermenu.size();
for (unsigned int i = USERMENU_ITEMS_COUNT; i < ums; i++)
if (g_settings.usermenu[i]->key != CRCInput::RC_nokey) {
CUserMenuSetup *cms = new CUserMenuSetup(LOCALE_USERMENU_HEAD, i);
CMenuDForwarder *fw = new CMenuDForwarder(CRCInput::getKeyName(g_settings.usermenu[i]->key), true, g_settings.usermenu[i]->title, cms, to_string(i).c_str());
cms->setCaller(fw);
uMenu->addItem(fw);
}
uMenu->setFooter(footerButtons, 2);
uMenu->addKey(CRCInput::RC_red, this, ">d");
uMenu->addKey(CRCInput::RC_green, this, ">a");
}
#define PERSONALIZE_PLUGINTYPE_MAX 5
const CMenuOptionChooser::keyval PERSONALIZE_PLUGINTYPE_OPTIONS[PERSONALIZE_PLUGINTYPE_MAX] =
{
{ CPlugins::P_TYPE_DISABLED, LOCALE_PLUGINTYPE_DISABLED },
{ CPlugins::P_TYPE_GAME, LOCALE_PLUGINTYPE_GAME },
{ CPlugins::P_TYPE_TOOL, LOCALE_PLUGINTYPE_TOOL },
{ CPlugins::P_TYPE_SCRIPT, LOCALE_PLUGINTYPE_SCRIPT },
{ CPlugins::P_TYPE_LUA, LOCALE_PLUGINTYPE_LUA }
};
//init plugin settings
void CPersonalizeGui::ShowPluginMenu(CMenuWidget* p_widget)
void CPersonalizeGui::ShowPluginMenu(CMenuWidget* p_widget, std::string da[], int ia[])
{
p_widget->addIntroItems(LOCALE_PERSONALIZE_PLUGINS);
uint d_key = 1;
for (int i = 0; i<g_PluginList->getNumberOfPlugins(); i++)
uint d_key = 1;
int pcount = g_PluginList->getNumberOfPlugins();
for (int i = 0; i < pcount; 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 CMenuForwarder(g_PluginList->getName(i), true, g_PluginList->getDescription(i), NULL, NULL, getShortcut(d_key)));
d_key++;
}
ia[i] = g_PluginList->getType(i);
da[i] = g_PluginList->getName(i);
if (da[i].empty())
continue;
std::string pluginDesc = g_PluginList->getDescription(i);
if (!pluginDesc.empty())
da[i] += " (" + pluginDesc + ")";
p_widget->addItem(new CMenuOptionChooser(da[i].c_str(), &ia[i], PERSONALIZE_PLUGINTYPE_OPTIONS, PERSONALIZE_PLUGINTYPE_MAX,
!g_PluginList->isHidden(i), NULL, getShortcut(d_key++)));
}
}
@@ -509,20 +590,20 @@ int CPersonalizeGui::ShowMenuOptions(const int& widget)
{
string mn_name = v_widget[widget]->getName();
printf("[neutrino-personalize] exec %s for [%s]...\n", __FUNCTION__, mn_name.c_str());
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);
//reuqired in changeNotify()
options_count = 0;
options_count = 0;
tmpW = pm;
//*************************
//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;
s_sh += ": " + mn_name;
pm_subhead->setName(s_sh);
pm->addItem(pm_subhead);
pm->addIntroItems();
@@ -532,53 +613,53 @@ int CPersonalizeGui::ShowMenuOptions(const int& widget)
if (mn_name == v_item[i].widget->getName())
{
int i_mode = v_item[i].item_mode;
if (i_mode != PERSONALIZE_SHOW_NO)
{
//add items to the options menu
if (i_mode == PERSONALIZE_SHOW_AS_ITEM_OPTION)
{
if (i_mode == PERSONALIZE_SHOW_AS_ITEM_OPTION)
{
if (v_item[i].personalize_mode != NULL) //option chooser
{
//get locale name and personalize mode
neutrino_locale_t name = v_item[i].locale_name;
int* p_mode = v_item[i].personalize_mode;
//found observer item and if found, then define 'this' as observer for current option chooser and run changeNotify
bool is_observer = isObserver(v_item[i].widget, v_item[i].menuItem) ? true : false;
CChangeObserver* observer = is_observer ? this : NULL;
CChangeObserver* observer = is_observer ? this : NULL;
CMenuOptionChooser * opt = new CMenuOptionChooser(name, p_mode, PERSONALIZE_MODE_OPTIONS, PERSONALIZE_MODE_MAX, v_item[i].menuItem->active, observer);
if (is_observer)
changeNotify(name, (void*)p_mode);
//required for first view: check active mode of option chooser and disable if it's an observed item and item mode is set to 'not visible'
for (uint j = 0; j < v_observ.size(); j++)
for (uint j = 0; j < v_observ.size(); j++)
if (opt->getName()== g_Locale->getText(v_observ[j].to_observ_locale) && *p_mode == PERSONALIZE_MODE_NOTVISIBLE)
opt->setActive(false);
opt->setActive(false);
pm->addItem(opt); //add option chooser
}
else
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);
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->addItem(v_item[i].menuItem);
}
}
}
options_count = pm->getItemsCount();
int res = pm->exec (NULL, "");
@@ -588,32 +669,32 @@ int CPersonalizeGui::ShowMenuOptions(const int& widget)
//returns true, if found an observer item
bool CPersonalizeGui::isObserver(CMenuWidget* widget, CMenuItem *item)
{
{
for (uint i = 0; i < v_observ.size(); i++)
{
{
if (v_observ[i].widget == widget)
{
CMenuForwarder* fw = static_cast <CMenuForwarder*> (item);
CMenuForwarder* fw = static_cast <CMenuForwarder*> (item);
if (fw->getTextLocale() == v_observ[i].observer_locale)
return true;
return true;
}
}
}
return false;
}
bool CPersonalizeGui::changeNotify(const neutrino_locale_t locale, void *data)
{
{
int opt_val = *(int*) data;
//exit if no options found
int opt_count = options_count;
if (opt_count == 0 && locale == NONEXISTANT_LOCALE)
return true;
//if found an option and handle
for (int i = 0; i < opt_count; i++){
//get current item
CMenuItem* item = tmpW->getItem(i);
if (item->isMenueOptionChooser())
@@ -623,12 +704,12 @@ bool CPersonalizeGui::changeNotify(const neutrino_locale_t locale, void *data)
string opt_name = chooser->getName();
for (uint j = 0; j < v_observ.size(); j++)
{
{
//if found the same option name for an observer item then...
if (locale == v_observ[j].observer_locale)
{
{
//...compare for observed item
if (opt_name == g_Locale->getText(v_observ[j].to_observ_locale))
if (opt_name == g_Locale->getText(v_observ[j].to_observ_locale))
{
//and if found an observed item, then set properties
if (opt_val == PERSONALIZE_MODE_VISIBLE || opt_val == PERSONALIZE_MODE_PIN)
@@ -652,7 +733,7 @@ bool CPersonalizeGui::changeNotify(const neutrino_locale_t locale, void *data)
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));
@@ -697,7 +778,7 @@ void CPersonalizeGui::SaveAndExit()
//adds a menu widget to v_widget and sets the count of available widgets
//adds a menu widget to v_widget and sets the count of available widgets
void CPersonalizeGui::addWidget(CMenuWidget *widget)
{
v_widget.push_back(widget);
@@ -761,9 +842,9 @@ void CPersonalizeGui::addItem(CMenuWidget *widget, CMenuItem *menu_Item, const i
{
if (observer_Item != NULL)
addObservedItem(widget, observer_Item, menu_Item);
CMenuForwarder *fw = static_cast <CMenuForwarder*> (menu_Item);
menu_item_t item = {widget, menu_Item, defaultselected, fw->getTextLocale(), (int*)personalize_mode, item_mode, observer_Item};
if (item_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
@@ -803,12 +884,12 @@ void CPersonalizeGui::addSeparator(CMenuWidget &widget, const neutrino_locale_t
//returns available count of personalized item for definied widget
int CPersonalizeGui::getItemsCount(CMenuWidget *widget)
{
int ret = 0;
int ret = 0;
for (uint i = 0; i < v_item.size(); i++)
if (v_item[i].widget == widget)
ret++;
return ret;
}
@@ -826,64 +907,64 @@ void CPersonalizeGui::addPersonalizedItems()
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;
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();
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 <CMenuForwarder*> (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,
if (d_key == CRCInput::RC_nokey && 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
//set pinmode for personalize menu or for settings manager menu and if any item is pin protected
if (!g_settings.easymenu && (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(),
//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.easymenu ? g_settings.parentallock_pincode : g_settings.personalize_pincode,
use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, fw->iconName.c_str(), lock_icon);
use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, NULL, lock_icon);
v_item[i].menuItem->hintIcon = fw->hintIcon;
v_item[i].menuItem->hint = fw->hint;
//add item if it's set to visible or pin protected and allow to add an forwarder as next
@@ -892,10 +973,12 @@ void CPersonalizeGui::addPersonalizedItems()
//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)
if (add_shortcut) {
short_cut++;
v_item[i].widget->setNextShortcut(short_cut);
}
}
else if (p_mode == PERSONALIZE_MODE_NOTVISIBLE)
{
@@ -906,11 +989,11 @@ void CPersonalizeGui::addPersonalizedItems()
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
@@ -927,17 +1010,17 @@ void CPersonalizeGui::addPersonalizedItems()
// 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)
if (shortcut_num < 10)
return CRCInput::convertDigitToKey(shortcut_num);
else if (shortcut_num == 10)
else if (shortcut_num == 10)
return CRCInput::RC_0;
else
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);
}
@@ -949,20 +1032,20 @@ bool CPersonalizeGui::haveChangedSettings()
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;
}
@@ -972,7 +1055,7 @@ 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");
}
@@ -992,20 +1075,20 @@ bool CUserMenuNotifier::changeNotify(const neutrino_locale_t, void *)
toDisable[1]->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_GREEN_BUTTON]);
toDisable[2]->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_YELLOW_BUTTON]);
toDisable[3]->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON]);
return false;
}
//helper class to enable/disable pin setup
CPinSetupNotifier::CPinSetupNotifier( CMenuItem* item)
{
toDisable=item;
toDisable=item;
}
bool CPinSetupNotifier::changeNotify(const neutrino_locale_t, void *)
{
toDisable->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS]);
// return g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS];
// return g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS];
return false;
}