From ab82c36b9fdc155c9c0730bd3c725b8788583a42 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 9 Feb 2016 15:53:56 +0100 Subject: [PATCH] - moviebrowser: introduce user-assignable keys --- data/locale/deutsch.locale | 4 +++ data/locale/english.locale | 4 +++ src/gui/keybind_setup.cpp | 10 +++++++ src/gui/keybind_setup.h | 4 +++ src/gui/moviebrowser.cpp | 57 +++++++++++++++----------------------- src/neutrino.cpp | 9 ++++++ src/system/locals.h | 4 +++ src/system/locals_intern.h | 4 +++ src/system/settings.h | 5 ++++ 9 files changed, 67 insertions(+), 34 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a950a6ed2..cb17113f4 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -927,6 +927,10 @@ mainsettings.savesettingsnow Einstellungen jetzt speichern mainsettings.savesettingsnow_hint Einstellungen werden jetzt gespeichert,\nbitte warten... mainsettings.timezone Zeitzone mainsettings.video Video +mbkey.copy_onefile Film kopieren +mbkey.copy_several Film kopieren und teilen +mbkey.cut Film schneiden +mbkey.truncate Film kürzen menu.back Zurück menu.cancel Abbrechen menu.hint_a_pic Konfigurieren Sie den Audioplayer und den Bildbetrachter diff --git a/data/locale/english.locale b/data/locale/english.locale index 731836ed2..c248089df 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -927,6 +927,10 @@ mainsettings.savesettingsnow Save settings now mainsettings.savesettingsnow_hint Saving settings,\nplease wait... mainsettings.timezone Timezone mainsettings.video Video +mbkey.copy_onefile Copy movie +mbkey.copy_several Copy and split movie +mbkey.cut Cut movie +mbkey.truncate Truncate movie menu.back Back menu.cancel Cancel menu.hint_a_pic Configure audio player and picture viewer diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index e2198abb6..67956c9e5 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -205,6 +205,10 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] = {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_RECORD, &g_settings.key_record, LOCALE_MENU_HINT_KEY_RECORD }, + {LOCALE_MBKEY_COPY_ONEFILE, &g_settings.mbkey_copy_onefile, NONEXISTANT_LOCALE }, + {LOCALE_MBKEY_COPY_SEVERAL, &g_settings.mbkey_copy_several, NONEXISTANT_LOCALE }, + {LOCALE_MBKEY_CUT, &g_settings.mbkey_cut, NONEXISTANT_LOCALE }, + {LOCALE_MBKEY_TRUNCATE, &g_settings.mbkey_truncate, NONEXISTANT_LOCALE }, }; // used by driver/rcinput.cpp @@ -513,6 +517,12 @@ void CKeybindSetup::showKeyBindMoviebrowserSetup(CMenuWidget *bindSettings_mbrow { bindSettings_mbrowser->addIntroItems(LOCALE_MOVIEBROWSER_HEAD); + for (int i = MBKEY_COPY_ONEFILE; i <= MBKEY_TRUNCATE; i++) { + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + mf->setHint("", key_settings[i].hint); + bindSettings_mbrowser->addItem(mf); + } + 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); diff --git a/src/gui/keybind_setup.h b/src/gui/keybind_setup.h index 0ee68cf79..fc6866b96 100644 --- a/src/gui/keybind_setup.h +++ b/src/gui/keybind_setup.h @@ -90,6 +90,10 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver NKEY_PIC_MODE, NKEY_PIC_SIZE, NKEY_RECORD, + MBKEY_COPY_ONEFILE, + MBKEY_COPY_SEVERAL, + MBKEY_CUT, + MBKEY_TRUNCATE, KEYBINDS_COUNT }; diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index cd2d2c384..38da87f0b 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1789,7 +1789,29 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) bool result = true; neutrino_msg_data_t data; - if (msg == CRCInput::RC_home) + if (msg == (neutrino_msg_t) g_settings.mbkey_copy_onefile + || msg == (neutrino_msg_t) g_settings.mbkey_copy_several + || msg == (neutrino_msg_t) g_settings.mbkey_cut + || msg == (neutrino_msg_t) g_settings.mbkey_truncate) + { + if (msg == (neutrino_msg_t) g_settings.mbkey_copy_onefile) + exec(NULL, "copy_onefile"); + else + if (msg == (neutrino_msg_t) g_settings.mbkey_copy_several) + exec(NULL, "copy_several"); + else + if (msg == (neutrino_msg_t) g_settings.mbkey_cut) + exec(NULL, "cut"); + else + if (msg == (neutrino_msg_t) g_settings.mbkey_truncate) + exec(NULL, "truncate"); + + if (m_doLoadMovies) + loadMovies(); + if (m_doRefresh) + refresh(); + } + else if (msg == CRCInput::RC_home) { if (m_settings.gui == MB_GUI_FILTER) onSetGUIWindow(MB_GUI_MOVIE_INFO); @@ -1935,39 +1957,6 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) smsInput.resetOldKey(); } } - // just here to stay backward compatible with these horrible key assignments - else if (msg == CRCInput::RC_radio) - { - exec(NULL, "copy_onefile"); - if (m_doLoadMovies) - loadMovies(); - if (m_doRefresh) - refresh(); - } - else if (msg == CRCInput::RC_text) - { - exec(NULL, "copy_several"); - if (m_doLoadMovies) - loadMovies(); - if (m_doRefresh) - refresh(); - } - else if (msg == CRCInput::RC_audio) - { - exec(NULL, "cut"); - if (m_doLoadMovies) - loadMovies(); - if (m_doRefresh) - refresh(); - } - else if (msg == CRCInput::RC_games) - { - exec(NULL, "truncate"); - if (m_doLoadMovies) - loadMovies(); - if (m_doRefresh) - refresh(); - } else if (msg == CRCInput::RC_favorites) { if (m_movieSelectionHandler != NULL) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d3466e572..18f3465b9 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4180,6 +4180,10 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.key_bouquet_up = tconfig.getInt32( "key_bouquet_up", CRCInput::RC_right); g_settings.key_bouquet_down = tconfig.getInt32( "key_bouquet_down", CRCInput::RC_left); + g_settings.mbkey_copy_onefile = tconfig.getInt32( "mbkey.copy_onefile", CRCInput::RC_radio ); + g_settings.mbkey_copy_several = tconfig.getInt32( "mbkey.copy_several", CRCInput::RC_text ); + g_settings.mbkey_cut = tconfig.getInt32( "mbkey.cut", CRCInput::RC_audio ); + g_settings.mbkey_truncate = tconfig.getInt32( "mbkey.truncate", CRCInput::RC_games ); g_settings.mpkey_rewind = tconfig.getInt32( "mpkey.rewind", CRCInput::RC_rewind ); g_settings.mpkey_forward = tconfig.getInt32( "mpkey.forward", CRCInput::RC_forward ); @@ -4259,6 +4263,11 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "key_bouquet_up", g_settings.key_bouquet_up ); tconfig.setInt32( "key_bouquet_down", g_settings.key_bouquet_down ); + tconfig.setInt32( "mbkey.copy_onefile", g_settings.mbkey_copy_onefile ); + tconfig.setInt32( "mbkey.copy_several", g_settings.mbkey_copy_several ); + tconfig.setInt32( "mbkey.cut", g_settings.mbkey_cut ); + tconfig.setInt32( "mbkey.truncate", g_settings.mbkey_truncate ); + tconfig.setInt32( "mpkey.rewind", g_settings.mpkey_rewind ); tconfig.setInt32( "mpkey.forward", g_settings.mpkey_forward ); tconfig.setInt32( "mpkey.pause", g_settings.mpkey_pause ); diff --git a/src/system/locals.h b/src/system/locals.h index 72843b948..dcffb5ab5 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -954,6 +954,10 @@ typedef enum LOCALE_MAINSETTINGS_SAVESETTINGSNOW_HINT, LOCALE_MAINSETTINGS_TIMEZONE, LOCALE_MAINSETTINGS_VIDEO, + LOCALE_MBKEY_COPY_ONEFILE, + LOCALE_MBKEY_COPY_SEVERAL, + LOCALE_MBKEY_CUT, + LOCALE_MBKEY_TRUNCATE, LOCALE_MENU_BACK, LOCALE_MENU_CANCEL, LOCALE_MENU_HINT_A_PIC, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 897546fb2..e03de1e5b 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -954,6 +954,10 @@ const char * locale_real_names[] = "mainsettings.savesettingsnow_hint", "mainsettings.timezone", "mainsettings.video", + "mbkey.copy_onefile", + "mbkey.copy_several", + "mbkey.cut", + "mbkey.truncate", "menu.back", "menu.cancel", "menu.hint_a_pic", diff --git a/src/system/settings.h b/src/system/settings.h index aaff551f2..5c2527336 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -491,6 +491,11 @@ struct SNeutrinoSettings int key_volumeup; int key_volumedown; + int mbkey_copy_onefile; + int mbkey_copy_several; + int mbkey_cut; + int mbkey_truncate; + int mpkey_rewind; int mpkey_forward; int mpkey_pause;