From 0a98143e4986282bcd0569b747c3c29505e62caf Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 9 Feb 2016 12:05:28 +0100 Subject: [PATCH] - moviebrowser: add possibility to search for movies in SMS-style This feature has to be activated first. Menu -> Settings -> Key Setup -> Edit -> My recordings In moviebrowser press three times key "3" to select first movie title starting with a "F" or press two times "6" to select first movie title starting with a "N". The new item in keybind-setup is the first step to introduce user- assignable keys in moviebrowser. So finally the horrible hotkeys for the cutting functions can be removed and/or replaced. --- data/locale/deutsch.locale | 7 +++-- data/locale/english.locale | 7 +++-- src/gui/keybind_setup.cpp | 21 +++++++++++-- src/gui/keybind_setup.h | 1 + src/gui/moviebrowser.cpp | 64 ++++++++++++++++++++++++++++++++++++++ src/neutrino.cpp | 2 ++ src/neutrino_menue.h | 1 + src/system/locals.h | 5 ++- src/system/locals_intern.h | 5 ++- src/system/settings.h | 1 + 10 files changed, 106 insertions(+), 8 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 109271a93..a950a6ed2 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -464,7 +464,8 @@ extra.saveconfig Neutrino-HD Einstellungen: Sichern als extra.savekeys Speichere Tastenbelegung als extra.scrambled_message Verschlüsselung melden extra.show_mute_icon Mute-Icon bei Lautstärke 0 -extra.sms_channel SMS-Modus Kanal +extra.sms_channel SMS-Modus bei Kanalsuche +extra.sms_movie SMS-Modus bei Filmsuche extra.south Süden extra.start_tostandby Standby nach Boxstart extra.temp_timeshift Temporäres Timeshift @@ -1070,7 +1071,6 @@ menu.hint_key_binding In diesem Menü können Einstellungen für die Tasten der menu.hint_key_bouquetdown Weisen Sie eine Taste für das Zurückblättern in den Bouquets zu menu.hint_key_bouquetup Weisen Sie eine Taste für das Vorblättern in den Bouquets zu menu.hint_key_cancel Weisen Sie eine Taste für das Schließen der Menüs zu -menu.hint_key_channel_sms Wenn es aktiviert ist, können Sie die Nummern-Tasten in der Kanalliste nutzen, um im SMS-Style zu suchen menu.hint_key_channeldown Weisen Sie eine Taste für das Herunterschalten in der Kanalliste zu menu.hint_key_channellist Konfigurieren Sie die Tastenbelegung für die Kanalliste menu.hint_key_channelup Weisen Sie eine Taste für das Hochschalten in der Kanalliste zu @@ -1083,6 +1083,7 @@ menu.hint_key_list_end Weisen Sie eine Taste für den Wechsel zum Listenende zu menu.hint_key_list_start Weisen Sie eine Taste für den Wechsel zum Listenanfang zu menu.hint_key_load Laden Sie Ihre Tastenbelegungen aus einer Datei menu.hint_key_modechange Wählen Sie eine Taste für den Wechsel in den TV/Radio-Modus und für den Standby +menu.hint_key_moviebrowser Konfigurieren Sie die Tastenbelegung für den Moviebrowser menu.hint_key_movieplayer Konfigurieren Sie die Tastenbelegung für den Movieplayer menu.hint_key_mpaudio Weisen Sie eine Taste zu, um die Tonspuren in ihren Aufnahmen zu wechseln menu.hint_key_mpbookmark Weisen Sie eine Taste zu, um Merker in ihren Aufnahmen für den Neustart zu setzen @@ -1370,6 +1371,8 @@ menu.hint_shutdown_rcdelay Aktiviert den Deep-Standby, wenn die Power-Taste län menu.hint_shutdown_real Aktiviert den Standby-Modus. Ist diese Option deaktiviert, fährt die Box in den Deep-Standby menu.hint_sleeptimer Zeitschaltuhr auf Ihrer Box aktivieren\nDie Box fährt dann in den Standby-Modus menu.hint_sleeptimer_min Voreinstellung der Zeitschaltuhr auf Ihrer Box +menu.hint_sms_channel Wenn es aktiviert ist, können Sie die Nummern-Tasten in der Kanalliste nutzen, um im SMS-Style zu suchen +menu.hint_sms_movie Wenn es aktiviert ist, können Sie die Nummern-Tasten im Moviebrowser nutzen, um im SMS-Style zu suchen menu.hint_soft_restart Neustarten von Neutrino-HD, ohne die Box neu zu starten menu.hint_softupdate_check Im Internet nach verfügbaren Updates suchen, herunterladen und installieren menu.hint_softupdate_check_local Lokal nach verfügbaren Updates suchen und installieren diff --git a/data/locale/english.locale b/data/locale/english.locale index 025a06954..731836ed2 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -464,7 +464,8 @@ extra.saveconfig Neutrino-HD Settings: Save as extra.savekeys Save keys as extra.scrambled_message Scrambled Message extra.show_mute_icon mute-icon at volume 0 -extra.sms_channel sms-mode channel +extra.sms_channel SMS-mode channel +extra.sms_movie SMS-mode movie extra.south South extra.start_tostandby Startup to standby extra.temp_timeshift Temporary timeshift @@ -1070,7 +1071,6 @@ menu.hint_key_binding Re-define keys used for common operations menu.hint_key_bouquetdown Assign button to switch channel list\nto previous bouquet menu.hint_key_bouquetup Assign button to switch channel list\nto next bouquet menu.hint_key_cancel Assign button to close GUI window -menu.hint_key_channel_sms If enabled, numeric buttons in channel list\nused to search channel in SMS style menu.hint_key_channeldown Assign button for fast switch to previous\nchannel in channel list menu.hint_key_channellist Configure keybingdings for channel list menu.hint_key_channelup Assign button for fast switch to next\nchannel in channel list @@ -1083,6 +1083,7 @@ menu.hint_key_list_end Assign button to go do list end menu.hint_key_list_start Assign button to go to list start menu.hint_key_load Load keybindings from file menu.hint_key_modechange Change TV/Radio mode and standby keys +menu.hint_key_moviebrowser Configure keybingdings for movie browser menu.hint_key_movieplayer Configure keybingdings for movie player menu.hint_key_mpaudio Assign button to show audio selection\nin record/file playback mode menu.hint_key_mpbookmark Assign button to create bookmark\nwhile playing record @@ -1370,6 +1371,8 @@ menu.hint_shutdown_rcdelay Enable deep-standby, if power button\npressed more th menu.hint_shutdown_real Enable soft-standby mode\nIf disabled, power button put box to deep-standby menu.hint_sleeptimer Set timer to put your box\nin sleep mode menu.hint_sleeptimer_min Default setting for sleeptimer +menu.hint_sms_channel If enabled, numeric buttons in channel list used to search channel in SMS style +menu.hint_sms_movie If enabled, numeric buttons in moviebrowser used to search movie in SMS style menu.hint_soft_restart Restart Neutrino-HD without reboot menu.hint_softupdate_check Check online update, download and flash firmware menu.hint_softupdate_check_local Select and flash firmware from local file diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index dd6db5654..e2198abb6 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -375,6 +375,13 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) mf->setHint("", LOCALE_MENU_HINT_KEY_MOVIEPLAYER); bindSettings->addItem(mf); + //moviebrowser + CMenuWidget* bindSettings_mbrowser = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MOVIEBROWSER); + showKeyBindMoviebrowserSetup(bindSettings_mbrowser); + mf = new CMenuDForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, bindSettings_mbrowser, NULL, CRCInput::RC_nokey); + mf->setHint("", LOCALE_MENU_HINT_KEY_MOVIEBROWSER); + bindSettings->addItem(mf); + //video bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_VIDEO)); for (int i = NKEY_NEXT43MODE; i <= NKEY_SWITCHFORMAT; i++) { @@ -440,7 +447,8 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) 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 + bindSettings->addItem(new CMenuSeparator()); + // left/right keys 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); mc->setHint("", LOCALE_MENU_HINT_KEY_RIGHT); bindSettings->addItem(mc); @@ -475,7 +483,7 @@ void CKeybindSetup::showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist } CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_EXTRA_SMS_CHANNEL, &g_settings.sms_channel, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - mc->setHint("", LOCALE_MENU_HINT_KEY_CHANNEL_SMS); + mc->setHint("", LOCALE_MENU_HINT_SMS_CHANNEL); bindSettings_chlist->addItem(mc); } @@ -501,6 +509,15 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye } } +void CKeybindSetup::showKeyBindMoviebrowserSetup(CMenuWidget *bindSettings_mbrowser) +{ + bindSettings_mbrowser->addIntroItems(LOCALE_MOVIEBROWSER_HEAD); + + CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_EXTRA_SMS_MOVIE, &g_settings.sms_movie, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_SMS_MOVIE); + bindSettings_mbrowser->addItem(mc); +} + void CKeybindSetup::showKeyBindSpecialSetup(CMenuWidget *bindSettings_special) { bindSettings_special->addIntroItems(LOCALE_KEYBINDINGMENU_SPECIAL_ACTIVE); diff --git a/src/gui/keybind_setup.h b/src/gui/keybind_setup.h index 894b45bc1..0ee68cf79 100644 --- a/src/gui/keybind_setup.h +++ b/src/gui/keybind_setup.h @@ -105,6 +105,7 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver void showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist); void showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap); void showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplayer); + void showKeyBindMoviebrowserSetup(CMenuWidget *bindSettings_mbrowser); void showKeyBindSpecialSetup(CMenuWidget *bindSettings_special); public: diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 272e880c5..35caad7f1 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -83,6 +83,7 @@ typedef struct dirent64 dirent_struct; #define TRACE printf #define NUMBER_OF_MOVIES_LAST 40 // This is the number of movies shown in last recored and last played list +#define MOVIE_SMSKEY_TIMEOUT 800 #define MESSAGEBOX_BROWSER_ROW_ITEM_COUNT 20 const CMenuOptionChooser::keyval MESSAGEBOX_BROWSER_ROW_ITEM[MESSAGEBOX_BROWSER_ROW_ITEM_COUNT] = @@ -1790,6 +1791,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) { //TRACE("[mb]->onButtonPressMainFrame: %d\n",msg); bool result = true; + neutrino_msg_data_t data; if (msg == CRCInput::RC_home) { @@ -1875,6 +1877,68 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) } } + else if (g_settings.sms_movie && (msg >= CRCInput::RC_1) && (msg <= CRCInput::RC_9)) + { + unsigned char smsKey = 0; + SMSKeyInput smsInput; + smsInput.setTimeout(MOVIE_SMSKEY_TIMEOUT); + + std::vector *current_list = NULL; + CListFrame *current_frame = NULL; + + if (m_windowFocus == MB_FOCUS_BROWSER) + { + current_list = &m_vHandleBrowserList; + current_frame = m_pcBrowser; + } + else if (m_windowFocus == MB_FOCUS_LAST_PLAY) + { + current_list = &m_vHandlePlayList; + current_frame = m_pcLastPlay; + } + else if (m_windowFocus == MB_FOCUS_LAST_RECORD) + { + current_list = &m_vHandleRecordList; + current_frame = m_pcLastRecord; + } + + if (current_list == NULL || current_frame == NULL) + return result; + + do { + smsKey = smsInput.handleMsg(msg); + printf("SMS new key: %c\n", smsKey); + g_RCInput->getMsg_ms(&msg, &data, MOVIE_SMSKEY_TIMEOUT-100); + } while ((msg >= CRCInput::RC_1) && (msg <= CRCInput::RC_9)); + + int selected = current_frame->getSelectedLine(); + if (msg == CRCInput::RC_timeout || msg == CRCInput::RC_nokey) { + uint32_t i; + for (i = selected+1; i < (*current_list).size(); i++) { + + char firstCharOfTitle = (*current_list)[i]->epgTitle.c_str()[0]; + if (tolower(firstCharOfTitle) == smsKey) { + printf("SMS found selected=%d i=%d \"%s\"\n", selected, i, (*current_list)[i]->epgTitle.c_str()); + break; + } + } + if (i >= (*current_list).size()) { + for (i = 0; i < (*current_list).size(); i++) { + char firstCharOfTitle = (*current_list)[i]->epgTitle.c_str()[0]; + if (tolower(firstCharOfTitle) == smsKey) { + printf("SMS found selected=%d i=%d \"%s\"\n", selected, i, (*current_list)[i]->epgTitle.c_str()); + break; + } + } + } + if (i < (*current_list).size()) { + current_frame->setSelectedLine(i); + updateMovieSelection(); + } + + smsInput.resetOldKey(); + } + } // just here to stay backward compatible with these horrible key assignments else if (msg == CRCInput::RC_radio) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d75cf2263..d3466e572 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4208,6 +4208,7 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.bouquetlist_mode = tconfig.getInt32( "bouquetlist_mode", 0 ); g_settings.sms_channel = tconfig.getInt32( "sms_channel", 0 ); + g_settings.sms_movie = tconfig.getInt32( "sms_movie", 0 ); g_settings.mode_left_right_key_tv = tconfig.getInt32( "mode_left_right_key_tv", SNeutrinoSettings::ZAP); g_settings.key_help = tconfig.getInt32( "key_help", CRCInput::RC_help ); @@ -4284,6 +4285,7 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "bouquetlist_mode", g_settings.bouquetlist_mode ); tconfig.setInt32( "sms_channel", g_settings.sms_channel ); + tconfig.setInt32( "sms_movie", g_settings.sms_movie ); tconfig.setInt32( "mode_left_right_key_tv", g_settings.mode_left_right_key_tv ); tconfig.setInt32( "key_help", g_settings.key_help ); diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 1318d7402..735c88ee4 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -102,6 +102,7 @@ enum MN_WIDGET_ID MN_WIDGET_ID_KEYSETUP_KEYBINDING_CHANNELLIST, MN_WIDGET_ID_KEYSETUP_KEYBINDING_QUICKZAP, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MOVIEPLAYER, + MN_WIDGET_ID_KEYSETUP_KEYBINDING_MOVIEBROWSER, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL, //picture viewer setup diff --git a/src/system/locals.h b/src/system/locals.h index 0bde8d6b9..72843b948 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -492,6 +492,7 @@ typedef enum LOCALE_EXTRA_SCRAMBLED_MESSAGE, LOCALE_EXTRA_SHOW_MUTE_ICON, LOCALE_EXTRA_SMS_CHANNEL, + LOCALE_EXTRA_SMS_MOVIE, LOCALE_EXTRA_SOUTH, LOCALE_EXTRA_START_TOSTANDBY, LOCALE_EXTRA_TEMP_TIMESHIFT, @@ -1097,7 +1098,6 @@ typedef enum LOCALE_MENU_HINT_KEY_BOUQUETDOWN, LOCALE_MENU_HINT_KEY_BOUQUETUP, LOCALE_MENU_HINT_KEY_CANCEL, - LOCALE_MENU_HINT_KEY_CHANNEL_SMS, LOCALE_MENU_HINT_KEY_CHANNELDOWN, LOCALE_MENU_HINT_KEY_CHANNELLIST, LOCALE_MENU_HINT_KEY_CHANNELUP, @@ -1110,6 +1110,7 @@ typedef enum LOCALE_MENU_HINT_KEY_LIST_START, LOCALE_MENU_HINT_KEY_LOAD, LOCALE_MENU_HINT_KEY_MODECHANGE, + LOCALE_MENU_HINT_KEY_MOVIEBROWSER, LOCALE_MENU_HINT_KEY_MOVIEPLAYER, LOCALE_MENU_HINT_KEY_MPAUDIO, LOCALE_MENU_HINT_KEY_MPBOOKMARK, @@ -1397,6 +1398,8 @@ typedef enum LOCALE_MENU_HINT_SHUTDOWN_REAL, LOCALE_MENU_HINT_SLEEPTIMER, LOCALE_MENU_HINT_SLEEPTIMER_MIN, + LOCALE_MENU_HINT_SMS_CHANNEL, + LOCALE_MENU_HINT_SMS_MOVIE, LOCALE_MENU_HINT_SOFT_RESTART, LOCALE_MENU_HINT_SOFTUPDATE_CHECK, LOCALE_MENU_HINT_SOFTUPDATE_CHECK_LOCAL, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index bc5c07f62..897546fb2 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -492,6 +492,7 @@ const char * locale_real_names[] = "extra.scrambled_message", "extra.show_mute_icon", "extra.sms_channel", + "extra.sms_movie", "extra.south", "extra.start_tostandby", "extra.temp_timeshift", @@ -1097,7 +1098,6 @@ const char * locale_real_names[] = "menu.hint_key_bouquetdown", "menu.hint_key_bouquetup", "menu.hint_key_cancel", - "menu.hint_key_channel_sms", "menu.hint_key_channeldown", "menu.hint_key_channellist", "menu.hint_key_channelup", @@ -1110,6 +1110,7 @@ const char * locale_real_names[] = "menu.hint_key_list_start", "menu.hint_key_load", "menu.hint_key_modechange", + "menu.hint_key_moviebrowser", "menu.hint_key_movieplayer", "menu.hint_key_mpaudio", "menu.hint_key_mpbookmark", @@ -1397,6 +1398,8 @@ const char * locale_real_names[] = "menu.hint_shutdown_real", "menu.hint_sleeptimer", "menu.hint_sleeptimer_min", + "menu.hint_sms_channel", + "menu.hint_sms_movie", "menu.hint_soft_restart", "menu.hint_softupdate_check", "menu.hint_softupdate_check_local", diff --git a/src/system/settings.h b/src/system/settings.h index 728ae275b..aaff551f2 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -729,6 +729,7 @@ struct SNeutrinoSettings int hdd_statfs_mode; int zap_cycle; int sms_channel; + int sms_movie; std::string font_file; std::string ttx_font_file;