rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=505928e3f76a6ecb254ed423ffe3bc6896010510
commit 505928e3f76a6ecb254ed423ffe3bc6896010510 Author: Andrii Kroitor <an.kroi...@samsung.com> Date: Tue Apr 12 15:23:04 2016 +0300 eflete: add import edc from command line support --- src/bin/main.c | 69 ++++++++++++++++++++++++++++++++++++++++ src/bin/ui/tab_home_import_edc.c | 43 +++++++++++++++++++++++++ src/bin/ui/tabs.c | 7 ++++ src/bin/ui/tabs.h | 9 ++++++ src/bin/ui/tabs_private.h | 4 +++ 5 files changed, 132 insertions(+) diff --git a/src/bin/main.c b/src/bin/main.c index 84cc731..212b20a 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -31,6 +31,10 @@ static char *file = NULL; static char *pro_name = NULL; static char *pro_path = NULL; +static Eina_List *img_dirs = NULL; +static Eina_List *snd_dirs = NULL; +static Eina_List *fnt_dirs = NULL; +static Eina_List *data_dirs = NULL; #define _ERR_EXIT(MSG, ...) \ do { \ @@ -55,6 +59,10 @@ static const Ecore_Getopt options = { { ECORE_GETOPT_STORE_STR(0, "name", N_("Name for new project that would be created in import process")), ECORE_GETOPT_STORE_STR(0, "path", N_("Path for project")), + ECORE_GETOPT_APPEND_METAVAR('i', "id", "Add image directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), + ECORE_GETOPT_APPEND_METAVAR('s', "sd", "Add sound directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), + ECORE_GETOPT_APPEND_METAVAR('f', "fd", "Add font directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), + ECORE_GETOPT_APPEND_METAVAR('d', "dd", "Add data directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), ECORE_GETOPT_STORE_TRUE('r', "reopen", "reopen last project"), ECORE_GETOPT_VERSION ('v', "version"), ECORE_GETOPT_COPYRIGHT('c', "copyright"), @@ -121,6 +129,25 @@ _import_edj(void *data __UNUSED__) tabs_menu_tab_open(TAB_HOME_IMPORT_EDJ); } +static void +_import_edc(void *data __UNUSED__) +{ + const char *name; + Eina_Tmpstr *proj_name; + if (pro_name) + { + tabs_menu_import_edc_data_set(pro_name, pro_path, file, img_dirs, snd_dirs, fnt_dirs, data_dirs); + } + else + { + name = ecore_file_file_get(file); + proj_name = eina_tmpstr_add_length(name, strlen(name) - 4); + tabs_menu_import_edc_data_set(proj_name, pro_path, file, img_dirs, snd_dirs, fnt_dirs, data_dirs); + eina_tmpstr_del(proj_name); + } + tabs_menu_tab_open(TAB_HOME_IMPORT_EDC); +} + EAPI_MAIN int elm_main(int argc, char **argv) { @@ -132,6 +159,10 @@ elm_main(int argc, char **argv) Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(pro_name), ECORE_GETOPT_VALUE_STR(pro_path), + ECORE_GETOPT_VALUE_LIST(img_dirs), + ECORE_GETOPT_VALUE_LIST(snd_dirs), + ECORE_GETOPT_VALUE_LIST(fnt_dirs), + ECORE_GETOPT_VALUE_LIST(data_dirs), ECORE_GETOPT_VALUE_BOOL(reopen), ECORE_GETOPT_VALUE_BOOL(info_only), ECORE_GETOPT_VALUE_BOOL(info_only), @@ -175,6 +206,14 @@ elm_main(int argc, char **argv) _ERR_EXIT(_("--reopen is given but --name specified.")); if (pro_path) _ERR_EXIT(_("--repoen is given but --path specified.")); + if (img_dirs) + _ERR_EXIT(_("--reopen is given but --id specified.")); + if (snd_dirs) + _ERR_EXIT(_("--reopen is given but --sd specified.")); + if (fnt_dirs) + _ERR_EXIT(_("--reopen is given but --fd specified.")); + if (data_dirs) + _ERR_EXIT(_("--reopen is given but --dd specified.")); config = config_get(); if (!config->recents) @@ -198,15 +237,37 @@ elm_main(int argc, char **argv) _ERR_EXIT(_("*.pro file is given but --name specified.")); if (pro_path) _ERR_EXIT(_("*.pro file is given but --path specified.")); + if (img_dirs) + _ERR_EXIT(_("*.pro file is given but --id specified.")); + if (snd_dirs) + _ERR_EXIT(_("*.pro file is given but --sd specified.")); + if (fnt_dirs) + _ERR_EXIT(_("*.pro file is given but --fd specified.")); + if (data_dirs) + _ERR_EXIT(_("*.pro file is given but --dd specified.")); ecore_job_add(_open_project, NULL); goto run; } else if (eina_str_has_suffix(file, ".edj")) { + if (img_dirs) + _ERR_EXIT(_("*.edj file is given but --id specified.")); + if (snd_dirs) + _ERR_EXIT(_("*.edj file is given but --sd specified.")); + if (fnt_dirs) + _ERR_EXIT(_("*.edj file is given but --fd specified.")); + if (data_dirs) + _ERR_EXIT(_("*.edj file is given but --dd specified.")); + ecore_job_add(_import_edj, NULL); goto run; } + else if (eina_str_has_suffix(file, ".edc")) + { + ecore_job_add(_import_edc, NULL); + goto run; + } else _ERR_EXIT(_("Wrong file extension.")); } @@ -217,6 +278,14 @@ elm_main(int argc, char **argv) _ERR_EXIT(_("no file is given but --name specified.")); if (pro_path) _ERR_EXIT(_("no file is given but --path specified.")); + if (img_dirs) + _ERR_EXIT(_("no file is given but --id specified.")); + if (snd_dirs) + _ERR_EXIT(_("no file is given but --sd specified.")); + if (fnt_dirs) + _ERR_EXIT(_("no file is given but --fd specified.")); + if (data_dirs) + _ERR_EXIT(_("no file is given but --dd specified.")); } run: diff --git a/src/bin/ui/tab_home_import_edc.c b/src/bin/ui/tab_home_import_edc.c index 8b7a60f..855a29b 100644 --- a/src/bin/ui/tab_home_import_edc.c +++ b/src/bin/ui/tab_home_import_edc.c @@ -571,3 +571,46 @@ _tab_import_edc_add(void) return tab_edc.layout; } + +void +_tab_import_edc_data_set(const char *name, const char *path, const char *edc, + const Eina_List *img, const Eina_List *snd, const Eina_List *fnt, const Eina_List *dd) +{ + Dir_Data *dir_data; + const Eina_List *l; + const char *str; + + assert(tab_edc.layout != NULL); + + elm_entry_entry_set(tab_edc.name, name); + + if (path) elm_entry_entry_set(tab_edc.path, path); + else elm_entry_entry_set(tab_edc.path, profile_get()->general.projects_folder); + + elm_entry_entry_set(tab_edc.edc, edc); + + EINA_LIST_FOREACH(img, l, str) + { + dir_data = eina_list_data_get(eina_list_last(tab_edc.img_dirs)); + elm_entry_entry_set(dir_data->entry, str); + _dir_add(&tab_edc.img_dirs, _img_dir_del); + } + EINA_LIST_FOREACH(snd, l, str) + { + dir_data = eina_list_data_get(eina_list_last(tab_edc.snd_dirs)); + elm_entry_entry_set(dir_data->entry, str); + _dir_add(&tab_edc.snd_dirs, _snd_dir_del); + } + EINA_LIST_FOREACH(fnt, l, str) + { + dir_data = eina_list_data_get(eina_list_last(tab_edc.fnt_dirs)); + elm_entry_entry_set(dir_data->entry, str); + _dir_add(&tab_edc.fnt_dirs, _fnt_dir_del); + } + EINA_LIST_FOREACH(dd, l, str) + { + dir_data = eina_list_data_get(eina_list_last(tab_edc.data_dirs)); + elm_entry_entry_set(dir_data->entry, str); + _dir_add(&tab_edc.data_dirs, _data_dir_del); + } +} diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c index 8502397..b46e303 100644 --- a/src/bin/ui/tabs.c +++ b/src/bin/ui/tabs.c @@ -1092,6 +1092,13 @@ tabs_menu_import_edj_data_set(const char *name, const char *path, const char *ed _tab_import_edj_data_set(name, path, edj); } +void +tabs_menu_import_edc_data_set(const char *name, const char *path, const char *edc, + const Eina_List *img, const Eina_List *snd, const Eina_List *fnt, const Eina_List *dd) +{ + _tab_import_edc_data_set(name, path, edc, img, snd, fnt, dd); +} + static void _tab_close(void *data, Elm_Object_Item *it __UNUSED__, diff --git a/src/bin/ui/tabs.h b/src/bin/ui/tabs.h index cef4c0b..3f3a28a 100644 --- a/src/bin/ui/tabs.h +++ b/src/bin/ui/tabs.h @@ -69,6 +69,15 @@ void tabs_menu_import_edj_data_set(const char *name, const char *path, const char *edj); /** + * Fill the import edc tab fields + * + * @ingroup Tabs + */ +void +tabs_menu_import_edc_data_set(const char *name, const char *path, const char *edc, + const Eina_List *img, const Eina_List *snd, const Eina_List *fnt, const Eina_List *dd); + +/** * Add new tab. This tab consist a workspace and a liveview. * * @param group The Group object diff --git a/src/bin/ui/tabs_private.h b/src/bin/ui/tabs_private.h index 3781aac..ccdd194 100644 --- a/src/bin/ui/tabs_private.h +++ b/src/bin/ui/tabs_private.h @@ -54,6 +54,10 @@ _tab_import_edj_add(void); void _tab_import_edj_data_set(const char *name, const char *path, const char *edj); +void +_tab_import_edc_data_set(const char *name, const char *path, const char *edc, + const Eina_List *img, const Eina_List *snd, const Eina_List *fnt, const Eina_List *dd); + Evas_Object * _tab_import_edc_add(void); --