From ea10609f6f1a286d9217ce819178b6b3e21d3f4b Mon Sep 17 00:00:00 2001 From: Denis Dolzhenko Date: Tue, 24 Jan 2017 11:56:04 +0200 Subject: [PATCH] TizenRefApp-7939 Prepare C++ base APP skeleton. Change-Id: Idfd4b58f5d4a92ad2b01640388cec963b5af7bb3 Signed-off-by: Denis Dolzhenko --- .cproject | 594 ++++++++++++++++++++++++++++++ .exportMap | 5 + .gitignore | 14 + .project | 46 +++ .tproject | 12 + Build/appendix.mk | 1 + Build/basedef.mk | 34 ++ Build/build_c.mk | 110 ++++++ Build/build_edc.mk | 81 ++++ Build/build_po.mk | 64 ++++ Build/flags.mk | 16 + Build/funcs.mk | 50 +++ Build/makefile | 34 ++ Build/makefile.mk | 197 ++++++++++ Build/platform.mk | 15 + Build/tooldef.mk | 63 ++++ build_def.prop | 6 + inc/Config.h | 39 ++ project_def.prop | 63 ++++ res/edje/taskmanager.edc | 14 + shared/res/taskmanager.png | Bin 0 -> 7460 bytes src/App/inc/App.h | 57 +++ src/App/inc/Resource.h | 24 ++ src/App/src/App.cpp | 120 ++++++ src/Common/inc/AtspiAccessibleInterface.h | 122 ++++++ src/Common/inc/BaseView.h | 82 +++++ src/Common/inc/Callback.h | 44 +++ src/Common/inc/LangUtils.h | 111 ++++++ src/Common/inc/Logger.h | 87 +++++ src/Common/inc/PathUtils.h | 61 +++ src/Common/inc/View.h | 558 ++++++++++++++++++++++++++++ src/Common/inc/Window.h | 45 +++ src/Common/src/Logger.cpp | 46 +++ src/Common/src/PathUtils.cpp | 125 +++++++ src/Common/src/View.cpp | 197 ++++++++++ src/Common/src/Window.cpp | 85 +++++ src/main.cpp | 25 ++ tizen-manifest.xml | 8 + 38 files changed, 3255 insertions(+) create mode 100644 .cproject create mode 100644 .exportMap create mode 100644 .gitignore create mode 100644 .project create mode 100644 .tproject create mode 100644 Build/appendix.mk create mode 100644 Build/basedef.mk create mode 100644 Build/build_c.mk create mode 100644 Build/build_edc.mk create mode 100644 Build/build_po.mk create mode 100644 Build/flags.mk create mode 100644 Build/funcs.mk create mode 100644 Build/makefile create mode 100644 Build/makefile.mk create mode 100644 Build/platform.mk create mode 100644 Build/tooldef.mk create mode 100644 build_def.prop create mode 100644 inc/Config.h create mode 100644 project_def.prop create mode 100644 res/edje/taskmanager.edc create mode 100644 shared/res/taskmanager.png create mode 100644 src/App/inc/App.h create mode 100644 src/App/inc/Resource.h create mode 100644 src/App/src/App.cpp create mode 100644 src/Common/inc/AtspiAccessibleInterface.h create mode 100644 src/Common/inc/BaseView.h create mode 100644 src/Common/inc/Callback.h create mode 100644 src/Common/inc/LangUtils.h create mode 100644 src/Common/inc/Logger.h create mode 100644 src/Common/inc/PathUtils.h create mode 100644 src/Common/inc/View.h create mode 100644 src/Common/inc/Window.h create mode 100644 src/Common/src/Logger.cpp create mode 100644 src/Common/src/PathUtils.cpp create mode 100644 src/Common/src/View.cpp create mode 100644 src/Common/src/Window.cpp create mode 100644 src/main.cpp create mode 100644 tizen-manifest.xml diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..4608729 --- /dev/null +++ b/.cproject @@ -0,0 +1,594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.exportMap b/.exportMap new file mode 100644 index 0000000..de30516 --- /dev/null +++ b/.exportMap @@ -0,0 +1,5 @@ +{ + global: main; + _IO_*; + local: *; +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..65a06db --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +Debug/ +Release/ +crash-info +.sign +.checkers +*~ +/SA_Report +.rds_delta +.sdk_delta.info +.settings/ +org.tizen.message-Test-result.xml +.package-stamp +.svace-dir +*.edj diff --git a/.project b/.project new file mode 100644 index 0000000..f674bd8 --- /dev/null +++ b/.project @@ -0,0 +1,46 @@ + + + taskmanager + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + 1485186287445 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-*/.tpk + + + + 1485186287454 + + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-project_def.prop + + + + diff --git a/.tproject b/.tproject new file mode 100644 index 0000000..de5a150 --- /dev/null +++ b/.tproject @@ -0,0 +1,12 @@ + + + + + wearable-3.0 + + + + + + + diff --git a/Build/appendix.mk b/Build/appendix.mk new file mode 100644 index 0000000..2e06c34 --- /dev/null +++ b/Build/appendix.mk @@ -0,0 +1 @@ +# Appendix diff --git a/Build/basedef.mk b/Build/basedef.mk new file mode 100644 index 0000000..a762983 --- /dev/null +++ b/Build/basedef.mk @@ -0,0 +1,34 @@ +# Add inputs and outputs from these tool invocations to the build variables + + +OS_NAME := $(shell $(UNAME)) + + +#ifeq ($(origin BUILD_CONFIG), undefined) +BUILD_CONFIG ?= Debug +#endif + +#ifeq ($(origin ARCH), undefined) +ARCH ?= i386 +#endif + +#ifeq ($(origin PROJPATH), undefined) +PROJPATH ?= . +#endif + + +#ifeq ($(origin PROJ_PATH), undefined) +PROJ_PATH ?= $(PROJPATH) +#endif + +#ifeq ($(strip $(OUTPUT_DIR)),) +#OUTPUT_DIR ?= $(PROJ_PATH)/$(BUILD_CONFIG) +#endif + +#ifeq ($(strip $(BUILD_ARCH)),) +BUILD_ARCH ?= $(ARCH) +#endif + +#ifeq ($(strip $(ENVENTOR_PATH)),) +ENVENTOR_PATH ?= $(SDK_TOOLPATH)/enventor +#endif diff --git a/Build/build_c.mk b/Build/build_c.mk new file mode 100644 index 0000000..d818ab6 --- /dev/null +++ b/Build/build_c.mk @@ -0,0 +1,110 @@ +# C/C++ build script + + +_FUNC_EXT2O = $(patsubst %.$(3),$(1)/%.o,$(2)) +_FUNC_C2O = $(call _FUNC_EXT2O,$(1),$(2),c) +_FUNC_CPP2O = $(call _FUNC_EXT2O,$(1),$(2),cpp) + + +# parameter : +# $(1) - C/C++ soruce file +# $(2) - output path +# $(3) - .ext +CONVERT_ESC_EXT_TO_O = $(addprefix $(2)/,$(call CONVERT_4MAKE_TO_OUT,$(patsubst %.$(3),%.o,$(1)))) + +CONVERT_ESC_C_TO_O = $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),c) +CONVERT_ESC_CPP_TO_O = $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),cpp) + + +# parameter : +# $(1) - encoded one C/C++ soruce file +# $(2) - output path +# $(3) - ext title (C/C++) +# $(4) - ext (c/cpp) +# $(5) - compiler ($(CC)/$(CXX)) +# $(6) - build opt +# $(7) - build opt file +# output : +# $(8) - output files list +define C_BUILD_PROC_RAW +$(call CONVERT_ESC_EXT_TO_O,$(1),$(2),$(4)) : $(call DECODE_4MAKE,$(1)) $(7) + @echo ' Building file: $$<' + @echo ' Invoking: $(3) Compiler' + $$(call MAKEDIRS,$$(@D)) + $(5) -c "$$<" -o "$$@" $(6) -Wp,@$(7) + @echo ' Finished building: $$<' +$(8) += $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),$(4)) +endef + + +# parameter : +# $(1) - output paths +# $(2) - src paths +# $(3) - inc paths +# $(4) - inc files +# $(5) - Defs +# $(6) - UnDefs +# $(7) - compiler opt +# $(8) - compiler opt file +# $(9) - ext title (C/C++) +# $(10) - ext (c/cpp) +# $(11) - compiler ($(CC)/$(CXX)) +# output : +# $(12) - OBJS +# return : +# none +define C_PROC_RAW + +_OUTPUT_DIR := $$(strip $(1))# +_SRCS := $(2)# +_INCS := $(3)# +_INC_FILES := $(4)# +_DEFS := $(5)# +_UNDEFS := $(6)# + +_OPT := $(7) +_OPT_FILE := $(8) + +_EXT_TITLE := $(9) +_EXT := $(10) +_COMPILER := $(11) + +#_OUTPUT_FILES := $(12) + +_ENC_SRCS := $$(call ENCODE_4MAKE,$$(_SRCS)) +_ENC_SRCS := $$(filter %.$$(_EXT),$$(_ENC_SRCS)) + +ifneq ($$(strip $$(_SRCS)),) + +_NORMAL_SRCS := $$(filter-out %*.$$(_EXT),$$(_ENC_SRCS)) +_WIDLCARD_SRCS := $$(filter %*.$$(_EXT),$$(_ENC_SRCS)) + +_ALL_SRCS := $$(call DECODE_4MAKE,$$(_NORMAL_SRCS)) \ + $$(foreach var,$$(_WIDLCARD_SRCS),$$(call FIND_FILES_4MAKE,$$(call DECODE_4MAKE,$$(var)))) + +ifneq ($$(strip $$(_ALL_SRCS)),) + +_ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS)) + +_CDEFS := $$(CDEFS) +_CDEFS += $$(addprefix -D,$$(_DEFS)) +_CDEFS += $$(addprefix -U,$$(_UNDEFS)) + +_ENC_C_INCS := $$(call ENCODE_4MAKE,$$(_INCS)) +_ENC_C_INCS := $$(addprefix -I,$$(_ENC_C_INCS)) + +_ENC_INC_FILES := $$(call ENCODE_4MAKE,$$(_INC_FILES)) +_ENC_INC_FILES += $$(addprefix -include,$$(_ENC_INC_FILES)) + +_C_INCS := $$(call DECODE_4MAKE,$$(_ENC_C_INCS) $$(_ENC_C_INC_FILES)) + +_DEFS := $$(_CDEFS) $$(_C_INCS) -I"pch" $$(_OPT) + +$$(foreach var,$$(_ENC_SRCS),$$(eval $$(call C_BUILD_PROC_RAW,$$(var),$$(_OUTPUT_DIR),$$(_EXT_TITLE),$$(_EXT),$$(_COMPILER),$$(_DEFS),$$(_OPT_FILE),$(12)))) + +endif # (_(strip _(_ALL_SRCS)),) + +endif # (_(strip _(_SRCS)),) + + +endef diff --git a/Build/build_edc.mk b/Build/build_edc.mk new file mode 100644 index 0000000..6f85fdd --- /dev/null +++ b/Build/build_edc.mk @@ -0,0 +1,81 @@ +# EDC build script + + +FUNC_EDC2EDJ = $(patsubst %.edc,$(2)/%.edj,$(1)) + +# parameter : +# $(1) - C/C++ soruce file +# $(2) - output path +CONVERT_ESC_EDC_TO_EDJ = $(call CONVERT_4MAKE_TO_OUT,$(call FUNC_EDC2EDJ,$(1),$(2))) + + +# parameter : +# $(1) - encoded one C/C++ soruce file +# $(2) - output path +# $(3) - build opt +# output : +# $(4) - output files list +define EDJ_BUILD_PROC_RAW +$(call CONVERT_ESC_EDC_TO_EDJ,$(1),$(2)) : $(call DECODE_4MAKE,$(1)) + @echo ' Building file: $$<' + @echo ' Invoking: EDC Resource Compiler' + $$(call MAKEDIRS,$$(@D)) + $$(EDJE_CC) $(3) "$$<" "$$@" + @echo ' Finished building: $$<' +$(4) += $(call CONVERT_ESC_EDC_TO_EDJ,$(1),$(2)) +endef + + +# parameter : +# $(1) - output paths +# $(2) - src paths +# $(3) - image inc paths +# $(4) - sound inc paths +# $(5) - font inc paths +# output : +# $(6) - OBJS +# return : +# none +define EDJ_PROC_RAW + +_OUTPUT_DIR := $$(strip $(1))# +_SRCS := $(2)# +_IMAGE_DIRS := $(3)# +_SOUND_DIRS := $(4)# +_FONT_DIRS := $(5)# + +ifneq ($$(strip $$(_SRCS)),) + +_ENC_SRCS := $$(call ENCODE_4MAKE,$$(_SRCS)) + +_NORMAL_SRCS := $$(filter-out %*.edc,$$(_ENC_SRCS)) +_WIDLCARD_SRCS := $$(filter %*.edc,$$(_ENC_SRCS)) + +_ALL_SRCS := $$(call DECODE_4MAKE,$$(_NORMAL_SRCS)) \ + $$(foreach var,$$(_WIDLCARD_SRCS),$$(call FIND_FILES_4MAKE,$$(call DECODE_4MAKE,$$(var)))) + +ifneq ($$(strip $$(_ALL_SRCS)),) + +_ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS)) + +_COMPILER_FLAGS := -id "$$(ENVENTOR_SHARED_RES_PATH)/images" +_COMPILER_FLAGS += -sd "$$(ENVENTOR_SHARED_RES_PATH)/sounds" +_COMPILER_FLAGS += -fd "$$(ENVENTOR_SHARED_RES_PATH)/fonts" + +ifneq ($$(strip $$(_IMAGE_DIRS)),) +_COMPILER_FLAGS += $$(addprefix -id ,$$(_IMAGE_DIRS)) +endif +ifneq ($$(strip $$(_SOUND_DIRS)),) +_COMPILER_FLAGS += $$(addprefix -sd ,$$(_SOUND_DIRS)) +endif +ifneq ($$(strip $$(_FONT_DIRS)),) +_COMPILER_FLAGS += $$(addprefix -fd ,$$(_FONT_DIRS)) +endif + +$$(foreach var,$$(_ENC_SRCS),$$(eval $$(call EDJ_BUILD_PROC_RAW,$$(var),$$(_OUTPUT_DIR),$$(_COMPILER_FLAGS),$(6)))) + +endif # (_(strip _(_ALL_SRCS)),) + +endif # (_(strip _(_SRCS)),) + +endef diff --git a/Build/build_po.mk b/Build/build_po.mk new file mode 100644 index 0000000..d88d71a --- /dev/null +++ b/Build/build_po.mk @@ -0,0 +1,64 @@ +# PO build script + + +_FUNC_PO2MO = $(patsubst %.po,$(2)/res/locale/%/LC_MESSAGES/$(3).mo,$(notdir $(1))) + + +# parameter : +# $(1) - C/C++ soruce file +# $(2) - output path +# $(3) - app name +CONVERT_ESC_PO_TO_MO = $(call CONVERT_4MAKE_TO_OUT,$(call _FUNC_PO2MO,$(1),$(2),$(3))) + + +# parameter : +# $(1) - encoded one C/C++ soruce file +# $(2) - output path +# $(3) - app name +# output : +# $(4) - output files list +define MO_BUILD_PROC_RAW +$(call CONVERT_ESC_PO_TO_MO,$(1),$(2),$(3)) : $(call DECODE_4MAKE,$(1)) + @echo ' Building file: $$<' + @echo ' Invoking: msgfmt String Formatter' + $$(call MAKEDIRS,$$(@D)) + $$(MSGFMT) -o "$$@" "$$<" + @echo ' Finished building: $$<' +$(4) += $(call CONVERT_ESC_PO_TO_MO,$(1),$(2),$(3)) +endef + + +# parameter : +# $(1) - output dir +# $(2) - src paths +# $(3) - app name +# output : +# $(4) - OBJS + +define MO_PROC_RAW + +_OUTPUT_DIR := $(1) +_SRCS := $(2) +_APPNAME := $(3) + +ifneq ($$(strip $$(_SRCS)),) + +_ENC_SRCS := $$(call ENCODE_4MAKE,$$(_SRCS)) + +_NORMAL_SRCS := $$(filter-out %*.po,$$(_ENC_SRCS)) +_WIDLCARD_SRCS := $$(filter %*.po,$$(_ENC_SRCS)) + +_ALL_SRCS := $$(call DECODE_4MAKE,$$(_NORMAL_SRCS)) \ + $$(foreach var,$$(_WIDLCARD_SRCS),$$(call FIND_FILES_4MAKE,$$(call DECODE_4MAKE,$$(var)))) + +ifneq ($$(strip $$(_ALL_SRCS)),) + +_ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS)) + +$$(foreach var,$$(_ENC_SRCS),$$(eval $$(call MO_BUILD_PROC_RAW,$$(var),$$(_OUTPUT_DIR),$$(_APPNAME),$(4)))) + +endif # (_(strip _(_ALL_SRCS)),) + +endif # (_(strip _(_SRCS)),) + +endef diff --git a/Build/flags.mk b/Build/flags.mk new file mode 100644 index 0000000..39c9e21 --- /dev/null +++ b/Build/flags.mk @@ -0,0 +1,16 @@ + +DEBUG_OP = +CPP_DEBUG_OP = -g3 + +OPTIMIZATION_OP = +CPP_OPTIMIZATION_OP = -O0 + +COMPILE_FLAGS = $(DEBUG_OP) $(OPTIMIZATION_OP) + +CPP_COMPILE_FLAGS = $(CPP_DEBUG_OP) $(CPP_OPTIMIZATION_OP) -std=c++1y -Wall -c -fmessage-length=0 + +LINK_FLAGS = + +AR_FLAGS = + +EDC_COMPILE_FLAGS = \ No newline at end of file diff --git a/Build/funcs.mk b/Build/funcs.mk new file mode 100644 index 0000000..3ba778b --- /dev/null +++ b/Build/funcs.mk @@ -0,0 +1,50 @@ + +BSLASH := \\# +NULL_CHAR := # +SPACE := \ # +COLON := :# +DOTDOT := ..# +SPACE_ESC := &sp;# +COLON_ESC := &co;# +SPACE_OUT := ~sp~# +COLON_OUT := ~co~# +DOTDOT_OUT := ~dtdt~# + +BSLASH2SLASH = $(subst $(BSLASH),/,$(1)) + +REMOVE_TAIL = $(patsubst %/,%,$(1)) + +#LOWER_CASE = $(shell echo translit($(1),[A-Z],[a-z])|$(M4)) +LOWER_CASE = $(shell echo $(1)|$(TR) [A-Z] [a-z]) + +#ifneq ($(findstring Windows,$(OS)),) +# ... +#endif + +FIND_FILES = $(shell $(FIND) $(1)/$(2) | $(SED) 's/^$(subst /,$(BSLASH)/,$(1))$(BSLASH)///') +FIND_FILES_ESC = $(shell $(FIND) $(1)/$(2) | $(SED) 's/^$(subst /,$(BSLASH)/,$(1))$(BSLASH)///' -e 's/:/$(BSLASH)&co;/g' -e 's/$(BSLASH) /$(BSLASH)&sp;/g') +FIND_FILES_4MAKE = $(shell $(FIND) $(1)/$(2) | $(SED) 's/^$(subst /,$(BSLASH)/,$(1))$(BSLASH)///') + +FIND_FILES_ABS = $(shell $(FIND) $(1)) +FIND_FILES_ABS_4MAKE = $(shell $(FIND) $(1) -e 's/$(BSLASH) /$(BSLASH)&sp;/g') +FIND_FILES_ABS_ESC = $(shell $(FIND) $(1) -e 's/:/$(BSLASH)&co;/g' -e 's/$(BSLASH) /$(BSLASH)&sp;/g') + +FIND_FILES_4MAKE = $(shell $(FIND) $(1) | $(SED) 's/ /\\\ /g') + +#ENCODE_ESC = $(shell echo $(1) | $(SED) -e 's/:/$(BSLASH)&co;/g' -e 's/$(BSLASH) /$(BSLASH)&sp;/g') +#DECODE_ESC = $(shell echo $(1) | $(SED) -e 's/$(BSLASH)&co;/:/g' -e 's/$(BSLASH)&sp;/$(BSLASH) / g') +ENCODE_ESC = $(subst $(SPACE),$(SPACE_ESC),$(subst $(COLON),$(COLON_ESC),$(1))) +DECODE_ESC = $(subst $(COLON_ESC),$(COLON),$(subst $(SPACE_ESC),$(SPACE),$(1))) +ENCODE_4MAKE = $(subst $(SPACE),$(SPACE_ESC),$(1)) +DECODE_4MAKE = $(subst $(SPACE_ESC),$(SPACE),$(1)) + +CONVERT_TO_OUT = $(subst $(DOTDOT),$(DOTDOT_OUT),$(subst $(COLON),$(COLON_OUT),$(subst $(SPACE),$(SPACE_OUT),$(1)))) +CONVERT_ESC_TO_OUT = $(subst $(DOTDOT),$(DOTDOT_OUT),$(subst $(COLON_ESC),$(COLON_OUT),$(subst $(SPACE_ESC),$(SPACE_OUT),$(1)))) +CONVERT_4MAKE_TO_OUT = $(subst $(DOTDOT),$(DOTDOT_OUT),$(subst $(COLON),$(COLON_OUT),$(subst $(SPACE_ESC),$(SPACE_OUT),$(1)))) + +PROC_NO_EXIST = $(if $(wildcard $(1)),,$(call $(2),$(1))) +define MAKEDIRS0 + @echo ' Building directory: $(1)' + @$(MKDIR) $(MKDIR_OP) $(subst $(BSLASH),/,$(1)) +endef +MAKEDIRS = $(call PROC_NO_EXIST,$(1),MAKEDIRS0) diff --git a/Build/makefile b/Build/makefile new file mode 100644 index 0000000..f491b50 --- /dev/null +++ b/Build/makefile @@ -0,0 +1,34 @@ +# +# Usege : make -f /Build/makefile -C +# + +BUILD_SCRIPT_VERSION := 1.1.0 + +.PHONY : app_version app_build app_clean build_version + + +all : app_build + +clean : app_clean + +version : build_version + +#PROJ_ROOT = . +BUILD_ROOT := $(PROJ_PATH)/Build# + +ifeq ($(MAKE_NAME),mingw32-make) +ifneq ($(SHELL),) +OPTIONS += --eval="SHELL=$(SHELL)" +endif +endif + +app_build : + @echo $(MAKE) -f "$(BUILD_ROOT)/makefile.mk" + @$(MAKE_BIN) -f "$(BUILD_ROOT)/makefile.mk" -C "$(PROJ_PATH)" $(OPTIONS) + +app_clean : + @$(MAKE) -f "$(BUILD_ROOT)/makefile.mk" -C "$(PROJ_PATH)" $(OPTIONS) clean + +build_version : + @echo makefile : $(BUILD_SCRIPT_VERSION) + @$(MAKE) -f "$(BUILD_ROOT)/makefile.mk" -C "$(PROJ_PATH)" $(OPTIONS) version diff --git a/Build/makefile.mk b/Build/makefile.mk new file mode 100644 index 0000000..205a3ad --- /dev/null +++ b/Build/makefile.mk @@ -0,0 +1,197 @@ +# +# Usege : make -f /Build/makefile -C +# + +BUILD_SCRIPT_VERSION := 1.2.3 + +.PHONY : app_version app_clean build_version + + +all : app_build + +clean : app_clean + +version : build_version + + +#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJ_PATH)) +PROJ_ROOT := . +BUILD_ROOT := $(PROJ_ROOT)/Build + +include $(BUILD_ROOT)/basedef.mk + +include $(PROJ_ROOT)/project_def.prop +-include $(PROJ_ROOT)/build_def.prop + +include $(BUILD_ROOT)/funcs.mk + +-include $(BUILD_ROOT)/tooldef.mk +-include $(BUILD_ROOT)/flags.mk +-include $(BUILD_ROOT)/platform.mk + + +APPTYPE := $(type) + +OUTPUT_DIR := $(PROJ_ROOT)/$(BUILD_CONFIG) +OBJ_OUTPUT := $(OUTPUT_DIR)/objs + +LOWER_APPNAME := $(call LOWER_CASE,$(APPNAME)) +APPID2 := $(subst $(basename $(APPID)).,,$(APPID)) + +ifeq ($(strip $(APPTYPE)),app) +APPFILE := $(OUTPUT_DIR)/$(LOWER_APPNAME) +endif +ifeq ($(strip $(APPTYPE)),staticLib) +APPFILE := $(OUTPUT_DIR)/lib$(LOWER_APPNAME).a +endif +ifeq ($(strip $(APPTYPE)),sharedLib) +APPFILE := $(OUTPUT_DIR)/lib$(LOWER_APPNAME).so +endif + +ifneq ($(strip $(PLATFORM_INCS)),) +PLATFORM_INCS_FILE := $(OBJ_OUTPUT)/platform_incs_file.inc +endif + +include $(BUILD_ROOT)/build_c.mk + + +ifeq ($(strip $(APPTYPE)),app) +EXT_OP := -fPIE +endif +ifeq ($(strip $(APPTYPE)),staticLib) +EXT_OP := -fPIE +endif +ifeq ($(strip $(APPTYPE)),sharedLib) +EXT_OP := -fPIC +endif + +C_OPT := $(COMPILE_FLAGS) $(TC_COMPILER_MISC) $(RS_COMPILER_MISC) $(EXT_OP) --sysroot="$(SYSROOT)" -Werror-implicit-function-declaration $(M_OPT) $(USER_C_OPTS) +CPP_OPT := $(CPP_COMPILE_FLAGS) $(TC_COMPILER_MISC) $(RS_COMPILER_MISC) $(EXT_OP) --sysroot="$(SYSROOT)" -Werror-implicit-function-declaration $(M_OPT) $(USER_CPP_OPTS) +C_OPT_FILE := $(PLATFORM_INCS_FILE) + +OBJS := # + +# Global C/C++ +ifeq ($(strip $(USER_ROOT)),) +USER_ROOT := $(PROJ_ROOT) +endif +$(eval $(call C_PROC_RAW,$(OBJ_OUTPUT),$(USER_SRCS),$(USER_INC_DIRS),$(USER_INC_FILES),$(USER_DEFS),$(USER_UNDEFS),$(C_OPT),$(C_OPT_FILE),C,c,$(CC),OBJS)) +$(foreach ext,cpp cxx cc c++ C,$(eval $(call C_PROC_RAW,$(OBJ_OUTPUT),$(USER_SRCS),$(USER_INC_DIRS),$(USER_CPP_INC_FILES),$(USER_CPP_DEFS),$(USER_CPP_UNDEFS),$(CPP_OPT),$(C_OPT_FILE),C++,$(ext),$(CXX),OBJS))) + +# Individual C/C++ +ifneq ($(strip $(USER_EXT_C_KEYS)),) +$(foreach var,$(USER_EXT_C_KEYS),$(eval $(call C_PROC_RAW,$(OBJ_OUTPUT),$(USER_EXT_$(var)_SRCS),$(USER_EXT_$(var)_INC_DIRS),$(USER_EXT_$(var)_INC_FILES),$(USER_EXT_$(var)_DEFS),$(USER_EXT_$(var)_UNDEFS),$(C_OPT),$(C_OPT_FILE),C,c,$(CC),OBJS))) +$(foreach ext,cpp cxx cc c++ C,$(foreach var,$(USER_EXT_C_KEYS),$(eval $(call C_PROC_RAW,$(OBJ_OUTPUT),$(USER_EXT_$(var)_SRCS),$(USER_EXT_$(var)_INC_DIRS),$(USER_EXT_$(var)_CPP_INC_FILES),$(USER_EXT_$(var)_CPP_DEFS),$(USER_EXT_$(var)_CPP_UNDEFS),$(CPP_OPT),$(C_OPT_FILE),C++,$(ext),$(CXX),OBJS)))) +endif + + +ifneq ($(strip $(USER_LIB_DIRS)),) +_ENC_USER_LIB_DIRS := $(call ENCODE_4MAKE,$(USER_LIB_DIRS)) +_ENC_USER_LIB_DIRS := $(addprefix -L,$(_ENC_USER_LIB_DIRS)) +LIBPATHS := $(call DECODE_4MAKE,$(_ENC_USER_LIB_DIRS)) +endif + +LIBS += $(addprefix -l,$(USER_LIBS)) + +UOBJS += $(USER_OBJS) + +M_OPT = -MMD -MP -MF"$(@:%.o=%.d)" + +DEPS := $(OBJS:.o=.d) + +ifneq ($(strip $(DEPS)),) +-include $(PROJ_ROOT)/Build/$(DEPS) +endif + + +ifeq ($(strip $(APPTYPE)),app) +$(APPFILE) : $(OBJS) $(UOBJS) + @echo ' Building target: $@' + @echo ' Invoking: C/C++ Linker' + $(call MAKEDIRS,$(@D)) + $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration $(USER_LINK_OPTS) + @echo ' Finished building target: $@' +endif +ifeq ($(strip $(APPTYPE)),staticLib) +$(APPFILE) : $(OBJS) $(UOBJS) + @echo ' Building target: $@' + @echo ' Invoking: Archive utility' + $(call MAKEDIRS,$(@D)) + $(AR) -r $(APPFILE) $(OBJS) $(UOBJS) $(AR_FLAGS) $(USER_LINK_OPTS) + @echo ' Finished building target: $@' +endif +ifeq ($(strip $(APPTYPE)),sharedLib) +$(APPFILE) : $(OBJS) $(UOBJS) + @echo ' Building target: $@' + @echo ' Invoking: C/C++ Linker' + $(call MAKEDIRS,$(@D)) + $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -shared -lpthread --sysroot="$(SYSROOT)" $(RS_LIB_PATHS) $(RS_LIBRARIES) $(USER_LINK_OPTS) + @echo ' Finished building target: $@' +endif + + +$(OBJ_OUTPUT) : + $(call MAKEDIRS,$@) + +$(OUTPUT_DIR) : + $(call MAKEDIRS,$@) + + +ifneq ($(strip $(PLATFORM_INCS)),) +$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) + @echo ' Building inc file: $@' +ifneq ($(findstring Windows,$(OS)),) +ifneq ($(findstring 3.82,$(MAKE_VERSION)),) + $(file > $@,$(PLATFORM_INCS)) +else + @echo $(PLATFORM_INCS) > $@ +endif +else + @echo $(PLATFORM_INCS) > $@ +endif +endif + + +include $(BUILD_ROOT)/build_edc.mk + +#ifeq ($(strip $(ENVENTOR_SHARED_RES_PATH)),) +ENVENTOR_SHARED_RES_PATH ?= $(ENVENTOR_PATH)/share/enventor +#endif + +EDJ_FILES := + +# Global EDCs +ifneq ($(strip $(USER_EDCS)),) +$(eval $(call EDJ_PROC_RAW,$(OUTPUT_DIR),$(USER_EDCS),$(USER_EDCS_IMAGE_DIRS),$(USER_EDCS_SOUND_DIRS),$(USER_EDCS_FONT_DIRS),EDJ_FILES)) +endif + +# Individual EDCs +ifneq ($(strip $(USER_EXT_EDC_KEYS)),) +$(foreach var,$(USER_EXT_EDC_KEYS),$(eval $(call EDJ_PROC_RAW,$(OUTPUT_DIR),$(USER_EXT_$(var)_EDCS),$(USER_EXT_$(var)_EDCS_IMAGE_DIRS),$(USER_EXT_$(var)_EDCS_SOUND_DIRS),$(USER_EXT_$(var)_EDCS_FONT_DIRS),EDJ_FILES))) +endif + + +include $(BUILD_ROOT)/build_po.mk + +MO_FILES := + +# Global POs +ifneq ($(strip $(USER_POS)),) +$(eval $(call MO_PROC_RAW,$(OUTPUT_DIR),$(USER_POS),$(APPID2),MO_FILES)) +endif + + +secondary-outputs : $(EDJ_FILES) $(MO_FILES) + +-include appendix.mk + +app_build : $(OUTPUT_DIR) $(APPFILE) secondary-outputs + @echo ========= done ========= + + +app_clean : + rm -f $(APPFILE) + rm -rf $(OUTPUT_DIR) + +build_version : + @echo makefile.mk : $(BUILD_SCRIPT_VERSION) diff --git a/Build/platform.mk b/Build/platform.mk new file mode 100644 index 0000000..294a38a --- /dev/null +++ b/Build/platform.mk @@ -0,0 +1,15 @@ +# Add inputs and outputs from these tool invocations to the build variables + +SYSROOT = $(SBI_SYSROOT) + +USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX)) + +ifeq ($(strip $(PLATFORM_LIB_PATHS)),) +RS_LIB_PATHS := "$(SYSROOT)/usr/lib" +else +RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS)) +endif + +RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX)) + +PLATFORM_INCS = $(USR_INCS) -I"$(SDK_PATH)/library" diff --git a/Build/tooldef.mk b/Build/tooldef.mk new file mode 100644 index 0000000..fded35b --- /dev/null +++ b/Build/tooldef.mk @@ -0,0 +1,63 @@ +# Add inputs and outputs from these tool invocations to the build variables + +ifneq ($(strip $(SHELL_BIN)),) +SHELL = $(SHELL_BIN) +else +SHELL = sh +endif + +ifneq ($(strip $(MKDIR_BIN)),) +MKDIR = $(MKDIR_BIN) +MKDIR_OP = -p +else +MKDIR = mkdir +MKDIR_OP = -p +endif + +ifneq ($(strip $(UNAME_BIN)),) +UNAME = $(UNAME_BIN) +else +UNAME = uname +endif + +ifneq ($(strip $(M4_BIN)),) +M4 = $(M4_BIN) +else +M4 = m4 +endif + +ifneq ($(strip $(TR_BIN)),) +TR = $(TR_BIN) +else +TR = tr +endif + +ifneq ($(strip $(FIND_BIN)),) +FIND = $(FIND_BIN) +else +FIND = find +endif + +ifneq ($(strip $(SED_BIN)),) +SED = $(SED_BIN) +else +SED = sed +endif + +ifneq ($(strip $(GREP_BIN)),) +GREP = $(GREP_BIN) +else +GREP = grep +endif + +ifneq ($(strip $(EDJE_CC_BIN)),) +EDJE_CC = $(EDJE_CC_BIN) +else +EDJE_CC = edje_cc +endif + +ifneq ($(strip $(MSGFMT_BIN)),) +MSGFMT = $(MSGFMT_BIN) +else +MSGFMT = msgfmt +endif diff --git a/build_def.prop b/build_def.prop new file mode 100644 index 0000000..6bb5e2f --- /dev/null +++ b/build_def.prop @@ -0,0 +1,6 @@ + +# Add pre/post build process +PREBUILD_DESC = +PREBUILD_COMMAND = +POSTBUILD_DESC = +POSTBUILD_COMMAND = diff --git a/inc/Config.h b/inc/Config.h new file mode 100644 index 0000000..050af59 --- /dev/null +++ b/inc/Config.h @@ -0,0 +1,39 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 Config_h_ +#define Config_h_ + +#if !defined(PACKAGE_NAME) +#define PACKAGE_NAME "org.tizen.taskmanager" +#endif + +#if !defined(PROJECT_NAME) +#define PROJECT_NAME "taskmanager" +#endif + +#ifdef LOGGER_TAG +#undef LOGGER_TAG +#endif +#define LOGGER_TAG "TASKMANAGER" + +#define SYS_DOMAIN "sys_string" +#define APP_DOMAIN PROJECT_NAME + +// Preference storage prefix +#define PREF_PREFX "db/private/" PACKAGE_NAME "/" + +#endif // Config_h_ diff --git a/project_def.prop b/project_def.prop new file mode 100644 index 0000000..b3b6fbd --- /dev/null +++ b/project_def.prop @@ -0,0 +1,63 @@ + +# Project Name +APPNAME = taskmanager + +# Project Type +type = app + +# Project Profile +profile = wearable-3.0 + +# C/CPP Sources +USER_SRCS = src/App/src/App.cpp src/main.cpp src/Common/src/PathUtils.cpp src/Common/src/Window.cpp src/Common/src/Logger.cpp src/Common/src/View.cpp + +# EDC Sources +USER_EDCS = + +# PO Sources +USER_POS = + +# User Defines +USER_DEFS = +USER_CPP_DEFS = TIZEN_DEPRECATION DEPRECATION_WARNING + +# User Undefines +USER_UNDEFS = +USER_CPP_UNDEFS = + +# User Libraries +USER_LIBS = + +# User Objects +USER_OBJS = + +# User Includes +## C Compiler +USER_C_INC_DIRS = +USER_INC_FILES = +## C++ Compiler +USER_CPP_INC_DIRS = inc src/App/inc src/Common/inc +USER_CPP_INC_FILES = + +USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS) + +# User Library Path +USER_LIB_DIRS = lib + +# EDC Resource Path +USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje/images +USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje/sounds +USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje/fonts + +# EDC Flags +USER_EXT_EDC_KEYS = EDC0 + +USER_EXT_EDC0_EDCS = res/edje/taskmanager.edc +USER_EXT_EDC0_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje/images +USER_EXT_EDC0_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje/sounds +USER_EXT_EDC0_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje/fonts + +# Resource Filter +USER_RES_INCLUDE = +USER_RES_EXCLUDE = + diff --git a/res/edje/taskmanager.edc b/res/edje/taskmanager.edc new file mode 100644 index 0000000..252aeb9 --- /dev/null +++ b/res/edje/taskmanager.edc @@ -0,0 +1,14 @@ +collections { + group { name: "main"; + parts { + part { name: "txt_title"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + text { text: "Hello Tizen"; font: "Tizen:style=regular"; size: 20; min: 1 1; align: 0.5 0; ellipsis: -1; } + color: 0 255 255 255; + } + } + } + } +} diff --git a/shared/res/taskmanager.png b/shared/res/taskmanager.png new file mode 100644 index 0000000000000000000000000000000000000000..7f7b4069f1bb019cfff71e62739ba2de192646d3 GIT binary patch literal 7460 zcmV+<9oyoGP)1^@s67{VYS00009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)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pQy30y>8jVK4oW3RAT(d){W z%GEsrTnISDCe+6c;KP)t2y`j$QjTK=D8A;{P+7btY*ey_1*N{Mn_e!Ta%`y_o+{O{ zSWbe08E$Eq9k4H}Ie{n-y)=dQj+8x_d}hL@8syO~9o{Y*KFn z^a&l_q{=}`S4=@qi#P8sV9Mc3!I%;{>n5+$nM1HsBaT_rY#s1Z9KYFY$O#>tDRdTB zO+Z~?!NDBn~- zw~%t*1g-|UFk{AJ6-2C<7;~4fTp&DkMX z@o^HkAJ_<-BmQg$hwYFU%Q<3f_fz7Kno^=zd66o;Fc*mZ$>o4ms?_xZkBR-&^LE;2 z+Kpf{aRz20!-bglaZQTIHG)~!<2lR=Xxrv5xUo0(iqALl2zQ=1-fs{~P^s%`jA3T% z?81y{c!>&1h;dU{*n0}&wuz;*9ase{6*FCf_ymAj%-S2%`pRI|ZkP}!yixHP0S3jA icL?+9<|q}6{~rL_dKuK_C%Gp80000 +#include + +namespace TaskMngr +{ + class Window; + class TaskMngrService; + + class App + { + public: + static App &getInst(); + int start(int argc, char *argv[]); + void exit(); + + private: + App(); + ~App(); + App(App &) = delete; + App &operator=(App &) = delete; + + // App cbs: + bool onCreate(); + void onTerminate(); + void onPause(); + void onResume(); + void onControl(app_control_h app_control); + void onLanguageChanged(app_event_info_h appEvent); + void onLowBattery(app_event_info_h appEvent); + void onRegionChanged(app_event_info_h appEvent); + + private: + static App m_AppInst; + Window *m_pWindow; + }; +} + +#endif /* App_h_ */ diff --git a/src/App/inc/Resource.h b/src/App/inc/Resource.h new file mode 100644 index 0000000..c581924 --- /dev/null +++ b/src/App/inc/Resource.h @@ -0,0 +1,24 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 RESOURCE_H_ +#define RESOURCE_H_ + +#define EDJ_PATH "edje" +#define IMAGE_PATH "images" + + +#endif /* RESOURCE_H_ */ diff --git a/src/App/src/App.cpp b/src/App/src/App.cpp new file mode 100644 index 0000000..b817708 --- /dev/null +++ b/src/App/src/App.cpp @@ -0,0 +1,120 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "App.h" +#include "PathUtils.h" +#include "Logger.h" +#include "Callback.h" +#include "Window.h" + +using namespace TaskMngr; + +App App::m_AppInst; + +App::App() + : m_pWindow(nullptr) +{ +} + +App::~App() +{ +} + +App &App::getInst() +{ + return m_AppInst; +} + +void App::exit() +{ + if (m_pWindow) + m_pWindow->lower(); +} + +int App::start(int argc, char *argv[]) +{ + ui_app_lifecycle_callback_s cbs = {}; + + cbs.app_control = makeCbLast(&App::onControl); + cbs.create = makeCbLast(&App::onCreate); + cbs.pause = makeCbLast(&App::onPause); + cbs.resume = makeCbLast(&App::onResume); + cbs.terminate = makeCbLast(&App::onTerminate); + + app_event_handler_h handlers[3] = {}; + ui_app_add_event_handler(&handlers[0], APP_EVENT_LOW_BATTERY, makeCbLast(&App::onLowBattery), this); + ui_app_add_event_handler(&handlers[1], APP_EVENT_LANGUAGE_CHANGED, makeCbLast(&App::onLanguageChanged), this); + ui_app_add_event_handler(&handlers[2], APP_EVENT_REGION_FORMAT_CHANGED, makeCbLast(&App::onRegionChanged), this); + + return ui_app_main(argc, argv, &cbs, this); +} + +bool App::onCreate() +{ + TRACE; + + const int maxFps = 60; + + std::string localePath(PathUtils::getLocalePath()); + if (!localePath.empty()) + bindtextdomain(PROJECT_NAME, localePath.c_str()); + + elm_app_base_scale_set(1.3); + elm_config_accel_preference_set("3d"); + ecore_animator_frametime_set(1 / (double)maxFps); + + m_pWindow = new Window; + m_pWindow->show(); + + return true; +} + +void App::onTerminate() +{ + TRACE; + m_pWindow->destroy(); +} + +void App::onPause() +{ + TRACE; +} + +void App::onResume() +{ + TRACE; +} + +void App::onControl(app_control_h app_control) +{ + TRACE; +} + +void App::onLanguageChanged(app_event_info_h appEvent) +{ + TRACE; +} + +void App::onLowBattery(app_event_info_h appEvent) +{ + TRACE; +} + +void App::onRegionChanged(app_event_info_h appEvent) +{ + TRACE; +} + diff --git a/src/Common/inc/AtspiAccessibleInterface.h b/src/Common/inc/AtspiAccessibleInterface.h new file mode 100644 index 0000000..1be20ca --- /dev/null +++ b/src/Common/inc/AtspiAccessibleInterface.h @@ -0,0 +1,122 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 AtspiAccessibleInterface_h_ +#define AtspiAccessibleInterface_h_ + +#include "LangUtils.h" +#include "Config.h" +#include + +namespace TaskMngr +{ + /** + * @brief Wrapper for Elm_Interface_Atspi_Accessible interface (Screen reader) + */ + class AtspiAccessibleInterface + { + public: + AtspiAccessibleInterface(Elm_Interface_Atspi_Accessible *obj); + void wrap(Elm_Interface_Atspi_Accessible *obj); + Elm_Interface_Atspi_Accessible *getEo() const; + operator Elm_Interface_Atspi_Accessible *() const; + + void setDescription(const char *text); + void setDescription(const std::string &text); + void setName(const char *text); + void setName(const std::string &text); + void setRole(Elm_Atspi_Role role); + void setReadingInfo(Elm_Accessible_Reading_Info_Type type); + void appendRelationship(Elm_Atspi_Relation_Type type, const Elm_Interface_Atspi_Accessible *obj); + void removeRelationship(Elm_Atspi_Relation_Type type, const Elm_Interface_Atspi_Accessible *obj); + void canHighlight(bool canHighlight); + + // TODO: impl. other methods if needed + + private: + Elm_Interface_Atspi_Accessible *m_pEo; + }; + + typedef AtspiAccessibleInterface Atspi; + + inline AtspiAccessibleInterface::AtspiAccessibleInterface(Elm_Interface_Atspi_Accessible *obj) + : m_pEo(obj) + { + } + + inline void AtspiAccessibleInterface::wrap(Elm_Interface_Atspi_Accessible *obj) + { + m_pEo = obj; + } + + inline Elm_Interface_Atspi_Accessible *AtspiAccessibleInterface::getEo() const + { + return m_pEo; + } + + inline AtspiAccessibleInterface::operator Elm_Interface_Atspi_Accessible *() const + { + return getEo(); + } + + inline void AtspiAccessibleInterface::setDescription(const char *text) + { + elm_atspi_accessible_description_set(m_pEo, text); + elm_atspi_accessible_translation_domain_set(m_pEo, PACKAGE_NAME); + } + + inline void AtspiAccessibleInterface::setDescription(const std::string &text) + { + setDescription(text.c_str()); + } + + inline void AtspiAccessibleInterface::setName(const char *text) + { + elm_atspi_accessible_name_set(m_pEo, (char*)text); + } + + inline void AtspiAccessibleInterface::setName(const std::string &text) + { + setName(text.c_str()); + } + + inline void AtspiAccessibleInterface::setRole(Elm_Atspi_Role role) + { + elm_atspi_accessible_role_set(m_pEo, role); + } + + inline void AtspiAccessibleInterface::setReadingInfo(Elm_Accessible_Reading_Info_Type type) + { + elm_atspi_accessible_reading_info_type_set(m_pEo, type); + } + + inline void AtspiAccessibleInterface::appendRelationship(Elm_Atspi_Relation_Type type, const Elm_Interface_Atspi_Accessible *obj) + { + elm_atspi_accessible_relationship_append(m_pEo, type, obj); + } + + inline void AtspiAccessibleInterface::removeRelationship(Elm_Atspi_Relation_Type type, const Elm_Interface_Atspi_Accessible *obj) + { + elm_atspi_accessible_relationship_remove(m_pEo, type, obj); + } + + inline void AtspiAccessibleInterface::canHighlight(bool canHighlight) + { + elm_atspi_accessible_can_highlight_set(m_pEo, canHighlight); + } +} + +#endif /* AtspiAccessibleInterface_h_ */ diff --git a/src/Common/inc/BaseView.h b/src/Common/inc/BaseView.h new file mode 100644 index 0000000..9d4b20c --- /dev/null +++ b/src/Common/inc/BaseView.h @@ -0,0 +1,82 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 BaseView_h_ +#define BaseView_h_ + +#include +#include "PathUtils.h" +#include "AtspiAccessibleInterface.h" + +namespace TaskMngr +{ + /** + * @brief Basic interface for all visual objects used across the whole application. + */ + class BaseView + { + public: + BaseView(); + virtual ~BaseView() {}; + + operator Evas_Object *() const; + Eo *getEo() const; + + /** + * @brief Gets AtspiAccessibleInterface wrapper + * @return wrapper to AtspiAccessibleInterface + */ + AtspiAccessibleInterface getAtspi() const; + + protected: + void setEo(Eo *eo); + + /** + * @brief Performs self-removing by request from children-classes. + */ + virtual void onViewDestroyed() { delete this; }; + + protected: + Eo *m_pEo; + }; + + inline BaseView::BaseView() + : m_pEo(nullptr) + { + } + + inline AtspiAccessibleInterface BaseView::getAtspi() const + { + return AtspiAccessibleInterface(m_pEo); + } + + inline BaseView::operator Eo *() const + { + return m_pEo; + } + + inline Eo *BaseView::getEo() const + { + return m_pEo; + } + + inline void BaseView::setEo(Eo *eo) + { + m_pEo = eo; + } +} + +#endif /* BaseView_h_ */ diff --git a/src/Common/inc/Callback.h b/src/Common/inc/Callback.h new file mode 100644 index 0000000..faf09b0 --- /dev/null +++ b/src/Common/inc/Callback.h @@ -0,0 +1,44 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 Callback_h_ +#define Callback_h_ + +template +struct Callback; + +template +struct Callback +{ + using M = R(C::*)(A...); + + template + static R stubFirst(void *obj, A... args) + { + return (static_cast(obj)->*m)(args...); + } + + template + static R stubLast(A... args, void *obj) + { + return (static_cast(obj)->*m)(args...); + } +}; + +#define makeCbFirst(method) Callback::stubFirst +#define makeCbLast(method) Callback::stubLast + +#endif // Callback_h_ diff --git a/src/Common/inc/LangUtils.h b/src/Common/inc/LangUtils.h new file mode 100644 index 0000000..950d04a --- /dev/null +++ b/src/Common/inc/LangUtils.h @@ -0,0 +1,111 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 LangUtils_h_ +#define LangUtils_h_ + +#include "Resource.h" +#include "Config.h" + +#include +#include +#include +#include + +namespace TaskMngr +{ + // Translatable Text + struct TText + { + explicit TText(const char *stringId, const char *domainName) + : m_pDomain(domainName) + , m_pMsg(stringId) + { + }; + + const char *getMsg() const + { + return m_pMsg; + } + + const char *getDomain() const + { + return m_pDomain; + } + + private: + TText(TText&) = delete; + TText operator =(TText&) = delete; + + const char *m_pDomain; + const char *m_pMsg; + }; + + // dgettext + struct DText + { + explicit DText(const char *stringId, const char *domainName) + { + m_pMsg = dgettext(domainName, stringId); + } + + explicit DText(const std::string &stringId, const char *domainName) + { + m_pMsg = dgettext(domainName, stringId.c_str()); + } + + explicit DText(char dummyArg, const char *stringId, const char *domainName, ...) + : m_pMsg(m_Buf) + { + va_list args; + va_start(args, domainName); + vsnprintf(m_Buf, maxBufSize, dgettext(domainName, stringId), args); + va_end(args); + } + + const char *get() const + { + return m_pMsg; + } + + const char* cStr() const + { + return m_pMsg; + } + + operator std::string() const + { + return m_pMsg; + } + + private: + DText(DText&) = delete; + DText operator =(DText&) = delete; + + static const int maxBufSize = 1024; + char m_Buf[maxBufSize]; + const char *m_pMsg; + }; + + #define msgt(strId) TText(strId, APP_DOMAIN) + #define msg(strId) DText(strId, APP_DOMAIN) + #define msgArgs(strId, ...) DText(0, strId, APP_DOMAIN, __VA_ARGS__) + #define sys(strId) DText(strId, SYS_DOMAIN) + #define syst(strId) TText(strId, SYS_DOMAIN) + #define sysArgs(strId, ...) DText(0, strId, SYS_DOMAIN, __VA_ARGS__) +} + +#endif /* LangUtils_h_ */ diff --git a/src/Common/inc/Logger.h b/src/Common/inc/Logger.h new file mode 100644 index 0000000..a833443 --- /dev/null +++ b/src/Common/inc/Logger.h @@ -0,0 +1,87 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 LOGGER_H_ +#define LOGGER_H_ + +#include "Config.h" +#include +#include +#include +#include + +#ifndef LOGGER_TAG + #error "Please define LOGGER_TAG" +#endif + +enum class LogPriority +{ + DEFAULT = DLOG_DEFAULT, + VERBOSE = DLOG_VERBOSE, /**< Verbose */ + DEBUG = DLOG_DEBUG, /**< Debug */ + INFO = DLOG_INFO, /**< Info */ + WARN = DLOG_WARN, /**< Warning */ + ERROR = DLOG_ERROR, /**< Error */ + FATAL = DLOG_FATAL, /**< Fatal */ + SILEN = DLOG_SILENT, /**< Silent */ + MAX = DLOG_PRIO_MAX/**< Keep this always at the end. */ +}; + +template +void loggerImpl(LogPriority prior + , const char *tag + , const char *file, const char *function, int line + , Tail... msg) +{ + std::ostringstream messageStr; + std::initializer_list { (messageStr << msg, true)... }; + dlog_print(static_cast(prior) + , tag, "%s: %s(%d) -> %s", file, function, line + , messageStr.str().c_str()); +} + +class LoggerImpl +{ + public: + LoggerImpl(const char *tag, const char *file, const char *function, int line); + ~LoggerImpl(); + + private: + const std::string m_Tag; + const std::string m_File; + const std::string m_Function; +}; + +#define TRACE\ + LoggerImpl __tmp_logger_unique(LOGGER_TAG, __FILE__, __FUNCTION__, __LINE__);\ + +#define LOG(...)\ + loggerImpl(LogPriority::INFO, LOGGER_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); + +#define LOG_INFO(...)\ + loggerImpl(LogPriority::INFO, LOGGER_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); + +#define LOG_ERROR(...)\ + loggerImpl(LogPriority::ERROR, LOGGER_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); + +#define LOG_WARN(...)\ + loggerImpl(LogPriority::WARN, LOGGER_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); + +#define ASSERT(expr, ...)\ + if (!(expr)) { LOG_ERROR(__VA_ARGS__); } \ + assert(expr) + +#endif /* LOGGER_H_ */ diff --git a/src/Common/inc/PathUtils.h b/src/Common/inc/PathUtils.h new file mode 100644 index 0000000..7ac905e --- /dev/null +++ b/src/Common/inc/PathUtils.h @@ -0,0 +1,61 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 PathUtils_h_ +#define PathUtils_h_ + +#include +#include "Resource.h" + +namespace TaskMngr +{ + namespace PathUtils + { + /** + * @brief Gets the absolute path to file in the application resource directory. + * @param[in] path to file in res. dir (without slash at begin/end) + * @return absolute path to file + */ + std::string getResourcePath(const std::string &filePath); + + /** + * @brief Gets the absolute path to file in data directory which is used to store private data of the application. + * @param[in] path to file in data dir (without slash at begin/end) + * @return absolute path to file + */ + std::string getDataPath(const std::string &filePath); + + /** + * @brief Gets absolute path to application's resource-directory + * @return absolute path in case of success, or empty string otherwise + */ + std::string getResourcePath(); + + /** + * @brief Gets absolute path to application's locale-directory + * @return absolute path in case of success, or empty string otherwise + */ + std::string getLocalePath(); + + /** + * @brief Gets absolute path to Dowloads directory + * @return absolute path in case of success, or empty string otherwise + */ + const std::string &getDownloadPath(); + }; +} + +#endif /* PathUtils_h_ */ diff --git a/src/Common/inc/View.h b/src/Common/inc/View.h new file mode 100644 index 0000000..809038a --- /dev/null +++ b/src/Common/inc/View.h @@ -0,0 +1,558 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 View_h_ +#define View_h_ + +#include "BaseView.h" +#include "LangUtils.h" +#include "AtspiAccessibleInterface.h" + +#include + +namespace TaskMngr +{ + /** + * @brief Wraps all basic Evas_Object operations and manages automatic self-removal by EVAS_CALLBACK_FREE and EVAS_CALLBACK_DEL events. + */ + class View + : public BaseView + { + public: + View(); + + /** + * @brief Destroys nested Evas_Object. + */ + void destroy(); + operator Evas_Object *() const; + Evas_Object *getEo() const; + + /** + * @brief Checks whether view is visible or not. + * @return true if view is visible, otherwise false. + */ + bool isVisible() const; + + /** + * @brief Shows view. + * @param[in] value - true show, false - otherwise + */ + void show(bool value = true); + + /** + * @brief Moves view to specified Evas-coordinates. + * @param[in] x x-coordinate + * @param[in] y y-coordinate + */ + void move(Evas_Coord x, Evas_Coord y); + + /** + * @brief Sets size-weight hints. + * @param[in] x x-coordinate + * @param[in] y y-coordinate + */ + void setSizeHintWeight(double x = EVAS_HINT_EXPAND, double y = EVAS_HINT_EXPAND); + + /** + * @brief Sets size-align hints. + * @param[in] x x-coordinate + * @param[in] y y-coordinate + */ + void setSizeHintAlign(double x = EVAS_HINT_FILL, double y = EVAS_HINT_FILL); + + /** + * @brief Make the scroller minimum size limited to the minimum size of the view's content + * + * @param[in] w Enable limiting minimum size horizontally + * @param[in] h Enable limiting minimum size vertically + */ + void setScrollerContentMinLimit(Eina_Bool w, Eina_Bool h); + + /** + * @brief Sets size-weight and size-align hints in order to make view expanded. + */ + void expand(); + + /** + * @brief Sets specified Evas_object's size-weight and size-align hints in order to make it expanded. + * @param[in] obj an Evas_Object to be expanded. + */ + static void expand(Evas_Object *obj); + + /** + * @brief Sets min size hints. + * @param[in] w width hint. + * @param[in] h height hint. + */ + void setSizeHintMin(Evas_Coord w, Evas_Coord h); + + /** + * @brief Sets max size hints. + * @param[in] w width hint. + * @param[in] h height hint. + */ + void setSizeHintMax(Evas_Coord w, Evas_Coord h); + + /** + * @brief Gets min size hints. + * @param[out] w width hint. + * @param[out] h height hint. + */ + void getSizeHintMin(Evas_Coord *w, Evas_Coord *h) const; + + /** + * @brief Gets max size hints. + * @param[out] w width hint. + * @param[out] h height hint. + */ + void getSizeHintMax(Evas_Coord *w, Evas_Coord *h) const; + + /** + * @brief Sets specified content into specified part. + * @param[in] content a content to set into view. + * @param[in] part a part content should be placed to. If part is nullptr the default part is used. + * @param[in] saveOldContent a flag that checks whether old view's content should be returned or not. + * @return if saveOldContent is true returns old content set into view before, otherwise returns nullptr. + */ + Evas_Object *setContent(Evas_Object *content, const char *part = nullptr, bool saveOldContent = false); + + /** + * @brief Unsets view's content. + * @param[in] part a part content should be removed from. If part is nullptr the default part is used. + * @return old view's content in case of success, nullptr in case of errors. + */ + Evas_Object *unsetContent(const char *part = nullptr); + + /** + * @brief Gets view's content. + * @param[in] part a content-part. If part is nullptr the default part is used. + * @return view's content in case of success, nullptr in case of errors. + */ + Evas_Object* getContent(const char *part = nullptr) const; + + /** + * @brief Set the ability for an view object to be focused. + * @param[in] enable if true view is enabled to be focused, otherwise it can not be focused. + */ + void setFocusAllow(bool enable); + + /** + * @brief Checks whether view can be focused or not. + * @return true if view is able to be focused, otherwise false. + */ + bool getFocusAllow() const; + + /** + * @brief Sets(unsets) focus to view. + * @param[in] focus if true sets focus to view, otherwise unfocuses it. + */ + void setFocus(bool focus); + + /** + * @brief Checks whether view is focused or not. + * @return true if view is focused, otherwise false. + */ + bool getFocus() const; + + /** + * @brief Mark the part text to be translatable or not. + * @param[in] translatable @c true, the part text will be translated internally. @c false, otherwise. + * @param[in] domain The translation domain to use. + * @param[in] part The part name of the translatable text, if part is nullptr the default part is used. + */ + void setTranslatable(bool translatable, const char *domain, const char *part = nullptr); + + /** + * @brief Sends a signal to edje-object. + * @param[in] emission The signal's name. + * @param[in] source The signal's source. + * @param[in] async true - process an object's message queue in job/timer, false - process immediately. + */ + void emitSignal(const char *emission, const char *source, bool async = false); + + /** + * @brief Sends a signal to edje-object. + * @param[in] obj Target object + * @param[in] emission The signal's name. + * @param[in] source The signal's source. + * @param[in] async true - process the signal postponed, false - process immediately. + */ + static void emitSignal(Evas_Object *obj, const char *emission, const char *source, bool async = false); + + /** + * @brief Process all edje signals for object + * @param[in] obj Target object + */ + static void processSignal(Evas_Object *obj); + + /** + * @brief Process edje signals for object + */ + void processSignal(); + + /** + * @brief Process all edje signals + */ + static void processSignals(); + + /** + * @brief Sets user-data associated with specified key-string. + * @param[in] key a string-key. + * @param[in] data to be stored. + */ + void setData(const char *key, const void *data); + + /** + * @brief Sets the view mirrored mode. + * @param[in] obj evas object + * @param[in] true to set mirrored mode, false othewise + */ + static void setMirrored(Evas_Object *obj, bool mirrored); + void setMirrored(bool mirrored); + + /** + * @brief Gets data associated with specified key-string. + * @param[in] key a string-key. + * @return user-data. + */ + void *getData(const char *key) const; + void addEventCb(Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data); + void addSmartCb(const char *event, Evas_Smart_Cb func, const void *data); + void addSignalCb(const char *emission, const char *source, Edje_Signal_Cb func, void *data); + + template + static T staticCast(void *evasObj); + template + static T reinterpretCast(void *evasObj); + template + static T dynamicCast(void *evasObj); + + /** + * @brief Gets text placed in specified part. + * @param[in] part a part to get text from. If part is nullptr the default part is used. + * @return a text part contains. If part contains no text returns empty string. + */ + std::string getText(const char *part = nullptr) const; + + /** + * @brief A C-style implementation of getText(). + */ + const char *getTextCStr(const char *part = nullptr) const; + + /** + * @brief Sets text into specified part. + * @param[in] text a text to be set in specified part + * @param[in] part a part to get text from. If part is nullptr the default part is used. + */ + void setText(const char *text, const char *part = nullptr); + + /** + * @brief Sets text into specified part. + * @param[in] text a text to be set in specified part + * @param[in] part a part to get text from. If part is nullptr the default part is used. + */ + void setText(const std::string &text, const char *part = nullptr); + + /** + * @brief Sets IDS of translatable string into specified part. + * @param[in] text a translatable text to be set in specified part. + * @param[in] part a part to get text from. If part is nullptr the default part is used. + */ + void setText(const TText &text, const char *part = nullptr); + + /** + * @brief Set the style to used by a given widget + * @param[in] style The name of the style to use on it + */ + void setStyle(const std::string &style); + + /** + * @brief Gets the edje object + * @return edje object + */ + Evas_Object *getEdje() const; + + /** + * @brief Gets evas + * @return pointer to evas + */ + Evas *getEvas() const; + + static void setText(Evas_Object *obj, const TText &text, const char *part = nullptr); + + static Evas_Object *addLayout(Evas_Object *parent, const std::string &edjePath, const std::string &group); + + protected: + virtual ~View(); + + /** + * @brief Allows children-classes to perform some cleanup activities before their destroying. + * @param[in] view to be destroyed after exiting onBeforeDelete(). + */ + virtual void onBeforeDelete(View &view) {}; + + void setEventCb(Evas_Callback_Type type); + void unsetEventCb(Evas_Callback_Type type); + void setEo(Evas_Object *eo); + + private: + View(View&) = delete; + View& operator=(View&) = delete; + Evas_Object_Event_Cb getCb(Evas_Callback_Type); + void *getData() const; + static void *getData(Evas_Object *obj); + void setData(const void *data); + static void setData(Evas_Object *obj, const void *data); + + private: + static void on_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); + static void on_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); + }; + + std::string markupToUtf8(const char *str); + std::string utf8ToMarkup(const char *str); + std::string markupToUtf8(const std::string &str); + std::string utf8ToMarkup(const std::string &str); + + inline View::operator Evas_Object *() const + { + return m_pEo; + } + + inline Evas_Object *View::getEo() const + { + return (Evas_Object*)BaseView::getEo(); + } + + inline void View::destroy() + { + evas_object_del(m_pEo); + } + + inline bool View::isVisible() const + { + return evas_object_visible_get(m_pEo); + } + + inline void View::show(bool value) + { + value ? evas_object_show(m_pEo) : evas_object_hide(m_pEo); + } + + inline void View::setSizeHintWeight(double x, double y) + { + evas_object_size_hint_weight_set(m_pEo, x, y); + } + + inline void View::setSizeHintAlign(double x, double y) + { + evas_object_size_hint_align_set(m_pEo, x, y); + } + + inline void View::setScrollerContentMinLimit(Eina_Bool w, Eina_Bool h) + { + elm_scroller_content_min_limit(m_pEo, w, h); + } + + inline void View::setSizeHintMin(Evas_Coord w, Evas_Coord h) + { + evas_object_size_hint_min_set(m_pEo, w, h); + } + + inline void View::setSizeHintMax(Evas_Coord w, Evas_Coord h) + { + evas_object_size_hint_max_set(m_pEo, w, h); + } + + inline void View::getSizeHintMin(Evas_Coord *w, Evas_Coord *h) const + { + evas_object_size_hint_min_get(m_pEo, w, h); + }; + + inline void View::getSizeHintMax(Evas_Coord *w, Evas_Coord *h) const + { + evas_object_size_hint_max_get(m_pEo, w, h); + } + + inline void View::move(Evas_Coord x, Evas_Coord y) + { + evas_object_move(m_pEo, x, y); + } + + inline Evas_Object* View::getContent(const char *part) const + { + return elm_object_part_content_get(m_pEo, part); + } + + inline void View::setFocusAllow(bool enable) + { + elm_object_focus_allow_set(m_pEo, enable); + } + + inline bool View::getFocusAllow() const + { + return elm_object_focus_allow_get(m_pEo); + } + + inline void View::setFocus(bool focus) + { + return elm_object_focus_set(m_pEo, focus); + } + + inline bool View::getFocus() const + { + return elm_object_focus_get(m_pEo); + } + + inline void View::setTranslatable(bool translatable, const char *domain, const char *part) + { + elm_object_domain_part_text_translatable_set(m_pEo, part, domain, translatable); + } + + inline void View::emitSignal(const char *emission, const char *source, bool async) + { + emitSignal(m_pEo, emission, source, async); + } + + inline void View::processSignal() + { + processSignal(m_pEo); + } + + inline void View::processSignals() + { + edje_message_signal_process(); + } + + inline void View::setText(const char *text, const char *part) + { + elm_object_part_text_set(m_pEo, part, text); + } + + inline void View::setText(const std::string &text, const char *part) + { + setText(text.c_str(), part); + } + + inline void View::setText(const TText &text, const char *part) + { + setText(m_pEo, text, part); + } + + inline void View::setStyle(const std::string &style) + { + elm_object_style_set(getEo(), style.c_str()); + } + + inline void View::setText(Evas_Object *obj, const TText &text, const char *part) + { + elm_object_domain_translatable_part_text_set(obj, part, text.getDomain(), text.getMsg()); + } + + inline std::string View::getText(const char *part) const + { + const char *text = getTextCStr(part); + return text ? text : ""; + } + + inline const char *View::getTextCStr(const char *part) const + { + return elm_object_part_text_get(m_pEo, part); + } + + inline void View::setData(const char *key, const void *data) + { + evas_object_data_set(m_pEo, key, data); + } + + inline void *View::getData(const char *key) const + { + return evas_object_data_get(m_pEo, key); + } + + inline void View::setData(const void *data) + { + setData(m_pEo, data); + } + + inline void *View::getData() const + { + return getData(m_pEo); + } + + template + inline T View::staticCast(void *evasObj) + { + return static_cast(getData((Evas_Object*)evasObj)); + } + + template + inline T View::reinterpretCast(void *evasObj) + { + return reinterpret_cast(getData((Evas_Object*)evasObj)); + } + + template + inline T View::dynamicCast(void *evasObj) + { + return dynamic_cast(staticCast(evasObj)); + } + + inline void View::addEventCb(Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data) + { + evas_object_event_callback_add(m_pEo, type, func, data); + } + + inline void View::addSmartCb(const char *event, Evas_Smart_Cb func, const void *data) + { + evas_object_smart_callback_add(m_pEo, event, func, data); + } + + inline void View::addSignalCb(const char *emission, const char *source, Edje_Signal_Cb func, void *data) + { + elm_object_signal_callback_add(m_pEo, emission, source, func, data); + } + + inline Evas_Object *View::unsetContent(const char *part) + { + return elm_object_part_content_unset(m_pEo, part); + } + + inline Evas_Object *View::getEdje() const + { + return elm_layout_edje_get(m_pEo); + } + + inline Evas *View::getEvas() const + { + return evas_object_evas_get(m_pEo); + } + + inline void View::setMirrored(Evas_Object *obj, bool mirrored) + { + elm_object_mirrored_automatic_set(obj, mirrored); + elm_object_mirrored_set(obj, mirrored); + } + + inline void View::setMirrored(bool mirrored) + { + setMirrored(getEo(), mirrored); + } + +} + +#endif /* View_h_ */ diff --git a/src/Common/inc/Window.h b/src/Common/inc/Window.h new file mode 100644 index 0000000..8667ad8 --- /dev/null +++ b/src/Common/inc/Window.h @@ -0,0 +1,45 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 Window_h_ +#define Window_h_ + +#include "View.h" + +namespace TaskMngr +{ + class Window + : public View + { + public: + Window(); + virtual ~Window(); + + Evas_Object *getConformEvasObject() const; + Evas_Object *getHostEvasObject() const; + void setContent(Evas_Object *content); + void getScreenSize(int *x, int *y, int *w, int *h) const; + int getRotation() const; + void lower(); + void raise(); + + private: + Evas_Object *m_pConform; + Evas_Object *m_pBg; + }; +} + +#endif /* Window_h_ */ diff --git a/src/Common/src/Logger.cpp b/src/Common/src/Logger.cpp new file mode 100644 index 0000000..4d0d316 --- /dev/null +++ b/src/Common/src/Logger.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "Logger.h" + +namespace +{ + const std::string enterFraseFormat = "%s: %s(%d) -> [ENTER]"; + const std::string leaveFraseFormat = "%s: %s -> [LEAVE]"; + const log_priority defaultPriority = DLOG_DEBUG; +} + +LoggerImpl::LoggerImpl(const char *tag, const char *file, const char *function, int line) + : m_Tag(tag) + , m_File(file) + , m_Function(function) +{ + dlog_print(defaultPriority + , m_Tag.c_str() + , enterFraseFormat.c_str() + , m_File.c_str() + , m_Function.c_str() + , line); +} + +LoggerImpl::~LoggerImpl() +{ + dlog_print(defaultPriority + , m_Tag.c_str() + , leaveFraseFormat.c_str() + , m_File.c_str() + , m_Function.c_str()); +} diff --git a/src/Common/src/PathUtils.cpp b/src/Common/src/PathUtils.cpp new file mode 100644 index 0000000..03508ed --- /dev/null +++ b/src/Common/src/PathUtils.cpp @@ -0,0 +1,125 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "PathUtils.h" +#include "Logger.h" + +#include +#include +#include + +namespace TaskMngr { +namespace PathUtils { + +std::string getResourcePath(const std::string &filePath) +{ + std::string res; + static std::string basePath; + if (basePath.empty()) + { + char *path = app_get_resource_path(); + if (path) + { + basePath = path; + free(path); + } + } + + res += basePath; + res += filePath; + + return res; +} + +std::string getDataPath(const std::string &filePath) +{ + std::string res; + static std::string basePath; + if (basePath.empty()) + { + char *path = app_get_data_path(); + if (path) + { + basePath = path; + free(path); + } + } + + res += basePath; + res += filePath; + + return res; +} + +std::string getResourcePath() +{ + std::string res; + char* resPath = app_get_resource_path(); + if (resPath) + { + res = resPath; + free(resPath); + } + + return res; +} + +std::string getLocalePath() +{ + std::string resPath(getResourcePath()); + if (!resPath.empty()) + { + resPath.append("locale"); + } + + return resPath; +} + +static bool storageCb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +{ + if (type == STORAGE_TYPE_INTERNAL) + { + int *internalStorage = (int *)userData; + *internalStorage = storageId; + return false; + } + return true; +} + +const std::string &getDownloadPath() +{ + static std::string downloadPath; + + if (!downloadPath.empty()) + return downloadPath; + + char *dirPath = nullptr; + int storageId = -1; + + int error = storage_foreach_device_supported(storageCb, &storageId); + if (error == STORAGE_ERROR_NONE) + storage_get_directory(storageId, STORAGE_DIRECTORY_DOWNLOADS, &dirPath); + + if (dirPath) + { + downloadPath = dirPath; + free(dirPath); + } + + return downloadPath; +} +} // PathUtils +} // TaskMngr diff --git a/src/Common/src/View.cpp b/src/Common/src/View.cpp new file mode 100644 index 0000000..f6b5c18 --- /dev/null +++ b/src/Common/src/View.cpp @@ -0,0 +1,197 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "View.h" +#include "Logger.h" +#include "PathUtils.h" + +#include +#include +#include + +using namespace TaskMngr; + +namespace +{ + const char *thisKey = "this"; +} + +View::View() +{ +} + +View::~View() +{ +} + +Evas_Object_Event_Cb View::getCb(Evas_Callback_Type type) +{ + static std::map cbMap = + { + {EVAS_CALLBACK_FREE, on_free_cb}, + {EVAS_CALLBACK_DEL, on_del_cb} + }; + + auto it = cbMap.find(type); + return it != cbMap.end() ? it->second : nullptr; +} + +void View::setEventCb(Evas_Callback_Type type) +{ + Evas_Object_Event_Cb cb = getCb(type); + if (cb) + { + evas_object_event_callback_add(m_pEo, type, cb, this); + } else { + LOG_ERROR("Not implemented"); + assert(false); + } +} + +void View::setEo(Evas_Object *eo) +{ + if (m_pEo) + { + LOG_ERROR("m_pEo not null"); + assert(false); + } + + BaseView::setEo(eo); + + if (eo) + { + setData(this); + setEventCb(EVAS_CALLBACK_FREE); + setEventCb(EVAS_CALLBACK_DEL); + } +} + +void View::unsetEventCb(Evas_Callback_Type type) +{ + Evas_Object_Event_Cb cb = getCb(type); + if (cb) + { + evas_object_event_callback_del(m_pEo, type, cb); + } else { + LOG_ERROR("Not implemented"); + assert(false); + } +} + +Evas_Object *View::setContent(Evas_Object *content, const char *part, bool saveOldContent) +{ + Evas_Object *oldContent = saveOldContent ? elm_object_part_content_unset(m_pEo, part) : nullptr; + elm_object_part_content_set(m_pEo, part, content); + return oldContent; +} + +void View::on_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + View *view = static_cast(data); + if (view) + view->onViewDestroyed(); +} + +void View::on_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + View *view = static_cast(data); + if (view) + view->onBeforeDelete(*view); +} + +void View::expand() +{ + expand(m_pEo); +} + +void View::expand(Evas_Object *obj) +{ + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL); +} + +void View::processSignal(Evas_Object *obj) +{ + Evas_Object *edj = elm_layout_edje_get(obj); + edje_object_message_signal_process(edj); +} + +void View::emitSignal(Evas_Object *obj, const char *emission, const char *source, bool async) +{ + elm_object_signal_emit(obj, emission, source); + if (!async) + processSignal(obj); +} + +Evas_Object *View::addLayout(Evas_Object *parent, const std::string &edjePath, const std::string &group) +{ + Evas_Object *layout = elm_layout_add(parent); + std::string edjAbsPath = PathUtils::getResourcePath(edjePath); + elm_layout_file_set(layout, edjAbsPath.c_str(), group.c_str()); + return layout; +} + +void View::setData(Evas_Object *obj, const void *data) +{ + evas_object_data_set(obj, thisKey, (void*)data); +} + +void *View::getData(Evas_Object *obj) +{ + return evas_object_data_get(obj, thisKey); +} + +std::string TaskMngr::markupToUtf8(const char *str) +{ + if (!str) + return std::string(); + + std::string res; + char *markup = elm_entry_markup_to_utf8(str); + if (markup) + { + res = markup; + free(markup); + } + + return res; +} + +std::string TaskMngr::utf8ToMarkup(const char *str) +{ + if (!str) + return std::string(); + + std::string res; + char *markup = elm_entry_utf8_to_markup(str); + if (markup) + { + res = markup; + free(markup); + } + + return res; +} + +std::string TaskMngr::markupToUtf8(const std::string &str) +{ + return markupToUtf8(str.c_str()); +} + +std::string TaskMngr::utf8ToMarkup(const std::string &str) +{ + return utf8ToMarkup(str.c_str()); +} diff --git a/src/Common/src/Window.cpp b/src/Common/src/Window.cpp new file mode 100644 index 0000000..b13c92a --- /dev/null +++ b/src/Common/src/Window.cpp @@ -0,0 +1,85 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "Config.h" +#include "Window.h" + +using namespace TaskMngr; + +Window::Window() + : m_pConform(nullptr) + , m_pBg(nullptr) +{ + // Window: + setEo(elm_win_add(nullptr, PACKAGE_NAME, ELM_WIN_BASIC)); + elm_win_conformant_set(getEo(), EINA_TRUE); + elm_win_autodel_set(getEo(), EINA_TRUE); + + // Conform: + m_pConform = elm_conformant_add(getEo()); + elm_win_indicator_mode_set(getEo(), ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(getEo(), ELM_WIN_INDICATOR_OPAQUE); + evas_object_size_hint_weight_set(m_pConform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(getEo(), m_pConform); + evas_object_show(m_pConform); + + // Bg: + m_pBg = elm_bg_add(m_pConform); + evas_object_size_hint_weight_set(m_pBg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(m_pBg); + + elm_object_part_content_set(m_pConform, "elm.swallow.bg", m_pBg); +} + +Window::~Window() +{ +} + +void Window::lower() +{ + elm_win_lower(getEo()); +} + +void Window::raise() +{ + elm_win_raise(getEo()); +} + +Evas_Object *Window::getConformEvasObject() const +{ + return m_pConform; +} + +Evas_Object *Window::getHostEvasObject() const +{ + return m_pConform; +} + +void Window::setContent(Evas_Object *content) +{ + elm_object_content_set(m_pConform, content); +} + +void Window::getScreenSize(int *x, int *y, int *w, int *h) const +{ + elm_win_screen_size_get(getEo(), x, y, w, h); +} + +int Window::getRotation() const +{ + return elm_win_rotation_get(getEo()); +} + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..da2c9b2 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,25 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "App.h" +#include "Logger.h" + +EXPORT_API int main(int argc, char *argv[]) +{ + TRACE; + return TaskMngr::App::getInst().start(argc, argv); +} diff --git a/tizen-manifest.xml b/tizen-manifest.xml new file mode 100644 index 0000000..7524f00 --- /dev/null +++ b/tizen-manifest.xml @@ -0,0 +1,8 @@ + + + + + taskmanager.png + + + -- 2.7.4