From 2edaa5018e2c00bdec4b1261ab6a0cd2b09fa02e Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Sun, 16 Aug 2015 11:07:23 +0900 Subject: [PATCH] initial commit Change-Id: If43d2fc2aff47dfc1165f10e6ae5b4286444d6f5 Signed-off-by: Soohye Shin --- CMakeLists.txt | 62 +++++++++++++++++++ edje/CMakeLists.txt | 8 +++ edje/etg.edc | 20 ++++++ include/defs.h | 20 ++++++ org.tizen.etg.xml.in | 9 +++ packaging/org.tizen.etg.manifest | 5 ++ packaging/org.tizen.etg.spec | 52 ++++++++++++++++ src/main.c | 127 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 303 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 edje/CMakeLists.txt create mode 100644 edje/etg.edc create mode 100644 include/defs.h create mode 100644 org.tizen.etg.xml.in create mode 100644 packaging/org.tizen.etg.manifest create mode 100644 packaging/org.tizen.etg.spec create mode 100644 src/main.c diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e9f4ccd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT("etg" C) + +IF(NOT DEFINED PACKAGE_NAME) + SET(PACKAGE_NAME "org.tizen.etg") +ENDIF(NOT DEFINED PACKAGE_NAME) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +IF(NOT DEFINED BINDIR) + SET(BINDIR"${PREFIX}/bin") +ENDIF(NOT DEFINED BINDIR) +IF(NOT DEFINED IMAGEDIR) + SET(IMAGEDIR "${PREFIX}/res/images") +ENDIF(NOT DEFINED IMAGEDIR) +IF(NOT DEFINED MANIFESTDIR) + SET(MANIFESTDIR "/usr/share/packages") +ENDIF(NOT DEFINED MANIFESTDIR) + +SET(TARGET_EDJ "${PROJECT_NAME}.edj") +SET(SRCS + src/main.c) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"") +ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"") +ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"") +ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"") + +INCLUDE(FindPkgConfig) +pkg_check_modules(PKGS REQUIRED + elementary + app-utils + capi-appfw-application) + +FOREACH(flag ${PKGS_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror") +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS}) +CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) +INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR}) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images/ DESTINATION ${IMAGEDIR} FILES_MATCHING PATTERN "*.png") + +ADD_SUBDIRECTORY(edje) diff --git a/edje/CMakeLists.txt b/edje/CMakeLists.txt new file mode 100644 index 0000000..42622bb --- /dev/null +++ b/edje/CMakeLists.txt @@ -0,0 +1,8 @@ +ADD_CUSTOM_TARGET(${TARGET_EDJ} + COMMAND edje_cc -id images + ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc + ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc +) +ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR}) diff --git a/edje/etg.edc b/edje/etg.edc new file mode 100644 index 0000000..2c43ca4 --- /dev/null +++ b/edje/etg.edc @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "../include/defs.h" + +collections { +} diff --git a/include/defs.h b/include/defs.h new file mode 100644 index 0000000..996fa87 --- /dev/null +++ b/include/defs.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __AIR_ETG_DEFS_H__ +#define __AIR_ETG_DEFS_H__ + +#endif /* __AIR_ETG_DEFS_H__ */ diff --git a/org.tizen.etg.xml.in b/org.tizen.etg.xml.in new file mode 100644 index 0000000..2e46f9e --- /dev/null +++ b/org.tizen.etg.xml.in @@ -0,0 +1,9 @@ + + + + Soohye Shin + ETG Application + + + + diff --git a/packaging/org.tizen.etg.manifest b/packaging/org.tizen.etg.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/packaging/org.tizen.etg.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/org.tizen.etg.spec b/packaging/org.tizen.etg.spec new file mode 100644 index 0000000..267133e --- /dev/null +++ b/packaging/org.tizen.etg.spec @@ -0,0 +1,52 @@ +Name: org.tizen.etg +Summary: TV ETG application +Version: 0.1 +Release: 1 +Group: Applications/Core Applications +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest + +BuildRequires: cmake +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(app-utils) + +%define _pkgdir /usr/apps/%{name} +%define _bindir %{_pkgdir}/bin +%define _resdir %{_pkgdir}/res +%define _imagedir %{_resdir}/images +%define _edjedir %{_resdir}/edje +%define _manifestdir /usr/share/packages + +%description +Application for Interface of Connectivity + +%prep +%setup -q +cp %{SOURCE1} . + +%build +cmake \ + -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \ + -DPACKAGE_NAME=%{name} \ + -DBINDIR=%{_bindir} \ + -DEDJEDIR=%{_edjedir} \ + -DIMAGEDIR=%{_imagedir} \ + -DMANIFESTDIR=%{_manifestdir} \ + -DVERSION=%{version} + +make %{?jobs:-j%jobs} + +%install +%make_install + +%clean +rm -rf %{buildroot} + +%files +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_bindir}/* +%{_resdir}/* +%{_manifestdir}/%{name}.xml diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..47b494f --- /dev/null +++ b/src/main.c @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "defs.h" + +SET_TAG(PACKAGE); + +struct _appdata { + const char *name; + Evas_Object *win; +}; + +static Evas_Object *_add_win(const char *name) +{ + Evas_Object *win; + + win = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (!win) + return NULL; + + elm_win_title_set(win, name); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_show(win); + + return win; +} + +static bool _create(void *user_data) +{ + struct _appdata *ad; + Evas_Object *win; + + if (!user_data) { + _ERR("Invalid argument"); + return false; + } + + ad = user_data; + + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); + + win = _add_win(ad->name); + if (!win) { + _ERR("failed to create window"); + return false; + } + + ad->win = win; + + return true; +} + +static void _terminate(void *user_data) +{ + struct _appdata *ad; + + if (!user_data) + return; + + ad = user_data; + + if (ad->win) + evas_object_del(ad->win); +} + +static void _pause(void *user_data) +{ + +} + +static void _resume(void *user_data) +{ + +} + +static void _control(app_control_h app_control, void *user_data) +{ + struct _appdata *ad; + + if (!user_data) { + _ERR("Invalid argument"); + return; + } + + ad = user_data; + + if (ad->win) { + elm_win_activate(ad->win); + evas_object_show(ad->win); + } +} + +int main(int argc, char **argv) +{ + struct _appdata ad; + + ui_app_lifecycle_callback_s event_callback = {0,}; + + event_callback.create = _create; + event_callback.terminate = _terminate; + event_callback.pause = _pause; + event_callback.resume = _resume; + event_callback.app_control = _control; + + memset(&ad, 0x00, sizeof(ad)); + ad.name = PACKAGE; + + return ui_app_main(argc, argv, &event_callback, &ad); +} + -- 2.7.4