Update the live-viewer
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 1 Nov 2012 11:27:42 +0000 (20:27 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 1 Nov 2012 12:19:20 +0000 (21:19 +0900)
Change-Id: Idd788f74087304a7941a402bc028d7bf4880988f

18 files changed:
live.viewer/CMakeLists.txt [moved from live-viewer/CMakeLists.txt with 78% similarity]
live.viewer/image/folder [moved from live-viewer/image/folder with 100% similarity]
live.viewer/include/CLiveBox.h [moved from live-viewer/include/CLiveBox.h with 91% similarity]
live.viewer/include/CLiveBoxMgr.h [moved from live-viewer/include/CLiveBoxMgr.h with 100% similarity]
live.viewer/include/CMain.h [moved from live-viewer/include/CMain.h with 100% similarity]
live.viewer/include/CResourceMgr.h [moved from live-viewer/include/CResourceMgr.h with 100% similarity]
live.viewer/include/CUtil.h [moved from live-viewer/include/CUtil.h with 100% similarity]
live.viewer/include/dlist.h [moved from live-viewer/include/dlist.h with 100% similarity]
live.viewer/live.viewer.xml [new file with mode: 0644]
live.viewer/packaging/live.viewer.spec [moved from live-viewer/packaging/live-viewer.spec with 93% similarity]
live.viewer/res/CMakeLists.txt [moved from live-viewer/res/CMakeLists.txt with 77% similarity]
live.viewer/res/live-viewer.edc [moved from live-viewer/res/live-viewer.edc with 100% similarity]
live.viewer/src/CLiveBox.cpp [moved from live-viewer/src/CLiveBox.cpp with 96% similarity]
live.viewer/src/CLiveBoxMgr.cpp [moved from live-viewer/src/CLiveBoxMgr.cpp with 100% similarity]
live.viewer/src/CMain.cpp [moved from live-viewer/src/CMain.cpp with 88% similarity]
live.viewer/src/CResourceMgr.cpp [moved from live-viewer/src/CResourceMgr.cpp with 100% similarity]
live.viewer/src/CUtil.cpp [moved from live-viewer/src/CUtil.cpp with 100% similarity]
live.viewer/src/dlist.cpp [moved from live-viewer/src/dlist.cpp with 100% similarity]

similarity index 78%
rename from live-viewer/CMakeLists.txt
rename to live.viewer/CMakeLists.txt
index 24d49d9..60c48a0 100644 (file)
@@ -22,7 +22,9 @@ ENDFOREACH(flag)
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -Winline -g")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 
+SET(PKGROOT "/opt/usr/apps/live.viewer")
 ADD_DEFINITIONS("-DNDEBUG")
+ADD_DEFINITIONS("-DPKGROOT=\"${PKGROOT}\"")
 #ADD_DEFINITIONS("-DFLOG")
 ADD_DEFINITIONS(${pkgs_CFLAGS})
 ADD_DEFINITIONS(${pkgs_LDFLAGS})
@@ -39,6 +41,7 @@ ADD_EXECUTABLE(${PROJECT_NAME}
 )
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${PKGROOT}/bin)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/live.viewer.xml DESTINATION /opt/share/packages)
 
 ADD_SUBDIRECTORY(res)
similarity index 91%
rename from live-viewer/include/CLiveBox.h
rename to live.viewer/include/CLiveBox.h
index b564426..7ef910b 100644 (file)
@@ -21,9 +21,9 @@ public:
        int CreatePD(void);
        int DestroyPD(void);
 
-       int GetSizeList(int *cnt, int *w, int *h);
+       int GetSizeList(int *cnt, int *list);
 
-       int Resize(int w, int h);
+       int Resize(int size_type);
 
 private:
        int m_OnCreate(void);
