From 420af7a4dc2249e4bf9fadb3e3bcd93c49e8f00d Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 5 Sep 2014 17:49:11 +0400 Subject: [PATCH] neutrino: sync keybind and usermenu code with neutrino-mp, code (C) martii --- data/locale/deutsch.locale | 23 + data/locale/english.locale | 27 +- src/driver/volume.cpp | 4 +- src/gui/bedit/bouqueteditor_bouquets.cpp | 8 +- src/gui/bedit/bouqueteditor_channels.cpp | 8 +- src/gui/bouquetlist.cpp | 8 +- src/gui/channellist.cpp | 10 +- src/gui/eventlist.cpp | 12 +- src/gui/infoviewer_bb.cpp | 34 +- src/gui/infoviewer_bb.h | 1 + src/gui/keybind_setup.cpp | 206 +++++-- src/gui/keybind_setup.h | 67 ++- src/gui/miscsettings_menu.cpp | 26 - src/gui/motorcontrol.cpp | 7 + src/gui/moviebrowser.cpp | 12 +- src/gui/movieplayer.cpp | 59 +- src/gui/movieplayer.h | 1 + src/gui/personalize.cpp | 463 +++++++++------- src/gui/personalize.h | 53 +- src/gui/plugins.cpp | 154 ++++-- src/gui/plugins.h | 10 +- src/gui/timerlist.cpp | 10 +- src/gui/upnpbrowser.cpp | 16 +- src/gui/user_menue.cpp | 674 +++++++++++++---------- src/gui/user_menue.h | 9 +- src/gui/user_menue_setup.cpp | 299 ++++++---- src/gui/user_menue_setup.h | 16 +- src/gui/widget/hintbox.cpp | 2 +- src/gui/widget/keychooser.cpp | 9 +- src/gui/widget/keychooser.h | 12 +- src/gui/widget/listbox.cpp | 8 +- src/gui/widget/menue.h | 8 - src/gui/widget/stringinput.cpp | 15 +- src/gui/widget/stringinput_ext.cpp | 10 +- src/neutrino.cpp | 418 +++++++------- src/neutrino_menue.cpp | 3 +- src/neutrino_menue.h | 1 + src/system/helpers.cpp | 53 ++ src/system/helpers.h | 22 +- src/system/locals.h | 23 + src/system/locals_intern.h | 23 + src/system/setting_helpers.cpp | 10 - src/system/setting_helpers.h | 6 - src/system/settings.h | 69 ++- src/zapit/src/frontend.cpp | 2 + 45 files changed, 1767 insertions(+), 1144 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 365784e66..b375781de 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -380,15 +380,19 @@ extra.fec_9_10 9/10 extra.fec_auto Auto extra.key_current_transponder Aktuelle Transponder Taste extra.key_format_mode Videoformat +extra.key_help Hilfe-Taste extra.key_list_end Listenende extra.key_list_start Listenanfang +extra.key_next43mode Nächstes Seitenformat extra.key_pic_mode Bildschirmformat extra.key_pic_size 4:3 Anzeigeverhalten extra.key_pip_close Stop/Start PiP extra.key_pip_setup PiP Konfiguration extra.key_pip_swap Umschalten PiP/live extra.key_plugin Schnellstart-Plugin +extra.key_record Aufnahme-Taste extra.key_screenshot Screenshot Taste +extra.key_switchformat Nächste Auflösung extra.key_timeshift Timeshift extra.key_unlock Entsperrtaste extra.ladirection Breitengrad-Ausrichtung @@ -731,6 +735,7 @@ keybindingmenu.cancel Kanalliste schließen keybindingmenu.channeldown Kanal runter keybindingmenu.channellist Kanalliste keybindingmenu.channelup Kanal hoch +keybindingmenu.edit Bearbeiten keybindingmenu.head Tasten-Belegungen bearbeiten keybindingmenu.lastchannel Letzter Kanal keybindingmenu.longkeypress_duration Langer Tastendruck @@ -741,6 +746,7 @@ keybindingmenu.mode_left_right_key_tv_volume Lautstärkeregelung keybindingmenu.mode_left_right_key_tv_vzap Virtual Zap keybindingmenu.mode_left_right_key_tv_zap Umschalten keybindingmenu.modechange Moduswechsel +keybindingmenu.navigation Navigation keybindingmenu.pagedown Seite weiter keybindingmenu.pageup Seite zurück keybindingmenu.poweroff Standby EIN/AUS @@ -760,6 +766,10 @@ keybindingmenu.special_active Sondertasten keybindingmenu.subchanneldown Unterkanal zurück keybindingmenu.subchannelup Unterkanal weiter keybindingmenu.tvradiomode Fernseh-/Radio-Modus +keybindingmenu.video Video +keybindingmenu.volume Lautstärke +keybindingmenu.volumedown Leiser +keybindingmenu.volumeup Lauter keybindingmenu.zaphistory Zapping-History Bouquet keychooser.head Neue Taste einstellen keychooser.text1 Bitte Taste drücken @@ -1004,6 +1014,7 @@ menu.hint_key_pip_swap Tastenzuordnung zum Umschalten PiP und aktuellem Kanal menu.hint_key_plugin Wählen Sie eine Taste für das Schnellstart-Plugin menu.hint_key_poweroff Wählen Sie eine Taste für den Standby und für das Verhalten für Standby und Deep-Standby menu.hint_key_quickzap Konfigurieren Sie die Tastenbelegung für die Schnellumschaltung +menu.hint_key_record Konfigurieren Sie die Taste für den Aufnahmestart menu.hint_key_repeatblock Die Verzögerung nach einem Tastendruck bis die Box reagieren soll menu.hint_key_repeatblockgeneric Die Verzögerung zwischen den Tastewiederholungen bis die Box reagieren soll menu.hint_key_right Wählen Sie die Funktion für die Tasten 'links' und 'rechts' im TV/Radio-Modus @@ -1016,6 +1027,8 @@ menu.hint_key_subchannelup Weisen Sie eine Taste für das Weiterschalten in den menu.hint_key_transponder Weisen Sie eine Taste für das Anzeigen der Transponder in der Kanalliste zu menu.hint_key_tvradiomode Wählen Sie eine Taste für das Umschalten zwischen TV- und Radio-Modus menu.hint_key_unlock Weisen Sie eine Taste zum Entriegeln zu, \nbetätigen Sie die Taste 'Rot' für 5 Sekunden +menu.hint_key_volumedown Weisen Sie eine Taste für die Reduzierung der Lautstärke zu +menu.hint_key_volumeup Weisen Sie eine Taste für die Erhöhung der Lautstärke zu menu.hint_keys Tastenbelegungen und Fernbedienungs-Abstimmung bearbeiten menu.hint_lang_pref Wählen Sie ihre bevorzugten Tonspuren und Untertitel-Sprachen menu.hint_language Menü-Sprache, Zeitzone, bevorzugte Tonspuren, Untertitel-Sprachen und mehr @@ -1608,6 +1621,8 @@ movieplayer.ytplayback Youtube-Feed Wiedergabe mpkey.audio Audiotrack mpkey.bookmark Speichere Lesezeichen mpkey.forward Vorlauf +mpkey.goto Zeiteingabe +mpkey.next_repeat_mode Nächster Wiederholungs-Modus mpkey.pause Pause mpkey.play Play mpkey.plugin Movieplayer-Plugin @@ -1796,6 +1811,11 @@ pinprotection.head PIN-Abfrage pinprotection.wrongcode Geben Sie den Code nocheinmal ein! plugins.hdd_dir Externes Plugin-Verz. plugins.result Pluginausgabe +plugintype.disabled Deaktiviert +plugintype.game Spiel +plugintype.lua LUA Skript +plugintype.script Skript +plugintype.tool Werkzeug rclock.lockmsg Die Fernbedienung der CST wird gesperrt.\n Um die Sperre aufzuheben, bitte\n und auf der Fernbedienung\n drücken. rclock.menueadd FB sperren rclock.title Fernbedienung sperren @@ -2134,6 +2154,9 @@ usermenu.item_epg_misc EPG Funktionen usermenu.item_none (frei) usermenu.item_plugin_types Plugin-Typen usermenu.item_vtxt Teletext +usermenu.items Menüpunkte +usermenu.key Taste +usermenu.key_select Taste zuweisen usermenu.msg_info_is_empty Es wurde kein Name für dieses Menü vergeben.\nVerwende Standardname:\n usermenu.msg_warning_name Sie haben mehrere Menüpunkte für dieses Menü angelegt,\naber keinen neuen Namen festgelegt.\nEs ist daher empfohlen, einen neuen Namen zu vergeben! usermenu.msg_warning_no_items Sie haben keine Menüpunkte für dieses Menü angelegt!\nDer Menüname wird daher zurückgesetzt! diff --git a/data/locale/english.locale b/data/locale/english.locale index d54666a88..7b21ad41e 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -380,15 +380,19 @@ extra.fec_9_10 9/10 extra.fec_auto Auto extra.key_current_transponder Current Transponder Key extra.key_format_mode Video format +extra.key_help Help key extra.key_list_end end extra.key_list_start home +extra.key_next43mode Next aspect ratio extra.key_pic_mode Screen format extra.key_pic_size 4:3 Display behavior extra.key_pip_close Stop/Start PiP extra.key_pip_setup Configure PiP extra.key_pip_swap Swap PiP/live extra.key_plugin One touch plugin +extra.key_record Record key extra.key_screenshot Screenshot key +extra.key_switchformat Next resolution extra.key_timeshift Timeshift extra.key_unlock Unlock key extra.ladirection LaDirection @@ -731,6 +735,7 @@ keybindingmenu.cancel close channellist keybindingmenu.channeldown channel down keybindingmenu.channellist Channellist keybindingmenu.channelup channel up +keybindingmenu.edit Edit keybindingmenu.head Edit Keybindings keybindingmenu.lastchannel Quick Zap keybindingmenu.longkeypress_duration Long key-press @@ -741,6 +746,7 @@ keybindingmenu.mode_left_right_key_tv_volume Volume Control keybindingmenu.mode_left_right_key_tv_vzap Virtual Zap keybindingmenu.mode_left_right_key_tv_zap Zap keybindingmenu.modechange Modechange +keybindingmenu.navigation Navigation keybindingmenu.pagedown page down keybindingmenu.pageup page up keybindingmenu.poweroff Power toggle @@ -760,6 +766,10 @@ keybindingmenu.special_active Special Keys keybindingmenu.subchanneldown subchannel down keybindingmenu.subchannelup subchannel up keybindingmenu.tvradiomode TV/Radio-mode +keybindingmenu.video Video +keybindingmenu.volume Volume +keybindingmenu.volumedown Decrease +keybindingmenu.volumeup Increase keybindingmenu.zaphistory Zapping History Bouquet keychooser.head Setup new Key keychooser.text1 Please press the new key @@ -805,7 +815,7 @@ mainmenu.channels Channels mainmenu.clearsectionsd Clear EPG Cache mainmenu.games Games mainmenu.head Main Menu -mainmenu.lua Plugins +mainmenu.lua Lua Plugins mainmenu.media Media mainmenu.movieplayer Movieplayer mainmenu.pausesectionsd Read EPG @@ -1004,6 +1014,7 @@ menu.hint_key_pip_swap Assign button to swap PiP and live channel menu.hint_key_plugin Assign button to execute the one touch plugin menu.hint_key_poweroff Assign button to switch power state\n (standby/deepstandby <-> running) menu.hint_key_quickzap Configure keybingdings for quick\nchannel switch +menu.hint_key_record Assign button to start a recording menu.hint_key_repeatblock Delay after button press and before\nfirst key repeat menu.hint_key_repeatblockgeneric Delay between key repeats\nwhile button pressed menu.hint_key_right Select 'right' function in live TV/Radio mode @@ -1016,6 +1027,8 @@ menu.hint_key_subchannelup Assign button for fast switch\n to next subchannel menu.hint_key_transponder Assign button to show channel list\nfor current transponder menu.hint_key_tvradiomode Assign button to switch TV <> Radio mode menu.hint_key_unlock Assign button to unlock box if locked\nTo unlock press 'red', then in next 5 seconds this key +menu.hint_key_volumedown Assign button to decrease volume +menu.hint_key_volumeup Assign button to increase volume menu.hint_keys Remote control repeat rate\nEdit key bindings menu.hint_lang_pref Configure preferred audio, EPG\nand subtitle languages menu.hint_language OSD language, timezone\nPreffered audio and subtitles languages @@ -1029,7 +1042,7 @@ menu.hint_leds_standby LEDs state in soft-standby mode menu.hint_leds_tv Working LEDs state menu.hint_load Load Neutrino-HD GUI settings from file menu.hint_longkeypress_duration A key press will be considered as "long key press" if it's pressed longer than the specified time. -menu.hint_lua Run Plugins +menu.hint_lua Run Lua Plugins menu.hint_make_hdlist Auto-create HD channel list based on\nchannel type and name menu.hint_make_newlist Create list of recently added channels menu.hint_make_removedlist Create list of recently removed channels @@ -1608,6 +1621,8 @@ movieplayer.ytplayback Youtube videoplayer mpkey.audio Audio track mpkey.bookmark save bookmark mpkey.forward Forward +mpkey.goto Enter playtime +mpkey.next_repeat_mode next repeat mode mpkey.pause Pause mpkey.play Play mpkey.plugin Movieplayer plugin @@ -1796,6 +1811,11 @@ pinprotection.head Enter PIN code pinprotection.wrongcode PIN-Code was wrong! Try again. plugins.hdd_dir Plugin HDD dir. plugins.result plugin output +plugintype.disabled Disabled +plugintype.game Game +plugintype.lua LUA Script +plugintype.script Script +plugintype.tool Tool rclock.lockmsg Your box remote control will be locked.\n To unlock it, press \n and on your remote control. rclock.menueadd Lock RC rclock.title Lock Remote Control @@ -2134,6 +2154,9 @@ usermenu.item_epg_misc EPG functions usermenu.item_none (empty) usermenu.item_plugin_types Plugin types usermenu.item_vtxt Videotext +usermenu.items Menu items +usermenu.key Key +usermenu.key_select Assign key usermenu.msg_info_is_empty You don't have definied a name for this menu!\nUsing default name:\n usermenu.msg_warning_name You have more than one items created for this menu,\nbut none new name for this menue defined.\nIt is recommended to enter a new name! usermenu.msg_warning_no_items No items defined!\nThe menu name is reset! diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index af9a0d178..21f763be8 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -108,9 +108,9 @@ void CVolume::setVolume(const neutrino_msg_t key) { bool sub_chan_keybind = g_settings.mode_left_right_key_tv == SNeutrinoSettings::VOLUME && g_RemoteControl && g_RemoteControl->subChannels.size() < 1; - if ((msg == CRCInput::RC_plus || msg == CRCInput::RC_minus) || + if ((msg == (neutrino_msg_t) g_settings.key_volumeup || msg == (neutrino_msg_t) g_settings.key_volumedown) || (sub_chan_keybind && (msg == CRCInput::RC_right || msg == CRCInput::RC_left))) { - int dir = (msg == CRCInput::RC_plus || msg == CRCInput::RC_right) ? 1 : -1; + int dir = (msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? 1 : -1; if (CNeutrinoApp::getInstance()->isMuted() && (dir > 0 || g_settings.current_volume > 0)) { hideVolscale(); CAudioMute::getInstance()->AudioMute(false, true); diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 63fbfe15d..f116c6ca7 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -282,10 +282,10 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* cancelMoveBouquet(); } } - else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_channelList_pageup) + else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup) { if (!(Bouquets->empty())) { - int step = (msg == (neutrino_msg_t)g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 int new_selected = selected - step; if (new_selected < 0) { @@ -297,10 +297,10 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* updateSelection(new_selected); } } - else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_channelList_pagedown) + else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown) { if (!(Bouquets->empty())) { - int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 int new_selected = selected + step; if (new_selected >= (int) Bouquets->size()) { if ((Bouquets->size() - listmaxshow -1 < selected) && (selected != (Bouquets->size() - 1)) && (step != 1)) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 38b63080a..55e7255f1 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -342,10 +342,10 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* cancelMoveChannel(); } } - else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_channelList_pageup) + else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup) { if (!(Channels->empty())) { - int step = (msg == (neutrino_msg_t)g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 int new_selected = selected - step; if (new_selected < 0) { @@ -357,10 +357,10 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* updateSelection(new_selected); } } - else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_channelList_pagedown) + else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown) { if (!(Channels->empty())) { - int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 int new_selected = selected + step; if (new_selected >= (int) Channels->size()) { if ((Channels->size() - listmaxshow -1 < selected) && (selected != (Channels->size() - 1)) && (step != 1)) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 7c5a0a669..16230337e 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -480,10 +480,10 @@ int CBouquetList::show(bool bShowChannelList) if (!Bouquets.empty()) updateSelection(Bouquets.size()-1); } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) { if (!Bouquets.empty()) { - int step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 int new_selected = selected - step; if (new_selected < 0) { if (selected != 0 && step != 1) @@ -494,10 +494,10 @@ int CBouquetList::show(bool bShowChannelList) updateSelection(new_selected); } } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { if (!Bouquets.empty()) { - int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 int new_selected = selected + step; if (new_selected >= (int) Bouquets.size()) { if ((Bouquets.size() - listmaxshow -1 < selected) && (selected != (Bouquets.size() - 1)) && (step != 1)) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index c04a01d1c..392ebf206 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -698,7 +698,7 @@ int CChannelList::show() } else loop=false; } - else if( msg == CRCInput::RC_record) { //start direct recording from channellist + else if( msg == (neutrino_msg_t) g_settings.key_record) { //start direct recording from channellist #if 0 if(!CRecordManager::getInstance()->RecordingStatus(chanlist[selected]->channel_id)) { @@ -789,10 +789,10 @@ int CChannelList::show() else if (msg == (neutrino_msg_t) g_settings.key_list_end) { actzap = updateSelection(chanlist.size()-1); } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) { displayList = 1; - int step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 int new_selected = selected - step; if (new_selected < 0) { if (selected != 0 && step != 1) @@ -802,10 +802,10 @@ int CChannelList::show() } actzap = updateSelection(new_selected); } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { displayList = 1; - int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 int new_selected = selected + step; if (new_selected >= (int) chanlist.size()) { if ((chanlist.size() - listmaxshow -1 < selected) && (selected != (chanlist.size() - 1)) && (step != 1)) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index e923508bd..be10e90a0 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -346,8 +346,8 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c } //manage painting of function bar during scrolling, depends of timerevent types - if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup || - msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { bool paint_buttonbar = false; //function bar int step = 0; @@ -359,17 +359,17 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c (g_settings.key_channelList_addrecord != (int)CRCInput::RC_nokey))) paint_buttonbar = true; - if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) + if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) { - step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 selected -= step; if((prev_selected-step) < 0) // because of uint selected = evtlist.size() - 1; paintDescription(selected); } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 selected += step; if(selected >= evtlist.size()) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index a0a0834f5..87e2e9d51 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -223,25 +223,32 @@ void CInfoViewerBB::getBBButtonInfo() int mode; for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { int w = 0, h = 0; + bool active; std::string text, icon; switch (i) { case CInfoViewerBB::BUTTON_EPG: icon = NEUTRINO_ICON_BUTTON_RED; frameBuffer->getIconSize(icon.c_str(), &w, &h); - text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_RED]; + text = CUserMenu::getUserMenuButtonName(0, active); + if (!text.empty()) + break; + text = g_settings.usermenu[SNeutrinoSettings::BUTTON_RED]->title; if (text.empty()) text = g_Locale->getText(LOCALE_INFOVIEWER_EVENTLIST); break; case CInfoViewerBB::BUTTON_AUDIO: icon = NEUTRINO_ICON_BUTTON_GREEN; frameBuffer->getIconSize(icon.c_str(), &w, &h); - text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_GREEN]; + text = CUserMenu::getUserMenuButtonName(1, active); + if (!text.empty()) + break; + text = g_settings.usermenu[SNeutrinoSettings::BUTTON_GREEN]->title; if (text == g_Locale->getText(LOCALE_AUDIOSELECTMENUE_HEAD)) text = ""; mode = CNeutrinoApp::getInstance()->getMode(); if ((mode == NeutrinoMessages::mode_ts || mode == NeutrinoMessages::mode_webtv) && !CMoviePlayerGui::getInstance().timeshift) { text = CMoviePlayerGui::getInstance().CurrentAudioName(); - }else if (!g_RemoteControl->current_PIDs.APIDs.empty()) { + } else if (!g_RemoteControl->current_PIDs.APIDs.empty()) { int selected = g_RemoteControl->current_PIDs.PIDs.selected_apid; if (text.empty()){ text = g_RemoteControl->current_PIDs.APIDs[selected].desc; @@ -251,14 +258,20 @@ void CInfoViewerBB::getBBButtonInfo() case CInfoViewerBB::BUTTON_SUBS: icon = NEUTRINO_ICON_BUTTON_YELLOW; frameBuffer->getIconSize(icon.c_str(), &w, &h); - text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_YELLOW]; + text = CUserMenu::getUserMenuButtonName(2, active); + if (!text.empty()) + break; + text = g_settings.usermenu[SNeutrinoSettings::BUTTON_YELLOW]->title; if (text.empty()) text = g_Locale->getText((g_RemoteControl->are_subchannels) ? LOCALE_INFOVIEWER_SUBSERVICE : LOCALE_INFOVIEWER_SELECTTIME); break; case CInfoViewerBB::BUTTON_FEAT: icon = NEUTRINO_ICON_BUTTON_BLUE; frameBuffer->getIconSize(icon.c_str(), &w, &h); - text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_BLUE]; + text = CUserMenu::getUserMenuButtonName(3, active); + if (!text.empty()) + break; + text = g_settings.usermenu[SNeutrinoSettings::BUTTON_BLUE]->title; if (text.empty()) text = g_Locale->getText(LOCALE_INFOVIEWER_STREAMINFO); break; @@ -270,6 +283,7 @@ void CInfoViewerBB::getBBButtonInfo() bbButtonInfo[i].h = h; bbButtonInfo[i].text = text; bbButtonInfo[i].icon = icon; + bbButtonInfo[i].active = active; } // Calculate position/size of buttons minX = std::min(bbIconMinX, g_InfoViewer->ChanInfoX + (((g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX) * 75) / 100)); @@ -382,10 +396,12 @@ void CInfoViewerBB::showBBButtons(const int modus) __LINE__, i); continue; } - frameBuffer->paintIcon(bbButtonInfo[i].icon, bbButtonInfo[i].x, BBarY, InfoHeightY_Info); + if (bbButtonInfo[i].active) { + frameBuffer->paintIcon(bbButtonInfo[i].icon, bbButtonInfo[i].x, BBarY, InfoHeightY_Info); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(bbButtonInfo[i].x + bbButtonInfo[i].cx, BBarFontY, - bbButtonInfo[i].w - bbButtonInfo[i].cx, bbButtonInfo[i].text, COL_INFOBAR_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(bbButtonInfo[i].x + bbButtonInfo[i].cx, BBarFontY, + bbButtonInfo[i].w - bbButtonInfo[i].cx, bbButtonInfo[i].text, COL_INFOBAR_TEXT); + } } } @@ -856,7 +872,7 @@ void CInfoViewerBB::setBBOffset() void* CInfoViewerBB::scrambledThread(void *arg) { - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); CInfoViewerBB *infoViewerBB = static_cast(arg); while(1) { if (infoViewerBB->is_visible) diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h index cdace0147..d0e42f7b8 100644 --- a/src/gui/infoviewer_bb.h +++ b/src/gui/infoviewer_bb.h @@ -83,6 +83,7 @@ class CInfoViewerBB int h; std::string icon; std::string text; + bool active; } bbButtonInfoStruct; typedef struct diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index fcb675f72..90a6312b0 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -33,6 +33,8 @@ #include #endif +#include + #include "keybind_setup.h" #include @@ -50,6 +52,9 @@ #include #include +#include +#include +#include #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::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; } diff --git a/src/gui/keybind_setup.h b/src/gui/keybind_setup.h index 8b0de168d..b099956e3 100644 --- a/src/gui/keybind_setup.h +++ b/src/gui/keybind_setup.h @@ -44,25 +44,27 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver public: enum keynames { - KEY_TV_RADIO_MODE, - KEY_POWER_OFF, - KEY_PAGE_UP, - KEY_PAGE_DOWN, - KEY_LIST_START, - KEY_LIST_END, - KEY_CANCEL_ACTION, - KEY_SORT, - KEY_ADD_RECORD, - KEY_ADD_REMIND, - KEY_BOUQUET_UP, - KEY_BOUQUET_DOWN, - KEY_CURRENT_TRANSPONDER, - KEY_CHANNEL_UP, - KEY_CHANNEL_DOWN, - KEY_SUBCHANNEL_UP, - KEY_SUBCHANNEL_DOWN, - KEY_ZAP_HISTORY, - KEY_LASTCHANNEL, + NKEY_TV_RADIO_MODE, + NKEY_POWER_OFF, + NKEY_PAGE_UP, + NKEY_PAGE_DOWN, + NKEY_VOLUME_UP, + NKEY_VOLUME_DOWN, + NKEY_LIST_START, + NKEY_LIST_END, + NKEY_CANCEL_ACTION, + NKEY_SORT, + NKEY_ADD_RECORD, + NKEY_ADD_REMIND, + NKEY_BOUQUET_UP, + NKEY_BOUQUET_DOWN, + NKEY_CURRENT_TRANSPONDER, + NKEY_CHANNEL_UP, + NKEY_CHANNEL_DOWN, + NKEY_SUBCHANNEL_UP, + NKEY_SUBCHANNEL_DOWN, + NKEY_ZAP_HISTORY, + NKEY_LASTCHANNEL, MPKEY_REWIND, MPKEY_FORWARD, MPKEY_PAUSE, @@ -72,17 +74,24 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver MPKEY_SUBTITLE, MPKEY_TIME, MPKEY_BOOKMARK, - KEY_TIMESHIFT, + MPKEY_GOTO, + //MPKEY_NEXT3DMODE, + MPKEY_NEXT_REPEAT_MODE, + //MPKEY_VTXT, + NKEY_TIMESHIFT, MPKEY_PLUGIN, - KEY_PLUGIN, - KEY_UNLOCK, - KEY_SCREENSHOT, - KEY_PIP_CLOSE, - KEY_PIP_SETUP, - KEY_PIP_SWAP, - KEY_FORMAT_MODE, - KEY_PIC_MODE, - KEY_PIC_SIZE, + NKEY_UNLOCK, + NKEY_HELP, + NKEY_NEXT43MODE, + NKEY_SWITCHFORMAT, + NKEY_SCREENSHOT, + NKEY_PIP_CLOSE, + NKEY_PIP_SETUP, + NKEY_PIP_SWAP, + NKEY_FORMAT_MODE, + NKEY_PIC_MODE, + NKEY_PIC_SIZE, + NKEY_RECORD, KEYBINDS_COUNT }; diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index e21503050..098a14a1f 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -93,28 +93,6 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } - else if(actionKey == "onekey_plugin") - { - CMenuWidget OneKeyPluginSelector(LOCALE_EXTRA_KEY_PLUGIN, NEUTRINO_ICON_FEATURES); - OneKeyPluginSelector.addItem(GenericMenuSeparator); - - char id[5]; - int cnt = 0; - int enabled_count = 0; - for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) - { - if (!g_PluginList->isHidden(count)) - { - sprintf(id, "%d", count); - enabled_count++; - OneKeyPluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); - cnt++; - } - } - - OneKeyPluginSelector.exec(NULL, ""); - return menu_return::RETURN_REPAINT; - } else if(actionKey == "movieplayer_plugin") { CMenuWidget MoviePluginSelector(LOCALE_MOVIEPLAYER_DEFPLUGIN, NEUTRINO_ICON_FEATURES); @@ -347,10 +325,6 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) mf->setHint("", LOCALE_MENU_HINT_PLUGINS_HDD_DIR); ms_general->addItem(mf); - mf = new CMenuForwarder(LOCALE_EXTRA_KEY_PLUGIN, true, g_settings.onekey_plugin, this, "onekey_plugin"); - mf->setHint("", LOCALE_MENU_HINT_ONEKEY_PLUGIN); - ms_general->addItem(mf); - mf = new CMenuForwarder(LOCALE_MPKEY_PLUGIN, true, g_settings.movieplayer_plugin, this, "movieplayer_plugin"); mf->setHint("", LOCALE_MENU_HINT_MOVIEPLAYER_PLUGIN); ms_general->addItem(mf); diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index e0aa2501e..644339a5c 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -136,6 +136,8 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) TP.feparams.symbol_rate = atoi(scansettings.sat_TP_rate.c_str()); TP.feparams.fec_inner = (fe_code_rate_t)scansettings.sat_TP_fec; TP.feparams.polarization = scansettings.sat_TP_pol; + TP.feparams.delsys = (delivery_system_t) scansettings.sat_TP_delsys; + TP.feparams.modulation = (fe_modulation_t) scansettings.sat_TP_mod; g_Zapit->tune_TP(TP); @@ -167,6 +169,11 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) } else wasgrow = 0; + if (msg == (neutrino_msg_t)g_settings.key_volumeup) + msg = CRCInput::RC_plus; + else if (msg == (neutrino_msg_t)g_settings.key_volumedown) + msg = CRCInput::RC_minus; + if (msg == CRCInput::RC_ok || msg == CRCInput::RC_0) { printf("[motorcontrol] 0 key received... goto %s\n", installerMenue ? "userMenue" : "installerMenue"); if (installerMenue) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index be4d52714..0c8445f4b 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1791,12 +1791,12 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) else result = false; } - else if (msg == CRCInput::RC_minus) + else if (msg == (neutrino_msg_t)g_settings.key_volumedown) { onSetGUIWindowPrev(); //refreshMovieInfo(); } - else if (msg == CRCInput::RC_plus) + else if (msg == (neutrino_msg_t)g_settings.key_volumeup) { onSetGUIWindowNext(); //refreshMovieInfo(); @@ -1985,11 +1985,11 @@ bool CMovieBrowser::onButtonPressBrowserList(neutrino_msg_t msg) { m_pcBrowser->scrollLineDown(1); } - else if (msg == (neutrino_msg_t)g_settings.key_channelList_pageup) + else if (msg == (neutrino_msg_t)g_settings.key_pageup) { m_pcBrowser->scrollPageUp(1); } - else if (msg == (neutrino_msg_t)g_settings.key_channelList_pagedown) + else if (msg == (neutrino_msg_t)g_settings.key_pagedown) { m_pcBrowser->scrollPageDown(1); } @@ -2099,11 +2099,11 @@ bool CMovieBrowser::onButtonPressFilterList(neutrino_msg_t msg) { m_pcFilter->scrollLineDown(1); } - else if (msg == (neutrino_msg_t)g_settings.key_channelList_pageup) + else if (msg == (neutrino_msg_t)g_settings.key_pageup) { m_pcFilter->scrollPageUp(1); } - else if (msg == (neutrino_msg_t)g_settings.key_channelList_pagedown) + else if (msg == (neutrino_msg_t)g_settings.key_pagedown) { m_pcFilter->scrollPageDown(1); } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 75cbd856a..4cceb7a69 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -395,7 +395,7 @@ void CMoviePlayerGui::makeFilename() std::replace(pretty_name.begin(), pretty_name.end(), '_', ' '); } else pretty_name = file_name; - + if(pretty_name.substr(0,14)=="videoplayback?"){//youtube name if(!p_movie_info->epgTitle.empty()) pretty_name = p_movie_info->epgTitle; @@ -739,6 +739,13 @@ bool CMoviePlayerGui::PlayFileStart(void) return res; } +bool CMoviePlayerGui::SetPosition(int pos, bool absolute) +{ + clearSubtitle(); + bool res = playback->SetPosition(pos, absolute); + return res; +} + void CMoviePlayerGui::PlayFileLoop(void) { bool first_start = true; @@ -879,40 +886,44 @@ void CMoviePlayerGui::PlayFileLoop(void) if (!timeshift) callInfoViewer(/*duration, position*/); } else if (msg == CRCInput::RC_1) { // Jump Backwards 1 minute - clearSubtitle(); - playback->SetPosition(-60 * 1000); + SetPosition(-60 * 1000); } else if (msg == CRCInput::RC_3) { // Jump Forward 1 minute - clearSubtitle(); - playback->SetPosition(60 * 1000); + SetPosition(60 * 1000); } else if (msg == CRCInput::RC_4) { // Jump Backwards 5 minutes - clearSubtitle(); - playback->SetPosition(-5 * 60 * 1000); + SetPosition(-5 * 60 * 1000); } else if (msg == CRCInput::RC_6) { // Jump Forward 5 minutes - clearSubtitle(); - playback->SetPosition(5 * 60 * 1000); + SetPosition(5 * 60 * 1000); } else if (msg == CRCInput::RC_7) { // Jump Backwards 10 minutes - clearSubtitle(); - playback->SetPosition(-10 * 60 * 1000); + SetPosition(-10 * 60 * 1000); } else if (msg == CRCInput::RC_9) { // Jump Forward 10 minutes - clearSubtitle(); - playback->SetPosition(10 * 60 * 1000); + SetPosition(10 * 60 * 1000); } else if (msg == CRCInput::RC_2) { // goto start - clearSubtitle(); - playback->SetPosition(0, true); + SetPosition(0, true); } else if (msg == CRCInput::RC_5) { // goto middle - clearSubtitle(); - playback->SetPosition(duration/2, true); + SetPosition(duration/2, true); } else if (msg == CRCInput::RC_8) { // goto end - clearSubtitle(); - playback->SetPosition(duration - 60 * 1000, true); + SetPosition(duration - 60 * 1000, true); } else if (msg == CRCInput::RC_page_up) { - clearSubtitle(); - playback->SetPosition(10 * 1000); + SetPosition(10 * 1000); } else if (msg == CRCInput::RC_page_down) { - clearSubtitle(); - playback->SetPosition(-10 * 1000); + SetPosition(-10 * 1000); } else if (msg == CRCInput::RC_0) { // cancel bookmark jump handleMovieBrowser(CRCInput::RC_0, position); + } else if (msg == (neutrino_msg_t) g_settings.mpkey_goto) { + bool cancel = true; + playback->GetPosition(position, duration); + int ss = position/1000; + int hh = ss/3600; + ss -= hh * 3600; + int mm = ss/60; + ss -= mm * 60; + std::string Value = to_string(hh/10) + to_string(hh%10) + ":" + to_string(mm/10) + to_string(mm%10) + ":" + to_string(ss/10) + to_string(ss%10); + CTimeInput jumpTime (LOCALE_MPKEY_GOTO, &Value, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, NULL, &cancel); + jumpTime.exec(NULL, ""); + jumpTime.hide(); + if (!cancel && (3 == sscanf(Value.c_str(), "%d:%d:%d", &hh, &mm, &ss))) + SetPosition(1000 * (hh * 3600 + mm * 60 + ss), true); + } else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) { callInfoViewer(/*duration, position*/); update_lcd = true; @@ -1561,7 +1572,7 @@ void CMoviePlayerGui::selectSubtitle() APIDSelector.addItem(sc); APIDSelector.addItem(GenericMenuSeparatorLine); - + char cnt[5]; unsigned int count; for (count = 0; count < numsubs; count++) { diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 627df8f2e..08fd77884 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -192,6 +192,7 @@ class CMoviePlayerGui : public CMenuTarget void setLastMode(int m) { m_LastMode = m; } void Pause(bool b = true); void selectAudioPid(); + bool SetPosition(int pos, bool absolute = false); }; #endif diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index 1f1eea012..de2e2e8c6 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -174,6 +174,7 @@ #include "plugins.h" #include +#include using namespace std; @@ -202,11 +203,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; @@ -222,39 +222,79 @@ 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(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) { + delete g_settings.usermenu[i]; + g_settings.usermenu[i] = NULL; + CNeutrinoApp::getInstance()->getConfigFile()->clear(); + } + } + uMenu->removeItem(selected); + uMenu->hide(); + return menu_return::RETURN_REPAINT; + } + return menu_return::RETURN_NONE; + } + if (parent) parent->hide(); + if (actionKey == ">a") { + int selected = uMenu->getSelected(); + + 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 (selected >= customkey_offset) + uMenu->insertItem(selected, fw); + else + uMenu->addItem(fw); + 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; @@ -262,30 +302,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) @@ -334,37 +366,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 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)); - + 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::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::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; } @@ -372,94 +456,49 @@ 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); 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 &v_umenu) +void CPersonalizeGui::ShowUserMenu() { - p_widget->addIntroItems(LOCALE_USERMENU_HEAD); - + uMenu->addIntroItems(LOCALE_USERMENU_HEAD); + //define usermenu items - vector v_umenu_fw; + std::vector v_umenu_fw; for (uint i = 0; igetUsedItemsCount() > 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*/ - - //add usermenu items - p_widget->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_RIGHT | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_NAME)); - user_menu_notifier->changeNotify(); - for (uint j = 0; jaddItem(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)); - pluginSelectionMenu = new CMenuWidget(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, NEUTRINO_ICON_SETTINGS); + 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)); + + uMenu->addItem(GenericMenuSeparatorLine); + 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)); + CMenuWidget *pluginSelectionMenu = new CMenuWidget(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, NEUTRINO_ICON_SETTINGS); pluginSelectionMenu->addIntroItems(LOCALE_MAINMENU_SETTINGS); CMenuOptionChooser * /*oc = NULL;*/ - oc = new CMenuOptionChooser(LOCALE_MAINMENU_GAMES, &g_settings.personalize[SNeutrinoSettings::P_UMENU_PLUGIN_TYPE_GAMES], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + oc = new CMenuOptionChooser(LOCALE_MAINMENU_GAMES, &g_settings.personalize[SNeutrinoSettings::P_UMENU_PLUGIN_TYPE_GAMES], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); oc->setHint(NEUTRINO_ICON_HINT_PERSONALIZE, LOCALE_MENU_HINT_PLUGIN_TYPE_GAMES); pluginSelectionMenu->addItem(oc); @@ -475,23 +514,59 @@ void CPersonalizeGui::ShowUserMenu(CMenuWidget* p_widget, vectorsetHint(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)); + uMenu->addItem(new CMenuDForwarder(LOCALE_PERSONALIZE_USERMENU_PLUGIN_TYPES, true, NULL, pluginSelectionMenu)); + + //add usermenu items + uMenu->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_RIGHT | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_NAME)); + user_menu_notifier->changeNotify(); + for (uint j = 0; jaddItem(v_umenu_fw[j]); + + 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; igetNumberOfPlugins(); 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++))); } } @@ -501,20 +576,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(); @@ -524,53 +599,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, ""); @@ -580,32 +655,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 (item); + CMenuForwarder* fw = static_cast (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()) @@ -615,12 +690,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) @@ -644,7 +719,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)); @@ -689,7 +764,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); @@ -753,9 +828,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 (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) @@ -795,12 +870,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; } @@ -818,62 +893,62 @@ 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 (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 (d_key == CRCInput::RC_nokey && 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, NULL, lock_icon); v_item[i].menuItem->hintIcon = fw->hintIcon; @@ -884,7 +959,7 @@ 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) short_cut++; @@ -898,11 +973,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 @@ -919,17 +994,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); } @@ -941,20 +1016,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; } @@ -964,7 +1039,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"); } @@ -984,20 +1059,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; } diff --git a/src/gui/personalize.h b/src/gui/personalize.h index 09e97e489..fb84f80b5 100644 --- a/src/gui/personalize.h +++ b/src/gui/personalize.h @@ -39,7 +39,7 @@ 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! @@ -69,8 +69,8 @@ class CUserMenuNotifier : public CChangeObserver { private: - CMenuItem* toDisable[4]; - + CMenuItem* toDisable[USERMENU_ITEMS_COUNT]; + public: CUserMenuNotifier( CMenuItem*, CMenuItem*, CMenuItem*, CMenuItem*); @@ -139,41 +139,41 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP { protected: virtual CMenuTarget* getParent() { return( NULL);}; - + private: CUserMenuNotifier *user_menu_notifier; CPinSetupNotifier *pin_setup_notifier; - CMenuWidget* fkeyMenu; - CMenuWidget* plMenu; CMenuWidget* tmpW; - CMenuWidget *pluginSelectionMenu; - + CMenuWidget* uMenu; + int width, widget_count, shortcut, options_count; bool show_usermenu, show_pin_setup; - + bool show_pluginmenu; + + int customkey_offset; + //stuff for settings handlers void handleSetting(int *setting); void restoreSettings(); bool haveChangedSettings(); std::vector v_int_settings; - + std::vector v_item; std::vector v_widget; std::vector v_observ; - + int ShowPersonalizationMenu(); int ShowMenuOptions(const int& menu); void ShowHelpPersonalize(); void ShowPinSetup(CMenuWidget* p_widget, CPINChangeWidget * &pin_widget); - void ShowUserMenu(CMenuWidget* p_widget, std::vector &v_umenu); - void ShowPluginMenu(CMenuWidget* p_widget); - void ShowPreverredKeySetup(CMenuWidget* p_widget); + void ShowUserMenu(); + void ShowPluginMenu(CMenuWidget* p_widget, std::string da[], int ia[]); void SaveAndExit(); void ApplySettings(); - + bool hasPinItems(); - + neutrino_msg_t getShortcut(const int & shortcut_num, neutrino_msg_t alternate_rc_key = CRCInput::RC_nokey); void addObservedItem(CMenuWidget *widget, CMenuItem *observer_Item, CMenuItem *to_observ_Item); bool changeNotify(const neutrino_locale_t locale= NONEXISTANT_LOCALE, void *data = NULL); @@ -185,7 +185,7 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP PERSONALIZE_MODE_NOTVISIBLE = 0, PERSONALIZE_MODE_VISIBLE = 1, PERSONALIZE_MODE_PIN = 2, - + PERSONALIZE_MODE_MAX }; @@ -194,7 +194,7 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP { PERSONALIZE_PROTECT_MODE_NOT_PROTECTED = 0, PERSONALIZE_PROTECT_MODE_PIN_PROTECTED = 2, - + PERSONALIZE_PROTECT_MODE_MAX = 2 }; @@ -203,10 +203,10 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP { 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 { @@ -215,7 +215,7 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP 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 { @@ -224,17 +224,17 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP 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;}; @@ -250,6 +250,7 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP 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 enablePluginMenu(bool show = true){show_pluginmenu = show;}; void enablePinSetup(bool show = true){show_pin_setup = show;}; }; diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index f574e2e09..b76fd4971 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -57,18 +57,25 @@ #include #include +#include "widget/shellwindow.h" +#include "widget/messagebox.h" +#include +#include +#include + +#include +extern cVideo * videoDecoder; #include "plugins.h" #include -#if ENABLE_LUA #include -#endif extern CPlugins * g_PluginList; /* neutrino.cpp */ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ #define PLUGINDIR_VAR "/var/tuxbox/plugins" +#define PLUGINDIR_USB "/mnt/usb/tuxbox/plugins" CPlugins::CPlugins() { @@ -76,11 +83,6 @@ CPlugins::CPlugins() number_of_plugins = 0; } -CPlugins::~CPlugins() -{ - plugin_list.clear(); -} - bool CPlugins::plugin_exists(const std::string & filename) { return (find_plugin(filename) >= 0); @@ -103,14 +105,14 @@ void CPlugins::scanDir(const char *dir) int number_of_files = scandir(dir, &namelist, 0, alphasort); - if(number_of_files < 0) + if (number_of_files < 0) return; for (int i = 0; i < number_of_files; i++) { - std::string filename; + std::string filename(namelist[i]->d_name); + free(namelist[i]); - filename = namelist[i]->d_name; int pos = filename.find(".cfg"); if (pos > -1) { @@ -120,17 +122,15 @@ void CPlugins::scanDir(const char *dir) fname += '/'; new_plugin.cfgfile = fname.append(new_plugin.filename); new_plugin.cfgfile.append(".cfg"); - parseCfg(&new_plugin); bool plugin_ok = parseCfg(&new_plugin); - if (plugin_ok) { + if (plugin_ok) + { new_plugin.pluginfile = fname; if (new_plugin.type == CPlugins::P_TYPE_SCRIPT) new_plugin.pluginfile.append(".sh"); -#if ENABLE_LUA else if (new_plugin.type == CPlugins::P_TYPE_LUA) new_plugin.pluginfile.append(".lua"); -#endif - else // CPlugins::P_TYPE_GAME or CPlugins::P_TYPE_TOOL + else new_plugin.pluginfile.append(".so"); // We do not check if new_plugin.pluginfile exists since .cfg in // PLUGINDIR_VAR can overwrite settings in read only dir @@ -147,7 +147,6 @@ void CPlugins::scanDir(const char *dir) } } } - free(namelist[i]); } free(namelist); } @@ -159,12 +158,33 @@ void CPlugins::loadPlugins() plugin_list.clear(); sindex = 100; scanDir(g_settings.plugin_hdd_dir.c_str()); + scanDir(PLUGINDIR_USB); scanDir(PLUGINDIR_VAR); scanDir(PLUGINDIR); sort (plugin_list.begin(), plugin_list.end()); } +CPlugins::~CPlugins() +{ + plugin_list.clear(); +} + +bool CPlugins::overrideType(plugin *plugin_data, std::string &setting, p_type type) +{ + if (!setting.empty()) { + char s[setting.length() + 1]; + cstrncpy(s, setting, setting.length() + 1); + char *t, *p = s; + while ((t = strsep(&p, ","))) + if (!strcmp(t, plugin_data->filename.c_str())) { + plugin_data->type = type; + return true; + } + } + return false; +} + bool CPlugins::parseCfg(plugin *plugin_data) { std::ifstream inFile; @@ -199,11 +219,11 @@ bool CPlugins::parseCfg(plugin *plugin_data) if (cmd == "index") { - plugin_data->index = atoi(parm.c_str()); + plugin_data->index = atoi(parm); } else if (cmd == "pluginversion") { - plugin_data->key = atoi(parm.c_str()); + plugin_data->key = atoi(parm); } else if (cmd == "name") { @@ -219,44 +239,51 @@ bool CPlugins::parseCfg(plugin *plugin_data) } else if (cmd == "type") { - plugin_data->type = getPluginType(atoi(parm.c_str())); + plugin_data->type = getPluginType(atoi(parm)); } else if (cmd == "needfb") { - plugin_data->fb = ((parm == "1")?true:false); + plugin_data->fb = atoi(parm); } else if (cmd == "needrc") { - plugin_data->rc = ((parm == "1")?true:false); + plugin_data->rc = atoi(parm); } else if (cmd == "needlcd") { - plugin_data->lcd = ((parm == "1")?true:false); + plugin_data->lcd = atoi(parm); } else if (cmd == "needvtxtpid") { - plugin_data->vtxtpid = ((parm == "1")?true:false); + plugin_data->vtxtpid = atoi(parm); } else if (cmd == "pigon") { - plugin_data->showpig = ((parm == "1")?true:false); + plugin_data->showpig = atoi(parm); } else if (cmd == "needoffsets") { - plugin_data->needoffset = ((parm == "1")?true:false); + plugin_data->needoffset = atoi(parm); } else if (cmd == "hide") { - plugin_data->hide = ((parm == "1")?true:false); + plugin_data->hide = atoi(parm); } else if (cmd == "needenigma") { - reject = ((parm == "1")?true:false); + reject = atoi(parm); } } inFile.close(); + + overrideType(plugin_data, g_settings.plugins_disabled, P_TYPE_DISABLED) || + overrideType(plugin_data, g_settings.plugins_game, P_TYPE_GAME) || + overrideType(plugin_data, g_settings.plugins_tool, P_TYPE_TOOL) || + overrideType(plugin_data, g_settings.plugins_script, P_TYPE_SCRIPT) || + overrideType(plugin_data, g_settings.plugins_lua, P_TYPE_LUA); + return !reject; } @@ -282,11 +309,11 @@ PluginParam * CPlugins::makeParam(const char * const id, const int value, Plugin } #endif -void CPlugins::startPlugin_by_name(const std::string & name) +void CPlugins::startPlugin_by_name(const std::string & filename) { for (int i = 0; i < (int) plugin_list.size(); i++) { - if (name.compare(g_PluginList->getName(i))==0) + if (!filename.compare(g_PluginList->getFileName(i))) { startPlugin(i); return; @@ -314,31 +341,14 @@ void CPlugins::startScriptPlugin(int number) script, plugin_list[number].cfgfile.c_str()); return; } - pid_t pid = 0; - FILE *f = my_popen(pid,script,"r"); - if (f != NULL) - { - char *output=NULL; - size_t len = 0; - while (( getline(&output, &len, f)) != -1) - { - scriptOutput += output; - } - pclose(f); - int s; - while (waitpid(pid,&s,WNOHANG)>0); - kill(pid,SIGTERM); - if(output) - free(output); - } - else - { - printf("[CPlugins] can't execute %s\n",script); - } + // workaround for manually messed up permissions + if (access(script, X_OK)) + chmod(script, 0755); + CShellWindow(script, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE); + scriptOutput = ""; } -#if ENABLE_LUA void CPlugins::startLuaPlugin(int number) { const char *script = plugin_list[number].pluginfile.c_str(); @@ -352,8 +362,12 @@ void CPlugins::startLuaPlugin(int number) CLuaInstance *lua = new CLuaInstance(); lua->runScript(script); delete lua; -} +#if HAVE_SPARK_HARDWARE + frameBuffer->ClearFB(); #endif + videoDecoder->Pig(-1, -1, -1, -1); + frameBuffer->paintBackground(); +} void CPlugins::startPlugin(int number) { @@ -361,13 +375,29 @@ void CPlugins::startPlugin(int number) delScriptOutput(); /* export neutrino settings to the environment */ char tmp[32]; +#if HAVE_SPARK_HARDWARE + sprintf(tmp, "%d", g_settings.screen_StartX_int); +#else sprintf(tmp, "%d", g_settings.screen_StartX); +#endif setenv("SCREEN_OFF_X", tmp, 1); +#if HAVE_SPARK_HARDWARE + sprintf(tmp, "%d", g_settings.screen_StartY_int); +#else sprintf(tmp, "%d", g_settings.screen_StartY); +#endif setenv("SCREEN_OFF_Y", tmp, 1); +#if HAVE_SPARK_HARDWARE + sprintf(tmp, "%d", g_settings.screen_EndX_int); +#else sprintf(tmp, "%d", g_settings.screen_EndX); +#endif setenv("SCREEN_END_X", tmp, 1); +#if HAVE_SPARK_HARDWARE + sprintf(tmp, "%d", g_settings.screen_EndY_int); +#else sprintf(tmp, "%d", g_settings.screen_EndY); +#endif setenv("SCREEN_END_Y", tmp, 1); bool ispip = strstr(plugin_list[number].pluginfile.c_str(), "pip") != 0; @@ -379,13 +409,11 @@ void CPlugins::startPlugin(int number) startScriptPlugin(number); return; } -#if ENABLE_LUA if (plugin_list[number].type == CPlugins::P_TYPE_LUA) { startLuaPlugin(number); return; } -#endif if (!file_exists(plugin_list[number].pluginfile.c_str())) { printf("[CPlugins] could not find %s,\nperhaps wrong plugin type in %s\n", @@ -395,10 +423,22 @@ void CPlugins::startPlugin(int number) g_RCInput->clearRCMsg(); g_RCInput->stopInput(); - + /* stop automatic updates etc. */ + frameBuffer->Lock(); + //frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); printf("Starting %s\n", plugin_list[number].pluginfile.c_str()); - my_system(2, plugin_list[number].pluginfile.c_str(), NULL); + // workaround for manually messed up permissions + if (access(plugin_list[number].pluginfile, X_OK)) + chmod(plugin_list[number].pluginfile.c_str(), 0755); + + my_system(2, plugin_list[number].pluginfile.c_str(), NULL); + //frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); + frameBuffer->Unlock(); +#if HAVE_SPARK_HARDWARE + frameBuffer->ClearFB(); +#endif + videoDecoder->Pig(-1, -1, -1, -1); frameBuffer->paintBackground(); g_RCInput->restartInput(); g_RCInput->clearRCMsg(); @@ -441,10 +481,8 @@ CPlugins::p_type_t CPlugins::getPluginType(int type) case PLUGIN_TYPE_SCRIPT: return P_TYPE_SCRIPT; break; -#if ENABLE_LUA case PLUGIN_TYPE_LUA: return P_TYPE_LUA; -#endif default: return P_TYPE_DISABLED; } diff --git a/src/gui/plugins.h b/src/gui/plugins.h index 9415173a2..6531884b3 100644 --- a/src/gui/plugins.h +++ b/src/gui/plugins.h @@ -51,11 +51,8 @@ class CPlugins P_TYPE_DISABLED = 0x1, P_TYPE_GAME = 0x2, P_TYPE_TOOL = 0x4, - P_TYPE_SCRIPT = 0x8 -#if ENABLE_LUA - , + P_TYPE_SCRIPT = 0x8, P_TYPE_LUA = 0x10 -#endif } p_type_t; @@ -125,13 +122,14 @@ class CPlugins inline int getIndex (const int number) const { return plugin_list[number].index ; } inline neutrino_msg_t getKey (const int number) const { return (neutrino_msg_t)plugin_list[number].key; } + void setType (const int number, int t) { plugin_list[number].type = (CPlugins::p_type_t) t ; } + bool overrideType(plugin *plugin_data, std::string &setting, p_type type); + void startPlugin(int number); // start plugins by number void startPlugin(const char * const filename); // start plugins by filename void startPlugin_by_name(const std::string & name); // start plugins by "name=" in .cfg void startScriptPlugin(int number); -#if ENABLE_LUA void startLuaPlugin(int number); -#endif bool hasPlugin(CPlugins::p_type_t type); const std::string& getScriptOutput() const; diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index a1d92cbd4..2af0aee57 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -523,12 +523,12 @@ int CTimerList::show() loop=false; } - else if ((msg == CRCInput::RC_up || msg == (unsigned int)g_settings.key_channelList_pageup) && !(timerlist.empty())) + else if ((msg == CRCInput::RC_up || msg == (unsigned int)g_settings.key_pageup) && !(timerlist.empty())) { int step = 0; int prev_selected = selected; - step = (msg == (unsigned int)g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + step = (msg == (unsigned int)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 selected -= step; if((prev_selected-step) < 0) // because of uint selected = timerlist.size() - 1; @@ -547,12 +547,12 @@ int CTimerList::show() paintFoot(); } - else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_channelList_pagedown) && !(timerlist.empty())) + else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_pagedown) && !(timerlist.empty())) { unsigned int step = 0; int prev_selected = selected; - step = (msg == (unsigned int)g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + step = (msg == (unsigned int)g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 selected += step; if(selected >= timerlist.size()) @@ -1228,9 +1228,7 @@ int CTimerList::newTimer() timerNew_pluginName = "---"; CPluginChooser plugin_chooser(LOCALE_TIMERLIST_PLUGIN, CPlugins::P_TYPE_SCRIPT | CPlugins::P_TYPE_TOOL -#if ENABLE_LUA | CPlugins::P_TYPE_LUA -#endif , timerNew_pluginName); CMenuForwarder *m10 = new CMenuForwarder(LOCALE_TIMERLIST_PLUGIN, false, timerNew_pluginName, &plugin_chooser); diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 1daae1b43..85c61f7f5 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -490,9 +490,9 @@ void CUpnpBrowserGui::selectDevice() else if (msg_repeatok == (neutrino_msg_t) g_settings.key_list_end) { updateDeviceSelection(m_devices.size()-1); } - else if (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) + else if (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_pageup) { - int step = ((int) msg == g_settings.key_channelList_pageup) ? m_listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pageup) ? m_listmaxshow : 1; // browse or step 1 int new_selected = m_selecteddevice - step; if (new_selected < 0) { if (m_selecteddevice != 0 && step != 1) @@ -502,9 +502,9 @@ void CUpnpBrowserGui::selectDevice() } updateDeviceSelection(new_selected); } - else if (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + else if (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - int step = ((int) msg == g_settings.key_channelList_pagedown) ? m_listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pagedown) ? m_listmaxshow : 1; // browse or step 1 int new_selected = m_selecteddevice + step; if (new_selected >= (int) m_devices.size()) { if ((m_devices.size() - m_listmaxshow -1 < m_selecteddevice) && (m_selecteddevice != (m_devices.size() - 1)) && (step != 1)) @@ -726,8 +726,8 @@ bool CUpnpBrowserGui::selectItem(std::string id) else if (!timeout && (msg_repeatok == (neutrino_msg_t) g_settings.key_list_end)) { updateItemSelection(id, entries, total-1, selected, liststart); } - else if (!timeout && (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup)) { - int step = ((int) msg == g_settings.key_channelList_pageup) ? m_listmaxshow : 1; // browse or step 1 + else if (!timeout && (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_pageup)) { + int step = ((int) msg == g_settings.key_pageup) ? m_listmaxshow : 1; // browse or step 1 int new_selected = selected - step; if (new_selected < 0) { if (selected != 0 && step != 1) @@ -737,8 +737,8 @@ bool CUpnpBrowserGui::selectItem(std::string id) } updateItemSelection(id, entries, new_selected, selected, liststart); } - else if (!timeout && (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown)) { - int step = ((int) msg == g_settings.key_channelList_pagedown) ? m_listmaxshow : 1; // browse or step 1 + else if (!timeout && (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)) { + int step = ((int) msg == g_settings.key_pagedown) ? m_listmaxshow : 1; // browse or step 1 int new_selected = selected + step; if (new_selected >= (int) total) { if ((total - m_listmaxshow -1 < selected) && (selected != (total - 1)) && (step != 1)) diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 81e021a2e..c0dcc8389 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -40,6 +40,7 @@ #ifdef HAVE_CONFIG_H #include #endif +#include #include "user_menue.h" #include "user_menue_setup.h" @@ -48,12 +49,16 @@ #include "audio_select.h" #include "streaminfo2.h" #include "epgplus.h" +#include "epgview.h" +#include "eventlist.h" #include "movieplayer.h" #include "timerlist.h" #include "plugins.h" #include "imageinfo.h" #include "dboxinfo.h" +#if !HAVE_SPARK_HARDWARE #include "cam_menu.h" +#endif #include "pluginlist.h" #include "infoclock.h" @@ -63,14 +68,19 @@ #include +#include #include #include +#include + #include -extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -// extern CPlugins * g_PluginList; +extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ +extern CPlugins * g_PluginList; /* neutrino.cpp */ +#if !HAVE_SPARK_HARDWARE extern CCAMMenuHandler * g_CamHandler; -extern CInfoClock * InfoClock; +#endif + // #include @@ -81,70 +91,76 @@ CUserMenu::CUserMenu() CUserMenu::~CUserMenu() { - } -// USERMENU -bool CUserMenu::showUserMenu(int button) +bool CUserMenu::showUserMenu(neutrino_msg_t msg) { - InfoClock->enableInfoClock(false); + int button = -1; + unsigned ums = g_settings.usermenu.size(); + for (unsigned int i = 0; i < ums; i++) + if (g_settings.usermenu[i]->key == msg) { + button = i; + break; + } - // set width - width = w_max (40, 10); - - if (button < 0 || button >= COL_BUTTONMAX) + if (button < 0) return false; + int pers = -1; + switch(msg) { + case CRCInput::RC_red: + pers = SNeutrinoSettings::P_MAIN_RED_BUTTON; + button = SNeutrinoSettings::BUTTON_RED; + break; + case CRCInput::RC_green: + pers = SNeutrinoSettings::P_MAIN_GREEN_BUTTON; + button = SNeutrinoSettings::BUTTON_GREEN; + break; + case CRCInput::RC_yellow: + pers = SNeutrinoSettings::P_MAIN_YELLOW_BUTTON; + button = SNeutrinoSettings::BUTTON_YELLOW; + break; + case CRCInput::RC_blue: + pers = SNeutrinoSettings::P_MAIN_BLUE_BUTTON; + button = SNeutrinoSettings::BUTTON_BLUE; + break; + } + + CNeutrinoApp::getInstance()->StopSubtitles(); + + if (pers > -1 && (g_settings.personalize[pers] != CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)) { + ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); + CNeutrinoApp::getInstance()->StartSubtitles(); + return true; + } + + width = w_max (40, 10); + CMenuItem* menu_item = NULL; + CMenuItem* last_menu_item = NULL; CColorKeyHelper keyhelper; //set default feature key neutrino_msg_t key = feat_key[CPersonalizeGui::PERSONALIZE_FEAT_KEY_AUTO].key; //CRCInput::RC_nokey - - const char * icon = NULL; - int dummy; + const char * icon = NULL; int menu_items = 0; - int menu_prev = -1; // define classes - CFavorites* tmpFavorites = NULL; - CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; - CMenuWidget* tmpNVODSelector = NULL; CSubChannelSelectMenu subchanselect; - CStreamInfo2 * streamInfo = NULL; - CEventListHandler* tmpEventListHandler = NULL; - CEPGplusHandler* tmpEPGplusHandler = NULL; - CEPGDataHandler* tmpEPGDataHandler = NULL; - CTimerList* Timerlist = NULL; - CRCLock *rcLock = NULL; - CStreamFeaturesChangeExec *StreamFeaturesChanger = NULL; - CImageInfo *imageinfo = NULL; - CDBoxInfoWidget *boxinfo = NULL; - CNeutrinoApp * neutrino = NULL; - CPluginList * games = NULL; - CPluginList * tools = NULL; - CPluginList * scripts = NULL; -#if ENABLE_LUA - CPluginList * lua = NULL; -#endif + CStreamFeaturesChangeExec StreamFeaturesChanger; + CNeutrinoApp * neutrino = CNeutrinoApp::getInstance(); - std::string txt = g_settings.usermenu_text[button]; - neutrino_locale_t caption = user_menu[button].caption; - - //ensure correct caption for yellow menue - if ( button == SNeutrinoSettings::BUTTON_YELLOW) - caption = g_RemoteControl->are_subchannels ? LOCALE_INFOVIEWER_SUBSERVICE : LOCALE_INFOVIEWER_SELECTTIME; - - //ensure no empty caption - if ( txt.empty() ) - txt = g_Locale->getText(caption); - - CMenuWidget *menu = new CMenuWidget(txt.c_str(), user_menu[button].menu_icon_def, width); + std::string txt = g_settings.usermenu[button]->title; + if (button < COL_BUTTONMAX && txt.empty()) + txt = g_Locale->getText(user_menu[button].caption); + + CMenuWidget *menu = new CMenuWidget(txt, (button < COL_BUTTONMAX) ? user_menu[button].menu_icon_def : "", width); if (menu == NULL) - return 0; - - menu->setSelected(user_menu[button].selected); + return true; + + if (button < COL_BUTTONMAX) + menu->setSelected(user_menu[button].selected); //show cancel button if configured if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL]) @@ -152,184 +168,139 @@ bool CUserMenu::showUserMenu(int button) else menu->addItem(GenericMenuSeparator); - // go through any postition number - for (int pos = 0; pos < SNeutrinoSettings::ITEM_MAX ; pos++) { - // now compare pos with the position of any item. Add this item if position is the same - switch (g_settings.usermenu[button][pos]) { + std::string itemstr_last("1"); + + std::vector items = ::split(g_settings.usermenu[button]->items, ','); + for (std::vector::iterator it = items.begin(); it != items.end(); ++it) { + if (it->empty()) + continue; + if (*it == itemstr_last) + continue; + int item = -1; + if (it->find_first_not_of("0123456789") == std::string::npos) + item = atoi(*it); + menu_item = NULL; + switch (item) { case SNeutrinoSettings::ITEM_NONE: - // do nothing - break; + continue; case SNeutrinoSettings::ITEM_BAR: - if (menu_prev == -1 || menu_prev == SNeutrinoSettings::ITEM_BAR ) - break; - menu->addItem(GenericMenuSeparatorLine); - menu_prev = SNeutrinoSettings::ITEM_BAR; break; - case SNeutrinoSettings::ITEM_FAVORITS: - { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_FAVORITS; - tmpFavorites = new CFavorites; keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_FAVORIT]].key); //CRCInput::RC_green - menu_item = new CMenuForwarder(LOCALE_FAVORITES_MENUEADD, true, NULL, tmpFavorites, "-1", key, icon); - menu->addItem(menu_item, false); + menu_item = new CMenuDForwarder(LOCALE_FAVORITES_MENUEADD, true, NULL, new CFavorites, "-1", key, icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); break; - } case SNeutrinoSettings::ITEM_RECORD: - { if (g_settings.recording_type == RECORDING_OFF) break; - - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_RECORD; keyhelper.get(&key,&icon,CRCInput::RC_red); menu_item = new CMenuForwarder(LOCALE_MAINMENU_RECORDING, true, NULL, CRecordManager::getInstance(), "-1", key, icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); + break; + case SNeutrinoSettings::ITEM_MOVIEPLAYER_MB: + if (g_settings.recording_type == RECORDING_OFF) + break; + keyhelper.get(&key,&icon,CRCInput::RC_green); + menu_item = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, neutrino, "tsmoviebrowser", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MB); + break; + case SNeutrinoSettings::ITEM_TIMERLIST: + keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_TIMERLIST]].key); //CRCInput::RC_yellow + menu_item = new CMenuDForwarder(LOCALE_TIMERLIST_NAME, true, NULL, new CTimerList, "-1", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_TIMERS, LOCALE_MENU_HINT_TIMERS); + break; + case SNeutrinoSettings::ITEM_REMOTE: + keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK]].key); //CRCInput::RC_nokey); + menu_item = new CMenuDForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, new CRCLock, "-1" , key, icon ); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); + break; + case SNeutrinoSettings::ITEM_EPG_SUPER: + keyhelper.get(&key,&icon,CRCInput::RC_green); + menu_item = new CMenuDForwarder(LOCALE_EPGMENU_EPGPLUS , true, NULL, new CEPGplusHandler, "-1", key, icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); + break; + case SNeutrinoSettings::ITEM_EPG_LIST: + keyhelper.get(&key,&icon,CRCInput::RC_red); + menu_item = new CMenuDForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, new CEventListHandler, "-1", key, icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); + break; + case SNeutrinoSettings::ITEM_EPG_INFO: + keyhelper.get(&key,&icon,CRCInput::RC_yellow); + menu_item = new CMenuDForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, new CEPGDataHandler, "-1", key, icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); + break; + case SNeutrinoSettings::ITEM_EPG_MISC: + { + int dummy = g_Sectionsd->getIsScanningActive(); + keyhelper.get(&key,&icon); + // new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOMODE, &g_settings.video_Mode, VIDEOMENU_VIDEOMODE_OPTIONS, VIDEOMENU_VIDEOMODE_OPTION_COUNT, true, this, CRCInput::RC_nokey, "", true); + menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this , key, icon ); menu->addItem(menu_item, false); + + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_MAINMENU_CLEARSECTIONSD, true, NULL, neutrino, "clearSectionsd", key,icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); break; } - case SNeutrinoSettings::ITEM_MOVIEPLAYER_MB: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_MB; - keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, &CMoviePlayerGui::getInstance(), "tsmoviebrowser", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_TIMERLIST: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_TIMERLIST; - keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_TIMERLIST]].key); //CRCInput::RC_yellow - Timerlist = new CTimerList(); - menu_item = new CMenuForwarder(LOCALE_TIMERLIST_NAME, true, NULL, Timerlist, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_REMOTE: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_REMOTE; - keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK]].key); //CRCInput::RC_nokey); - rcLock = new CRCLock(); - menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1", key, icon ); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_SUPER: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_SUPER; - tmpEPGplusHandler = new CEPGplusHandler(); - keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS, true, NULL, tmpEPGplusHandler, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_LIST: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_LIST; - tmpEventListHandler = new CEventListHandler(); - keyhelper.get(&key,&icon,CRCInput::RC_red); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST, true, NULL, tmpEventListHandler, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_INFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_INFO; - tmpEPGDataHandler = new CEPGDataHandler(); - keyhelper.get(&key,&icon,CRCInput::RC_yellow); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO, true, NULL, tmpEPGDataHandler, "-1", key, icon); - menu->addItem(menu_item, false); - break; - - case SNeutrinoSettings::ITEM_EPG_MISC: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_EPG_MISC; - dummy = g_Sectionsd->getIsScanningActive(); - //dummy = sectionsd_scanning; - keyhelper.get(&key,&icon); - menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, key, icon ); - menu->addItem(menu_item, false); - menu_items++; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MAINMENU_CLEARSECTIONSD, true, NULL, CNeutrinoApp::getInstance(), "clearSectionsd", key,icon); - menu->addItem(menu_item, false); - break; - case SNeutrinoSettings::ITEM_AUDIO_SELECT: - //g_settings.audio_left_right_selectable || g_RemoteControl->current_PIDs.APIDs.size() > 1) - if (1) { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_AUDIO_SELECT; - tmpAudioSelectMenuHandler = new CAudioSelectMenuHandler; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_AUDIOSELECTMENUE_HEAD, true, NULL, tmpAudioSelectMenuHandler, "-1", key,icon); - menu->addItem(menu_item, false); - } + keyhelper.get(&key,&icon); + menu_item = new CMenuDForwarder(LOCALE_AUDIOSELECTMENUE_HEAD, true, NULL, new CAudioSelectMenuHandler, "-1", key,icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); break; - case SNeutrinoSettings::ITEM_SUBCHANNEL: - if (!(g_RemoteControl->subChannels.empty())) { - // NVOD/SubService- Kanal! - tmpNVODSelector = new CMenuWidget(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, NEUTRINO_ICON_VIDEO); - if (subchanselect.getNVODMenu(tmpNVODSelector)) { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_SUBCHANNEL; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, true, NULL, tmpNVODSelector, "-1", key,icon); - menu->addItem(menu_item, false); - } + { + if (g_RemoteControl->subChannels.empty()) + break; + // NVOD/SubService- Kanal! + CMenuWidget *tmpNVODSelector = new CMenuWidget(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, NEUTRINO_ICON_VIDEO); + if (!subchanselect.getNVODMenu(tmpNVODSelector)) { + delete tmpNVODSelector; + break; } + keyhelper.get(&key,&icon); + menu_item = new CMenuDForwarder(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD, true, NULL, tmpNVODSelector, "-1", key,icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); break; - + } case SNeutrinoSettings::ITEM_TECHINFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_TECHINFO; - streamInfo = new CStreamInfo2(); keyhelper.get(&key,&icon,CRCInput::RC_blue); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, !CNeutrinoApp::getInstance()->channelList->isEmpty(), NULL, streamInfo, "-1", key, icon ); - menu->addItem(menu_item, false); + menu_item = new CMenuDForwarder(LOCALE_EPGMENU_STREAMINFO, !neutrino->channelList->isEmpty(), NULL, new CStreamInfo2, "-1", key, icon ); + menu_item->setHint(NEUTRINO_ICON_HINT_STREAMINFO, LOCALE_MENU_HINT_STREAMINFO); break; case SNeutrinoSettings::ITEM_GAMES: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_GAMES; - games = new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME); keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MAINMENU_GAMES, g_PluginList->hasPlugin(CPlugins::P_TYPE_GAME), NULL, games, "-1", key, icon ); - menu->addItem(menu_item, false); - break; - case SNeutrinoSettings::ITEM_TOOLS: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_TOOLS; - tools = new CPluginList(LOCALE_MAINMENU_TOOLS,CPlugins::P_TYPE_TOOL); - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MAINMENU_TOOLS, g_PluginList->hasPlugin(CPlugins::P_TYPE_TOOL), NULL, tools, "-1", key, icon ); - menu->addItem(menu_item, false); + menu_item = new CMenuDForwarder(LOCALE_MAINMENU_GAMES, g_PluginList->hasPlugin(CPlugins::P_TYPE_GAME), NULL, new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME), "-1", key, icon ); + menu_item->setHint(NEUTRINO_ICON_HINT_GAMES, LOCALE_MENU_HINT_GAMES); break; + case SNeutrinoSettings::ITEM_TOOLS: + keyhelper.get(&key,&icon); + menu_item = new CMenuDForwarder(LOCALE_MAINMENU_TOOLS, g_PluginList->hasPlugin(CPlugins::P_TYPE_TOOL), NULL, new CPluginList(LOCALE_MAINMENU_TOOLS,CPlugins::P_TYPE_TOOL), "-1", key, icon ); + menu->addItem(menu_item, false); + break; case SNeutrinoSettings::ITEM_SCRIPTS: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_SCRIPTS; - scripts = new CPluginList(LOCALE_MAINMENU_SCRIPTS,CPlugins::P_TYPE_SCRIPT); keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MAINMENU_SCRIPTS, g_PluginList->hasPlugin(CPlugins::P_TYPE_SCRIPT), NULL, scripts, "-1", key, icon ); - menu->addItem(menu_item, false); + menu_item = new CMenuDForwarder(LOCALE_MAINMENU_SCRIPTS, g_PluginList->hasPlugin(CPlugins::P_TYPE_SCRIPT), NULL, new CPluginList(LOCALE_MAINMENU_SCRIPTS,CPlugins::P_TYPE_SCRIPT), "-1", key, icon ); + menu_item->setHint(NEUTRINO_ICON_HINT_SCRIPTS, LOCALE_MENU_HINT_SCRIPTS); break; -#if ENABLE_LUA case SNeutrinoSettings::ITEM_LUA: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_LUA; - lua = new CPluginList(LOCALE_MAINMENU_LUA,CPlugins::P_TYPE_LUA); keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MAINMENU_LUA, g_PluginList->hasPlugin(CPlugins::P_TYPE_LUA), NULL, lua, "-1", key, icon ); + menu_item = new CMenuDForwarder(LOCALE_MAINMENU_LUA, g_PluginList->hasPlugin(CPlugins::P_TYPE_LUA), NULL, new CPluginList(LOCALE_MAINMENU_LUA,CPlugins::P_TYPE_LUA), "-1", key, icon ); menu->addItem(menu_item, false); break; -#endif - case SNeutrinoSettings::ITEM_PLUGIN_TYPES: + case SNeutrinoSettings::ITEM_PLUGIN: { + unsigned int number_of_plugins = (unsigned int) g_PluginList->getNumberOfPlugins(); + if (!number_of_plugins) + continue; char id[5]; int cnt = 0; - for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++) + for (unsigned int count = 0; count < number_of_plugins; count++) { +#if 0 + bool show = g_PluginList->getType(count) == CPlugins::P_TYPE_TOOL || + g_PluginList->getType(count) == CPlugins::P_TYPE_LUA; +#endif bool show = false; if (g_settings.personalize[SNeutrinoSettings::P_UMENU_PLUGIN_TYPE_GAMES]) show = show || g_PluginList->getType(count) == CPlugins::P_TYPE_GAME; @@ -337,141 +308,266 @@ bool CUserMenu::showUserMenu(int button) show = show || g_PluginList->getType(count) == CPlugins::P_TYPE_TOOL; if (g_settings.personalize[SNeutrinoSettings::P_UMENU_PLUGIN_TYPE_SCRIPTS]) show = show || g_PluginList->getType(count) == CPlugins::P_TYPE_SCRIPT; -#if ENABLE_LUA if (g_settings.personalize[SNeutrinoSettings::P_UMENU_PLUGIN_TYPE_LUA]) show = show || g_PluginList->getType(count) == CPlugins::P_TYPE_LUA; -#endif if (show && !g_PluginList->isHidden(count)) { sprintf(id, "%d", count); menu_items++; - menu_prev = SNeutrinoSettings::ITEM_PLUGIN_TYPES; neutrino_msg_t d_key = g_PluginList->getKey(count); //printf("[neutrino usermenu] plugin %d, set key %d...\n", count, g_PluginList->getKey(count)); - StreamFeaturesChanger = new CStreamFeaturesChangeExec(); keyhelper.get(&key,&icon, d_key); - menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); - menu->addItem(menu_item, 0); + menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, &StreamFeaturesChanger, id, key, icon); + menu_item->setHint("", g_PluginList->getDescription(count)); + + menu->addItem(menu_item, false); cnt++; } } + menu_item = NULL; + break; } - break; - case SNeutrinoSettings::ITEM_VTXT: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_VTXT; keyhelper.get(&key,&icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT]].key); //CRCInput::RC_blue - StreamFeaturesChanger = new CStreamFeaturesChangeExec(); - menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, StreamFeaturesChanger, "teletext", key, icon); - menu->addItem(menu_item, 0); + menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, &StreamFeaturesChanger, "teletext", key, icon); + // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); break; case SNeutrinoSettings::ITEM_IMAGEINFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_IMAGEINFO; - imageinfo = new CImageInfo(); keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, imageinfo, NULL, key, icon ), false); + menu_item = new CMenuDForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, new CImageInfo, NULL, key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_IMAGEINFO, LOCALE_MENU_HINT_IMAGEINFO); break; case SNeutrinoSettings::ITEM_BOXINFO: - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_BOXINFO; - boxinfo = new CDBoxInfoWidget(); keyhelper.get(&key,&icon); - menu->addItem( new CMenuForwarder(LOCALE_EXTRA_DBOXINFO, true, NULL, boxinfo, NULL, key, icon)); + menu_item = new CMenuDForwarder(LOCALE_EXTRA_DBOXINFO, true, NULL, new CDBoxInfoWidget, NULL, key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_DBOXINFO, LOCALE_MENU_HINT_DBOXINFO); break; +#if !HAVE_SPARK_HARDWARE case SNeutrinoSettings::ITEM_CAM: - //if(cs_get_revision() != 10) - { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_CAM; - keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon)); - } + //if(cs_get_revision() == 10) continue; + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon); break; +#endif case SNeutrinoSettings::ITEM_CLOCK: - { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_CLOCK; - keyhelper.get(&key,&icon); - neutrino = CNeutrinoApp::getInstance(); - menu_item = new CMenuForwarder(!g_settings.mode_clock ? LOCALE_CLOCK_SWITCH_ON:LOCALE_CLOCK_SWITCH_OFF, true, NULL, neutrino, "clock_switch", key, icon); - menu->addItem(menu_item, false); - } + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(!g_settings.mode_clock ? LOCALE_CLOCK_SWITCH_ON:LOCALE_CLOCK_SWITCH_OFF, true, NULL, neutrino, "clock_switch", key, icon); + menu_item->setHint("", LOCALE_MENU_HINT_CLOCK_MODE); break; +#if 0 + case SNeutrinoSettings::ITEM_ADZAP: + keyhelper.get(&key,&icon,CRCInput::RC_blue); + menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_ADZAP, true, NULL, neutrino, "adzap", key, icon); + menu_item->setHint("", LOCALE_MENU_HINT_ADZAP); + break; + case SNeutrinoSettings::ITEM_TUNER_RESTART: + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_SERVICEMENU_RESTART_TUNER, true, NULL, neutrino, "restarttuner", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_RELOAD_CHANNELS, LOCALE_MENU_HINT_RESTART_TUNER); + break; + case SNeutrinoSettings::ITEM_RASS: + if (!(neutrino->getMode() == CNeutrinoApp::mode_radio && g_Radiotext && g_Radiotext->haveRASS())) + continue; + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_RASS_HEAD, true, NULL, neutrino, "rass", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_RASS, LOCALE_MENU_HINT_RASS); + break; + case SNeutrinoSettings::ITEM_NETZKINO: + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_NKPLAYBACK, true, NULL, neutrino, "nkplayback", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_NKPLAY, LOCALE_MENU_HINT_NKPLAY); + break; +#endif +#if HAVE_SPARK_HARDWARE + case SNeutrinoSettings::ITEM_THREE_D_MODE: + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_THREE_D_SETTINGS, true, NULL, neutrino, "3dmode", key, icon); + menu_item->setHint("", LOCALE_MENU_HINT_VIDEO_THREE_D); + break; +#endif case SNeutrinoSettings::ITEM_YOUTUBE: - { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_YOUTUBE; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, true, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", key, icon); - menu_item->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY); - menu->addItem(menu_item, 0); - } + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, true, NULL, neutrino, "ytplayback", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY); break; case SNeutrinoSettings::ITEM_FILEPLAY: - { - menu_items++; - menu_prev = SNeutrinoSettings::ITEM_FILEPLAY; - keyhelper.get(&key,&icon); - menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback", key, icon); - menu_item->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY); - menu->addItem(menu_item, 0); + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, neutrino, "fileplayback", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY); + break; + case SNeutrinoSettings::ITEM_AUDIOPLAY: + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_AUDIOPLAYER_NAME, true, NULL, neutrino, "audioplayer", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_APLAY, LOCALE_MENU_HINT_APLAY); + break; + case SNeutrinoSettings::ITEM_INETPLAY: + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, neutrino, "inetplayer", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_INET_RADIO, LOCALE_MENU_HINT_INET_RADIO); + break; + case SNeutrinoSettings::ITEM_HDDMENU: + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(LOCALE_HDD_SETTINGS, true, NULL, neutrino, "hddmenu", key, icon); + menu_item->setHint(NEUTRINO_ICON_HINT_HDD, LOCALE_MENU_HINT_HDD); + break; + case -1: // plugin + { + int number_of_plugins = g_PluginList->getNumberOfPlugins(); + if (!number_of_plugins) + continue; + int count = 0; + for(; count < number_of_plugins; count++) { + const char *pname = g_PluginList->getFileName(count); + if (pname && (std::string(pname) == *it)) { + keyhelper.get(&key,&icon); + menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, this, pname, key, icon); + const std::string hint = g_PluginList->getDescription(count); + if (hint != "") { + const char *hint_icon = NULL; + switch(g_PluginList->getType(count)) { + case CPlugins::P_TYPE_GAME: + hint_icon = NEUTRINO_ICON_HINT_GAMES; + break; + case CPlugins::P_TYPE_SCRIPT: + hint_icon = NEUTRINO_ICON_HINT_SCRIPTS; + break; + } + menu_item->setHint(hint_icon, hint); + } + break; + } } - break; - default: - printf("[neutrino] WARNING! menu wrong item!!\n"); - break; + if (count == number_of_plugins) + continue; + } + } + + itemstr_last = *it; + if (menu_item) { + menu_items++; + menu->addItem(menu_item, false); + last_menu_item = menu_item; } } -#if 0 - // Allow some tailoring for privat image bakers ;) - if (button == SNeutrinoSettings::BUTTON_RED) { - } - else if ( button == SNeutrinoSettings::BUTTON_GREEN) { - } - else if ( button == SNeutrinoSettings::BUTTON_YELLOW) { - } - else if ( button == SNeutrinoSettings::BUTTON_BLUE) { - } -#endif + extern CInfoClock *InfoClock; + InfoClock->enableInfoClock(false); // show menu if there are more than 2 items only // otherwise, we start the item directly (must be the last one) - if (menu_items > 1 ) { - menu->exec(NULL,""); - } - else if (menu_item != NULL) - menu_item->exec( NULL ); + if (menu_items > 1 ) + menu->exec(NULL, ""); + else if (last_menu_item) + last_menu_item->exec( NULL ); - user_menu[button].selected = menu->getSelected(); - - // clear the heap - if (tmpFavorites) delete tmpFavorites; - if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; - if (tmpNVODSelector) delete tmpNVODSelector; - if (streamInfo) delete streamInfo; - if (tmpEventListHandler) delete tmpEventListHandler; - if (tmpEPGplusHandler) delete tmpEPGplusHandler; - if (tmpEPGDataHandler) delete tmpEPGDataHandler; - if (Timerlist) delete Timerlist; - if (rcLock) delete rcLock; - if (StreamFeaturesChanger) delete StreamFeaturesChanger; - if (imageinfo) delete imageinfo; - if (boxinfo) delete boxinfo; - if (games) delete games; - if (tools) delete tools; - if (scripts) delete scripts; -#if ENABLE_LUA - if (lua) delete lua; -#endif - if (menu) delete menu; - InfoClock->enableInfoClock(true); + CNeutrinoApp::getInstance()->StartSubtitles(); - return 0; + if (button < COL_BUTTONMAX) + user_menu[button].selected = menu->getSelected(); + + delete menu; + + return true; +} + +const char *CUserMenu::getUserMenuButtonName(int button, bool &active) +{ + active = false; + if(button < 0 || button >= (int) g_settings.usermenu.size()) + return ""; + + bool return_title = false; + neutrino_locale_t loc = NONEXISTANT_LOCALE; + const char *text = NULL; + + std::vector items = ::split(g_settings.usermenu[button]->items, ','); + for (std::vector::iterator it = items.begin(); it != items.end(); ++it) { + int item = -1; + if (it->find_first_not_of("0123456789") == std::string::npos) + item = atoi(*it); + + switch(item) { + case -1: + if(loc != NONEXISTANT_LOCALE || text) + return_title = true; + else { + int nop = g_PluginList->getNumberOfPlugins(); + for(int count = 0; count < nop; count++) { + if (std::string(g_PluginList->getFileName(count)) == *it) { + text = g_PluginList->getName(count); + active = true; + break; + } + } + } + continue; + case SNeutrinoSettings::ITEM_NONE: + case SNeutrinoSettings::ITEM_BAR: + continue; + case SNeutrinoSettings::ITEM_EPG_MISC: + return_title = true; + active = true; + continue; + case SNeutrinoSettings::ITEM_SUBCHANNEL: + if (!g_RemoteControl->subChannels.empty()) { + if(loc == NONEXISTANT_LOCALE && !text) + loc = g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_HEAD; + else + return_title = true; + active = true; + } + continue; + case SNeutrinoSettings::ITEM_PLUGIN: + return_title = true; + continue; + case SNeutrinoSettings::ITEM_CLOCK: + if(loc == NONEXISTANT_LOCALE && !text) + loc = g_settings.mode_clock ? LOCALE_CLOCK_SWITCH_OFF : LOCALE_CLOCK_SWITCH_ON; + else + return_title = true; + active = true; + continue; + case SNeutrinoSettings::ITEM_AUDIO_SELECT: + if(loc == NONEXISTANT_LOCALE && !text) { + if (g_RemoteControl->current_PIDs.APIDs.size() > 0) + text = g_RemoteControl->current_PIDs.APIDs[ + g_RemoteControl->current_PIDs.PIDs.selected_apid].desc; + } else + return_title = true; + active = true; + continue; +#if 0 + case SNeutrinoSettings::ITEM_RASS: + if (!(CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio && g_Radiotext && g_Radiotext->haveRASS())) + continue; +#endif + default: + if(loc == NONEXISTANT_LOCALE && !text) + loc = CUserMenuSetup::getLocale(item); + else + return_title = true; + active = true; + continue; + } + if (return_title) + break; + } + + if (return_title) { + if (!g_settings.usermenu[button]->title.empty()) + return g_settings.usermenu[button]->title.c_str(); + if (button < USERMENU_ITEMS_COUNT) + return g_Locale->getText(usermenu[button].def_name); + } else { + if (text) + return text; + if (loc != NONEXISTANT_LOCALE) + return g_Locale->getText(loc); + } + + return ""; } /************************************************************************************** @@ -485,3 +581,11 @@ bool CUserMenu::changeNotify(const neutrino_locale_t OptionName, void * Data) return false; } + +int CUserMenu::exec(CMenuTarget* /*parent*/, const std::string & actionKey) +{ + if (actionKey == "") + return menu_return::RETURN_NONE; + g_PluginList->startPlugin(actionKey.c_str()); + return menu_return::RETURN_EXIT; +} diff --git a/src/gui/user_menue.h b/src/gui/user_menue.h index 701a25af7..878aa8a5f 100644 --- a/src/gui/user_menue.h +++ b/src/gui/user_menue.h @@ -55,7 +55,7 @@ typedef struct user_menu_data_t } user_menu_data_struct; #define COL_BUTTONMAX SNeutrinoSettings::BUTTON_MAX -static user_menu_data_t user_menu[COL_BUTTONMAX]= +static user_menu_data_t user_menu[COL_BUTTONMAX] = { {LOCALE_INFOVIEWER_EVENTLIST , CRCInput::RC_red , NEUTRINO_ICON_BUTTON_RED , NEUTRINO_ICON_RED, -1}, {LOCALE_INFOVIEWER_LANGUAGES , CRCInput::RC_green , NEUTRINO_ICON_BUTTON_GREEN , NEUTRINO_ICON_GREEN, -1}, @@ -63,20 +63,21 @@ static user_menu_data_t user_menu[COL_BUTTONMAX]= {LOCALE_INFOVIEWER_STREAMINFO , CRCInput::RC_blue , NEUTRINO_ICON_BUTTON_BLUE , NEUTRINO_ICON_FEATURES, -1} }; -// #define COL_BUTTONMAX SNeutrinoSettings::BUTTON_MAX // const neutrino_msg_t col_key_helper_msg_def[COL_BUTTONMAX]={CRCInput::RC_red,CRCInput::RC_green,CRCInput::RC_yellow,CRCInput::RC_blue}; // const char * col_key_helper_icon_def[COL_BUTTONMAX]={NEUTRINO_ICON_BUTTON_RED,NEUTRINO_ICON_BUTTON_GREEN,NEUTRINO_ICON_BUTTON_YELLOW,NEUTRINO_ICON_BUTTON_BLUE}; -class CUserMenu : public CChangeObserver +class CUserMenu : public CChangeObserver, CMenuTarget { private: int width; bool changeNotify(const neutrino_locale_t OptionName, void *); + int exec(CMenuTarget* parent, const std::string & actionKey); public: CUserMenu(); ~CUserMenu(); - bool showUserMenu(int button); + bool showUserMenu(neutrino_msg_t msg); + static const char *getUserMenuButtonName(int button, bool &active); }; diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index 2c7ae6de2..2afd1489f 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -46,163 +47,256 @@ #include +#include #include +static bool usermenu_show = true; +#if 0 +#if HAVE_SPARK_HARDWARE +static bool usermenu_show_three_d_mode = true; +#else +static bool usermenu_show_three_d_mode = false; +#endif +#endif +#if HAVE_SPARK_HARDWARE +static bool usermenu_show_cam = false; // FIXME -- use hwcaps? +#else +static bool usermenu_show_cam = true; // FIXME -- use hwcaps? +#endif +struct keyvals +{ + const int key; + const neutrino_locale_t value; + bool &show; +}; + +static keyvals usermenu_items[] = +{ + { SNeutrinoSettings::ITEM_NONE, LOCALE_USERMENU_ITEM_NONE, usermenu_show }, + { SNeutrinoSettings::ITEM_BAR, LOCALE_USERMENU_ITEM_BAR, usermenu_show }, + { SNeutrinoSettings::ITEM_EPG_LIST, LOCALE_EPGMENU_EVENTLIST, usermenu_show }, + { SNeutrinoSettings::ITEM_EPG_SUPER, LOCALE_EPGMENU_EPGPLUS, usermenu_show }, + { SNeutrinoSettings::ITEM_EPG_INFO, LOCALE_EPGMENU_EVENTINFO, usermenu_show }, + { SNeutrinoSettings::ITEM_EPG_MISC, LOCALE_USERMENU_ITEM_EPG_MISC, usermenu_show }, + { SNeutrinoSettings::ITEM_AUDIO_SELECT, LOCALE_AUDIOSELECTMENUE_HEAD, usermenu_show }, + { SNeutrinoSettings::ITEM_SUBCHANNEL, LOCALE_INFOVIEWER_SUBSERVICE, usermenu_show }, + { SNeutrinoSettings::ITEM_FILEPLAY, LOCALE_MOVIEPLAYER_FILEPLAYBACK, usermenu_show }, + { SNeutrinoSettings::ITEM_AUDIOPLAY, LOCALE_AUDIOPLAYER_NAME, usermenu_show }, + { SNeutrinoSettings::ITEM_INETPLAY, LOCALE_INETRADIO_NAME, usermenu_show }, + { SNeutrinoSettings::ITEM_MOVIEPLAYER_MB, LOCALE_MOVIEBROWSER_HEAD, usermenu_show }, + { SNeutrinoSettings::ITEM_TIMERLIST, LOCALE_TIMERLIST_NAME, usermenu_show }, + { SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_MENUEADD, usermenu_show }, + { SNeutrinoSettings::ITEM_FAVORITS, LOCALE_FAVORITES_MENUEADD, usermenu_show }, + { SNeutrinoSettings::ITEM_TECHINFO, LOCALE_EPGMENU_STREAMINFO, usermenu_show }, + { SNeutrinoSettings::ITEM_PLUGIN, LOCALE_TIMERLIST_PLUGIN, usermenu_show }, + { SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT, usermenu_show }, + { SNeutrinoSettings::ITEM_IMAGEINFO, LOCALE_SERVICEMENU_IMAGEINFO, usermenu_show }, + { SNeutrinoSettings::ITEM_BOXINFO, LOCALE_EXTRA_DBOXINFO, usermenu_show }, + { SNeutrinoSettings::ITEM_CAM, LOCALE_CI_SETTINGS, usermenu_show_cam }, + { SNeutrinoSettings::ITEM_CLOCK, LOCALE_CLOCK_SWITCH_ON, usermenu_show }, + { SNeutrinoSettings::ITEM_GAMES, LOCALE_MAINMENU_GAMES, usermenu_show }, + { SNeutrinoSettings::ITEM_TOOLS, LOCALE_MAINMENU_TOOLS, usermenu_show }, + { SNeutrinoSettings::ITEM_SCRIPTS, LOCALE_MAINMENU_SCRIPTS, usermenu_show }, + { SNeutrinoSettings::ITEM_LUA, LOCALE_MAINMENU_LUA, usermenu_show }, +#if 0 + { SNeutrinoSettings::ITEM_ADZAP, LOCALE_USERMENU_ITEM_ADZAP, usermenu_show }, + { SNeutrinoSettings::ITEM_TUNER_RESTART, LOCALE_SERVICEMENU_RESTART_TUNER, usermenu_show }, + { SNeutrinoSettings::ITEM_THREE_D_MODE, LOCALE_THREE_D_SETTINGS, usermenu_show_three_d_mode }, + { SNeutrinoSettings::ITEM_RASS, LOCALE_RASS_HEAD, usermenu_show }, + { SNeutrinoSettings::ITEM_NETZKINO, LOCALE_MOVIEPLAYER_NKPLAYBACK, usermenu_show }, +#endif + { SNeutrinoSettings::ITEM_YOUTUBE, LOCALE_MOVIEPLAYER_YTPLAYBACK, usermenu_show }, + { SNeutrinoSettings::ITEM_RECORD, LOCALE_TIMERLIST_TYPE_RECORD, usermenu_show }, + { SNeutrinoSettings::ITEM_HDDMENU, LOCALE_HDD_SETTINGS, usermenu_show }, + { SNeutrinoSettings::ITEM_MAX, NONEXISTANT_LOCALE, usermenu_show } +}; + CUserMenuSetup::CUserMenuSetup(neutrino_locale_t menue_title, int menue_button) { local = menue_title; button = menue_button; max_char = 24; width = w_max (40, 10); - pref_name = g_settings.usermenu_text[button]; //set current button name as prefered name - ums = NULL; + if (menue_button < (int) g_settings.usermenu.size()) + pref_name = g_settings.usermenu[button]->title; //set current button name as prefered name + forwarder = NULL; + + for (int i = 0; usermenu_items[i].key != SNeutrinoSettings::ITEM_MAX; i++) { + const char *loc = g_Locale->getText(usermenu_items[i].value); + if (usermenu_items[i].show) + options.push_back(loc); + keys[loc] = to_string(usermenu_items[i].key); + vals[keys[loc]] = loc; + } + + int number_of_plugins = g_PluginList->getNumberOfPlugins(); + for (int count = 0; count < number_of_plugins; count++) { + const char *loc = g_PluginList->getName(count); + const char *key = g_PluginList->getFileName(count); + if (loc && *loc && key && *key) { + options.push_back(loc); + keys[loc] = key; + vals[keys[loc]] = loc; + } + } + std::sort(options.begin(), options.end()); } CUserMenuSetup::~CUserMenuSetup() { - delete ums; } -#define USERMENU_ITEM_OPTION_COUNT SNeutrinoSettings::ITEM_MAX -const CMenuOptionChooser::keyval USERMENU_ITEM_OPTIONS[USERMENU_ITEM_OPTION_COUNT] = +int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &actionKey) { - { SNeutrinoSettings::ITEM_NONE, LOCALE_USERMENU_ITEM_NONE }, - { SNeutrinoSettings::ITEM_BAR, LOCALE_USERMENU_ITEM_BAR }, - { SNeutrinoSettings::ITEM_EPG_LIST, LOCALE_EPGMENU_EVENTLIST }, - { SNeutrinoSettings::ITEM_EPG_SUPER, LOCALE_EPGMENU_EPGPLUS }, - { SNeutrinoSettings::ITEM_EPG_INFO, LOCALE_EPGMENU_EVENTINFO }, - { SNeutrinoSettings::ITEM_EPG_MISC, LOCALE_USERMENU_ITEM_EPG_MISC }, - { SNeutrinoSettings::ITEM_AUDIO_SELECT, LOCALE_AUDIOSELECTMENUE_HEAD }, - { SNeutrinoSettings::ITEM_SUBCHANNEL, LOCALE_INFOVIEWER_SUBSERVICE }, - { SNeutrinoSettings::ITEM_MOVIEPLAYER_MB, LOCALE_MOVIEBROWSER_HEAD }, - { SNeutrinoSettings::ITEM_TIMERLIST, LOCALE_TIMERLIST_NAME }, - { SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_MENUEADD }, - { SNeutrinoSettings::ITEM_FAVORITS, LOCALE_FAVORITES_MENUEADD }, - { SNeutrinoSettings::ITEM_TECHINFO, LOCALE_EPGMENU_STREAMINFO }, - { SNeutrinoSettings::ITEM_PLUGIN_TYPES, LOCALE_USERMENU_ITEM_PLUGIN_TYPES }, - { SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT }, - { SNeutrinoSettings::ITEM_IMAGEINFO, LOCALE_SERVICEMENU_IMAGEINFO }, - { SNeutrinoSettings::ITEM_BOXINFO, LOCALE_EXTRA_DBOXINFO }, - { SNeutrinoSettings::ITEM_CAM, LOCALE_CI_SETTINGS }, - { SNeutrinoSettings::ITEM_CLOCK, LOCALE_CLOCK_SWITCH_ON }, - { SNeutrinoSettings::ITEM_GAMES, LOCALE_MAINMENU_GAMES }, - { SNeutrinoSettings::ITEM_SCRIPTS, LOCALE_MAINMENU_SCRIPTS }, - { SNeutrinoSettings::ITEM_RECORD, LOCALE_TIMERLIST_TYPE_RECORD }, - { SNeutrinoSettings::ITEM_YOUTUBE, LOCALE_MOVIEPLAYER_YTPLAYBACK }, - { SNeutrinoSettings::ITEM_FILEPLAY, LOCALE_MOVIEPLAYER_FILEPLAYBACK }, - { SNeutrinoSettings::ITEM_TOOLS, LOCALE_MAINMENU_TOOLS }, - { SNeutrinoSettings::ITEM_LUA, LOCALE_MAINMENU_LUA } -}; + if (actionKey == ">d") { + int selected = ums->getSelected(); + if (selected >= item_offset) { + if(parent) + parent->hide(); + ums->removeItem(selected); + ums->hide(); + return menu_return::RETURN_REPAINT; + } + return menu_return::RETURN_NONE; + } -int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &) -{ - if(parent != NULL) + if(parent) parent->hide(); - + + if (actionKey == ">a") { + int selected = ums->getSelected(); + CMenuOptionStringChooser *c = new CMenuOptionStringChooser(std::string(""), NULL, true, NULL, CRCInput::RC_nokey, NULL, true); + c->setOptions(options); + std::string n(g_Locale->getText(LOCALE_USERMENU_ITEM_NONE)); + c->setOptionValue(n); + if (selected >= item_offset) + ums->insertItem(selected, c); + else + ums->addItem(c); + ums->hide(); + return menu_return::RETURN_REPAINT; + } + int res = showSetup(); checkButtonName(); return res; } +static neutrino_locale_t locals[SNeutrinoSettings::ITEM_MAX]; +neutrino_locale_t CUserMenuSetup::getLocale(unsigned int key) +{ + static bool initialized = false; + if (!initialized) { + initialized = true; + for (int i = 0; i < SNeutrinoSettings::ITEM_MAX; i++) + locals[i] = NONEXISTANT_LOCALE; + for (int i = 0; usermenu_items[i].key != SNeutrinoSettings::ITEM_MAX; i++) + locals[usermenu_items[i].key] = usermenu_items[i].value; + } + return locals[key]; +} + int CUserMenuSetup::showSetup() { - if (ums == NULL) { - mn_widget_id_t widget_id = MN_WIDGET_ID_USERMENU_RED + button; //add up ''button'' and becomes to MN_WIDGET_ID_USERMENU_ GREEN, MN_WIDGET_ID_USERMENU_ YELLOW, MN_WIDGET_ID_USERMENU_BLUE - ums = new CMenuWidget(local, NEUTRINO_ICON_KEYBINDING, width, widget_id); - }else{ - //if widget not clean, ensure that we have an empty widget without any item and set the last selected item - int sel = ums->getSelected(); - ums->resetWidget(true); - ums->setSelected(sel); - } - - //CUserMenuNotifier *notify = new CUserMenuNotifier(); - CStringInputSMS name(LOCALE_USERMENU_NAME, &g_settings.usermenu_text[button], 11, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüß/- "/*, notify*/); + mn_widget_id_t widget_id = (button < SNeutrinoSettings::BUTTON_MAX) ? MN_WIDGET_ID_USERMENU_RED + button : NO_WIDGET_ID; + ums = new CMenuWidget(local, NEUTRINO_ICON_KEYBINDING, width, widget_id); - CMenuForwarder * mf = new CMenuForwarder(LOCALE_USERMENU_NAME, true, g_settings.usermenu_text[button],&name); - - //------------------------------------- ums->addIntroItems(); - //------------------------------------- + + int old_key = g_settings.usermenu[button]->key; + CStringInputSMS name(LOCALE_USERMENU_NAME, &g_settings.usermenu[button]->title, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüß/- "/*, notify*/); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_USERMENU_NAME, true, NULL, &name); + ums->addItem(mf); - ums->addItem(GenericMenuSeparatorLine); - //------------------------------------- - char text[max_char]; - for(int item = 0; item < SNeutrinoSettings::ITEM_MAX && item <13; item++) // Do not show more than 13 items - { - snprintf(text,max_char,"%d.",item+1); - text[max_char-1]=0;// terminate for sure - int count = (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) ? USERMENU_ITEM_OPTION_COUNT : USERMENU_ITEM_OPTION_COUNT - 1; - ums->addItem(new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, count,true, NULL, CRCInput::RC_nokey, "", true, true)); + + if (button >= SNeutrinoSettings::BUTTON_MAX) { + CKeyChooser *kc = new CKeyChooser(&g_settings.usermenu[button]->key, LOCALE_USERMENU_KEY_SELECT, NEUTRINO_ICON_SETTINGS); + CMenuDForwarder *kf = new CMenuDForwarder(LOCALE_USERMENU_KEY, true, kc->getKeyName(), kc); + ums->addItem(kf); } - + + ums->addItem(new CMenuSeparator(CMenuSeparator::STRING | CMenuSeparator::LINE, LOCALE_USERMENU_ITEMS)); + + std::vector items = ::split(g_settings.usermenu[button]->items, ','); + item_offset = ums->getItemsCount(); + for (std::vector::iterator it = items.begin(); it != items.end(); ++it) { + CMenuOptionStringChooser *c = new CMenuOptionStringChooser(std::string(""), NULL, true, NULL, CRCInput::RC_nokey, NULL, true); + c->setTitle(LOCALE_USERMENU_ITEMS); + c->setOptions(options); + c->setOptionValue(vals[*it]); + ums->addItem(c); + } + + const struct button_label footerButtons[2] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_BOUQUETEDITOR_DELETE }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_BOUQUETEDITOR_ADD } + }; + ums->setFooter(footerButtons, 2); + ums->addKey(CRCInput::RC_red, this, ">d"); + ums->addKey(CRCInput::RC_green, this, ">a"); + int res = ums->exec(NULL, ""); + int items_end = ums->getItemsCount(); + + const char *delim = ""; + g_settings.usermenu[button]->items = ""; + std::string none = to_string(SNeutrinoSettings::ITEM_NONE); + for (int count = item_offset; count < items_end; count++) { + std::string lk = keys[static_cast(ums->getItem(count))->getOptionValue()]; + if (lk == none) + continue; + g_settings.usermenu[button]->items += delim + lk; + delim = ","; + } + + delete ums; + + if (forwarder && (old_key != (int) g_settings.usermenu[button]->key)) + forwarder->setName(CRCInput::getKeyName(g_settings.usermenu[button]->key)); return res; } + //check items of current button menu and set prefered menue name void CUserMenuSetup::checkButtonItems() { - //count of all items of widget - int count = ums->getItemsCount(); - //count of configured items int used_items = getUsedItemsCount(); //warn if no items defined and reset menu name, if empty if (used_items == 0){ - if (!g_settings.usermenu_text[button].empty()){ - DisplayInfoMessage(g_Locale->getText(LOCALE_USERMENU_MSG_WARNING_NO_ITEMS)); - g_settings.usermenu_text[button] = ""; + if (!g_settings.usermenu[button]->title.empty()){ + // DisplayInfoMessage(g_Locale->getText(LOCALE_USERMENU_MSG_WARNING_NO_ITEMS)); + g_settings.usermenu[button]->title = ""; } return; } - - //found configured items and set as prefered name - for(int i = 0; i < count ; i++) - { - if (ums->getItem(i)->isMenueOptionChooser()) //choosers only - { - CMenuOptionChooser * opt_c = NULL; - opt_c = static_cast (ums->getItem(i)); - neutrino_locale_t opt_locale = USERMENU_ITEM_OPTIONS[opt_c->getOption()].value; - int set_key = USERMENU_ITEM_OPTIONS[opt_c->getOption()].key; - opt_c = NULL; - - if (set_key != SNeutrinoSettings::ITEM_NONE) - pref_name = g_Locale->getText(opt_locale); - - //warn if we have more than 1 items and the name of usermenu ist the same like before, exit function and let user decide, what to do - if (used_items > 1 && g_settings.usermenu_text[button]==pref_name){ - DisplayInfoMessage(g_Locale->getText(LOCALE_USERMENU_MSG_WARNING_NAME)); - return; - } - } + + //if found only 1 configured item, ensure that the caption of usermenu is the same like this + if (used_items == 1) { + bool dummy; + g_settings.usermenu[button]->title = CUserMenu::getUserMenuButtonName(button, dummy); } - - if (used_items == 1) - g_settings.usermenu_text[button] = pref_name; //if found only 1 configured item, ensure that the caption of usermenu is the same like this } //check button name for details like empty string and show an user message on issue void CUserMenuSetup::checkButtonName() -{ +{ checkButtonItems(); //exit function, if no items found if (getUsedItemsCount() == 0) return; - bool is_empty = g_settings.usermenu_text[button].empty(); - if (is_empty) + if (button < USERMENU_ITEMS_COUNT && g_settings.usermenu[button]->title.empty()) { - std::string msg = g_Locale->getText(LOCALE_USERMENU_MSG_INFO_IS_EMPTY); - msg += g_Locale->getText(usermenu[button].def_name); - + std::string msg(g_Locale->getText(LOCALE_USERMENU_MSG_INFO_IS_EMPTY)); + msg += g_Locale->getText(usermenu[button].def_name); DisplayInfoMessage(msg.c_str()); - g_settings.usermenu_text[button] = is_empty ? g_Locale->getText(usermenu[button].def_name) : g_settings.usermenu_text[button].c_str(); + + g_settings.usermenu[button]->title = g_Locale->getText(usermenu[button].def_name); } } @@ -210,11 +304,6 @@ void CUserMenuSetup::checkButtonName() //get count of used items int CUserMenuSetup::getUsedItemsCount() { - int def_items = 0; - for(int item = 0; item < SNeutrinoSettings::ITEM_MAX; item++) - if (g_settings.usermenu[button][item] != 0) - def_items++; - - return def_items; + return ::split(g_settings.usermenu[button]->items, ',').size(); } diff --git a/src/gui/user_menue_setup.h b/src/gui/user_menue_setup.h index 2cc2b5190..8f0041b1c 100644 --- a/src/gui/user_menue_setup.h +++ b/src/gui/user_menue_setup.h @@ -37,6 +37,8 @@ #include #include +#include +#include typedef struct usermenu_props_t { @@ -48,7 +50,7 @@ typedef struct usermenu_props_t }usermenu_props_struct_t; -#define USERMENU_ITEMS_COUNT 4 +#define USERMENU_ITEMS_COUNT SNeutrinoSettings::BUTTON_MAX const struct usermenu_props_t usermenu[USERMENU_ITEMS_COUNT] = { {LOCALE_USERMENU_BUTTON_RED , SNeutrinoSettings::BUTTON_RED , CRCInput::RC_red ,NEUTRINO_ICON_BUTTON_RED ,LOCALE_INFOVIEWER_EVENTLIST }, @@ -64,20 +66,26 @@ class CUserMenuSetup : public CMenuTarget int width; int max_char; int button; + int item_offset; std::string pref_name; neutrino_locale_t local; + CMenuForwarder *forwarder; + CMenuWidget * ums; + std::vector options; + std::map keys; + std::map vals; int showSetup(); void checkButtonItems(); void checkButtonName(); - - CMenuWidget * ums; - + public: CUserMenuSetup(neutrino_locale_t menue_title, int menue_button); ~CUserMenuSetup(); + void setCaller(CMenuForwarder *fw) { forwarder = fw ; } int getUsedItemsCount(); int exec(CMenuTarget* parent, const std::string & actionKey); + static neutrino_locale_t getLocale(unsigned int i); }; diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 0b1ba2c42..835ae95b6 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -284,7 +284,7 @@ int ShowHint(const char * const Caption, const char * const Text, const int Widt res = messages_return::handled; break; } - else if((msg == CRCInput::RC_next) || (msg == CRCInput::RC_prev)) { + else if((msg == (neutrino_msg_t) g_settings.key_switchformat) || (msg == (neutrino_msg_t) g_settings.key_next43mode)) { res = messages_return::cancel_all; g_RCInput->postMsg(msg, data); } diff --git a/src/gui/widget/keychooser.cpp b/src/gui/widget/keychooser.cpp index 960a4b3d8..a0e1c99b3 100644 --- a/src/gui/widget/keychooser.cpp +++ b/src/gui/widget/keychooser.cpp @@ -64,7 +64,7 @@ public: -CKeyChooser::CKeyChooser(int * const Key, const neutrino_locale_t title, const std::string & Icon) : CMenuWidget(title, Icon) +CKeyChooser::CKeyChooser(unsigned int * const Key, const neutrino_locale_t title, const std::string & Icon) : CMenuWidget(title, Icon) { frameBuffer = CFrameBuffer::getInstance(); key = Key; @@ -76,7 +76,7 @@ CKeyChooser::CKeyChooser(int * const Key, const neutrino_locale_t title, const s addItem(GenericMenuSeparatorLine); addItem(GenericMenuBack); addItem(GenericMenuSeparatorLine); - addItem(new CMenuForwarder(LOCALE_KEYCHOOSERMENU_SETNEW , true, NULL, keyChooser)); + addItem(new CMenuForwarder(LOCALE_KEYCHOOSERMENU_SETNEW, true, NULL, keyChooser)); addItem(new CMenuForwarder(LOCALE_KEYCHOOSERMENU_SETNONE, true, NULL, keyDeleter)); } @@ -96,7 +96,7 @@ void CKeyChooser::paint() } //***************************** -CKeyChooserItem::CKeyChooserItem(const neutrino_locale_t Name, int * Key) +CKeyChooserItem::CKeyChooserItem(const neutrino_locale_t Name, unsigned int * Key) { name = Name; key = Key; @@ -117,7 +117,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) parent->hide(); paint(); - + CFrameBuffer::getInstance()->blit(); g_RCInput->clearRCMsg(); g_RCInput->setLongPressAny(true); @@ -147,6 +147,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) void CKeyChooserItem::hide() { CFrameBuffer::getInstance()->paintBackgroundBoxRel(x, y, width, height); + CFrameBuffer::getInstance()->blit(); } void CKeyChooserItem::paint() diff --git a/src/gui/widget/keychooser.h b/src/gui/widget/keychooser.h index 3c132aeb6..d7495dc45 100644 --- a/src/gui/widget/keychooser.h +++ b/src/gui/widget/keychooser.h @@ -49,13 +49,13 @@ class CKeyChooser : public CMenuWidget { private: CFrameBuffer *frameBuffer; - int* key; + unsigned int * key; std::string keyName; CKeyChooserItem *keyChooser; CKeyChooserItemNoKey *keyDeleter; public: - CKeyChooser(int * const Key, const neutrino_locale_t title, const std::string & Icon = ""); + CKeyChooser(unsigned int * const Key, const neutrino_locale_t title, const std::string & Icon = ""); ~CKeyChooser(); void paint(); @@ -72,13 +72,13 @@ class CKeyChooserItem : public CMenuTarget int height; neutrino_locale_t name; - int * key; + unsigned int * key; void paint(); public: - CKeyChooserItem(const neutrino_locale_t Name, int *Key); + CKeyChooserItem(const neutrino_locale_t Name, unsigned int *Key); void hide(); int exec(CMenuTarget* parent, const std::string & actionKey); @@ -87,11 +87,11 @@ class CKeyChooserItem : public CMenuTarget class CKeyChooserItemNoKey : public CMenuTarget { - int *key; + unsigned int * key; public: - CKeyChooserItemNoKey(int *Key) + CKeyChooserItemNoKey(unsigned int *Key) { key=Key; }; diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index 2d706d098..2e5e9379a 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -189,10 +189,10 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/) { loop = false; } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) { if(getItemCount()!=0) { - int step = (msg == (neutrino_msg_t)g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 int new_selected = selected - step; if (new_selected < 0) { @@ -204,10 +204,10 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/) updateSelection(new_selected); } } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { if(getItemCount()!=0) { - int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 int new_selected = selected + step; if (new_selected >= (int) getItemCount()) { if ((getItemCount() - listmaxshow -1 < selected) && (selected != (getItemCount() - 1)) && (step != 1)) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index fb1b4523d..c72d77a07 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -45,13 +45,11 @@ #include #include #include -#if ENABLE_LUA extern "C" { #include #include #include } -#endif #define NO_WIDGET_ID -1 @@ -77,12 +75,10 @@ class CChangeObserver { return false; } -#if ENABLE_LUA virtual bool changeNotify(lua_State * /*L*/, const std::string & /*luaId*/, const std::string & /*luaAction*/, void * /*Data*/) { return false; } -#endif }; class CMenuTarget @@ -109,11 +105,9 @@ class CMenuItem fb_pixel_t item_color, item_bgcolor; void initItemColors(const bool select_mode); -#if ENABLE_LUA lua_State *luaState; std::string luaAction; std::string luaId; -#endif neutrino_locale_t name; std::string nameString; neutrino_locale_t desc; @@ -176,9 +170,7 @@ class CMenuItem virtual int isMenueOptionChooser(void) const{return 0;} void setHint(const char * const icon, const neutrino_locale_t text) { hintIcon = (icon && *icon) ? icon : NULL; hint = text; } void setHint(const char * const icon, const std::string text) { hintIcon = (icon && *icon) ? icon : NULL; hintText = text; } -#if ENABLE_LUA void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; }; -#endif virtual const char *getName(); virtual void setName(const std::string& text); virtual void setName(const neutrino_locale_t text); diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 18afdb93d..649dd57b1 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -159,7 +160,7 @@ void CStringInput::NormalKeyPressed(const neutrino_msg_t key) if (selected >= (int)valueString->length()) valueString->append(selected - valueString->length() + 1, ' '); valueString->at(selected) = validchars[CRCInput::getNumericValue(key)]; - int current_value = atoi((*valueString).c_str()); + int current_value = atoi(*valueString); int tmp = current_value; if (lower_bound != -1 || upper_bound != -1) { @@ -258,7 +259,7 @@ void CStringInput::keyUpPressed() npos = 0; valueString->at(selected)=validchars[npos]; - int current_value = atoi((*valueString).c_str()); + int current_value = atoi(*valueString); int tmp = current_value; if (lower_bound != -1 || upper_bound != -1) { @@ -294,7 +295,7 @@ void CStringInput::keyDownPressed() npos = strlen(validchars)-1; valueString->at(selected)=validchars[npos]; - int current_value = atoi((*valueString).c_str()); + int current_value = atoi(*valueString); int tmp = current_value; if (lower_bound != -1 || upper_bound != -1) { @@ -405,6 +406,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) bool loop=true; while (loop) { + frameBuffer->blit(); if (*valueString != dispval) { CVFD::getInstance()->showMenuText(1,valueString->c_str() , selected+1); @@ -469,10 +471,10 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) else if (msg==CRCInput::RC_down) { keyDownPressed(); - } else if (msg==CRCInput::RC_plus) + } else if (msg==(neutrino_msg_t)g_settings.key_volumeup) { keyPlusPressed(); - } else if (msg==CRCInput::RC_minus) + } else if (msg==(neutrino_msg_t)g_settings.key_volumedown) { keyMinusPressed(); } @@ -516,6 +518,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) { frameBuffer->RestoreScreen(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET, pixbuf); delete[] pixbuf;//Mismatching allocation and deallocation: pixbuf + frameBuffer->blit(); } else hide(); @@ -536,6 +539,7 @@ int CStringInput::handleOthers(const neutrino_msg_t /*msg*/, const neutrino_msg_ void CStringInput::hide() { frameBuffer->paintBackgroundBoxRel(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET); + frameBuffer->blit(); } void CStringInput::paint(bool sms) @@ -803,6 +807,7 @@ int CPINInput::exec( CMenuTarget* parent, const std::string & ) while(loop) { + frameBuffer->blit(); g_RCInput->getMsg( &msg, &data, 300 ); if (msg==CRCInput::RC_left) diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index 17d7ab97d..962ebc780 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -66,7 +67,7 @@ void CExtendedInput::Init(void) width = frameBuffer->getScreenWidth() / 100 * 45; - int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name)); + int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name)); // UTF-8 width = std::max(width, tmp_w + offset); bheight = input_h + 2*offset; @@ -151,6 +152,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) std::string oldval = *valueString; std::string dispval = *valueString; paint(); + frameBuffer->blit(); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); @@ -265,6 +267,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) *cancel = true; res = menu_return::RETURN_EXIT_ALL; } + frameBuffer->blit(); } hide(); @@ -282,6 +285,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) void CExtendedInput::hide() { frameBuffer->paintBackgroundBoxRel(x, y, width, height); + frameBuffer->blit(); } void CExtendedInput::paint() @@ -604,7 +608,7 @@ CTimeInput::CTimeInput(const neutrino_locale_t Name, std::string* Value, const n { valueString = Value; frameBuffer = CFrameBuffer::getInstance(); -#if 0 +#if 1 // As nobody else seems to use this class I feel free to make some minor (and mostly backwards-compatible) // adjustments to make it suitable for movieplayer playtime selection ... --martii @@ -688,7 +692,7 @@ void CIntInput::onBeforeExec() void CIntInput::onAfterExec() { - *myValue = atoi((*valueString).c_str()); + *myValue = atoi(*valueString); } //-----------------------------#################################------------------------------------------------------- diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 5bb0ff660..8e62c370e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -86,6 +86,7 @@ #include "gui/start_wizard.h" #include "gui/update_ext.h" #include "gui/videosettings.h" +#include "gui/audio_select.h" #include "gui/widget/hintbox.h" #include "gui/widget/icons.h" @@ -197,9 +198,6 @@ static char **global_argv; extern const char * locale_real_names[]; /* #include */ -// USERMENU -const char* usermenu_button_def[SNeutrinoSettings::BUTTON_MAX]={"red","green","yellow","blue"}; - /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + CNeutrinoApp - Constructor, initialize g_fontRenderer + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -268,6 +266,28 @@ const lcd_setting_struct_t lcd_setting[SNeutrinoSettings::LCD_SETTING_COUNT] = ,{ "lcd_epgmode" , 0 /*DEFAULT_LCD_EPGMODE*/ } #endif }; +#if 0 +const char* usermenu_default[SNeutrinoSettings::BUTTON_MAX]={ + "2,3,4,13", // RED + "6", // GREEN + "7", // YELLOW + "12,11,20,21,19,14,15" // BLUE +}; +#endif +static SNeutrinoSettings::usermenu_t usermenu_default[] = { + { CRCInput::RC_red, "2,3,4,13", "", "red" }, + { CRCInput::RC_green, "6", "", "green" }, + { CRCInput::RC_yellow, "7", "", "yellow" }, + { CRCInput::RC_blue, "12,11,20,21,19,14,15", "", "blue" }, + { CRCInput::RC_play, "9", "", "5" }, + { CRCInput::RC_audio, "27", "", "6" }, +#if 0 + { CRCInput::RC_timer, "19", "", "7" }, + { CRCInput::RC_usb, "31", "", "6" }, + { CRCInput::RC_archive, "30", "", "4" }, +#endif + { CRCInput::RC_nokey, "", "", "" }, +}; /************************************************************************************** * CNeutrinoApp - loadSetup, load the application-settings * @@ -623,7 +643,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_type = configfile.getInt32("recording_type", RECORDING_FILE); g_settings.recording_stopsectionsd = configfile.getBool("recording_stopsectionsd" , false ); g_settings.recording_audio_pids_default = configfile.getInt32("recording_audio_pids_default", - g_settings.easymenu ? TIMERD_APIDS_ALL : TIMERD_APIDS_STD | TIMERD_APIDS_AC3); + g_settings.easymenu ? TIMERD_APIDS_ALL : TIMERD_APIDS_STD | TIMERD_APIDS_AC3); g_settings.recording_zap_on_announce = configfile.getBool("recording_zap_on_announce" , false); g_settings.shutdown_timer_record_type = configfile.getBool("shutdown_timer_record_type" , false); @@ -640,8 +660,14 @@ int CNeutrinoApp::loadSetup(const char * fname) // default plugin for movieplayer g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "noplugin" ); - g_settings.onekey_plugin = configfile.getString( "onekey_plugin", "noplugin" ); g_settings.plugin_hdd_dir = configfile.getString( "plugin_hdd_dir", "/media/sda1/plugins" ); + + g_settings.plugins_disabled = configfile.getString( "plugins_disabled", "" ); + g_settings.plugins_game = configfile.getString( "plugins_game", "" ); + g_settings.plugins_tool = configfile.getString( "plugins_tool", "" ); + g_settings.plugins_script = configfile.getString( "plugins_script", "" ); + g_settings.plugins_lua = configfile.getString( "plugins_lua", "" ); + g_settings.logo_hdd_dir = configfile.getString( "logo_hdd_dir", "/media/sda1/logos" ); int webtv_count = configfile.getInt32("webtv_xml_count", 0); @@ -804,44 +830,38 @@ int CNeutrinoApp::loadSetup(const char * fname) // USERMENU -> in system/settings.h //------------------------------------------- - // this is as the current neutrino usermen - const char* usermenu_default[SNeutrinoSettings::BUTTON_MAX]={ - "2,3,4,13", // RED - "6", // GREEN - "7", // YELLOW - "12,11,20,21,19,14,15" // BLUE - }; - char txt1[81]; - std::string txt2; - const char* txt2ptr; - for(int button = 0; button < SNeutrinoSettings::BUTTON_MAX; button++) + + if (configfile.getString("usermenu_key_red", "").empty() || + configfile.getString("usermenu_key_green", "").empty() || + configfile.getString("usermenu_key_yellow", "").empty() || + configfile.getString("usermenu_key_blue", "").empty()) { - snprintf(txt1,80,"usermenu_tv_%s_text",usermenu_button_def[button]); - txt1[80] = 0; // terminate for sure - g_settings.usermenu_text[button] = configfile.getString(txt1, ""); - - snprintf(txt1,80,"usermenu_tv_%s",usermenu_button_def[button]); - txt2 = configfile.getString(txt1,usermenu_default[button]); - txt2ptr = txt2.c_str(); - for( int pos = 0; pos < SNeutrinoSettings::ITEM_MAX; pos++) - { - // find next comma or end of string - if it's not the first round - if(pos != 0) - { - while(*txt2ptr != 0 && *txt2ptr != ',') - txt2ptr++; - if(*txt2ptr != 0) - txt2ptr++; + for(SNeutrinoSettings::usermenu_t *um = usermenu_default; um->key != CRCInput::RC_nokey; um++) { + SNeutrinoSettings::usermenu_t *u = new SNeutrinoSettings::usermenu_t; + *u = *um; + g_settings.usermenu.push_back(u); + } + } else { + for (unsigned int i = 0; ; i++) { + std::string name = (i < 4) ? usermenu_default[i].name : to_string(i); + std::string usermenu_key("usermenu_key_"); + usermenu_key += name; + int uk = configfile.getInt32(usermenu_key, CRCInput::RC_nokey); + if (!uk || uk == (int)CRCInput::RC_nokey) { + if (i > 3) + break; + continue; } - if(*txt2ptr != 0) - { - g_settings.usermenu[button][pos] = atoi(txt2ptr); // there is still a string - if(g_settings.usermenu[button][pos] >= SNeutrinoSettings::ITEM_MAX) - g_settings.usermenu[button][pos] = 0; - } - else - g_settings.usermenu[button][pos] = 0; // string empty, fill up with 0 + SNeutrinoSettings::usermenu_t *u = new SNeutrinoSettings::usermenu_t; + u->key = uk; + std::string txt1("usermenu_tv_"); + txt1 += name; + u->items = configfile.getString(txt1, ""); + txt1 += "_text"; + u->title = configfile.getString(txt1, ""); + + g_settings.usermenu.push_back(u); } } @@ -897,6 +917,8 @@ void CNeutrinoApp::saveSetup(const char * fname) if(!scansettings.saveSettings(NEUTRINO_SCAN_SETTINGS_FILE)) { dprintf(DEBUG_NORMAL, "error while saving scan-settings!\n"); } + /* clear old values */ + configfile.clear(); //video configfile.setInt32( "video_Mode", g_settings.video_Mode ); @@ -1152,8 +1174,14 @@ void CNeutrinoApp::saveSetup(const char * fname) // default plugin for movieplayer configfile.setString ( "movieplayer_plugin", g_settings.movieplayer_plugin ); - configfile.setString ( "onekey_plugin", g_settings.onekey_plugin ); configfile.setString ( "plugin_hdd_dir", g_settings.plugin_hdd_dir ); + + configfile.setString ( "plugins_disabled", g_settings.plugins_disabled ); + configfile.setString ( "plugins_game", g_settings.plugins_game ); + configfile.setString ( "plugins_tool", g_settings.plugins_tool ); + configfile.setString ( "plugins_script", g_settings.plugins_script ); + configfile.setString ( "plugins_lua", g_settings.plugins_lua ); + configfile.setString ( "logo_hdd_dir", g_settings.logo_hdd_dir ); int webtv_count = 0; @@ -1293,23 +1321,22 @@ void CNeutrinoApp::saveSetup(const char * fname) // USERMENU //--------------------------------------- - char txt1[81]; - char txt2[81]; - for(int button = 0; button < SNeutrinoSettings::BUTTON_MAX; button++) { - snprintf(txt1,80,"usermenu_tv_%s_text",usermenu_button_def[button]); - txt1[80] = 0; // terminate for sure - configfile.setString(txt1,g_settings.usermenu_text[button]); - - char* txt2ptr = txt2; - snprintf(txt1,80,"usermenu_tv_%s",usermenu_button_def[button]); - for(int pos = 0; pos < SNeutrinoSettings::ITEM_MAX; pos++) { - if( g_settings.usermenu[button][pos] != 0) { - if(pos != 0) - *txt2ptr++ = ','; - txt2ptr += snprintf(txt2ptr,80,"%d",g_settings.usermenu[button][pos]); - } + for (unsigned int i = 0, count = 4; i < g_settings.usermenu.size(); i++) { + if (g_settings.usermenu[i]->key != CRCInput::RC_nokey) { + std::string name; + if (i < 4) + name = usermenu_default[i].name; + else + name = to_string(count++); + std::string usermenu_key("usermenu_key_"); + usermenu_key += name; + configfile.setInt32(usermenu_key, g_settings.usermenu[i]->key); + std::string txt1("usermenu_tv_"); + txt1 += name; + configfile.setString(txt1, g_settings.usermenu[i]->items); + txt1 += "_text"; + configfile.setString(txt1, g_settings.usermenu[i]->title); } - configfile.setString(txt1,txt2); } configfile.setInt32("bigFonts", g_settings.bigFonts); @@ -1336,6 +1363,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("infoClockBackground", g_settings.infoClockBackground); configfile.setInt32("infoClockSeconds", g_settings.infoClockSeconds); configfile.setInt32("easymenu", g_settings.easymenu); + if(strcmp(fname, NEUTRINO_SETTINGS_FILE)) configfile.saveConfig(fname); @@ -1907,6 +1935,17 @@ TIMER_START(); loadLocale_ret = g_Locale->loadLocale(g_settings.language.c_str()); show_startwizard = true; } + + // default usermenu titles correspond to gui/user_menue_setup.h:struct usermenu_props_t usermenu + if (g_settings.usermenu[0]->title.empty()) + g_settings.usermenu[0]->title = g_Locale->getText(LOCALE_INFOVIEWER_EVENTLIST); + if (g_settings.usermenu[1]->title.empty()) + g_settings.usermenu[1]->title = g_Locale->getText(LOCALE_AUDIOSELECTMENUE_HEAD); + if (g_settings.usermenu[2]->title.empty()) + g_settings.usermenu[2]->title = g_Locale->getText(LOCALE_INFOVIEWER_SUBSERVICE); + if (g_settings.usermenu[3]->title.empty()) + g_settings.usermenu[3]->title = g_Locale->getText(LOCALE_INFOVIEWER_STREAMINFO); + /* setup GUI */ neutrinoFonts = CNeutrinoFonts::getInstance(); SetupFonts(); @@ -2166,34 +2205,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) InfoClock->enableInfoClock(true); StartSubtitles(); } - else if( msg == CRCInput::RC_epg ) { - InfoClock->enableInfoClock(false); - StopSubtitles(); - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - g_EventList->exec(live_channel_id, channelList->getActiveChannelName()); - InfoClock->enableInfoClock(true); - StartSubtitles(); - } - else if( ( msg == (neutrino_msg_t) g_settings.key_quickzap_up ) || ( msg == (neutrino_msg_t) g_settings.key_quickzap_down ) ) - { - //quickzap - quickZap(msg); - } - else if( msg == CRCInput::RC_text) { - g_RCInput->clearRCMsg(); - InfoClock->enableInfoClock(false); - StopSubtitles(); - tuxtx_stop_subtitle(); - - tuxtx_main(g_RCInput->getFileHandle(), g_RemoteControl->current_PIDs.PIDs.vtxtpid); - - frameBuffer->paintBackground(); - //if(!g_settings.cacheTXT) - // tuxtxt_stop(); - g_RCInput->clearRCMsg(); - InfoClock->enableInfoClock(true); - StartSubtitles(); - } + /* the only hardcoded key to check before key bindings */ else if( msg == CRCInput::RC_setup ) { if(!g_settings.minimode) { StopSubtitles(); @@ -2219,11 +2231,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) } } } - else if (((msg == CRCInput::RC_tv) || (msg == CRCInput::RC_radio)) && (g_settings.key_tvradio_mode == (int)CRCInput::RC_nokey)) { - switchTvRadioMode();//used with defined default tv/radio rc key + else if( ( msg == (neutrino_msg_t) g_settings.key_quickzap_up ) || ( msg == (neutrino_msg_t) g_settings.key_quickzap_down ) ) + { + quickZap(msg); } else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode ) { - switchTvRadioMode(); //used with defined rc key TODO: do we really need this, because we already have a specified key on the remote control + switchTvRadioMode(); } else if( msg == (neutrino_msg_t) g_settings.key_subchannel_up || msg == (neutrino_msg_t) g_settings.key_subchannel_down) { if( !g_RemoteControl->subChannels.empty() ) { @@ -2253,23 +2266,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else quickZap( msg ); } - /* in case key_subchannel_up/down redefined */ - else if( msg == CRCInput::RC_left || msg == CRCInput::RC_right) { - switch (g_settings.mode_left_right_key_tv) - { - case SNeutrinoSettings::INFOBAR: - case SNeutrinoSettings::VZAP: - if (channelList->getSize()) - showInfo(); - break; - case SNeutrinoSettings::VOLUME: - g_volume->setVolume(msg); - break; - default: /* SNeutrinoSettings::ZAP */ - quickZap(msg); - break; - } - } else if( msg == (neutrino_msg_t) g_settings.key_zaphistory ) { // Zap-History "Bouquet" InfoClock->enableInfoClock(false); @@ -2287,16 +2283,13 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) // Quick Zap numericZap( msg ); } - else if( msg == (neutrino_msg_t) g_settings.key_plugin ) { - g_PluginList->startPlugin_by_name(g_settings.onekey_plugin.c_str()); - } else if(msg == (neutrino_msg_t) g_settings.key_timeshift) { if (mode == mode_webtv) { - CMoviePlayerGui::getInstance().Pause(); + CMoviePlayerGui::getInstance().Pause(); } else CRecordManager::getInstance()->StartTimeshift(); } - else if (msg == (neutrino_msg_t) g_settings.key_current_transponder){ + else if (msg == (neutrino_msg_t) g_settings.key_current_transponder) { numericZap( msg ); } #ifdef ENABLE_PIP @@ -2321,9 +2314,65 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) } } #endif + else if( msg == (neutrino_msg_t) g_settings.key_record && (mode != mode_webtv)) { + if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) + CRecordManager::getInstance()->exec(NULL, "Record"); + } + /* after sensitive key bind, check user menu */ + else if (usermenu.showUserMenu(msg)) { + } + /* hardcoded key values, if not redefined in keybind or user menu */ + else if( msg == CRCInput::RC_text) { + g_RCInput->clearRCMsg(); + InfoClock->enableInfoClock(false); + StopSubtitles(); + tuxtx_stop_subtitle(); + + tuxtx_main(g_RCInput->getFileHandle(), g_RemoteControl->current_PIDs.PIDs.vtxtpid); + + frameBuffer->paintBackground(); + //if(!g_settings.cacheTXT) + // tuxtxt_stop(); + g_RCInput->clearRCMsg(); + InfoClock->enableInfoClock(true); + StartSubtitles(); + } + else if (((msg == CRCInput::RC_tv) || (msg == CRCInput::RC_radio)) && (g_settings.key_tvradio_mode == (int)CRCInput::RC_nokey)) { + switchTvRadioMode();//used with defined default tv/radio rc key + } + /* in case key_subchannel_up/down redefined */ + else if( msg == CRCInput::RC_left || msg == CRCInput::RC_right) { + switch (g_settings.mode_left_right_key_tv) + { + case SNeutrinoSettings::INFOBAR: + case SNeutrinoSettings::VZAP: + if (channelList->getSize()) + showInfo(); + break; + case SNeutrinoSettings::VOLUME: + g_volume->setVolume(msg); + break; + default: /* SNeutrinoSettings::ZAP */ + quickZap(msg); + break; + } + } + else if( msg == CRCInput::RC_epg ) { + InfoClock->enableInfoClock(false); + StopSubtitles(); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + g_EventList->exec(live_channel_id, channelList->getActiveChannelName()); + InfoClock->enableInfoClock(true); + StartSubtitles(); + } else if (CRCInput::isNumeric(msg)) { numericZap( msg ); } + /* FIXME ??? */ + else if (CRCInput::isNumeric(msg) && g_RemoteControl->director_mode ) { + g_RemoteControl->setSubChannel(CRCInput::getNumericValue(msg)); + g_InfoViewer->showSubchan(); + } else if( msg == CRCInput::RC_page_up || msg == CRCInput::RC_page_down) { quickZap(msg == CRCInput::RC_page_up ? CRCInput::RC_right : CRCInput::RC_left); } @@ -2334,61 +2383,19 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) CMoviePlayerGui::getInstance().exec(NULL, "rtimeshift"); } } - else if( msg == CRCInput::RC_record && (mode != mode_webtv)) { - if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) - CRecordManager::getInstance()->exec(NULL, "Record"); - } else if( msg == CRCInput::RC_stop) { - CRecordManager::getInstance()->exec(NULL, "Stop_record"); - } - else if( msg == CRCInput::RC_red ) { - // eventlist - if (g_settings.personalize[SNeutrinoSettings::P_MAIN_RED_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// EventList Menu - Personalization Check - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_RED); - StartSubtitles(); - } - else - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); - } - else if( msg == CRCInput::RC_green) - { - if (g_settings.personalize[SNeutrinoSettings::P_MAIN_GREEN_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED) - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); - StartSubtitles(); - } - else - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); - } - else if( msg == CRCInput::RC_yellow ) { // NVODs - if (g_settings.personalize[SNeutrinoSettings::P_MAIN_YELLOW_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED) - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_YELLOW); - StartSubtitles(); - } - else - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); - } - else if( msg == CRCInput::RC_blue ) { - if (g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// Features Menu - Personalization Check - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_BLUE); - StartSubtitles(); - } - else - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT), 450, 10); - } - else if ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) - { StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); + CRecordManager::getInstance()->exec(NULL, "Stop_record"); StartSubtitles(); } + else if (msg == CRCInput::RC_audio) + { + StopSubtitles(); + CAudioSelectMenuHandler as; + as.exec(NULL, "-1"); + StartSubtitles(); + } +#if 0 else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { //open mediaplayer menu in audio mode, user can select between audioplayer and internetradio CMediaPlayerMenu * media = CMediaPlayerMenu::getInstance(); @@ -2396,15 +2403,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) media->setUsageMode(CMediaPlayerMenu::MODE_AUDIO); media->exec(NULL, ""); } +#endif else if( msg == CRCInput::RC_video || msg == CRCInput::RC_play ) { //open moviebrowser via media player menu object if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) CMediaPlayerMenu::getInstance()->exec(NULL,"movieplayer"); } - else if (CRCInput::isNumeric(msg) && g_RemoteControl->director_mode ) { - g_RemoteControl->setSubChannel(CRCInput::getNumericValue(msg)); - g_InfoViewer->showSubchan(); - } else if( ( msg == CRCInput::RC_help ) || ( msg == CRCInput::RC_info) || ( msg == NeutrinoMessages::SHOW_INFOBAR ) ) { @@ -2423,9 +2427,9 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) Timerlist.exec(NULL, ""); } else { - if (msg == CRCInput::RC_home) { + if (msg == CRCInput::RC_home) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); - } + if (msg != CRCInput::RC_timeout) handleMsg(msg, data); } @@ -2613,7 +2617,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) if(msg == NeutrinoMessages::EVT_WEBTV_ZAP_COMPLETE) { t_channel_id chid = *(t_channel_id *) data; -printf("EVT_WEBTV_ZAP_COMPLETE: %llx\n", chid); + printf("EVT_WEBTV_ZAP_COMPLETE: %llx\n", chid); if (mode == mode_standby) { delete [] (unsigned char*) data; } else { @@ -2811,11 +2815,11 @@ printf("EVT_WEBTV_ZAP_COMPLETE: %llx\n", chid); g_videoSettings->nextMode(); return messages_return::handled; } - else if(( msg == CRCInput::RC_next ) && g_settings.key_pic_size_active ) { + else if(( msg == (neutrino_msg_t) g_settings.key_next43mode ) && g_settings.key_pic_size_active ) { g_videoSettings->next43Mode(); return messages_return::handled; } - else if(( msg == CRCInput::RC_prev ) && g_settings.key_pic_mode_active ) { + else if(( msg == (neutrino_msg_t) g_settings.key_switchformat) && g_settings.key_pic_mode_active ) { g_videoSettings->SwitchFormat(); return messages_return::handled; } @@ -3258,9 +3262,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) dprintf(DEBUG_INFO, "exit\n"); StopSubtitles(); -printf("###################################### CNeutrinoApp::ExitRun: g_Zapit->stopPlayBack()\n");fflush(stdout); stopPlayBack(); -printf("###################################### CNeutrinoApp::ExitRun: g_Zapit->stopPlayBack() done\n");fflush(stdout); frameBuffer->paintBackground(); videoDecoder->ShowPicture(DATADIR "/neutrino/icons/shutdown.jpg"); @@ -3647,11 +3649,11 @@ void CNeutrinoApp::radioMode( bool rezap) { //printf("radioMode: rezap %s\n", rezap ? "yes" : "no"); INFO("rezap %d current mode %d", rezap, mode); - if (mode == mode_webtv) { - CMoviePlayerGui::getInstance().setLastMode(mode_unknown); - CMoviePlayerGui::getInstance().stopPlayBack(); - CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); - } + if (mode == mode_webtv) { + CMoviePlayerGui::getInstance().setLastMode(mode_unknown); + CMoviePlayerGui::getInstance().stopPlayBack(); + CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); + } if (mode == mode_tv) { CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); StopSubtitles(); @@ -3724,7 +3726,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) { // printf("ac: %s\n", actionKey.c_str()); int returnval = menu_return::RETURN_REPAINT; - + if(actionKey == "help_recording") { ShowMsg(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMessageBox::mbrBack, CMessageBox::mbBack); } @@ -3773,7 +3775,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) tuxtxt_init(); } else tuxtxt_close(); - + //g_Sectionsd->setEventsAreOldInMinutes((unsigned short) (g_settings.epg_old_hours*60)); //g_Sectionsd->setHoursToCache((unsigned short) (g_settings.epg_cache_days*24)); @@ -3782,7 +3784,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) } else if(actionKey=="recording") { setupRecordingDevice(); - } + } else if(actionKey=="reloadplugins") { CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SERVICEMENU_GETPLUGINS_HINT)); hintBox->paint(); @@ -3792,6 +3794,29 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) hintBox->hide(); delete hintBox; } + else if(actionKey=="nkplayback" || actionKey=="ytplayback" || actionKey=="tsmoviebrowser" || actionKey=="fileplayback") { + frameBuffer->Clear(); + if(mode == NeutrinoMessages::mode_radio ) + videoDecoder->StopPicture(); + int _mode = mode; + // FIXME CMediaPlayerMenu::getInstance()->exec(NULL, actionKey); ?? + CMoviePlayerGui::getInstance().exec(NULL, actionKey); + if(_mode == NeutrinoMessages::mode_radio ) + videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); + else if (_mode == mode_webtv) + tvMode(true); + return menu_return::RETURN_EXIT_ALL; + } + else if(actionKey=="audioplayer" || actionKey == "inetplayer") { + frameBuffer->Clear(); + CMediaPlayerMenu * media = CMediaPlayerMenu::getInstance(); + media->exec(NULL, actionKey); + return menu_return::RETURN_EXIT_ALL; + } + else if(actionKey == "hddmenu") { + CHDDMenuHandler::getInstance()->exec(NULL, ""); + return menu_return::RETURN_EXIT_ALL; + } else if(actionKey=="restart") { if (recordingstatus) DisplayErrorMessage(g_Locale->getText(LOCALE_SERVICEMENU_RESTART_REFUSED_RECORDING)); @@ -4010,8 +4035,8 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.key_tvradio_mode = tconfig.getInt32( "key_tvradio_mode", (unsigned int)CRCInput::RC_nokey ); g_settings.key_power_off = tconfig.getInt32( "key_power_off", CRCInput::RC_standby ); - g_settings.key_channelList_pageup = tconfig.getInt32( "key_channelList_pageup", CRCInput::RC_page_up ); - g_settings.key_channelList_pagedown = tconfig.getInt32( "key_channelList_pagedown", CRCInput::RC_page_down ); + g_settings.key_pageup = tconfig.getInt32( "key_channelList_pageup", CRCInput::RC_page_up ); + g_settings.key_pagedown = tconfig.getInt32( "key_channelList_pagedown", CRCInput::RC_page_down ); g_settings.key_channelList_cancel = tconfig.getInt32( "key_channelList_cancel", CRCInput::RC_home ); g_settings.key_channelList_sort = tconfig.getInt32( "key_channelList_sort", CRCInput::RC_blue ); g_settings.key_channelList_addrecord = tconfig.getInt32( "key_channelList_addrecord", CRCInput::RC_red ); @@ -4020,7 +4045,6 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.key_list_start = tconfig.getInt32( "key_list_start", (unsigned int)CRCInput::RC_nokey ); g_settings.key_list_end = tconfig.getInt32( "key_list_end", (unsigned int)CRCInput::RC_nokey ); g_settings.key_timeshift = tconfig.getInt32( "key_timeshift", CRCInput::RC_pause ); - g_settings.key_plugin = tconfig.getInt32( "key_plugin", (unsigned int)CRCInput::RC_nokey ); g_settings.key_unlock = tconfig.getInt32( "key_unlock", CRCInput::RC_setup ); g_settings.key_screenshot = tconfig.getInt32( "key_screenshot", (unsigned int)CRCInput::RC_nokey ); #ifdef ENABLE_PIP @@ -4040,6 +4064,7 @@ 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.mpkey_rewind = tconfig.getInt32( "mpkey.rewind", CRCInput::RC_rewind ); g_settings.mpkey_forward = tconfig.getInt32( "mpkey.forward", CRCInput::RC_forward ); g_settings.mpkey_pause = tconfig.getInt32( "mpkey.pause", CRCInput::RC_pause ); @@ -4051,13 +4076,15 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.mpkey_plugin = tconfig.getInt32( "mpkey.plugin", (unsigned int)CRCInput::RC_nokey ); g_settings.mpkey_subtitle = tconfig.getInt32( "mpkey.subtitle", CRCInput::RC_sub ); + g_settings.mpkey_goto = tconfig.getInt32( "mpkey.goto", CRCInput::RC_nokey ); + g_settings.mpkey_next_repeat_mode = tconfig.getInt32( "mpkey.next_repeat_mode", CRCInput::RC_nokey); + g_settings.key_format_mode_active = tconfig.getInt32( "key_format_mode_active", 1 ); g_settings.key_pic_mode_active = tconfig.getInt32( "key_pic_mode_active", 1 ); g_settings.key_pic_size_active = tconfig.getInt32( "key_pic_size_active", 1 ); /* options */ g_settings.menu_left_exit = tconfig.getInt32( "menu_left_exit", 0 ); - g_settings.audio_run_player = tconfig.getInt32( "audio_run_player", 1 ); g_settings.key_click = tconfig.getInt32( "key_click", 1 ); g_settings.repeat_blocker = tconfig.getInt32("repeat_blocker", 150); g_settings.repeat_genericblocker = tconfig.getInt32("repeat_genericblocker", 100); @@ -4066,6 +4093,13 @@ 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.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 ); + g_settings.key_record = tconfig.getInt32( "key_record", CRCInput::RC_record ); + g_settings.key_switchformat = tconfig.getInt32("key_switchformat", CRCInput::RC_prev); + g_settings.key_next43mode = tconfig.getInt32("key_next43mode", CRCInput::RC_next); + g_settings.key_volumeup = tconfig.getInt32( "key_volumeup", CRCInput::RC_plus ); + g_settings.key_volumedown = tconfig.getInt32( "key_volumedown", CRCInput::RC_minus ); } void CNeutrinoApp::saveKeys(const char * fname) @@ -4079,8 +4113,8 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "key_tvradio_mode", g_settings.key_tvradio_mode ); tconfig.setInt32( "key_power_off", g_settings.key_power_off ); - tconfig.setInt32( "key_channelList_pageup", g_settings.key_channelList_pageup ); - tconfig.setInt32( "key_channelList_pagedown", g_settings.key_channelList_pagedown ); + tconfig.setInt32( "key_channelList_pageup", g_settings.key_pageup ); + tconfig.setInt32( "key_channelList_pagedown", g_settings.key_pagedown ); tconfig.setInt32( "key_channelList_cancel", g_settings.key_channelList_cancel ); tconfig.setInt32( "key_channelList_sort", g_settings.key_channelList_sort ); tconfig.setInt32( "key_channelList_addrecord", g_settings.key_channelList_addrecord ); @@ -4089,7 +4123,6 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "key_list_start", g_settings.key_list_start ); tconfig.setInt32( "key_list_end", g_settings.key_list_end ); tconfig.setInt32( "key_timeshift", g_settings.key_timeshift ); - tconfig.setInt32( "key_plugin", g_settings.key_plugin ); tconfig.setInt32( "key_unlock", g_settings.key_unlock ); tconfig.setInt32( "key_screenshot", g_settings.key_screenshot ); #ifdef ENABLE_PIP @@ -4120,12 +4153,14 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "mpkey.plugin", g_settings.mpkey_plugin ); tconfig.setInt32( "mpkey.subtitle", g_settings.mpkey_subtitle ); + tconfig.setInt32( "mpkey.goto", g_settings.mpkey_goto ); + tconfig.setInt32( "mpkey.next_repeat_mode", g_settings.mpkey_next_repeat_mode ); + tconfig.setInt32( "key_format_mode_active", g_settings.key_format_mode_active ); tconfig.setInt32( "key_pic_mode_active", g_settings.key_pic_mode_active ); tconfig.setInt32( "key_pic_size_active", g_settings.key_pic_size_active ); tconfig.setInt32( "menu_left_exit", g_settings.menu_left_exit ); - tconfig.setInt32( "audio_run_player", g_settings.audio_run_player ); tconfig.setInt32( "key_click", g_settings.key_click ); tconfig.setInt32( "repeat_blocker", g_settings.repeat_blocker ); tconfig.setInt32( "repeat_genericblocker", g_settings.repeat_genericblocker ); @@ -4135,6 +4170,13 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "sms_channel", g_settings.sms_channel ); tconfig.setInt32( "mode_left_right_key_tv", g_settings.mode_left_right_key_tv ); + tconfig.setInt32( "key_help", g_settings.key_help ); + tconfig.setInt32( "key_record", g_settings.key_record ); + tconfig.setInt32( "key_switchformat", g_settings.key_switchformat ); + tconfig.setInt32( "key_next43mode", g_settings.key_next43mode ); + tconfig.setInt32( "key_volumeup", g_settings.key_volumeup ); + tconfig.setInt32( "key_volumedown", g_settings.key_volumedown ); + if(fname) tconfig.saveConfig(fname); } diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 65c0db14c..d352d4ef9 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -113,6 +113,7 @@ void CNeutrinoApp::InitMenu() //personalize: neutrino.h, neutrino.cpp personalize.enableUsermenu(); + personalize.enablePluginMenu(); personalize.enablePinSetup(); personalize.addWidgets(menu_widgets, g_settings.easymenu ? MENU_MAX : 3); @@ -207,13 +208,11 @@ void CNeutrinoApp::InitMenuMain() mf->setHint(NEUTRINO_ICON_HINT_SCRIPTS, LOCALE_MENU_HINT_SCRIPTS); personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SCRIPTS]); -#if ENABLE_LUA //lua bool show_lua = g_PluginList->hasPlugin(CPlugins::P_TYPE_LUA); mf = new CMenuForwarder(LOCALE_MAINMENU_LUA, show_lua, NULL, new CPluginList(LOCALE_MAINMENU_LUA,CPlugins::P_TYPE_LUA)); mf->setHint(NEUTRINO_ICON_HINT_SCRIPTS, LOCALE_MENU_HINT_LUA); personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_LUA]); -#endif } //separator diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 4fe2c0225..275d5b6f2 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -147,6 +147,7 @@ enum MN_WIDGET_ID //personalize: to personalize sub menues MN_WIDGET_ID_PERSONALIZE_USERMENU, MN_WIDGET_ID_PERSONALIZE_FEATUREKEYS, + MN_WIDGET_ID_PERSONALIZE_PLUGINS, //user menu setup MN_WIDGET_ID_USERMENU_RED, diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index a376e82ad..8d9aaa75c 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -765,3 +765,56 @@ bool split_config_string(const std::string &str, std::map split(const std::string &s, char delim) +{ + std::vector vec; + std::stringstream ss(s); + std::string item; + while (std::getline(ss, item, delim)) + vec.push_back(item); + return vec; +} + +std::string to_string(int i) +{ + std::stringstream s; + s << i; + return s.str(); +} + +std::string to_string(unsigned int i) +{ + std::stringstream s; + s << i; + return s.str(); +} + +std::string to_string(long i) +{ + std::stringstream s; + s << i; + return s.str(); +} + +std::string to_string(unsigned long i) +{ + std::stringstream s; + s << i; + return s.str(); +} + +std::string to_string(long long i) +{ + std::stringstream s; + s << i; + return s.str(); +} + +std::string to_string(unsigned long long i) +{ + std::stringstream s; + s << i; + return s.str(); +} + diff --git a/src/system/helpers.h b/src/system/helpers.h index 9d5874cf2..07cbf44df 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -84,20 +84,22 @@ class CFileHelpers bool removeDir(const char *Dir); }; -template std::string to_string(C i) -{ - std::stringstream s; - s << i; - return s.str(); -} - -inline void cstrncpy(char *dest, const char * const src, size_t n) { n--; strncpy(dest, src, n); dest[n] = 0; } -inline void cstrncpy(char *dest, const std::string &src, size_t n) { n--; strncpy(dest, src.c_str(), n); dest[n] = 0; } -bool split_config_string(const std::string &str, std::map &smap); +std::string to_string(int); +std::string to_string(unsigned int); +std::string to_string(long); +std::string to_string(unsigned long); +std::string to_string(long long); +std::string to_string(unsigned long long); inline int atoi(std::string &s) { return atoi(s.c_str()); } inline int atoi(const std::string &s) { return atoi(s.c_str()); } inline int access(std::string &s, int mode) { return access(s.c_str(), mode); } inline int access(const std::string &s, int mode) { return access(s.c_str(), mode); } +inline void cstrncpy(char *dest, const char * const src, size_t n) { n--; strncpy(dest, src, n); dest[n] = 0; } +inline void cstrncpy(char *dest, const std::string &src, size_t n) { n--; strncpy(dest, src.c_str(), n); dest[n] = 0; } + +std::vector split(const std::string &s, char delim); + +bool split_config_string(const std::string &str, std::map &smap); #endif diff --git a/src/system/locals.h b/src/system/locals.h index 3688e8a59..20076a4c5 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -407,15 +407,19 @@ typedef enum LOCALE_EXTRA_FEC_AUTO, LOCALE_EXTRA_KEY_CURRENT_TRANSPONDER, LOCALE_EXTRA_KEY_FORMAT_MODE, + LOCALE_EXTRA_KEY_HELP, LOCALE_EXTRA_KEY_LIST_END, LOCALE_EXTRA_KEY_LIST_START, + LOCALE_EXTRA_KEY_NEXT43MODE, LOCALE_EXTRA_KEY_PIC_MODE, LOCALE_EXTRA_KEY_PIC_SIZE, LOCALE_EXTRA_KEY_PIP_CLOSE, LOCALE_EXTRA_KEY_PIP_SETUP, LOCALE_EXTRA_KEY_PIP_SWAP, LOCALE_EXTRA_KEY_PLUGIN, + LOCALE_EXTRA_KEY_RECORD, LOCALE_EXTRA_KEY_SCREENSHOT, + LOCALE_EXTRA_KEY_SWITCHFORMAT, LOCALE_EXTRA_KEY_TIMESHIFT, LOCALE_EXTRA_KEY_UNLOCK, LOCALE_EXTRA_LADIRECTION, @@ -758,6 +762,7 @@ typedef enum LOCALE_KEYBINDINGMENU_CHANNELDOWN, LOCALE_KEYBINDINGMENU_CHANNELLIST, LOCALE_KEYBINDINGMENU_CHANNELUP, + LOCALE_KEYBINDINGMENU_EDIT, LOCALE_KEYBINDINGMENU_HEAD, LOCALE_KEYBINDINGMENU_LASTCHANNEL, LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION, @@ -768,6 +773,7 @@ typedef enum LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV_VZAP, LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV_ZAP, LOCALE_KEYBINDINGMENU_MODECHANGE, + LOCALE_KEYBINDINGMENU_NAVIGATION, LOCALE_KEYBINDINGMENU_PAGEDOWN, LOCALE_KEYBINDINGMENU_PAGEUP, LOCALE_KEYBINDINGMENU_POWEROFF, @@ -787,6 +793,10 @@ typedef enum LOCALE_KEYBINDINGMENU_SUBCHANNELDOWN, LOCALE_KEYBINDINGMENU_SUBCHANNELUP, LOCALE_KEYBINDINGMENU_TVRADIOMODE, + LOCALE_KEYBINDINGMENU_VIDEO, + LOCALE_KEYBINDINGMENU_VOLUME, + LOCALE_KEYBINDINGMENU_VOLUMEDOWN, + LOCALE_KEYBINDINGMENU_VOLUMEUP, LOCALE_KEYBINDINGMENU_ZAPHISTORY, LOCALE_KEYCHOOSER_HEAD, LOCALE_KEYCHOOSER_TEXT1, @@ -1031,6 +1041,7 @@ typedef enum LOCALE_MENU_HINT_KEY_PLUGIN, LOCALE_MENU_HINT_KEY_POWEROFF, LOCALE_MENU_HINT_KEY_QUICKZAP, + LOCALE_MENU_HINT_KEY_RECORD, LOCALE_MENU_HINT_KEY_REPEATBLOCK, LOCALE_MENU_HINT_KEY_REPEATBLOCKGENERIC, LOCALE_MENU_HINT_KEY_RIGHT, @@ -1043,6 +1054,8 @@ typedef enum LOCALE_MENU_HINT_KEY_TRANSPONDER, LOCALE_MENU_HINT_KEY_TVRADIOMODE, LOCALE_MENU_HINT_KEY_UNLOCK, + LOCALE_MENU_HINT_KEY_VOLUMEDOWN, + LOCALE_MENU_HINT_KEY_VOLUMEUP, LOCALE_MENU_HINT_KEYS, LOCALE_MENU_HINT_LANG_PREF, LOCALE_MENU_HINT_LANGUAGE, @@ -1635,6 +1648,8 @@ typedef enum LOCALE_MPKEY_AUDIO, LOCALE_MPKEY_BOOKMARK, LOCALE_MPKEY_FORWARD, + LOCALE_MPKEY_GOTO, + LOCALE_MPKEY_NEXT_REPEAT_MODE, LOCALE_MPKEY_PAUSE, LOCALE_MPKEY_PLAY, LOCALE_MPKEY_PLUGIN, @@ -1823,6 +1838,11 @@ typedef enum LOCALE_PINPROTECTION_WRONGCODE, LOCALE_PLUGINS_HDD_DIR, LOCALE_PLUGINS_RESULT, + LOCALE_PLUGINTYPE_DISABLED, + LOCALE_PLUGINTYPE_GAME, + LOCALE_PLUGINTYPE_LUA, + LOCALE_PLUGINTYPE_SCRIPT, + LOCALE_PLUGINTYPE_TOOL, LOCALE_RCLOCK_LOCKMSG, LOCALE_RCLOCK_MENUEADD, LOCALE_RCLOCK_TITLE, @@ -2161,6 +2181,9 @@ typedef enum LOCALE_USERMENU_ITEM_NONE, LOCALE_USERMENU_ITEM_PLUGIN_TYPES, LOCALE_USERMENU_ITEM_VTXT, + LOCALE_USERMENU_ITEMS, + LOCALE_USERMENU_KEY, + LOCALE_USERMENU_KEY_SELECT, LOCALE_USERMENU_MSG_INFO_IS_EMPTY, LOCALE_USERMENU_MSG_WARNING_NAME, LOCALE_USERMENU_MSG_WARNING_NO_ITEMS, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 7379ae8df..7a9fc0fa1 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -407,15 +407,19 @@ const char * locale_real_names[] = "extra.fec_auto", "extra.key_current_transponder", "extra.key_format_mode", + "extra.key_help", "extra.key_list_end", "extra.key_list_start", + "extra.key_next43mode", "extra.key_pic_mode", "extra.key_pic_size", "extra.key_pip_close", "extra.key_pip_setup", "extra.key_pip_swap", "extra.key_plugin", + "extra.key_record", "extra.key_screenshot", + "extra.key_switchformat", "extra.key_timeshift", "extra.key_unlock", "extra.ladirection", @@ -758,6 +762,7 @@ const char * locale_real_names[] = "keybindingmenu.channeldown", "keybindingmenu.channellist", "keybindingmenu.channelup", + "keybindingmenu.edit", "keybindingmenu.head", "keybindingmenu.lastchannel", "keybindingmenu.longkeypress_duration", @@ -768,6 +773,7 @@ const char * locale_real_names[] = "keybindingmenu.mode_left_right_key_tv_vzap", "keybindingmenu.mode_left_right_key_tv_zap", "keybindingmenu.modechange", + "keybindingmenu.navigation", "keybindingmenu.pagedown", "keybindingmenu.pageup", "keybindingmenu.poweroff", @@ -787,6 +793,10 @@ const char * locale_real_names[] = "keybindingmenu.subchanneldown", "keybindingmenu.subchannelup", "keybindingmenu.tvradiomode", + "keybindingmenu.video", + "keybindingmenu.volume", + "keybindingmenu.volumedown", + "keybindingmenu.volumeup", "keybindingmenu.zaphistory", "keychooser.head", "keychooser.text1", @@ -1031,6 +1041,7 @@ const char * locale_real_names[] = "menu.hint_key_plugin", "menu.hint_key_poweroff", "menu.hint_key_quickzap", + "menu.hint_key_record", "menu.hint_key_repeatblock", "menu.hint_key_repeatblockgeneric", "menu.hint_key_right", @@ -1043,6 +1054,8 @@ const char * locale_real_names[] = "menu.hint_key_transponder", "menu.hint_key_tvradiomode", "menu.hint_key_unlock", + "menu.hint_key_volumedown", + "menu.hint_key_volumeup", "menu.hint_keys", "menu.hint_lang_pref", "menu.hint_language", @@ -1635,6 +1648,8 @@ const char * locale_real_names[] = "mpkey.audio", "mpkey.bookmark", "mpkey.forward", + "mpkey.goto", + "mpkey.next_repeat_mode", "mpkey.pause", "mpkey.play", "mpkey.plugin", @@ -1823,6 +1838,11 @@ const char * locale_real_names[] = "pinprotection.wrongcode", "plugins.hdd_dir", "plugins.result", + "plugintype.disabled", + "plugintype.game", + "plugintype.lua", + "plugintype.script", + "plugintype.tool", "rclock.lockmsg", "rclock.menueadd", "rclock.title", @@ -2161,6 +2181,9 @@ const char * locale_real_names[] = "usermenu.item_none", "usermenu.item_plugin_types", "usermenu.item_vtxt", + "usermenu.items", + "usermenu.key", + "usermenu.key_select", "usermenu.msg_info_is_empty", "usermenu.msg_warning_name", "usermenu.msg_warning_no_items", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index d61f57a6f..73454f727 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -399,16 +399,6 @@ int CMoviePluginChangeExec::exec(CMenuTarget* parent, const std::string & action } return menu_return::RETURN_EXIT; } -int COnekeyPluginChangeExec::exec(CMenuTarget* parent, const std::string & actionKey) -{ - int sel= atoi(actionKey.c_str()); - parent->hide(); - if (sel>=0) - { - g_settings.onekey_plugin=g_PluginList->getName(sel); - } - return menu_return::RETURN_EXIT; -} long CNetAdapter::mac_addr_sys ( u_char *addr) //only for function getMacAddr() { diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 52db018f1..dbe1c94fa 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -127,12 +127,6 @@ class CMoviePluginChangeExec : public CMenuTarget int exec(CMenuTarget* parent, const std::string & actionKey); }; -class COnekeyPluginChangeExec : public CMenuTarget -{ - public: - int exec(CMenuTarget* parent, const std::string & actionKey); -}; - class CTZChangeNotifier : public CChangeObserver { public: diff --git a/src/system/settings.h b/src/system/settings.h index ca5426eef..3d2bb0feb 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -137,7 +137,7 @@ struct SNeutrinoSettings int ci_ignore_messages; int radiotext_enable; int easymenu; - + //vcr int vcr_AutoSwitch; @@ -176,20 +176,20 @@ struct SNeutrinoSettings enum PERSONALIZE_SETTINGS //settings.h { P_MAIN_PINSTATUS, - + //user menu P_MAIN_BLUE_BUTTON, P_MAIN_YELLOW_BUTTON, P_MAIN_GREEN_BUTTON, P_MAIN_RED_BUTTON, - + //main menu P_MAIN_TV_MODE, P_MAIN_TV_RADIO_MODE, //togglemode P_MAIN_RADIO_MODE, P_MAIN_TIMER, P_MAIN_MEDIA, - + P_MAIN_GAMES, P_MAIN_TOOLS, P_MAIN_SCRIPTS, @@ -202,7 +202,7 @@ struct SNeutrinoSettings P_MAIN_SHUTDOWN, P_MAIN_INFOMENU, P_MAIN_CISETTINGS, - + //settings menu P_MSET_SETTINGS_MANAGER, P_MSET_VIDEO, @@ -217,7 +217,7 @@ struct SNeutrinoSettings P_MSET_KEYBINDING, P_MSET_MEDIAPLAYER, P_MSET_MISC, - + //service menu P_MSER_TUNER, P_MSER_SCANTS, @@ -228,7 +228,7 @@ struct SNeutrinoSettings P_MSER_RELOAD_PLUGINS, P_MSER_SERVICE_INFOMENU, P_MSER_SOFTUPDATE, - + //media menu P_MEDIA_MENU, P_MEDIA_AUDIO, @@ -236,18 +236,18 @@ struct SNeutrinoSettings P_MEDIA_MPLAYER, P_MEDIA_PVIEWER, P_MEDIA_UPNP, - + //movieplayer menu P_MPLAYER_MBROWSER, P_MPLAYER_FILEPLAY, P_MPLAYER_YTPLAY, - + //feature keys P_FEAT_KEY_FAVORIT, P_FEAT_KEY_TIMERLIST, P_FEAT_KEY_VTXT, P_FEAT_KEY_RC_LOCK, - + //user menu P_UMENU_SHOW_CANCEL, @@ -257,10 +257,10 @@ struct SNeutrinoSettings P_UMENU_PLUGIN_TYPE_SCRIPTS, P_UMENU_PLUGIN_TYPE_LUA, - P_SETTINGS_MAX + P_SETTINGS_MAX }; - int personalize[P_SETTINGS_MAX]; + int personalize[P_SETTINGS_MAX]; std::string personalize_pincode; //timing @@ -275,7 +275,7 @@ struct SNeutrinoSettings TIMING_VOLUMEBAR = 6, TIMING_FILEBROWSER = 7, TIMING_NUMERICZAP = 8, - + TIMING_SETTING_COUNT }; @@ -392,16 +392,22 @@ struct SNeutrinoSettings int filesystem_is_utf8; // default plugin for ts-movieplayer (red button) std::string movieplayer_plugin; - std::string onekey_plugin; std::string plugin_hdd_dir; - + std::string logo_hdd_dir; + std::string plugins_disabled; + std::string plugins_game; + std::string plugins_tool; + std::string plugins_script; + std::string plugins_lua; + //key configuration int key_tvradio_mode; - int key_channelList_pageup; - int key_channelList_pagedown; + int key_pageup; + int key_pagedown; + int key_channelList_cancel; int key_channelList_sort; int key_channelList_addrecord; @@ -419,7 +425,6 @@ struct SNeutrinoSettings int key_list_end; int key_power_off; int menu_left_exit; - int audio_run_player; int key_click; int timeshift_pause; int auto_timeshift; @@ -427,6 +432,12 @@ struct SNeutrinoSettings int auto_delete; int record_hours; int timeshift_hours; + int key_record; + int key_help; + int key_next43mode; + int key_switchformat; + int key_volumeup; + int key_volumedown; int mpkey_rewind; int mpkey_forward; @@ -437,7 +448,9 @@ struct SNeutrinoSettings int mpkey_time; int mpkey_bookmark; int mpkey_plugin; + int mpkey_goto; int mpkey_subtitle; + int mpkey_next_repeat_mode; int key_timeshift; int key_plugin; @@ -611,10 +624,10 @@ struct SNeutrinoSettings int backlight_standby; int backlight_deepstandby; int lcd_scroll; -//#define FILESYSTEM_ENCODING_TO_UTF8(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::Latin1_to_UTF8(a).c_str()) + //#define FILESYSTEM_ENCODING_TO_UTF8(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::Latin1_to_UTF8(a).c_str()) #define FILESYSTEM_ENCODING_TO_UTF8(a) (isUTF8(a) ? (a) : ZapitTools::Latin1_to_UTF8(a).c_str()) #define UTF8_TO_FILESYSTEM_ENCODING(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::UTF8_to_Latin1(a).c_str()) -//#define FILESYSTEM_ENCODING_TO_UTF8_STRING(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::Latin1_to_UTF8(a)) + //#define FILESYSTEM_ENCODING_TO_UTF8_STRING(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::Latin1_to_UTF8(a)) #define FILESYSTEM_ENCODING_TO_UTF8_STRING(a) (isUTF8(a) ? (a) : ZapitTools::Latin1_to_UTF8(a)) // pictureviewer @@ -680,7 +693,7 @@ struct SNeutrinoSettings ITEM_VTXT = 11, ITEM_TECHINFO = 13, ITEM_REMOTE = 14, - ITEM_PLUGIN_TYPES = 15, + ITEM_PLUGIN = 15, ITEM_IMAGEINFO = 16, ITEM_BOXINFO = 17, ITEM_CAM = 18, @@ -691,10 +704,20 @@ struct SNeutrinoSettings ITEM_FILEPLAY = 23, ITEM_TOOLS = 24, ITEM_LUA = 25, + + ITEM_HDDMENU = 26, + ITEM_AUDIOPLAY = 27, + ITEM_INETPLAY = 28, + ITEM_MAX // MUST be always the last in the list } USER_ITEM; - std::string usermenu_text[BUTTON_MAX]; - int usermenu[BUTTON_MAX][ITEM_MAX]; // (USER_ITEM) [button][position in Menue] = feature item + typedef struct { + unsigned int key; + std::string items; + std::string title; + std::string name; + } usermenu_t; + std::vector usermenu; //progressbar arrangement for infobar typedef enum diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 5e4f8509b..abb83d7e8 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -308,7 +308,9 @@ void CFrontend::getFEInfo(void) switch (info.type) { case FE_QPSK: deliverySystemMask |= DVB_S; +#ifndef BOXMODEL_NEVIS if (info.caps & FE_CAN_2G_MODULATION) +#endif deliverySystemMask |= DVB_S2; break; case FE_OFDM: