From 8a907b4c21ec3f4d807fa362cc5ac4724066503d Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Tue, 16 Feb 2016 11:30:02 +0200 Subject: [PATCH] TizenRefApp-5787 [Call UI] Refactor View Manager Change-Id: I2b313d4a869565943878e2dd57ec6205866c3b69 --- inc/callui-common.h | 10 ++ inc/callui-debug.h | 68 +++++++++ inc/callui-view-callend.h | 6 +- inc/callui-view-dialing.h | 7 +- inc/callui-view-incoming-lock.h | 4 +- inc/callui-view-manager.h | 133 ++++++------------ inc/callui-view-multi-call-conf.h | 4 +- inc/callui-view-multi-call-split.h | 6 +- inc/callui-view-quickpanel.h | 6 +- inc/callui-view-single-call.h | 7 +- inc/callui.h | 56 ++------ src/callui-common.c | 14 +- src/callui-keypad.c | 11 +- src/callui-view-callend.c | 69 +++------ src/callui-view-circle.c | 116 +++++++++------- src/callui-view-dialing.c | 60 +++----- src/callui-view-elements.c | 32 +++-- src/callui-view-incoming-call.c | 27 ++-- src/callui-view-incoming-lock.c | 58 +++----- src/callui-view-lock-screen.c | 10 +- src/callui-view-manager.c | 278 ++++++++++++++++--------------------- src/callui-view-multi-call-conf.c | 86 ++++-------- src/callui-view-multi-call-list.c | 68 +++------ src/callui-view-multi-call-split.c | 49 +++---- src/callui-view-quickpanel.c | 72 +++++----- src/callui-view-single-call.c | 67 +++------ src/callui.c | 91 ++++++++---- 27 files changed, 608 insertions(+), 807 deletions(-) create mode 100644 inc/callui-debug.h diff --git a/inc/callui-common.h b/inc/callui-common.h index 5128681..4a09f7f 100644 --- a/inc/callui-common.h +++ b/inc/callui-common.h @@ -54,6 +54,11 @@ typedef enum { LCD_OFF } callui_lcd_control_t; +typedef enum { + CALLUI_RESULT_OK, + CALLUI_RESULT_FAIL, + CALLUI_RESULT_INVALID_PARAM +} callui_result_t; /** * @brief Set call duration @@ -286,4 +291,9 @@ const char *_callui_common_get_call_theme_path(); */ char *_callui_common_get_reject_msg_by_index(int index); +/** + * @brief Makes request on close application + */ +void _callui_common_exit_app(); + #endif //__CALLUI_COMMON_H_ diff --git a/inc/callui-debug.h b/inc/callui-debug.h new file mode 100644 index 0000000..96f7343 --- /dev/null +++ b/inc/callui-debug.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 + * + * 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. + * + */ +#ifndef __CALLUI_DEBUG_H__ +#define __CALLUI_DEBUG_H__ + +#ifndef CALLUI_LOG_TAG +#define CALLUI_LOG_TAG "CALLUI" +#endif + +#define info(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_INFO, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } +#define dbg(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_DEBUG, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } +#define warn(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_WARN, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } +#define err(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_ERROR, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } +#define fatal(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_FATAL, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } + +#define sec_err(fmt, arg...) {SECURE_LOGE(CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##arg); } +#define sec_warn(fmt, arg...) {SECURE_LOGW(CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##arg); } +#define sec_dbg(fmt, arg...) {SECURE_LOGD(CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##arg); } + +#define debug_trace(fmt, args...) do { info(fmt, ##args); } while (0) +#define debug_enter() do { debug_trace(" * Enter * "); } while (0) +#define debug_leave() do { debug_trace(" * Leave * "); } while (0) + +#ifndef CALLUI_RETURN_IF_FAIL +#define CALLUI_RETURN_IF_FAIL(check_condition) {\ + if (!(check_condition)) \ + { \ + err("%s: Failed", #check_condition); \ + return; \ + } \ +} +#endif + +#ifndef CALLUI_RETURN_VALUE_IF_FAIL +#define CALLUI_RETURN_VALUE_IF_FAIL(check_condition, value) {\ + if (!(check_condition)) \ + { \ + err("%s: Failed", #check_condition); \ + return value; \ + } \ +} +#endif + +#ifndef CALLUI_RETURN_NULL_IF_FAIL +#define CALLUI_RETURN_NULL_IF_FAIL(check_condition) {\ + if (!(check_condition)) \ + { \ + err("%s: Failed", #check_condition); \ + return NULL; \ + } \ +} +#endif + +#endif /* __CALLUI_DEBUG_H__ */ diff --git a/inc/callui-view-callend.h b/inc/callui-view-callend.h index 56b3fac..70204aa 100644 --- a/inc/callui-view-callend.h +++ b/inc/callui-view-callend.h @@ -20,17 +20,13 @@ #include "callui-view-manager.h" -typedef struct callui_endcall_view_priv callui_endcall_view_priv_t; - /** * @brief Create end call layout * - * @param[in] ad Application data - * * @return End call view data * */ -call_view_data_t *_callui_view_callend_new(callui_app_data_t *ad); +call_view_data_t *_callui_view_callend_new(); /** * @brief Get end call layout diff --git a/inc/callui-view-dialing.h b/inc/callui-view-dialing.h index 326442a..3f6a6ad 100644 --- a/inc/callui-view-dialing.h +++ b/inc/callui-view-dialing.h @@ -18,19 +18,14 @@ #ifndef __CALLUI_DIALING_VIEW_H_ #define __CALLUI_DIALING_VIEW_H_ -#include "callui.h" #include "callui-view-manager.h" -typedef struct callui_view_dialing_priv callui_view_dialing_priv_t; - /** * @brief Create dialing view * - * @param[in] ad Application data - * * @return New dialing view data * */ -call_view_data_t *_callui_dialing_view_dialing_new(callui_app_data_t *ad); +call_view_data_t *_callui_dialing_view_dialing_new(); #endif //__CALLUI_DIALING_VIEW_H_ diff --git a/inc/callui-view-incoming-lock.h b/inc/callui-view-incoming-lock.h index cf3533d..e8b548f 100644 --- a/inc/callui-view-incoming-lock.h +++ b/inc/callui-view-incoming-lock.h @@ -24,12 +24,10 @@ /** * @brief Create Incoming lock view * - * @param[in] ad Application data - * * @return View data * */ -call_view_data_t *_callui_view_incoming_lock_new(callui_app_data_t *ad); +call_view_data_t *_callui_view_incoming_lock_new(); /** * @brief Incoming lock set accept layout diff --git a/inc/callui-view-manager.h b/inc/callui-view-manager.h index 291451c..73affdb 100644 --- a/inc/callui-view-manager.h +++ b/inc/callui-view-manager.h @@ -15,132 +15,77 @@ * */ -#ifndef __CALLUI_VM_H_ -#define __CALLUI_VM_H_ +#ifndef __CALLUI_VIEW_MANAGER_H__ +#define __CALLUI_VIEW_MANAGER_H__ #include typedef enum { - VIEW_UNDEFINED_TYPE = -1, - VIEW_DIALLING_VIEW, /**< Dialling view*/ - VIEW_INCOMING_LOCK_VIEW,/**< Incoming lock view*/ - VIEW_INCALL_ONECALL_VIEW,/**< Incoming single call view*/ - VIEW_INCALL_MULTICALL_SPLIT_VIEW,/**< Multicall split view */ - VIEW_INCALL_MULTICALL_CONF_VIEW,/**< Multicall conference view */ - VIEW_INCALL_MULTICALL_LIST_VIEW,/**< Multicall list view */ - VIEW_ENDCALL_VIEW,/**< End call view */ - VIEW_QUICKPANEL_VIEW,/**< Quick panel view */ - VIEW_MAX/**< Last view */ -} callui_view_id_t; + VIEW_TYPE_UNDEFINED = -1, + VIEW_TYPE_DIALLING, /**< Dialling view*/ + VIEW_TYPE_INCOMING_LOCK, /**< Incoming lock view*/ + VIEW_TYPE_SINGLECALL, /**< Incoming single call view*/ + VIEW_TYPE_MULTICALL_SPLIT, /**< Multicall split view */ + VIEW_TYPE_MULTICALL_CONF, /**< Multicall conference view */ + VIEW_TYPE_MULTICALL_LIST, /**< Multicall list view */ + VIEW_TYPE_ENDCALL, /**< End call view */ + VIEW_TYPE_QUICKPANEL, /**< Quick panel view */ + VIEW_TYPE_MAX /**< Max view count*/ +} callui_view_type_e; struct _view_data; +typedef struct appdata callui_app_data_t; -typedef int (*create_cb) (struct _view_data *view_data, unsigned int param1, void *param2, void *appdata); -typedef int (*update_cb) (struct _view_data *view_data, void *update_data); +typedef int (*create_cb) (struct _view_data *view_data, void *appdata); +typedef int (*update_cb) (struct _view_data *view_data); typedef int (*destroy_cb) (struct _view_data *view_data); -typedef int (*show_cb) (struct _view_data *view_data, void *appdata); -typedef int (*hide_cb) (struct _view_data *view_data); -typedef int (*rotate_cb) (struct _view_data *view_data); typedef struct _view_data { - callui_view_id_t type; //CM_UI to do removed vcui_app_call_data_t *app_data; + callui_view_type_e type; //CM_UI to do removed vcui_app_call_data_t *app_data; create_cb onCreate; update_cb onUpdate; destroy_cb onDestroy; - show_cb onShow; - hide_cb onHide; - rotate_cb onRotate; Evas_Object *layout; + callui_app_data_t *ad; void *priv; } call_view_data_t; -typedef struct _view_manager_data view_manager_data_t; +typedef struct _callui_vm *callui_vm_h; /** - * @brief Initialize view manager - * - * @return Manager data - * - */ -view_manager_data_t *_callvm_init(); - -/** - * @brief Change view - * - * @param[in] view_id View id - * @param[in] param1 Param to show view - * @param[in] param2 Param to show view - * @param[in] appdata Application data - * - */ -void _callvm_view_change(callui_view_id_t view_id, unsigned int param1, void *param2, void *appdata); - -/** - * @brief Get top view ID - * - * @param[in] view_manager_handle Manager handle - * - * @return view id - * + * @brief Create view manager + * @return view manager handler */ -callui_view_id_t _callvm_get_top_view_id(view_manager_data_t *view_manager_handle); +callui_vm_h _callui_vm_create(callui_app_data_t *ad); /** - * @brief View auto changed - * - * @param[in] appdata Application data - * + * @brief Destroy view manager + * @param[in] vm View manager handler */ -void _callvm_view_auto_change(void *appdata); +void _callui_vm_destroy(callui_vm_h vm); /** - * @brief Terminate app or change view - * - * @param[in] appdata Application data - * - */ -void _callvm_terminate_app_or_view_change(void *appdata); - -/** - * @brief Get call view data - * - * @param[in] ad Application data - * @param[in] view_id View ID - * - * @return view data - * - */ -call_view_data_t * _callvm_get_call_view_data(void *ad, callui_view_id_t view_id); - -/** - * @brief Set call view data - * - * @param[in] ad Application data - * @param[in] view_id View ID - * @param[in] vd View data - * + * @brief Change view + * @param[in] vm View manager handler + * @param[in] type View type + * @return result CALLUI_RESULT_OK on success */ -void _callvm_set_call_view_data(void *appdata, callui_view_id_t view_id,call_view_data_t *vd); +int _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type); /** - * @brief Get view layout - * - * @param[in] ad Application data - * - * @return view layout - * + * @brief Auto change view + * @param[in] vm View manager handler + * @return result CALLUI_RESULT_OK on success */ -Evas_Object *_callvm_get_view_layout(void *appdata); +int _callui_vm_auto_change_view(callui_vm_h vm); /** - * @brief Reset call view data - * - * @param[in] ad Application data - * @param[in] view_id View ID - * + * @brief Get top view type + * @param[in] vm View manager handler + * @return view type */ -void _callvm_reset_call_view_data(void *appdata, callui_view_id_t view_id); +callui_view_type_e _callui_vm_get_cur_view_type(callui_vm_h vm); -#endif //__CALLUI_VM_H_ +#endif /* __CALLUI_VIEW_MANAGER_H__ */ diff --git a/inc/callui-view-multi-call-conf.h b/inc/callui-view-multi-call-conf.h index 484c80b..e19117c 100755 --- a/inc/callui-view-multi-call-conf.h +++ b/inc/callui-view-multi-call-conf.h @@ -24,12 +24,10 @@ /** * @brief Create multicall conf * - * @param[in] ad Application data - * * @return New multicall data * */ -call_view_data_t *_callui_view_multi_call_conf_new(callui_app_data_t *ad); +call_view_data_t *_callui_view_multi_call_conf_new(); #endif /*_CALLUI_VIEW_MULTI_CALL_CONF_H_*/ diff --git a/inc/callui-view-multi-call-split.h b/inc/callui-view-multi-call-split.h index 35dd454..144bc1f 100644 --- a/inc/callui-view-multi-call-split.h +++ b/inc/callui-view-multi-call-split.h @@ -22,12 +22,12 @@ #include "callui-view-manager.h" /** - * @param[in] ad Application data + * @brief Creates multi call split view * - * @return new split view data + * @return New multi call split view data * */ -call_view_data_t *_callui_view_multi_call_split_new(callui_app_data_t *ad); +call_view_data_t *_callui_view_multi_call_split_new(); #endif //_CALLUI_VIEW_MULTI_CALL_SPLIT_H_ diff --git a/inc/callui-view-quickpanel.h b/inc/callui-view-quickpanel.h index 13d3865..ad2aac9 100644 --- a/inc/callui-view-quickpanel.h +++ b/inc/callui-view-quickpanel.h @@ -19,17 +19,13 @@ #ifndef __VCUI_VIEW_QUICKPANEL_H_ #define __VCUI_VIEW_QUICKPANEL_H_ -typedef struct callui_view_qp_priv callui_view_qp_priv_t; - /** * @brief Create quickpanel view * - * @param[in] ad Application data - * * @return quickpanel view * */ -call_view_data_t *_callui_view_qp_new(callui_app_data_t * ad); +call_view_data_t *_callui_view_qp_new(); /** * @brief Hide quick panel diff --git a/inc/callui-view-single-call.h b/inc/callui-view-single-call.h index c562e24..c0453d1 100644 --- a/inc/callui-view-single-call.h +++ b/inc/callui-view-single-call.h @@ -18,19 +18,14 @@ #ifndef __CALLUI_ONECALL_VIEW_H_ #define __CALLUI_ONECALL_VIEW_H_ -#include "callui.h" #include "callui-view-manager.h" -typedef struct incall_one_view_priv incall_one_view_priv_t; - /** * @brief Create single call view * - * @param[in] ad Application data - * * @return New single call data * */ -call_view_data_t *_callui_view_single_call_new(callui_app_data_t *ad); +call_view_data_t *_callui_view_single_call_new(); #endif //__CALLUI_ONECALL_VIEW_H_ diff --git a/inc/callui.h b/inc/callui.h index f200927..f7f635d 100755 --- a/inc/callui.h +++ b/inc/callui.h @@ -25,55 +25,12 @@ #include "callui-view-manager.h" #include "callui-lock-manager.h" +#include "callui-debug.h" #ifndef CALLUI_EXPORT_API #define CALLUI_EXPORT_API __attribute__ ((visibility("default"))) #endif -#ifndef CALLUI_LOG_TAG -#define CALLUI_LOG_TAG "CALLUI" -#endif - -#define info(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_INFO, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } -#define dbg(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_DEBUG, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } -#define warn(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_WARN, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } -#define err(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_ERROR, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } -#define fatal(fmt,args...) { __dlog_print(LOG_ID_MAIN, DLOG_FATAL, CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##args); } - -#define sec_err(fmt, arg...) {SECURE_LOGE(CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##arg); } -#define sec_warn(fmt, arg...) {SECURE_LOGW(CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##arg); } -#define sec_dbg(fmt, arg...) {SECURE_LOGD(CALLUI_LOG_TAG, "%s: %s(%d) > " fmt "\n", __FILE__, __func__, __LINE__, ##arg); } - -#ifndef CALLUI_RETURN_IF_FAIL -#define CALLUI_RETURN_IF_FAIL(check_condition) {\ - if (!(check_condition)) \ - { \ - err("%s: Failed", #check_condition); \ - return; \ - } \ -} -#endif - -#ifndef CALLUI_RETURN_VALUE_IF_FAIL -#define CALLUI_RETURN_VALUE_IF_FAIL(check_condition, value) {\ - if (!(check_condition)) \ - { \ - err("%s: Failed", #check_condition); \ - return value; \ - } \ -} -#endif - -#ifndef CALLUI_RETURN_NULL_IF_FAIL -#define CALLUI_RETURN_NULL_IF_FAIL(check_condition) {\ - if (!(check_condition)) \ - { \ - err("%s: Failed", #check_condition); \ - return NULL; \ - } \ -} -#endif - #define MSG_PKG "org.tizen.message" #define PACKAGE "org.tizen.call-ui" @@ -146,8 +103,11 @@ typedef struct _call_data_t { call_contact_data_t call_ct_info; /**< Contact information */ }call_data_t; -typedef struct appdata { - Evas *evas; +//typedef struct view_manager *view_manager_h; +// +//typedef struct appdata callui_app_data_t; + +struct appdata { Evas_Object *win; Evas_Object *win_conformant; Evas_Object *nf; @@ -161,7 +121,7 @@ typedef struct appdata { Evas_Object *second_call_popup; Evas_Object *bt_popup; - view_manager_data_t *view_manager_handle; + callui_vm_h view_manager_handle; bool multi_call_list_end_clicked; @@ -209,7 +169,7 @@ typedef struct appdata { Evas_Object *win_quickpanel; Evas_Object *quickpanel_layout; char *quickpanel_text; -} callui_app_data_t; +}; callui_app_data_t *_callui_get_app_data(); diff --git a/src/callui-common.c b/src/callui-common.c index 1dead6c..4714a9d 100755 --- a/src/callui-common.c +++ b/src/callui-common.c @@ -15,6 +15,7 @@ * */ +#include #include #include #include @@ -92,7 +93,7 @@ void _callui_common_set_call_duration(char *time_dur) Evas_Object *layout = NULL; layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); CALLUI_RETURN_IF_FAIL(layout); - if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCALL_MULTICALL_SPLIT_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_MULTICALL_SPLIT) { Evas_Object *one_hold_layout = elm_object_part_content_get(layout, PART_SWALLOW_CALL_INFO); Evas_Object *active_layout = elm_object_part_content_get(one_hold_layout, PART_SWALLOW_ACTIVE_INFO); elm_object_part_text_set(active_layout, PART_TEXT_STATUS, time_dur); @@ -181,7 +182,7 @@ static Eina_Bool __callui_common_ending_timer_expired_cb(void *data) callui_app_data_t *ad = _callui_get_app_data(); ad->ending_timer = NULL; - _callvm_terminate_app_or_view_change(ad); + _callui_common_exit_app(); return ECORE_CALLBACK_CANCEL; } @@ -335,7 +336,7 @@ long _callui_common_get_uptime(void) void _callui_common_win_set_noti_type(void *appdata, int bwin_noti) { - dbg("_callui_common_win_set_noti_type"); + dbg("_callui_common_win_set_noti_type START"); callui_app_data_t *ad = (callui_app_data_t *)appdata; Ecore_Wl_Window *win = elm_win_wl_window_get(ad->win); @@ -350,6 +351,8 @@ void _callui_common_win_set_noti_type(void *appdata, int bwin_noti) /* Set Notification's priority to LEVEL_HIGH */ efl_util_set_notification_window_level(ad->win, EFL_UTIL_NOTIFICATION_LEVEL_TOP); } + dbg("_callui_common_win_set_noti_type END"); + return; } @@ -1001,3 +1004,8 @@ char *_callui_common_get_reject_msg_by_index(int index) return return_str; } + +void _callui_common_exit_app() +{ + ui_app_exit(); +} diff --git a/src/callui-keypad.c b/src/callui-keypad.c index 5f86915..5d0921c 100755 --- a/src/callui-keypad.c +++ b/src/callui-keypad.c @@ -290,7 +290,8 @@ static void __callui_keypad_create_entry(void *data) keypad_data_t *pkeypad_data = gkeypad_data; callui_app_data_t *ad = (callui_app_data_t *)data; CALLUI_RETURN_IF_FAIL(ad != NULL); - Evas_Object *current_ly = _callvm_get_view_layout(ad); + Evas_Object *current_ly = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); + CALLUI_RETURN_IF_FAIL(current_ly != NULL); CALLUI_RETURN_IF_FAIL(pkeypad_data != NULL); @@ -327,7 +328,7 @@ void _callui_keypad_show_layout(void *app_data) CALLUI_RETURN_IF_FAIL(pkeypad_data); callui_app_data_t *ad = (callui_app_data_t *)app_data; CALLUI_RETURN_IF_FAIL(ad); - Evas_Object *view_ly = _callvm_get_view_layout(ad); + Evas_Object *view_ly = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); CALLUI_RETURN_IF_FAIL(view_ly); elm_object_signal_emit(pkeypad_data->keypad_ly, "SHOW", "KEYPADBTN"); @@ -361,7 +362,7 @@ void _callui_keypad_hide_layout(void *app_data) CALLUI_RETURN_IF_FAIL(pkeypad_data); callui_app_data_t *ad = (callui_app_data_t *)app_data; CALLUI_RETURN_IF_FAIL(ad); - Evas_Object *view_ly = _callvm_get_view_layout(ad); + Evas_Object *view_ly = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); CALLUI_RETURN_IF_FAIL(view_ly); elm_object_signal_emit(pkeypad_data->keypad_ly, "HIDE", "KEYPADBTN"); @@ -387,7 +388,7 @@ void _callui_keypad_create_layout(void *appdata) dbg(".."); callui_app_data_t *ad = (callui_app_data_t *)appdata; CALLUI_RETURN_IF_FAIL(ad); - Evas_Object *parent_ly = _callvm_get_view_layout(ad); + Evas_Object *parent_ly = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); CALLUI_RETURN_IF_FAIL(parent_ly); _callui_keypad_delete_layout(ad); @@ -418,7 +419,7 @@ void _callui_keypad_delete_layout(void *appdata) CALLUI_RETURN_IF_FAIL(ad); keypad_data_t *pkeypad_data = gkeypad_data; CALLUI_RETURN_IF_FAIL(pkeypad_data); - Evas_Object *parent_ly = _callvm_get_view_layout(ad); + Evas_Object *parent_ly = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); CALLUI_RETURN_IF_FAIL(parent_ly); elm_object_signal_emit(parent_ly, "HIDE", "KEYPAD_AREA"); diff --git a/src/callui-view-callend.c b/src/callui-view-callend.c index 98ee4ad..1d4f5ca 100644 --- a/src/callui-view-callend.c +++ b/src/callui-view-callend.c @@ -36,41 +36,34 @@ struct callui_endcall_view_priv { int call_end_type; bool is_emergency_call; }; +typedef struct callui_endcall_view_priv callui_endcall_view_priv_t; #define APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact" #define CONTACT_NUMBER_BUF_LEN 32 #define BG_COLOR_ALPHA 120 -static int __callui_view_callend_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3); -static int __callui_view_callend_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_callend_onhide(call_view_data_t *view_data); +static int __callui_view_callend_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_callend_onupdate(call_view_data_t *view_data); static int __callui_view_callend_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_callend_ondestroy(call_view_data_t *view_data); -static int __callui_view_callend_onrotate(call_view_data_t *view_data); static void __callui_view_callend_create_screen(callui_app_data_t *ad, Evas_Object *eo, void *data); static Evas_Object *__callui_view_callend_create_contents(void *data, char *grp_name); -call_view_data_t *_callui_view_callend_new(callui_app_data_t *ad) +call_view_data_t *_callui_view_callend_new() { - static call_view_data_t callend_view = { - .type = VIEW_ENDCALL_VIEW, - .layout = NULL, - .onCreate = __callui_view_callend_oncreate, - .onUpdate = __callui_view_callend_onupdate, - .onHide = __callui_view_callend_onhide, - .onShow = __callui_view_callend_onshow, - .onDestroy = __callui_view_callend_ondestroy, - .onRotate = __callui_view_callend_onrotate, - .priv = NULL, - }; - - callend_view.priv = calloc(1, sizeof(callui_endcall_view_priv_t)); - - if (!callend_view.priv) { + call_view_data_t *callend_view = calloc(1, sizeof(call_view_data_t)); + callend_view->type = VIEW_TYPE_ENDCALL; + callend_view->layout = NULL; + callend_view->onCreate = __callui_view_callend_oncreate; + callend_view->onUpdate = __callui_view_callend_onupdate; + callend_view->onDestroy = __callui_view_callend_ondestroy; + + callend_view->priv = calloc(1, sizeof(callui_endcall_view_priv_t)); + if (!callend_view->priv) { err("ERROR!!!!!!!!!!!"); } - return &callend_view; + return callend_view; } static void __callui_endcall_voicecall_btn_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) @@ -102,7 +95,7 @@ static void __vcui_endcall_create_contact_btn_cb(void *data, Evas_Object *obj, v { callui_app_data_t *ad = _callui_get_app_data(); CALLUI_RETURN_IF_FAIL(ad); - _callvm_terminate_app_or_view_change(ad); + _callui_common_exit_app(); app_control_h request; app_control_create(&request); app_control_set_operation(request, APP_CONTROL_OPERATION_ADD); @@ -122,7 +115,7 @@ static void __vcui_endcall_update_contact_btn_cb(void *data, Evas_Object *obj, v { callui_app_data_t *ad = _callui_get_app_data(); CALLUI_RETURN_IF_FAIL(ad); - _callvm_terminate_app_or_view_change(ad); + _callui_common_exit_app(); app_control_h request; app_control_create(&request); app_control_set_operation(request, APP_CONTROL_OPERATION_EDIT); @@ -291,7 +284,7 @@ static Evas_Object *__callui_view_callend_create_contents(void *data, char *grp_ return eo; } -static int __callui_view_callend_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *data) +static int __callui_view_callend_oncreate(call_view_data_t *view_data, void *data) { dbg("endcall view create"); call_view_data_t *vd = view_data; @@ -299,6 +292,7 @@ static int __callui_view_callend_oncreate(call_view_data_t *view_data, unsigned callui_endcall_view_priv_t *priv = (callui_endcall_view_priv_t *)vd->priv; call_data_t *call_data = NULL; + vd->ad = ad; priv->bshowbutton = FALSE; /* Init */ if (ad->active) { @@ -344,21 +338,12 @@ static int __callui_view_callend_oncreate(call_view_data_t *view_data, unsigned return 0; } -static int __callui_view_callend_onupdate(call_view_data_t *view_data, void *update_data) +static int __callui_view_callend_onupdate(call_view_data_t *view_data) { dbg("end call view update"); return 0; } -static int __callui_view_callend_onhide(call_view_data_t *view_data) -{ - dbg("end call view hide"); - callui_app_data_t *ad = _callui_get_app_data(); - - evas_object_hide(ad->main_ly); - return 0; -} - static int __callui_view_callend_onshow(call_view_data_t *view_data, void *appdata) { dbg("end call view show"); @@ -373,13 +358,10 @@ static int __callui_view_callend_onshow(call_view_data_t *view_data, void *appda return 0; } -static int __callui_view_callend_ondestroy(call_view_data_t *view_data) +static int __callui_view_callend_ondestroy(call_view_data_t *vd) { - dbg("endcall view destroy"); - callui_app_data_t *ad = _callui_get_app_data(); - CALLUI_RETURN_VALUE_IF_FAIL(ad, -1); - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_ENDCALL_VIEW); CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); + callui_endcall_view_priv_t *priv = (callui_endcall_view_priv_t *)vd->priv; _callui_common_delete_ending_timer(); @@ -408,15 +390,6 @@ static int __callui_view_callend_ondestroy(call_view_data_t *view_data) priv = NULL; } - _callvm_reset_call_view_data(ad, VIEW_ENDCALL_VIEW); - - dbg("complete destroy one view"); - return 0; -} - -static int __callui_view_callend_onrotate(call_view_data_t *view_data) -{ - dbg("*** Call End view Rotate ***"); return 0; } diff --git a/src/callui-view-circle.c b/src/callui-view-circle.c index 6c255e7..c609d9b 100755 --- a/src/callui-view-circle.c +++ b/src/callui-view-circle.c @@ -61,7 +61,7 @@ static void __callui_view_circle_handle_accept(call_view_data_t *vd, callui_app_ _callui_common_unlock_swipe_lock(); } - if (vd->type == VIEW_INCOMING_LOCK_VIEW) { + if (vd->type == VIEW_TYPE_INCOMING_LOCK) { if (ad->active == NULL) { dbg("No Call Or Held call - Accept"); @@ -82,7 +82,7 @@ static void __callui_view_circle_handle_reject(call_view_data_t *vd, callui_app_ dbg(".."); int ret = -1; - if (vd->type == VIEW_INCOMING_LOCK_VIEW) { + if (vd->type == VIEW_TYPE_INCOMING_LOCK) { ret = cm_reject_call(ad->cm_handle); if (ret != CM_ERROR_NONE) { err("cm_reject_call() is failed"); @@ -96,7 +96,7 @@ static Evas_Object *__callui_view_circle_get_accept_layout(void *data) call_view_data_t *vd = (call_view_data_t *)data; Evas_Object *layout = NULL; switch (vd->type) { - case VIEW_INCOMING_LOCK_VIEW: + case VIEW_TYPE_INCOMING_LOCK: { layout = _callui_view_incoming_lock_get_accept_layout(vd); } @@ -112,7 +112,7 @@ static void __callui_view_circle_set_accept_layout(void *data, Evas_Object *layo { call_view_data_t *vd = (call_view_data_t *)data; switch (vd->type) { - case VIEW_INCOMING_LOCK_VIEW: + case VIEW_TYPE_INCOMING_LOCK: { _callui_view_incoming_lock_set_accept_layout(vd, layout); } @@ -127,7 +127,7 @@ static Evas_Object *__callui_view_circle_get_reject_layout(void *data) call_view_data_t *vd = (call_view_data_t *)data; Evas_Object *layout = NULL; switch (vd->type) { - case VIEW_INCOMING_LOCK_VIEW: + case VIEW_TYPE_INCOMING_LOCK: { layout = _callui_view_incoming_lock_get_reject_layout(vd); } @@ -143,7 +143,7 @@ static void __callui_view_circle_set_reject_layout(void *data, Evas_Object *layo { call_view_data_t *vd = (call_view_data_t *)data; switch (vd->type) { - case VIEW_INCOMING_LOCK_VIEW: + case VIEW_TYPE_INCOMING_LOCK: { _callui_view_incoming_lock_set_reject_layout(vd, layout); } @@ -183,12 +183,15 @@ static void __callui_view_circle_accept_down(call_view_data_t *vd, callui_app_da static void __callui_view_circle_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - dbg(""); - Evas_Event_Mouse_Down *ev = event_info; - callui_app_data_t *ad = (callui_app_data_t *)data; - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCOMING_LOCK_VIEW); + CALLUI_RETURN_IF_FAIL(data); + CALLUI_RETURN_IF_FAIL(event_info); + + call_view_data_t *vd = (call_view_data_t *)data; + + CALLUI_RETURN_IF_FAIL(vd->ad); - CALLUI_RETURN_IF_FAIL(vd); + Evas_Event_Mouse_Down *ev = event_info; + callui_app_data_t *ad = vd->ad; if (-1 == accept_touch_num && -1 == reject_touch_num) { __callui_view_circle_accept_down(vd, ad, ev->canvas.x, ev->canvas.y); @@ -204,12 +207,15 @@ static void __callui_view_circle_mouse_down_cb(void *data, Evas *evas, Evas_Obje static void __callui_view_circle_multi_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - dbg(".."); - Evas_Event_Multi_Down *ev = event_info; - callui_app_data_t *ad = (callui_app_data_t *)data; - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCOMING_LOCK_VIEW); + CALLUI_RETURN_IF_FAIL(data); + CALLUI_RETURN_IF_FAIL(event_info); + + call_view_data_t *vd = (call_view_data_t *)data; + + CALLUI_RETURN_IF_FAIL(vd->ad); - CALLUI_RETURN_IF_FAIL(vd); + Evas_Event_Multi_Down *ev = event_info; + callui_app_data_t *ad = vd->ad; dbg("ev->device = %d, accept_touch_num = %d", ev->device, accept_touch_num); if (-1 == accept_touch_num && -1 == reject_touch_num) { @@ -251,12 +257,16 @@ static void __callui_view_circle_accept_move(call_view_data_t *vd, callui_app_da static void __callui_view_circle_mouse_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { + CALLUI_RETURN_IF_FAIL(data); + CALLUI_RETURN_IF_FAIL(event_info); + + call_view_data_t *vd = (call_view_data_t *)data; + + CALLUI_RETURN_IF_FAIL(vd->ad); + Evas_Event_Mouse_Move *ev = event_info; - CALLUI_RETURN_IF_FAIL(ev); - callui_app_data_t *ad = (callui_app_data_t *)data; - CALLUI_RETURN_IF_FAIL(ad); - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCOMING_LOCK_VIEW); - CALLUI_RETURN_IF_FAIL(vd); + callui_app_data_t *ad = vd->ad; + if (accept_touch_num == 0) __callui_view_circle_accept_move(vd, ad, ev->cur.canvas.x, ev->cur.canvas.y); else if (reject_touch_num == 0) @@ -265,9 +275,16 @@ static void __callui_view_circle_mouse_move_cb(void *data, Evas *evas, Evas_Obje static void __callui_view_circle_multi_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { + CALLUI_RETURN_IF_FAIL(data); + CALLUI_RETURN_IF_FAIL(event_info); + + call_view_data_t *vd = (call_view_data_t *)data; + + CALLUI_RETURN_IF_FAIL(vd->ad); + Evas_Event_Multi_Move *ev = event_info; - callui_app_data_t *ad = (callui_app_data_t *)data; - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCOMING_LOCK_VIEW); + callui_app_data_t *ad = vd->ad; + dbg("ev->device = %d, accept_touch_num = %d", ev->device, accept_touch_num); if (vd) { if (accept_touch_num == ev->device) @@ -305,13 +322,15 @@ static void __callui_view_circle_accept_up(call_view_data_t *vd, callui_app_data static void __callui_view_circle_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - dbg(".."); + CALLUI_RETURN_IF_FAIL(data); + CALLUI_RETURN_IF_FAIL(event_info); + + call_view_data_t *vd = (call_view_data_t *)data; + + CALLUI_RETURN_IF_FAIL(vd->ad); + Evas_Event_Mouse_Up *ev = event_info; - CALLUI_RETURN_IF_FAIL(ev); - callui_app_data_t *ad = (callui_app_data_t *)data; - CALLUI_RETURN_IF_FAIL(ad); - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCOMING_LOCK_VIEW); - CALLUI_RETURN_IF_FAIL(vd); + callui_app_data_t *ad = vd->ad; if (accept_touch_num == 0) { __callui_view_circle_accept_up(vd, ad, ev->canvas.x, ev->canvas.y); @@ -324,14 +343,15 @@ static void __callui_view_circle_mouse_up_cb(void *data, Evas *evas, Evas_Object static void __callui_view_circle_multi_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - dbg(".."); + CALLUI_RETURN_IF_FAIL(data); + CALLUI_RETURN_IF_FAIL(event_info); + + call_view_data_t *vd = (call_view_data_t *)data; + + CALLUI_RETURN_IF_FAIL(vd->ad); + Evas_Event_Multi_Up *ev = event_info; - CALLUI_RETURN_IF_FAIL(ev); - callui_app_data_t *ad = (callui_app_data_t *)data; - CALLUI_RETURN_IF_FAIL(ad); - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCOMING_LOCK_VIEW); - CALLUI_RETURN_IF_FAIL(vd); - dbg("ev->device = %d", ev->device); + callui_app_data_t *ad = vd->ad; if (accept_touch_num == ev->device) { __callui_view_circle_accept_up(vd, ad, ev->canvas.x, ev->canvas.y); @@ -450,12 +470,12 @@ Evas_Object *_callui_view_circle_create_reject_layout(callui_app_data_t *ad, voi elm_object_part_text_set(lock_reject, "reject_text", _("IDS_CALL_BUTTON_REJECT")); - evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MOUSE_DOWN, __callui_view_circle_mouse_down_cb, ad); - evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MOUSE_MOVE, __callui_view_circle_mouse_move_cb, ad); - evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MOUSE_UP, __callui_view_circle_mouse_up_cb, ad); - evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MULTI_DOWN, __callui_view_circle_multi_down_cb, ad); - evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MULTI_MOVE, __callui_view_circle_multi_move_cb, ad); - evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MULTI_UP, __callui_view_circle_multi_up_cb, ad); + evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MOUSE_DOWN, __callui_view_circle_mouse_down_cb, vd); + evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MOUSE_MOVE, __callui_view_circle_mouse_move_cb, vd); + evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MOUSE_UP, __callui_view_circle_mouse_up_cb, vd); + evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MULTI_DOWN, __callui_view_circle_multi_down_cb, vd); + evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MULTI_MOVE, __callui_view_circle_multi_move_cb, vd); + evas_object_event_callback_add(lock_reject, EVAS_CALLBACK_MULTI_UP, __callui_view_circle_multi_up_cb, vd); inner_circle = _callui_edje_object_part_get(lock_reject, "reject_inner_circle"); evas_object_geometry_get(inner_circle, &x, &y, &width, &height); @@ -498,12 +518,12 @@ Evas_Object *_callui_view_circle_create_accept_layout(callui_app_data_t *ad, voi elm_object_signal_emit(lock_accept, "outer_circle,hide", "outer-circle"); elm_object_part_text_set(lock_accept, "accept_text", _("IDS_CALL_BUTTON_ACCEPT")); - evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_DOWN, __callui_view_circle_mouse_down_cb, ad); - evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_MOVE, __callui_view_circle_mouse_move_cb, ad); - evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_UP, __callui_view_circle_mouse_up_cb, ad); - evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MULTI_DOWN, __callui_view_circle_multi_down_cb, ad); - evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MULTI_MOVE, __callui_view_circle_multi_move_cb, ad); - evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MULTI_UP, __callui_view_circle_multi_up_cb, ad); + evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_DOWN, __callui_view_circle_mouse_down_cb, vd); + evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_MOVE, __callui_view_circle_mouse_move_cb, vd); + evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_UP, __callui_view_circle_mouse_up_cb, vd); + evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MULTI_DOWN, __callui_view_circle_multi_down_cb, vd); + evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MULTI_MOVE, __callui_view_circle_multi_move_cb, vd); + evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MULTI_UP, __callui_view_circle_multi_up_cb, vd); inner_circle = _callui_edje_object_part_get(lock_accept, "accept_inner_circle"); evas_object_geometry_get(inner_circle, &x, &y, &width, &height); diff --git a/src/callui-view-dialing.c b/src/callui-view-dialing.c index f120a08..de88caa 100644 --- a/src/callui-view-dialing.c +++ b/src/callui-view-dialing.c @@ -32,36 +32,31 @@ struct callui_view_dialing_priv { Evas_Object *ic; Eina_Bool bredial; }; +typedef struct callui_view_dialing_priv callui_view_dialing_priv_t; #define VIEW_DIALING_LAYOUT_ID "DIALVIEW" -static int __callui_view_dialing_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *appdata); -static int __callui_view_dialing_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_dialing_onhide(call_view_data_t *view_data); +static int __callui_view_dialing_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_dialing_onupdate(call_view_data_t *view_data); static int __callui_view_dialing_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_dialing_ondestroy(call_view_data_t *view_data); -static int __callui_view_dialing_onrotate(call_view_data_t *view_data); -call_view_data_t *_callui_dialing_view_dialing_new(callui_app_data_t *ad) +call_view_data_t *_callui_dialing_view_dialing_new() { - static call_view_data_t dialing_view = { - .type = VIEW_DIALLING_VIEW, - .layout = NULL, - .onCreate = __callui_view_dialing_oncreate, - .onUpdate = __callui_view_dialing_onupdate, - .onHide = __callui_view_dialing_onhide, - .onShow = __callui_view_dialing_onshow, - .onDestroy = __callui_view_dialing_ondestroy, - .onRotate = __callui_view_dialing_onrotate, - .priv = NULL, - }; - dialing_view.priv = calloc(1, sizeof(callui_view_dialing_priv_t)); - - if (!dialing_view.priv) { + call_view_data_t *dialing_view = calloc(1, sizeof(call_view_data_t)); + + dialing_view->type = VIEW_TYPE_DIALLING; + dialing_view->layout = NULL; + dialing_view->onCreate = __callui_view_dialing_oncreate; + dialing_view->onUpdate = __callui_view_dialing_onupdate; + dialing_view->onDestroy = __callui_view_dialing_ondestroy; + dialing_view->priv = calloc(1, sizeof(callui_view_dialing_priv_t)); + + if (!dialing_view->priv) { err("ERROR!!!!!!!!!!! "); } - return &dialing_view; + return dialing_view; } static Evas_Object *__callui_view_dialing_create_contents(void *data, char *grpname) @@ -148,12 +143,14 @@ static void __callui_view_dialing_draw_screen(callui_app_data_t *ad, Evas_Object EVAS_CALLBACK_RENDER_POST, __vcui_view_dialing_post_render_cb, vd);*/ } -static int __callui_view_dialing_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *appdata) +static int __callui_view_dialing_oncreate(call_view_data_t *view_data, void *appdata) { dbg("dialling view create!!"); callui_app_data_t *ad = (callui_app_data_t *) appdata; callui_view_dialing_priv_t *priv = (callui_view_dialing_priv_t *)view_data->priv; + view_data->ad = ad; + if (ad->main_ly) { priv->contents = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); if (!priv->contents) { @@ -184,22 +181,11 @@ static int __callui_view_dialing_oncreate(call_view_data_t *view_data, unsigned return 0; } -static int __callui_view_dialing_onupdate(call_view_data_t *view_data, void *update_data) +static int __callui_view_dialing_onupdate(call_view_data_t *view_data) { return 0; } -static int __callui_view_dialing_onhide(call_view_data_t *view_data) -{ - dbg("dialling view hide"); - - callui_app_data_t *ad = _callui_get_app_data(); - - evas_object_hide(ad->main_ly); - - return 0; -} - static int __callui_view_dialing_onshow(call_view_data_t *view_data, void *appdata) { dbg("dialling view show"); @@ -231,13 +217,5 @@ static int __callui_view_dialing_ondestroy(call_view_data_t *vd) priv = NULL; } - _callvm_reset_call_view_data(ad, VIEW_DIALLING_VIEW); - - return 0; -} - -static int __callui_view_dialing_onrotate(call_view_data_t *view_data) -{ - dbg("*** Dialling view Rotate ***"); return 0; } diff --git a/src/callui-view-elements.c b/src/callui-view-elements.c index 8782e22..31d77db 100755 --- a/src/callui-view-elements.c +++ b/src/callui-view-elements.c @@ -125,7 +125,7 @@ static Evas_Object *__callui_create_button_style(void *data, Evas_Object **p_but Evas_Object *sw = NULL; callui_app_data_t *ad = (callui_app_data_t *)data; CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL); - layout = _callvm_get_view_layout(ad); + layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); CALLUI_RETURN_VALUE_IF_FAIL(layout, NULL); btn_ly = elm_object_part_content_get(layout, "btn_region"); CALLUI_RETURN_VALUE_IF_FAIL(btn_ly, NULL); @@ -546,24 +546,24 @@ static void __callui_end_btn_cb(void *data, Evas_Object *obj, void *event_info) dbg("vd->type:[%d]", vd->type); switch (vd->type) { - case VIEW_DIALLING_VIEW: + case VIEW_TYPE_DIALLING: { if (ad->active) ret = cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE); } break; - case VIEW_INCALL_ONECALL_VIEW: + case VIEW_TYPE_SINGLECALL: { ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_CALLS); } break; - case VIEW_INCALL_MULTICALL_SPLIT_VIEW: + case VIEW_TYPE_MULTICALL_SPLIT: { ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS); } break; - case VIEW_INCALL_MULTICALL_CONF_VIEW: - case VIEW_INCALL_MULTICALL_LIST_VIEW: + case VIEW_TYPE_MULTICALL_CONF: + case VIEW_TYPE_MULTICALL_LIST: { ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_CALLS); } @@ -694,7 +694,7 @@ Evas_Object *_callui_create_message_button_disabled(void *data) Evas_Object *icon = NULL; switch (vd->type) { - case VIEW_ENDCALL_VIEW: + case VIEW_TYPE_ENDCALL: { layout = _callui_view_callend_get_layout(vd); } @@ -763,7 +763,7 @@ Evas_Object *_callui_create_view_contact_button(void *data, int ct_id) CALLUI_RETURN_VALUE_IF_FAIL(vd != NULL, NULL); switch (vd->type) { - case VIEW_ENDCALL_VIEW: + case VIEW_TYPE_ENDCALL: { layout = _callui_view_callend_get_layout(vd); } @@ -801,7 +801,7 @@ Evas_Object *_callui_create_create_contacts_button(void *data, char *number) Evas_Object *sw = NULL; switch (vd->type) { - case VIEW_ENDCALL_VIEW: + case VIEW_TYPE_ENDCALL: { layout = _callui_view_callend_get_layout(vd); } @@ -873,7 +873,7 @@ Evas_Object *_callui_create_update_existing_contact_button(void *data, char *num CALLUI_RETURN_VALUE_IF_FAIL(vd != NULL, NULL); switch (vd->type) { - case VIEW_ENDCALL_VIEW: + case VIEW_TYPE_ENDCALL: { layout = _callui_view_callend_get_layout(vd); } @@ -909,7 +909,7 @@ Evas_Object *_callui_create_message_button(void *data, char *number) Evas_Object *icon = NULL; switch (vd->type) { - case VIEW_ENDCALL_VIEW: + case VIEW_TYPE_ENDCALL: { layout = _callui_view_callend_get_layout(vd); } @@ -988,7 +988,8 @@ Evas_Object *_callui_show_caller_info_status(void *data, const char *status) { Evas_Object *layout = NULL; - layout = _callvm_get_view_layout(data); + callui_app_data_t *ad = (callui_app_data_t *)data; + layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); edje_object_part_text_set(_EDJ(layout), "call_txt_status", status); return layout; @@ -1102,7 +1103,7 @@ void _callui_load_more_option(void *data) eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL); /* Hold/Resume */ - if (vd->type != VIEW_INCALL_MULTICALL_SPLIT_VIEW) { + if (vd->type != VIEW_TYPE_MULTICALL_SPLIT) { if (ad->active != NULL) { elm_ctxpopup_item_append(ctxpopup, _("IDS_CALL_BUTTON_HOLD"), NULL, __callui_hold_btn_cb, ad); } else {/* CALL_HOLD */ @@ -1240,8 +1241,9 @@ static void __callui_second_call_cancel_btn_response_cb(void *data, Evas_Object { dbg(".."); - __callui_unload_second_call_popup(data); - _callvm_view_change(VIEW_INCOMING_LOCK_VIEW, -1, NULL, data); + callui_app_data_t *ad = (callui_app_data_t*) data; + __callui_unload_second_call_popup(ad); + _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_INCOMING_LOCK); return; } diff --git a/src/callui-view-incoming-call.c b/src/callui-view-incoming-call.c index 23c3b28..6b3a2a7 100644 --- a/src/callui-view-incoming-call.c +++ b/src/callui-view-incoming-call.c @@ -458,7 +458,7 @@ static void __reject_msg_create_glist(void *data) void _callui_view_incoming_call_draw_screen(callui_app_data_t *ad, call_view_data_t *vd) { incoming_lock_view_priv_t *priv = (incoming_lock_view_priv_t *)vd->priv; - Evas_Object *eo = priv->contents; + char *file_path = NULL; call_data_t *call_data = NULL; @@ -504,7 +504,7 @@ void _callui_view_incoming_call_draw_screen(callui_app_data_t *ad, call_view_dat __callui_view_incoming_call_create_reject_msg_layout(vd); } - evas_object_show(eo); + evas_object_show(priv->contents); } static Eina_Bool __callui_view_incoming_lock_reject_msg_available(callui_app_data_t *ad, char *call_num) @@ -516,11 +516,7 @@ static Eina_Bool __callui_view_incoming_lock_reject_msg_available(callui_app_dat info("Invalid number"); return EINA_FALSE; } -/* else if (ad->b_msg_restricted) { - CALL_UI_DEBUG(VC_LOG_WARN, "MDM"); - return EINA_FALSE; - } -*/ + return EINA_TRUE; } @@ -614,26 +610,25 @@ int _callui_view_incoming_call_oncreate(call_view_data_t *view_data, void *appda dbg("mt-lock view create!!"); callui_app_data_t *ad = (callui_app_data_t *)appdata; - dbg(" active %d", ad->active); - dbg(" incoming %d", ad->incom); + dbg(" active %p", ad->active); + dbg(" incoming %p", ad->incom); incoming_lock_view_priv_t *priv = (incoming_lock_view_priv_t *) view_data->priv; evas_object_resize(ad->win, ad->root_w, ad->root_h); evas_object_pointer_mode_set(ad->win, EVAS_OBJECT_POINTER_MODE_NOGRAB); + if (ad->main_ly) { priv->contents = __callui_view_incoming_call_create_contents(ad, GRP_MAIN_LY); elm_object_part_content_set(ad->main_ly, "elm.swallow.content", priv->contents); - priv->caller_info = elm_object_part_content_get(priv->contents, "caller_info"); - if (!priv->caller_info) { - priv->caller_info = __callui_view_incoming_call_create_contents(ad, GRP_CALLER_INFO); - elm_object_part_content_set(priv->contents, "caller_info", priv->caller_info); - } + priv->caller_info = __callui_view_incoming_call_create_contents(ad, GRP_CALLER_INFO); + elm_object_part_content_set(priv->contents, "caller_info", priv->caller_info); + elm_object_signal_emit(priv->contents, "mt_circle_bg_show", "mt_view"); - _callui_destroy_end_call_button(priv->contents); evas_object_name_set(priv->caller_info, VIEW_INCOMING_LOCK_LAYOUT_ID); } - if (_callui_lock_manager_is_started(ad->lock_handle) == TRUE) { + + if (_callui_lock_manager_is_started(ad->lock_handle)) { _callui_lock_manager_force_stop(ad->lock_handle); } diff --git a/src/callui-view-incoming-lock.c b/src/callui-view-incoming-lock.c index ed30460..54ccac3 100755 --- a/src/callui-view-incoming-lock.c +++ b/src/callui-view-incoming-lock.c @@ -33,34 +33,27 @@ #define SAFE_C_CAST(type, value) ((type)(ptrdiff_t)value) -static int __callui_view_incoming_lock_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *appdata); -static int __callui_view_incoming_lock_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_incoming_lock_onhide(call_view_data_t *view_data); +static int __callui_view_incoming_lock_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_incoming_lock_onupdate(call_view_data_t *view_data); static int __callui_view_incoming_lock_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_incoming_lock_ondestroy(call_view_data_t *view_data); -static int __callui_view_incoming_lock_onrotate(call_view_data_t *view_data); -call_view_data_t *_callui_view_incoming_lock_new(callui_app_data_t *ad) +call_view_data_t *_callui_view_incoming_lock_new() { - dbg("_callui_view_incoming_lock_new"); - static call_view_data_t incoming_lock_view = { - .type = VIEW_INCOMING_LOCK_VIEW, - .layout = NULL, - .onCreate = __callui_view_incoming_lock_oncreate, - .onUpdate = __callui_view_incoming_lock_onupdate, - .onHide = __callui_view_incoming_lock_onhide, - .onShow = __callui_view_incoming_lock_onshow, - .onDestroy = __callui_view_incoming_lock_ondestroy, - .onRotate = __callui_view_incoming_lock_onrotate, - .priv = NULL, - }; - incoming_lock_view.priv = calloc(1, sizeof(incoming_lock_view_priv_t)); - - if (!incoming_lock_view.priv) { + call_view_data_t *incoming_lock_view = calloc(1, sizeof(call_view_data_t)); + + incoming_lock_view->type = VIEW_TYPE_INCOMING_LOCK; + incoming_lock_view->layout = NULL; + incoming_lock_view->onCreate = __callui_view_incoming_lock_oncreate; + incoming_lock_view->onUpdate = __callui_view_incoming_lock_onupdate; + incoming_lock_view->onDestroy = __callui_view_incoming_lock_ondestroy; + incoming_lock_view->priv = calloc(1, sizeof(incoming_lock_view_priv_t)); + + if (!incoming_lock_view->priv) { err("ERROR!!!!!!!!!!!"); } - return &incoming_lock_view; + return incoming_lock_view; } static void __send_reject_msg_status_cb(msg_handle_t Handle, msg_struct_t pStatus, void *pUserParam) @@ -154,9 +147,12 @@ void _callui_view_incoming_lock_view_send_reject_msg(void *data, call_data_t *ca return; } -static int __callui_view_incoming_lock_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *appdata) +static int __callui_view_incoming_lock_oncreate(call_view_data_t *view_data, void *appdata) { + callui_app_data_t *ad = (callui_app_data_t *)appdata; + view_data->ad = ad; + if (_callui_common_get_idle_lock_type() == LOCK_TYPE_UNLOCK && ad->held == NULL && ad->active == NULL && ad->incom != NULL && ad->active_incoming == false) { @@ -172,7 +168,7 @@ static int __callui_view_incoming_lock_oncreate(call_view_data_t *view_data, uns return 0; } -static int __callui_view_incoming_lock_onupdate(call_view_data_t *view_data, void *update_data1) +static int __callui_view_incoming_lock_onupdate(call_view_data_t *view_data) { dbg("mt-lock view update!!"); callui_app_data_t *ad = _callui_get_app_data(); @@ -180,15 +176,6 @@ static int __callui_view_incoming_lock_onupdate(call_view_data_t *view_data, voi return 0; } -static int __callui_view_incoming_lock_onhide(call_view_data_t *view_data) -{ - dbg("mt-lock view hide!!"); - callui_app_data_t *ad = _callui_get_app_data(); - - evas_object_hide(ad->main_ly); - return 0; -} - static int __callui_view_incoming_lock_onshow(call_view_data_t *view_data, void *appdata) { dbg("mt-lock view show!!"); @@ -413,13 +400,6 @@ static int __callui_view_incoming_lock_ondestroy(call_view_data_t *vd) return 0; } -static int __callui_view_incoming_lock_onrotate(call_view_data_t *view_data) -{ - dbg("*** Incoming view Rotate ***"); - - return 0; -} - Evas_Object *_callui_view_incoming_lock_get_accept_layout(call_view_data_t *vd) { incoming_lock_view_priv_t *priv = NULL; diff --git a/src/callui-view-lock-screen.c b/src/callui-view-lock-screen.c index 194b3ec..99b2869 100755 --- a/src/callui-view-lock-screen.c +++ b/src/callui-view-lock-screen.c @@ -111,7 +111,7 @@ static void __callui_lock_screen_show_layout(lock_screen_data_t *lock_screen_pri evas_object_show(lock_screen_priv->layout); #ifdef _DBUS_DVC_LSD_TIMEOUT_ - if (_callvm_get_top_view_id(ad->view_manager_handle) != VIEW_DIALLING_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) != VIEW_TYPE_DIALLING) { dbg("lcd show"); _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_LOCKSCREEN_SET); } @@ -132,7 +132,7 @@ static void __callui_lock_screen_hide_layout(lock_screen_data_t *lock_screen_pri lock_screen_priv->is_locked = false; #ifdef _DBUS_DVC_LSD_TIMEOUT_ - if (_callvm_get_top_view_id(ad->view_manager_handle) != VIEW_DIALLING_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) != VIEW_TYPE_DIALLING) { dbg("lcd hide"); _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_SET); } @@ -159,11 +159,11 @@ static Eina_Bool __lock_timeout_cb(void *data) priv->no_lock_timer = NULL; - if (_callvm_get_top_view_id(ad->view_manager_handle) >= VIEW_INCALL_MULTICALL_LIST_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) >= VIEW_TYPE_MULTICALL_LIST) { return ECORE_CALLBACK_CANCEL; } - if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCOMING_LOCK_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_INCOMING_LOCK) { return ECORE_CALLBACK_RENEW; } @@ -202,7 +202,7 @@ static bool __callui_lock_screen_create_layout(lock_screen_data_t *priv) CALLUI_RETURN_VALUE_IF_FAIL(priv, false); /* Make Hit rectangle to refresh lock timer */ - hit_rect = evas_object_rectangle_add(ad->evas); + hit_rect = evas_object_rectangle_add(evas_object_evas_get(ad->win)); evas_object_color_set(hit_rect, 0, 0, 0, 0); evas_object_resize(hit_rect, ad->root_w, ad->root_h); evas_object_move(hit_rect, 0, 0); diff --git a/src/callui-view-manager.c b/src/callui-view-manager.c index cbf4954..bacfaab 100644 --- a/src/callui-view-manager.c +++ b/src/callui-view-manager.c @@ -24,236 +24,194 @@ #include "callui-view-multi-call-conf.h" #include "callui-view-multi-call-list.h" #include "callui-view-quickpanel.h" +#include "callui-common.h" typedef call_view_data_t *(*new_view_data_cb) (); -struct _view_manager_data { - new_view_data_cb func_new[VIEW_MAX]; - call_view_data_t *view_st[VIEW_MAX]; - callui_view_id_t view_before_top; - callui_view_id_t view_top; +struct _callui_vm { + new_view_data_cb func_new[VIEW_TYPE_MAX]; + call_view_data_t *cur_view; + callui_view_type_e cur_view_type; + callui_app_data_t *ad; }; +typedef struct _callui_vm callui_vm_t; -static void __callvm_init_view_register_function(view_manager_data_t *vm_data, callui_view_id_t view_id, call_view_data_t *(*view_new) ()) -{ - vm_data->func_new[view_id] = view_new; -} +static int __callui_vm_destroy_cur_view(callui_vm_h vm); +static int __callui_vm_create_update_view(callui_vm_h vm, callui_view_type_e type); +static void __callui_vm_init_view_reg_func(callui_vm_h vm, + callui_view_type_e view_type, + call_view_data_t *(*view_new) ()); -view_manager_data_t *_callvm_init() +static void __callui_vm_init_view_reg_func(callui_vm_h vm, callui_view_type_e view_type, call_view_data_t *(*view_new) ()) { - view_manager_data_t *vm_data = NULL; - - vm_data = (view_manager_data_t *) calloc(1, sizeof(view_manager_data_t)); - CALLUI_RETURN_VALUE_IF_FAIL(vm_data, NULL); - __callvm_init_view_register_function(vm_data, VIEW_DIALLING_VIEW, _callui_dialing_view_dialing_new); - __callvm_init_view_register_function(vm_data, VIEW_INCOMING_LOCK_VIEW, _callui_view_incoming_lock_new); - __callvm_init_view_register_function(vm_data, VIEW_INCALL_ONECALL_VIEW, _callui_view_single_call_new); - __callvm_init_view_register_function(vm_data, VIEW_INCALL_MULTICALL_SPLIT_VIEW, _callui_view_multi_call_split_new); - __callvm_init_view_register_function(vm_data, VIEW_INCALL_MULTICALL_CONF_VIEW, _callui_view_multi_call_conf_new); - __callvm_init_view_register_function(vm_data, VIEW_INCALL_MULTICALL_LIST_VIEW, _callui_view_multi_call_list_new); - __callvm_init_view_register_function(vm_data, VIEW_QUICKPANEL_VIEW, _callui_view_qp_new); - __callvm_init_view_register_function(vm_data, VIEW_ENDCALL_VIEW, _callui_view_callend_new); - vm_data->view_top = VIEW_UNDEFINED_TYPE; - return vm_data; + vm->func_new[view_type] = view_new; } -callui_view_id_t _callvm_get_top_view_id(view_manager_data_t *view_manager_handle) +callui_vm_h _callui_vm_create(callui_app_data_t *ad) { - return view_manager_handle->view_top; -} + CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL); -call_view_data_t *_callvm_get_call_view_data(void *appdata, callui_view_id_t view_id) -{ + callui_vm_h vm = calloc(1, sizeof(callui_vm_t)); - callui_app_data_t *ad = (callui_app_data_t *) appdata; - if (ad->view_manager_handle->view_st[view_id]) { - return (call_view_data_t *) ad->view_manager_handle->view_st[view_id]; - } + CALLUI_RETURN_VALUE_IF_FAIL(vm, NULL); - return NULL; -} + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_DIALLING, _callui_dialing_view_dialing_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_INCOMING_LOCK, _callui_view_incoming_lock_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_SINGLECALL, _callui_view_single_call_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_MULTICALL_SPLIT, _callui_view_multi_call_split_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_MULTICALL_CONF, _callui_view_multi_call_conf_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_MULTICALL_LIST, _callui_view_multi_call_list_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_QUICKPANEL, _callui_view_qp_new); + __callui_vm_init_view_reg_func(vm, VIEW_TYPE_ENDCALL, _callui_view_callend_new); -void _callvm_set_call_view_data(void *appdata, callui_view_id_t view_id, call_view_data_t *vd) -{ - dbg(".."); - callui_app_data_t *ad = (callui_app_data_t *) appdata; + vm->cur_view_type = VIEW_TYPE_UNDEFINED; + vm->ad = ad; - if (vd) { - (ad->view_manager_handle->view_st[view_id]) = vd; - } + return vm; } -Evas_Object *_callvm_get_view_layout(void *appdata) +void _callui_vm_destroy(callui_vm_h vm) { - Evas_Object *layout = NULL; - callui_app_data_t *ad = (callui_app_data_t *)appdata; - CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL); - layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); + CALLUI_RETURN_IF_FAIL(vm); - return layout; -} + __callui_vm_destroy_cur_view(vm); + free(vm); +} -void _callvm_reset_call_view_data(void *appdata, callui_view_id_t view_id) +callui_view_type_e _callui_vm_get_cur_view_type(callui_vm_h vm) { - dbg(".."); - callui_app_data_t *ad = (callui_app_data_t *) appdata; - - info("view:[%d] -> [%d]", ad->view_manager_handle->view_top, view_id); - ad->view_manager_handle->view_st[view_id] = NULL; + if (!vm) { + err("vm is NULL"); + return VIEW_TYPE_UNDEFINED; + } + return vm->cur_view_type; } -static void _callvm_hide_view(call_view_data_t *view) +static int __callui_vm_destroy_cur_view(callui_vm_h vm) { - CALLUI_RETURN_IF_FAIL(view); + int res; + call_view_data_t *view = vm->cur_view; + CALLUI_RETURN_VALUE_IF_FAIL(view, CALLUI_RESULT_FAIL); + CALLUI_RETURN_VALUE_IF_FAIL(view->onDestroy, CALLUI_RESULT_FAIL); - hide_cb hide = view->onHide; - destroy_cb destroy = view->onDestroy; - - if (hide) { - hide(view); - } - if (destroy) { - destroy(view); + if (view->onDestroy) { + res = view->onDestroy(view); } + + free(vm->cur_view); + vm->cur_view = NULL; + vm->cur_view_type = VIEW_TYPE_UNDEFINED; + + return res; } -static call_view_data_t *_callvm_show_view(call_view_data_t *view, new_view_data_cb func_new, unsigned int param1, void *param2, void *ad) +static int __callui_vm_create_update_view(callui_vm_h vm, callui_view_type_e type) { - if (view == NULL) { - dbg("Create view data"); + call_view_data_t *view = vm->cur_view; + int res; - view = func_new(ad); - } - CALLUI_RETURN_VALUE_IF_FAIL(view, NULL); + if (!view) { + dbg("Try create new view [%d]", type); + CALLUI_RETURN_VALUE_IF_FAIL(vm->func_new[type], CALLUI_RESULT_FAIL); - if (view->layout == NULL) { - dbg("Create layout"); + view = vm->func_new[type](); + CALLUI_RETURN_VALUE_IF_FAIL(view, CALLUI_RESULT_FAIL); - create_cb create = view->onCreate; - CALLUI_RETURN_VALUE_IF_FAIL(create, NULL); - create(view, param1, param2, ad); - } else { - dbg("Update layout"); + if (!view->onCreate) { + err("Create callback is NULL"); + free(view); + return CALLUI_RESULT_FAIL; + } + res = view->onCreate(view, vm->ad); + if (res != CALLUI_RESULT_OK) { + err("onCreate callback failed! res[%d]", res); + free(view); + return CALLUI_RESULT_FAIL; + } + vm->cur_view = view; - update_cb update = view->onUpdate; - CALLUI_RETURN_VALUE_IF_FAIL(update, NULL); - update(view, param2); + } else { + dbg("Try update view [%d]", type); + CALLUI_RETURN_VALUE_IF_FAIL(view->onUpdate, CALLUI_RESULT_OK); + view->onUpdate(view); } - - return view; + return CALLUI_RESULT_OK; } -void _callvm_view_change(callui_view_id_t view_id, unsigned int param1, void *param2, void *appdata) +int _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type) { - CALLUI_RETURN_IF_FAIL(appdata); - callui_app_data_t *ad = (callui_app_data_t *)appdata; - info("view:[%d] -> [%d]", ad->view_manager_handle->view_top, view_id); - if ((view_id <= VIEW_UNDEFINED_TYPE) || (view_id >= VIEW_MAX)) { - err("[=========== ERROR!!!! Invalid View ID : %d =================]", view_id); - return; - } + CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM); - call_view_data_t **views = ad->view_manager_handle->view_st; + if ((type <= VIEW_TYPE_UNDEFINED) || (type >= VIEW_TYPE_MAX)) { + err("Invalid view type [%d]", type); + return CALLUI_RESULT_INVALID_PARAM; + } - callui_view_id_t last_view_id = ad->view_manager_handle->view_top; - ad->view_manager_handle->view_before_top = last_view_id; /* hold the current top window in the before_top pointer */ - ad->view_manager_handle->view_top = view_id; /* set the new top window to the view_id which is passed... this step enables in setting 00:00:00 as timer */ - new_view_data_cb func_new = ad->view_manager_handle->func_new[view_id]; + info("Change view: [%d] -> [%d]", vm->cur_view_type, type); + int res; + callui_view_type_e last_view_type = vm->cur_view_type; - if ((last_view_id != VIEW_UNDEFINED_TYPE) && (last_view_id != view_id)) { - dbg("hide & destroy [%d]", last_view_id); - _callvm_hide_view(views[last_view_id]); - views[last_view_id] = NULL; + if ((last_view_type != VIEW_TYPE_UNDEFINED) && (last_view_type != type)) { + dbg("hide & destroy [%d]", last_view_type); + res = __callui_vm_destroy_cur_view(vm); + CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); } - views[view_id] = _callvm_show_view(views[view_id], func_new, param1, param2, appdata); - if (view_id == VIEW_DIALLING_VIEW || view_id == VIEW_INCOMING_LOCK_VIEW) { - elm_win_activate(ad->win); + res = __callui_vm_create_update_view(vm, type); + CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); + + vm->cur_view_type = type; + + if (type == VIEW_TYPE_DIALLING || type == VIEW_TYPE_INCOMING_LOCK) { + elm_win_activate(vm->ad->win); } - if (view_id != VIEW_ENDCALL_VIEW) { + if (type != VIEW_TYPE_ENDCALL) { + // TODO: currently not working functionality. + // Will be replaced in QP commit. _callui_view_quickpanel_change(); } - evas_object_show(ad->win); - dbg("End"); + evas_object_show(vm->ad->win); + return CALLUI_RESULT_OK; } -void _callvm_view_auto_change(void *appdata) +int _callui_vm_auto_change_view(callui_vm_h vm) { - dbg("_callvm_view_auto_change"); - callui_app_data_t *ad = (callui_app_data_t *)appdata; - if (ad == NULL) { - err("Invalid AppData"); - return; - } + CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM); + + callui_app_data_t *ad = vm->ad; if (ad->multi_call_list_end_clicked) { ad->multi_call_list_end_clicked = false; if (ad->active && ad->active->member_count > 1) { - _callvm_view_change(VIEW_INCALL_MULTICALL_LIST_VIEW, 0, NULL, ad); - return; + return _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_LIST); } } + int res; if (ad->incom) { - _callvm_view_change(VIEW_INCOMING_LOCK_VIEW, 0, NULL, ad); - return; + res = _callui_vm_change_view(vm, VIEW_TYPE_INCOMING_LOCK); } else if (ad->active) { if (CM_CALL_STATE_DIALING == ad->active->call_state) { - _callvm_view_change(VIEW_DIALLING_VIEW, 0, NULL, ad); + res = _callui_vm_change_view(vm, VIEW_TYPE_DIALLING); } else if (ad->held) { - _callvm_view_change(VIEW_INCALL_MULTICALL_SPLIT_VIEW, 0, NULL, ad); + res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_SPLIT); } else if (ad->active->member_count > 1) { - _callvm_view_change(VIEW_INCALL_MULTICALL_CONF_VIEW, 0, NULL, ad); + res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_CONF); } else { - _callvm_view_change(VIEW_INCALL_ONECALL_VIEW, 0, NULL, ad); + res = _callui_vm_change_view(vm, VIEW_TYPE_SINGLECALL); } - return; } else if (ad->held) { if (ad->held->member_count > 1) { - _callvm_view_change(VIEW_INCALL_MULTICALL_CONF_VIEW, 0, NULL, ad); + res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_CONF); } else { - _callvm_view_change(VIEW_INCALL_ONECALL_VIEW, 0, NULL, ad); + res = _callui_vm_change_view(vm, VIEW_TYPE_SINGLECALL); } } else { err("No call exist"); + res = CALLUI_RESULT_FAIL; } - return; + return res; } - -static void __callvm_terminate_app(void *data) -{ - dbg(".."); - lock_data_t *lock_h = data; - _callui_lock_manager_destroy(lock_h); - elm_exit(); -} - -void _callvm_terminate_app_or_view_change(void *appdata) -{ - callui_app_data_t *ad = (callui_app_data_t *)appdata; - view_manager_data_t *vd = ad->view_manager_handle; - int i = 0; - if ((NULL == ad->active) && (NULL == ad->incom) && (NULL == ad->held)) { - warn("No call exist. App will be terminated"); - for (i = 0; i < VIEW_MAX; i++) { - if (vd->view_st[i] != NULL) { - dbg("hide & destory [%d]", i); - vd->view_st[i]->onHide(vd->view_st[i]); - vd->view_st[i]->onDestroy(vd->view_st[i]); - } - } - vd->view_top = VIEW_UNDEFINED_TYPE; - if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) { - _callui_lock_manager_set_callback_on_unlock(ad->lock_handle, __callvm_terminate_app, ad->lock_handle); - } else { - __callvm_terminate_app(ad->lock_handle); - } - } else { - _callvm_view_auto_change(ad); - } - return; -} - diff --git a/src/callui-view-multi-call-conf.c b/src/callui-view-multi-call-conf.c index 7cda0f9..1fa9853 100755 --- a/src/callui-view-multi-call-conf.c +++ b/src/callui-view-multi-call-conf.c @@ -32,41 +32,32 @@ typedef struct { Eina_Bool is_held; } callui_view_multi_call_conf_priv_t; -static int __callui_view_multi_call_conf_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3); -static int __callui_view_multi_call_conf_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_multi_call_conf_onhide(call_view_data_t *view_data); +static int __callui_view_multi_call_conf_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_multi_call_conf_onupdate(call_view_data_t *view_data); static int __callui_view_multi_call_conf_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_multi_call_conf_ondestroy(call_view_data_t *view_data); -static int __callui_view_multi_call_conf_onrotate(call_view_data_t *view_data); - -static call_view_data_t s_view = { - .type = VIEW_INCALL_MULTICALL_CONF_VIEW, - .layout = NULL, - .onCreate = __callui_view_multi_call_conf_oncreate, - .onUpdate = __callui_view_multi_call_conf_onupdate, - .onHide = __callui_view_multi_call_conf_onhide, - .onShow = __callui_view_multi_call_conf_onshow, - .onDestroy = __callui_view_multi_call_conf_ondestroy, - .onRotate = __callui_view_multi_call_conf_onrotate, - .priv = NULL, -}; - -call_view_data_t *_callui_view_multi_call_conf_new(callui_app_data_t *ad) -{ - s_view.priv = calloc(1, sizeof(callui_view_multi_call_conf_priv_t)); - if (!s_view.priv) { +call_view_data_t *_callui_view_multi_call_conf_new() +{ + call_view_data_t *multi_call_conf_view = calloc(1, sizeof(call_view_data_t)); + multi_call_conf_view->type = VIEW_TYPE_MULTICALL_CONF; + multi_call_conf_view->layout = NULL; + multi_call_conf_view->onCreate = __callui_view_multi_call_conf_oncreate; + multi_call_conf_view->onUpdate = __callui_view_multi_call_conf_onupdate; + multi_call_conf_view->onDestroy = __callui_view_multi_call_conf_ondestroy; + + multi_call_conf_view->priv = calloc(1, sizeof(callui_view_multi_call_conf_priv_t)); + if (!multi_call_conf_view->priv) { err("ERROR!!!!!!!!!!! "); } - - return &s_view; + return multi_call_conf_view; } static void __callui_view_manage_btn_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source) { dbg(".."); callui_app_data_t *ad = _callui_get_app_data(); - _callvm_view_change(VIEW_INCALL_MULTICALL_LIST_VIEW, 0, 0, ad); + _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_MULTICALL_LIST); return; } @@ -162,10 +153,12 @@ static void __callui_view_multi_call_conf_more_btn_cb(void *data, Evas_Object *o return; } -static int __callui_view_multi_call_conf_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3) +static int __callui_view_multi_call_conf_oncreate(call_view_data_t *view_data, void *appdata) { callui_view_multi_call_conf_priv_t *priv = (callui_view_multi_call_conf_priv_t *)view_data->priv; - callui_app_data_t *ad = _callui_get_app_data(); + callui_app_data_t *ad = (callui_app_data_t *)appdata; + + view_data->ad = ad; if (ad->main_ly) { /* Create Main Layout */ @@ -209,7 +202,7 @@ static int __callui_view_multi_call_conf_oncreate(call_view_data_t *view_data, u return 0; } -static int __callui_view_multi_call_conf_onupdate(call_view_data_t *view_data, void *update_data1) +static int __callui_view_multi_call_conf_onupdate(call_view_data_t *view_data) { dbg("multicall-conf view update"); @@ -217,14 +210,6 @@ static int __callui_view_multi_call_conf_onupdate(call_view_data_t *view_data, v return 0; } -static int __callui_view_multi_call_conf_onhide(call_view_data_t *view_data) -{ - dbg("multicall-conf view hide"); - callui_app_data_t *ad = _callui_get_app_data(); - evas_object_hide(ad->main_ly); - return 0; -} - static int __callui_view_multi_call_conf_onshow(call_view_data_t *view_data, void *appdata) { dbg("multicall-conf view show"); @@ -240,14 +225,13 @@ static int __callui_view_multi_call_conf_onshow(call_view_data_t *view_data, vo return 0; } -static int __callui_view_multi_call_conf_ondestroy(call_view_data_t *view_data) +static int __callui_view_multi_call_conf_ondestroy(call_view_data_t *vd) { - dbg("multicall-conf view destroy"); - callui_app_data_t *ad = _callui_get_app_data(); - CALLUI_RETURN_VALUE_IF_FAIL(ad, -1); - - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCALL_MULTICALL_CONF_VIEW); CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); + CALLUI_RETURN_VALUE_IF_FAIL(vd->ad, -1); + + callui_app_data_t *ad = vd->ad; + callui_view_multi_call_conf_priv_t *priv = (callui_view_multi_call_conf_priv_t *)vd->priv; if (priv != NULL) { @@ -278,25 +262,5 @@ static int __callui_view_multi_call_conf_ondestroy(call_view_data_t *view_data) priv = NULL; } - _callvm_reset_call_view_data(ad, VIEW_INCALL_MULTICALL_CONF_VIEW); - - dbg("complete destroy multi view conf"); - return 0; } - -static int __callui_view_multi_call_conf_onrotate(call_view_data_t *view_data) -{ - dbg("*** Multi Call conf-view Rotate ***"); - callui_view_multi_call_conf_priv_t *priv = view_data->priv; - callui_app_data_t *ad = _callui_get_app_data(); - - elm_object_signal_emit(priv->contents, "set_portrait", "multicall_conf_layout"); - elm_object_signal_emit(priv->contents, "SHOW_NO_EFFECT", "ALLBTN"); - elm_object_signal_emit(priv->caller_info, "set_portrait", "caller_info_layout"); - - evas_object_show(ad->win); - - return 0; -} - diff --git a/src/callui-view-multi-call-list.c b/src/callui-view-multi-call-list.c index 1a24fcd..0004890 100755 --- a/src/callui-view-multi-call-list.c +++ b/src/callui-view-multi-call-list.c @@ -31,30 +31,22 @@ typedef struct { GSList *call_list; } callui_view_multi_call_list_priv_t; -static int __callui_view_multi_call_list_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3); -static int __callui_view_multi_call_list_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_multi_call_list_onhide(call_view_data_t *view_data); +static int __callui_view_multi_call_list_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_multi_call_list_onupdate(call_view_data_t *view_data); static int __callui_view_multi_call_list_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_multi_call_list_ondestroy(call_view_data_t *view_data); -static int __callui_view_multi_call_list_onrotate(call_view_data_t *view_data); - -static call_view_data_t s_view = { - .type = VIEW_INCALL_MULTICALL_LIST_VIEW, - .layout = NULL, - .onCreate = __callui_view_multi_call_list_oncreate, - .onUpdate = __callui_view_multi_call_list_onupdate, - .onHide = __callui_view_multi_call_list_onhide, - .onShow = __callui_view_multi_call_list_onshow, - .onDestroy = __callui_view_multi_call_list_ondestroy, - .onRotate = __callui_view_multi_call_list_onrotate, - .priv = NULL, -}; call_view_data_t *_callui_view_multi_call_list_new(callui_app_data_t *ad) { - s_view.priv = calloc(1, sizeof(callui_view_multi_call_list_priv_t)); - CALLUI_RETURN_VALUE_IF_FAIL(s_view.priv, NULL); - return &s_view; + call_view_data_t* multi_call_list_view = calloc(1, sizeof(call_view_data_t)); + multi_call_list_view->type = VIEW_TYPE_MULTICALL_LIST; + multi_call_list_view->layout = NULL; + multi_call_list_view->onCreate = __callui_view_multi_call_list_oncreate; + multi_call_list_view->onUpdate = __callui_view_multi_call_list_onupdate; + multi_call_list_view->onDestroy = __callui_view_multi_call_list_ondestroy; + multi_call_list_view->priv = calloc(1, sizeof(callui_view_multi_call_list_priv_t)); + CALLUI_RETURN_VALUE_IF_FAIL(multi_call_list_view->priv, NULL); + return multi_call_list_view; } static void __callui_view_multi_call_list_small_end_call_cb(void *data, Evas_Object *obj, void *event_info) @@ -224,7 +216,7 @@ void __callui_view_multi_call_list_genlist_item_append(void *data) static void __callui_view_multi_call_list_back_cb(void *data, Evas_Object *obj, void *event_info) { callui_app_data_t *ad = (callui_app_data_t *)data; - _callvm_view_auto_change(ad); + _callui_vm_auto_change_view(ad->view_manager_handle); } static Evas_Object *__callui_view_multi_call_list_create_contents(Evas_Object *parent, char *group) @@ -244,10 +236,12 @@ static Evas_Object *__callui_view_multi_call_list_create_contents(Evas_Object *p return eo; } -static int __callui_view_multi_call_list_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3) +static int __callui_view_multi_call_list_oncreate(call_view_data_t *view_data, void *appdata) { dbg("multicall-list view create"); + view_data->ad = (callui_app_data_t *)appdata; + __callui_view_multi_call_list_onshow(view_data, NULL); return 0; @@ -259,7 +253,7 @@ static void __callui_view_multi_call_list_free_cb(gpointer data) cm_conf_call_data_free(call_data); } -static int __callui_view_multi_call_list_onupdate(call_view_data_t *view_data, void *update_data1) +static int __callui_view_multi_call_list_onupdate(call_view_data_t *view_data) { dbg("multicall-list view update"); @@ -285,14 +279,6 @@ static int __callui_view_multi_call_list_onupdate(call_view_data_t *view_data, v return 0; } -static int __callui_view_multi_call_list_onhide(call_view_data_t *view_data) -{ - dbg("multicall-list view hide"); - callui_app_data_t *ad = _callui_get_app_data(); - evas_object_hide(ad->main_ly); - return 0; -} - static int __callui_view_multi_call_list_onshow(call_view_data_t *view_data, void *appdata) { dbg("multicall-list view show"); @@ -340,14 +326,13 @@ static int __callui_view_multi_call_list_onshow(call_view_data_t *view_data, vo return 0; } -static int __callui_view_multi_call_list_ondestroy(call_view_data_t *view_data) +static int __callui_view_multi_call_list_ondestroy(call_view_data_t *vd) { - dbg("multicall-list view destroy"); - - callui_app_data_t *ad = _callui_get_app_data(); - CALLUI_RETURN_VALUE_IF_FAIL(ad, -1); - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCALL_MULTICALL_LIST_VIEW); CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); + CALLUI_RETURN_VALUE_IF_FAIL(vd->ad, -1); + + callui_app_data_t *ad = vd->ad; + callui_view_multi_call_list_priv_t *priv = (callui_view_multi_call_list_priv_t *)vd->priv; if (priv != NULL) { @@ -364,17 +349,6 @@ static int __callui_view_multi_call_list_ondestroy(call_view_data_t *view_data) priv = NULL; } vd->layout = NULL; - _callvm_reset_call_view_data(ad, VIEW_INCALL_MULTICALL_LIST_VIEW); - dbg("complete destroy multi view list"); - return 0; -} -static int __callui_view_multi_call_list_onrotate(call_view_data_t *view_data) -{ - dbg("*** Multi Call List view Rotate ***"); - - __callui_view_multi_call_list_onshow(view_data, NULL); return 0; } - - diff --git a/src/callui-view-multi-call-split.c b/src/callui-view-multi-call-split.c index a414e04..800e32e 100755 --- a/src/callui-view-multi-call-split.c +++ b/src/callui-view-multi-call-split.c @@ -51,23 +51,11 @@ static void _manage_callers_cb(void *data, Evas_Object *obj, const char *emissio static void _merge_cb(void *data, Evas_Object *obj, const char *emission, const char *source); static void _swap_cb(void *data, Evas_Object *obj, const char *emission, const char *source); -static int _callui_view_multi_call_split_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3); -static int _callui_view_multi_call_split_onupdate(call_view_data_t *view_data, void *update_data1); +static int _callui_view_multi_call_split_oncreate(call_view_data_t *view_data, void *appdata); +static int _callui_view_multi_call_split_onupdate(call_view_data_t *view_data); static int _callui_view_multi_call_split_onshow(call_view_data_t *view_data, void *appdata); static int _callui_view_multi_call_split_ondestroy(call_view_data_t *view_data); -static call_view_data_t s_view = { - .type = VIEW_INCALL_MULTICALL_SPLIT_VIEW, - .layout = NULL, - .onCreate = _callui_view_multi_call_split_oncreate, - .onUpdate = _callui_view_multi_call_split_onupdate, - .onHide = NULL, - .onShow = _callui_view_multi_call_split_onshow, - .onDestroy = _callui_view_multi_call_split_ondestroy, - .onRotate = NULL, - .priv = NULL, -}; - static Evas_Object *_create_merge_swap_btn(Evas_Object *parent, const char *name, const char *text) { Evas_Object *layout = elm_layout_add(parent); @@ -224,7 +212,7 @@ static void _callui_view_multi_call_split_draw_screen(Evas_Object *eo, void *dat static void _manage_callers_cb(void *data, Evas_Object *obj, const char *emission, const char *source) { callui_app_data_t *ad = data; - _callvm_view_change(VIEW_INCALL_MULTICALL_LIST_VIEW, 0, NULL, ad); + _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_MULTICALL_LIST); } static void _merge_cb(void *data, Evas_Object *obj, const char *emission, const char *source) @@ -245,11 +233,12 @@ static void _swap_cb(void *data, Evas_Object *obj, const char *emission, const c } } -static int _callui_view_multi_call_split_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3) +static int _callui_view_multi_call_split_oncreate(call_view_data_t *view_data, void *appdata) { dbg("multi-split view create"); - callui_app_data_t *ad = _callui_get_app_data(); + callui_app_data_t *ad = (callui_app_data_t *)appdata; + view_data->ad = ad; _callui_view_multi_call_split_onshow(view_data, ad); _callui_lock_manager_start(ad->lock_handle); @@ -257,7 +246,7 @@ static int _callui_view_multi_call_split_oncreate(call_view_data_t *view_data, u return 0; } -static int _callui_view_multi_call_split_onupdate(call_view_data_t *view_data, void *update_data1) +static int _callui_view_multi_call_split_onupdate(call_view_data_t *view_data) { dbg("multi-split view update"); callui_app_data_t *ad = _callui_get_app_data(); @@ -279,29 +268,29 @@ static int _callui_view_multi_call_split_onshow(call_view_data_t *view_data, voi return 0; } -static int _callui_view_multi_call_split_ondestroy(call_view_data_t *view_data) +static int _callui_view_multi_call_split_ondestroy(call_view_data_t *vd) { - dbg("multi-split view destroy"); - - callui_app_data_t *ad = _callui_get_app_data(); - - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCALL_MULTICALL_SPLIT_VIEW); CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); free(vd->priv); vd->priv = NULL; - _callvm_reset_call_view_data(ad, VIEW_INCALL_MULTICALL_SPLIT_VIEW); return 0; } -call_view_data_t *_callui_view_multi_call_split_new(callui_app_data_t*ad) +call_view_data_t *_callui_view_multi_call_split_new() { - s_view.priv = calloc(1, sizeof(incall_multi_view_split_priv_t)); - - if (!s_view.priv) { + call_view_data_t *multi_call_split_view = calloc(1, sizeof(call_view_data_t)); + + multi_call_split_view->type = VIEW_TYPE_MULTICALL_SPLIT; + multi_call_split_view->layout = NULL; + multi_call_split_view->onCreate = _callui_view_multi_call_split_oncreate; + multi_call_split_view->onUpdate = _callui_view_multi_call_split_onupdate; + multi_call_split_view->onDestroy = _callui_view_multi_call_split_ondestroy; + multi_call_split_view->priv = calloc(1, sizeof(incall_multi_view_split_priv_t)); + if (!multi_call_split_view->priv) { err("ERROR!"); } - return &s_view; + return multi_call_split_view; } diff --git a/src/callui-view-quickpanel.c b/src/callui-view-quickpanel.c index e88537a..b3bd604 100755 --- a/src/callui-view-quickpanel.c +++ b/src/callui-view-quickpanel.c @@ -36,50 +36,50 @@ struct callui_view_qp_priv { int rotate_angle; //Ecore_Event_Handler *client_msg_handler; }; +typedef struct callui_view_qp_priv callui_view_qp_priv_t; + static Evas_Object *__callui_view_qp_create_contents(void *data, char *group); -static int __callui_view_qp_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3); -static int __callui_view_qp_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_qp_onhide(call_view_data_t *view_data); +static int __callui_view_qp_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_qp_onupdate(call_view_data_t *view_data); static int __callui_view_qp_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_qp_ondestroy(call_view_data_t *view_data); // TODO ecore x atom actions are not supported. Need to move on event from mini controller. //static Eina_Bool __callui_qp_client_message_cb(void *data, int type, void *event); -call_view_data_t *_callui_view_qp_new(callui_app_data_t *ad) +call_view_data_t *_callui_view_qp_new() { - static call_view_data_t qp_view = { - .type = VIEW_QUICKPANEL_VIEW, - .layout = NULL, - .onCreate = __callui_view_qp_oncreate, - .onUpdate = __callui_view_qp_onupdate, - .onHide = __callui_view_qp_onhide, - .onShow = __callui_view_qp_onshow, - .onDestroy = __callui_view_qp_ondestroy, - .onRotate = NULL, - .priv = NULL, - }; - qp_view.priv = calloc(1, sizeof(callui_view_qp_priv_t)); - if (!qp_view.priv) { + call_view_data_t *qp_view = calloc(1, sizeof(call_view_data_t)); + + qp_view->type = VIEW_TYPE_QUICKPANEL, + qp_view->layout = NULL, + qp_view->onCreate = __callui_view_qp_oncreate, + qp_view->onUpdate = __callui_view_qp_onupdate, + qp_view->onDestroy = __callui_view_qp_ondestroy, + qp_view->priv = NULL, + + qp_view->priv = calloc(1, sizeof(callui_view_qp_priv_t)); + if (!qp_view->priv) { err("ERROR!!!!!!!!!!! "); } - return &qp_view; + return qp_view; }; void _callui_view_quickpanel_change(void) { - dbg(".."); + // TODO: need to refactor logic + /*dbg(".."); callui_app_data_t *ad = _callui_get_app_data(); CALLUI_RETURN_IF_FAIL(ad); - call_view_data_t *view_data = _callvm_get_call_view_data(ad, VIEW_QUICKPANEL_VIEW); + call_view_data_t *view_data = _callui_vm_get_call_view_data(ad, VIEW_TYPE_QUICKPANEL); if (ad->win_quickpanel) { if (!(ad->held) && !(ad->active) && (!ad->incom)) { dbg("destroy quickpanel"); _callui_view_qp_hide(ad); - _callvm_reset_call_view_data(ad, VIEW_QUICKPANEL_VIEW); + _callui_vm_reset_call_view_data(ad, VIEW_TYPE_QUICKPANEL); ad->win_quickpanel = NULL; } else if (view_data && view_data->layout != NULL) { dbg("update quickpanel"); @@ -90,12 +90,12 @@ void _callui_view_quickpanel_change(void) if (view_data == NULL) { view_data = _callui_view_qp_new(ad); CALLUI_RETURN_IF_FAIL(view_data); - _callvm_set_call_view_data(ad, VIEW_QUICKPANEL_VIEW, view_data); + _callui_vm_set_call_view_data(ad, VIEW_TYPE_QUICKPANEL, view_data); } if (view_data->layout == NULL) { __callui_view_qp_oncreate(view_data, 0, NULL, ad); } - } + }*/ } // TODO ecore x atom actions are not supported. Need to move on event from mini controller. @@ -577,13 +577,15 @@ static Evas_Object *__callui_view_qp_create_contents(void *data, char *group) return eo; } -static int __callui_view_qp_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *appdata) +static int __callui_view_qp_oncreate(call_view_data_t *view_data, void *appdata) { dbg("quickpanel view create!!"); callui_app_data_t *ad = (callui_app_data_t *) appdata; + callui_view_qp_priv_t *priv = (callui_view_qp_priv_t *)view_data->priv; ad->view_data = view_data; + view_data->ad = ad; if (!view_data->layout) { ad->win_quickpanel = __callui_view_qp_create_window(); if (ad->win_quickpanel == NULL) { @@ -617,7 +619,7 @@ static int __callui_view_qp_oncreate(call_view_data_t *view_data, unsigned int p return 0; } -static int __callui_view_qp_onupdate(call_view_data_t *view_data, void *update_data1) +static int __callui_view_qp_onupdate(call_view_data_t *view_data) { dbg("quickpanel view update!!"); @@ -625,14 +627,6 @@ static int __callui_view_qp_onupdate(call_view_data_t *view_data, void *update_d return 0; } -static int __callui_view_qp_onhide(call_view_data_t *view_data) -{ - dbg("quickpanel view hide!!"); - - evas_object_hide(view_data->layout); - return 0; -} - static int __callui_view_qp_onshow(call_view_data_t *view_data, void *appdata) { dbg("quickpanel view show!!"); @@ -659,14 +653,12 @@ static int __callui_view_qp_onshow(call_view_data_t *view_data, void *appdata) return 0; } -static int __callui_view_qp_ondestroy(call_view_data_t *view_data) +static int __callui_view_qp_ondestroy(call_view_data_t *vd) { - dbg("quickpanel view destroy!!"); - - callui_app_data_t *ad = _callui_get_app_data(); - CALLUI_RETURN_VALUE_IF_FAIL(ad, -1); - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_QUICKPANEL_VIEW); CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); + CALLUI_RETURN_VALUE_IF_FAIL(vd->ad, -1); + + callui_app_data_t *ad = vd->ad; callui_view_qp_priv_t *priv = (callui_view_qp_priv_t *)vd->priv; @@ -694,8 +686,6 @@ static int __callui_view_qp_ondestroy(call_view_data_t *view_data) vd->layout = NULL; } - _callvm_reset_call_view_data(ad, VIEW_QUICKPANEL_VIEW); - if (ad->win_quickpanel) { evas_object_del(ad->win_quickpanel); ad->win_quickpanel = NULL; diff --git a/src/callui-view-single-call.c b/src/callui-view-single-call.c index 4280f15..05d0735 100644 --- a/src/callui-view-single-call.c +++ b/src/callui-view-single-call.c @@ -29,35 +29,30 @@ struct incall_one_view_priv { Evas_Object *btn_ly; Evas_Object *ic; }; +typedef struct incall_one_view_priv incall_one_view_priv_t; -static int __callui_view_single_call_oncreate(call_view_data_t *view_data, unsigned int param1, void *param2, void *param3); -static int __callui_view_single_call_onupdate(call_view_data_t *view_data, void *update_data1); -static int __callui_view_single_call_onhide(call_view_data_t *view_data); +static int __callui_view_single_call_oncreate(call_view_data_t *view_data, void *appdata); +static int __callui_view_single_call_onupdate(call_view_data_t *view_data); static int __callui_view_single_call_onshow(call_view_data_t *view_data, void *appdata); static int __callui_view_single_call_ondestroy(call_view_data_t *view_data); static Evas_Object *__callui_view_single_call_create_contents(void *data, char *grpname); -static int __callui_view_single_call_onRotate(call_view_data_t *view_data); -call_view_data_t *_callui_view_single_call_new(callui_app_data_t *ad) +call_view_data_t *_callui_view_single_call_new() { - static call_view_data_t one_call_view = { - .type = VIEW_INCALL_ONECALL_VIEW, - .layout = NULL, - .onCreate = __callui_view_single_call_oncreate, - .onUpdate = __callui_view_single_call_onupdate, - .onHide = __callui_view_single_call_onhide, - .onShow = __callui_view_single_call_onshow, - .onDestroy = __callui_view_single_call_ondestroy, - .onRotate = __callui_view_single_call_onRotate, - .priv = NULL, - }; - one_call_view.priv = calloc(1, sizeof(incall_one_view_priv_t)); - - if (!one_call_view.priv) { + call_view_data_t *single_call_view = calloc(1, sizeof(call_view_data_t)); + + single_call_view->type = VIEW_TYPE_SINGLECALL; + single_call_view->layout = NULL; + single_call_view->onCreate = __callui_view_single_call_oncreate; + single_call_view->onUpdate = __callui_view_single_call_onupdate; + single_call_view->onDestroy = __callui_view_single_call_ondestroy; + single_call_view->priv = calloc(1, sizeof(incall_one_view_priv_t)); + + if (!single_call_view->priv) { err("ERROR!!!!!!!!!!! "); } - return &one_call_view; + return single_call_view; } static Evas_Object *__callui_view_single_call_create_contents(void *data, char *grpname) @@ -178,13 +173,14 @@ static void __callui_view_single_call_draw_screen(callui_app_data_t *ad, Evas_Ob evas_object_show(eo); } -static int __callui_view_single_call_oncreate(call_view_data_t *vd, unsigned int param1, void *param2, void *appdata) +static int __callui_view_single_call_oncreate(call_view_data_t *vd, void *appdata) { dbg("incall view create"); incall_one_view_priv_t *priv = (incall_one_view_priv_t *)vd->priv; callui_app_data_t *ad = (callui_app_data_t *) appdata; call_data_t *call_data = NULL; + vd->ad = ad; if (ad->active) { call_data = ad->active; @@ -229,7 +225,7 @@ static int __callui_view_single_call_oncreate(call_view_data_t *vd, unsigned int return 0; } -static int __callui_view_single_call_onupdate(call_view_data_t *view_data, void *update_data) +static int __callui_view_single_call_onupdate(call_view_data_t *view_data) { dbg("incall view update"); callui_app_data_t *ad = _callui_get_app_data(); @@ -237,15 +233,6 @@ static int __callui_view_single_call_onupdate(call_view_data_t *view_data, void return 0; } -static int __callui_view_single_call_onhide(call_view_data_t *view_data) -{ - dbg("incall view hide"); - callui_app_data_t *ad = _callui_get_app_data(); - - evas_object_hide(ad->main_ly); - return 0; -} - static int __callui_view_single_call_onshow(call_view_data_t *view_data, void *appdata) { dbg("incall view show"); @@ -260,15 +247,13 @@ static int __callui_view_single_call_onshow(call_view_data_t *view_data, void *a return 0; } -static int __callui_view_single_call_ondestroy(call_view_data_t *view_data) +static int __callui_view_single_call_ondestroy(call_view_data_t *vd) { - dbg("incall view destroy"); - callui_app_data_t *ad = _callui_get_app_data(); - CALLUI_RETURN_VALUE_IF_FAIL(ad, -1); + CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); + CALLUI_RETURN_VALUE_IF_FAIL(vd->ad, -1); + callui_app_data_t *ad = vd->ad; - call_view_data_t *vd = _callvm_get_call_view_data(ad, VIEW_INCALL_ONECALL_VIEW); - CALLUI_RETURN_VALUE_IF_FAIL(vd, -1); incall_one_view_priv_t *priv = (incall_one_view_priv_t *)vd->priv; if (priv != NULL) { @@ -290,14 +275,6 @@ static int __callui_view_single_call_ondestroy(call_view_data_t *view_data) priv = NULL; } - _callvm_reset_call_view_data(ad, VIEW_INCALL_ONECALL_VIEW); - dbg("complete destroy one view"); return 0; } - -static int __callui_view_single_call_onRotate(call_view_data_t *view_data) -{ - return 0; -} - diff --git a/src/callui.c b/src/callui.c index cdf4c99..3645790 100755 --- a/src/callui.c +++ b/src/callui.c @@ -36,6 +36,8 @@ static bool _callui_app_create_layout(void *data); static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *event); static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *event); +static void __callui_app_terminate(void *data); +static void __callui_app_terminate_or_view_change(callui_app_data_t *ad); static callui_app_data_t g_ad; @@ -155,7 +157,7 @@ static void __callui_process_incoming_call(callui_app_data_t *ad) CALLUI_RETURN_IF_FAIL(cm_incom); __callui_update_call_data(&(ad->incom), cm_incom); - _callvm_view_change(VIEW_INCOMING_LOCK_VIEW, 0, NULL, ad); + _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_INCOMING_LOCK); cm_call_data_free(cm_incom); return; @@ -168,7 +170,7 @@ static void __callui_process_outgoing_call(callui_app_data_t *ad, char *number) if (CM_ERROR_NONE != cm_dial_call(ad->cm_handle, number, CM_CALL_TYPE_VOICE, CM_SIM_SLOT_DEFAULT_E)) { err("cm_dial_call failed!!"); - _callvm_terminate_app_or_view_change(ad); + __callui_app_terminate_or_view_change(ad); return; } ad->waiting_dialing = true; @@ -194,7 +196,7 @@ static void __callui_call_event_cb(cm_call_event_e call_event, cm_call_event_dat } __callui_update_all_call_data(ad, call_state_data); _callui_common_create_duration_timer(); - _callvm_view_auto_change(ad); + _callui_vm_auto_change_view(ad->view_manager_handle); #ifdef _DBUS_DVC_LSD_TIMEOUT_ if (ad->speaker_status == EINA_TRUE) { @@ -219,15 +221,15 @@ static void __callui_call_event_cb(cm_call_event_e call_event, cm_call_event_dat cm_call_event_data_get_held_call(call_state_data, &held_call); if ((ad->incom) && (call_id == ad->incom->call_id)) { __callui_update_all_call_data(ad, call_state_data); - _callvm_terminate_app_or_view_change(ad); + __callui_app_terminate_or_view_change(ad); } else if (incom_call == NULL && active_call == NULL && held_call == NULL) { _callui_common_delete_duration_timer(); - _callvm_view_change(VIEW_ENDCALL_VIEW, call_id, NULL, ad); + _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_ENDCALL); _callui_lock_manager_stop(ad->lock_handle); __callui_update_all_call_data(ad, call_state_data); } else { __callui_update_all_call_data(ad, call_state_data); - _callvm_terminate_app_or_view_change(ad); + __callui_app_terminate_or_view_change(ad); } } break; @@ -235,7 +237,7 @@ static void __callui_call_event_cb(cm_call_event_e call_event, cm_call_event_dat { _callui_common_dvc_control_lcd_state(LCD_ON_LOCK); __callui_update_all_call_data(ad, call_state_data); - _callvm_view_auto_change(ad); + _callui_vm_auto_change_view(ad->view_manager_handle); } break; case CM_CALL_EVENT_DIALING: @@ -245,7 +247,7 @@ static void __callui_call_event_cb(cm_call_event_e call_event, cm_call_event_dat case CM_CALL_EVENT_JOIN: case CM_CALL_EVENT_SPLIT: __callui_update_all_call_data(ad, call_state_data); - _callvm_view_auto_change(ad); + _callui_vm_auto_change_view(ad->view_manager_handle); break; default: break; @@ -351,7 +353,7 @@ static void __callui_bt_init() } } -static gboolean __callui_init(callui_app_data_t *ad) +static gboolean __callui_init_sys_api(callui_app_data_t *ad) { dbg(".."); @@ -364,7 +366,6 @@ static gboolean __callui_init(callui_app_data_t *ad) __callui_bt_init(); - ad->view_manager_handle = _callvm_init(); return true; } @@ -459,19 +460,19 @@ static void __callui_app_text_classes_set() static bool _callui_app_create(void *data) { - dbg(".."); + CALLUI_RETURN_VALUE_IF_FAIL(data, false); + callui_app_data_t *ad = data; - int ret = 0; - /* Set base scale */ elm_app_base_scale_set(2.6); + elm_config_preferred_engine_set("opengl_x11"); + _callui_common_dvc_control_lcd_state(LCD_OFF_SLEEP_LOCK); - elm_config_preferred_engine_set("opengl_x11"); - ret = __callui_init(ad); + int ret = __callui_init_sys_api(ad); if (!ret) { - err("__callui_init failed"); + err("__callui_init_sys_api failed"); return FALSE; } @@ -479,6 +480,7 @@ static bool _callui_app_create(void *data) err("_callui_app_create_layout failed"); return FALSE; } + ad->view_manager_handle = _callui_vm_create(ad); ad->lock_handle = _callui_lock_manager_create(); @@ -505,7 +507,6 @@ static bool _callui_app_create_layout(void *data) __callui_app_text_classes_set(); - ad->evas = evas_object_evas_get(ad->win); __callui_app_win_key_grab(ad); return true; @@ -559,6 +560,16 @@ static void _callui_app_terminate(void *data) elm_win_keygrab_unset(ad->win, CALLUI_KEY_POWER, 0, 0); elm_win_keygrab_unset(ad->win, CALLUI_KEY_MEDIA, 0, 0); + if (ad->view_manager_handle) { + _callui_vm_destroy(ad->view_manager_handle); + ad->view_manager_handle = NULL; + } + + if (ad->lock_handle) { + _callui_lock_manager_destroy(ad->lock_handle); + ad->lock_handle = NULL; + } + if (ad->main_ly) { evas_object_del(ad->main_ly); ad->main_ly = NULL; @@ -596,8 +607,9 @@ static void _callui_app_service(app_control_h app_control, void *data) char *uri_bundle = NULL; char *operation = NULL; - if (_callvm_get_top_view_id(ad->view_manager_handle) == -1 && !ad->waiting_dialing) { - err("view_manager_handle->viewtop -1 "); + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_UNDEFINED + && !ad->waiting_dialing) { + err("VIEW_TYPE_UNDEFINED. Clear data"); __callui_call_list_init(ad); _callui_common_dvc_control_lcd_state(LCD_OFF_SLEEP_LOCK); } @@ -606,7 +618,6 @@ static void _callui_app_service(app_control_h app_control, void *data) CALLUI_RETURN_IF_FAIL(ret == APP_CONTROL_ERROR_NONE); CALLUI_RETURN_IF_FAIL(operation != NULL); - ret = app_control_get_uri(app_control, &uri_bundle); CALLUI_RETURN_IF_FAIL(ret == APP_CONTROL_ERROR_NONE); @@ -716,7 +727,7 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve return 0; } - dbg("Top view(%d)", _callvm_get_top_view_id(ad->view_manager_handle)); + dbg("Top view(%d)", _callui_vm_get_cur_view_type(ad->view_manager_handle)); /*power key case */ if (!strcmp(ev->keyname, CALLUI_KEY_POWER)) { @@ -724,20 +735,20 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve bpowerkey_enabled = _callui_common_is_powerkey_mode_on(); dbg("[KEY]KEY_POWER pressed, bpowerkey_enabled(%d)", bpowerkey_enabled); if (bpowerkey_enabled == EINA_TRUE && !_callui_lock_manager_is_lcd_off(ad->lock_handle)) { - if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_DIALLING_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_DIALLING) { if (ad->active) cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE); - } else if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCOMING_LOCK_VIEW) { + } else if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_INCOMING_LOCK) { if (ad->incom) cm_end_call(ad->cm_handle, ad->incom->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE); - } else if ((_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCALL_ONECALL_VIEW) - || (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCALL_MULTICALL_CONF_VIEW) - || (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCALL_MULTICALL_LIST_VIEW)) { + } else if ((_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_SINGLECALL) + || (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_MULTICALL_CONF) + || (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_MULTICALL_LIST)) { if (ad->active) cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_ALL_CALLS); else if (ad->held) cm_end_call(ad->cm_handle, ad->held->call_id, CALL_RELEASE_TYPE_ALL_CALLS); - } else if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCALL_MULTICALL_SPLIT_VIEW) { + } else if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_MULTICALL_SPLIT) { if (ad->active) cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS); } else { @@ -745,7 +756,7 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve } } else { if (ad->incom && !ad->active && !ad->held) { - _callvm_view_change(VIEW_INCOMING_LOCK_VIEW, 0, NULL, ad); + _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_INCOMING_LOCK); } } } else if (!strcmp(ev->keyname, CALLUI_KEY_MEDIA)) { @@ -765,7 +776,7 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve } else { dbg("KEY_SELECT key ungrab success"); } - if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_INCOMING_LOCK_VIEW) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_INCOMING_LOCK) { banswering_enabled = _callui_common_is_answering_mode_on(); if (banswering_enabled == EINA_TRUE) { int unhold_call_count = 0; @@ -842,7 +853,7 @@ static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *e return EINA_FALSE; } - if (_callvm_get_top_view_id(ad->view_manager_handle) == VIEW_UNDEFINED_TYPE) { + if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_UNDEFINED) { dbg("ad->view_top is UNDEFINED"); return EINA_FALSE; } @@ -855,3 +866,23 @@ static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *e dbg("End.."); return EINA_FALSE; } + +static void __callui_app_terminate(void *data) +{ + _callui_common_exit_app(); +} + +static void __callui_app_terminate_or_view_change(callui_app_data_t *ad) +{ + CALLUI_RETURN_IF_FAIL(ad); + + if ((NULL == ad->active) && (NULL == ad->incom) && (NULL == ad->held)) { + if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) { + _callui_lock_manager_set_callback_on_unlock(ad->lock_handle, __callui_app_terminate, NULL); + } else { + __callui_app_terminate(ad->lock_handle); + } + } else { + _callui_vm_auto_change_view(ad->view_manager_handle); + } +} -- 2.7.4