From 1dbf862fed8227552d3abc5c4175c5f9971fdb72 Mon Sep 17 00:00:00 2001 From: "h2.seo" Date: Thu, 11 Apr 2013 15:06:41 +0900 Subject: add appcontrol option - switch key Change-Id: I2a89a09a44c7671a21380d2c644edb8f009c14a4 --- include/cam.h | 1 + include/cam_property.h | 1 + src/cam_app.c | 26 +++++++++++++++++++++----- src/cam_menu_composer.c | 9 +++++++++ src/edc-callback/cam_toolbar_edc_callback.c | 10 ++-------- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/include/cam.h b/include/cam.h index 096aa48..5ff9058 100755 --- a/include/cam.h +++ b/include/cam.h @@ -111,6 +111,7 @@ #define SERVICE_MIME_TYPE_IMAGE_2 "image/jpeg" #define SERVICE_MIME_TYPE_VIDEO_1 "video/3gp" #define SERVICE_MIME_TYPE_VIDEO_2 "video/3gpp" +#define SERVICE_OPTIONAL_KEY_ALLOW_SWITCH "http://tizen.org/appcontrol/data/camera/allow_switch" #define DEFAULT_WIN_ANGLE (270) diff --git a/include/cam_property.h b/include/cam_property.h index d7bb9b1..38cf3e7 100755 --- a/include/cam_property.h +++ b/include/cam_property.h @@ -266,6 +266,7 @@ struct _cam_exe_args { int height; int size_limit; gboolean review; + gboolean allow_switch; char *caller; }; diff --git a/src/cam_app.c b/src/cam_app.c index e89705a..4d927ea 100755 --- a/src/cam_app.c +++ b/src/cam_app.c @@ -8051,24 +8051,39 @@ gboolean cam_app_parse_args(CamExeArgs *args, service_h service) return FALSE; } + /* mime type */ if (ad->service_mime != NULL) { - /* get mode */ if ((strcmp(ad->service_mime, SERVICE_MIME_TYPE_IMAGE_1) == 0) || (strcmp(ad->service_mime, SERVICE_MIME_TYPE_IMAGE_2) == 0)) { - cam_debug(LOG_UI, "CAM_CAMERA_MODE"); args->cam_mode = CAM_CAMERA_MODE; } else if ((strcmp(ad->service_mime, SERVICE_MIME_TYPE_VIDEO_1) == 0) || (strcmp(ad->service_mime, SERVICE_MIME_TYPE_VIDEO_2) == 0)) { - cam_debug(LOG_UI, "CAM_CAMCORDER_MODE"); args->cam_mode = CAM_CAMCORDER_MODE; } else { - cam_critical(LOG_UI, "Invalid mime type"); + cam_critical(LOG_UI, "invalid mime type"); args->cam_mode = CAM_CAMERA_MODE; } + } else { + cam_critical(LOG_UI, "service mime is NULL"); + args->cam_mode = CAM_CAMERA_MODE; } + /* allow switch */ const char *val = NULL; + service_get_extra_data(service, "SERVICE_OPTIONAL_KEY_ALLOW_SWITCH", (char **)&val); + if (val) { + if (0 == strcmp(val, "true")) { + args->allow_switch = TRUE; + args->cam_mode = CAM_CAMERA_MODE; + } else { + args->allow_switch = FALSE; + } + } else { + args->allow_switch = FALSE; + } + /* get caller appl. */ + val = NULL; service_get_extra_data(service, "CALLER", (char **)&val); if (val) { cam_debug(LOG_UI, "CALLER %s", val); @@ -8113,7 +8128,7 @@ gboolean cam_app_parse_args(CamExeArgs *args, service_h service) cam_debug(LOG_UI, "LIMIT %s", val); args->size_limit = atoi(val); } else { - args->size_limit = 0; + args->size_limit = REC_SIZE_LIMIT_DEFAULT; } args->review = TRUE; @@ -8126,6 +8141,7 @@ gboolean cam_app_parse_args(CamExeArgs *args, service_h service) cam_debug(LOG_SYS, "height =%d", args->height); cam_debug(LOG_SYS, "limit =%d", args->size_limit); cam_debug(LOG_SYS, "review =%d", args->review); + cam_debug(LOG_SYS, "allow_switch =%d", args->allow_switch); cam_debug(LOG_SYS, "############### end ###############"); return TRUE; diff --git a/src/cam_menu_composer.c b/src/cam_menu_composer.c index 8893ec6..26fe5c9 100755 --- a/src/cam_menu_composer.c +++ b/src/cam_menu_composer.c @@ -868,6 +868,11 @@ static gboolean __is_enabled_shooting_mode(void* data) if(!(capacity & CAM_CP_FUNC_SHOT_MODE)) return FALSE; + if (ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL + && ad->exe_args->allow_switch == FALSE + && camapp->camera_mode == CAM_CAMCORDER_MODE) + return FALSE; + return TRUE; } @@ -879,6 +884,7 @@ static gboolean __is_enabled_recording_mode(void* data) cam_retvm_if(camapp == NULL, FALSE, "camapp_handle is NULL"); if(ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL + && ad->exe_args->allow_switch == FALSE && camapp->camera_mode == CAM_CAMERA_MODE) return FALSE; @@ -903,6 +909,7 @@ static gboolean __is_enabled_scene_mode(void* data) return FALSE; if(ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL + && ad->exe_args->allow_switch == FALSE && camapp->camera_mode == CAM_CAMCORDER_MODE) return FALSE; @@ -995,6 +1002,7 @@ static gboolean __is_enabled_photo_resolution(void* data) GetCamDevFuncCaps(&capacity, (void*)ad); if(ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL + && ad->exe_args->allow_switch == FALSE && camapp->camera_mode == CAM_CAMCORDER_MODE) return FALSE; @@ -1018,6 +1026,7 @@ static gboolean __is_enabled_video_resolution(void* data) return FALSE; if(ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL + && ad->exe_args->allow_switch == FALSE && camapp->camera_mode == CAM_CAMERA_MODE) return FALSE; diff --git a/src/edc-callback/cam_toolbar_edc_callback.c b/src/edc-callback/cam_toolbar_edc_callback.c index 79ad5c0..d5c7eb0 100644 --- a/src/edc-callback/cam_toolbar_edc_callback.c +++ b/src/edc-callback/cam_toolbar_edc_callback.c @@ -559,12 +559,6 @@ void cam_toolbar_recording_button_cb(void *data, Evas_Object *o, int mm_state = cam_mm_get_state(); - if ((camapp->camera_mode == CAM_CAMERA_MODE) - && (ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL)) { - cam_debug(LOG_UI, "do not record"); - return; - } - if (strcmp(emission, "press_shutter_sig") == 0) { if ((camapp->camera_mode == CAM_CAMCORDER_MODE) && (mm_state == RECORDER_STATE_RECORDING)) edje_object_signal_emit(_EDJ(ad->recordingbtn), "recording_pause_button,press", "prog"); @@ -2331,7 +2325,7 @@ void cam_toolbar_update(struct appdata *ad) case CAM_SELF_SINGLE_MODE: __toolbar_bg_update(ad, TOOLBAR_ITEM_STATE_NORMAL); - if(ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL){ + if((ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL) && (ad->exe_args->allow_switch == FALSE)){ __toolbar_menu_item_update(ad, TOOLBAR_ITEM_STATE_NORMAL); __toolbar_shutter_button_update(ad, TOOLBAR_ITEM_STATE_NORMAL); __toolbar_recording_button_update(ad, TOOLBAR_ITEM_STATE_DIM); @@ -2387,7 +2381,7 @@ void cam_toolbar_update(struct appdata *ad) __toolbar_bg_update(ad, TOOLBAR_ITEM_STATE_NORMAL); __toolbar_menu_item_update(ad, TOOLBAR_ITEM_STATE_NORMAL); - if(ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL){ + if((ad->launching_mode == CAM_LAUNCHING_MODE_EXTERNAL) && (ad->exe_args->allow_switch == FALSE)){ __toolbar_shutter_button_update(ad, TOOLBAR_ITEM_STATE_DIM); } else { __toolbar_shutter_button_update(ad, TOOLBAR_ITEM_STATE_NORMAL); -- cgit v1.2.3