diff --git a/acinclude.m4 b/acinclude.m4 index 22f4c8214..5bfcbfcbd 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -42,11 +42,10 @@ elif test "$TARGET" = "cdk"; then AC_MSG_RESULT(cdk) if test "$CC" = "" -a "$CXX" = ""; then - CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++ + AC_MSG_ERROR([you need to specify variables CC or CXX in cdk]) fi - if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then - CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS" - CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS" + if test "$CFLAGS" = "" -o "$CXXFLAGS" = ""; then + AC_MSG_ERROR([you need to specify variables CFLAGS and CXXFLAGS in cdk]) fi if test "$prefix" = "NONE"; then AC_MSG_ERROR([invalid prefix, you need to specify one in cdk mode]) @@ -58,10 +57,6 @@ elif test "$TARGET" = "cdk"; then AC_MSG_ERROR([invalid targetprefix, you need to specify one in cdk mode]) TARGET_PREFIX="" fi - if test "$host_alias" = ""; then - cross_compiling=yes - host_alias=powerpc-tuxbox-linux-gnu - fi else AC_MSG_RESULT(none) AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]); @@ -206,79 +201,6 @@ AC_SUBST(PUBLIC_HTTPDDIR) AC_SUBST(HOSTED_HTTPDDIR) dnl end workaround -AC_DEFUN([TUXBOX_APPS_ENDIAN],[ -AC_CHECK_HEADERS(endian.h) -AC_C_BIGENDIAN -]) - -AC_DEFUN([TUXBOX_APPS_DRIVER],[ -AC_ARG_WITH(driver, - [ --with-driver=PATH path for driver sources [[NONE]]], - [DRIVER="$withval"],[DRIVER=""]) - -if test -d "$DRIVER/include"; then - AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources]) -else - AC_MSG_ERROR([can't find driver sources]) -fi - -AC_SUBST(DRIVER) - -CPPFLAGS="$CPPFLAGS -I$DRIVER/include" -]) - -AC_DEFUN([TUXBOX_APPS_DVB],[ -AC_ARG_WITH(dvbincludes, - [ --with-dvbincludes=PATH path for dvb includes [[NONE]]], - [DVBINCLUDES="$withval"],[DVBINCLUDES=""]) - -if test "$DVBINCLUDES"; then - CPPFLAGS="-I$DVBINCLUDES $CPPFLAGS" - CFLAGS="-I$DVBINCLUDES $CFLAGS" - CXXFLAGS="-I$DVBINCLUDES $CXXFLAGS" -fi - -AC_CHECK_HEADERS(linux/dvb/version.h,[ - AC_LANG_PREPROC_REQUIRE() - AC_REQUIRE([AC_PROG_EGREP]) - AC_LANG_CONFTEST([AC_LANG_SOURCE([[ -#include -version DVB_API_VERSION - ]])]) - DVB_API_VERSION=`(eval "$ac_cpp -traditional-cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"` - - AC_LANG_CONFTEST([AC_LANG_SOURCE([[ -#include -version DVB_API_VERSION_MINOR - ]])]) - DVB_API_VERSION_MINOR=`(eval "$ac_cpp -traditional-cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"` - rm -f conftest* - - AC_MSG_NOTICE([found dvb version $DVB_API_VERSION.$DVB_API_VERSION_MINOR]) -]) - -if test "$DVB_API_VERSION"; then - AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes]) - AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api]) -else - AC_MSG_ERROR([can't find dvb headers]) -fi - -if test "$DVB_API_VERSION_MINOR"; then - AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION_MINOR,$DVB_API_VERSION_MINOR,[Define to the minor version of the dvb api]) -else - AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION_MINOR,0,[Define to the minor version of the dvb api]) -fi -]) - -AC_DEFUN([TUXBOX_APPS_CAPTURE],[ -AC_CHECK_HEADER(linux/dvb/avia/avia_gt_capture.h,[ - AC_DEFINE(HAVE_OLD_CAPTURE_API,1,[Define this if you want to use the old dbox2 capture API]) - AC_MSG_NOTICE([using old demux capture API])],[ - AC_MSG_NOTICE([using v4l2 capture API]) - ]) -]) - AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[ AC_PATH_PROG($1_CONFIG,$2,no) if test "$$1_CONFIG" != "no"; then @@ -354,128 +276,20 @@ AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[ _TUXBOX_APPS_LIB_PKGCONFIG($1,$2) ]) -AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[ -AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no") -if test "$HAVE_$1" = "yes"; then - $1_LIBS=-l$2 -fi - -AC_SUBST($1_LIBS) -]) - -AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[ -_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR) -if test "$HAVE_$1" = "no"; then - AC_MSG_ERROR([could not find $2]); -fi -]) - -AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[ -_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN) -]) - -AC_DEFUN([TUXBOX_APPS_GETTEXT],[ -AC_PATH_PROG(MSGFMT, msgfmt, no) -AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) -AC_PATH_PROG(XGETTEXT, xgettext, no) -AC_PATH_PROG(MSGMERGE, msgmerge, no) - -AC_MSG_CHECKING([whether NLS is requested]) -AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) -AC_MSG_RESULT($USE_NLS) -AC_SUBST(USE_NLS) - -if test "$USE_NLS" = "yes"; then - AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[ - AC_TRY_LINK([ - #include - #ifndef __GNU_GETTEXT_SUPPORTED_REVISION - #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) - #endif - extern int _nl_msg_cat_cntr; - extern int *_nl_domain_bindings; - ],[ - bindtextdomain ("", ""); - return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings; - ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no - )] - ) - - if test "$gt_cv_func_gnugettext_libc" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) - gt_use_preinstalled_gnugettext=yes - else - USE_NLS=no - fi -fi - -if test -f "$srcdir/po/LINGUAS"; then - ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS") -fi - -POFILES= -GMOFILES= -UPDATEPOFILES= -DUMMYPOFILES= -for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" -done -INST_LINGUAS= -if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test -n "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done -fi -CATALOGS= -if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done -fi -AC_SUBST(POFILES) -AC_SUBST(GMOFILES) -AC_SUBST(UPDATEPOFILES) -AC_SUBST(DUMMYPOFILES) -AC_SUBST(CATALOGS) -]) - AC_DEFUN([TUXBOX_BOXTYPE],[ AC_ARG_WITH(boxtype, - [ --with-boxtype valid values: dbox2,tripledragon,dreambox,ipbox,coolstream,spark,azbox,generic], + [ --with-boxtype valid values: tripledragon,coolstream,spark,azbox,generic], [case "${withval}" in - dbox2|dreambox|ipbox|tripledragon|coolstream|spark|azbox|generic) + tripledragon|coolstream|spark|azbox|generic) BOXTYPE="$withval" ;; - dm*) - BOXTYPE="dreambox" - BOXMODEL="$withval" - ;; *) AC_MSG_ERROR([bad value $withval for --with-boxtype]) ;; esac], [BOXTYPE="coolstream"]) AC_ARG_WITH(boxmodel, [ --with-boxmodel valid for coolstream: hd1, hd2 - valid for dreambox: dm500, dm500plus, dm600pvr, dm56x0, dm7000, dm7020, dm7025 - valid for ipbox: ip200, ip250, ip350, ip400], + valid for generic: raspi], [case "${withval}" in hd1|hd2) if test "$BOXTYPE" = "coolstream"; then @@ -496,15 +310,8 @@ AC_ARG_WITH(boxmodel, AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) fi ;; - dm500|dm500plus|dm600pvr|dm56x0|dm7000|dm7020|dm7025) - if test "$BOXTYPE" = "dreambox"; then - BOXMODEL="$withval" - else - AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) - fi - ;; - ip200|ip250|ip350|ip400) - if test "$BOXTYPE" = "ipbox"; then + raspi) + if test "$BOXTYPE" = "generic"; then BOXMODEL="$withval" else AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) @@ -521,18 +328,13 @@ AC_ARG_WITH(boxmodel, AC_MSG_ERROR([unsupported value $withval for --with-boxmodel]) ;; esac], [test "$BOXTYPE" = "coolstream" && BOXMODEL="hd1" || true] - [if test "$BOXTYPE" = "dreambox" -o "$BOXTYPE" = "ipbox" && test -z "$BOXMODEL"; then - AC_MSG_ERROR([Dreambox/IPBox needs --with-boxmodel]) - fi]) + ) AC_SUBST(BOXTYPE) AC_SUBST(BOXMODEL) AM_CONDITIONAL(BOXTYPE_AZBOX, test "$BOXTYPE" = "azbox") -AM_CONDITIONAL(BOXTYPE_DBOX2, test "$BOXTYPE" = "dbox2") AM_CONDITIONAL(BOXTYPE_TRIPLE, test "$BOXTYPE" = "tripledragon") -AM_CONDITIONAL(BOXTYPE_DREAMBOX, test "$BOXTYPE" = "dreambox") -AM_CONDITIONAL(BOXTYPE_IPBOX, test "$BOXTYPE" = "ipbox") AM_CONDITIONAL(BOXTYPE_COOL, test "$BOXTYPE" = "coolstream") AM_CONDITIONAL(BOXTYPE_SPARK, test "$BOXTYPE" = "spark") AM_CONDITIONAL(BOXTYPE_GENERIC, test "$BOXTYPE" = "generic") @@ -540,29 +342,12 @@ AM_CONDITIONAL(BOXTYPE_GENERIC, test "$BOXTYPE" = "generic") AM_CONDITIONAL(BOXMODEL_CS_HD1,test "$BOXMODEL" = "hd1") AM_CONDITIONAL(BOXMODEL_CS_HD2,test "$BOXMODEL" = "hd2") -AM_CONDITIONAL(BOXMODEL_DM500,test "$BOXMODEL" = "dm500") -AM_CONDITIONAL(BOXMODEL_DM500PLUS,test "$BOXMODEL" = "dm500plus") -AM_CONDITIONAL(BOXMODEL_DM600PVR,test "$BOXMODEL" = "dm600pvr") -AM_CONDITIONAL(BOXMODEL_DM56x0,test "$BOXMODEL" = "dm56x0") -AM_CONDITIONAL(BOXMODEL_DM7000,test "$BOXMODEL" = "dm7000" -o "$BOXMODEL" = "dm7020" -o "$BOXMODEL" = "dm7025") - -AM_CONDITIONAL(BOXMODEL_IP200,test "$BOXMODEL" = "ip200") -AM_CONDITIONAL(BOXMODEL_IP250,test "$BOXMODEL" = "ip250") -AM_CONDITIONAL(BOXMODEL_IP350,test "$BOXMODEL" = "ip350") -AM_CONDITIONAL(BOXMODEL_IP400,test "$BOXMODEL" = "ip400") - AM_CONDITIONAL(BOXMODEL_RASPI,test "$BOXMODEL" = "raspi") -if test "$BOXTYPE" = "dbox2"; then - AC_DEFINE(HAVE_DBOX_HARDWARE, 1, [building for a dbox2]) -elif test "$BOXTYPE" = "azbox"; then +if test "$BOXTYPE" = "azbox"; then AC_DEFINE(HAVE_AZBOX_HARDWARE, 1, [building for an azbox]) elif test "$BOXTYPE" = "tripledragon"; then AC_DEFINE(HAVE_TRIPLEDRAGON, 1, [building for a tripledragon]) -elif test "$BOXTYPE" = "dreambox"; then - AC_DEFINE(HAVE_DREAMBOX_HARDWARE, 1, [building for a dreambox]) -elif test "$BOXTYPE" = "ipbox"; then - AC_DEFINE(HAVE_IPBOX_HARDWARE, 1, [building for an ipbox]) elif test "$BOXTYPE" = "coolstream"; then AC_DEFINE(HAVE_COOL_HARDWARE, 1, [building for a coolstream]) elif test "$BOXTYPE" = "spark"; then @@ -575,17 +360,7 @@ fi if test "$BOXMODEL" = "hd1"; then AC_DEFINE(BOXMODEL_CS_HD1, 1, [coolstream hd1/neo/neo2/zee]) elif test "$BOXMODEL" = "hd2"; then - AC_DEFINE(BOXMODEL_CS_HD2, 1, [coolstream tank/trinity/trinity v2/trinity duo/zeeČ/link]) -elif test "$BOXMODEL" = "dm500"; then - AC_DEFINE(BOXMODEL_DM500, 1, [dreambox 500]) -elif test "$BOXMODEL" = "ip200"; then - AC_DEFINE(BOXMODEL_IP200, 1, [ipbox 200]) -elif test "$BOXMODEL" = "ip250"; then - AC_DEFINE(BOXMODEL_IP250, 1, [ipbox 250]) -elif test "$BOXMODEL" = "ip350"; then - AC_DEFINE(BOXMODEL_IP350, 1, [ipbox 350]) -elif test "$BOXMODEL" = "ip400"; then - AC_DEFINE(BOXMODEL_IP400, 1, [ipbox 400]) + AC_DEFINE(BOXMODEL_CS_HD2, 1, [coolstream tank/trinity/trinity v2/trinity duo/zee2/link]) elif test "$BOXMODEL" = "raspi"; then AC_DEFINE(BOXMODEL_RASPI, 1, [Raspberry pi]) fi @@ -612,4 +387,3 @@ AC_DEFUN([AC_PROG_EGREP], EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ]) - diff --git a/configure.ac b/configure.ac index fabe46e56..78ff83be8 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,6 @@ AM_INIT_AUTOMAKE([1.0.1 nostdinc]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) TUXBOX_APPS -TUXBOX_APPS_DVB TUXBOX_APPS_DIRECTORY TUXBOX_APPS_PKGCONFIG TUXBOX_BOXTYPE diff --git a/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h b/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h index 1051c99c0..9a4e77259 100644 --- a/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h +++ b/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h @@ -47,6 +47,9 @@ enum CS_LOG_MODULE { void cs_api_init(void); void cs_api_exit(void); +/* Dummy for compatibility with HD2 */ +#define cs_new_auto_videosystem(); + // Memory helpers void *cs_malloc_uncached(size_t size); void cs_free_uncached(void *ptr); diff --git a/lib/hardware/coolstream/hd1/libcoolstream/helpers_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/helpers_cs.h new file mode 100644 index 000000000..8e7ea0b93 --- /dev/null +++ b/lib/hardware/coolstream/hd1/libcoolstream/helpers_cs.h @@ -0,0 +1,16 @@ +#ifndef __HELPERS_CS_H__ +#define __HELPERS_CS_H__ + +enum { + CS_EXTRA_DEBUG_OFF = 0x00000000, + CS_EXTRA_DEBUG_VIDEO1 = 0x00000001, + CS_EXTRA_DEBUG_ALL = 0xFFFFFFFF +}; + +void cs_set_extra_debug(uint32_t mode); + +const char* __func_ext__f(const char* _func_, int _line_, const char* _file_, bool havePathFile); +#define __func_ext__ __func_ext__f(__PRETTY_FUNCTION__, __LINE__, NULL, true) +#define __func_ext_file__ __func_ext__f(__PRETTY_FUNCTION__, __LINE__, __path_file__, true) + +#endif // __HELPERS_CS_H__ diff --git a/lib/hardware/coolstream/hd1/libcoolstream/video_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/video_cs.h index 47524c1b6..b29677e83 100644 --- a/lib/hardware/coolstream/hd1/libcoolstream/video_cs.h +++ b/lib/hardware/coolstream/hd1/libcoolstream/video_cs.h @@ -9,9 +9,11 @@ #ifndef __VIDEO_CS_H_ #define __VIDEO_CS_H_ +#include #include #include #include +#include #include "cs_types.h" @@ -123,6 +125,18 @@ typedef enum VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS } VIDEO_CONTROL; +typedef struct cs_vs_format_t +{ + char format[16]; +} cs_vs_format_struct_t; + +enum { + CS_FBCOPY_BB2FB = 0, + CS_FBCOPY_FB2FB = 1, + CS_FBCOPY_MEM2FB = 2, + CS_FBCOPY_FB2MEM = 3 +}; + class cVideo { private: CS_VIDEO_PDATA *privateData; @@ -155,6 +169,11 @@ private: vfd_icon mode_icon; unsigned int unit; cDemux *demux; + int current_video_system; + bool isReadScreeninfo; + fb_var_screeninfo varScreeninfo; + fb_fix_screeninfo fixScreeninfo; + // int SelectAutoFormat(); void ScalePic(); @@ -163,6 +182,9 @@ public: cVideo(int mode, void * hChannel, void * hBuffer, unsigned int Unit = 0); ~cVideo(void); + /* Important! + Call this function when osd resolution has been changed */ + void updateOsdScreenInfo(); void * GetDRM(void); void * GetTVEnc(); void * GetTVEncSD(); @@ -207,6 +229,11 @@ public: int64_t GetPTS(void); int Flush(void); + /* get video system infos */ + int GetVideoSystem(); + /* when system = -1 then use current video system */ + void GetVideoSystemFormatName(cs_vs_format_t* format, int system = -1); + /* set video_system */ int SetVideoSystem(int video_system, bool remember = true); int SetStreamType(VIDEO_FORMAT type); @@ -234,6 +261,8 @@ public: int StartVBI(unsigned short pid); int StopVBI(void); bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); + int fbCopy(uint32_t *mem_p, int width, int height, int dst_x, int dst_y, int src_x, int src_y, int mode); + int fbFill(int sx, int sy, int width, int height, fb_pixel_t col, int mode=0); void SetDemux(cDemux *Demux); }; diff --git a/lib/hardware/coolstream/hd2/libcoolstream/helpers_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/helpers_cs.h new file mode 100644 index 000000000..8e7ea0b93 --- /dev/null +++ b/lib/hardware/coolstream/hd2/libcoolstream/helpers_cs.h @@ -0,0 +1,16 @@ +#ifndef __HELPERS_CS_H__ +#define __HELPERS_CS_H__ + +enum { + CS_EXTRA_DEBUG_OFF = 0x00000000, + CS_EXTRA_DEBUG_VIDEO1 = 0x00000001, + CS_EXTRA_DEBUG_ALL = 0xFFFFFFFF +}; + +void cs_set_extra_debug(uint32_t mode); + +const char* __func_ext__f(const char* _func_, int _line_, const char* _file_, bool havePathFile); +#define __func_ext__ __func_ext__f(__PRETTY_FUNCTION__, __LINE__, NULL, true) +#define __func_ext_file__ __func_ext__f(__PRETTY_FUNCTION__, __LINE__, __path_file__, true) + +#endif // __HELPERS_CS_H__ diff --git a/lib/hardware/coolstream/hd2/libcoolstream/video_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/video_cs.h index 71f4e6db5..515d4ad3f 100644 --- a/lib/hardware/coolstream/hd2/libcoolstream/video_cs.h +++ b/lib/hardware/coolstream/hd2/libcoolstream/video_cs.h @@ -9,6 +9,7 @@ #ifndef __VIDEO_CS_H_ #define __VIDEO_CS_H_ +#include #include #include @@ -158,6 +159,13 @@ typedef struct cs_vs_format_t char formatSD[16]; } cs_vs_format_struct_t; +enum { + CS_FBCOPY_BB2FB = 0, + CS_FBCOPY_FB2FB = 1, + CS_FBCOPY_MEM2FB = 2, + CS_FBCOPY_FB2MEM = 3 +}; + class cDemux; class cAudio; @@ -206,6 +214,10 @@ public: cVideo(int mode, void * hChannel, void * hBuffer); ~cVideo(void); + /* Important! + Call this function when osd resolution has been changed */ + void updateOsdScreenInfo(); + void * GetVPP(void); void * GetTVEnc(); void * GetTVEncSD(); @@ -282,6 +294,8 @@ public: int StartVBI(unsigned short pid); int StopVBI(void); bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); + int fbCopy(uint32_t *mem_p, int width, int height, int dst_x, int dst_y, int src_x, int src_y, int mode); + int fbFill(int sx, int sy, int width, int height, fb_pixel_t col, int mode=0); void SetDemux(cDemux *Demux); static cVideo *GetDecoder(unsigned int Unit); bool SyncSTC(void); diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index b7bba8f93..b7e964356 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -124,8 +124,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const cc_btn_font = NULL; cc_btn_icon = icon_name; cc_btn_text = caption; - cc_directKey = CRCInput::RC_nokey; - cc_directKeyAlt = cc_directKey; + cc_directKeys.push_back(CRCInput::RC_nokey); cc_btn_result = -1; cc_btn_alias = -1; diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index a0540636b..92bf474f8 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -70,9 +70,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen ///property: icon name, only icons supported, to find in gui/widget/icons.h std::string cc_btn_icon; - ///property: assigned event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKey(), getButtonDirectKey() - neutrino_msg_t cc_directKey; - ///property: assigned an alternate event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKeyAlt(), getButtonDirectKeyAlt() + ///property: container for all assigned event message values, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKey(), hasButtonDirectKey() + std::vectorcc_directKeys; + ///property: assigned an alternate event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKeyAlt(), hasButtonDirectKeyAlt() neutrino_msg_t cc_directKeyAlt; ///property: assigned return value, see also setButtonResult(), getButtonResult(), default value = -1 (not defined) int cc_btn_result; @@ -135,7 +135,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen fb_pixel_t color_frame = COL_SHADOW_PLUS_0, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); ///set text color - inline virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_text_col = caption_color;}; + void setButtonTextColor(fb_pixel_t caption_color){cc_btn_text_col = caption_color;}; /**Member to modify background behavior of embeded caption object. * @param[in] mode @@ -159,42 +159,80 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen }; ///set caption: parameter as string - virtual void setCaption(const std::string& text); + void setCaption(const std::string& text); ///set caption: parameter as locale - virtual void setCaption(const neutrino_locale_t locale_text); + void setCaption(const neutrino_locale_t locale_text); ///get caption, type as std::string - inline virtual std::string getCaptionString(){return cc_btn_text;}; + std::string getCaptionString(){return cc_btn_text;}; ///get loacalized caption id, type = neutrino_locale_t - inline virtual neutrino_locale_t getCaptionLocale(){return cc_btn_text_locale;}; + neutrino_locale_t getCaptionLocale(){return cc_btn_text_locale;}; ///property: set font for label caption, parameter as font object, value NULL causes usaage of dynamic font - virtual void setButtonFont(Font* font){cc_btn_font = font; initCCBtnItems();}; + void setButtonFont(Font* font){cc_btn_font = font; initCCBtnItems();}; ///reinitialize items - virtual void Refresh(){initCCBtnItems();}; + void Refresh(){initCCBtnItems();}; ///paint button object void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - ///assigns an event msg value to button object, parameter1 as neutrino_msg_t, see driver/rcinput.h for possible values - inline virtual void setButtonDirectKey(const neutrino_msg_t& msg){cc_directKey = msg;}; - ///assigns an alternate event msg value to button object, parameter1 as neutrino_msg_t, see driver/rcinput.h for possible values - inline virtual void setButtonDirectKeyA(const neutrino_msg_t& msg){cc_directKeyAlt = msg;}; - ///returns an event msg value to button object, see driver/rcinput.h for possible values - inline virtual neutrino_msg_t getButtonDirectKey(){return cc_directKey;}; - ///returns an alternate event msg value to button object, but returns the primary direct key if no key was defined, see driver/rcinput.h for possible values - inline virtual neutrino_msg_t getButtonDirectKeyA(){return cc_directKeyAlt != CRCInput::RC_nokey ? cc_directKeyAlt : cc_directKey ;}; + /** + * Assigns a single event msg value to button object + * @param[in] neutrino_msg_t + * @li excepts type msg_result_t + * @note This method adds only one message key value into the cc_directKeys container, \n + * Already existant keys will be removed. When more than one key value is required, \n + * use setButtonDirectKeys(). + * @see setButtonDirectKeys(), driver/rcinput.h for possible values + */ + + void setButtonDirectKey(const neutrino_msg_t& msg){cc_directKeys.clear(); cc_directKeys.push_back(msg);} + /** + * Assigns a container with any event msg values to button object + * @param[in] v_directKeys + * @li excepts type std::vector + * @note This method adds any message key values into the cc_directKeys container, \n + * Already existant keys will be removed. When only one key value is required, \n + * use setButtonDirectKey(). + * @see driver/rcinput.h for possible values + */ + void setButtonDirectKeys(const std::vector &v_directKeys){cc_directKeys = v_directKeys;} + + /** + * Returns current primary event msg value of button object. + * @return neutrino_msg_t + * @note This method returns only the first existant message value from cc_directKeys container \n + * Other existant keys ar ignored. If a certain value is required, \n + * use hasButtonDirectKey(). + * @see bool hasButtonDirectKey(), driver/rcinput.h for possible values + */ + neutrino_msg_t getButtonDirectKey(){return cc_directKeys[0];} + + /** + * Returns true if filtered event msg value of button object is found in cc_directKeys container. + * @return bool + * @param[in] msg + * @li exepts type neutrino_msg_t as filter for searched message + * @see neutrino_msg_t getButtonDirectKey(), driver/rcinput.h for possible values + */ + bool hasButtonDirectKey(const neutrino_msg_t& msg) + { + for (size_t i= 0; i< cc_directKeys.size(); i++) + if (cc_directKeys[i] == msg) + return true; + return false; + } ///assigns an return value to button object, parameter1 as int - inline virtual void setButtonResult(const int& result_value){cc_btn_result = result_value;}; + void setButtonResult(const int& result_value){cc_btn_result = result_value;} ///returns current result value of button object - inline virtual int getButtonResult(){return cc_btn_result;}; + int getButtonResult(){return cc_btn_result;} ///assigns an alias value to button object, parameter1 as int, e.g. previous known as mbYes, mbNo... from message boxes - inline virtual void setButtonAlias(const int& alias_value){cc_btn_alias = alias_value;}; + void setButtonAlias(const int& alias_value){cc_btn_alias = alias_value;} ///returns an alias value from button object, see also cc_btn_alias - inline virtual int getButtonAlias(){return cc_btn_alias;}; + int getButtonAlias(){return cc_btn_alias;} }; //! Sub class of CComponentsButton. diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 017bc7feb..8084521e4 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -192,8 +192,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con CComponentsButton *btn = new CComponentsButton(0, y_btn, w_btn, h_btn, txt, icon_name, NULL, false, true, ccf_enable_button_shadow); btn->doPaintBg(ccf_enable_button_bg); - btn->setButtonDirectKey(content[i].directKey); - btn->setButtonDirectKeyA(content[i].directKeyAlt); + btn->setButtonDirectKeys(content[i].directKeys); btn->setButtonResult(content[i].btn_result); btn->setButtonAlias(content[i].btn_alias); btn->setButtonFont(ccf_btn_font); @@ -253,7 +252,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label * const conten buttons[i].locale = content[i].locale; //NOTE: here are used default values, because old button label struct don't know about this, //if it possible, don't use this methode! - buttons[i].directKey = buttons[i].directKeyAlt = CRCInput::RC_nokey; + buttons[i].directKeys.push_back(CRCInput::RC_nokey); buttons[i].btn_result = -1; buttons[i].btn_alias = -1; } @@ -269,8 +268,7 @@ void CComponentsFooter::setButtonLabels(const vector &v_content buttons[i].button = v_content[i].button; buttons[i].text = v_content[i].text; buttons[i].locale = v_content[i].locale; - buttons[i].directKey = v_content[i].directKey; - buttons[i].directKeyAlt = v_content[i].directKeyAlt; + buttons[i].directKeys = v_content[i].directKeys; buttons[i].btn_result = v_content[i].btn_result; buttons[i].btn_alias = v_content[i].btn_alias; } @@ -284,15 +282,13 @@ void CComponentsFooter::setButtonLabel( const char *button_icon, const int& label_width, const neutrino_msg_t& msg, const int& result_value, - const int& alias_value, - const neutrino_msg_t& directKeyAlt) + const int& alias_value) { button_label_cc button[1]; button[0].button = button_icon; button[0].text = text; - button[0].directKey = msg; - button[0].directKeyAlt = directKeyAlt; + button[0].directKeys.push_back(msg); button[0].btn_result = result_value; button[0].btn_alias = alias_value; @@ -305,12 +301,11 @@ void CComponentsFooter::setButtonLabel( const char *button_icon, const int& label_width, const neutrino_msg_t& msg, const int& result_value, - const int& alias_value, - const neutrino_msg_t& directKeyAlt) + const int& alias_value) { string txt = locale != NONEXISTANT_LOCALE ? g_Locale->getText(locale) : ""; - setButtonLabel(button_icon, txt, chain_width, label_width, msg, result_value, alias_value, directKeyAlt); + setButtonLabel(button_icon, txt, chain_width, label_width, msg, result_value, alias_value); } void CComponentsFooter::enableButtonBg(bool enable) diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 3cc572605..852faaae1 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -99,8 +99,7 @@ class CComponentsFooter : public CComponentsHeader const int& label_width = 0, const neutrino_msg_t& msg = CRCInput::RC_nokey, const int& result_value = -1, - const int& alias_value = -1, - const neutrino_msg_t& directKeyAlt = CRCInput::RC_nokey); + const int& alias_value = -1); ///add single button label with locale label type as content, chain_width as int, label width as int void setButtonLabel( const char *button_icon, const neutrino_locale_t& locale, @@ -108,8 +107,7 @@ class CComponentsFooter : public CComponentsHeader const int& label_width = 0, const neutrino_msg_t& msg = CRCInput::RC_nokey, const int& result_value = -1, - const int& alias_value = -1, - const neutrino_msg_t& directKeyAlt = CRCInput::RC_nokey); + const int& alias_value = -1); ///enables background of buttons, parameter bool show, default= true void enableButtonBg(bool enable = true); diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 5f56ee181..83b22f8d3 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -179,16 +179,19 @@ typedef struct cc_string_ext_txt_t //for 'button_label' type with string typedef struct button_label_cc { - const char * button; - std::string text; - neutrino_locale_t locale; - neutrino_msg_t directKey; - neutrino_msg_t directKeyAlt; - int btn_result; - int btn_alias; - std::string bg_image; - std::string hint; - button_label_cc(): button(NULL), text(std::string()), locale(NONEXISTANT_LOCALE){} + const char * button; + std::string text; + neutrino_locale_t locale; + std::vector directKeys; + int btn_result; + int btn_alias; + std::string bg_image; + std::string hint; + //defaults + button_label_cc(): button(NULL), + text(std::string()), + locale(NONEXISTANT_LOCALE), + directKeys(1, CRCInput::RC_nokey){} } button_label_cc_struct; #define CC_WIDTH_MIN 16 diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index bcdd23e8a..eb40539cb 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -134,8 +134,8 @@ void CMsgBox::initButtons() if (mb_show_button & mbOk){ btn.button = NEUTRINO_ICON_BUTTON_OKAY; btn.text = BTN_TEXT(mbOk); - btn.directKey = CRCInput::RC_ok; - btn.directKeyAlt = btn.directKey; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_ok); btn.btn_result = mbrOk; btn.btn_alias = mbOk; v_buttons.push_back(btn); @@ -143,8 +143,9 @@ void CMsgBox::initButtons() if (mb_show_button & mbNo){ btn.button = NEUTRINO_ICON_BUTTON_RED; btn.text = BTN_TEXT(mbNo); - btn.directKey = CRCInput::RC_red; - btn.directKeyAlt = CRCInput::RC_home; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_red); + btn.directKeys.push_back(CRCInput::RC_home); btn.btn_result = mbrNo; btn.btn_alias = mbNo; v_buttons.push_back(btn); @@ -152,8 +153,9 @@ void CMsgBox::initButtons() if (mb_show_button & mbYes){ btn.button = NEUTRINO_ICON_BUTTON_GREEN; btn.text = BTN_TEXT(mbYes); - btn.directKey = CRCInput::RC_green; - btn.directKeyAlt = CRCInput::RC_ok; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_green); + btn.directKeys.push_back(CRCInput::RC_ok); btn.btn_result = mbrYes; btn.btn_alias = mbYes; v_buttons.push_back(btn); @@ -161,8 +163,9 @@ void CMsgBox::initButtons() if (mb_show_button & mbCancel){ btn.button = NEUTRINO_ICON_BUTTON_HOME; btn.text = BTN_TEXT(mbCancel); - btn.directKey = CRCInput::RC_home; - btn.directKeyAlt = CRCInput::RC_setup; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_home); + btn.directKeys.push_back(CRCInput::RC_setup); btn.btn_result = mbrCancel; btn.btn_alias = mbCancel; v_buttons.push_back(btn); @@ -170,8 +173,8 @@ void CMsgBox::initButtons() if (mb_show_button & mbBack){ btn.button = NEUTRINO_ICON_BUTTON_HOME; btn.text = BTN_TEXT(mbBack); - btn.directKey = CRCInput::RC_home; - btn.directKeyAlt = btn.directKey; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_home); btn.btn_result = mbrBack; btn.btn_alias = mbBack; v_buttons.push_back(btn); @@ -179,15 +182,18 @@ void CMsgBox::initButtons() if (mb_show_button & mbNoYes){ btn.button = NEUTRINO_ICON_BUTTON_RED; btn.text = BTN_TEXT(mbYes); - btn.directKey = CRCInput::RC_red; - btn.directKeyAlt = CRCInput::RC_ok; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_red); + btn.directKeys.push_back(CRCInput::RC_ok); btn.btn_result = mbrYes; btn.btn_alias = mbYes; v_buttons.push_back(btn); + btn.button = NEUTRINO_ICON_BUTTON_GREEN; btn.text = BTN_TEXT(mbNo); - btn.directKey = CRCInput::RC_green; - btn.directKeyAlt = CRCInput::RC_home; + btn.directKeys.clear(); + btn.directKeys.push_back(CRCInput::RC_green); + btn.directKeys.push_back(CRCInput::RC_home); btn.btn_result = mbrNo; btn.btn_alias = mbNo; v_buttons.push_back(btn); @@ -299,7 +305,7 @@ int CMsgBox::exec() //***action buttons without preselection*** for (size_t i = 0; i< ccw_footer->getButtonChainObject()->size(); i++){ CComponentsButton* btn_action = static_cast(ccw_footer->getButtonChainObject()->getCCItem(i)); - if (msg == btn_action->getButtonDirectKey() || msg == btn_action->getButtonDirectKeyA()){ + if (btn_action->hasButtonDirectKey(msg)){ result = (msg_result_t)btn_action->getButtonResult(); dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); loop = false; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 5458fa490..ac3e8d497 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2168,10 +2168,6 @@ TIMER_START(); g_RCInput = new CRCInput(); - /* later on, we'll crash anyway, so tell about it. */ - if (! zapit_init) - DisplayErrorMessage("Zapit initialization failed. This is a fatal error, sorry."); - InitZapitClient(); g_Zapit->setStandby(false); @@ -2231,6 +2227,10 @@ TIMER_START(); g_CamHandler = new CCAMMenuHandler(); g_CamHandler->init(); + /* later on, we'll crash anyway, so tell about it. */ + if (! zapit_init) + DisplayErrorMessage("Zapit initialization failed. This is a fatal error, sorry."); + #ifndef ASSUME_MDEV mkdir("/media/sda1", 0755); mkdir("/media/sdb1", 0755);