#include "ivug-debug.h"
#include "ivug-string.h"
#include "ivug-context.h"
+#include "ivug-db.h"
+
+#include "ivug-setas-view.h"
#undef LOG_LVL
#define LOG_LVL DBG_MSG_LVL_MED
evas_object_smart_callback_del(obj, "ok,clicked", _ivug_crop_view_ok_clicked_cb);
+ media_handle m_handle = NULL;
+
+ m_handle = ivug_db_insert_file_to_DB(path);
+ if(m_handle == NULL)
+ {
+ MSG_ERROR("ivug_db_insert_file_to_DB failed %s", path);
+ }
+ else
+ {
+ ivug_db_destroy_file_handle(m_handle);
+ }
+
_send_result(gGetUGHandle(), "crop_image_path", path, NULL, NULL);
MSG_HIGH("Start destroy ug");
ug_destroy_me(gGetUGHandle());
}
+static void _ivug_setas_crop_view_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *path = (char *)event_info;
+
+ MSG_MAIN_HIGH("_ivug_setas_view_ok_clicked_cb path = %s", path);
+
+ evas_object_smart_callback_del(obj, "ok,clicked", _ivug_setas_crop_view_ok_clicked_cb);
+
+ // do not insert to db
+
+ int setas_data = (int)evas_object_data_get(obj, "setas_type");
+ ivug_set_screen_type type = (ivug_set_screen_type)setas_data;
+
+ int setas_mode = (int)evas_object_data_get(obj, "setas_mode");
+ ivug_setas_mode mode = (ivug_setas_mode)setas_mode;
+
+ const char* homescreen_path = IVUG_HOME_SCREEN_PATH;
+ const char* lockscreen_path = IVUG_LOCK_SCREEN_PATH;
+ const char* appsvc_home_path = IVUG_APPSVC_HOME_SCREEN_PATH;
+
+ if(mode == IVUG_SETAS_CROP)
+ {
+ ivug_copy_file(path, appsvc_home_path);
+ _send_result(gGetUGHandle(), "crop_image_path", appsvc_home_path, NULL, NULL);
+ }
+ else
+ {
+ if(type == IVUG_CTRLBAR_SET_SCREEN_HOME)
+ {
+ ivug_copy_file(path, homescreen_path);
+ ivug_config_set_homescreen_image(homescreen_path);
+ _send_result(gGetUGHandle(), "homescreen_path", homescreen_path, NULL, NULL);
+ }
+ else if(type == IVUG_CTRLBAR_SET_SCREEN_LOCK)
+ {
+ ivug_copy_file(path, lockscreen_path);
+ ivug_config_set_lockscreen_image(lockscreen_path);
+ _send_result(gGetUGHandle(), "lockscreen_path", lockscreen_path, NULL, NULL);
+ }
+ else if(type == IVUG_CTRLBAR_SET_SCREEN_BOTH)
+ {
+ ivug_copy_file(path, homescreen_path);
+ ivug_config_set_homescreen_image(homescreen_path);
+ ivug_copy_file(path, lockscreen_path);
+ ivug_config_set_lockscreen_image(lockscreen_path);
+ _send_result(gGetUGHandle(), "homescreen_path", homescreen_path, "lockscreen_path", lockscreen_path);
+ }
+ }
+
+ MSG_HIGH("Start destroy ug");
+ ug_destroy_me(gGetUGHandle());
+}
+
+
static void _ivug_crop_view_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
//ivug_crop_ug_destroy((IvugCropUG *)data);
{
IvugCropUG *crop_ug = (IvugCropUG *)data;
+ ivug_crop_view_destroy(crop_ug->crop_view);
+
crop_ug->crop_view = NULL;
}
ivug_crop_view_create_menu(crop_view, crop_ug->navi_bar);
+ Evas_Object *conformant = (Evas_Object *)ug_get_conformant();
+ elm_object_signal_emit(conformant, "elm,state,indicator,nooverlap", "");
+
+ return crop_ug;
+}
+
+IvugCropUG * ivug_setas_crop_ug_create(Evas_Object *parent, const char *filepath, ivug_setas_mode mode, ivug_set_screen_type type)
+{
+ IvugCropUG *crop_ug = (IvugCropUG *)calloc(1, sizeof(IvugCropUG));
+ if(crop_ug == NULL)
+ {
+ MSG_ERROR("crop_ug calloc error");
+ return NULL;
+ }
+
+ IvugCropView *crop_view = NULL;
+ Evas_Object *layout = NULL;
+
+ crop_view = ivug_crop_view_create(parent);
+ if(crop_view == NULL)
+ {
+ MSG_ERROR("ivug_crop_view_create error");
+ free(crop_ug);
+ return NULL;
+ }
+
+ layout = ivug_crop_view_get_object(crop_view);
+
+ evas_object_smart_callback_add(layout, "ok,clicked", _ivug_setas_crop_view_ok_clicked_cb, crop_ug);
+ evas_object_smart_callback_add(layout, "cancel,clicked", _ivug_crop_view_cancel_clicked_cb, crop_ug);
+ evas_object_smart_callback_add(layout, "destroyed", _ivug_crop_view_destroyed_cb, crop_ug);
+ evas_object_smart_callback_add(layout, "download,failed", _on_msg_load_failed, crop_ug);
+ //evas_object_smart_callback_add(layout, "clicked", _ivug_crop_view_clicked_cb, crop_ug);
+
+ evas_object_data_set(layout, "setas_type", (void *)type);
+ evas_object_data_set(layout, "setas_mode", (void *)mode);
+
+ crop_ug->crop_view = crop_view;
+ crop_ug->layout = layout;
+ crop_ug->parent = parent;
+ crop_ug->filepath = strdup(filepath);
+
+ crop_ug->navi_bar = elm_naviframe_add(parent);
+
+#ifdef USE_CUSTOM_STYLE
+ elm_object_theme_set(crop_ug->navi_bar, gGetSystemTheme() );
+#endif
+ const char *profile = elm_config_profile_get();
+ if (!strcmp(profile,"mobile"))
+ {
+ elm_object_style_set(crop_ug->navi_bar, "ivug-main/default");
+ }
+ else if (!strcmp(profile,"desktop"))
+ {
+ elm_object_style_set(crop_ug->navi_bar, "ivug-main/noindicator");
+ }
+ else
+ {
+ MSG_MAIN_ERROR("Unknown profile : %s", profile);
+ }
+
+ evas_object_name_set(crop_ug->navi_bar, "Crop ug naviframe");
+
+// Layout life cycle is controlled by application explictily.
+ elm_naviframe_content_preserve_on_pop_set(crop_ug->navi_bar, EINA_TRUE);
+
+ Evas_Object *back_btn = ivug_button_add(crop_ug->navi_bar, "naviframe/end_btn/default",
+ IDS_BACK, NULL, on_crop_view_btn_back_clicked, crop_ug);
+
+ crop_ug->navi_it = elm_naviframe_item_push(crop_ug->navi_bar, IDS_LOADING, back_btn, NULL, crop_ug->layout, NULL);
+ elm_naviframe_item_title_visible_set(crop_ug->navi_it, EINA_FALSE);
+
+ Evas_Object *conformant = (Evas_Object *)ug_get_conformant();
+ elm_object_signal_emit(conformant, "elm,state,indicator,nooverlap", "");
+
+ int lcd_x = 0;
+ int lcd_y = 0;
+ int lcd_w = 0;
+ int lcd_h = 0;
+ int rot = 0;
+
+ ivug_crop_view_create_menu(crop_view, crop_ug->navi_bar);
+
+ ivug_crop_view_destination_set(crop_view, DATA_PATH, ".iv_setas.jpg");
+
+ evas_object_geometry_get((Evas_Object *)ug_get_window(), &lcd_x, &lcd_y, &lcd_w, &lcd_h);
+ rot = gGetRotationDegree();
+ if(rot == 90 || rot == 270)
+ {
+ int temp = lcd_w;
+ lcd_w = lcd_h;
+ lcd_h = temp;
+ }
+
+ ivug_crop_view_box_size_set(crop_view, lcd_w, lcd_h);
+
+ ivug_crop_view_box_ratio_fix(crop_view, true);
+
return crop_ug;
}
MSG_HIGH("ivug_crop_ug_start");
IV_ASSERT(crop_ug != NULL);
+ Evas_Object *conformant = (Evas_Object *)ug_get_conformant();
+ elm_object_signal_emit(conformant, "elm,state,indicator,nooverlap", "");
+
ivug_crop_view_file_set(crop_ug->crop_view, crop_ug->filepath);
return true;