diff --git a/live.viewer/live.viewer.xml b/live.viewer/live.viewer.xml
new file mode 100644 (file)
index 0000000..e011336
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<manifest xmlns="http://tizen.org/ns/packages" package="live.viewer" version="0.0.1" install-location="auto">
+       <label>Live viewer (native)</label>
+       <author email="nicesj.park@samsung.com" href="www.samsung.com">Sung-jae Park</author>
+       <description>Live box simple viewer (native)</description>
+
+       <ui-application appid="live.viewer" exec="/opt/usr/apps/live.viewer/bin/live-viewer" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+               <icon>live.viewer.png</icon>
+               <label>Live box simple viewer (native)</label>
+               <label xml:lang="en-us">Live box simple viewer (native)</label>
+       </ui-application>
+</manifest>
similarity index 93%
rename from live-viewer/packaging/live-viewer.spec
rename to live.viewer/packaging/live.viewer.spec
index 5ba077d..dbdb6c3 100644 (file)
@@ -1,4 +1,4 @@
-Name: live-viewer
+Name: live.viewer
 Summary: viewer
 Version: 0.0.1
 Release: 1
@@ -37,5 +37,5 @@ rm -rf %{buildroot}
 
 %files
 %defattr(-,root,root,-)
-/usr/bin/*
-/usr/share/*
+/opt/usr/apps/live.viewer/*
+/opt/share/*
similarity index 77%
rename from live-viewer/res/CMakeLists.txt
rename to live.viewer/res/CMakeLists.txt
index d95b4a1..5f6447c 100644 (file)
@@ -4,4 +4,4 @@ ADD_CUSTOM_TARGET(live-viewer.edj ALL
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/live-viewer.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} live-viewer.edj)
-INSTALL(FILES live-viewer.edj DESTINATION /usr/share/live-viewer/res/edje)
+INSTALL(FILES live-viewer.edj DESTINATION ${PKGROOT}/res/edje)
similarity index 96%
rename from live-viewer/src/CLiveBox.cpp
rename to live.viewer/src/CLiveBox.cpp
index e9a6593..90d3866 100644 (file)
@@ -385,11 +385,13 @@ void CLiveBox::OnUpdateLB(void)
        int w, h;
        int ow, oh;
        enum livebox_lb_type type;
+       int size_type;
 
        if (!m_pIconSlot || !m_pLBImage)
                return;
 
-       if (livebox_get_size(m_pHandler, &w, &h) < 0)
+       size_type = livebox_size(m_pHandler);
+       if (livebox_service_get_size(size_type, &w, &h) < 0)
                return;
 
        /*
@@ -620,7 +622,7 @@ int CLiveBox::m_OnCreate(void)
                return -EFAULT;
        }
 
-       if (elm_layout_file_set(m_pIconSlot, "/usr/share/live-viewer/res/edje/live-viewer.edj", "icon,slot") == EINA_FALSE) {
+       if (elm_layout_file_set(m_pIconSlot, PKGROOT "/res/edje/live-viewer.edj", "icon,slot") == EINA_FALSE) {
                ErrPrint("Failed to load an icon slot EDJE\n");
                evas_object_del(m_pIconSlot);
                m_pIconSlot = NULL;
@@ -663,25 +665,21 @@ int CLiveBox::m_OnCreate(void)
        return 0;
 }
 
-int CLiveBox::Resize(int w, int h)
+int CLiveBox::Resize(int size_type)
 {
-       enum livebox_size_type type;
-       type = livebox_service_size_type(w, h);
-       if (type == LB_SIZE_TYPE_UNKNOWN) {
-               ErrPrint("Unsupported size type %dx%d\n", w, h);
+       if (size_type == LB_SIZE_TYPE_UNKNOWN)
                return -1;
-       }
 
-       livebox_resize(m_pHandler, type, s_ResizeCB, this);
+       livebox_resize(m_pHandler, size_type, s_ResizeCB, this);
        return 0;
 }
 
-int CLiveBox::GetSizeList(int *cnt, int *w, int *h)
+int CLiveBox::GetSizeList(int *cnt, int *list)
 {
-       if (!m_pHandler || !cnt || !w || !h)
+       if (!m_pHandler || !cnt || !list)
                return -EINVAL;
 
-       return livebox_get_supported_sizes(m_pHandler, cnt, w, h);
+       return livebox_get_supported_sizes(m_pHandler, cnt, list);
 }
 
 /* End of a file */
