Wifi Grid: Added wifi grid code and edc style 93/49093/1
authorHyojung Jo <hj903.jo@samsung.com>
Tue, 6 Oct 2015 09:52:43 +0000 (18:52 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Tue, 6 Oct 2015 09:52:43 +0000 (18:52 +0900)
Change-Id: I918b5243f37698512278ee734ec2f6aad85af652
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
CMakeLists.txt
include/grid.h [new file with mode: 0644]
include/layout/network.h
res/widget/gengrid.edc
src/grid/grid_wireless.c [new file with mode: 0644]

index dcf84de256293fbfa7544b22a576ceafca5906c8..041be04fde119b3e5a7f3472800e35a55cae5426 100644 (file)
@@ -70,6 +70,7 @@ SET(SRCS
        src/layout/layout_support.c
        src/layout/layout_info.c
        src/layout/layout_voice.c
+       src/grid/grid_wireless.c
        src/data/data_wireless.c
    )
 
diff --git a/include/grid.h b/include/grid.h
new file mode 100644 (file)
index 0000000..4f04b1d
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 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 __AIR_SETTINGS_GRID_H__
+#define __AIR_SETTINGS_GRID_H__
+
+struct grid_class *get_wireless_grid_class(void);
+
+#endif /* __AIR_SETTINGS_GRID_H__ */
index 29ec488cc5de820bc4b632bae4d550dd0e1942aa..9f8964736b80597427b4315a9a998134fca6f35e 100644 (file)
 #define GRP_LAYOUT_NETWORK "grp.layout.network"
 
 /* Style */
+#define STYLE_GRID_WIRELESS "style.grid.wireless"
 
 /* Part for network layout */
 #define PART_NETWORK_TYPE "part.network.type"
 #define PART_REFRESH "part.refresh"
+#define PART_WIFI_NAME "part.wifi.name"
+#define PART_STATE_LOCK "part_state_lock"
+#define PART_STATE_CHECK "part_state_check"
 
 /* Signal for network layout */
 
 #define SIZE_NETWORK_CTXPOPUP_W 310
 #define SIZE_NETWORK_CTXPOPUP_H 114
 
+/* Image */
+#define IC_NETWORK_NOR_04_PNG "ic_network_nor_04.png"
+#define IC_NETWORK_FOC_04_PNG "ic_network_foc_04.png"
+#define IC_LOCK_NETWORK_NOR_04_PNG "ic_lock_network_nor_04.png"
+#define IC_LOCK_NETWORK_FOC_04_PNG "ic_lock_network_foc_04.png"
+#define IC_CHECK_NOR_PNG "ic_thumb_check_sel.png"
+#define IC_CHECK_FOC_PNG "ic_thumb_check_foc.png"
+
 #endif  /* __AIR_SETTINGS_LAYOUT_NETWORK_H__ */
index fb758506929765c4d498e30b1565c5474ba965fe..ba828e99268f9b68189acae36fd70858b1ca3f09 100644 (file)
  * limitations under the License.
  */
 
+#define STATE_NORMAL 0
+#define STATE_LOCKED 1
+#define STATE_CHECKED 2
+
 group {
        name, "elm/gengrid/item/style.grid.wireless/default";
        data.item, "focus_highlight" "on";
        data.item, "texts" "part.thumb.text";
-       data.item, "contents" "part.thumb.icon";
+       data.item, "states" "part_state_check part_state_lock";
+       images {
+               image, IC_NETWORK_NOR_04_PNG COMP;
+               image, IC_NETWORK_FOC_04_PNG COMP;
+               image, IC_LOCK_NETWORK_NOR_04_PNG COMP;
+               image, IC_LOCK_NETWORK_FOC_04_PNG COMP;
+               image, IC_CHECK_NOR_PNG COMP;
+               image, IC_CHECK_FOC_PNG COMP;
+       }
+
+       script {
+               public lock_state;
+               public check_state;
+       }
+
        parts {
                part {
                        name, "padding.bottom.right";
@@ -63,8 +81,11 @@ group {
                                        relative, 0.0 0.0;
                                }
                                fixed, 1 1;
-                               visible, 0;
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
                }
 
                part {
@@ -85,8 +106,8 @@ group {
                }
 
                part {
-                       name, PART_THUMB_ICON;
-                       type, SWALLOW;
+                       name, "part.wifi.icon";
+                       type, IMAGE;
                        scale, 1;
                        mouse_events, 1;
                        description {
@@ -106,11 +127,31 @@ group {
                                        perspective_on, 1;
                                        perspective, "map";
                                }
+                               image.normal, IC_NETWORK_NOR_04_PNG;
                        }
                        description {
-                               state, "focused" 0.0;
+                               state, "focused.locked" 0.0;
+                               inherit, "default" 0.0;
+                               map.on, 1;
+                               image.normal, IC_LOCK_NETWORK_FOC_04_PNG;
+                       }
+                       description {
+                               state, "focused.unlocked" 0.0;
+                               inherit, "default" 0.0;
+                               map.on, 1;
+                               image.normal, IC_NETWORK_FOC_04_PNG;
+                       }
+                       description {
+                               state, "unfocused.locked" 0.0;
+                               inherit, "default" 0.0;
+                               map.on, 1;
+                               image.normal, IC_LOCK_NETWORK_NOR_04_PNG;
+                       }
+                       description {
+                               state, "unfocused.unlocked" 0.0;
                                inherit, "default" 0.0;
                                map.on, 1;
+                               image.normal, IC_NETWORK_NOR_04_PNG;
                        }
                }
 
@@ -149,7 +190,7 @@ group {
                }
 
                part {
-                       name, PART_THUMB_TEXT;
+                       name, PART_WIFI_NAME;
                        type, TEXT;
                        scale, 1;
                        description {
@@ -181,6 +222,68 @@ group {
                        }
                }
 
+               part {
+                       name, "padding.check.icon";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 20 0;
+                               rel1 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2.to, "part.bg";
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "part.check.icon";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 50 50;
+                               rel1 {
+                                       to, "padding.check.icon";
+                                       relative, 0.0 0.5;
+                               }
+                               rel2 {
+                                       to, "padding.check.icon";
+                                       relative, 0.0 0.5;
+                               }
+                               align, 1.0 0.5;
+                               fixed, 1 1;
+                               image.normal, IC_CHECK_NOR_PNG;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused.checked" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                               map.on, 1;
+                               image.normal, IC_CHECK_FOC_PNG;
+                       }
+                       description {
+                               state, "focused.unchecked" 0.0;
+                               inherit, "default" 0.0;
+                               map.on, 1;
+                       }
+                       description {
+                               state, "unfocused.checked" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                               map.on, 1;
+                       }
+                       description {
+                               state, "unfocused.unchecked" 0.0;
+                               inherit, "default" 0.0;
+                               map.on, 1;
+                       }
+               }
+
                part {
                        name, "part.inside.line.up";
                        type, RECT;
@@ -259,4 +362,79 @@ group {
                        }
                }
        }
+
+       programs {
+               program {
+                       name, "load";
+                       signal, "load";
+                       source, "";
+                       script {
+                               set_int(lock_state, STATE_NORMAL);
+                               set_int(check_state, STATE_NORMAL);
+                       }
+               }
+
+               program {
+                       name, "elm,state,focused";
+                       signal, "elm,state,focused";
+                       source, SRC_ELM;
+                       script {
+                               new state;
+                               state = get_int(lock_state);
+                               if (state == STATE_LOCKED)
+                                       set_state(PART:"part.wifi.icon", "focused.locked", 0.0);
+                               else
+                                       set_state(PART:"part.wifi.icon", "focused.unlocked", 0.0);
+
+                               state = get_int(check_state);
+                               if (state == STATE_CHECKED)
+                                       set_state(PART:"part.check.icon", "focused.checked", 0.0);
+                               else
+                                       set_state(PART:"part.check.icon", "focused.unchecked", 0.0);
+
+                               set_state(PART:PART_THUMB_TEXT, "focused", 0.0);
+                               set_state(PART:"part.bg", "focused", 0.0);
+                       }
+               }
+
+               program {
+                       name, "elm,state,unfocused";
+                       signal, "elm,state,unfocused";
+                       source, SRC_ELM;
+                       script {
+                               new state;
+                               state = get_int(lock_state);
+                               if (state == STATE_LOCKED)
+                                       set_state(PART:"part.wifi.icon", "unfocused.locked", 0.0);
+                               else
+                                       set_state(PART:"part.wifi.icon", "unfocused.unlocked", 0.0);
+
+                               state = get_int(check_state);
+                               if (state == STATE_CHECKED)
+                                       set_state(PART:"part.check.icon", "unfocused.checked", 0.0);
+                               else
+                                       set_state(PART:"part.check.icon", "unfocused.unchecked", 0.0);
+
+                               set_state(PART:PART_THUMB_TEXT, "default", 0.0);
+                               set_state(PART:"part.bg", "default", 0.0);
+                       }
+               }
+
+               program {
+                       signal, "elm,state,part_state_lock,active";
+                       source, SRC_ELM;
+                       script {
+                               set_int(lock_state, STATE_LOCKED);
+                               set_state(PART:"part.wifi.icon", "unfocused.locked", 0.0);
+                       }
+               }
+               program {
+                       signal, "elm,state,part_state_check,active";
+                       source, SRC_ELM;
+                       script {
+                               set_int(check_state, STATE_CHECKED);
+                               set_state(PART:"part.check.icon", "unfocused.checked", 0.0);
+                       }
+               }
+       }
 }
diff --git a/src/grid/grid_wireless.c b/src/grid/grid_wireless.c
new file mode 100644 (file)
index 0000000..db7fc28
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 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.
+ */
+
+#include <Elementary.h>
+#include <gridmgr.h>
+#include <app_define.h>
+#include <app_debug.h>
+
+#include "define.h"
+#include "grid.h"
+#include "data/data_wireless.h"
+
+static char *_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       struct wifi_ap_info *ap_info;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return NULL;
+       }
+
+       ap_info = data;
+
+       if (!strcmp(part, PART_WIFI_NAME) && ap_info->essid)
+               return strdup(ap_info->essid);
+
+       return NULL;
+}
+
+static Eina_Bool _state_get(void *data, Evas_Object *obj, const char *part)
+{
+       struct wifi_ap_info *ap_info;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return EINA_FALSE;
+       }
+
+       ap_info = data;
+
+       if (!strcmp(part, PART_STATE_LOCK)) {
+               if (ap_info->secure_type != WIFI_SECURITY_TYPE_NONE)
+                       return EINA_TRUE;
+               else
+                       return EINA_FALSE;
+       } else if (!strcmp(part, PART_STATE_CHECK)) {
+               if (ap_info->connection_state
+                               == WIFI_CONNECTION_STATE_CONNECTED)
+                       return EINA_TRUE;
+               else
+                       return EINA_FALSE;
+       }
+
+       return EINA_FALSE;
+}
+
+static struct grid_class _gclass = {
+       .item_style = STYLE_GRID_WIRELESS,
+       .text_get = _text_get,
+       .state_get = _state_get,
+       .del = NULL,
+};
+
+struct grid_class *get_wireless_grid_class(void)
+{
+       return &_gclass;
+}