From b740a1d3264d67a287aea447bda0100d224b6c8a Mon Sep 17 00:00:00 2001 From: Boubacar DIENE Date: Fri, 27 Jan 2017 23:13:45 +0100 Subject: [PATCH] Add possibility to perform several actions in 1 click --- README | 4 +- build/Makefile.inc | 2 +- inc/core/Loaders.h | 11 +- inc/core/XmlDefines.h | 4 +- inc/graphics/Graphics.h | 3 +- inc/specific/Specific.h | 14 +- res/Main.xml | 6 +- res/configs/Graphics.xml | 31 ++- src/core/Core.c | 9 +- src/core/loaders/GraphicsLoader.c | 150 ++++++++++--- src/graphics/Drawer.c | 13 +- src/graphics/Graphics.c | 46 ++-- src/specific/Handlers.c | 348 +++++++++++++++++++++++------- src/specific/Specific.c | 8 +- 14 files changed, 486 insertions(+), 163 deletions(-) diff --git a/README b/README index 88e1de5..193eb2a 100644 --- a/README +++ b/README @@ -17,7 +17,7 @@ mmstreamer currently includes 4 independent modules : - Graphics : To locally display video The application has been designed to make configuring these features as simple as -possible. Unless you have very specific needs, th following xml resources should +possible. Unless you have very specific needs, the following xml resources should be sufficient to use it : - res/Main.xml : Choose which modules to launch and how to keep app alive @@ -40,7 +40,7 @@ can locally display using "Graphics" module before they are sent to connected c through "Servers" module. All kind of clients are supported : Browsers, Applications (VLC, ...) -Connections can also be performed from any type of devices (computers, mobiles). +Connections can also be initiated from any type of devices (computers, mobiles). mmstreamer provides a dynamic library called "libnet-client-.so" that can be used to connect and get stream from its servers. However, feel free to implement your diff --git a/build/Makefile.inc b/build/Makefile.inc index ddb7d15..9725248 100755 --- a/build/Makefile.inc +++ b/build/Makefile.inc @@ -15,7 +15,7 @@ # Project PROJECT_NAME := mmstreamer -PROJECT_VERSION := 0.1 +PROJECT_VERSION := 0.2 # Path LOCAL := ${shell pwd} diff --git a/inc/core/Loaders.h b/inc/core/Loaders.h index b138939..cbc19f1 100755 --- a/inc/core/Loaders.h +++ b/inc/core/Loaders.h @@ -66,6 +66,7 @@ typedef struct XML_SCREEN_S XML_SCREEN_S; typedef struct XML_ELEMENT_TEXT_S XML_ELEMENT_TEXT_S; typedef struct XML_ELEMENT_IMAGE_S XML_ELEMENT_IMAGE_S; typedef struct XML_ELEMENT_NAV_S XML_ELEMENT_NAV_S; +typedef struct XML_ELEMENT_CLICK_S XML_ELEMENT_CLICK_S; typedef struct XML_ELEMENT_S XML_ELEMENT_S; typedef struct XML_GRAPHICS_S XML_GRAPHICS_S; @@ -214,6 +215,11 @@ struct XML_ELEMENT_NAV_S { char *down; }; +struct XML_ELEMENT_CLICK_S { + char *name; + char *data; +}; + struct XML_ELEMENT_S { char *name; char *groupName; @@ -235,8 +241,9 @@ struct XML_ELEMENT_S { XML_ELEMENT_TEXT_S *text; XML_ELEMENT_IMAGE_S *image; XML_ELEMENT_NAV_S *nav; - - char *clickHandlerName; + + uint32_t nbClickHandlers; + XML_ELEMENT_CLICK_S *clickHandlers; }; struct XML_GRAPHICS_S { diff --git a/inc/core/XmlDefines.h b/inc/core/XmlDefines.h index 8e6bb23..939ed7f 100755 --- a/inc/core/XmlDefines.h +++ b/inc/core/XmlDefines.h @@ -61,6 +61,8 @@ extern "C" { #define XML_TAG_CONFIG "Config" #define XML_TAG_TEXT "Text" #define XML_TAG_NAV "Nav" +#define XML_TAG_ON_CLICK "OnClick" +#define XML_TAG_HANDLER "Handler" #define XML_TAG_FOCUS "Focus" #define XML_TAG_BLUR "Blur" #define XML_TAG_RESET "Reset" @@ -112,7 +114,7 @@ extern "C" { #define XML_ATTR_CLICKABLE "clickable" #define XML_ATTR_FOCUSABLE "focusable" #define XML_ATTR_HAS_FOCUS "hasFocus" -#define XML_ATTR_ON_CLICK "onClick" +#define XML_ATTR_DATA "data" #define XML_ATTR_SIZE "size" #define XML_ATTR_LEFT "left" #define XML_ATTR_UP "up" diff --git a/inc/graphics/Graphics.h b/inc/graphics/Graphics.h index 95c47e3..64ed652 100755 --- a/inc/graphics/Graphics.h +++ b/inc/graphics/Graphics.h @@ -80,7 +80,8 @@ enum GRAPHICS_ERROR_E { GRAPHICS_ERROR_UNINIT, GRAPHICS_ERROR_LOCK, GRAPHICS_ERROR_LIST, - GRAPHICS_ERROR_DRAWER + GRAPHICS_ERROR_DRAWER, + GRAPHICS_ERROR_PARAMS }; struct GRAPHICS_PARAMS_S { diff --git a/inc/specific/Specific.h b/inc/specific/Specific.h index 58a84a3..36b11a7 100644 --- a/inc/specific/Specific.h +++ b/inc/specific/Specific.h @@ -47,6 +47,7 @@ extern "C" { typedef enum SPECIFIC_ERROR_E SPECIFIC_ERROR_E; +typedef struct SPECIFIC_HANDLERS_S SPECIFIC_HANDLERS_S; typedef struct SPECIFIC_GETTERS_S SPECIFIC_GETTERS_S; typedef struct SPECIFIC_TEXT_IDS_S SPECIFIC_TEXT_IDS_S; typedef struct SPECIFIC_IMAGE_IDS_S SPECIFIC_IMAGE_IDS_S; @@ -72,8 +73,8 @@ typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_ELEMENT_TEXT_IDS_F)(SPECIFIC_S *obj, v typedef SPECIFIC_ERROR_E (*SPECIFIC_SET_ELEMENT_IMAGE_IDS_F )(SPECIFIC_S *obj, void *data, SPECIFIC_IMAGE_IDS_S *imageIds); typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_ELEMENT_IMAGE_IDS_F)(SPECIFIC_S *obj, void *data); -typedef SPECIFIC_ERROR_E (*SPECIFIC_SET_CLICK_HANDLER_F )(SPECIFIC_S *obj, void *data, char *clickHandlerName, uint32_t index); -typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_CLICK_HANDLER_F)(SPECIFIC_S *obj, void *data); +typedef SPECIFIC_ERROR_E (*SPECIFIC_SET_CLICK_HANDLERS_F )(SPECIFIC_S *obj, void *data, SPECIFIC_HANDLERS_S *handlers, uint32_t nbHandlers, uint32_t index); +typedef SPECIFIC_ERROR_E (*SPECIFIC_UNSET_CLICK_HANDLERS_F)(SPECIFIC_S *obj, void *data); typedef SPECIFIC_ERROR_E (*SPECIFIC_HANDLE_CLICK_F)(CONTEXT_S *ctx, GFX_EVENT_S *gfxEvent); @@ -84,6 +85,11 @@ enum SPECIFIC_ERROR_E { SPECIFIC_ERROR_PARAMS }; +struct SPECIFIC_HANDLERS_S { + char *name; + char *data; +}; + struct SPECIFIC_GETTERS_S { SPECIFIC_GET_STRING_F getString; SPECIFIC_GET_COLOR_F getColor; @@ -120,8 +126,8 @@ struct SPECIFIC_S { SPECIFIC_SET_ELEMENT_IMAGE_IDS_F setElementImageIds; SPECIFIC_UNSET_ELEMENT_IMAGE_IDS_F unsetElementImageIds; - SPECIFIC_SET_CLICK_HANDLER_F setClickHandler; - SPECIFIC_UNSET_CLICK_HANDLER_F unsetClickHandler; + SPECIFIC_SET_CLICK_HANDLERS_F setClickHandlers; + SPECIFIC_UNSET_CLICK_HANDLERS_F unsetClickHandlers; SPECIFIC_HANDLE_CLICK_F handleClick; diff --git a/res/Main.xml b/res/Main.xml index 627980e..f4429b5 100755 --- a/res/Main.xml +++ b/res/Main.xml @@ -33,12 +33,12 @@ Note: Attribute timeout_s="" is ignored if method is not Timer_based. --> - + - + - + - +