similarity index 88%
rename from live-viewer/src/CMain.cpp
rename to live.viewer/src/CMain.cpp
index 642c2d4..e46d4b0 100644 (file)
@@ -196,7 +196,7 @@ int CMain::OnCreate(void)
 
        layout = elm_layout_add(win);
        if (layout) {
-               if (elm_layout_file_set(layout, "/usr/share/live-viewer/res/edje/live-viewer.edj", "layout") == EINA_FALSE) {
+               if (elm_layout_file_set(layout, PKGROOT "/res/edje/live-viewer.edj", "layout") == EINA_FALSE) {
                        evas_object_del(layout);
                        ErrPrint("Failed to load a layout edje\n");
                } else {
@@ -301,8 +301,7 @@ static void s_ResizeBox(void *data, Evas_Object *obj, void *event_info)
        CLiveBox *box = (CLiveBox *)data;
        Elm_Object_Item *item;
        const char *label;
-       int w;
-       int h;
+       int size_type;
 
        item = elm_list_selected_item_get(obj);
        if (!item)
@@ -312,13 +311,23 @@ static void s_ResizeBox(void *data, Evas_Object *obj, void *event_info)
        if (!label)
                return;
 
-       if (sscanf(label, "%dx%d", &w, &h) != 2) {
-               ErrPrint("Failed to get the WxX\n");
+       if (!strcmp(label, "1x1")) {
+               size_type = LB_SIZE_TYPE_1x1;
+       } else if (!strcmp(label, "2x1")) {
+               size_type = LB_SIZE_TYPE_2x1;
+       } else if (!strcmp(label, "2x2")) {
+               size_type = LB_SIZE_TYPE_2x2;
+       } else if (!strcmp(label, "4x1")) {
+               size_type = LB_SIZE_TYPE_4x1;
+       } else if (!strcmp(label, "4x2")) {
+               size_type = LB_SIZE_TYPE_4x2;
+       } else if (!strcmp(label, "4x4")) {
+               size_type = LB_SIZE_TYPE_4x4;
+       } else {
                return;
        }
 
-       DbgPrint("Size %dx%d\n", w, h);
-       box->Resize(w, h);
+       box->Resize(size_type);
 }
 
 int CMain::UpdateCtrl(CLiveBox *box)
@@ -326,9 +335,8 @@ int CMain::UpdateCtrl(CLiveBox *box)
        Evas_Object *layout;
        Evas_Object *list;
        int cnt = NR_OF_SIZE_LIST;
-       int w[NR_OF_SIZE_LIST];
-       int h[NR_OF_SIZE_LIST];
-       char size_str[] = "0000x0000";
+       int size_list[NR_OF_SIZE_LIST];
+       const char *str_size_type;
        register int i;
        Elm_Object_Item *item;
 
@@ -340,14 +348,34 @@ int CMain::UpdateCtrl(CLiveBox *box)
        if (!list)
                return -EFAULT;
 
-       if (box->GetSizeList(&cnt, w, h) < 0)
+       if (box->GetSizeList(&cnt, size_list) < 0)
                return 0;
 
        elm_list_clear(list);
        for (i = 0; i < cnt; i++) {
-               snprintf(size_str, sizeof(size_str), "%dx%d", w[i], h[i]);
-               DbgPrint("Size: %s\n", size_str);
-               item = elm_list_item_append(list, size_str, NULL, NULL, s_ResizeBox, box);
+               switch (size_list[i]) {
+               case LB_SIZE_TYPE_1x1:
+                       str_size_type = "1x1";
+                       break;
+               case LB_SIZE_TYPE_2x1:
+                       str_size_type = "2x1";
+                       break;
+               case LB_SIZE_TYPE_2x2:
+                       str_size_type = "2x2";
+                       break;
+               case LB_SIZE_TYPE_4x1:
+                       str_size_type = "4x1";
+                       break;
+               case LB_SIZE_TYPE_4x2:
+                       str_size_type = "4x2";
+                       break;
+               case LB_SIZE_TYPE_4x4:
+                       str_size_type = "4x4";
+                       break;
+               default:
+                       continue;
+               }
+               item = elm_list_item_append(list, str_size_type, NULL, NULL, s_ResizeBox, box);
                if (!item) {
                        ErrPrint("Failed to append a new size list\n");
                        return -EFAULT;