summaryrefslogtreecommitdiff
path: root/main/src/view/ivug-setas-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/view/ivug-setas-view.c')
-rwxr-xr-xmain/src/view/ivug-setas-view.c1013
1 files changed, 436 insertions, 577 deletions
diff --git a/main/src/view/ivug-setas-view.c b/main/src/view/ivug-setas-view.c
index 836478b..54b80f4 100755
--- a/main/src/view/ivug-setas-view.c
+++ b/main/src/view/ivug-setas-view.c
@@ -1,23 +1,21 @@
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include <ui-gadget-module.h>
#include <Evas.h>
-#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -26,20 +24,23 @@
#include "ivug-common.h"
#include "ivug-parameter.h"
-#include "ivug-popup.h"
#include "ivug-ext-ug.h"
-#include "ivug-widget.h"
-#include "ivug-main.h"
-
#include "ivug-setas-view.h"
-#include "ivug-slider.h"
+#include "ivug-setas-view-wallpaper.h"
+#include "ivug-setas-view-callerid.h"
+#include "ivug-setas.h"
+
+
#include "ivug-listpopup.h"
-/*
- Used for storing cropped image.
-*/
-#define IVUG_HOME_SCREEN_TEMP_PATH DATA_PATH"/.homescreen_tmp.jpg";
-#define IVUG_LOCK_SCREEN_TEMP_PATH DATA_PATH"/.lockscreen_tmp.jpg";
+
+#define EDJ_PATH PREFIX"/res/edje/"PACKAGE
+
+#define TRANSITION_EFFECT
+
+#define IVUG_RESULT_BUNDLE_KEY_ERROR "Error"
+#define IVUG_RESULT_BUNDLE_VALUE_NOT_SUPPORTED "not_supported_file_type"
+
/*
Final image path
@@ -48,212 +49,145 @@
#define IVUG_LOCK_SCREEN_PATH DATA_PATH"/.lockscreen.jpg";
/*
- Image displays when incomming call is recevied.
+ Screen path for APPSVC
*/
+#define IVUG_APPSVC_HOME_SCREEN_PATH DATA_PATH"/.iv_homescreen.jpg";
-#define IVUG_RESULT_BUNDLE_KEY_ERROR "Error"
-#define IVUG_RESULT_BUNDLE_VALUE_NOT_SUPPORTED "not_supported_file_type"
-
-#define CLICK_TIME_MAX (500) // click time.
-#define CLICK_WIDTH_MIN (elm_config_finger_size_get() >> 1) //click width, if mouse move under this value and under click time, it is click.
-#define CLICK_INTERVAL_TIME 0.15
-#define SETAS_EDJ_FILE EDJ_PATH"/ivug-setas.edj"
+/*
+ Caller ID image
+*/
+#define SET_AS_CALL_ID_PATH DATA_PATH"/.callerid.jpg"
-#define IVUG_RESPONSE_OK (1)
+#define SET_AS_VIDEO_CALL_ID_PATH DATA_PATH"/.videocallid.jpg"
-#define TRANSITION_EFFECT
+/*
+ Image displays when incomming call is recevied.
+*/
+#define SET_AS_CALL_ID_LCD_PATH DATA_PATH"/.callerid_lcd.jpg"
//set as
enum {
IVUG_SET_AS_TYPE_HOME = 0x00,
IVUG_SET_AS_TYPE_LOCK,
IVUG_SET_AS_TYPE_BOTH,
+ IVUG_SET_AS_TYPE_CALLER_ID,
IVUG_SET_AS_TYPE_MAX,
};
-static void
-_ivug_setas_on_icon_set_clicked(void *data, Evas_Object* obj, const char *emission, const char *source );
-/*********************************Common Part**************************************/
+static void _OnOK(Ivug_SetAsView *pSetAsView);
+static void _OnCancel(Ivug_SetAsView *pSetAsView);
+static Evas_Object*_show_exit_popup( Evas_Object *parent, const char *title, const char *desc, void *data);
+static void _send_result(ui_gadget_h ug, const char *key1, const char *val1, const char *key2, const char *val2);
-static void
-_setas_ug_view_deleted(void * data, Evas * e, Evas_Object * obj, void * event_info)
-{
- char *szView = (char *)data;
-
- MSG_SETAS_WARN("%s is destroyed", szView);
- return;
-}
static void
-_ivug_setas_view_remove(Ivug_SetAsView *pSetAsView)
+_on_msg_load_failed(void *data, Evas_Object *obj, void *event_info)
{
- MSG_SETAS_HIGH("Start destroy ug");
- ug_destroy_me(gGetUGHandle());
- return;
-}
-
-static void
-_ivug_setas_view_show_icons(Evas_Object *layout)
-{
- ivug_retm_if(!layout, "pSetAsView->layout is NULL");
-
- elm_win_indicator_mode_set(ug_get_window(), ELM_WIN_INDICATOR_SHOW);
-
- edje_object_signal_emit(_EDJ(layout),
- "setasview,show,btn_cancel","elm");
-
- edje_object_signal_emit(_EDJ(layout),
- "setasview,show,btn_ok","elm");
-}
-
-static void
-_ivug_setas_view_hide_icons(Evas_Object *layout)
-{
- ivug_retm_if(!layout, "pSetAsView->layout is NULL");
-
- elm_win_indicator_mode_set(ug_get_window(), ELM_WIN_INDICATOR_HIDE);
-
- edje_object_signal_emit(_EDJ(layout),
- "setasview,hide,btn_cancel","elm");
+ Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
- edje_object_signal_emit(_EDJ(layout),
- "setasview,hide,btn_ok","elm");
-}
+ SetAs_Error error = (SetAs_Error)event_info;
-static void
-_ivug_setas_view_unregister_set_signal(Evas_Object *layout, void (*func) (void *data, Evas_Object *obj, const char *emission, const char *source))
-{
- ivug_retm_if(!layout, "pSetAsView->layout is NULL");
+ const char *szMsg = NULL;
- edje_object_signal_callback_del(_EDJ(layout),
- "setasview,set,clicked",
- "",
- func);
-}
-
-static Eina_Bool
-_ivug_setas_view_click_cb(void *data)
-{
- Ivug_SetAsView *setas_data = (Ivug_SetAsView *)data;
- if (setas_data->click_timer)
+ switch(error)
{
- ecore_timer_del(setas_data->click_timer);
- setas_data->click_timer = NULL;
+ case SETAS_ERROR_TYPE_INVALID_FILE:
+ szMsg = IDS_INVALID_IMAGE_FILE;
+ break;
+ case SETAS_ERROR_TYPE_PERMISSION_DENIED:
+ szMsg = IDS_PERMISSION_DENIED;
+ break;
+ case SETAS_ERROR_TYPE_UNKNOWN_FORMAT:
+ szMsg = "Unknown format";
+ break;
+ case SETAS_ERROR_TYPE_GENERAL:
+ default:
+ szMsg = IDS_FAILED;
+ break;
}
- setas_data->b_hide_bar_flag = !(setas_data->b_hide_bar_flag);
+ MSG_SETAS_ERROR("Load failed : %s", szMsg);
- MSG_SETAS_HIGH("Bar flag is %d", setas_data->b_hide_bar_flag);
- if(setas_data->b_hide_bar_flag)
- {
- _ivug_setas_view_hide_icons(setas_data->layout);
- }
- else
+ _show_exit_popup(obj, IDS_ERROR, szMsg, (void *)pSetAsView );
+
+ if ( pSetAsView->Mode == IVUG_SETAS_UG )
{
- _ivug_setas_view_show_icons(setas_data->layout);
+ MSG_SETAS_ERROR("Send error message to ug caller app");
+ _send_result(gGetUGHandle(), IVUG_RESULT_BUNDLE_KEY_ERROR, IVUG_RESULT_BUNDLE_VALUE_NOT_SUPPORTED, NULL, NULL);
}
-
- return ECORE_CALLBACK_CANCEL;
}
static void
-_ivug_setas_view_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+_on_msg_ok_clicked(void *data, Evas_Object *obj, void *event_info)
{
+ MSG_SETAS_HIGH("ok clicked");
- Ivug_SetAsView *setas_data = (Ivug_SetAsView *)data;
- Evas_Event_Mouse_Down *ev = event_info;
-
- MSG_SETAS_HIGH("Mouse down!");
- ivug_ret_if(!data);
-
- setas_data->down_pos.x = ev->canvas.x;
- setas_data->down_pos.y = ev->canvas.y;
- setas_data->timestamp = ev->timestamp;
+ Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
- if (setas_data->click_timer)
- {
- ecore_timer_del(setas_data->click_timer);
- setas_data->click_timer = NULL;
- }
+ _OnOK(pSetAsView);
}
+
static void
-_ivug_setas_view_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+_on_msg_cancel_clicked(void *data, Evas_Object *obj, void *event_info)
{
- Ivug_SetAsView *setas_data = (Ivug_SetAsView *)data;
- Evas_Event_Mouse_Up *ev = event_info;
- int step;
- unsigned int interval_time;
-
- MSG_SETAS_HIGH("Mouse up!");
- ivug_ret_if(!data);
+ MSG_SETAS_HIGH("cancel clicked");
- step = setas_data->down_pos.x - ev->canvas.x;
- interval_time = ev->timestamp - setas_data->timestamp;
+ Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
- if(ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- {
- MSG_SETAS_HIGH("double clicked");
- return;
- }
- if ((step < CLICK_WIDTH_MIN && step > -CLICK_WIDTH_MIN) && (interval_time < CLICK_TIME_MAX && interval_time > 0) )
- {
- MSG_SETAS_HIGH("clicked");
- setas_data->click_timer = ecore_timer_add(CLICK_INTERVAL_TIME, _ivug_setas_view_click_cb , data);
- return ;
- }
+ _OnCancel(pSetAsView);
}
-/********************************* Common Function **************************************/
+
static void
-_ivug_setas_view_send_result(struct ui_gadget *ug, const char *key1, const char *val1, const char *key2, const char *val2)
+_ivug_setas_view_remove(Ivug_SetAsView *pSetAsView)
{
- ivug_ret_if(!ug);
+ IV_ASSERT(pSetAsView != NULL);
- bundle *b;
- b = bundle_create();
- if(key1 && val1)
+#if 0
+ if(pSetAsView->select_box)
{
- MSG_SETAS_HIGH("Bundle 1 : [%s = %s]", key1, val1);
- bundle_add(b, key1, val1);
+ evas_object_del(pSetAsView->select_box);
+ pSetAsView->select_box = NULL;
}
+#endif
- if(key2 && val2)
+ if(pSetAsView->Mode == IVUG_SETAS_UG || pSetAsView->Mode == IVUG_SETAS_APPSVC)
{
- MSG_SETAS_HIGH("Bundle 2 : [%s = %s]", key2, val2);
- bundle_add(b, key2, val2);
+ MSG_SETAS_HIGH("Start destroy ug");
+ ug_destroy_me(gGetUGHandle());
+ return;
}
- ug_send_result(ug, b);
- bundle_free(b);
-}
+ MSG_SETAS_HIGH( "destroy data");
+
+#ifdef TRANSITION_EFFECT
+ edje_object_signal_emit(_EDJ(pSetAsView->ly_effect), "elm,state,hide", "app");
+#else
+ ivug_setas_view_destroy(pSetAsView);
+#endif
+}
static void
_ivug_setas_view_response_cb( void *data, Evas_Object *obj, void *event_info )
{
MSG_SETAS_HIGH( "response callback=%d",(int)event_info);
+// Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *)data;
- evas_object_hide(obj);
+ evas_object_hide(obj); // popup
evas_object_del(obj);
- ivug_retm_if(!data, "data is NULL");
-
_ivug_setas_view_remove((Ivug_SetAsView *)data);
}
-/**
-* @brief
-*
-* @param title
-* @param txt_noti
-*/
+
static Evas_Object*
-_ivug_setas_view_show_exit_popup( Evas_Object *parent, const char *title, const char *desc, void *data)
+_show_exit_popup( Evas_Object *parent, const char *title, const char *desc, void *data)
{
MSG_SETAS_HIGH( "title: %s, desc %s", title, desc);
@@ -262,339 +196,283 @@ _ivug_setas_view_show_exit_popup( Evas_Object *parent, const char *title, const
elm_popup_timeout_set(style1_popup, (double)2.0);
elm_object_text_set(style1_popup, desc);
elm_object_part_text_set(style1_popup, "title,text", title);
+
evas_object_smart_callback_add(style1_popup, "timeout", _ivug_setas_view_response_cb, data);
+
evas_object_show(style1_popup);
evas_object_layer_set(style1_popup, EVAS_LAYER_MAX);
return style1_popup;
}
-static Eina_Bool _ivug_setas_view_resize_save(Evas_Object *org, const char *filepath, int w, int h)
+static void
+_send_result(ui_gadget_h ug, const char *key1, const char *val1, const char *key2, const char *val2)
{
- IV_ASSERT(org != NULL);
- IV_ASSERT(filepath != NULL);
+ ivug_ret_if(!ug);
- if(w <= 0 || h <= 0)
+ service_h service;
+ service_create(&service);
+ if(key1 && val1)
{
- MSG_SETAS_ERROR("input size parameter is invalid, w = %d, h = %d", w, h);
- return EINA_FALSE;
+ MSG_SETAS_HIGH("Bundle 1 : [%s = %s]", key1, val1);
+ service_add_extra_data(service, key1, val1);
}
- int img_w = 0;
- int img_h = 0;
-
- evas_object_image_size_get(org, &img_w, &img_h);
- MSG_SETAS_LOW("img_w = %d, img_h = %d", img_w, img_h);
- MSG_SETAS_LOW("w = %d, h = %d", w, h);
-
- char *ImgBuffer = evas_object_image_data_get(org, EINA_FALSE);
-
- Ecore_Evas *ee;
- Evas *evas;
-
- ee = ecore_evas_buffer_new(w, h);
- IV_ASSERT(ee != NULL);
- evas = ecore_evas_get(ee);
- IV_ASSERT(evas != NULL);
-
- Evas_Object *input;
- input = evas_object_image_filled_add(evas);
- IV_ASSERT(input != NULL);
-
- evas_object_image_size_set(input, img_w, img_h);
- evas_object_image_data_set(input, ImgBuffer);
- evas_object_image_smooth_scale_set(input, EINA_TRUE);
- evas_object_move(input, 0, 0);
- evas_object_resize(input, w, h);
-
- evas_object_show(input);
- evas_object_image_data_update_add(input, 0, 0, w, h);
-
- Ecore_Evas *ee_dest;
- Evas *evas_dest;
+ if(key2 && val2)
+ {
+ MSG_SETAS_HIGH("Bundle 2 : [%s = %s]", key2, val2);
+ service_add_extra_data(service, key2, val2);
+ }
- ee_dest = ecore_evas_buffer_new(1, 1);
- IV_ASSERT(ee_dest != NULL);
- evas_dest = ecore_evas_get(ee_dest);
- IV_ASSERT(evas_dest != NULL);
+ ug_send_result(ug, service);
+ service_destroy(service);
+}
- Evas_Object *output;
- output = evas_object_image_filled_add(evas_dest);
- IV_ASSERT(output != NULL);
- void *data = NULL;
- data = (void*)ecore_evas_buffer_pixels_get(ee);
- IV_ASSERT(data != NULL);
- evas_object_image_size_set(output, w, h);
- evas_object_image_data_set(output, data);
+static void _on_setas_homescreen(Ivug_SetAsView *pSetAsView)
+{
+ const char *homescreen_path = NULL;
- if (evas_object_image_save(output, filepath, NULL, NULL) == EINA_FALSE)
+ if(pSetAsView->Mode != IVUG_SETAS_APPSVC)
{
- MSG_SETAS_ERROR("evas_object_image_save error. %s", filepath);
- evas_object_del(input);
- evas_object_del(output);
- return EINA_FALSE;
+ homescreen_path = IVUG_HOME_SCREEN_PATH;
}
else
{
- int fd = open(filepath, O_RDONLY);
- if(fd < 0)
- {
- MSG_SETAS_ERROR("%s open error[%d]", filepath, fd);
- evas_object_del(input);
- evas_object_del(output);
- return EINA_FALSE;
- }
- fsync(fd);
- int ret = close(fd);
- if(ret < 0)
- {
- MSG_SETAS_ERROR("%s open error[%d]", filepath, ret);
- }
+ homescreen_path = IVUG_APPSVC_HOME_SCREEN_PATH;
}
- evas_object_del(input);
- evas_object_del(output);
- return EINA_TRUE;
-}
-static Eina_Bool
-_ivug_setas_view_screen_create_file(Ivug_SetAsView *pSetAsView, char* screen_file)
- {
-// Delete the home screen file if exist
- if (ivug_remove_file(screen_file) == false)
- {
- MSG_SETAS_ERROR( "Detele file %s failed", screen_file);
- return EINA_FALSE;
- }
+// Save to Image
+ Evas_Coord_Rectangle box_rect;
+ evas_object_geometry_get(pSetAsView->content, &(box_rect.x), &(box_rect.y), &(box_rect.w), &(box_rect.h) );
- int x = 0;
- int y = 0;
- int w = 0;
- int h = 0;
+ MSG_SETAS_HIGH("Rect XYWH(%d,%d,%d,%d)", box_rect.x, box_rect.y, box_rect.w , box_rect.h);
- Evas *canvas;
- Ecore_Evas *ee;
- ee = ecore_evas_buffer_new(1, 1);
- if (!ee)
+ Eina_Bool ret = EINA_FALSE;
+
+ ret = _ivug_setas_save_home_screen(_ivug_setas_internal_image_get( pSetAsView->content) ,&box_rect,homescreen_path);
+
+ if ( ret == false )
{
- MSG_DETAIL_ERROR("Cannot get EVAS");
- return EINA_FALSE;
+ MSG_SETAS_ERROR("Error occured. when setAS. %s", homescreen_path);
}
- canvas = ecore_evas_get(ee);
- Evas_Object *img = evas_object_image_add(canvas);
- evas_object_image_file_set(img, NULL, NULL);
- evas_object_image_load_orientation_set(img, EINA_TRUE);
- evas_object_image_load_scale_down_set(img, 0);
-
- evas_object_image_file_set(img, pSetAsView->file_path, NULL);
- Evas_Load_Error error = evas_object_image_load_error_get(img);
- if ( error != EVAS_LOAD_ERROR_NONE)
+ if(pSetAsView->Mode != IVUG_SETAS_APPSVC)
{
- MSG_SETAS_ERROR("Decoding Error(%d) : %s", error, pSetAsView->file_path);
- evas_object_image_file_set(img, NULL, NULL);
- evas_object_del(img);
- ecore_evas_free(ee);
- return EINA_FALSE;
+ ret = ivug_config_set_homescreen_image(homescreen_path);
}
- elm_photocam_image_region_get(pSetAsView->photocam, &x, &y, &w, &h);
- double zoom = elm_photocam_zoom_get(pSetAsView->photocam);
- if(zoom != 0.0)
+ if(ret == true)
{
- w = w/zoom;
- h = h/zoom;
+ _show_exit_popup(pSetAsView->content, IDS_HOME_SCREEN_WALLPAPER, IDS_SUCCESS, (void *)pSetAsView );
+ _send_result(gGetUGHandle(), "homescreen_path", homescreen_path, NULL, NULL);
+
+ MSG_SETAS_HIGH("Set Home screen: %s", homescreen_path);
}
- MSG_SETAS_HIGH("w = %d, h = %d", w, h);
- if(_ivug_setas_view_resize_save(img, screen_file, w, h) == EINA_FALSE)
+ else
{
- MSG_SETAS_ERROR("setas image save faied.");
- evas_object_image_file_set(img, NULL, NULL);
- evas_object_del(img);
- ecore_evas_free(ee);
- return EINA_FALSE;
+ _show_exit_popup(pSetAsView->content, IDS_HOME_SCREEN_WALLPAPER, IDS_FAILED, (void *)pSetAsView );
}
- evas_object_image_file_set(img, NULL, NULL);
- evas_object_del(img);
- ecore_evas_free(ee);
- return EINA_TRUE;
}
-static void
-_ivug_setas_on_change_home_screen(void *data, Evas_Object *obj, void *event_info)
+static void _on_setas_lockscreen(Ivug_SetAsView *pSetAsView)
{
- IV_ASSERT(data != NULL);
+ MSG_SETAS_HIGH("Change Lock Screen");
- MSG_SETAS_HIGH("Change Home Screen");
+ char* lockscreen_path = IVUG_LOCK_SCREEN_PATH;
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
+// Save to Image
+ Evas_Coord_Rectangle box_rect;
+ evas_object_geometry_get(pSetAsView->content, &(box_rect.x), &(box_rect.y), &(box_rect.w), &(box_rect.h) );
-// TODO : Remove dependancy
- char* homescreen_path = IVUG_HOME_SCREEN_PATH;
+ MSG_SETAS_HIGH("Rect XYWH(%d,%d,%d,%d)", box_rect.x, box_rect.y, box_rect.w , box_rect.h);
Eina_Bool ret = EINA_FALSE;
- if((ret = _ivug_setas_view_screen_create_file(pSetAsView, homescreen_path)) == EINA_FALSE)
- {
- MSG_SETAS_ERROR( "Create screen file failed");
- goto end;
- }
+ ret = _ivug_setas_save_lock_screen(_ivug_setas_internal_image_get( pSetAsView->content) ,&box_rect, lockscreen_path);
- if( (ret = ivug_config_set_homescreen_image(homescreen_path)) == EINA_TRUE)
+ if ( ret == false )
{
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_HOME_SCREEN_WALLPAPER, IDS_SUCCESS, pSetAsView);
+ MSG_SETAS_ERROR("Error occured. when setAS. %s", lockscreen_path);
}
- else
+
+ //Set the lock screen
+ if(pSetAsView->Mode != IVUG_SETAS_APPSVC)
{
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_HOME_SCREEN_WALLPAPER, IDS_FAILED, pSetAsView);
+ ret = ivug_config_set_lockscreen_image(lockscreen_path);
}
- MSG_SETAS_HIGH("Set Home screen: %s", homescreen_path);
-end:
if(ret == EINA_TRUE)
{
- _ivug_setas_view_send_result(gGetUGHandle(), "homescreen_path", homescreen_path, NULL, NULL);
+ _show_exit_popup(pSetAsView->content, IDS_LOCK_SCREEN_WALLPAPER, IDS_SUCCESS, pSetAsView);
+ _send_result(gGetUGHandle(), "lockscreen_path", lockscreen_path, NULL, NULL);
+
+ MSG_SETAS_HIGH("Set Lock screen: %s", lockscreen_path);
+ }
+ else
+ {
+ _show_exit_popup(pSetAsView->content, IDS_LOCK_SCREEN_WALLPAPER, IDS_FAILED, pSetAsView);
}
+
}
-static void
-_ivug_setas_on_change_lock_screen(void *data, Evas_Object *obj, void *event_info)
+
+static void _on_setas_bothscreen(Ivug_SetAsView *pSetAsView)
{
- IV_ASSERT(data != NULL);
+ MSG_SETAS_HIGH("Change Home & Lock Screen");
- MSG_SETAS_HIGH("Change Lock Screen");
+// Set homescreen image
+ const char* homescreen_path = IVUG_HOME_SCREEN_PATH;
+ const char* lockscreen_path = IVUG_LOCK_SCREEN_PATH;
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
+ Evas_Coord_Rectangle box_rect;
+ evas_object_geometry_get(pSetAsView->content, &(box_rect.x), &(box_rect.y), &(box_rect.w), &(box_rect.h) );
- char* lockscreen_path = IVUG_LOCK_SCREEN_PATH;
+ MSG_SETAS_HIGH("Rect XYWH(%d,%d,%d,%d)", box_rect.x, box_rect.y, box_rect.w , box_rect.h);
Eina_Bool ret = EINA_FALSE;
- if((ret = _ivug_setas_view_screen_create_file(pSetAsView, lockscreen_path)) == EINA_FALSE)
- {
- MSG_SETAS_ERROR( "Create screen file failed");
- goto end;
- }
+ ret = _ivug_setas_save_homenlock_screen(_ivug_setas_internal_image_get( pSetAsView->content),&box_rect, homescreen_path, lockscreen_path);
- //Set the lock screen
- if((ret = ivug_config_set_lockscreen_image(lockscreen_path)) == EINA_TRUE)
+ char *title = elm_entry_utf8_to_markup(IDS_HOME_AND_LOCK_SCREENS);
+
+ ret = ivug_config_set_homescreen_image(homescreen_path);
+
+ if ( ret == false)
{
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_LOCK_SCREEN_WALLPAPER, IDS_SUCCESS, pSetAsView);
+ _show_exit_popup(pSetAsView->content, title, IDS_FAILED, pSetAsView);
}
else
{
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_LOCK_SCREEN_WALLPAPER, IDS_FAILED, pSetAsView);
+ ret = ivug_config_set_lockscreen_image(lockscreen_path);
+ if ( ret == false)
+ {
+ // TODO : Do I revet homescreen if either failed?????
+ _show_exit_popup(pSetAsView->content, title, IDS_FAILED, pSetAsView);
+ }
+ else
+ {
+ _show_exit_popup(pSetAsView->content, title, IDS_SUCCESS, pSetAsView);
+ }
+
}
- MSG_SETAS_HIGH("Set Lock screen: %s", lockscreen_path);
-end:
- if(ret == EINA_TRUE)
+ MSG_SETAS_HIGH("Set Home&Lock screen: %s %s", homescreen_path, lockscreen_path);
+ free(title);
+
+ if(pSetAsView->Mode == IVUG_SETAS_UG || pSetAsView->Mode == IVUG_SETAS_APPSVC)
{
- _ivug_setas_view_send_result(gGetUGHandle(), "lockscreen_path", lockscreen_path, NULL, NULL);
+ if(ret == EINA_TRUE)
+ {
+ _send_result(gGetUGHandle(), "homescreen_path", homescreen_path, "lockscreen_path", lockscreen_path);
+ }
}
}
-static void
-_ivug_setas_on_change_homeNlock_screen(void *data, Evas_Object *obj, void *event_info)
+
+static void _on_setas_callerid(Ivug_SetAsView *pSetAsView)
{
- IV_ASSERT(data != NULL);
+ MSG_SETAS_HIGH("Set Caller Image");
- MSG_SETAS_HIGH("Change Lock Screen");
+// Save to Image
+ Evas_Coord_Rectangle box_rect;
+ evas_object_geometry_get(pSetAsView->content, &(box_rect.x), &(box_rect.y), &(box_rect.w), &(box_rect.h) );
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
+ MSG_SETAS_HIGH("Rect XYWH(%d,%d,%d,%d)", box_rect.x, box_rect.y, box_rect.w , box_rect.h);
-// Set homescreen image
- char* homescreen_path = IVUG_HOME_SCREEN_PATH;
+// LCD Image
+ Evas_Object *image = NULL;
- char* lockscreen_path = IVUG_LOCK_SCREEN_PATH;
+ image = _ivug_setas_callerid_internal_image_get( pSetAsView->content);
Eina_Bool ret = EINA_FALSE;
- if((ret = _ivug_setas_view_screen_create_file(pSetAsView, homescreen_path)) == EINA_FALSE)
+ char *title = elm_entry_utf8_to_markup(IDS_CALLER_IMAGE);
+
+ ret = _ivug_setas_save_cropimage(image, &box_rect, SET_AS_CALL_ID_LCD_PATH);
+ if ( ret == false )
{
- MSG_SETAS_ERROR( "Create screen file failed");
- goto end;
+ MSG_SETAS_ERROR("Error occured. when setAS1. %s", SET_AS_CALL_ID_LCD_PATH);
+ _show_exit_popup(pSetAsView->content, title, IDS_FAILED, pSetAsView);
+ free(title);
+ return;
}
- char* temp_lock_path = IVUG_LOCK_SCREEN_TEMP_PATH;
- if (ivug_remove_file(temp_lock_path) == false)
+// Cropped Image
+ _ivug_setas_callerid_select_region_get(pSetAsView->content, &(box_rect.x), &(box_rect.y), &(box_rect.w), &(box_rect.h));
+
+ MSG_SETAS_HIGH("Cropped rect XYWH(%d,%d,%d,%d)", box_rect.x, box_rect.y, box_rect.w , box_rect.h);
+
+ ret = _ivug_setas_save_cropimage(image ,&box_rect, SET_AS_CALL_ID_PATH);
+ if ( ret == false )
{
- MSG_SETAS_ERROR( "Detele file %s: failed", temp_lock_path);
- goto end;
+ MSG_SETAS_ERROR("Error occured. when setAS2. %s", SET_AS_CALL_ID_PATH);
+ _show_exit_popup(pSetAsView->content, title, IDS_FAILED, pSetAsView);
+ free(title);
+ return;
}
-// Make a copy from home screen to lock screen
- if((ret = ecore_file_cp(homescreen_path, temp_lock_path)) == EINA_FALSE)
+ free(title);
+
+ if(pSetAsView->Mode == IVUG_SETAS_UG || pSetAsView->Mode == IVUG_SETAS_APPSVC)
{
- MSG_SETAS_ERROR( "File copy failed");
- goto end;
+ _send_result(gGetUGHandle(), "crop_image_path", SET_AS_CALL_ID_PATH, "image_path", SET_AS_CALL_ID_LCD_PATH);
}
- else
- {
- if(ivug_rename_file(temp_lock_path, lockscreen_path) == false)
- {
- MSG_SETAS_ERROR( "Rename file %s to %s failed", temp_lock_path, lockscreen_path );
- if(ivug_remove_file(temp_lock_path)== false)
- {
- MSG_SETAS_ERROR( "delete tmp lock file failed %s", temp_lock_path);
- }
- ret = EINA_FALSE;
- goto end;
- }
- sync(); //sync copied file.
- }
+}
- char *title = elm_entry_utf8_to_markup(IDS_HOME_AND_LOCK_SCREEN_WALLPAPER);
+static void _on_setas_video_call_id(Ivug_SetAsView *pSetAsView)
+{
+ MSG_SETAS_HIGH("Set Caller Image");
- ret = ivug_config_set_homescreen_image(homescreen_path);
+// Save to Image
+ Evas_Coord_Rectangle box_rect;
- if ( ret == false)
+// LCD Image
+ Evas_Object *image = NULL;
+
+ image = _ivug_setas_callerid_internal_image_get(pSetAsView->content);
+
+ Eina_Bool ret = EINA_FALSE;
+
+ char *title = elm_entry_utf8_to_markup(IDS_CALLER_IMAGE);
+
+// Cropped Image
+ _ivug_setas_callerid_select_region_get(pSetAsView->content, &(box_rect.x), &(box_rect.y), &(box_rect.w), &(box_rect.h));
+
+ MSG_SETAS_HIGH("Cropped rect XYWH(%d,%d,%d,%d)", box_rect.x, box_rect.y, box_rect.w , box_rect.h);
+
+ ret = _ivug_setas_save_cropimage(image, &box_rect, SET_AS_VIDEO_CALL_ID_PATH);
+ if ( ret == false )
{
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, title, IDS_FAILED, pSetAsView);
+ MSG_SETAS_ERROR("Error occured. when setAS2. %s", SET_AS_VIDEO_CALL_ID_PATH);
+ _show_exit_popup(pSetAsView->content, title, IDS_FAILED, pSetAsView);
+ free(title);
+ return;
}
- else
- {
- ret = ivug_config_set_lockscreen_image(lockscreen_path);
- if ( ret == false)
- {
- // TODO : Do I revet homescreen if either failed?????
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, title, IDS_FAILED, pSetAsView);
- }
- else
- {
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, title, IDS_SUCCESS, pSetAsView);
- }
+ if(pSetAsView->Mode == IVUG_SETAS_UG || pSetAsView->Mode == IVUG_SETAS_APPSVC)
+ {
+ _send_result(gGetUGHandle(), "crop_image_path", SET_AS_VIDEO_CALL_ID_PATH, NULL, NULL);
}
- MSG_SETAS_HIGH("Set Home&Lock screen: %s %s", homescreen_path, lockscreen_path);
+ _show_exit_popup(pSetAsView->content, title, IDS_SUCCESS, pSetAsView);
+
free(title);
-end:
- if(ret == EINA_TRUE)
- {
- _ivug_setas_view_send_result(gGetUGHandle(), "homescreen_path", homescreen_path, "lockscreen_path", lockscreen_path);
- }
}
static void
-_ivug_setas_wallpaper_set_selected_cb(void *data, Evas_Object *obj, void *event_info)
+_on_type_popup_selected(void *data, Evas_Object *obj, void *event_info)
{
IV_ASSERT(data != NULL);
Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
- ivug_listpopup_item *item = event_info;
-
- edje_object_signal_callback_add(_EDJ(pSetAsView->layout),
- "setasview,set,clicked",
- "",
- _ivug_setas_on_icon_set_clicked,
- (void *)pSetAsView);
+ Ivug_ListPopup_Item *item = event_info;
if ( item == NULL ) // Cancel is selected
{
@@ -605,25 +483,24 @@ _ivug_setas_wallpaper_set_selected_cb(void *data, Evas_Object *obj, void *event_
return;
}
- MSG_SETAS_HIGH("Create SetAsView. name= %s", item->caption);
+ const char *label = ivug_listpopup_item_get_data(item);
+ MSG_SETAS_HIGH("Create SetAsView. name= %s", label);
- switch(item->index)
+ if ( strcmp(IDS_HOME_SCREEN, label) == 0 )
{
- case IVUG_SET_AS_TYPE_HOME:
- _ivug_setas_on_change_home_screen(data, NULL, NULL);
- break;
-
- case IVUG_SET_AS_TYPE_LOCK:
- _ivug_setas_on_change_lock_screen(data, NULL, NULL);
- break;
-
- case IVUG_SET_AS_TYPE_BOTH:
- _ivug_setas_on_change_homeNlock_screen(data, NULL, NULL);
- break;
-
- default:
- MSG_SETAS_ERROR("Unknown Set as type : %d", item->index);
- break;
+ _on_setas_homescreen(pSetAsView);
+ }
+ else if ( strcmp(IDS_LOCK_SCREEN, label) == 0 )
+ {
+ _on_setas_lockscreen(pSetAsView);
+ }
+ else if ( strcmp(IDS_HOME_AND_LOCK_SCREENS, label) == 0 )
+ {
+ _on_setas_bothscreen(pSetAsView);
+ }
+ else
+ {
+ MSG_SETAS_ERROR("Unknown Set as type : %s", label);
}
evas_object_del(pSetAsView->genlist_popup);
@@ -631,184 +508,209 @@ _ivug_setas_wallpaper_set_selected_cb(void *data, Evas_Object *obj, void *event_
}
-static void
-_ivug_setas_on_icon_cancel_clicked(void *data, Evas_Object* obj, const char *emission, const char *source )
+static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info)
{
- MSG_SETAS_HIGH("Cancel button clicked");
- ivug_ret_if(!data);
-
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
-
- _ivug_setas_view_remove(pSetAsView);
+ MSG_SETAS_HIGH("Popup dissmissed");
}
+
static void
-_ivug_setas_on_icon_set_clicked(void *data, Evas_Object* obj, const char *emission, const char *source )
+_OnOK(Ivug_SetAsView *pSetAsView)
{
- MSG_SETAS_HIGH("On Btn Done clicke");
- ivug_ret_if(!data);
-
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
+ MSG_SETAS_HIGH("On Btn Done clicked");
- _ivug_setas_view_unregister_set_signal(pSetAsView->layout, _ivug_setas_on_icon_set_clicked);
+ Evas_Object *obj;
- if(pSetAsView->set_type == IVUG_CTRLBAR_SET_SCREEN_UNDEFINED)
+ switch(pSetAsView->Type)
{
- // In case of setting->wallpaper
- MSG_SETAS_HIGH("Create setas wallpaper popup");
+ case IVUG_CTRLBAR_SET_SCREEN_UNDEFINED:
+ MSG_SETAS_HIGH("Create setas wallpaper popup");
+
+ obj = ivug_listpopup_add(pSetAsView->content);
+
+ evas_object_smart_callback_add(obj, "popup,dismissed", _dismissed_cb, pSetAsView);
+ evas_object_smart_callback_add(obj, "popup,selected", _on_type_popup_selected, pSetAsView);
+
+ ivug_listpopup_item_append(obj, NULL,IDS_HOME_SCREEN, IDS_HOME_SCREEN);
+ ivug_listpopup_item_append(obj, NULL,IDS_LOCK_SCREEN, IDS_LOCK_SCREEN);
+ ivug_listpopup_item_append(obj, NULL,IDS_HOME_AND_LOCK_SCREENS, IDS_HOME_AND_LOCK_SCREENS);
- ivug_listpopup_itemlist items = ivug_listpopup_itemlist_new();
+ ivug_listpopup_title_set(obj, IDS_SET_AS);
- ivug_listpopup_itemlist_add(items, IVUG_SET_AS_TYPE_HOME, NULL, IDS_HOME_SCREEN_WALLPAPER, NULL , false);
- ivug_listpopup_itemlist_add(items, IVUG_SET_AS_TYPE_LOCK, NULL, IDS_LOCK_SCREEN_WALLPAPER, NULL , false);
- ivug_listpopup_itemlist_add(items, IVUG_SET_AS_TYPE_BOTH, NULL, IDS_HOME_AND_LOCK_SCREEN_WALLPAPER, NULL , false);
+ ivug_listpopup_button_set(obj, IDS_CLOSE);
- pSetAsView->genlist_popup = ivug_listpopup_show(pSetAsView->layout, IDS_SET_AS, items, _ivug_setas_wallpaper_set_selected_cb, pSetAsView);
+ ivug_listpopup_popup_show(obj);
- ivug_listpopup_itemlist_free(items);
+ pSetAsView->genlist_popup = obj;
+
+ break;
+
+ case IVUG_CTRLBAR_SET_SCREEN_HOME:
+ _on_setas_homescreen(pSetAsView);
+ break;
+ case IVUG_CTRLBAR_SET_SCREEN_LOCK:
+ _on_setas_lockscreen(pSetAsView);
+ break;
+ case IVUG_CTRLBAR_SET_SCREEN_BOTH:
+ _on_setas_bothscreen(pSetAsView);
+ break;
+ case IVUG_CTRLBAR_SET_SCREEN_CALLERID:
+ _on_setas_callerid(pSetAsView);
+ break;
+ case IVUG_CTRLBAR_SET_SCREEN_VIDEO_CALL_ID:
+ _on_setas_video_call_id(pSetAsView);
+ break;
+ default:
+ MSG_SETAS_ERROR("Unknown Set as type : %d", pSetAsView->Type);
+ break;
}
-}
+}
static void
-_ivug_setas_on_photocam_loaded(void *data, Evas_Object *obj, void *event_info)
+_OnCancel(Ivug_SetAsView *pSetAsView)
{
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data;
+ MSG_SETAS_HIGH("On Btn cancel clicked");
- IV_ASSERT(pSetAsView != NULL);
+ _ivug_setas_view_remove(pSetAsView);
+}
- Evas_Load_Error error = (Evas_Load_Error)event_info;
+#ifdef TRANSITION_EFFECT
+static void _signal_hide_finished(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ Ivug_SetAsView *pSetAsView = data;
- if ( error != EVAS_LOAD_ERROR_NONE )
- {
- MSG_SETAS_ERROR("Error occured during decoding. Error=%d", error);
+ IV_ASSERT(pSetAsView != NULL);
-// Show popup & Exit.
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_ERROR, IDS_INVALID_IMAGE_FILE, pSetAsView );
+ MSG_SETAS_HIGH("_signal_hide_finished. pData=0x%08x", pSetAsView);
- return;
- }
+ ivug_setas_view_destroy(pSetAsView);
+}
- elm_object_part_content_set(pSetAsView->layout, "setasview.photocam", pSetAsView->photocam);
+static void _signal_show_finished(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ Ivug_SetAsView *pSetAsView = data;
- edje_object_signal_emit(_EDJ(pSetAsView->layout), "setasview,enable,btn_ok", "elm");
+ IV_ASSERT(pSetAsView != NULL);
- edje_object_signal_callback_add(_EDJ(pSetAsView->layout),
- "setasview,set,clicked",
- "",
- _ivug_setas_on_icon_set_clicked,
- (void *)pSetAsView);
+ MSG_SETAS_HIGH("_signal_show_finished. pData=0x%08x", pSetAsView);
}
-static Ivug_SetAsView *_create_setas_view(Evas_Object *parent, const char* filepath, ivug_set_screen_type screen_type)
+#endif // UG_TRANSITION_EFFECT
+
+
+
+Ivug_SetAsView *
+ivug_setas_view_screen_create(Evas_Object *parent, const char* filepath, ivug_setas_mode mode, ivug_set_screen_type screen_type)
{
- IV_ASSERT(filepath != NULL);
+ Ivug_SetAsView *pSetAsView = NULL;
- Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *)calloc(1, sizeof(Ivug_SetAsView));
+ MSG_SETAS_HIGH("Setas View creates");
- if ( pSetAsView == NULL )
- {
- MSG_SETAS_ERROR("Cannot allocate memory");
- return NULL;
- }
+ pSetAsView = (Ivug_SetAsView *)calloc(1, sizeof(Ivug_SetAsView));
- pSetAsView->file_path = strdup(filepath);
- pSetAsView->set_type = screen_type;
- pSetAsView->layout = ivug_layout_add(parent , SETAS_EDJ_FILE, "setas_view");
+ pSetAsView->Mode = mode;
+ pSetAsView->Type = screen_type;
- if ( pSetAsView->layout == NULL )
- {
- MSG_SETAS_ERROR("Cannot create layout.");
- free(pSetAsView);
- return NULL;
- }
+ pSetAsView->content = _ivug_setas_create_layout(parent);
- Evas_Object *photocam;
- photocam = elm_photocam_add(pSetAsView->layout);
- elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
- elm_photocam_paused_set(photocam, EINA_TRUE);
+ evas_object_smart_callback_add(pSetAsView->content, "load,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "download,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "ok,clicked", _on_msg_ok_clicked, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "cancel,clicked", _on_msg_cancel_clicked, pSetAsView);
- edje_object_signal_emit(_EDJ(pSetAsView->layout), "setasview,disable,btn_ok","elm"); // Disable ok button
+ _ivug_setas_load_file(pSetAsView->content , filepath);
- _ivug_setas_view_show_icons(pSetAsView->layout);
+// Transition layout
+#ifdef TRANSITION_EFFECT
+ pSetAsView->ly_effect = ivug_layout_add(parent , EDJ_PATH"/ivug-effect.edj", "ivug_effect");
- evas_object_smart_callback_add(photocam, "loaded", _ivug_setas_on_photocam_loaded, (void *)pSetAsView);
+ elm_object_part_content_set(pSetAsView->ly_effect, "elm.swallow.content", pSetAsView->content);
- pSetAsView->photocam = photocam;
+ edje_object_signal_callback_add(_EDJ(pSetAsView->ly_effect), "elm,action,hide,finished", "elm", _signal_hide_finished, (void *)pSetAsView);
+ edje_object_signal_callback_add(_EDJ(pSetAsView->ly_effect), "elm,action,show,finished", "elm", _signal_show_finished, (void *)pSetAsView);
- Evas_Load_Error error = EVAS_LOAD_ERROR_NONE;
+ evas_object_show(pSetAsView->ly_effect);
-// Get Screen size
- Evas_Coord w, h;
- evas_object_geometry_get(pSetAsView->layout, NULL, NULL, &w, &h);
+ edje_object_signal_emit(_EDJ(pSetAsView->ly_effect), "elm,state,show", "app"); // Start Effect
+#endif
- evas_object_show(photocam);
+ return pSetAsView;
+}
- error = elm_photocam_file_set(photocam, filepath);
- if ( error != EVAS_LOAD_ERROR_NONE )
- {
- // TODO : What is good for error handing??????
- MSG_SETAS_ERROR("FileSet Error=%d", error);
+Ivug_SetAsView *
+ivug_setas_view_screen_ug_create(Evas_Object *parent, const char* filepath, ivug_setas_mode mode, ivug_set_screen_type type)
+{
+ Ivug_SetAsView *pSetAsView = NULL;
- if ( error == EVAS_LOAD_ERROR_UNKNOWN_FORMAT )
- {
- _ivug_setas_view_send_result(gGetUGHandle(), IVUG_RESULT_BUNDLE_KEY_ERROR, IVUG_RESULT_BUNDLE_VALUE_NOT_SUPPORTED, NULL, NULL);
- ivug_setas_view_destroy(pSetAsView);
+ MSG_SETAS_HIGH("Wallpaper UG creates");
- return NULL;
- }
- else if ( error == EVAS_LOAD_ERROR_PERMISSION_DENIED )
- {
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_ERROR, IDS_PERMISSION_DENIED, pSetAsView );
- return pSetAsView;
- }
- else
- {
- pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_ERROR, IDS_INVALID_IMAGE_FILE, pSetAsView );
- return pSetAsView;
- }
+ pSetAsView = (Ivug_SetAsView *)calloc(1, sizeof(Ivug_SetAsView));
- }
+ pSetAsView->Mode = mode;
+ pSetAsView->Type = type;
- edje_object_signal_callback_add(_EDJ(pSetAsView->layout),
- "setasview,cancel,clicked",
- "",
- _ivug_setas_on_icon_cancel_clicked,
- (void *)pSetAsView);
+ pSetAsView->content = _ivug_setas_create_layout(parent);
- const Evas_Object *event = edje_object_part_object_get(_EDJ(pSetAsView->layout), "event");
- if(!event)
- {
- MSG_SETAS_ERROR("event object is NULL");
- }
- else
- {
- evas_object_event_callback_add((Evas_Object *)event, EVAS_CALLBACK_MOUSE_DOWN, _ivug_setas_view_mouse_down_cb, pSetAsView);
- evas_object_event_callback_add((Evas_Object *)event, EVAS_CALLBACK_MOUSE_UP, _ivug_setas_view_mouse_up_cb, pSetAsView);
- }
+ evas_object_smart_callback_add(pSetAsView->content, "load,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "download,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "ok,clicked", _on_msg_ok_clicked, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "cancel,clicked", _on_msg_cancel_clicked, pSetAsView);
+
+ _ivug_setas_load_file(pSetAsView->content , filepath);
return pSetAsView;
+}
+
+
+Ivug_SetAsView *
+ivug_setas_view_callerid_ug_create(Evas_Object *parent, const char* filepath, ivug_setas_mode mode, int output_width, int output_height)
+{
+ Ivug_SetAsView *pSetAsView = NULL;
+
+ MSG_SETAS_HIGH("CallerID UG creates. ImgOut(%d,%d)", output_width, output_height);
+
+ pSetAsView = (Ivug_SetAsView *)calloc(1, sizeof(Ivug_SetAsView));
+
+ pSetAsView->Mode = mode;
+ pSetAsView->Type = IVUG_CTRLBAR_SET_SCREEN_CALLERID; // Means that aspect ration should be preserved
+ pSetAsView->content = _ivug_setas_callerid_create_layout(parent);
+
+ evas_object_smart_callback_add(pSetAsView->content, "load,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "download,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "ok,clicked", _on_msg_ok_clicked, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "cancel,clicked", _on_msg_cancel_clicked, pSetAsView);
+
+ _ivug_setas_callerid_load_file(pSetAsView->content , filepath);
+ _ivug_setas_callerid_aspect_ratio_set(pSetAsView->content , (double)output_height/output_width);
+
+ return pSetAsView;
}
Ivug_SetAsView *
-ivug_setas_view_screen_ug_create(Evas_Object *parent, const char* filepath)
+ivug_setas_view_video_call_id_ug_create(Evas_Object *parent, const char* filepath, ivug_setas_mode mode, int output_width, int output_height)
{
Ivug_SetAsView *pSetAsView = NULL;
- MSG_SETAS_HIGH("Wallpaper UG creates");
+ MSG_SETAS_HIGH("CallerID UG creates. ImgOut(%d,%d)", output_width, output_height);
- pSetAsView = _create_setas_view(parent, filepath, IVUG_CTRLBAR_SET_SCREEN_UNDEFINED);
+ pSetAsView = (Ivug_SetAsView *)calloc(1, sizeof(Ivug_SetAsView));
- if ( pSetAsView == NULL )
- {
- MSG_SETAS_ERROR("Cannot create Wallpaper UG");
- return NULL;
- }
+ pSetAsView->Mode = mode;
+ pSetAsView->Type = IVUG_CTRLBAR_SET_SCREEN_VIDEO_CALL_ID; // Means that aspect ration should be preserved
+
+ pSetAsView->content = _ivug_setas_callerid_create_layout(parent);
+
+ evas_object_smart_callback_add(pSetAsView->content, "load,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "download,failed", _on_msg_load_failed, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "ok,clicked", _on_msg_ok_clicked, pSetAsView);
+ evas_object_smart_callback_add(pSetAsView->content, "cancel,clicked", _on_msg_cancel_clicked, pSetAsView);
- evas_object_event_callback_add(pSetAsView->layout, EVAS_CALLBACK_DEL, _setas_ug_view_deleted, "Wallpaper UG");
+ _ivug_setas_callerid_load_file(pSetAsView->content , filepath);
+ _ivug_setas_callerid_aspect_ratio_set(pSetAsView->content , (double)output_height/output_width);
return pSetAsView;
}
@@ -819,7 +721,7 @@ ivug_setas_view_object_get(Ivug_SetAsView *pSetAsView)
{
IV_ASSERT(pSetAsView != NULL);
- return pSetAsView->layout;
+ return pSetAsView->content;
}
void
@@ -827,69 +729,26 @@ ivug_setas_view_destroy(Ivug_SetAsView *pSetAsView)
{
MSG_SETAS_HIGH("Removing SetAs VIew");
- ivug_ret_if(!pSetAsView);
-
- const Evas_Object *event = edje_object_part_object_get(_EDJ(pSetAsView->layout), "event");
- if(event != NULL)
- {
- evas_object_event_callback_del((Evas_Object *)event, EVAS_CALLBACK_MOUSE_DOWN, _ivug_setas_view_mouse_down_cb);
- evas_object_event_callback_del((Evas_Object *)event, EVAS_CALLBACK_MOUSE_UP, _ivug_setas_view_mouse_up_cb);
- }
-
- if (pSetAsView->click_timer)
- {
- ecore_timer_del(pSetAsView->click_timer);
- pSetAsView->click_timer = NULL;
- }
-
- if(pSetAsView->genlist_popup)
- {
- evas_object_del(pSetAsView->genlist_popup);
- pSetAsView->genlist_popup = NULL;
- }
-
- if(pSetAsView->popup)
- {
- evas_object_del(pSetAsView->popup);
- pSetAsView->popup = NULL;
- }
-
- if(pSetAsView->select_box)
- {
- evas_object_del(pSetAsView->select_box);
- pSetAsView->select_box = NULL;
- }
-
- if(pSetAsView->photocam)
- {
- evas_object_del(pSetAsView->photocam);
- pSetAsView->photocam = NULL;
- }
-
- if(pSetAsView->file_path)
+ if ( pSetAsView->ly_effect)
{
- free(pSetAsView->file_path);
- pSetAsView->file_path = NULL;
+ evas_object_del(pSetAsView->ly_effect);
+ pSetAsView->ly_effect = NULL;
}
- if(pSetAsView->layout)
+ if ( pSetAsView->content)
{
- evas_object_del(pSetAsView->layout);
- pSetAsView->layout = NULL;
+ evas_object_del(pSetAsView->content);
+ pSetAsView->content = NULL;
}
- if ( pSetAsView->ly_effect)
+ if ( pSetAsView->filename )
{
- evas_object_del(pSetAsView->ly_effect);
- pSetAsView->ly_effect = NULL;
+ free(pSetAsView->filename);
}
if(pSetAsView)
{
free(pSetAsView);
}
- pSetAsView = NULL;
-
}
-