neutrino: sync keybind and usermenu code with neutrino-mp, code (C) martii

This commit is contained in:
[CST] Focus
2014-09-05 17:49:11 +04:00
parent f07e81c4b9
commit 420af7a4dc
45 changed files with 1767 additions and 1144 deletions

View File

@@ -33,6 +33,8 @@
#include <config.h>
#endif
#include <unistd.h>
#include "keybind_setup.h"
#include <global.h>
@@ -50,6 +52,9 @@
#include <driver/screenshot.h>
#include <system/debug.h>
#include <system/helpers.h>
#include <sys/socket.h>
#include <sys/un.h>
#ifdef IOC_IR_SET_PRI_PROTOCOL
/* define constants instead of #ifdef'ing the corresponding code.
@@ -155,8 +160,10 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] =
{
{LOCALE_KEYBINDINGMENU_TVRADIOMODE, &g_settings.key_tvradio_mode, LOCALE_MENU_HINT_KEY_TVRADIOMODE },
{LOCALE_KEYBINDINGMENU_POWEROFF, &g_settings.key_power_off, LOCALE_MENU_HINT_KEY_POWEROFF },
{LOCALE_KEYBINDINGMENU_PAGEUP, &g_settings.key_channelList_pageup, LOCALE_MENU_HINT_KEY_PAGEUP },
{LOCALE_KEYBINDINGMENU_PAGEDOWN, &g_settings.key_channelList_pagedown, LOCALE_MENU_HINT_KEY_PAGEDOWN },
{LOCALE_KEYBINDINGMENU_PAGEUP, &g_settings.key_pageup, LOCALE_MENU_HINT_KEY_PAGEUP },
{LOCALE_KEYBINDINGMENU_PAGEDOWN, &g_settings.key_pagedown, LOCALE_MENU_HINT_KEY_PAGEDOWN },
{LOCALE_KEYBINDINGMENU_VOLUMEUP, &g_settings.key_volumeup, LOCALE_MENU_HINT_KEY_VOLUMEUP },
{LOCALE_KEYBINDINGMENU_VOLUMEDOWN, &g_settings.key_volumedown, LOCALE_MENU_HINT_KEY_VOLUMEDOWN },
{LOCALE_EXTRA_KEY_LIST_START, &g_settings.key_list_start, LOCALE_MENU_HINT_KEY_LIST_START },
{LOCALE_EXTRA_KEY_LIST_END, &g_settings.key_list_end, LOCALE_MENU_HINT_KEY_LIST_END },
{LOCALE_KEYBINDINGMENU_CANCEL, &g_settings.key_channelList_cancel, LOCALE_MENU_HINT_KEY_CANCEL },
@@ -181,17 +188,24 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] =
{LOCALE_MPKEY_SUBTITLE, &g_settings.mpkey_subtitle, LOCALE_MENU_HINT_KEY_MPSUBTITLE },
{LOCALE_MPKEY_TIME, &g_settings.mpkey_time, LOCALE_MENU_HINT_KEY_MPTIME },
{LOCALE_MPKEY_BOOKMARK, &g_settings.mpkey_bookmark, LOCALE_MENU_HINT_KEY_MPBOOKMARK },
{LOCALE_MPKEY_GOTO, &g_settings.mpkey_goto, NONEXISTANT_LOCALE},
//{LOCALE_MPKEY_NEXT3DMODE, &g_settings.mpkey_next3dmode, NONEXISTANT_LOCALE},
{LOCALE_MPKEY_NEXT_REPEAT_MODE, &g_settings.mpkey_next_repeat_mode, NONEXISTANT_LOCALE},
//{LOCALE_MPKEY_VTXT, &g_settings.mpkey_vtxt, NONEXISTANT_LOCALE},
{LOCALE_EXTRA_KEY_TIMESHIFT, &g_settings.key_timeshift, LOCALE_MENU_HINT_KEY_MPTIMESHIFT },
{LOCALE_MPKEY_PLUGIN, &g_settings.mpkey_plugin, LOCALE_MENU_HINT_KEY_MPPLUGIN },
{LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, LOCALE_MENU_HINT_KEY_PLUGIN },
{LOCALE_EXTRA_KEY_UNLOCK, &g_settings.key_unlock, LOCALE_MENU_HINT_KEY_UNLOCK},
{LOCALE_EXTRA_KEY_HELP, &g_settings.key_help, NONEXISTANT_LOCALE},
{LOCALE_EXTRA_KEY_NEXT43MODE, &g_settings.key_next43mode, NONEXISTANT_LOCALE},
{LOCALE_EXTRA_KEY_SWITCHFORMAT, &g_settings.key_switchformat, NONEXISTANT_LOCALE},
{LOCALE_EXTRA_KEY_SCREENSHOT, &g_settings.key_screenshot, LOCALE_MENU_HINT_KEY_SCREENSHOT },
{LOCALE_EXTRA_KEY_PIP_CLOSE, &g_settings.key_pip_close, LOCALE_MENU_HINT_KEY_PIP_CLOSE },
{LOCALE_EXTRA_KEY_PIP_SETUP, &g_settings.key_pip_setup, LOCALE_MENU_HINT_KEY_PIP_SETUP },
{LOCALE_EXTRA_KEY_PIP_SWAP, &g_settings.key_pip_swap, LOCALE_MENU_HINT_KEY_PIP_CLOSE },
{LOCALE_EXTRA_KEY_FORMAT_MODE, &g_settings.key_format_mode_active, LOCALE_MENU_HINT_KEY_FORMAT_MODE_ACTIVE },
{LOCALE_EXTRA_KEY_PIC_MODE, &g_settings.key_pic_mode_active, LOCALE_MENU_HINT_KEY_PIC_MODE_ACTIVE },
{LOCALE_EXTRA_KEY_PIC_SIZE, &g_settings.key_pic_size_active, LOCALE_MENU_HINT_KEY_PIC_SIZE_ACTIVE }
{LOCALE_EXTRA_KEY_PIC_SIZE, &g_settings.key_pic_size_active, LOCALE_MENU_HINT_KEY_PIC_SIZE_ACTIVE },
{LOCALE_EXTRA_KEY_RECORD, &g_settings.key_record, LOCALE_MENU_HINT_KEY_RECORD },
};
// used by driver/rcinput.cpp
@@ -205,11 +219,15 @@ bool checkLongPress(uint32_t key)
for (unsigned int i = 0; i < CKeybindSetup::KEYBINDS_COUNT; i++)
if ((uint32_t)*key_settings[i].keyvalue_p == key)
return true;
for (std::vector<SNeutrinoSettings::usermenu_t*>::iterator it = g_settings.usermenu.begin(); it != g_settings.usermenu.end(); ++it)
if (*it && (uint32_t)((*it)->key) == key)
return true;
return false;
}
int CKeybindSetup::showKeySetup()
{
#if !HAVE_SPARK_HARDWARE
//save original rc hardware selection and initialize text strings
int org_remote_control_hardware = g_settings.remote_control_hardware;
char RC_HW_str[4][32];
@@ -219,68 +237,88 @@ int CKeybindSetup::showKeySetup()
snprintf(RC_HW_str[CRCInput::RC_HW_TRIPLEDRAGON], sizeof(RC_HW_str[CRCInput::RC_HW_TRIPLEDRAGON])-1, "%s", g_Locale->getText(LOCALE_KEYBINDINGMENU_REMOTECONTROL_HARDWARE_TRIPLEDRAGON));
char RC_HW_msg[256];
snprintf(RC_HW_msg, sizeof(RC_HW_msg)-1, "%s", g_Locale->getText(LOCALE_KEYBINDINGMENU_REMOTECONTROL_HARDWARE_MSG_PART1));
#endif
//keysetup menu
CMenuWidget* keySettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP);
keySettings->addIntroItems(LOCALE_MAINSETTINGS_KEYBINDING);
keySettings->addIntroItems(LOCALE_MAINSETTINGS_KEYBINDING, LOCALE_KEYBINDINGMENU_HEAD);
//keybindings menu
CMenuWidget bindSettings(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING);
//keybindings
for (int i = 0; i < KEYBINDS_COUNT; i++)
keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS);
keychooser[i] = new CKeyChooser((unsigned int *) key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS);
int shortcut = 1;
showKeyBindSetup(&bindSettings);
CMenuForwarder * mf;
mf = new CMenuForwarder(LOCALE_KEYBINDINGMENU_HEAD, true, NULL, &bindSettings, NULL, CRCInput::convertDigitToKey(shortcut++));
mf = new CMenuForwarder(LOCALE_KEYBINDINGMENU_EDIT, true, NULL, &bindSettings, NULL, CRCInput::RC_red);
mf->setHint("", LOCALE_MENU_HINT_KEY_BINDING);
keySettings->addItem(mf);
keySettings->addItem(GenericMenuSeparator);
mf = new CMenuForwarder(LOCALE_EXTRA_LOADKEYS, true, NULL, this, "loadkeys", CRCInput::convertDigitToKey(shortcut++));
mf = new CMenuForwarder(LOCALE_EXTRA_LOADKEYS, true, NULL, this, "loadkeys", CRCInput::RC_green);
mf->setHint("", LOCALE_MENU_HINT_KEY_LOAD);
keySettings->addItem(mf);
mf = new CMenuForwarder(LOCALE_EXTRA_SAVEKEYS, true, NULL, this, "savekeys", CRCInput::convertDigitToKey(shortcut++));
mf = new CMenuForwarder(LOCALE_EXTRA_SAVEKEYS, true, NULL, this, "savekeys", CRCInput::RC_yellow);
mf->setHint("", LOCALE_MENU_HINT_KEY_SAVE);
keySettings->addItem(mf);
//rc tuning
keySettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_RC));
if (RC_HW_SELECT) {
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_REMOTECONTROL_HARDWARE, &g_settings.remote_control_hardware, KEYBINDINGMENU_REMOTECONTROL_HARDWARE_OPTIONS, KEYBINDINGMENU_REMOTECONTROL_HARDWARE_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_KEY_HARDWARE);
keySettings->addItem(mc);
}
keySettings->addItem(GenericMenuSeparatorLine);
//rc tuning
std::string ms_number_format("%d ");
ms_number_format += g_Locale->getText(LOCALE_UNIT_SHORT_MILLISECOND);
CMenuOptionNumberChooser *cc;
int shortcut = 1;
cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION,
&g_settings.longkeypress_duration, true, LONGKEYPRESS_OFF, 9999, NULL, CRCInput::convertDigitToKey(shortcut++), NULL, 0, LONGKEYPRESS_OFF, LOCALE_OPTIONS_OFF);
&g_settings.longkeypress_duration, true, LONGKEYPRESS_OFF, 9999, NULL,
CRCInput::convertDigitToKey(shortcut++), NULL, 0, LONGKEYPRESS_OFF, LOCALE_OPTIONS_OFF);
cc->setNumberFormat(ms_number_format);
cc->setNumericInput(true);
cc->setHint("", LOCALE_MENU_HINT_LONGKEYPRESS_DURATION);
keySettings->addItem(cc);
#if HAVE_SPARK_HARDWARE
g_settings.accept_other_remotes = access("/etc/lircd_predata_lock", R_OK) ? 1 : 0;
CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_ACCEPT_OTHER_REMOTES,
&g_settings.accept_other_remotes, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this,
CRCInput::convertDigitToKey(shortcut++));
mc->setHint("", LOCALE_MENU_HINT_ACCEPT_OTHER_REMOTES);
keySettings->addItem(mc);
#endif
#if !HAVE_SPARK_HARDWARE
if (RC_HW_SELECT) {
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_REMOTECONTROL_HARDWARE,
&g_settings.remote_control_hardware, KEYBINDINGMENU_REMOTECONTROL_HARDWARE_OPTIONS, KEYBINDINGMENU_REMOTECONTROL_HARDWARE_OPTION_COUNT, true, NULL,
CRCInput::convertDigitToKey(shortcut++));
mc->setHint("", LOCALE_MENU_HINT_KEY_HARDWARE);
keySettings->addItem(mc);
}
#endif
cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCK,
&g_settings.repeat_blocker, true, 0, 999);
&g_settings.repeat_blocker, true, 0, 999, NULL,
CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF);
cc->setNumberFormat(ms_number_format);
cc->setNumericInput(true);
cc->setHint("", LOCALE_MENU_HINT_KEY_REPEATBLOCK);
keySettings->addItem(cc);
cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC,
&g_settings.repeat_genericblocker, true, 0, 999);
&g_settings.repeat_genericblocker, true, 0, 999, NULL,
CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF);
cc->setNumberFormat(ms_number_format);
cc->setNumericInput(true);
cc->setHint("", LOCALE_MENU_HINT_KEY_REPEATBLOCKGENERIC);
keySettings->addItem(cc);
int res = keySettings->exec(NULL, "");
#if !HAVE_SPARK_HARDWARE
//check if rc hardware selection has changed before leaving the menu
if (org_remote_control_hardware != g_settings.remote_control_hardware) {
g_RCInput->CRCInput::set_rc_hw();
@@ -293,6 +331,7 @@ int CKeybindSetup::showKeySetup()
g_RCInput->CRCInput::set_rc_hw();
}
}
#endif
delete keySettings;
for (int i = 0; i < KEYBINDS_COUNT; i++)
@@ -312,33 +351,58 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
//modes
CMenuWidget* bindSettings_modes = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MODES);
showKeyBindModeSetup(bindSettings_modes);
mf = new CMenuDForwarder(LOCALE_KEYBINDINGMENU_MODECHANGE, true, NULL, bindSettings_modes, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mf = new CMenuDForwarder(LOCALE_KEYBINDINGMENU_MODECHANGE, true, NULL, bindSettings_modes, NULL, CRCInput::RC_red);
mf->setHint("", LOCALE_MENU_HINT_KEY_MODECHANGE);
bindSettings->addItem(mf);
// channellist keybindings
CMenuWidget* bindSettings_chlist = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_CHANNELLIST);
showKeyBindChannellistSetup(bindSettings_chlist);
mf = new CMenuDForwarder(LOCALE_KEYBINDINGMENU_CHANNELLIST, true, NULL, bindSettings_chlist, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf = new CMenuDForwarder(LOCALE_KEYBINDINGMENU_CHANNELLIST, true, NULL, bindSettings_chlist, NULL, CRCInput::RC_green);
mf->setHint("", LOCALE_MENU_HINT_KEY_CHANNELLIST);
bindSettings->addItem(mf);
// Zapping keys quickzap
CMenuWidget* bindSettings_qzap = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_QUICKZAP);
showKeyBindQuickzapSetup(bindSettings_qzap);
mf = new CMenuDForwarder(LOCALE_KEYBINDINGMENU_QUICKZAP, true, NULL, bindSettings_qzap, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);
mf = new CMenuDForwarder(LOCALE_KEYBINDINGMENU_QUICKZAP, true, NULL, bindSettings_qzap, NULL, CRCInput::RC_yellow);
mf->setHint("", LOCALE_MENU_HINT_KEY_QUICKZAP);
bindSettings->addItem(mf);
//movieplayer
CMenuWidget* bindSettings_mplayer = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MOVIEPLAYER);
showKeyBindMovieplayerSetup(bindSettings_mplayer);
mf = new CMenuDForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, bindSettings_mplayer, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE);
mf = new CMenuDForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, bindSettings_mplayer, NULL, CRCInput::RC_blue);
mf->setHint("", LOCALE_MENU_HINT_KEY_MOVIEPLAYER);
bindSettings->addItem(mf);
//video
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_VIDEO));
for (int i = NKEY_NEXT43MODE; i <= NKEY_SWITCHFORMAT; i++) {
mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
mf->setHint("", key_settings[i].hint);
bindSettings->addItem(mf);
}
//navigation
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_NAVIGATION));
for (int i = NKEY_PAGE_UP; i <= NKEY_PAGE_DOWN; i++) {
mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
mf->setHint("", key_settings[i].hint);
bindSettings->addItem(mf);
}
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_EXTRA_MENU_LEFT_EXIT, &g_settings.menu_left_exit, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_KEY_LEFT_EXIT);
bindSettings->addItem(mc);
//volume
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_VOLUME));
for (int i = NKEY_VOLUME_UP; i <= NKEY_VOLUME_DOWN; i++)
bindSettings->addItem(new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]));
//misc
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC));
//bindSettings->addItem(new CMenuForwarder(keydescription[NKEY_PLUGIN], true, NULL, keychooser[NKEY_PLUGIN]));
//Special keys
CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL);
@@ -347,41 +411,29 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
mf->setHint("", LOCALE_MENU_HINT_KEY_SPECIAL_ACTIVE);
bindSettings->addItem(mf);
//onekey-plugin
mf = new CMenuForwarder(key_settings[KEY_PLUGIN].keydescription, true, keychooser[KEY_PLUGIN]->getKeyName(), keychooser[KEY_PLUGIN]);
mf->setHint("", key_settings[KEY_PLUGIN].hint);
bindSettings->addItem(mf);
// unlock
mf = new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]);
mf->setHint("", key_settings[KEY_UNLOCK].hint);
mf = new CMenuForwarder(key_settings[NKEY_UNLOCK].keydescription, true, keychooser[NKEY_UNLOCK]->getKeyName(), keychooser[NKEY_UNLOCK]);
mf->setHint("", key_settings[NKEY_UNLOCK].hint);
bindSettings->addItem(mf);
// screenshot
mf = new CMenuForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]);
mf->setHint("", key_settings[KEY_SCREENSHOT].hint);
mf = new CMenuForwarder(key_settings[NKEY_SCREENSHOT].keydescription, true, keychooser[NKEY_SCREENSHOT]->getKeyName(), keychooser[NKEY_SCREENSHOT]);
mf->setHint("", key_settings[NKEY_SCREENSHOT].hint);
bindSettings->addItem(mf);
#ifdef ENABLE_PIP
// pip
mf = new CMenuForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]);
mf->setHint("", key_settings[KEY_PIP_CLOSE].hint);
mf = new CMenuForwarder(key_settings[NKEY_PIP_CLOSE].keydescription, true, keychooser[NKEY_PIP_CLOSE]->getKeyName(), keychooser[NKEY_PIP_CLOSE]);
mf->setHint("", key_settings[NKEY_PIP_CLOSE].hint);
bindSettings->addItem(mf);
mf = new CMenuForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]);
mf->setHint("", key_settings[KEY_PIP_SETUP].hint);
mf = new CMenuForwarder(key_settings[NKEY_PIP_SETUP].keydescription, true, keychooser[NKEY_PIP_SETUP]->getKeyName(), keychooser[NKEY_PIP_SETUP]);
mf->setHint("", key_settings[NKEY_PIP_SETUP].hint);
bindSettings->addItem(mf);
mf = new CMenuForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]);
mf->setHint("", key_settings[KEY_PIP_SWAP].hint);
mf = new CMenuForwarder(key_settings[NKEY_PIP_SWAP].keydescription, true, keychooser[NKEY_PIP_SWAP]->getKeyName(), keychooser[NKEY_PIP_SWAP]);
mf->setHint("", key_settings[NKEY_PIP_SWAP].hint);
bindSettings->addItem(mf);
#endif
//bindSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_ZAP_CYCLE, &g_settings.zap_cycle, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
// left-exit, FIXME is this option really change anything ??
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_EXTRA_MENU_LEFT_EXIT, &g_settings.menu_left_exit, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_KEY_LEFT_EXIT);
bindSettings->addItem(mc);
// audio for audio player
mc = new CMenuOptionChooser(LOCALE_EXTRA_AUDIO_RUN_PLAYER, &g_settings.audio_run_player, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_KEY_AUDIO);
bindSettings->addItem(mc);
bindSettings->addItem(new CMenuForwarder(key_settings[NKEY_HELP].keydescription, true, keychooser[NKEY_HELP]->getKeyName(), keychooser[NKEY_HELP]));
bindSettings->addItem(new CMenuForwarder(key_settings[NKEY_RECORD].keydescription, true, keychooser[NKEY_RECORD]->getKeyName(), keychooser[NKEY_RECORD]));
// right key
mc = new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV, &g_settings.mode_left_right_key_tv, KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV_OPTIONS, KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV_COUNT, true);
@@ -395,12 +447,12 @@ void CKeybindSetup::showKeyBindModeSetup(CMenuWidget *bindSettings_modes)
bindSettings_modes->addIntroItems(LOCALE_KEYBINDINGMENU_MODECHANGE);
// tv/radio
mf = new CMenuForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mf->setHint("", key_settings[KEY_TV_RADIO_MODE].hint);
mf = new CMenuForwarder(key_settings[NKEY_TV_RADIO_MODE].keydescription, true, keychooser[NKEY_TV_RADIO_MODE]->getKeyName(), keychooser[NKEY_TV_RADIO_MODE], NULL, CRCInput::RC_red);
mf->setHint("", key_settings[NKEY_TV_RADIO_MODE].hint);
bindSettings_modes->addItem(mf);
mf = new CMenuForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", key_settings[KEY_POWER_OFF].hint);
mf = new CMenuForwarder(key_settings[NKEY_POWER_OFF].keydescription, true, keychooser[NKEY_POWER_OFF]->getKeyName(), keychooser[NKEY_POWER_OFF], NULL, CRCInput::RC_green);
mf->setHint("", key_settings[NKEY_POWER_OFF].hint);
bindSettings_modes->addItem(mf);
}
@@ -411,7 +463,7 @@ void CKeybindSetup::showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist
CMenuOptionChooser *oj = new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_BOUQUETHANDLING, &g_settings.bouquetlist_mode, KEYBINDINGMENU_BOUQUETHANDLING_OPTIONS, KEYBINDINGMENU_BOUQUETHANDLING_OPTION_COUNT, true );
bindSettings_chlist->addItem(oj);
#endif
for (int i = KEY_PAGE_UP; i <= KEY_CURRENT_TRANSPONDER; i++) {
for (int i = NKEY_LIST_START; i <= NKEY_CURRENT_TRANSPONDER; i++) {
CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
mf->setHint("", key_settings[i].hint);
bindSettings_chlist->addItem(mf);
@@ -426,7 +478,7 @@ void CKeybindSetup::showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap)
{
bindSettings_qzap->addIntroItems(LOCALE_KEYBINDINGMENU_QUICKZAP);
for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++) {
for (int i = NKEY_CHANNEL_UP; i <= NKEY_LASTCHANNEL; i++) {
CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
mf->setHint("", key_settings[i].hint);
bindSettings_qzap->addItem(mf);
@@ -437,7 +489,7 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye
{
bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER);
for (int i = MPKEY_REWIND; i <= MPKEY_PLUGIN; i++) {
for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) {
CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
mf->setHint("", key_settings[i].hint);
bindSettings_mplayer->addItem(mf);
@@ -448,7 +500,7 @@ void CKeybindSetup::showKeyBindSpecialSetup(CMenuWidget *bindSettings_special)
{
bindSettings_special->addIntroItems(LOCALE_KEYBINDINGMENU_SPECIAL_ACTIVE);
for (int i = KEY_FORMAT_MODE; i <= KEY_PIC_SIZE; i++) {
for (int i = NKEY_FORMAT_MODE; i <= NKEY_PIC_SIZE; i++) {
CMenuOptionChooser * mf = new CMenuOptionChooser(key_settings[i].keydescription, key_settings[i].keyvalue_p, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
mf->setHint("", key_settings[i].hint);
bindSettings_special->addItem(mf);
@@ -457,6 +509,28 @@ void CKeybindSetup::showKeyBindSpecialSetup(CMenuWidget *bindSettings_special)
bool CKeybindSetup::changeNotify(const neutrino_locale_t OptionName, void * /* data */)
{
#if HAVE_SPARK_HARDWARE
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_KEYBINDINGMENU_ACCEPT_OTHER_REMOTES)) {
struct sockaddr_un sun;
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
strcpy(sun.sun_path, "/var/run/lirc/lircd");
int lircd_sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (lircd_sock > -1) {
if (!connect(lircd_sock, (struct sockaddr *) &sun, sizeof(sun))) {
if (g_settings.accept_other_remotes)
write(lircd_sock, "PREDATA_UNLOCK\n", 16);
else
write(lircd_sock, "PREDATA_LOCK\n", 14);
}
close(lircd_sock);
}
// work around junk data sent by vfd controller
sleep(2);
g_RCInput->clearRCMsg();
return false;
}
#endif
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC) ||
ARE_LOCALES_EQUAL(OptionName, LOCALE_KEYBINDINGMENU_REPEATBLOCK)) {
unsigned int fdelay = g_settings.repeat_blocker;
@@ -466,8 +540,26 @@ bool CKeybindSetup::changeNotify(const neutrino_locale_t OptionName, void * /* d
g_RCInput->repeat_block_generic = xdelay * 1000;
int fd = g_RCInput->getFileHandle();
#ifdef HAVE_COOL_HARDWARE
ioctl(fd, IOC_IR_SET_F_DELAY, fdelay);
ioctl(fd, IOC_IR_SET_X_DELAY, xdelay);
#else
/* if we have a good input device, we don't need the private ioctl above */
struct input_event ie;
memset(&ie, 0, sizeof(ie));
ie.type = EV_REP;
/* increase by 10 ms to trick the repeat checker code in the
* rcinput loop into accepting the key event... */
ie.value = fdelay + 10;
ie.code = REP_DELAY;
if (write(fd, &ie, sizeof(ie)) == -1)
perror("CKeySetupNotifier::changeNotify REP_DELAY");
ie.value = xdelay + 10;
ie.code = REP_PERIOD;
if (write(fd, &ie, sizeof(ie)) == -1)
perror("CKeySetupNotifier::changeNotify REP_PERIOD");
#endif
}
return false;
}