Worldclock Map View and timezone details added.
authorRadoslaw Czerski <r.czerski@samsung.com>
Tue, 13 Sep 2016 13:48:32 +0000 (15:48 +0200)
committerRadoslaw Czerski <r.czerski@samsung.com>
Tue, 13 Sep 2016 13:48:32 +0000 (15:48 +0200)
MVP model is not implemented yet and will be added in separate commit.

Change-Id: Iad0aa1d8950856f9cfe6810811c4d941c3ddb8cb
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
20 files changed:
clock/inc/Internal/WorldClockDefs.h [new file with mode: 0644]
clock/inc/Model/Location.h
clock/inc/Model/WordlClock.h [deleted file]
clock/inc/Model/WorldClock.h [new file with mode: 0644]
clock/inc/Utils/Time.h
clock/inc/View/WorldClockView.h
clock/project_def.prop
clock/res/edje/WorldClock.edc [new file with mode: 0644]
clock/res/edje/color_classes.edc [new file with mode: 0644]
clock/res/edje/images/arrow_bg.png [new file with mode: 0644]
clock/res/edje/images/clock_icon_world_clock_arrow_left.png [new file with mode: 0644]
clock/res/edje/images/clock_icon_world_clock_arrow_right.png [new file with mode: 0644]
clock/res/edje/images/clock_world_gmt_area.#.png [new file with mode: 0644]
clock/res/edje/images/clock_world_location_dot.png [new file with mode: 0644]
clock/res/edje/images/clock_world_location_ring.png [new file with mode: 0644]
clock/res/edje/images/clock_world_map_01.png [new file with mode: 0644]
clock/res/po/en_US.po [new file with mode: 0644]
clock/src/Model/WorldClock.cpp [new file with mode: 0644]
clock/src/Utils/Time.cpp
clock/src/View/WorldClockView.cpp

diff --git a/clock/inc/Internal/WorldClockDefs.h b/clock/inc/Internal/WorldClockDefs.h
new file mode 100644 (file)
index 0000000..f2c2995
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016 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 WORLDCLOCKDEFS_H_
+#define WORLDCLOCKDEFS_H_
+
+
+/* Messages */
+#define MESSAGE_ID_SET_TIMEZONE 1
+#define MESSAGE_ID_SET_LOCATION_DOT_POSITION 2
+
+/* Part visibility*/
+#define PART_VISIBLE 1
+#define PART_NOT_VISIBLE 0
+
+#define LOCATION_DOT_SIZE 7
+#define LOCATION_RING_SIZE 9
+
+#define STR_HELPER(x) #x
+#define STR(x) STR_HELPER(x)
+
+#define LOCATION_DOT_NAME(x) "dot."#x
+
+#define     QUOTE(hex)     #hex
+#define     TEST(name)      QUOTE(name ## foo)
+
+#define MAX_STYLE_LEN 512
+#define MAX_CITIES_LEN 512
+
+/* Parts names */
+
+#define TIMEZONE_DETAILS_FIRST_LINE_PART "main.timezone.details:timezone.details.first.line.content"
+#define TIMEZONE_DETAILS_SECOND_LINE_PART "main.timezone.details:timezone.details.second.line.cities"
+
+/* Styles names*/
+
+#define TIMEZONE_DETAILS_FIRST_LINE_TIME_STYLE(x) "<font=Tizen:style=Thin color=#fafafaff font_size=70 align=right ellipsis=-1.0>" x "</font>"
+#define TIMEZONE_DETAILS_FIRST_LINE_AMPM_STYLE(x) "<font=Tizen:style=Regular color=#fafafa font_size=36>" x "</font>"
+#define TIMEZONE_DETAILS_FIRST_LINE_RELATIVE_TO_LOCAL_STYLE(x) "<font=Tizen:style=Regular color=#fafafa font_size=36 align=left>" x "</font>"
+
+#define TIMEZONE_DETAILS_SECOND_LINE_CITIES(x) "<font=Tizen:style=Regular color=#fafafa font_size=36 align=center wrap=word ellipsis=1.0>" x "</font>"
+
+
+#endif /* WORLDCLOCKDEFS_H_ */
index e8eefa8..420723c 100644 (file)
@@ -4,12 +4,16 @@
 #include <string>
 
 namespace model {
-       struct Location {
-               std::string Name;
-               std::string Country;
-               std::string Timezone;
-               std::string TzPath;
-       };
+struct Location {
+       std::string name;
+       std::string country;
+
+       int gmt_offset_;
+       int x;
+       int y;
+
+       bool summertime;
+};
 } /* model */
 
 #endif
diff --git a/clock/inc/Model/WordlClock.h b/clock/inc/Model/WordlClock.h
deleted file mode 100644 (file)
index 7307218..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _CLOCK_WORLDCLOCK_H_
-#define _CLOCK_WORLDCLOCK_H_
-
-#include <vector>
-
-namespace model {
-       class WorldClock {
-               public:
-                       const std::vector<Location> Locations;
-                       const std::vector<Location> UserLocations;
-
-                       void AddUserLocation(Location loc);
-                       void RemoveUserLocation(Location loc);
-       };
-} /* model */
-
-#endif
diff --git a/clock/inc/Model/WorldClock.h b/clock/inc/Model/WorldClock.h
new file mode 100644 (file)
index 0000000..d560a42
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef _CLOCK_WORLDCLOCK_H_
+#define _CLOCK_WORLDCLOCK_H_
+
+#include <vector>
+
+#include "Model/Location.h"
+
+namespace model {
+
+       struct Timezone{
+                       int x_coord;
+                       int zone_width;
+                       int gmt_offset; /*minutes*/
+                       std::vector<model::Location> places;
+       };
+
+       class WorldClock {
+               public:
+                       WorldClock();
+                       std::vector<model::Location> UserLocations;
+
+                       void AddUserLocation(model::Location l);
+                       void RemoveUserLocation(model::Location l);
+
+                       void InitTimeZones();
+                       void InitLocations();
+                       int GetCurrentTimezoneNo();
+                       Timezone *GetCurrentTimezone();
+                       const char *GetCurrentTzString();
+                       char *OffsetToString(int offset);
+                       void SetCurrentTimezone(int tz);
+                       int GetTimezonesCount();
+                       int GetLocationsCount();
+                       const Timezone *GetTimezoneByOffset(int offset);
+               private:
+                       int current_tz_;
+                       model::Location user_location_;
+                       static std::vector<model::Location> locations_;
+                       static std::vector<Timezone> time_zones_;
+
+       };
+} /* model */
+
+#endif
index a084658..6172927 100644 (file)
@@ -20,7 +20,10 @@ namespace utils {
                                (a.Min == Min) && (a.Sec == Sec) && (a.Msec == Msec); }
                        std::string Format(enum Format format) const;
                        std::string Meridiem() const;
-                       std::string getFormattedTime(const char *icu_format) const;
+                       std::string GetMeridiemByOffset(int timezone_offset) const;
+                       std::string GetFormattedTime(const char *icu_format) const;
+                       std::string GetFormattedTimeByTimezoneOffset(const char *icu_format, int timezone_offset) const;
+                       int GetLocalTimezoneOffset(void) const;
        };
 } /* utils */
 
