diff options
author | youngsub ko <ys4610.ko@samsung.com> | 2013-03-29 17:24:58 +0900 |
---|---|---|
committer | youngsub ko <ys4610.ko@samsung.com> | 2013-03-29 17:36:31 +0900 |
commit | 87665f4212bae9d2e241db7a7b06c8f1d0befd9f (patch) | |
tree | ac02c8a20b23b338ee0916b937b14e4b989e495a /daemon | |
parent | edb872737d8a3ea871ad64fa3088cb7046e7218e (diff) | |
download | quickpanel-87665f4212bae9d2e241db7a7b06c8f1d0befd9f.tar.gz quickpanel-87665f4212bae9d2e241db7a7b06c8f1d0befd9f.tar.bz2 quickpanel-87665f4212bae9d2e241db7a7b06c8f1d0befd9f.zip |
sync with private git
Diffstat (limited to 'daemon')
-rwxr-xr-x | daemon/device/brightness.c | 21 | ||||
-rwxr-xr-x | daemon/media.c | 246 | ||||
-rwxr-xr-x | daemon/media.h | 30 | ||||
-rwxr-xr-x | daemon/minictrl/minictrl.c | 21 | ||||
-rwxr-xr-x | daemon/notifications/noti_box.c | 81 | ||||
-rwxr-xr-x | daemon/notifications/noti_list_item.c | 13 | ||||
-rwxr-xr-x | daemon/notifications/ticker.c | 101 | ||||
-rwxr-xr-x | daemon/quickpanel-ui.c | 247 | ||||
-rwxr-xr-x | daemon/quickpanel-ui.h | 8 |
9 files changed, 461 insertions, 307 deletions
diff --git a/daemon/device/brightness.c b/daemon/device/brightness.c index 25ec2e9..ddf4b45 100755 --- a/daemon/device/brightness.c +++ b/daemon/device/brightness.c @@ -165,17 +165,6 @@ static void quickpanel_brightness_qp_closed(void *data) } } -static int _brightness_is_low_battery(void) { - int battery_value; - - vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &battery_value); - - if (battery_value < VCONFKEY_SYSMAN_BAT_WARNING_LOW) - return 1; - else - return 0; -} - static int _brightness_set_level(int level) { int ret = DEVICE_ERROR_NONE; @@ -348,12 +337,6 @@ static void _brightness_set_checker(void) } elm_check_state_set(checker, _brightness_get_automate_level()); - - if (_brightness_is_low_battery() == 1) { - elm_object_disabled_set(checker, EINA_TRUE); - } else { - elm_object_disabled_set(checker, EINA_FALSE); - } } static void _brightness_set_slider(void) @@ -390,7 +373,7 @@ static void _brightness_set_slider(void) elm_slider_value_set(slider, _brightness_get_level()); - if (_brightness_get_automate_level() || _brightness_is_low_battery() == 1) { + if (_brightness_get_automate_level()) { elm_object_disabled_set(slider, EINA_TRUE); } else { elm_object_disabled_set(slider, EINA_FALSE); @@ -452,7 +435,6 @@ static void _brightness_register_event_cb(brightness_ctrl_obj *ctrl_obj) { retif(ctrl_obj == NULL, , "Invalid parameter!"); - vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, _brightness_vconf_cb, ctrl_obj); vconf_notify_key_changed(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, _brightness_vconf_cb, ctrl_obj); } @@ -460,7 +442,6 @@ static void _brightness_deregister_event_cb(brightness_ctrl_obj *ctrl_obj) { retif(ctrl_obj == NULL, , "Invalid parameter!"); - vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, _brightness_vconf_cb); vconf_ignore_key_changed(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, _brightness_vconf_cb); } diff --git a/daemon/media.c b/daemon/media.c new file mode 100755 index 0000000..2c2cbda --- /dev/null +++ b/daemon/media.c @@ -0,0 +1,246 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include <stdio.h> +#include <vconf.h> +#include "common.h" +#include "quickpanel-ui.h" + +static player_h g_sound_player; +static Ecore_Timer *g_sound_player_timer; + +static void _quickpanel_player_free_job_cb(void *data) +{ + player_h sound_player = data; + player_state_e state = PLAYER_STATE_NONE; + + retif(sound_player == NULL, , "invalid parameter"); + + if (player_get_state(sound_player, &state) == PLAYER_ERROR_NONE) { + + DBG("state of player %d", state); + + if (state == PLAYER_STATE_PLAYING) { + player_stop(sound_player); + player_unprepare(sound_player); + } + if (state == PLAYER_STATE_READY) { + player_unprepare(sound_player); + } + } + player_destroy(sound_player); +} + +static void _quickpanel_player_free(player_h *sound_player) +{ + retif(sound_player == NULL, , "invalid parameter"); + retif(*sound_player == NULL, , "invalid parameter"); + + ecore_job_add(_quickpanel_player_free_job_cb, *sound_player); + *sound_player = NULL; +} + +static void +_quickpanel_player_del_timeout_timer(void) +{ + if (g_sound_player_timer) { + ecore_timer_del(g_sound_player_timer); + g_sound_player_timer = NULL; + } +} + +static Eina_Bool _quickpanel_player_timeout_cb(void *data) +{ + g_sound_player_timer = NULL; + + retif(data == NULL, ECORE_CALLBACK_CANCEL, "invalid parameter"); + player_h *sound_player = data; + + _quickpanel_player_free(sound_player); + g_sound_player_timer = NULL; + + return ECORE_CALLBACK_CANCEL; +} + +static void +_quickpanel_player_completed_cb(void *user_data) +{ + retif(user_data == NULL, , "invalid parameter"); + player_h *sound_player = user_data; + + _quickpanel_player_del_timeout_timer(); + _quickpanel_player_free(sound_player); +} + +static void +_quickpanel_player_interrupted_cb(player_interrupted_code_e code, void *user_data) +{ + retif(user_data == NULL, , "invalid parameter"); + player_h *sound_player = user_data; + + _quickpanel_player_del_timeout_timer(); + _quickpanel_player_free(sound_player); +} + +static void +_quickpanel_player_error_cb(int error_code, void *user_data) +{ + retif(user_data == NULL, , "invalid parameter"); + player_h *sound_player = user_data; + + _quickpanel_player_del_timeout_timer(); + _quickpanel_player_free(sound_player); +} + +void quickpanel_player_play(sound_type_e sound_type, const char *sound_file) +{ + player_h *sound_player = &g_sound_player; + + int ret = PLAYER_ERROR_NONE; + player_state_e state = PLAYER_STATE_NONE; + + _quickpanel_player_del_timeout_timer(); + + if (*sound_player != NULL) { + _quickpanel_player_free(sound_player); + } + + ret = player_create(sound_player); + if (ret != PLAYER_ERROR_NONE) { + ERR("creating the player handle failed[%d]", ret); + player_destroy(*sound_player); + } + + ret = player_set_sound_type(*sound_player, SOUND_TYPE_MEDIA); + if (ret != PLAYER_ERROR_NONE) { + ERR("player_set_sound_type() ERR: %x!!!!", ret); + _quickpanel_player_free(sound_player); + return ; + } + + player_get_state(*sound_player, &state); + if (state > PLAYER_STATE_READY) { + _quickpanel_player_free(sound_player); + return; + } + + ret = player_set_uri(*sound_player, sound_file); + if (ret != PLAYER_ERROR_NONE) { + DBG("set attribute---profile_uri[%d]", ret); + _quickpanel_player_free(sound_player); + return; + } + + ret = player_prepare(*sound_player); + if (ret != PLAYER_ERROR_NONE) { + DBG("realizing the player handle failed[%d]", ret); + _quickpanel_player_free(sound_player); + return; + } + + player_get_state(*sound_player, &state); + if (state != PLAYER_STATE_READY) { + DBG("state of player is invalid %d", state); + _quickpanel_player_free(sound_player); + return; + } + + /* register callback */ + ret = player_set_completed_cb(*sound_player, _quickpanel_player_completed_cb, sound_player); + if (ret != PLAYER_ERROR_NONE) { + DBG("player_set_completed_cb() ERR: %x!!!!", ret); + _quickpanel_player_free(sound_player); + return; + } + + ret = player_set_interrupted_cb(*sound_player, _quickpanel_player_interrupted_cb, sound_player); + if (ret != PLAYER_ERROR_NONE) { + _quickpanel_player_free(sound_player); + return; + } + + ret = player_set_error_cb(*sound_player, _quickpanel_player_error_cb, sound_player); + if (ret != PLAYER_ERROR_NONE) { + _quickpanel_player_free(sound_player); + return; + } + + ret = player_start(*sound_player); + if (ret != PLAYER_ERROR_NONE) { /* if directly return retor.. */ + DBG("player_start [%d]", ret); + _quickpanel_player_free(sound_player); + return; + } + + g_sound_player_timer = ecore_timer_add(QP_PLAY_DURATION_LIMIT, + _quickpanel_player_timeout_cb, sound_player); +} + +void quickpanel_player_stop(void) +{ + _quickpanel_player_del_timeout_timer(); + + if (g_sound_player != NULL) { + _quickpanel_player_free(&g_sound_player); + } +} + +int quickpanel_is_sound_enabled(void) +{ + int snd_status = 0; + +#ifdef VCONFKEY_SETAPPL_ACCESSIBILITY_TURN_OFF_ALL_SOUNDS + int snd_disabled_status = 0; + + vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TURN_OFF_ALL_SOUNDS, &snd_disabled_status); + vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &snd_status); + + if (snd_disabled_status == 0 && snd_status == 1) { + return 1; + } +#else + vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &snd_status); + + if (snd_status == 1) { + return 1; + } +#endif + + return 0; +} + +int quickpanel_is_vib_enabled(void) +{ + int vib_status = 0; + + vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_status); + + if (vib_status == 1) + return 1; + else + return 0; +} + +void quickpanel_play_feedback(void) +{ + int snd_enabled = quickpanel_is_sound_enabled(); + int vib_enabled = quickpanel_is_vib_enabled(); + + if (snd_enabled == 1) { + feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TOUCH_TAP); + } else if (vib_enabled == 1) { + feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_TOUCH_TAP); + } +} diff --git a/daemon/media.h b/daemon/media.h new file mode 100755 index 0000000..81bcaa9 --- /dev/null +++ b/daemon/media.h @@ -0,0 +1,30 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef __QUICKPANEL_MEDIA_H__ +#define __QUICKPANEL_MEDIA_H__ + +#include <player.h> +#include <feedback.h> + +#define QP_PLAY_DURATION_LIMIT 15 + +void quickpanel_player_play(sound_type_e sound_type, const char *sound_file); +void quickpanel_player_stop(void); +int quickpanel_is_sound_enabled(void); +int quickpanel_is_vib_enabled(void); +void quickpanel_play_feedback(void); + +#endif diff --git a/daemon/minictrl/minictrl.c b/daemon/minictrl/minictrl.c index 72136dc..1e1e85c 100755 --- a/daemon/minictrl/minictrl.c +++ b/daemon/minictrl/minictrl.c @@ -83,15 +83,16 @@ static void _viewer_unfreeze(Evas_Object *viewer) } } -static Evas_Object *_get_minictrl_obj(Evas_Object *viewer) { - retif(viewer == NULL, NULL, "Invalid parameter!"); +static Evas_Object *_get_minictrl_obj(Evas_Object *layout) { + retif(layout == NULL, NULL, "Invalid parameter!"); - return elm_object_part_content_get(viewer, "elm_icon"); + return elm_object_part_content_get(layout, "elm.icon"); } -static void _viewer_set_size(Evas_Object *viewer, void *data, int width, int height) +static void _viewer_set_size(Evas_Object *layout, void *data, int width, int height) { - retif(viewer == NULL, , "Invalid parameter!"); + Evas_Object *viewer = NULL; + retif(layout == NULL, , "Invalid parameter!"); retif(data == NULL, , "Invalid parameter!"); retif(width < 0, , "Invalid parameter!"); retif(height < 0, , "Invalid parameter!"); @@ -99,12 +100,18 @@ static void _viewer_set_size(Evas_Object *viewer, void *data, int width, int hei int max_width = 0; int resized_width = 0; + viewer = _get_minictrl_obj(layout); + retif(viewer == NULL, , "Invalid parameter!"); + if (ad->angle == 90 || ad->angle == 270) { max_width = (ad->scale * MINICONTROL_WIDTH_L_MAX) - 1; } else { max_width = (ad->scale * MINICONTROL_WIDTH_P_MAX) - 1; } resized_width = (width > max_width) ? max_width : width; + + DBG("resize:%d %d", resized_width, height); + evas_object_size_hint_min_set(viewer, resized_width, height); } @@ -237,7 +244,7 @@ static void _minictrl_add(const char *name, unsigned int width, * */ viewer = _minictrl_create_view(ad, name); - _viewer_set_size(_get_minictrl_obj(viewer), ad, width, height); + _viewer_set_size(viewer, ad, width, height); evas_object_event_callback_add(_get_minictrl_obj(viewer), EVAS_CALLBACK_MOUSE_UP, _minictrl_release_cb, ad); @@ -313,7 +320,7 @@ static void _minictrl_update(const char *name, unsigned int width, found->height = height; if (found->viewer) { - _viewer_set_size(_get_minictrl_obj(found->viewer), ad, width, height); + _viewer_set_size(found->viewer, ad, width, height); } } diff --git a/daemon/notifications/noti_box.c b/daemon/notifications/noti_box.c index 17b4be8..0b2f818 100755 --- a/daemon/notifications/noti_box.c +++ b/daemon/notifications/noti_box.c @@ -25,6 +25,9 @@ #include "noti_node.h" #include "noti.h" +#define IMAGE_NO_RESIZE 0 +#define IMAGE_RESIZE 1 + static void _noti_box_call_item_cb(Evas_Object *noti_box, const char *emission) { retif(noti_box == NULL, , "invalid parameter"); retif(emission == NULL, , "invalid parameter"); @@ -129,6 +132,16 @@ static void _set_image(Evas_Object *noti_box, notification_h noti, DBG(""); char *image = NULL; + int w = 0, h =0; + int part_w = 0, part_h =0; + double scale = 1.0; + + retif(part == NULL, ,"invalid parameter"); + + struct appdata *ad = quickpanel_get_app_data(); + if (ad != NULL) { + scale = ad->scale; + } notification_get_image(noti, image_type, &image); @@ -136,9 +149,35 @@ static void _set_image(Evas_Object *noti_box, notification_h noti, Evas_Object *content = NULL; content = elm_image_add(noti_box); elm_image_file_set(content, image, NULL); - if (is_stretch == 1) { + if (is_stretch == IMAGE_RESIZE) { elm_image_aspect_fixed_set(content, EINA_FALSE); elm_image_resizable_set(content, EINA_TRUE, EINA_TRUE); + } else { + elm_image_object_size_get(content, &w, &h); + + if (strcmp(part, BOX_PART_ICON) == 0) { + part_w = scale * BOX_ICON_SIZE_W; + part_h = scale * BOX_ICON_SIZE_H; + } + if (strcmp(part, BOX_PART_ICON_SUB) == 0) { + part_w = scale * BOX_ICON_SUB_SIZE_W; + part_h = scale * BOX_ICON_SUB_SIZE_H; + } + + DBG("%d %d --- %d %d", w, h, part_w, part_h); + + if (part_w != 0 && part_h != 0) { + if (w > part_w || h > part_h) { + elm_image_aspect_fixed_set(content, EINA_FALSE); + elm_image_resizable_set(content, EINA_TRUE, EINA_TRUE); + } else { + elm_image_aspect_fixed_set(content, EINA_TRUE); + elm_image_resizable_set(content, EINA_FALSE, EINA_FALSE); + } + } else { + elm_image_aspect_fixed_set(content, EINA_TRUE); + elm_image_resizable_set(content, EINA_FALSE, EINA_FALSE); + } } elm_object_part_content_set(noti_box, part, content); @@ -277,17 +316,17 @@ static void _noti_box_set_layout_single(Evas_Object *noti_box, if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL) == 0) { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, - "object.icon.sub", 1); + "object.icon.sub", IMAGE_NO_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, - "object.icon", 1); + "object.icon", IMAGE_NO_RESIZE); } else { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, - "object.icon", 1); + "object.icon", IMAGE_NO_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON_SUB, - "object.icon.sub", 1); + "object.icon.sub", IMAGE_NO_RESIZE); } _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_BACKGROUND, - "object.icon.background", 1); + "object.icon.background", IMAGE_RESIZE); if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_BACKGROUND) == 0) { elm_object_signal_emit(noti_box, "box.show.dim", "box.prog"); @@ -375,17 +414,17 @@ static void _noti_box_set_layout_multi(Evas_Object *noti_box, if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL) == 0) { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, - "object.icon.sub", 1); + "object.icon.sub", IMAGE_NO_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, - "object.icon", 1); + "object.icon", IMAGE_NO_RESIZE); } else { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, - "object.icon", 1); + "object.icon", IMAGE_NO_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON_SUB, - "object.icon.sub", 1); + "object.icon.sub", IMAGE_NO_RESIZE); } _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_BACKGROUND, - "object.icon.background", 1); + "object.icon.background", IMAGE_RESIZE); if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_BACKGROUND) == 0) { elm_object_signal_emit(noti_box, "box.show.dim", "box.prog"); } @@ -423,28 +462,28 @@ static void _noti_box_set_layout_thumbnail(Evas_Object *noti_box, if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL) == 0) { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, - "object.icon.sub", 0); + "object.icon.sub", IMAGE_NO_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, - "object.icon", 0); + "object.icon", IMAGE_NO_RESIZE); } else { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, - "object.icon", 0); + "object.icon", IMAGE_NO_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON_SUB, - "object.icon.sub", 0); + "object.icon.sub", IMAGE_NO_RESIZE); } _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_BACKGROUND, - "object.icon.background", 1); + "object.icon.background", IMAGE_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_LIST_1, - "object.thumbnail.list.1", 1); + "object.thumbnail.list.1", IMAGE_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_LIST_2, - "object.thumbnail.list.2", 1); + "object.thumbnail.list.2", IMAGE_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_LIST_3, - "object.thumbnail.list.3", 1); + "object.thumbnail.list.3", IMAGE_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_LIST_4, - "object.thumbnail.list.4", 1); + "object.thumbnail.list.4", IMAGE_RESIZE); _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_LIST_5, - "object.thumbnail.list.5", 1); + "object.thumbnail.list.5", IMAGE_RESIZE); if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_BACKGROUND) == 0) { elm_object_signal_emit(noti_box, "box.show.dim", "box.prog"); diff --git a/daemon/notifications/noti_list_item.c b/daemon/notifications/noti_list_item.c index 2b84c09..3bc9b23 100755 --- a/daemon/notifications/noti_list_item.c +++ b/daemon/notifications/noti_list_item.c @@ -200,10 +200,15 @@ static char *_noti_get_progress(notification_h noti, char *buf, notification_get_size(noti, &size); notification_get_progress(noti, &percentage); - if (percentage < 1 && percentage > 0) { - if (snprintf(buf, buf_len, "%d%%", (int)(percentage * 100)) - <= 0) - return NULL; + if (percentage > 0) { + if (percentage < 1.0 ) { + if (snprintf(buf, buf_len, "%d%%", (int)(percentage * 100)) <= 0) { + return NULL; + } + } + if (percentage >= 1.0) { + snprintf(buf, buf_len, "%d%%", 100); + } return buf; } else if (size > 0 && percentage == 0) { diff --git a/daemon/notifications/ticker.c b/daemon/notifications/ticker.c index 42666f2..36b45e3 100755 --- a/daemon/notifications/ticker.c +++ b/daemon/notifications/ticker.c @@ -691,6 +691,62 @@ static void _quickpanel_ticker_win_rotated(void *data) { } } +static void _quickpanel_noti_media_feedback(notification_h noti) { + + retif(noti == NULL, ,"op_list is NULL"); + + if (quickpanel_is_sound_enabled() == 1) { + notification_sound_type_e nsound_type = NOTIFICATION_SOUND_TYPE_NONE; + const char *nsound_path = NULL; +#ifdef VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR + char *default_msg_tone = NULL; +#endif + + notification_get_sound(noti, &nsound_type, &nsound_path); + DBG("Sound : %d, %s", nsound_type, nsound_path); + + switch (nsound_type) { + case NOTIFICATION_SOUND_TYPE_USER_DATA: + quickpanel_player_play(SOUND_TYPE_NOTIFICATION, nsound_path); + break; + case NOTIFICATION_SOUND_TYPE_DEFAULT: +#ifdef VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR + default_msg_tone = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); + + if (default_msg_tone != NULL) { + quickpanel_player_play(SOUND_TYPE_NOTIFICATION, default_msg_tone); + free(default_msg_tone); + } else { + feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_UNLOCK); + } +#else + feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_UNLOCK); +#endif + break; + case NOTIFICATION_SOUND_TYPE_MAX: + case NOTIFICATION_SOUND_TYPE_NONE: + break; + } + } + + /* Play Vibration */ + notification_vibration_type_e nvibration_type = + NOTIFICATION_VIBRATION_TYPE_NONE; + const char *nvibration_path = NULL; + + notification_get_vibration(noti, &nvibration_type, &nvibration_path); + DBG("Vibration : %d, %s", nvibration_type, nvibration_path); + switch (nvibration_type) { + case NOTIFICATION_VIBRATION_TYPE_USER_DATA: + case NOTIFICATION_VIBRATION_TYPE_DEFAULT: + feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_GENERAL); + break; + case NOTIFICATION_VIBRATION_TYPE_MAX: + case NOTIFICATION_VIBRATION_TYPE_NONE: + break; + } +} + static void _quickpanel_ticker_noti_detailed_changed_cb(void *data, notification_type_e type, notification_op *op_list, int num_op) { notification_h noti = NULL; @@ -723,6 +779,10 @@ static void _quickpanel_ticker_noti_detailed_changed_cb(void *data, notification retif(noti == NULL, ,"noti is NULL"); + if (op_type == NOTIFICATION_OP_INSERT || op_type == NOTIFICATION_OP_UPDATE) { + _quickpanel_noti_media_feedback(noti); + } + notification_get_display_applist(noti, &applist); if (!(applist & NOTIFICATION_DISPLAY_APP_TICKER)) { DBG("No Ticker Msg"); @@ -741,47 +801,6 @@ static void _quickpanel_ticker_noti_detailed_changed_cb(void *data, notification return; } - /* Play sound */ - notification_sound_type_e nsound_type = NOTIFICATION_SOUND_TYPE_NONE; - const char *nsound_path = NULL; - - notification_get_sound(noti, &nsound_type, &nsound_path); - DBG("Sound : %d, %s", nsound_type, nsound_path); - if (nsound_type > NOTIFICATION_SOUND_TYPE_NONE - || nsound_type < NOTIFICATION_SOUND_TYPE_MAX) { - - switch (nsound_type) { - case NOTIFICATION_SOUND_TYPE_DEFAULT: - feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_UNLOCK); - break; - case NOTIFICATION_SOUND_TYPE_USER_DATA: - quickpanel_player_play(SOUND_TYPE_NOTIFICATION, nsound_path); - break; - default: - break; - } - } - /* Play Vibration */ - notification_vibration_type_e nvibration_type = - NOTIFICATION_VIBRATION_TYPE_NONE; - const char *nvibration_path = NULL; - - notification_get_vibration(noti, &nvibration_type, &nvibration_path); - DBG("Vibration : %d, %s", nvibration_type, nvibration_path); - if (nvibration_type > NOTIFICATION_VIBRATION_TYPE_NONE - || nvibration_type < NOTIFICATION_VIBRATION_TYPE_MAX) { - - switch (nvibration_type) { - case NOTIFICATION_SOUND_TYPE_DEFAULT: - feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_GENERAL); - break; - case NOTIFICATION_SOUND_TYPE_USER_DATA: - break; - default: - break; - } - } - /* Skip if previous ticker is still shown */ if (g_ticker != NULL) { _quickpanel_ticker_hide(NULL); diff --git a/daemon/quickpanel-ui.c b/daemon/quickpanel-ui.c index ed6b265..7419875 100755 --- a/daemon/quickpanel-ui.c +++ b/daemon/quickpanel-ui.c @@ -26,7 +26,6 @@ #include <unistd.h> #include <privilege-control.h> #include <bundle.h> -#include <feedback.h> #include <notification.h> #include "common.h" @@ -36,17 +35,15 @@ #include "list_util.h" #define QP_WINDOW_PRIO 300 -#define QP_PLAY_DURATION_LIMIT 15 +#define QP_ENABLE_HIDING_INDICATOR 0 -static player_h g_sound_player; -static Ecore_Timer *g_sound_player_timer; static struct appdata *g_app_data = NULL; /* binary information */ #define QP_EMUL_STR "Emulator" +static Ecore_X_Atom E_ILLUME_ATOM_MV_QUICKPANEL_STATE; static void _quickpanel_cache_flush(void *evas); -static void _quickpanel_player_free(player_h *sound_player); static void _quickpanel_init_size_genlist(void *data); static void _quickpanel_ui_update_height(void *data); static void _quickpanel_ui_set_indicator_cover(void *data); @@ -150,6 +147,11 @@ static void _quickpanel_move_data_to_service(const char *key, const char *val, v service_add_extra_data(service, key, val); } +static void atoms_init_quickpanel(void) +{ + E_ILLUME_ATOM_MV_QUICKPANEL_STATE = ecore_x_atom_get("_E_MOVE_QUICKPANEL_STATE"); +} + /****************************************************************************** * * UI @@ -285,15 +287,31 @@ static Eina_Bool quickpanel_ui_client_message_cb(void *data, int type, new_angle = ev->data.l[0]; _quickpanel_ui_rotation(ad, new_angle); } else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) { - if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON) { - qp_opened_modules(data); - if (g_sound_player != NULL) { - _quickpanel_player_free(&g_sound_player); - } - } else { + if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF) { + ad->is_opened = 0; qp_closed_modules(data); - if (g_sound_player != NULL) { - _quickpanel_player_free(&g_sound_player); + quickpanel_player_stop(); +#if QP_ENABLE_HIDING_INDICATOR + elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE); +#endif + } + } else if (ad->E_ILLUME_ATOM_MV_QUICKPANEL_STATE != NULL) { + if (ev->message_type == *(ad->E_ILLUME_ATOM_MV_QUICKPANEL_STATE)) { + if (ev->data.l[0] == 1) { + if (ad->is_opened == 0) { +#if QP_ENABLE_HIDING_INDICATOR + elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); +#endif + DBG("quickpanel open start"); + } + } + if (ev->data.l[0] == 0) { + if (ad->is_opened == 0) { + DBG("quickpanel closed"); + ad->is_opened = 1; + qp_opened_modules(data); + quickpanel_player_stop(); + } } } } @@ -632,204 +650,6 @@ static void _quickpanel_ui_window_set_content_region(void *data, int contents_he ecore_x_window_prop_card32_set(xwin, atom_window_contents_region, window_contents_region, 4); } - - -static Eina_Bool _quickpanel_player_free_idler_cb(void *data) -{ - player_h *sound_player = data; - player_state_e state = PLAYER_STATE_NONE; - - retif(data == NULL, QP_FAIL, "Invalid parameter!"); - - retif(sound_player == NULL, EINA_FALSE, "invalid parameter"); - retif(*sound_player == NULL, EINA_FALSE, "invalid parameter"); - - if (player_get_state(*sound_player, &state) == PLAYER_ERROR_NONE) { - - DBG("state of player %d", state); - - if (state == PLAYER_STATE_PLAYING) { - player_stop(*sound_player); - player_unprepare(*sound_player); - } - if (state == PLAYER_STATE_READY) { - player_unprepare(*sound_player); - } - } - player_destroy(*sound_player); - *sound_player = NULL; - - return EINA_FALSE; -} - -static void _quickpanel_player_free(player_h *sound_player) -{ - retif(sound_player == NULL, , "invalid parameter"); - - ecore_idler_add(_quickpanel_player_free_idler_cb, sound_player); -} - -static void -_quickpanel_player_del_timeout_timer(void) -{ - if (g_sound_player_timer) { - ecore_timer_del(g_sound_player_timer); - g_sound_player_timer = NULL; - } -} - -static Eina_Bool _quickpanel_player_timeout_cb(void *data) -{ - g_sound_player_timer = NULL; - - retif(data == NULL, ECORE_CALLBACK_CANCEL, "invalid parameter"); - player_h *sound_player = data; - - _quickpanel_player_free(sound_player); - - return ECORE_CALLBACK_CANCEL; -} - -static void -_quickpanel_player_completed_cb(void *user_data) -{ - retif(user_data == NULL, , "invalid parameter"); - player_h *sound_player = user_data; - - _quickpanel_player_del_timeout_timer(); - _quickpanel_player_free(sound_player); -} - -static void -_quickpanel_player_interrupted_cb(player_interrupted_code_e code, void *user_data) -{ - retif(user_data == NULL, , "invalid parameter"); - player_h *sound_player = user_data; - - _quickpanel_player_del_timeout_timer(); - _quickpanel_player_free(sound_player); -} - -static void -_quickpanel_player_error_cb(int error_code, void *user_data) -{ - retif(user_data == NULL, , "invalid parameter"); - player_h *sound_player = user_data; - - _quickpanel_player_del_timeout_timer(); - _quickpanel_player_free(sound_player); -} - -void quickpanel_player_play(sound_type_e sound_type, const char *sound_file) -{ - player_h *sound_player = &g_sound_player; - - int ret = PLAYER_ERROR_NONE; - player_state_e state = PLAYER_STATE_NONE; - - _quickpanel_player_del_timeout_timer(); - - if (*sound_player != NULL) { - _quickpanel_player_free(sound_player); - } - - ret = player_create(sound_player); - if (ret != PLAYER_ERROR_NONE) { - ERR("creating the player handle failed[%d]", ret); - player_destroy(*sound_player); - } - - ret = player_set_sound_type(*sound_player, SOUND_TYPE_MEDIA); - if (ret != PLAYER_ERROR_NONE) { - ERR("player_set_sound_type() ERR: %x!!!!", ret); - _quickpanel_player_free(sound_player); - return ; - } - - player_get_state(*sound_player, &state); - if (state > PLAYER_STATE_READY) { - _quickpanel_player_free(sound_player); - return; - } - - ret = player_set_uri(*sound_player, sound_file); - if (ret != PLAYER_ERROR_NONE) { - DBG("set attribute---profile_uri[%d]", ret); - _quickpanel_player_free(sound_player); - return; - } - - ret = player_prepare(*sound_player); - if (ret != PLAYER_ERROR_NONE) { - DBG("realizing the player handle failed[%d]", ret); - _quickpanel_player_free(sound_player); - return; - } - - player_get_state(*sound_player, &state); - if (state != PLAYER_STATE_READY) { - DBG("state of player is invalid %d", state); - _quickpanel_player_free(sound_player); - return; - } - - /* register callback */ - ret = player_set_completed_cb(*sound_player, _quickpanel_player_completed_cb, sound_player); - if (ret != PLAYER_ERROR_NONE) { - DBG("player_set_completed_cb() ERR: %x!!!!", ret); - _quickpanel_player_free(sound_player); - return; - } - - ret = player_set_interrupted_cb(*sound_player, _quickpanel_player_interrupted_cb, sound_player); - if (ret != PLAYER_ERROR_NONE) { - _quickpanel_player_free(sound_player); - return; - } - - ret = player_set_error_cb(*sound_player, _quickpanel_player_error_cb, sound_player); - if (ret != PLAYER_ERROR_NONE) { - _quickpanel_player_free(sound_player); - return; - } - - ret = player_start(*sound_player); - if (ret != PLAYER_ERROR_NONE) { /* if directly return retor.. */ - DBG("player_start [%d]", ret); - _quickpanel_player_free(sound_player); - return; - } - - g_sound_player_timer = ecore_timer_add(QP_PLAY_DURATION_LIMIT, - _quickpanel_player_timeout_cb, sound_player); -} - -void quickpanel_play_feedback(void) -{ - int vib_status = 0; - int snd_status = 0; - -#ifdef VCONFKEY_SETAPPL_ACCESSIBILITY_TURN_OFF_ALL_SOUNDS - int snd_disabled_status = 0; - - vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TURN_OFF_ALL_SOUNDS, &snd_disabled_status); - - if (!snd_disabled_status) { - vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &snd_status); - if (snd_status) - feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TOUCH_TAP); - } -#else - vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &snd_status); - if (snd_status) - feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TOUCH_TAP); -#endif - - vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_status); - if (vib_status) - feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_TOUCH_TAP); -} - static int _quickpanel_ui_delete_win(void *data) { struct appdata *ad = data; @@ -1114,6 +934,11 @@ static void quickpanel_app_service(service_h service, void *data) ret = _quickpanel_ui_create_win(ad); retif(ret != QP_OK, , "Failed to create window!"); + + atoms_init_quickpanel(); + + ad->E_ILLUME_ATOM_MV_QUICKPANEL_STATE = &E_ILLUME_ATOM_MV_QUICKPANEL_STATE; + _quickpanel_ui_init_ecore_event(ad); _quickpanel_ui_vconf_event_init(ad); diff --git a/daemon/quickpanel-ui.h b/daemon/quickpanel-ui.h index 0a6a4ad..86c151a 100755 --- a/daemon/quickpanel-ui.h +++ b/daemon/quickpanel-ui.h @@ -20,7 +20,7 @@ #include <Elementary.h> #include <Ecore_X.h> #include <X11/Xatom.h> -#include <player.h> +#include "media.h" #if !defined(VENDOR) # define VENDOR "org.tizen" @@ -55,6 +55,8 @@ #define INDICATOR_COVER_W 82 #define INDICATOR_COVER_H 60 +#define _NEWLINE '\n' +#define _SPACE ' ' #define QP_SETTING_PKG_SETTING VENDOR".setting" #define QP_SETTING_PKG_SETTING_EMUL "kto5jikgul.Settings" @@ -80,6 +82,7 @@ struct appdata { int is_emul; /* 0 : target, 1 : emul */ int is_suspended; + int is_opened; Ecore_Event_Handler *hdl_client_message; Ecore_Event_Handler *hdl_hardkey; @@ -91,6 +94,7 @@ struct appdata { Evas_Object *cover_indicator_left; Evas_Object *cover_indicator_right; + Ecore_X_Atom *E_ILLUME_ATOM_MV_QUICKPANEL_STATE; }; typedef struct _QP_Module { @@ -113,7 +117,6 @@ typedef struct _QP_Module { Eina_Bool state; } QP_Module; -void quickpanel_player_play(sound_type_e sound_type, const char *sound_file); int quickpanel_launch_app(char *app_id, void *data); void quickpanel_launch_app_inform_result(const char *pkgname, int retcode); int quickpanel_is_emul(void); @@ -125,6 +128,5 @@ Evas_Object *quickpanel_ui_load_edj(Evas_Object * parent, const char *file, const char *group, int is_just_load); void quickpanel_ui_set_indicator_cover(void *data); void quickpanel_close_quickpanel(bool is_check_lock); -void quickpanel_play_feedback(void); #endif /* __QUICKPANEL_UI_H__ */ |