From 8dd799601e9192bbbec15d0e25ccfbaab3c9511b Mon Sep 17 00:00:00 2001 From: thilo Date: Wed, 26 Jan 2011 11:05:28 +0000 Subject: [PATCH] *neutrino cec_setup: cec-setup moved in its own module, now to find under misc settings, but it's probaly not the right place, we should waiting for more user feedback or advising about it, to find a good place for it git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1065 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/deutsch.locale | 10 +-- data/locale/english.locale | 10 +-- src/gui/Makefile.am | 1 + src/gui/cec_setup.cpp | 152 +++++++++++++++++++++++++++++++++++++ src/gui/cec_setup.h | 59 ++++++++++++++ src/gui/videosettings.cpp | 46 ----------- src/gui/videosettings.h | 3 - src/neutrino.cpp | 13 +++- src/neutrino_menue.cpp | 2 + src/system/locals.h | 2 +- src/system/locals_intern.h | 2 +- 11 files changed, 235 insertions(+), 65 deletions(-) create mode 100644 src/gui/cec_setup.cpp create mode 100644 src/gui/cec_setup.h diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index e516e84a4..392e3f9b0 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1424,11 +1424,11 @@ videomenu.dbdr_deblock deBlock videomenu.dbdr_none aus videomenu.enabled_modes Videosysteme auf der VF-Taste videomenu.fullscreen Vollbild -videomenu.hdmi_cec HDMI-CEC -videomenu.hdmi_cec_mode HDMI-CEC Modus -videomenu.hdmi_cec_mode_off aus -videomenu.hdmi_cec_mode_recorder als Recorder -videomenu.hdmi_cec_mode_tuner als Tuner +videomenu.hdmi_cec CSTLink (HDMI-CEC) +videomenu.hdmi_cec_mode Receiver verwenden +videomenu.hdmi_cec_mode_off nein +videomenu.hdmi_cec_mode_recorder als Sat/Kabel PVR +videomenu.hdmi_cec_mode_tuner als Sat/Kabel STB videomenu.hdmi_cec_standby Aktiviere CEC Standby videomenu.hdmi_cec_view_on Aktiviere CEC View on videomenu.head Video-Einstellungen diff --git a/data/locale/english.locale b/data/locale/english.locale index 28db2719e..75da6fe1c 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -994,11 +994,11 @@ videomenu.analog_hd_yprpb_scart YPbPr on scart (HD) videomenu.analog_hd_yprpb_cinch YPbPr on cinch (HD) videomenu.scart Scart videomenu.cinch Cinch -videomenu.hdmi_cec HDMI-CEC -videomenu.hdmi_cec_mode HDMI-CEC mode -videomenu.hdmi_cec_mode_off off -videomenu.hdmi_cec_mode_tuner as Tuner -videomenu.hdmi_cec_mode_recorder as Recorder +videomenu.hdmi_cec CSTLink (HDMI-CEC) +videomenu.hdmi_cec_mode Receiver to use +videomenu.hdmi_cec_mode_off no +videomenu.hdmi_cec_mode_recorder as Sat/Cable PVR +videomenu.hdmi_cec_mode_tuner as Sat/Cable STB videomenu.hdmi_cec_view_on Enable CEC View on videomenu.hdmi_cec_standby Enable CEC standby videomenu.dbdr MPEG2 de-block/de-ring diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 5675fb2d4..e8fbc78d8 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -43,6 +43,7 @@ libneutrino_gui_a_SOURCES = \ bookmarkmanager.cpp \ bouquetlist.cpp \ channellist.cpp \ + cec_setup.cpp \ dboxinfo.cpp \ epg_menu.cpp \ epgplus.cpp \ diff --git a/src/gui/cec_setup.cpp b/src/gui/cec_setup.cpp new file mode 100644 index 000000000..e70902c85 --- /dev/null +++ b/src/gui/cec_setup.cpp @@ -0,0 +1,152 @@ +/* + cec settings menu - Neutrino-GUI + + Copyright (C) 2001 Steffen Hehn 'McClean' + and some other guys + Homepage: http://dbox.cyberphoria.org/ + + Copyright (C) 2011 T. Graf 'dbt' + Homepage: http://www.dbox2-tuning.net/ + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include "gui/cec_setup.h" + +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +extern cVideo *videoDecoder; + +CCECSetup::CCECSetup() +{ + frameBuffer = CFrameBuffer::getInstance(); + + width = w_max (40, 10); //% + hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + height = hheight+13*mheight+ 10; + selected = -1; + x = getScreenStartX (width); + y = getScreenStartY (height); +} + +CCECSetup::~CCECSetup() +{ + +} + +int CCECSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/) +{ + printf("[neutrino] init cec setup...\n"); + int res = menu_return::RETURN_REPAINT; + + if (parent) + parent->hide(); + + showMenu(); + + return res; +} + +void CCECSetup::hide() +{ + frameBuffer->paintBackgroundBoxRel(x,y, width, height); +} + + +#define VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT 3 +const CMenuOptionChooser::keyval VIDEOMENU_HDMI_CEC_MODE_OPTIONS[VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT] = +{ + { VIDEO_HDMI_CEC_MODE_OFF , LOCALE_VIDEOMENU_HDMI_CEC_MODE_OFF }, + { VIDEO_HDMI_CEC_MODE_TUNER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER }, + { VIDEO_HDMI_CEC_MODE_RECORDER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_RECORDER }, +}; + +void CCECSetup::showMenu() +{ + //menue init + CMenuWidget *cec = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width); + cec->setSelected(selected); + cec->addIntroItems(LOCALE_VIDEOMENU_HDMI_CEC); + + //cec + CMenuOptionChooser *cec_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_MODE, &g_settings.hdmi_cec_mode, VIDEOMENU_HDMI_CEC_MODE_OPTIONS, VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT, true, this); + cec1 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON, &g_settings.hdmi_cec_view_on, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); + cec2 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_STANDBY, &g_settings.hdmi_cec_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); + + cec->addItem(cec_ch); + cec->addItem(GenericMenuSeparatorLine); + //------------------------------------------------------- + cec->addItem(cec1); + cec->addItem(cec2); + + cec->exec(NULL, ""); + cec->hide(); + selected = cec->getSelected(); + delete cec; +} + +void CCECSetup::setCECSettings() +{ + printf("[neutrino CEC Settings] %s init CEC settings...\n", __FUNCTION__); + videoDecoder->SetCECAutoStandby(g_settings.hdmi_cec_standby == 1); + videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1); + videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode); +} + +bool CCECSetup::changeNotify(const neutrino_locale_t OptionName, void *data) +{ + int val = 0; + if(data) + val = * (int *) data; + + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_MODE)) + { + printf("[neutrino CEC Settings] %s set CEC settings...\n", __FUNCTION__); + cec1->setActive(g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF); + cec2->setActive(g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF); + bool ret = videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode); + } + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_STANDBY)) + { + videoDecoder->SetCECAutoStandby(g_settings.hdmi_cec_standby == 1); + } + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON)) + { + videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1); + } + + return true; +} + diff --git a/src/gui/cec_setup.h b/src/gui/cec_setup.h new file mode 100644 index 000000000..2c0d702ec --- /dev/null +++ b/src/gui/cec_setup.h @@ -0,0 +1,59 @@ +/* + Mediaplayer selection menu - Neutrino-GUI + + Copyright (C) 2001 Steffen Hehn 'McClean' + and some other guys + Homepage: http://dbox.cyberphoria.org/ + + Copyright (C) 2011 T. Graf 'dbt' + Homepage: http://www.dbox2-tuning.net/ + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __CEC_SETUP__ +#define __CEC_SETUP__ + +#include + +#include + +#include + +class CCECSetup : public CMenuTarget, CChangeObserver +{ + private: + CFrameBuffer *frameBuffer; + CMenuOptionChooser *cec1, *cec2; + + int x, y, width, height, hheight, mheight, selected; + + void hide(); + void showMenu(); + + + public: + CCECSetup(); + ~CCECSetup(); + void setCECSettings(); + int exec(CMenuTarget* parent, const std::string & actionKey); + virtual bool changeNotify(const neutrino_locale_t OptionName, void *data); +}; + + +#endif diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 015b2c13a..e2a7f3f0b 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -188,14 +188,6 @@ const CMenuOptionChooser::keyval VIDEOMENU_DBDR_OPTIONS[VIDEOMENU_DBDR_OPTION_CO { 2, LOCALE_VIDEOMENU_DBDR_BOTH } }; -#define VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT 3 -const CMenuOptionChooser::keyval VIDEOMENU_HDMI_CEC_MODE_OPTIONS[VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT] = -{ - { VIDEO_HDMI_CEC_MODE_OFF , LOCALE_VIDEOMENU_HDMI_CEC_MODE_OFF }, - { VIDEO_HDMI_CEC_MODE_TUNER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER }, - { VIDEO_HDMI_CEC_MODE_RECORDER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_RECORDER }, -}; - void CVideoSettings::showVideoSetup() { //init @@ -243,12 +235,6 @@ void CVideoSettings::showVideoSetup() CMenuForwarder * vs_videomodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES, true, NULL, videomodes, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED ); - //cec - CMenuSeparator *vs_cec_sep = new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_VIDEOMENU_HDMI_CEC); - CMenuOptionChooser *vs_cec_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_MODE, &g_settings.hdmi_cec_mode, VIDEOMENU_HDMI_CEC_MODE_OPTIONS, VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT, true, this); - cec1 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON, &g_settings.hdmi_cec_view_on, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); - cec2 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_STANDBY, &g_settings.hdmi_cec_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); - //--------------------------------------- videosetup->addIntroItems(LOCALE_MAINSETTINGS_VIDEO, LOCALE_VIDEOMENU_TV_SCART); //--------------------------------------- @@ -266,11 +252,6 @@ void CVideoSettings::showVideoSetup() videosetup->addItem(vs_videomodes_ch); //video system videosetup->addItem(vs_dbdropt_ch); //dbdr options videosetup->addItem(vs_videomodes_fw); //video modes submenue - //--------------------------------------- - videosetup->addItem(vs_cec_sep); //cec - videosetup->addItem(vs_cec_ch); - videosetup->addItem(cec1); - videosetup->addItem(cec2); videosetup->exec(NULL, ""); videosetup->hide(); @@ -278,11 +259,6 @@ void CVideoSettings::showVideoSetup() delete videosetup; } -void CVideoSettings::setVideoCECSettings() -{ - setVideoSettings(); - setCECSettings(); -} void CVideoSettings::setVideoSettings() { @@ -311,14 +287,6 @@ void CVideoSettings::setVideoSettings() videoDecoder->SetDBDR(g_settings.video_dbdr); } -void CVideoSettings::setCECSettings() -{ - printf("[neutrino VideoSettings] %s init CEC settings...\n", __FUNCTION__); - videoDecoder->SetCECAutoStandby(g_settings.hdmi_cec_standby == 1); - videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1); - videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode); -} - void CVideoSettings::setupVideoSystem(bool do_ask) { printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__); @@ -358,20 +326,6 @@ bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void *data { videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode2); } - else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_MODE)) - { - cec1->setActive(g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF); - cec2->setActive(g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF); - videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode); - } - else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_STANDBY)) - { - videoDecoder->SetCECAutoStandby(g_settings.hdmi_cec_standby == 1); - } - else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON)) - { - videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1); - } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_DBDR)) { videoDecoder->SetDBDR(g_settings.video_dbdr); diff --git a/src/gui/videosettings.h b/src/gui/videosettings.h index f95f687b1..b2c420ebe 100644 --- a/src/gui/videosettings.h +++ b/src/gui/videosettings.h @@ -40,7 +40,6 @@ class CVideoSettings : public CMenuWidget, CChangeObserver private: CFrameBuffer *frameBuffer; CMenuForwarder *SyncControlerForwarder; - CMenuOptionChooser *cec1, *cec2; CMenuOptionChooser *VcrVideoOutSignalOptionChooser; int vcr_video_out_signal; @@ -67,9 +66,7 @@ public: void next43Mode(); void SwitchFormat(); - void setVideoCECSettings(); void setVideoSettings(); - void setCECSettings(); void setupVideoSystem(bool do_ask); bool getWizardMode() {return is_wizard;}; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 600a7c46f..309a10cbe 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -75,6 +75,7 @@ #include #include +#include "gui/cec_setup.h" #include "gui/widget/colorchooser.h" #include "gui/widget/menue.h" #include "gui/widget/messagebox.h" @@ -291,8 +292,8 @@ static void initGlobals(void) g_Locale = new CLocaleManager; g_PluginList = NULL; - InfoClock = NULL; - g_CamHandler = NULL; + InfoClock = NULL; + g_CamHandler = NULL; } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -2099,9 +2100,13 @@ int CNeutrinoApp::run(int argc, char **argv) audioDecoder->SetSpdifDD(g_settings.spdif_dd ? true : false); audioDecoder->EnableAnalogOut(g_settings.analog_out ? true : false); - //init video and CEC Settings + //init video settings g_videoSettings = new CVideoSettings; - g_videoSettings->setVideoCECSettings(); + g_videoSettings->setVideoSettings(); + + //init cec settings + CCECSetup cecsetup; + cecsetup.setCECSettings(); // trigger a change audioSetupNotifier->changeNotify(LOCALE_AUDIOMENU_AVSYNC, NULL); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index a53706309..4d4d61e59 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -78,6 +78,7 @@ #include "gui/bedit/bouqueteditor_bouquets.h" #include "gui/bouquetlist.h" #include "gui/channellist.h" +#include "gui/cec_setup.h" #include "gui/color.h" #include "gui/customcolor.h" #include "gui/epg_menu.h" @@ -1144,6 +1145,7 @@ void CNeutrinoApp::InitMiscSettings(CMenuWidget &miscSettings) miscSettingsFilebrowser->addItem(new CMenuOptionChooser(LOCALE_FILEBROWSER_SHOWRIGHTS , &g_settings.filebrowser_showrights , MESSAGEBOX_NO_YES_OPTIONS , MESSAGEBOX_NO_YES_OPTION_COUNT , true )); miscSettingsFilebrowser->addItem(new CMenuOptionChooser(LOCALE_FILEBROWSER_DENYDIRECTORYLEAVE, &g_settings.filebrowser_denydirectoryleave, MESSAGEBOX_NO_YES_OPTIONS , MESSAGEBOX_NO_YES_OPTION_COUNT , true )); miscSettings.addItem( new CMenuForwarder(LOCALE_FILEBROWSER_HEAD, true, NULL, miscSettingsFilebrowser, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE) ); + miscSettings.addItem(new CMenuForwarder(LOCALE_VIDEOMENU_HDMI_CEC, true, NULL, new CCECSetup() , NULL, CRCInput::RC_0)); #if 0 //infobar diff --git a/src/system/locals.h b/src/system/locals.h index 511595c37..73309ebd2 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1264,8 +1264,8 @@ typedef enum { LOCALE_VIDEOMENU_HDMI_CEC, LOCALE_VIDEOMENU_HDMI_CEC_MODE, LOCALE_VIDEOMENU_HDMI_CEC_MODE_OFF, - LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER, LOCALE_VIDEOMENU_HDMI_CEC_MODE_RECORDER, + LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER, LOCALE_VIDEOMENU_HDMI_CEC_STANDBY, LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON, LOCALE_VIDEOMENU_DBDR, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 55c707e91..2708e1bac 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1264,8 +1264,8 @@ const char *locale_real_names[] = { "videomenu.hdmi_cec", "videomenu.hdmi_cec_mode", "videomenu.hdmi_cec_mode_off", - "videomenu.hdmi_cec_mode_tuner", "videomenu.hdmi_cec_mode_recorder", + "videomenu.hdmi_cec_mode_tuner", "videomenu.hdmi_cec_standby", "videomenu.hdmi_cec_view_on", "videomenu.dbdr",