add tabs to main layout and placeholder contacts and history.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Wed, 11 Jul 2012 15:49:10 +0000 (12:49 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Wed, 11 Jul 2012 15:49:10 +0000 (12:49 -0300)
Makefile.am
data/themes/default.edc
data/themes/images/bt_history_pressed.png [new file with mode: 0644]
data/themes/images/bt_history_released.png [new file with mode: 0644]
dialer/contacts.c [new file with mode: 0644]
dialer/contacts.h [new file with mode: 0644]
dialer/gui.c
dialer/history.c [new file with mode: 0644]
dialer/history.h [new file with mode: 0644]

index 02d634b..5785831 100644 (file)
@@ -34,6 +34,10 @@ dialer_dialer_SOURCES = \
        dialer/gui.h \
        dialer/keypad.c \
        dialer/keypad.h \
+       dialer/contacts.c \
+       dialer/contacts.h \
+       dialer/history.c \
+       dialer/history.h \
        dialer/callscreen.c \
        dialer/callscreen.h
 
@@ -62,6 +66,8 @@ data/themes/images/bt_call_pressed.png \
 data/themes/images/bt_call_released.png \
 data/themes/images/bt_contacts_pressed.png \
 data/themes/images/bt_contacts_released.png \
+data/themes/images/bt_history_pressed.png \
+data/themes/images/bt_history_released.png \
 data/themes/images/bt_keypad_pressed.png \
 data/themes/images/bt_keypad_released.png \
 data/themes/images/bt_merge_pressed.png \
index face672..915f78d 100644 (file)
@@ -34,6 +34,16 @@ collections {
 
    group {
       name: "elm/layout/dialer/main";
+
+      images {
+         image: "bt_keypad_pressed.png" COMP;
+         image: "bt_keypad_released.png" COMP;
+         image: "bt_contacts_pressed.png" COMP;
+         image: "bt_contacts_released.png" COMP;
+         image: "bt_history_pressed.png" COMP;
+         image: "bt_history_released.png" COMP;
+      }
+
       parts {
          part {
             name: "bg";
@@ -52,8 +62,306 @@ collections {
                state: "default" 0.0;
                rel2.offset: -1 -171;
             }
+            description {
+               state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+         part {
+            name: "elm.swallow.contacts";
+            type: SWALLOW;
+            description {
+               state: "default" 0.0;
+               rel2.offset: -1 -171;
+            }
+            description {
+               state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+         part {
+            name: "elm.swallow.history";
+            type: SWALLOW;
+            description {
+               state: "default" 0.0;
+               rel2.offset: -1 -171;
+            }
+            description {
+               state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+
+         part {
+            name: "bg.actions";
+            type: RECT;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               color: 0 0 0 0;
+               min: 720 170;
+               max: 720 99999; /* keep it tight centered */
+               fixed: 1 1;
+               rel1 {
+                  relative: 0.0 1.0;
+                  offset: 0 -170;
+               }
+            }
+         }
+
+#define ACTION_TOGGLE(id, x1, x2)                                       \
+         part {                                                         \
+            name: "button."##id;                                        \
+            type: IMAGE;                                                \
+            mouse_events: 1;                                            \
+            clip_to: "clipper.toggle."##id;                             \
+            description {                                               \
+               state: "default" 0.0;                                    \
+               color: 255 255 255 255;                                  \
+               color_class: "action";                                   \
+               min: 240 170;                                            \
+               max: 240 170;                                            \
+               fixed: 1 1;                                              \
+               rel1 {                                                   \
+                  to: "bg.actions";                                     \
+                  relative: x1 0.0;                                    \
+               }                                                        \
+               rel2 {                                                   \
+                  to: "bg.actions";                                     \
+                  relative: x2 1.0;                                     \
+                  offset: -1 -1;                                        \
+               }                                                        \
+               image.normal: "bt_"##id"_released.png";                  \
+            }                                                           \
+            description {                                               \
+               state: "pressed" 0.0;                                    \
+               inherit: "default" 0.0;                                  \
+               color: 255 255 255 0;                                    \
+               visible: 0;                                              \
+            }                                                           \
+         }                                                              \
+         part {                                                         \
+            name: "button.over."##id;                                   \
+            type: IMAGE;                                                \
+            description {                                               \
+               state: "default" 0.0;                                    \
+               color: 255 255 255 0;                                    \
+               visible: 0;                                              \
+               color_class: "action";                                   \
+               rel1.to: "button."##id;                                  \
+               rel2.to: "button."##id;                                  \
+               image.normal: "bt_"##id"_pressed.png";                   \
+            }                                                           \
+            description {                                               \
+               state: "pressed" 0.0;                                    \
+               inherit: "default" 0.0;                                  \
+               color: 255 255 255 255;                                  \
+               visible: 1;                                              \
+            }                                                           \
+         }                                                              \
+         part {                                                         \
+            name: "clipper.toggle."##id;                                \
+            type: RECT;                                                 \
+            mouse_events: 0;                                            \
+            description {                                               \
+               state: "default" 0.0;                                    \
+               color: 255 255 255 255;                                  \
+               visible: 1;                                              \
+            }                                                           \
+            description {                                               \
+               state: "on" 0.0;                                         \
+               inherit: "default" 0.0;                                  \
+               color: 255 255 255 0;                                    \
+               visible: 0;                                              \
+            }                                                           \
+         }                                                              \
+         part {                                                         \
+            name: "button.toggle."##id;                                 \
+            type: IMAGE;                                                \
+            mouse_events: 1;                                            \
+            description {                                               \
+               state: "default" 0.0;                                    \
+               color: 255 255 255 0;                                    \
+               visible: 0;                                              \
+               color_class: "action";                                   \
+               rel1.to: "button."##id;                                  \
+               rel2.to: "button."##id;                                  \
+               image.normal: "bt_"##id"_pressed.png";                   \
+            }                                                           \
+            description {                                               \
+               state: "on" 0.0;                                         \
+               inherit: "default" 0.0;                                  \
+               color: 255 255 255 255;                                  \
+               visible: 1;                                              \
+            }                                                           \
+         }                                                              \
+         part {                                                         \
+            name: "blocker."##id;                                       \
+            type: RECT;                                                 \
+            mouse_events: 1;                                            \
+            description {                                               \
+               state: "default" 0.0;                                    \
+               color: 0 0 0 0;                                          \
+               visible: 0;                                              \
+            }                                                           \
+            description {                                               \
+               state: "disabled" 0.0;                                   \
+               inherit: "default" 0.0;                                  \
+               visible: 1;                                              \
+            }                                                           \
+         }                                                              \
+         programs {                                                     \
+            program {                                                   \
+               signal: "mouse,up,1";                                    \
+               source: "button."##id;                                   \
+               action: SIGNAL_EMIT "released,"##id "gui";               \
+               after: "show_up_"##id;                                   \
+            }                                                           \
+            program {                                                   \
+               name: "show_up_"##id;                                    \
+               action: STATE_SET "default" 0.0;                         \
+               transition: DECELERATE 0.1;                              \
+               target: "button."##id;                                   \
+               target: "button.over."##id;                              \
+            }                                                           \
+            program {                                                   \
+               signal: "mouse,down,1";                                  \
+               source: "button."##id;                                   \
+               after: "show_down_"##id;                                 \
+               action: SIGNAL_EMIT "pressed,"##id "gui";                \
+            }                                                           \
+            program {                                                   \
+               name: "show_down_"##id;                                  \
+               action: STATE_SET "pressed" 0.0;                         \
+               transition: ACCELERATE 0.1;                              \
+               target: "button."##id;                                   \
+               target: "button.over."##id;                              \
+            }                                                           \
+            program {                                                   \
+               signal: "mouse,clicked,1";                               \
+               source: "button."##id;                                   \
+               action: SIGNAL_EMIT "clicked,"##id "gui";                \
+            }                                                           \
+            program {                                                   \
+               signal: "mouse,clicked,1";                               \
+               source: "button.toggle."##id;                            \
+               action: SIGNAL_EMIT "clicked,"##id "gui";                \
+            }                                                           \
+            program {                                                   \
+               signal: "toggle,on,"##id;                                \
+               source: "gui";                                           \
+               action: STATE_SET "on" 0.0;                              \
+               target: "clipper.toggle."##id;                           \
+               target: "button.toggle."##id;                            \
+            }                                                           \
+            program {                                                   \
+               signal: "toggle,off,"##id;                               \
+               source: "gui";                                           \
+               action: STATE_SET "default" 0.0;                         \
+               target: "clipper.toggle."##id;                           \
+               target: "button.toggle."##id;                            \
+            }                                                           \
          }
 
+         ACTION_TOGGLE("keypad",   0.000000000, 0.333333333);
+         ACTION_TOGGLE("contacts", 0.333333333, 0.666666666);
+         ACTION_TOGGLE("history",  0.666666666, 1.000000000);
+#undef ACTION_TOGGLE
+
+         programs {
+            program {
+               name: "show-keypad-swallow-phase1";
+               signal: "show,keypad";
+               source: "gui";
+               action: STATE_SET "hidden" 0.0;
+               target: "elm.swallow.contacts";
+               target: "elm.swallow.history";
+               after: "show-keypad-swallow-phase2";
+            }
+            program {
+               name: "show-keypad-swallow-phase2";
+               action: STATE_SET "default" 0.0;
+               target: "elm.swallow.keypad";
+            }
+
+            program {
+               signal: "show,keypad";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,on,keypad" "gui";
+            }
+            program {
+               signal: "show,keypad";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,off,contacts" "gui";
+            }
+            program {
+               signal: "show,keypad";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,off,history" "gui";
+            }
+
+            program {
+               name: "show-contacts-swallow-phase1";
+               signal: "show,contacts";
+               source: "gui";
+               action: STATE_SET "hidden" 0.0;
+               target: "elm.swallow.keypad";
+               target: "elm.swallow.history";
+               after: "show-contacts-swallow-phase2";
+            }
+            program {
+               name: "show-contacts-swallow-phase2";
+               action: STATE_SET "default" 0.0;
+               target: "elm.swallow.contacts";
+            }
+
+            program {
+               signal: "show,contacts";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,on,contacts" "gui";
+            }
+            program {
+               signal: "show,contacts";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,off,keypad" "gui";
+            }
+            program {
+               signal: "show,contacts";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,off,history" "gui";
+            }
+
+            program {
+               name: "show-history-swallow-phase1";
+               signal: "show,history";
+               source: "gui";
+               action: STATE_SET "hidden" 0.0;
+               target: "elm.swallow.contacts";
+               target: "elm.swallow.keypad";
+               after: "show-history-swallow-phase2";
+            }
+            program {
+               name: "show-history-swallow-phase2";
+               action: STATE_SET "default" 0.0;
+               target: "elm.swallow.history";
+            }
+
+            program {
+               signal: "show,history";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,on,history" "gui";
+            }
+            program {
+               signal: "show,history";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,off,contacts" "gui";
+            }
+            program {
+               signal: "show,history";
+               source: "gui";
+               action: SIGNAL_EMIT "toggle,off,keypad" "gui";
+            }
+         }
       }
    }
 
diff --git a/data/themes/images/bt_history_pressed.png b/data/themes/images/bt_history_pressed.png
new file mode 100644 (file)
index 0000000..dbd41fd
Binary files /dev/null and b/data/themes/images/bt_history_pressed.png differ
diff --git a/data/themes/images/bt_history_released.png b/data/themes/images/bt_history_released.png
new file mode 100644 (file)
index 0000000..80955cf
Binary files /dev/null and b/data/themes/images/bt_history_released.png differ
diff --git a/dialer/contacts.c b/dialer/contacts.c
new file mode 100644 (file)
index 0000000..e1b31b4
--- /dev/null
@@ -0,0 +1,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Elementary.h>
+
+Evas_Object *contacts_add(Evas_Object *parent) {
+       Evas_Object *obj = elm_label_add(parent);
+       elm_object_text_set(obj, "TO BE DONE");
+       return obj;
+}
diff --git a/dialer/contacts.h b/dialer/contacts.h
new file mode 100644 (file)
index 0000000..b97f423
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _EFL_OFONO_CONTACTS_H__
+#define _EFL_OFONO_CONTACTS_H__ 1
+
+Evas_Object *contacts_add(Evas_Object *parent);
+
+#endif
index 47d0dca..76704db 100644 (file)
@@ -6,10 +6,15 @@
 #include "log.h"
 #include "gui.h"
 #include "keypad.h"
+#include "contacts.h"
+#include "history.h"
 #include "callscreen.h"
 
 static Evas_Object *win = NULL;
-static Evas_Object *kp = NULL;
+static Evas_Object *main_layout = NULL;
+static Evas_Object *keypad = NULL;
+static Evas_Object *contacts = NULL;
+static Evas_Object *history = NULL;
 static Evas_Object *cs = NULL;
 static Evas_Object *flip = NULL;
 static char def_theme[PATH_MAX] = "";
@@ -30,6 +35,17 @@ Evas_Object *gui_layout_add(Evas_Object *parent, const char *style)
        return layout;
 }
 
+static void _gui_show(Evas_Object *o)
+{
+       if (o == keypad)
+               elm_object_signal_emit(main_layout, "show,keypad", "gui");
+       else if (o == contacts)
+               elm_object_signal_emit(main_layout, "show,contacts", "gui");
+       else if (o == history)
+               elm_object_signal_emit(main_layout, "show,history", "gui");
+       elm_object_focus_set(o, EINA_TRUE);
+}
+
 static void _popup_close(void *data, Evas_Object *bt __UNUSED__, void *event __UNUSED__)
 {
        Evas_Object *popup = data;
@@ -61,8 +77,8 @@ void gui_activate(void)
 
 void gui_number_set(const char *number, Eina_Bool auto_dial)
 {
-       /* TODO: show keypad */
-       keypad_number_set(kp, number, auto_dial);
+       _gui_show(keypad);
+       keypad_number_set(keypad, number, auto_dial);
 }
 
 void gui_call_enter(void)
@@ -86,7 +102,7 @@ void gui_call_exit(void)
                return;
        in_flip_anim = EINA_TRUE;
        elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
-       elm_object_focus_set(kp, EINA_TRUE);
+       elm_object_focus_set(cs, EINA_FALSE);
 }
 
 static void _gui_call_sync(void *data __UNUSED__, Evas_Object *o __UNUSED__,
@@ -97,14 +113,27 @@ static void _gui_call_sync(void *data __UNUSED__, Evas_Object *o __UNUSED__,
        if (showing_call ^ in_call) {
                DBG("Flip back to sync");
                elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
-               if (in_call)
-                       elm_object_focus_set(cs, EINA_TRUE);
-               else
-                       elm_object_focus_set(kp, EINA_TRUE);
+               elm_object_focus_set(cs, in_call);
        }
        in_flip_anim = EINA_FALSE;
 }
 
+static void _on_clicked(void *data __UNUSED__, Evas_Object *o __UNUSED__,
+                       const char *emission, const char *source __UNUSED__)
+{
+       DBG("signal: %s", emission);
+
+       EINA_SAFETY_ON_FALSE_RETURN(eina_str_has_prefix(emission, "clicked,"));
+       emission += strlen("clicked,");
+
+       if (strcmp(emission, "keypad") == 0)
+               _gui_show(keypad);
+       else if (strcmp(emission, "contacts") == 0)
+               _gui_show(contacts);
+       else if (strcmp(emission, "history") == 0)
+               _gui_show(history);
+}
+
 Eina_Bool gui_init(void)
 {
        Evas_Object *lay, *obj;
@@ -135,7 +164,7 @@ Eina_Bool gui_init(void)
                                        _gui_call_sync, NULL);
        evas_object_show(flip);
 
-       lay = gui_layout_add(win, "main");
+       main_layout = lay = gui_layout_add(win, "main");
        EINA_SAFETY_ON_NULL_RETURN_VAL(lay, EINA_FALSE);
        evas_object_size_hint_weight_set(lay,
                                EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -143,10 +172,23 @@ Eina_Bool gui_init(void)
        elm_object_part_content_set(flip, "front", lay);
        evas_object_show(lay);
 
-       kp = obj = keypad_add(win);
+       elm_object_signal_callback_add(lay, "clicked,*", "gui",
+                                       _on_clicked, NULL);
+
+       keypad = obj = keypad_add(win);
        EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
        elm_object_part_content_set(lay, "elm.swallow.keypad", obj);
 
+       contacts = obj = contacts_add(win);
+       EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+       elm_object_part_content_set(lay, "elm.swallow.contacts", obj);
+
+       history = obj = history_add(win);
+       EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+       elm_object_part_content_set(lay, "elm.swallow.history", obj);
+
+       _gui_show(keypad);
+
        cs = obj = callscreen_add(win);
        EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
        evas_object_size_hint_weight_set(obj,
diff --git a/dialer/history.c b/dialer/history.c
new file mode 100644 (file)
index 0000000..819ab55
--- /dev/null
@@ -0,0 +1,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Elementary.h>
+
+Evas_Object *history_add(Evas_Object *parent) {
+       Evas_Object *obj = elm_label_add(parent);
+       elm_object_text_set(obj, "TO BE DONE");
+       return obj;
+}
diff --git a/dialer/history.h b/dialer/history.h
new file mode 100644 (file)
index 0000000..54206bc
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _EFL_OFONO_HISTORY_H__
+#define _EFL_OFONO_HISTORY_H__ 1
+
+Evas_Object *history_add(Evas_Object *parent);
+
+#endif