#include <tzsh_quickpanel_service.h>
#include <system_settings.h>
#include <notification_setting_internal.h>
+#include <voice_control_setting.h>
+#include <voice_control_common.h>
#include <app.h>
#include "quickpanel-ui.h"
#define NOTI_CLEAR_ALL_SECTION "quickpanel/notisection/clear_all"
#define NOTI_DEFAULT_SECTION "quickpanel/notisection/default"
+#define VOICE_CONTROL_PKG "org.tizen.voice-control-panel"
-#define NOTI_SECTION_WIDTH 393
+
+#define NOTI_SECTION_WIDTH 1200
#define NOTI_SECTION_HEIGHT 48
-#define NOTI_SECTION_X 847
+#define NOTI_SECTION_X 40
#define NOTI_SECTION_Y 0
static struct _noti_section{
elm_object_part_text_set(noti_section, "text.button.clear_all", _("IDS_LCKSCN_ACBUTTON_CLEAR_ALL"));
}
+// To Do : define this function in appropriate file
+static void quickpanel_voice_control_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+ int ret = 0;
+ bool status = false;
+ if ((VC_ERROR_NONE == vc_setting_get_enabled(&status)) && status ) {
+ ret = quickpanel_common_send_message_to_app(VOICE_CONTROL_PKG, NULL, NULL, NULL);
+ quickpanel_common_inform_launch_app_result(VOICE_CONTROL_PKG, ret);
+ if(ret != APP_CONTROL_ERROR_NONE)
+ {
+ ERR("failed to launch voice control app");
+ return;
+ }
+ quickpanel_uic_close_quickpanel(true, 1);
+ } else {
+ DBG("voice control service is not enable or failed to get status of voice control service.");
+ }
+}
+
HAPI void quickpanel_noti_section_create(Evas_Object *parent)
{
Evas_Object *section;
evas_object_size_hint_weight_set(section, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(section, EVAS_HINT_FILL, EVAS_HINT_FILL);
- //quickpanel_uic_initial_resize(section, QP_THEME_LIST_ITEM_NOTI_SECTION_HEIGHT);
- evas_object_resize(section, NOTI_SECTION_WIDTH, NOTI_SECTION_HEIGHT);
evas_object_show(section);
focus_clear = quickpanel_accessibility_ui_get_focus_object(section);
}
Evas_Object *setting_button = elm_button_add(section);
+ evas_object_size_hint_weight_set(setting_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
if(setting_button == NULL) {
ERR("Failed to add button");
return ;
DBG("Image path = %s",path);
snprintf(buffer, 1024, "%s%s%s", path, "images_icon/", "icon_settings.png");
elm_image_file_set(img, buffer, NULL);
- evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(48), ELM_SCALE_SIZE(48));
- evas_object_size_hint_max_set(img, ELM_SCALE_SIZE(48), ELM_SCALE_SIZE(48));
+ evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40));
+ evas_object_size_hint_max_set(img, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40));
+ evas_object_size_hint_align_set(img, 0.0, 0.5);
elm_object_part_content_set(setting_button, "icon", img);
elm_object_style_set(setting_button, "focus");
elm_object_part_content_set(section, "settings_button_swallow", setting_button);
evas_object_smart_callback_add(setting_button, "clicked", quickpanel_setting_clicked, NULL);
evas_object_show(setting_button);
+
+ Evas_Object *vc_button = elm_button_add(section);
+ elm_object_style_set(vc_button, "focus");
+ evas_object_size_hint_weight_set(vc_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ snprintf(buffer, 1024, "%s%s%s", path, "images_icon/", "icon_voice_control.png");
+ Evas_Object *icon = elm_image_add(vc_button);
+ elm_image_file_set(icon, buffer, NULL);
+ evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40));
+ evas_object_size_hint_max_set(icon, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40));
+ evas_object_size_hint_align_set(icon, 1.0, 0.5);
+
+ elm_object_part_content_set(vc_button, "icon", icon);
+
+ elm_object_part_content_set(section, "voice_control_swallow", vc_button);
+ evas_object_smart_callback_add(vc_button, "clicked", quickpanel_voice_control_clicked, NULL);
+ evas_object_show(vc_button);
free(path);
elm_object_part_content_set(section, "focus", focus_clear);
evas_object_smart_callback_add(focus_clear, "clicked", quickpanel_noti_on_clear_all_clicked, NULL);
elm_object_part_content_set(section, "focus.setting", focus_setting);
evas_object_smart_callback_add(focus_setting, "clicked", quickpanel_noti_on_noti_setting_clicked, NULL);
- elm_grid_pack(parent, section, 32, NOTI_SECTION_Y, 1200, NOTI_SECTION_HEIGHT);
+ elm_grid_pack(parent, section, NOTI_SECTION_X, NOTI_SECTION_Y, NOTI_SECTION_WIDTH, NOTI_SECTION_HEIGHT);
noti_section_data.layout = section;
noti_section_data.clear_btn = focus_clear;
return BUTTON_LABEL;
}
-static int _check_dead_signal(int pid, void *data)
-{
- DBG("Process %d is terminated", pid);
- if (pid < 0) {
- ERR("pid : %d", pid);
- return 0;
- }
- if(pid == vcpid) {
- DBG("pid = %d and vcpid = %d",pid,vcpid);
- QP_Module_Setting *module = (QP_Module_Setting *)data;
- if(module == NULL) {
- ERR("module is NULL");
- return 0;
- }
- DBG("name of module = %s",module->name);
- DBG(" check_dead_signal, setting the module icon state to 0");
- quickpanel_setting_module_icon_state_set(module, 0);
- quickpanel_setting_module_icon_view_update(module ,0,FLAG_VALUE_VOID);
- }
- return 0;
-}
-
static const char *_icon_get(qp_setting_icon_image_type type)
{
if (type == QP_SETTING_ICON_NORMAL) {
quickpanel_setting_module_icon_state_set(module, 1);
quickpanel_setting_module_icon_view_update(module ,1,FLAG_VALUE_VOID);
- int ret = 0;
- ret = quickpanel_common_send_message_to_app(VOICE_CONTROL_PKG, NULL, NULL, NULL);
- quickpanel_common_inform_launch_app_result(VOICE_CONTROL_PKG, ret);
-
- app_context_h app_context_handle = NULL;
- ret = app_manager_get_app_context(VOICE_CONTROL_PKG, &app_context_handle);
- if (ret != APP_MANAGER_ERROR_NONE) {
- ERR("Failed to get app context");
- return ;
- }
-
- ret = app_context_get_pid(app_context_handle, &vcpid);
- if (ret != APP_MANAGER_ERROR_NONE) {
- ERR("Failed to get pid");
- return ;
- }
+ }
+}
- ret = aul_listen_app_dead_signal(_check_dead_signal, module);
- if (ret < 0) {
- ERR("aul_listen_app_dead_signal failed");
- return ;
- }
- DBG(" pid of voice_control is = %d ",vcpid);
- quickpanel_uic_close_quickpanel(true, 1);
+static void _vc_enabled_changed_cb(bool enabled, void* user_data)
+{
+ QP_Module_Setting *module = (QP_Module_Setting *)user_data;
+ if(enabled) {
+ quickpanel_setting_module_icon_state_set(module, 1);
+ quickpanel_setting_module_icon_view_update(module ,1,FLAG_VALUE_VOID);
+ } else {
+ quickpanel_setting_module_icon_state_set(module, 0);
+ quickpanel_setting_module_icon_view_update(module ,0,FLAG_VALUE_VOID);
}
}
+
static int _register_module_event_handler(void *data)
{
- int ret = 0;
+ if (0 != vc_setting_set_enabled_changed_cb(_vc_enabled_changed_cb, data)) {
+ ERR("Fail to set enabled cb");
+ return QP_FAIL;
+ }
return QP_OK;
}
static int _unregister_module_event_handler(void *data)
{
- int ret = 0;
+ if (0 != vc_setting_unset_enabled_changed_cb()) {
+ ERR("Fail to unset enabled cb");
+ return QP_FAIL;
+ }
return QP_OK;
}