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})
)
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)
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);
--- /dev/null
+<?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>
-Name: live-viewer
+Name: live.viewer
Summary: viewer
Version: 0.0.1
Release: 1
%files
%defattr(-,root,root,-)
-/usr/bin/*
-/usr/share/*
+/opt/usr/apps/live.viewer/*
+/opt/share/*
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)
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;
/*
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;
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 */
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 {
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)
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)
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;
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;