index f482af6..58af59e 100644 (file)
  * limitations under the License.
  */
 
-#ifndef WORLDCLOCKVIEW_H_
-#define WORLDCLOCKVIEW_H_
+#ifndef _CLOCK_VIEW_WORLDCLOCK_H_
+#define _CLOCK_VIEW_WORLDCLOCK_H_
 
+#include "Model/WorldClock.h"
 #include "View/PageView.h"
 #include "View/View.h"
 
 namespace view {
-       class WorldClockView : public ui::IView {
+       class WorldClockView: public ui::IView {
                public:
-               WorldClockView();
-               Evas_Object *GetEvasObject(){return world_clock_;};
+                       WorldClockView();
 
-       private:
-               Evas_Object *world_clock_;
+                       Evas_Object *GetEvasObject(){return world_clock_;};
+
+                       void UpdateTimezoneDetails(model::Timezone *timezone);
+
+               private:
+                       //TODO use function
+                       static void ChangeTimezoneCb(void *data, Evas_Object *obj,
+                               const char *emission, const char *source);
+
+                       void UpdateTimezoneLocationsDots();
+                       void UpdateGmtOffset();
+                       void UpdateTimezoneArea();
+                       void CreateTimezoneDetails();
+
+                       Evas_Object *CreateTimezoneTime();
+                       Evas_Object *CreateTimezoneXMeridiem();
+                       Evas_Object *CreateTimezoneRelativeToLocalObject();
+
+                       Evas_Object *CreatePadding(int width);
+                       void CreateTimezoneCitiesList();
+
+                       void UpdateTimezoneTime(int timezone_offset);
+                       void UpdateTimezoneXMeridiem(int timezone_offset);
+                       void UpdateTimezoneRelativeToLocal(int timezone_offset);
+
+                       void UpdateTimezoneCitiesList(model::Timezone *timezone);
+
+                       model::WorldClock *world_clock_data_;
+                       Evas_Object *world_clock_;
+                       Evas_Object *timezone_details_;
+                       Evas_Object *timezone_cities_;
        };
 }
 
-#endif /* WORLDCLOCKVIEW_H_ */
+#endif /* _CLOCK_VIEW_WORLDCLOCK_H_ */
index 1599857..329162c 100644 (file)
@@ -16,7 +16,7 @@ USER_SRCS_ABS =
 USER_EDCS =  
 
 # PO Sources
-USER_POS = 
+USER_POS = res/po/*.po
 
 # User Defines
 USER_DEFS = 
@@ -50,22 +50,22 @@ USER_LIB_DIRS = $(workspace_loc)/common/${BUILD_CONFIG}
 USER_LIB_DIRS_ABS =
 
 # EDC Resource Path
-USER_EDCS_IMAGE_DIRS = edje/images 
+USER_EDCS_IMAGE_DIRS = res/edje/images
 USER_EDCS_IMAGE_DIRS_ABS = 
-USER_EDCS_SOUND_DIRS = edje/sounds 
+USER_EDCS_SOUND_DIRS = res/edje/sounds
 USER_EDCS_SOUND_DIRS_ABS = 
-USER_EDCS_FONT_DIRS = edje/fonts 
+USER_EDCS_FONT_DIRS = res/edje/fonts
 USER_EDCS_FONT_DIRS_ABS = 
 
 # EDC Flags
 USER_EXT_EDC_KEYS = EDC0 
 
-USER_EXT_EDC0_EDCS = res/edje/clock.edc res/edje/alarm.edc res/edje/edit_alarm.edc res/edje/StopWatch.edc res/edje/Counter.edc
-USER_EXT_EDC0_EDCS_IMAGE_DIRS = edje/images 
+USER_EXT_EDC0_EDCS = res/edje/*.edc
+USER_EXT_EDC0_EDCS_IMAGE_DIRS = res/edje/images
 USER_EXT_EDC0_EDCS_IMAGE_DIRS_ABS = 
-USER_EXT_EDC0_EDCS_SOUND_DIRS = edje/sounds 
+USER_EXT_EDC0_EDCS_SOUND_DIRS = res/edje/sounds
 USER_EXT_EDC0_EDCS_SOUND_DIRS_ABS = 
-USER_EXT_EDC0_EDCS_FONT_DIRS = edje/fonts 
+USER_EXT_EDC0_EDCS_FONT_DIRS = res/edje/fonts
 USER_EXT_EDC0_EDCS_FONT_DIRS_ABS = 
 
 # Resource Filter
diff --git a/clock/res/edje/WorldClock.edc b/clock/res/edje/WorldClock.edc
new file mode 100644 (file)
index 0000000..97e08fc
--- /dev/null
@@ -0,0 +1,467 @@
+/*
+* Copyright (c) 2016 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 "../../inc/Internal/WorldClockDefs.h"
+
+#define DOT_SWALLOW( partName, partName2, offset_x, offset_y) \
+               image { partName; scale;\
+                       mouse_events: 0; \
+                       desc { "default"; \
+                               min: 10 10; \
+                               max: 10 10; \
+                               color_class: "B043P"; \
+                               rel1 { \
+                                       to: "map"; \
+                                       offset: offset_x offset_y; \
+                               } \
+                               rel2 { \
+                                       relative: 0.0 0.0; \
+                                       to: "map"; \
+                               } \
+                               align: 0.0 0.0; \
+                               image.normal: "clock_world_location_dot.png"; \
+                       } \
+               } \
+               image { partName2; scale;\
+                       mouse_events: 0; \
+                       desc { "default"; \
+                               min: 10 10; \
+                               max: 10 10; \
+                               rel1 { \
+                                       to: "map"; \
+                                       offset: offset_x offset_y; \
+                               } \
+                               rel2 { \
+                                       relative: 0.0 0.0; \
+                                       to: "map"; \
+                               } \
+                               align: 0.0 0.0; \
+                               vis; \
+                               image.normal: "clock_world_location_ring.png"; \
+                       } \
+               }
+
+collections {
+
+       base_scale: 2.6;
+
+       #include "color_classes.edc"
+
+       images {
+               image: "clock_world_gmt_area.#.png" COMP;
+               image: "arrow_bg.png" COMP;
+               image: "clock_world_map_01.png" COMP;
+               image: "clock_icon_world_clock_arrow_left.png" COMP;
+               image: "clock_icon_world_clock_arrow_right.png" COMP;
+               image: "clock_world_location_dot.png" COMP;
+               image: "clock_world_location_ring.png" COMP;
+       }
+
+       group { name: "main";
+               parts {
+                       spacer { "main.top"; scale;
+                               desc { "default";
+                                       min: 720 17;
+                                       max: 720 17;
+                                       align: 0.5 0.0;
+                               }
+                       }
+                       group { "main.world.map"; scale;
+                               source:"world.map";
+                               desc { "default";
+                                       min: 720 406;
+                                       max: 720 406;
+                                       rel1 {
+                                               relative: 0.0 1.0;
+                                               to: "main.top";
+                                       }
+                                       rel2.relative: 1.0 1.0;
+                                       align: 0.5 0.0;
+                               }
+                       }
+                       group { "main.timezone.details"; scale;
+                               source: "timezone.details";
+                               desc { "default";
+                                       max: 720 256;
+                                       max: 720 256;
+                                       rel1 {
+                                               relative: 0.0 1.0;
+                                               to: "main.world.map";
+                                       }
+                                       rel2.relative: 1.0 1.0;
+                                       align: 0.5 0.0;
+                               }
+                       }
+               }
+       }
+
+       group { name: "world.map";
+               styles {
+                       style {
+                               name: "timezone_offset_style";
+                               base: "font=Tizen:style=Regular color=#fafafa font_size=40";
+                       }
+               }
+               parts {
+                       image { "map"; scale;
+                       desc { "default";
+                               min: 720 406;
+                               max: 720 406;
+                               fixed: 1 1;
+                               image.normal: "clock_world_map_01.png";
+                       }
+                       }
+
+                       image { "timezone.area"; scale;
+                               desc { "default";
+                                       min: 15 320;
+                                       max: 15 320;
+                                       align: 0.0 0.5;
+                                       rel1 {
+                                               relative: -0.2 67/406;
+                                               to: "map";
+                                       }
+                                       image.normal: "clock_world_gmt_area.#.png";
+                                       color_class: "AO009";
+                               }
+                       }
+
+                       textblock { "timezone_offset"; scale;
+                       desc { "default";
+                               rel1 {
+                                       offset: -30 -60;
+                                       to: "timezone.area";
+                               }
+                               rel2 {
+                                       relative: 1.0 0.0;
+                                       offset: +30 -5;
+                                       to: "timezone.area";
+                               }
+                               text {
+                                       text: "+ 0";
+                                       style: "timezone_offset_style";
+                                       min: 1 1;
+                                       max: 1 1;
+                                       ellipsis: -1;
+                               }
+                       }
+                       }
+                       DOT_SWALLOW("dot.0","ring.0", -1, -1)
+                       DOT_SWALLOW("dot.1", "ring.1", -1, -1)
+                       DOT_SWALLOW("dot.2", "ring.2", -1, -1)
+                       DOT_SWALLOW("dot.3", "ring.3", -1, -1)
+                       DOT_SWALLOW("dot.4", "ring.4", -1, -1)
+                       DOT_SWALLOW("dot.5", "ring.5", -1, -1)
+                       DOT_SWALLOW("dot.6", "ring.6", -1, -1)
+                       DOT_SWALLOW("dot.7", "ring.7", -1, -1)
+
+                       spacer { "arrow.spacer.top"; scale;
+                               desc { "default";
+                                       min: 720 196;
+                                       max: 720 196;
+                                       align: 0.5 0.0;
+                                       rel1.to: "map";
+                               }
+                       }
+
+                       spacer { "arrow.spacer.bottom"; scale;
+                               desc { "default";
+                                       min: 720 130;
+                                       max: 720 130;
+                                       align: 0.5 1.0;
+                                       rel1.to: "map";
+                               }
+                       }
+
+                       image { "arrow.left.bg"; scale;
+                               desc { "default";
+                                       max: 56 80;
+                                       hid;
+                                       color_class: "B043";
+                                       rel1.to: "arrow.left";
+                                       rel2.to: "arrow.left";
+                                       image {
+                                               normal: "arrow_bg.png";
+                                               border: 10 10 10 10;
+                                       }
+                               }
+                               desc { "on.click.start";
+                                       inherit: "default";
+                                       vis;
+                                       max: (56 * 0.7) (80 * 0.7);
+                               }
+                               desc { "on.click.end";
+                                       inherit: "default";
+                                       vis;
+                                       max: 56 80;
+                               }
+                       }
+
+                       image { "arrow.left"; scale;
+                               desc { "default";
+                                       max: 56 80;
+                                       rel1 {
+                                               relative: 0.0 1.0;
+                                               to: "arrow.spacer.top";
+                                               offset: 10 0;
+                                       }
+                                       align: 0.0 0.0;
+                                       image.normal: "clock_icon_world_clock_arrow_left.png";
+                                       color_class: "AO010";
+                               }
+                       }
+
+                       image { "arrow.right.bg"; scale;
+                               desc { "default";
+                                       min: 56 80;
+                                       max: 56 80;
+                                       hid;
+                                       color_class: "B043";
+                                       rel1.to: "arrow.right";
+                                       rel2.to: "arrow.right";
+                                       image {
+                                               normal: "arrow_bg.png";
+                                               border: 10 10 10 10;
+                                       }
+                               }
+                               desc { "on.click.start";
+                                       inherit: "default";
+                                       vis;
+                                       min: (56 * 0.7) (80 * 0.7);
+                                       max: (56 * 0.7) (80 * 0.7);
+                               }
+                               desc { "on.click.end";
+                                       inherit: "default";
+                                       vis;
+                                       min: 56 80;
+                                       max: 56 80;
+                               }
+                       }
+
+                       image { "arrow.right"; scale;
+                               desc { "default";
+                                       max: 56 80;
+                                       rel1 {
+                                               relative: 0.0 1.0;
+                                               to_y: "arrow.spacer.top";
+                                       }
+                                       rel2 {
+                                               relative: 1.0 0.0;
+                                               to: "arrow.spacer.bottom";
+                                               offset: -10 0;
+                                       }
+                                       align: 1.0 1.0;
+                                       image.normal: "clock_icon_world_clock_arrow_right.png";
+                                       color_class: "AO010";
+                               }
+                       }
+               }
+
+               script {
+
+                       public set_dot_and_ring_custom_state (dot_nr, Float:x, Float:y, visibility)
+                       {
+                               new dot_id[6], ring_id[7];
+                               new dot_part_id, ring_part_id;
+
+                               snprintf(dot_id, sizeof(dot_id),        "dot.%d", dot_nr);
+                               snprintf(ring_id, sizeof(ring_id),      "ring.%d", dot_nr);
+
+                               dot_part_id = get_part_id(dot_id);
+                               ring_part_id = get_part_id(ring_id);
+
+                               new Float:dot_rel1_x;
+                               new Float:dot_rel1_y;
+                               new Float:ring_rel1_x;
+                               new Float:ring_rel1_y;
+
+                               dot_rel1_x = (x - (LOCATION_DOT_SIZE / 2)) / 720;
+                               dot_rel1_y = (y - (LOCATION_DOT_SIZE / 2)) / 406;
+
+                               custom_state(dot_part_id, "default", 0.0);
+                               set_state_val(dot_part_id, STATE_REL1, dot_rel1_x, dot_rel1_y);
+                               set_state_val(dot_part_id, STATE_VISIBLE, visibility);
+                               set_state(dot_part_id, "custom", 0.0);
+
+                               ring_rel1_x = (x - (LOCATION_RING_SIZE / 2)) / 720;
+                               ring_rel1_y = (y - (LOCATION_RING_SIZE / 2)) / 406;
+
+                               custom_state(ring_part_id, "default", 0.0);
+                               set_state_val(ring_part_id, STATE_REL1, ring_rel1_x, ring_rel1_y);
+                               set_state_val(ring_part_id, STATE_VISIBLE, visibility);
+                               set_state(ring_part_id, "custom", 0.0);
+                       }
+
+                       public message (Msg_Type:type, id, ...)
+                       {
+                               if ((type == MSG_INT_SET) && (id == MESSAGE_ID_SET_TIMEZONE)) {
+                                       new timezone_x, timezone_width;
+                                       new Float:rel, Float:rel1_x;
+
+                                       timezone_x = getarg(2);
+                                       timezone_width = getarg(3);
+
+                                       rel1_x = timezone_x + (timezone_width - 15) / 2;
+                                       rel =   rel1_x / 720;
+
+                                       custom_state(PART:"timezone.area", "default", 0.0);
+                                       set_state_val(PART:"timezone.area", STATE_REL1, rel, 67/406);
+                                       set_state(PART:"timezone.area", "custom", 0.0);
+                               }
+                               else if ((type == MSG_INT_SET) && (id == MESSAGE_ID_SET_LOCATION_DOT_POSITION)) {
+                                       new Float:x = getarg(2);
+                                       new Float:y = getarg(3);
+                                       new visibility = getarg(4);
+                                       new dot_nr = getarg(5);
+
+                                       set_dot_and_ring_custom_state(dot_nr, x, y, visibility);
+                               }
+                       }
+               }
+               programs {
+
+                       //Programs for left arrow click
+                       program {
+                               name: "arrow.left.mouse.down";
+                               signal: "mouse,down,*";
+                               source: "arrow.left";
+                               action: STATE_SET "on.click.start";
+                               target: "arrow.left.bg";
+                               sequence {
+                                       action: STATE_SET "on.click.end";
+                                       target: "arrow.left.bg";
+                                       transition: LINEAR 0.05;
+                               }
+                       }
+
+                       program {
+                               name: "arrow.left.mouse.up";
+                               signal: "mouse,up,*";
+                               source: "arrow.left";
+                               action: SIGNAL_EMIT "timezone,go,left" "arrow.left";
+                               sequence {
+                                       action: STATE_SET "on.click.start";
+                                       target: "arrow.left.bg";
+                                       transition: LINEAR 0.05;
+
+                                       action: STATE_SET "default";
+                                       target: "arrow.left.bg";
+                               }
+                       }
+
+                       //Programs for right arrow click
+                       program {
+                               name: "arrow.right.mouse.down";
+                               signal: "mouse,down,*";
+                               source: "arrow.right";
+                               action: STATE_SET "on.click.start";
+                               target: "arrow.right.bg";
+                               sequence {
+                                       action: STATE_SET "on.click.end";
+                                       target: "arrow.right.bg";
+                                       transition: LINEAR 0.05;
+                               }
+                       }
+                       program {
+                               name: "arrow.right.mouse.up";
+                               signal: "mouse,up,*";
+                               source: "arrow.right";
+                               action: SIGNAL_EMIT "timezone,go,right" "arrow.right";
+                               sequence {
+                                       action: STATE_SET "on.click.start";
+                                       target: "arrow.right.bg";
+                                       transition: LINEAR 0.05;
+
+                                       action: STATE_SET "default";
+                                       target: "arrow.right.bg";
+                               }
+                       }
+               }
+       }
+
+group { "timezone.details";
+
+               styles {
+                       style {
+                       name: "time_style";
+                       base: "font=Tizen:style=Thin color=#fafafa font_size=70 align=right ellipsis=-1.0";
+                       }
+                       style {
+                       name: "ampm_style";
+                       base: "font=Tizen:style=Regular color=#fafafa font_size=36";
+                       }
+                       style {
+                       name: "relative_to_local_style";
+                       base: "font=Tizen:style=Regular color=#fafafa font_size=36";
+                       }
+                       style {
+                       name: "timezone_cities_style";
+                       base: "font=Tizen:style=Regular color=#fafafa font_size=36 wrap=word ellipsis=1.0";
+                       }
+               }
+
+               parts {
+                       rect { "timezone.details.container"; scale;
+                               desc { "default";
+                                       color: 0 0 0 0;
+                               }
+                       }
+                       rect { "timezone.details.first.line"; scale;
+                               desc { "default";
+                                       align: 0.5 0.0;
+                                       min: 0 94;
+                                       max: 720 94;
+                                       color: 0 0 0 0;
+                                       rel1 {
+                                               offset: 0 50;
+                                               to: "timezone.details.container";
+                                       }
+                                       rel2.to_x: "timezone.details.container";
+                               }
+                       }
+
+                       swallow { "timezone.details.first.line.content"; scale;
+                               desc { "default";
+                                       align: 0.5 1.0;
+                                       rel1.to: "timezone.details.first.line";
+                                       rel2.to: "timezone.details.first.line";
+                               }
+                       }
+
+                       rect { "timezone.details.second.line"; scale;
+                               desc { "default";
+                                       align: 0.5 0.0;
+                                       min: 0 51;
+                                       max: -1 51;
+                                       color: 0 0 0 0;
+                                       rel1 {
+                                               relative: 0.0 1.0;
+                                               to_x: "timezone.details.container";
+                                               to_y: "timezone.details.first.line.content";
+                                       }
+                                       rel2.to_x: "timezone.details.container";
+                               }
+                       }
+
+                       swallow { "timezone.details.second.line.cities"; scale;
+                               desc { "default";
+                                       rel1.to: "timezone.details.second.line";
+                                       rel2.to: "timezone.details.second.line";
+                               }
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/clock/res/edje/color_classes.edc b/clock/res/edje/color_classes.edc
new file mode 100644 (file)
index 0000000..a5fbf64
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2016 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.
+*/
+
+//TODO below valuse are HSBA schem, but need to be converted to RGBA
+color_classes {
+       color_class {
+               name: "AO009";
+               color: 75 75 75 77;
+       }
+       color_class {
+               name: "AO010";
+               color: 200 200 200 204;
+       }
+       color_class {
+               name: "AO011";
+               color: 200 200 200 204;
+       }
+       color_class {
+               name: "AO041";
+               color: 0 0 0 255;
+       }
+       color_class {
+               name: "AO042";
+               color: 128 128 128 255;
+       }
+       color_class {
+               name: "AO043";
+               color: 0 0 0 255;
+       }
+       color_class {
+               name: "AO044";
+               color: 128 128 128 255;
+       }
+       color_class {
+               name: "B043";
+               color: 0 0 0 77;
+       }
+       color_class {
+               name: "B043P";
+               color: 0 0 0 140;
+       }
+
+       // For Fonts
+
+       color_class {
+               name: "ATO017";
+               color: 250 250 250 255;
+       }
+       color_class {
+               name: "ATO018";
+               color: 250 250 250 255;
+       }
+       color_class {
+               name: "ATO040";
+               color: 0 0 0 255;
+       }
+}
diff --git a/clock/res/edje/images/arrow_bg.png b/clock/res/edje/images/arrow_bg.png
new file mode 100644 (file)
index 0000000..fb62230
Binary files /dev/null and b/clock/res/edje/images/arrow_bg.png differ
diff --git a/clock/res/edje/images/clock_icon_world_clock_arrow_left.png b/clock/res/edje/images/clock_icon_world_clock_arrow_left.png
new file mode 100644 (file)
index 0000000..60198f6
Binary files /dev/null and b/clock/res/edje/images/clock_icon_world_clock_arrow_left.png differ
diff --git a/clock/res/edje/images/clock_icon_world_clock_arrow_right.png b/clock/res/edje/images/clock_icon_world_clock_arrow_right.png
new file mode 100644 (file)
index 0000000..7be0dd3
Binary files /dev/null and b/clock/res/edje/images/clock_icon_world_clock_arrow_right.png differ
diff --git a/clock/res/edje/images/clock_world_gmt_area.#.png b/clock/res/edje/images/clock_world_gmt_area.#.png
new file mode 100644 (file)
index 0000000..50f765d
Binary files /dev/null and b/clock/res/edje/images/clock_world_gmt_area.#.png differ
diff --git a/clock/res/edje/images/clock_world_location_dot.png b/clock/res/edje/images/clock_world_location_dot.png
new file mode 100644 (file)
index 0000000..3af7386
Binary files /dev/null and b/clock/res/edje/images/clock_world_location_dot.png differ
diff --git a/clock/res/edje/images/clock_world_location_ring.png b/clock/res/edje/images/clock_world_location_ring.png
new file mode 100644 (file)
index 0000000..7ed221c
Binary files /dev/null and b/clock/res/edje/images/clock_world_location_ring.png differ
diff --git a/clock/res/edje/images/clock_world_map_01.png b/clock/res/edje/images/clock_world_map_01.png
new file mode 100644 (file)
index 0000000..7060835
Binary files /dev/null and b/clock/res/edje/images/clock_world_map_01.png differ
diff --git a/clock/res/po/en_US.po b/clock/res/po/en_US.po
new file mode 100644 (file)
index 0000000..ccb5f50
--- /dev/null
@@ -0,0 +1,15 @@
+# This PO file is automatically generated by PO File Editor of Tizen Studio
+# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES CAN BE OVERWRITTEN
+
+msgid "IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB"
+msgstr "%d h %d m ahead"
+
+msgid "IDS_CLOCK_BODY_PS1D_H_P2SD_M_BEHIND_ABB"
+msgstr "%d h %d m behind"
+
+msgid "IDS_CLOCK_BODY_PD_H_AHEAD_ABB"
+msgstr "%d h ahead"
+
+msgid "IDS_CLOCK_BODY_PD_H_BEHIND_ABB"
+msgstr "%d h behind"
+
diff --git a/clock/src/Model/WorldClock.cpp b/clock/src/Model/WorldClock.cpp
new file mode 100644 (file)
index 0000000..fa7d462
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2016 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 "Model/WorldClock.h"
+#include "Model/Location.h"
+#include "log.h"
+
+using namespace model;
+
+#define L WorldClock::locations_
+
+std::vector<model::Location> WorldClock::locations_ = {
+                             { "Midway Atoll", "USA", -11 * 60, 43, 218 },
+                             { "Pago Pago", "American Samoa", -11 * 60, 54, 230 },
+                             { "Honolulu", "USA", -10 * 60, 57, 223 },
+                             { "Anchorage", "USA", -9 * 60, 74, 144 },
+                             { "Los Angeles", "USA", -8 * 60, 131, 196 },
+                             { "San Francisco", "USA", -8 * 60, 126, 191 },
+                             { "Vancouver", "Canada", -8 * 60, 122, 166 },
+                             { "Denver", "USA", -7 * 60, 156, 185 },
+                             { "Austin", "USA", -6 * 60, 168, 199 },
+                             { "Chicago", "USA", -6 * 60, 187, 181 },
+                             { "Guatemala City", "Guatemala", -6 * 60, 181, 233 },
+                             { "Mexico City", "Mexico", -6 * 60, 167, 244 },
+                             { "Bogota", "Colombia" - 5 * 60, 212, 253 },
+                             { "Lima", "Peru", -5 * 60, 206, 286 },
+                             { "Miami", "USA", -5 * 60, 200, 211 },
+                             { "New York", "USA", -5 * 60, 211, 184 },
+                             { "Ottawa", "Canada", -5 * 60, 208, 173 },
+                             { "Washington DC", "USA", -5 * 60, 205, 189 },
+                             { "Santiago", "Chile", -4 * 60, 217, 327 },
+                             { "Santo Domingo", "Dominican Republic", -4 * 60, 218, 226 },
+                             { "Brasilia", "Brazil", -3 * 60, 257, 290 },
+                             { "Buenos Aires", "Argentina", -3 * 60, 239, 329 },
+                             { "Nuuk", "Greenland", -3 * 60, 256, 143 },
+                             { "Sao Paulo", "Brazil", -3 * 60, 260, 308 },
+                             { "Mid-Atlantic", "", -2 * 60, 296, 266 },
+                             { "Grytvieken", "South Georgia", -2 * 60, 276, 364 },
+                             { "Azores", "Portugal", -1 * 60, 308, 188 },
+                             { "Ponta Delaga", "Portugal", -1 * 60, 300, 190 },
+                             { "Accra", "Ghana", 0, 343, 250 },
+                             { "Dakar", "Senegal", 0, 314, 234 },
+                             { "Lisbon", "Portugal", 0, 327, 187 },
+                             { "London", "United Kingdom", 0, 343, 162 },
+                             { "Reykjavik", "Iceland", 0, 306, 138 },
+                             { "Algiers", "Algeria", 1 * 60, 349, 190 },
+                             { "Bracelona", "Spain", 1 * 60, 346, 181 },
+                             { "Berlin", "Germany", 1 * 60, 367, 162 },
+                             { "Luanda", "Angola", 1 * 60, 367, 278 },
+                             { "Madrid", "Spain", 1 * 60, 337, 185 },
+                             { "Paris", "France", 1 * 60, 349, 168 },
+                             { "Rome", "Italy", 1 * 60, 365, 180 },
+                             { "Stockholm", "Sweden", 1 * 60, 375, 147 },
+                             { "Athens", "Greece", 2 * 60, 385, 188 },
+                             { "Cairo", "Egypt", 2 * 60, 400, 205 },
+                             { "Cape Town", "South Africa", 2 * 60, 376, 326 },
+                             { "Harare", "Zimbabwe", 2 * 60, 403, 293 },
+                             { "Istanbul", "Turkey", 2 * 60, 395, 183 },
+                             { "Doha", "Qatar", 3 * 60, 437, 213 },
+                             { "Nairobi", "Kenia", 3 * 60, 409, 263 },
+                             { "Moscow", "Russia", 3 * 60, 410, 155 },
+                             { "Tehran", "Iran", 210, 435, 192 },
+                             { "Izhevsk", "Russia", 4 * 60, 437, 152 },
+                             { "Dubai", "United Arab Emirates", 4 * 60, 441, 213 },
+                             { "Kabul", "Afghanistan", 270, 464, 194 },
+                             { "Islamabad", "Pakistan", 5 * 60, 467, 196 },
+                             { "Tashkent", "Uzbekistan", 5 * 60, 467, 182 },
+                             { "Delhi", "India", 330, 481, 203 },
+                             { "Kathmandu", "Nepal", 345, 494, 204 },
+                             { "Almaty", "Kazakhstan", 6 * 60, 481, 177 },
+                             { "Bishkek", "Kyrgyzstan", 6 * 60, 477, 179 },
+                             { "Dhaka", "Bangladesh", 6 * 60, 504, 213 },
+                             { "Omsk", "Russia", 6 * 60, 474, 156 },
+                             { "Bangkok", "Thailand", 7 * 60, 522, 235 },
+                             { "Hanoi", "Vietnam", 7 * 60, 532, 220 },
+                             { "Jakarta", "Indonesia", 7 * 60, 532, 274 },
+                             { "Beijing", "China", 8 * 60, 550, 185 },
+                             { "Kuala Lumpur", "Malaysia", 8 * 60, 523, 255 },
+                             { "Manila", "Philipines", 8 * 60, 559, 234 },
+                             { "Perth", "Australia", 8 * 60, 550, 322 },
+                             { "Singapore", "Republic of Singapore", 8 * 60, 528, 258 },
+                             { "Ulan Bator", "Mongolia", 8 * 60, 535, 168 },
+                             { "Seoul", "South Korea", 9 * 60, 570, 190 },
+                             { "Tokyo", "Japan", 9 * 60, 592, 193 },
+                             { "Sydney", "Australia", 10 * 60, 613, 326 },
+                             { "Noumea", "New Caledonia", 11 * 60, 639, 304 },
+                             { "Khabarowsk", "Russia", 11 * 60, 584, 169 },
+                             { "Auckland", "New Zealand", 12 * 60, 654, 328 } };
+
+std::vector<Timezone> WorldClock::time_zones_ = {
+                                { 44, 24, -11 * 60, {L[0], L[1]}},
+                                { 44, 24, -10 * 60, {L[2]}},
+                                { 68, 24, -9 * 60, {L[3]}},
+                                { 116, 30, -8 * 60, {L[4], L[5], L[6]}},
+                                { 146, 30, -7 * 60, {L[7]}},
+                                { 146, 47, -6 * 60, {L[8], L[9], L[10], L[11]}},
+                                { 193, 32, -5 * 60, {L[12], L[13], L[14], L[15], L[16], L[17]}},
+                                { 193, 61, -4 * 60, {L[18], L[19]}},
+                                { 225, 59, -3 * 60, {L[20], L[21], L[22], L[23]}},
+                                { 254, 54, -2 * 60, {L[24], L[25]}},
+                                { 284, 24, -1 * 60, {L[26], L[27]}},
+                                { 308, 41, 0 * 60, {L[28], L[29], L[30], L[31], L[32]}},
+                                { 332, 45, 1 * 60, {L[33], L[34], L[35], L[36], L[37], L[38], L[39], L[40]}},
+                                { 349, 85, 2 * 60, {L[41], L[42], L[43], L[44], L[45]}},
+                                { 377, 81, 3 * 60, {L[46], L[47], L[48]}},
+                                { 402, 56, 210, {L[49]}}, /* (3.5 * 60) */
+                                { 402, 56, 4 * 60, {L[50], L[51]}},
+                                { 458, 28, 270, {L[52]}}, /* (4.5 * 60) */
+                                { 458, 28, 5 * 60, {L[53], L[54]}},
+                                { 458, 28, 330, {L[55]}}, /*(5.5 * 60)*/
+                                { 486, 28, 345, {L[56]}}, /* (5.75 * 60) */
+                                { 458, 56, 6 * 60, {L[57], L[58], L[59], L[60]}},
+                                { 514, 24, 7 * 60, {L[61], L[62], L[63]}},
+                                { 514, 54, 8 * 60, {L[64], L[65], L[66], L[67], L[68], L[69]}},
+                                { 538, 84, 9 * 60, {L[70], L[71]}},
+                                { 595, 27, 10 * 60, {L[72]}},
+                                { 568, 76, 11 * 60, {L[73], L[74]}},
+                                { 644, 24, 12 * 60, {L[75]}} };
+
+WorldClock::WorldClock()
+{
+       SetCurrentTimezone(12); // Need to load and store currently set tz to file or any app_data if possible
+}
+
+int WorldClock::GetCurrentTimezoneNo()
+{
+       return current_tz_;
+}
+
+const Timezone *WorldClock::GetTimezoneByOffset(int offset)
+{
+       for (int i = offset / 60 + 11; i < time_zones_.size() - 1; i++) {
+               if (time_zones_.at(i).gmt_offset == offset) {
+                       return &time_zones_.at(i);
+               }
+       }
+       return NULL;
+}
+
+Timezone *WorldClock::GetCurrentTimezone()
+{
+       return &time_zones_.at(GetCurrentTimezoneNo());
+}
+
+const char *WorldClock::GetCurrentTzString()
+{
+       return OffsetToString(GetCurrentTimezone()->gmt_offset);
+}
+
+char *WorldClock::OffsetToString(int offset)
+{
+       int remainder;
+       char remainder_str[6];
+       static char tz_offset[6] = { 0, };
+
+       remainder = (offset % 60) * 100 / 60;
+       snprintf(remainder_str, 3, "%d", (remainder % 10) ? remainder : remainder / 10);
+
+       snprintf(tz_offset, 6, "%s%d%s%s", (offset < 0) ? "" : "+", offset / 60,
+               ((offset % 60) ? "." : ""), (remainder) ? remainder_str : "");
+       return &tz_offset[0];
+}
+
+void WorldClock::SetCurrentTimezone(int tz)
+{
+       current_tz_ = tz;
+}
+
+int WorldClock::GetTimezonesCount()
+{
+       return time_zones_.size();
+}
+
+int WorldClock::GetLocationsCount()
+{
+       return locations_.size();
+}
index 4d5f80c..8f89e1d 100644 (file)
@@ -1,3 +1,4 @@
+
 #include "Utils/Time.h"
 #include <utils_i18n.h>
 #include <cstring>
@@ -24,9 +25,9 @@ std::string Time::Format(enum Format format) const
 {
        switch (format) {
                case FORMAT_12H:
-                       return getFormattedTime("h:mm");
+                       return GetFormattedTime("h:mm");
                case FORMAT_24H:
-                       return getFormattedTime("HH:mm");
+                       return GetFormattedTime("HH:mm");
        }
        abort();
        return "";
@@ -37,7 +38,12 @@ std::string Time::Meridiem() const
        return Hour >= 12 ? "PM" : "AM";
 }
 
-std::string Time::getFormattedTime(const char *icu_format) const
+std::string Time::GetMeridiemByOffset(int timezone_offset) const
+{
+       return "PM";
+}
+
+std::string Time::GetFormattedTime(const char *icu_format) const
 {
        char buf[32] = {0,};
        if (!strcmp(icu_format, "HH:mm")) {
@@ -48,3 +54,12 @@ std::string Time::getFormattedTime(const char *icu_format) const
        }
        return buf;
 }
+
+std::string Time::GetFormattedTimeByTimezoneOffset(const char *icu_format, int timezone_offset) const
+{
+       return "15:01";
+}
+int Time::GetLocalTimezoneOffset(void) const
+{
+       return 60;
+}
index 2efe90b..bf3a2f2 100644 (file)
  * limitations under the License.
  */
 
+#include <vector>
+
 #include "View/WorldClockView.h"
 #include "View/MainView.h"
+#include "Model/WorldClock.h"
 #include "Utils/Utils.h"
+#include "Internal/WorldClockDefs.h"
+#include "log.h"
+#include "Utils/Time.h"
 
 using namespace view;
 using namespace utils;
 
-WorldClockView::WorldClockView()
+void WorldClockView::ChangeTimezoneCb(void *data, Evas_Object *obj, const char *emission,
+        const char *source)
+{
+       WorldClockView *world_clock_view = static_cast<WorldClockView *>(data);
+       model::WorldClock *world_clock_data = world_clock_view->world_clock_data_;
+
+       int current_tz = world_clock_data->GetCurrentTimezoneNo();
+
+       if (!strcmp(source, "main.world.map:arrow.left")) {
+               if (current_tz == 0)
+                       world_clock_data->SetCurrentTimezone(
+                               world_clock_data->GetTimezonesCount() - 1);
+               else
+                       world_clock_data->SetCurrentTimezone(current_tz - 1);
+
+       } else if (!strcmp(source, "main.world.map:arrow.right")) {
+               if (current_tz == world_clock_data->GetTimezonesCount() - 1)
+                       world_clock_data->SetCurrentTimezone(0);
+               else
+                       world_clock_data->SetCurrentTimezone(current_tz + 1);
+       }
+       world_clock_view->UpdateTimezoneDetails(world_clock_data->GetCurrentTimezone());
+}
+
+// TODO FOR DEBUGING ONLY - need to be removed when application is ready
+void message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
 {
-       /*Create content here and use main_layout_ as a parent*/
+       if (type == EDJE_MESSAGE_STRING) {
+               Edje_Message_String *m = static_cast<Edje_Message_String *>(msg);
+               DBG("EDJE STRING:%s", m->str);
+       } else if (type == EDJE_MESSAGE_INT) {
+               Edje_Message_Int *m = static_cast<Edje_Message_Int *>(msg);
+               DBG("EDJE INT:%d", m->val);
+       } else if (type == EDJE_MESSAGE_FLOAT) {
+               Edje_Message_Float *m = static_cast<Edje_Message_Float *>(msg);
+               DBG("EDJE FLOAT:%f", m->val);
+       }
+}
 
-       /*Temporary Code*/
+WorldClockView::WorldClockView()
+{
+       world_clock_data_ = new model::WorldClock(); // TODO Move to controller and create Presenter for WorldClock
        world_clock_ = elm_layout_add(MainView::GetInstance().GetEvasObject());
 
-       elm_layout_file_set(world_clock_, Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/clock.edj"), "main");
+       if(!elm_layout_file_set(world_clock_,
+               Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/WorldClock.edj"),
+               "main")) {
+               FAT("Failed to load layout file");
+       }
+
 
        evas_object_size_hint_align_set(world_clock_, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(world_clock_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
+       edje_object_message_handler_set(elm_layout_edje_get(world_clock_), message_cb, NULL);
+
+       CreateTimezoneDetails();
+
+       elm_layout_signal_callback_add(world_clock_, "timezone,go,left",
+               "main.world.map:arrow.left", WorldClockView::ChangeTimezoneCb,
+               static_cast<void *>(this));
+       elm_layout_signal_callback_add(world_clock_, "timezone,go,right",
+               "main.world.map:arrow.right", WorldClockView::ChangeTimezoneCb,
+               static_cast<void *>(this));
+}
+
+void WorldClockView::UpdateTimezoneLocationsDots()
+{
+       int current_tz = world_clock_data_->GetCurrentTimezoneNo();
+
+       for (int i = 0; i < 8; i++) {
+               Edje_Message_Int_Set *msg;
+               msg = (Edje_Message_Int_Set *) malloc(
+                       sizeof(Edje_Message_Int_Set) + 3 * sizeof(int));
+               msg->count = 4;
+
+               if (i >= world_clock_data_->GetCurrentTimezone()->places.size()) {
+                       msg->val[0] = 100;
+                       msg->val[1] = 100;
+                       msg->val[2] = PART_NOT_VISIBLE;
+
+               } else {
+                       model::Location loc = world_clock_data_->GetCurrentTimezone()->places.at(i);
+                       msg->val[0] = loc.x;
+                       msg->val[1] = loc.y;
+                       msg->val[2] = PART_VISIBLE;
+               }
+               msg->val[3] = i;
+               edje_object_message_send(elm_layout_edje_get(world_clock_), EDJE_MESSAGE_INT_SET,
+                       MESSAGE_ID_SET_LOCATION_DOT_POSITION, (void *) msg);
+
+               free(msg);
+       }
+}
+
+void WorldClockView::UpdateGmtOffset()
+{
+       const char *offset = world_clock_data_->GetCurrentTzString();
+       elm_object_part_text_set(world_clock_, "main.world.map:timezone_offset", offset);
+}
+
+void WorldClockView::UpdateTimezoneArea()
+{
+       Edje_Message_Int_Set *msg;
+
+       msg = static_cast<Edje_Message_Int_Set *>(malloc(
+               sizeof(Edje_Message_Int_Set) + sizeof(int)));
+
+       msg->count = 2;
+       msg->val[0] = world_clock_data_->GetCurrentTimezone()->x_coord;
+       msg->val[1] = world_clock_data_->GetCurrentTimezone()->zone_width;
+
+       edje_object_message_send(elm_layout_edje_get(world_clock_), EDJE_MESSAGE_INT_SET,
+               MESSAGE_ID_SET_TIMEZONE, (void *) msg);
+}
+
+void WorldClockView::CreateTimezoneDetails()
+{
+       timezone_details_ = elm_table_add(world_clock_);
+
+       Evas_Object *time = CreateTimezoneTime();
+       Evas_Object *padding_1 = CreatePadding(12);
+       Evas_Object *ampm = CreateTimezoneXMeridiem();
+       Evas_Object *padding_2 = CreatePadding(20);
+       Evas_Object *relative = CreateTimezoneRelativeToLocalObject();
+
+       elm_table_pack(timezone_details_, time, 0, 0, 1, 1);
+       elm_table_pack(timezone_details_, padding_1, 1, 0, 1, 1);
+       elm_table_pack(timezone_details_, ampm, 2, 0, 1, 1);
+       elm_table_pack(timezone_details_, padding_2, 3, 0, 1, 1);
+       elm_table_pack(timezone_details_, relative, 4, 0, 1, 1);
+
+       elm_layout_content_set(world_clock_, TIMEZONE_DETAILS_FIRST_LINE_PART,
+               timezone_details_);
+
+       CreateTimezoneCitiesList();
+
+       UpdateTimezoneDetails(world_clock_data_->GetCurrentTimezone());
+}
+
+void WorldClockView::UpdateTimezoneDetails(model::Timezone *timezone)
+{
+       UpdateTimezoneLocationsDots();
+       UpdateTimezoneArea();
+       UpdateGmtOffset();
+
+       UpdateTimezoneTime(timezone->gmt_offset);
+       UpdateTimezoneXMeridiem(timezone->gmt_offset);
+       UpdateTimezoneRelativeToLocal(timezone->gmt_offset);
+       UpdateTimezoneCitiesList(timezone);
+}
+
+Evas_Object *WorldClockView::CreateTimezoneTime()
+{
        Evas_Object *label = elm_label_add(world_clock_);
+       evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+       evas_object_show(label);
 
-       elm_object_text_set(label, "World Clock");
-       elm_layout_content_set(world_clock_, "bg", label);
+       return label;
 }
 
+void WorldClockView::UpdateTimezoneTime(int timezone_offset)
+{
+       utils::Time t;
+
+       //TODO This must be formated according to global device settings
+       std::string timezone_time = t.GetFormattedTimeByTimezoneOffset("HH:MM", timezone_offset);
+
+       char time_formatted[MAX_STYLE_LEN] = { 0, };
+       snprintf(time_formatted, sizeof(time_formatted),
+               TIMEZONE_DETAILS_FIRST_LINE_TIME_STYLE("%s"), timezone_time.c_str());
+       elm_object_text_set(elm_table_child_get(timezone_details_, 0, 0), time_formatted);
+}
+
+Evas_Object *WorldClockView::CreateTimezoneXMeridiem()
+{
+       Evas_Object *ampm = elm_label_add(world_clock_);
+       evas_object_size_hint_align_set(ampm, EVAS_HINT_FILL, 0.75);
+
+       evas_object_show(ampm);
+
+       return ampm;
+}
+
+void WorldClockView::UpdateTimezoneXMeridiem(int timezone_offset)
+{
+       utils::Time t;
+
+       //TODO This must be formated according to global device settings
+       std::string meridiem = t.GetMeridiemByOffset(timezone_offset);
+
+       char ampm_formatted[MAX_STYLE_LEN] = { 0, };
+       snprintf(ampm_formatted, sizeof(ampm_formatted),
+               TIMEZONE_DETAILS_FIRST_LINE_AMPM_STYLE("%s"), meridiem.c_str());
+       elm_object_text_set(elm_table_child_get(timezone_details_, 2, 0), ampm_formatted);
+}
+
+Evas_Object *WorldClockView::CreateTimezoneRelativeToLocalObject()
+{
+       Evas_Object *relative = elm_label_add(world_clock_);
+       evas_object_size_hint_align_set(relative, EVAS_HINT_FILL, 0.75);
+
+       evas_object_show(relative);
+
+       return relative;
+}
+
+void WorldClockView::UpdateTimezoneRelativeToLocal(int timezone_offset)
+{
+       char *message_pattern;
+       char message[64] = { 0, };
+       utils::Time t;
+
+       int local_timezone_offset = t.GetLocalTimezoneOffset();
+       int offset_integer = (abs(timezone_offset - local_timezone_offset)) / 60;
+       int offset_remainder = (abs(timezone_offset - local_timezone_offset)) % 60;
+
+       DBG("passed offset:%d, local:%d, remainder:%d", timezone_offset,
+               local_timezone_offset, offset_remainder);
+
+       if (timezone_offset < local_timezone_offset) {
+               if (offset_remainder > 0) {
+                       message_pattern = gettext("IDS_CLOCK_BODY_PS1D_H_P2SD_M_BEHIND_ABB");
+                       snprintf(message, sizeof(message), message_pattern, offset_integer,
+                               offset_remainder);
+               } else {
+                       message_pattern = gettext("IDS_CLOCK_BODY_PD_H_BEHIND_ABB");
+                       snprintf(message, sizeof(message), message_pattern, offset_integer);
+               }
+
+       } else if (timezone_offset > local_timezone_offset) {
+               if (offset_remainder > 0) {
+                       message_pattern = gettext("IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB");
+                       snprintf(message, sizeof(message), message_pattern, offset_integer,
+                               offset_remainder);
+               } else {
+                       message_pattern = gettext("IDS_CLOCK_BODY_PD_H_AHEAD_ABB");
+                       snprintf(message, sizeof(message), message_pattern, offset_integer);
+               }
+
+       } else {
+               snprintf(message, sizeof(message), "Same as local time");
+       }
+
+       char relative_formatted[MAX_STYLE_LEN] = { 0, };
+       snprintf(relative_formatted, sizeof(relative_formatted),
+               TIMEZONE_DETAILS_FIRST_LINE_RELATIVE_TO_LOCAL_STYLE("%s"), message);
+
+       elm_object_text_set(elm_table_child_get(timezone_details_, 4, 0), relative_formatted);
+}
+
+Evas_Object *WorldClockView::CreatePadding(int width)
+{
+       Evas_Object *padding = elm_bg_add(timezone_details_);
+       evas_object_size_hint_min_set(padding, width, 10);
+       evas_object_size_hint_max_set(padding, width, 10);
+       evas_object_color_set(padding, 0, 0, 0, 0);
+       evas_object_show(padding);
+
+       return padding;
+}
+
+void WorldClockView::CreateTimezoneCitiesList()
+{
+       timezone_cities_ = elm_label_add(world_clock_);
+       evas_object_size_hint_align_set(timezone_cities_, EVAS_HINT_FILL, 0.0);
+
+       evas_object_show (timezone_cities_);
+
+       elm_layout_content_set(world_clock_, TIMEZONE_DETAILS_SECOND_LINE_PART,
+               timezone_cities_);
+}
+
+void WorldClockView::UpdateTimezoneCitiesList(model::Timezone *timezone)
+{
+
+       std::vector < model::Location > *cities_list = ( (timezone) ?
+                       &timezone->places : &world_clock_data_->GetCurrentTimezone()->places);
+
+       char cities[MAX_CITIES_LEN];
+       snprintf(cities, sizeof(cities), "%s", cities_list->at(0).name.c_str());
+
+       for (int i = 1; i < cities_list->size(); i++) {
+               char *tmp = strdup(cities);
+               snprintf(cities, sizeof(cities), "%s, %s", tmp, cities_list->at(i).name.c_str());
+               free(tmp);
+       }
+
+       char cities_formatted[MAX_CITIES_LEN];
+       snprintf(cities_formatted, sizeof(cities_formatted),
+               TIMEZONE_DETAILS_SECOND_LINE_CITIES("%s"), cities);
+
+       elm_object_text_set(timezone_cities_, cities_formatted);
+}