--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ *
+ */
+collections {
+ base_scale: 2.6;
+
+ #define POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MIN_INC 360 360
+ #define POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MAX_INC 360 360
+ #define POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MIN_INC 224 76
+ #define POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MAX_INC 224 76
+ #define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC 224 100
+ #define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC 224 100
+
+ group { name: "cooldown_warning_layout";
+ parts {
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC;
+ max: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ rel2.relative: 1.0 0.0;
+ }
+ }
+ part { name: "before_text_pad";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 5;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "elm.swallow.content";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_y: "elm.swallow.content";
+ }
+ }
+ }
+ part { name: "label";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.5 0.0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "before_text_pad";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ }
+ }
+
+ group { name: "cooldown_poweroff_layout";
+ parts {
+ part { name: "base";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MIN_INC;
+ max: POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MAX_INC;
+ }
+ }
+ part { name: "top_pad";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MIN_INC;
+ max: POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MAX_INC;
+ rel1.relative: 0.0 0.0;
+ rel1.to: "base";
+ rel2.relative: 1.0 0.0;
+ rel2.to: "base";
+ align: 0.5 0.0;
+ fixed: 0 1;
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC;
+ max: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ rel2.relative: 1.0 0.0;
+ }
+ }
+ part { name: "before_text_pad";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 5;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "elm.swallow.content";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_y: "elm.swallow.content";
+ }
+ }
+ }
+ part { name: "label";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.5 0.0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "before_text_pad";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ }
+ }
+}
#define TIMEOUT_BEEP_1 1 /* seconds */
#define TIMEOUT_BEEP_0_5 (0.5) /* seconds */
+#define BUF_MAX 512
+
enum beep_type {
BEEP_SINGLE = FEEDBACK_PATTERN_LOWBATT, /* should be changed to FEEDBACK_PATTERN_TEMPERATURE_WARNING */
BEEP_DOUBLE = FEEDBACK_PATTERN_LOWBATT, /* should be changed to double beep */
{ BEEP_DONE , 0 },
};
+static char *items[] = {
+ "WDS_ST_HEADER_GEAR_COOLING_ABB",
+ "WDS_PN_TPOP_EMERGENCY_CALLS_ONLY_ABB",
+ "IDS_COM_SK_OK",
+ "WDS_PN_TPOP_GEAR_WILL_POWER_OFF_TO_COOL_ABB"
+};
+
+char* gl_text_get(int index)
+{
+ return strdup(_(items[index]));
+}
+
static const struct popup_ops cooldown_poweroff_ops;
static const struct popup_ops cooldown_warning_ops;
static const struct popup_ops cooldown_poweron_ops;
return 0;
}
-static int cooldown_poweroff_content(const struct popup_ops *ops, char *content, unsigned int len)
+static void _clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ const struct popup_ops *ops = data;
+
+ if (ops)
+ unload_simple_popup(ops);
+
+ terminate_if_no_popup();
+}
+
+static void _clicked_poweroff_cb(void *data, Evas_Object *obj, void *event_info)
{
- snprintf(content, len, "Device will power off to cool down.");
+ const struct popup_ops *ops = data;
+
+ cooldown_poweroff(ops);
+}
+
+int cooldown_warning_show(bundle *b, const struct popup_ops *ops)
+{
+ Evas_Object *popup;
+ Evas_Object *layout;
+ Evas_Object *layout_inner;
+ Evas_Object *label;
+ Evas_Object *btn;
+ Evas_Object *image;
+ Evas_Object *win;
+ char buf[BUF_MAX];
+ struct object_ops *obj;
+ int ret;
+
+ if (!ops)
+ return -EINVAL;
+
+ ret = get_object_by_ops(ops, &obj);
+ if (ret < 0) {
+ _E("Failed to get object (%d)", ret);
+ return -EINVAL;
+ }
+
+ win = get_window();
+ if (!win)
+ return -ENOMEM;
+
+ evas_object_show(win);
+
+ /* Popup */
+ popup = elm_popup_add(win);
+ elm_object_style_set(popup, "circle");
+
+ /* Layout for one button */
+ layout = elm_layout_add(popup);
+ elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons1");
+
+ /* Popup Title */
+ elm_object_part_text_set(layout, "elm.text.title", gl_text_get(0));
+ elm_object_content_set(popup, layout);
+
+ /* Inner Layout */
+ layout_inner = elm_layout_add(layout);
+ elm_layout_file_set(layout_inner, ELM_COOLDOWN_EDC, "cooldown_warning_layout");
+ elm_object_part_content_set(layout, "elm.swallow.content", layout_inner);
+
+ /* Image */
+ image = elm_image_add(layout_inner);
+ snprintf(buf, sizeof(buf), "%s/overheat.png", RESDIR);
+ elm_image_file_set(image, buf, NULL);
+ elm_object_part_content_set(layout_inner, "elm.swallow.content", image);
+
+ /* Label */
+ label = elm_label_add(layout_inner);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, gl_text_get(1));
+ elm_object_part_content_set(layout_inner, "label", label);
+
+ /* Button */
+ btn = elm_button_add(popup);
+ elm_object_style_set(btn, "popup/circle");
+ elm_object_text_set(btn, gl_text_get(2));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", _clicked_cb, ops);
+
+ /* Back key */
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
+
+ evas_object_show(popup);
+ obj->popup = popup;
+
return 0;
}
-static int cooldown_warning_content(const struct popup_ops *ops, char *content, unsigned int len)
+int cooldown_poweroff_show(bundle *b, const struct popup_ops *ops)
{
- snprintf(content, len, "Device is overheating. This task will end shortly. You will only be able to make emergency calls until it has cooled down.");
+ Evas_Object *popup;
+ Evas_Object *layout;
+ Evas_Object *layout_inner;
+ Evas_Object *label;
+ Evas_Object *btn;
+ Evas_Object *image;
+ Evas_Object *win;
+ char buf[BUF_MAX];
+ struct object_ops *obj;
+ int ret;
+
+ if (!ops)
+ return -EINVAL;
+
+ ret = get_object_by_ops(ops, &obj);
+ if (ret < 0) {
+ _E("Failed to get object (%d)", ret);
+ return -EINVAL;
+ }
+
+ win = get_window();
+ if (!win)
+ return -ENOMEM;
+
+ evas_object_show(win);
+
+ /* Popup */
+ popup = elm_popup_add(win);
+ elm_object_style_set(popup, "circle");
+
+ /* Layout for one button */
+ layout = elm_layout_add(popup);
+ elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons1");
+ elm_object_content_set(popup, layout);
+
+ /* Inner Layout */
+ layout_inner = elm_layout_add(layout);
+ elm_layout_file_set(layout_inner, ELM_COOLDOWN_EDC, "cooldown_poweroff_layout");
+ elm_object_part_content_set(layout, "elm.swallow.content", layout_inner);
+
+ /* Image */
+ image = elm_image_add(layout_inner);
+ snprintf(buf, sizeof(buf), "%s/overheat.png", RESDIR);
+ elm_image_file_set(image, buf, NULL);
+ elm_object_part_content_set(layout_inner, "elm.swallow.content", image);
+
+ /* Label */
+ label = elm_label_add(layout_inner);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, gl_text_get(3));
+ elm_object_part_content_set(layout_inner, "label", label);
+
+ /* Button */
+ btn = elm_button_add(popup);
+ elm_object_style_set(btn, "popup/circle");
+ elm_object_text_set(btn, gl_text_get(2));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", _clicked_poweroff_cb, ops);
+
+ /* Back key */
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
+
+ evas_object_show(popup);
+ obj->popup = popup;
+
return 0;
}
static const struct popup_ops cooldown_poweroff_ops = {
.name = "cooldown_poweroff",
.pattern = FEEDBACK_PATTERN_LOWBATT,
- .show = load_simple_popup,
- .get_content = cooldown_poweroff_content,
- .left_text = "IDS_COM_SK_OK",
- .left = cooldown_poweroff,
+ .show = cooldown_poweroff_show,
.pre = cooldown_poweroff_timer,
.terminate = cooldown_poweroff_terminate,
};
static const struct popup_ops cooldown_warning_ops = {
.name = "cooldown_warning",
.pattern = FEEDBACK_PATTERN_LOWBATT,
- .show = load_simple_popup,
- .get_content = cooldown_warning_content,
- .left_text = "IDS_COM_SK_OK",
- .left = cooldown_warning,
+ .show = cooldown_warning_show,
.pre = cooldown_warning_timer,
.terminate = cooldown_warning_terminate,
};
+static const struct popup_ops cooled_down_ops = {
+ .name = "cooled_down",
+ .pattern = FEEDBACK_PATTERN_LOWBATT,
+ .show = load_simple_popup,
+ .title = "WDS_PN_HEADER_COOLED_ABB",
+ .content = "WDS_PN_TPOP_YOUR_GEAR_IS_NOW_READY_TO_USE_ABB",
+ .left_text = "IDS_COM_SK_OK",
+};
+
/* Constructor to register cooldown button */
static __attribute__ ((constructor)) void cooldown_register_popup(void)
{
register_popup(&cooldown_poweron_ops);
register_popup(&cooldown_poweroff_ops);
register_popup(&cooldown_warning_ops);
+ register_popup(&cooled_down_ops);
}