+++ /dev/null
-/*
-* Copyright (c) 2000-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.
-*
-*/#pragma once
-
-#include <stdio.h>
-#include <stdlib.h>
-
-class CFile {
-public:
- enum {
- eSet = SEEK_SET,
- eCur = SEEK_CUR,
- eEnd = SEEK_END,
- };
-
- enum {
- eModeRead,
- eModeWrite,
- eModeRW,
- };
-
- CFile() : fp(NULL), fname(NULL), offset(0) {};
- ~CFile() {
- Close();
- };
-
- bool Open(const char *fname, int mode = eModeRead) {
- const char *szMode[] = {
- "rb", "wb", "rb+"
- };
-
- fp = fopen(fname, szMode[mode]);
-
- if ( fp == NULL )
- {
- return false;
- }
-
- fseek(fp, 0L, SEEK_END);
- fsize = ftell(fp);
-
-// Reset to head
- fseek(fp, 0L, SEEK_SET);
-
- this->fname = strdup(fname);
- return true;
- };
-
- bool Close() {
- if ( fp )
- fclose(fp);
- fp = NULL;
-
- if ( fname)
- free(fname);
- fname = NULL;
-
- return true;
- };
-
- int GetChar() const {
- if ( fp == NULL)
- {
- return EOF;
- }
-
- return fgetc(fp);
- };
-
- int Seek(long offset, int whence ) {
- return fseek(fp, offset, whence);
- };
-
- long Tell() {
- return ftell(fp);
- };
-
- int Read(void *buffer, int n) {
- return fread(buffer, 1, n, fp);
- };
-
- int SetBookmark(long offset) {
-
- return -1;
- };
-
- int GetBookmark(int bookmark)
- {
- return -1;
- };
-
- int Write(void *buffer, int n) {
- return fwrite(buffer, n, 1, fp);
- };
-
- bool IsLoaded() {
- return fp == NULL ? false : true;
- };
-
- size_t GetSize() {
- if ( fp == NULL )
- {
- return 0;
- }
-
- return fsize;
- };
-
- const char *GetFilename() {
- return fname;
- }
-
-private:
- FILE *fp;
-
- char *fname;
-
- int offset;
-
- size_t fsize; // File size
-
-};
+++ /dev/null
-/*
-* Copyright (c) 2000-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.
-*
-*/
-#pragma once
-
-#include "global.h"
-
-#include <string>
-#include <list>
-
-#define TIFF_TAG_IMAGEWIDTH (0x0100)
-#define TIFF_TAG_IMAGELENGTH (0x0101)
-#define TIFF_TAG_IMAGDESCRIPTION (0x010E)
-#define TIFF_TAG_ORIENTATION (0x0112)
-#define TIFF_TAG_MAKE (0x010F)
-
-#define TIFF_TAG_MODEL (0x0110)
-#define TIFF_TAG_SOFTWARE (0x0131)
-
-#define TAG_EXIF_IFD (0x8769)
-#define TAG_GPS_IFD (0x8825)
-#define TAG_INTEROPERABILITY_IFD (0xA005)
-
-/*
- Table 4 in specification
-*/
-#define EXIF_IFD_TAG_VERSION (0x9000)
-#define EXIF_IFD_TAG_FLASHPIXVER (0xA000)
-#define EXIF_IFD_TAG_COLORSPACE (0xA001)
-#define EXIF_IFD_TAG_COMPONENT_CONFIG (0x9101)
-#define EXIF_IFD_TAG_COMPRESSED_BPP (0x9102)
-#define EXIF_IFD_TAG_PIXEL_XDIM (0xA002)
-#define EXIF_IFD_TAG_PIXEL_YDIM (0xA003)
-#define EXIF_IFD_TAG_MAKER_NOTE (0x927C)
-#define EXIF_IFD_TAG_USER_COMMENT (0x9286)
-#define EXIF_IFD_TAG_RELATED_SOUND_FILE (0xA004)
-#define EXIF_IFD_TAG_DATATIME_ORIGINAL (0x9003)
-#define EXIF_IFD_TAG_DATATIME_DIGITIZED (0x9004)
-#define EXIF_IFD_TAG_SUBSECTIME (0x9290)
-#define EXIF_IFD_TAG_SUBSECTIME_ORIGNAL (0x9291)
-#define EXIF_IFD_TAG_SUBSECTIME_DIGITIZED (0x9292)
-#define EXIF_IFD_TAG_UNIQUE_IMAGE_ID (0xA420)
-
-/*
- Table 5 in specification
-*/
-#define EXIF_IFD_TAG_EXPOSURE_TIME (0x829A)
-#define EXIF_IFD_TAG_FNUMBER (0x829D)
-
-namespace iv {
-
-class CExif {
- const char *GetTagName(int tag);
-
- class CExifTag
- {
- public:
- CExifTag(short tag, short type, int count, int voffset)
- {
- m_tag = tag;
- m_type = type;
- m_count = count;
- m_voffset = voffset;
- }
-
- private:
- short m_tag;
- short m_type;
- int m_count;
- int m_voffset;
- };
-
- class CIFD {
- CIFD() : count(0) {};
- ~CIFD() {};
- public:
-
- private:
- int count; // Entry count
-
- byte *data;
- int len;
- };
-
- inline int GetBytes(int T) {
- static char Tsize[] = { 1 /* Inavalid */, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 };
-
- return Tsize[T];
- };
-
-private:
- int ParseUSerComment(byte *buf, int len)
- {
- // ID(8) | Comment(Any)
- m_usercomment.assign((const char *)buf + 8, len - 8);
- return 0;
- }
-
- int Get16(byte *buffer) {
- if ( blendian == true )
- {
- return buffer[0] | (buffer[1] << 8);
- }
-
- return buffer[1] | (buffer[0] << 8);
- };
-
- int Get32(byte *buffer) {
- if ( blendian == true )
- {
- return buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
- }
-
- return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
- };
-
-/*
- | IFD DATA | Value of IFD |
- |----------------------|
- buffer len
-
- We cannot get end offset of 'Value of IFD'
-*/
- int ParseIFD(byte *buffer, int len, byte *offsetbase, int lvl);
-
-public:
- CExif() {
- verbose = false;
- };
-
- bool Parse(byte *buffer, int len, int offset);
-
- const char *GetUserComment() {
- return m_usercomment.c_str();
- };
-
-private:
- std::string m_usercomment;
-
- bool blendian; // Is little endinan?
-
- long header_offset;
- byte *header;
-
-// For inplace edit.
- bool bFoundExifIFD;
- bool bFoundUserComment;
-
- struct {
- long offset;
- int len;
- int adjust; // Adjusted length.
- } UserComment;
-
- bool verbose;
-// IDF list
- std::list<CIFD *> m_ifdlist;
-
-};
-
-};
-
+++ /dev/null
-/*
-* Copyright (c) 2000-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.
-*
-*/
-#pragma once
-
-typedef unsigned char byte;
-
-#undef LOG_CAT
-#define LOG_CAT "IV-EXIF"
-
-#undef LOG_LVL
-//#define LOG_LVL DBG_MSG_LVL_LOW | DBG_MSG_LVL_DEBUG
-#define LOG_LVL DBG_MSG_LVL_HIGH
-
-#include "ivug-debug.h"
-
-#include "File.h"
extern "C" {
#endif
-void FreeUGData(ug_data *ug);
-
bool on_create(void *priv);
void on_pause(void *priv);
Evas_Object *create_layout(Evas_Object *parent, const char *edj, const char *group);
-void _language_changed_cb(void *user_data);
-
void on_destroy(void *priv);
+++ /dev/null
-/*
-* Copyright (c) 2000-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 __IVUG_COMMENT_H__
-#define __IVUG_COMMENT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void * Handle ;
-
-Handle ivug_comment_loadfile(const char *fname);
-
-void ivug_comment_set(Handle handle, const char *comment);
-
-const char *ivug_comment_get(Handle handle);
-
-void ivug_comment_savefile(Handle handle, const char *fname);
-
-void ivug_comment_closefile(Handle handle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __IVUG_COMMENT_H__
-
#include <Elementary.h>
#include <assert.h>
-#include "statistics.h"
#include "ivug-debug.h"
#include "ivug-string.h"
#include "ivug-util.h"
Eina_List *ivug_list_load_DB_items(const Filter_struct *filter, int stp, int endp);
-Eina_List *ivug_list_load_DB_items_list(const Filter_struct *filter, Eina_List *list);
-
int ivug_list_get_item_cnt(const Filter_struct *filter);
-int ivug_list_get_burst_item_cnt(const Filter_struct *filter, const char * burst_id);
-
void ivug_list_delete_items(Eina_List *items);
int ivug_list_get_dir_cnt(const char *basedir);
Eina_List *ivug_list_prepend_item(Eina_List *list, const char *filepath);
Eina_List *
-ivug_list_load_burst_items(const Filter_struct *filter, const char *burst_id, int stp, int endp);
-
-Eina_List *
ivug_list_load_file_list(const Filter_struct *filter, Eina_List *list);
#ifdef __cplusplus
#define _IVUG_DEBUG_H_
#include <dlog.h>
-#include "statistics.h"
#include "debug.h"
#define IVUG_LOG_OUTPUT_DLOG
#define LVL6 (6)
#define LVL7 (7)
-#ifdef PERF_TIME
-
-// accum item handling
-#define PERF_CHECK_BEGIN(lvl, name) iv_ta_accum_item_begin(lvl, name,false,__FILE__,__LINE__)
-#define PERF_CHECK_END(lvl, name) iv_ta_accum_item_end(lvl, name,false,__FILE__,__LINE__)
-
-// Print out
-#define PERF_SHOW_RESULT(fp) iv_ta_accum_show_result_fp(fp)
-
-#else
-
-#define PERF_CHECK_BEGIN(lvl, name)
-#define PERF_CHECK_END(lvl, name)
-
-// Print out
-#define PERF_SHOW_RESULT(fp)
-
-#endif // PERF_TIME
-
enum {
IVUG_MSG_COLOR_DEFAULT = 0,
IVUG_MSG_COLOR_BLACK = 30,
#define USE_NEW_DB_API
#define USE_THUMBLIST
-//#define USE_EXT_SLIDESHOW
#define USE_VIDEOCAM
#define USE_ADD_COMMENT
+++ /dev/null
-/*
-* Copyright (c) 2000-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 __IVUG_EXIF_H__
-#define __IVUG_EXIF_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-int ivug_exif_set_rotate(const char *file, int degree);
-
-int ivug_exif_get_rotate(const char *file, int *degree);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__IVUG_EXIF_H__
-
-
extern "C" {
#endif
-#define OPERATION_NAME_CALL "http://tizen.org/appcontrol/operation/call"
-
-/*
- Launch extern module.
-*/
-bool ivug_ext_launch_videoplayer_simple(const char *filepath);
bool ivug_ext_launch_videoplayer(const char *uri, bool isLockScreen);
-#ifdef USE_EXT_SLIDESHOW
-ui_gadget_h ivug_ext_launch_select_music(ug_result_cb result_func, ug_destroy_cb destroy_func, void *data);
-#endif
-
-bool ivug_ext_launch_videoeditor(const char *uri, app_control_reply_cb callback, void *data);
-
-bool ivug_ext_launch_browser(const char *uri);
-
-bool ivug_ext_launch_facebook(const char *uri);
-
-bool ivug_ext_launch_print(const char *uri);
-
-#ifdef IV_EXTENDED_FEATURES
-app_control_h ivug_ext_launch_image_editor(const char *uri, app_control_reply_cb callback, void *data);
-
-bool ivug_ext_launch_default(const char *uri, const char *operation, const char *pkg, const char *mime, void *data);
-#endif
-
-
-/*
- Actually, each sns pkg needs different parameter. so hard-coding cannot be removed.
-*/
-#ifdef IV_EXTENDED_FEATURES
-bool ivug_ext_launch_sns(const char *pkgname, const char *uri);
-#endif
-
-#ifdef IV_EXTENDED_FEATURES
-bool ivug_ext_launch_email(const char *uri);
-#endif
-
-bool ivug_ext_launch_nfc(const char *uri, void *data);
-
-
-/*
- Below functions are not used at Now, but should be needed soon.
-*/
-bool ivug_ext_launch_picasa(const char *uri);
-
-bool ivug_ext_launch_twitter(const char *uri);
-
-/*
- Start mira cast ug.
-*/
-#ifdef IV_EXTENDED_FEATURES
-bool ivug_ext_launch_allshare_cast(const char *szMacAddr, void *pUserData);
-
-
-bool ivug_ext_launch_map(double latitude, double longitude, void *pUserData);
-
-bool ivug_ext_launch_map_direction(double d_latitude, double d_longitude, void *pUserData);
-
-bool ivug_ext_launch_share_text(const char *text);
-#endif
-bool ivug_ext_launch_slideshow(const char *path, int index);
-
#ifdef __cplusplus
}
#endif
void ivug_notification_create(const char* text);
-/*
- Button handlers for main view
-*/
-
void on_btn_slideshow_clicked(Ivug_MainView *pMainView);
Evas_Object* ivug_ctx_popup_create(Ivug_MainView *pMainView);
-bool ivug_listpopup_context_set_rotate_enable(Evas_Object *obj, bool enable);
-
-bool ivug_listpopup_context_get_rotate_enable(Evas_Object *obj);
-
void on_btn_more_clicked(void *data, Evas_Object *obj, void *event_info);
void _on_remove_main_view_ui(Ivug_MainView *pMainView);
-
-/*
- Save current contents to disk
-*/
-void _on_mainview_save(Ivug_MainView *pMainView);
-void _on_mainview_share(Ivug_MainView *pMainView);
void _on_mainview_delete(Ivug_MainView *pMainView);
-
-/*
- Edit Image or Video
-*/
-void _on_mainview_edit(Ivug_MainView *pMainView);
-void _on_play_continous_shot(Ivug_MainView *pMainView);
void _set_thumblist_mode(Ivug_MainView *pMainView, Media_Data *mdata, Image_Object *image_obj);
-/*
- Destroy detail view
-*/
-void _delete_details_view(Ivug_MainView *pMainView );
-
#ifdef __cplusplus
}
#endif
// Slide show;
SlideShow *ssHandle;
-#ifdef USE_EXT_SLIDESHOW
- char *ss_music_name;
-#endif
bool bStandAlone; //if true, it is process not ug
extern "C" {
#endif
-bool ivug_mediadata_set_tag(Media_Data *data, const char *newtag);
bool ivug_mediadata_set_favorite(Media_Data *data, bool bFavorite);
bool ivug_mediadata_get_favorite(Media_Data *data, bool *bFavorite);
bool ivug_mediadata_free(Media_Data * mdata);
void ivug_mediadata_request_thumbnail(Media_Data *mdata, mdata_callback_t callback, void *data);
-
-void ivug_mediadata_request_file(Media_Data *mdata, mdata_callback_t callback, void *data);
-void ivug_mediadata_cancel_request_file(Media_Data *mdata);
-
const char* ivug_mediadata_get_filepath(Media_Data *mdata);
const char* ivug_mediadata_get_fileurl(Media_Data *mdata);
const char* ivug_mediadata_get_thumbnailpath(Media_Data *mdata);
Media_Data *ivug_alloc_mediadata_from_media_handle(media_handle media);
-Media_Data *ivug_alloc_mediadata_from_url(const char *url);
-
/**
* Free memory used by Media_Data
* @param mdata[in]
+++ /dev/null
-/*
-* Copyright (c) 2000-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 __IVUG_MEDIAINFO_H__
-#define __IVUG_MEDIAINFO_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- Not used!!!!!. Will be removed.
-*/
-MImageType MINfo_GetMediaType(const char *fname);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __IVUG_MEDIAINFO_H__
-
Media_Data *ivug_medialist_get_data(const Media_Item *item);
-Media_Item *ivug_medialist_get_random_item(Media_List *mList);
Media_Item *ivug_medialist_get_shuffle_item(Media_List *mList, Media_Item *item);
int ivug_medialist_get_tot_count(Media_List *mList);
-
-Media_Item *ivug_medialist_find_item_by_index(Media_List *mList, int index);
Media_Item *ivug_medialist_find_item_by_filename(Media_List *mList, const char* filepath);
Media_Item *ivug_medialist_find_item_by_uuid(Media_List *mList, UUID uuid);
-Media_Item *ivug_medialist_append_item(Media_List *mList, const char *filepath);
-Media_Item *ivug_medialist_prepend_item(Media_List *mList, const char *filepath);
-
void ivug_medialist_set_update_callback(Media_List *mList);
void ivug_medialist_del_update_callback(Media_List *mList);
void ivug_media_list_free(Media_List *mList);
-Eina_List *ivug_medialist_get_burst_item_list(Media_List *mList, const char *burst_id);
-
-void ivug_medialist_del_burst_item_list(Eina_List *list);
-
/* Return filter must be freed */
Filter_struct * ivug_medialist_get_filter(Media_List *mList);
+++ /dev/null
-/*
-* Copyright (c) 2000-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 __IVUG_MOTION_H__
-#define __IVUG_MOTION_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum
-{
- IV_MOTION_TILT,
- IV_MOTION_PANNING,
- IV_MOTION_MAX
-}motion_type_e;
-
-typedef void *motion_handle_t;
-
-typedef void (*motion_callback_t) (motion_handle_t handle, int dx, int dy, void *data);
-
-motion_handle_t ivug_motion_register_sensor(motion_type_e type, motion_callback_t cb_func, void *data);
-void ivug_motion_unregister_sensor(motion_type_e type, motion_handle_t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __IVUG_MOTION_H__
-//! End of a file
#define __IVUG_NAME_VIEW_H__
#include "ivug-common.h"
-#include "ivug-vibration.h"
-//#include "ivug-widgets.h"
typedef enum {
NAME_VIEW_RESPONSE_OK,
void
ivug_name_view_destroy(Ivug_NameView *pNameView);
-Evas_Object *
-ivug_name_view_object_get(Ivug_NameView *pNameView);
-
void
ivug_name_view_set_focus(Ivug_NameView *pNameView);
Evas_Object *
ivug_name_view_get_popup(Ivug_NameView *pNameView);
-
-/*
- Default is FALSE
-*/
-void
-ivug_name_view_allow_null_set(Ivug_NameView *pNameView, Eina_Bool bNullAllowed);
-
void
ivug_name_view_show_imf(Ivug_NameView *pNameView);
#include "ivug-define.h"
#include <Elementary.h>
-//#include "ivug-medialist.h"
#include "ivug-media.h"
-#include "ivug-motion.h"
typedef void (*callback_t)(void *handle, Media_Item *mItem, void *data);
typedef void (*location_callback_t )(void *handle, int x, int y, int w, int h, void *data);
void ivug_reset_zoom(Ivug_SliderNew *slider_new);
-
-/*
- Below API will be deprecated!
-*/
-
-
-
#ifdef __cplusplus
}
#endif
+++ /dev/null
-/*
-* Copyright (c) 2000-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 __IFUG_TRANSCODER_H__
-#define __IFUG_TRANSCODER_H__
-
-/*
-gst-launch multifilesrc location="341410.jpg" caps="image/jpeg,framerate=1/1" num-buffers=10 ! jpegdec ! savsenc_mp4 ! mp4mux name=mux ! filesink location=kk.mp4 sync=false
- filesrc location="deltio.mp3" ! mp3parse ! mux.
-*/
-
-typedef struct {
- int inWidth;
- int inHeight;
-
- int inOrientation;
- int inSizeLimit;
-
- int outOutsize;
-
-} IVTransConfig;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-bool ivug_trancoder_convert_video(const char *jpg, const char *wav, const char *outfile, IVTransConfig *config);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif // __IFUG_TRANSCODER_H__
-
-
+++ /dev/null
-/*
-* Copyright (c) 2000-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 __IVUG_VIBRATION_H__
-#define __IVUG_VIBRATION_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-#define INVALID_HAPTIC_HANDLE (NULL)
-#define VIBRATION_DURATION (500) // 500 ms
-
-typedef void * vibration_h;
-
-/*
- If success, returns handle. otherwise NULL.
-*/
-vibration_h ivug_vibration_create(void);
-
-/*
- duration in ms
-*/
-bool ivug_vibration_play(vibration_h handle, int duration);
-
-bool ivug_vibration_stop(vibration_h handle);
-
-bool ivug_vibration_delete(vibration_h handle);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __IVUG_VIBRATION_H__
-
+++ /dev/null
-/*
-* Copyright (c) 2000-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.
-*
-*/
-#pragma once
-
-
-#include "global.h"
-
-#include "exif.h"
-#include <list>
-#include <string>
-#include <algorithm>
-
-using namespace std;
-
-namespace iv {
-
-class CJPEG {
- enum {
- // JPEG Marker
- M_SOF0 = 0xC0, // Start Of Frame N
- M_SOF1 = 0xC1, // N indicates which compression process
- M_SOF2 = 0xC2, // Only SOF0-SOF2 are now in common use
- M_SOF3 = 0xC3,
- M_SOF5 = 0xC5, // NB: codes C4 and CC are NOT SOF markers
- M_SOF6 = 0xC6,
- M_SOF7 = 0xC7,
- M_SOF9 = 0xC9,
- M_SOF10 = 0xCA,
- M_SOF11 = 0xCB,
- M_SOF13 = 0xCD,
- M_SOF14 = 0xCE,
- M_SOF15 = 0xCF,
-
- M_SOI = 0xD8, // Start Of Image (beginning of datastream)
- M_EOI = 0xD9, // End Of Image (end of datastream)
- M_SOS = 0xDA, // Start Of Scan (begins compressed data)
-
- M_APP0 = 0xE0, // "JFIF\x00", "JFXX\x00"
- M_APP1 = 0xE1, // "EXIF\x00\x00" or "EXIF\x00\xFF", or XMP("http://ns.adobe.com/xap/1.0/\x00")
- M_APP2 = 0xE2, // "ICC_PROFILE\x00"
- M_APP3 = 0xE3, // "META\x00\x00" or "Meta\x00\x00"
- M_APP4 = 0xE4,
- M_APP5 = 0xE5,
- M_APP6 = 0xE6,
- M_APP7 = 0xE7,
- M_APP8 = 0xE8,
- M_APP9 = 0xE9,
- M_APP10 = 0xEA,
- M_APP11 = 0xEB,
- M_APP12 = 0xEC, // Picture info, or Ducky
- M_APP13 = 0xED, // "Photoshop 3.0\x00"
- M_APP14 = 0xEE, // "Adobe\x00"
- M_APP15 = 0xEF,
-
- M_COM = 0xFE, // COMment
- M_DQT = 0xDB, // Define Quantization Table
- M_DHT = 0xC4, // Define Huffmann Table
- M_DRI = 0xDD,
- M_IPTC = 0xED, // IPTC marker
- };
-
- class CSegment {
- enum {
- eModeUnknown,
- eModeBuffer,
- eModeOffset,
- };
-
- public:
- CSegment(int type, int len, int offset, string name) : T_(type), L_(len), offset_(offset), buf(NULL), name_(name) {};
-
- CSegment(int type, byte *buffer, int len, string name) : T_(type), L_(len), offset_(0), buf(buffer), name_(name) {};
- private:
- int T_; // JPEG Marker
- int L_; // Length. only Data length not whole segment
-
- int offset_; // Data offset in file base.
-
-// TODO : Who freed buf???
- byte *buf;
-
- string name_; // Readable segment name
-
- void SetData(byte *buffer, int n) {
- L_ = n;
- buf = buffer;
- };
-
- friend class CJPEG;
- };
-public:
- CJPEG() : bModified(false), m_exif(NULL) {};
- ~CJPEG() {
- if ( file.IsLoaded() == true )
- {
- // Close previous file.
- file.Close();
- }
-
- if ( m_exif )
- {
- MSG_WARN("Remove ~CEXIF()");
- delete m_exif;
- m_exif = NULL;
- }
- };
-
-private:
- inline int readLength(const CFile &file) {
- int ta, tb;
-
- ta = file.GetChar();
- tb = file.GetChar();
-
- return (ta << 8) | tb;
- };
-
- int ReadSegment(CFile &file); // Read JPEG marker segment
- int ReadAppN(CFile &file, int marker, int len); // Read APPn segment
-
-public:
- bool ParseJPEG(const char *fname) {
- MSG_DEBUG("Parse JPEG - %s", fname);
-
- if ( file.IsLoaded() == true )
- {
- // Close previous file.
- file.Close();
- }
-
- if ( m_exif )
- {
- delete m_exif;
- m_exif = NULL;
- }
-
- if ( file.Open(fname) == true )
- {
- ReadSegment(file);
- }
-
- return true;
- };
-
- void PrintInfo() {
- MSG_DEBUG("*****************************************\n");
- for(list<CSegment>::iterator itor = m_seglist.begin(); itor != m_seglist.end(); itor++)
- {
- MSG_DEBUG("%s(0x%02X) Offset=0x%08x Length=%d\n", (*itor).name_.c_str(), (*itor).T_, (*itor).offset_ ,(*itor).L_);
- }
- MSG_DEBUG("*****************************************\n");
- };
-
- bool WriteJPEG(const char *fname);
-
-// EXIF Infomation getter/setter
-public:
- const char *GetUserComment() {
- {
- // Try to find Comment from M_COM
- return m_comment.c_str();
- }
- return NULL;
- };
- void SetUserComment(const char *comment) {
- bModified = true;
-
- list<CSegment>::iterator litor = m_seglist.begin(); // M_SOI
-
-// Find last APPn
- list<CSegment>::iterator itor;
- for (itor = m_seglist.begin(); itor != m_seglist.end(); itor++)
- {
- CSegment &seg = *itor;
-
- if ( seg.T_ == M_COM )
- {
- // Found. Modify Segment
- seg.SetData((byte *)comment, strlen(comment));
- break;
- }
-
- if ( (seg.T_ & 0xF0 ) == 0xE0 )
- {
- // If found APPn, store segment.
- litor = itor;
- }
- }
-
- if ( itor == m_seglist.end() )
- {
-// Insert M_COM after itor.
- m_seglist.insert(litor, CSegment(M_COM, (byte *)comment, strlen(comment), "COM"));
- }
-
- PrintInfo();
-
- }
-
-private:
- CFile file;
-
- bool bModified; // Is metadata changed?
-
- list<CSegment> m_seglist;
-
- string m_comment; // Comment from m_comment
-
- string m_comment_new; //
-
-// Status
- CExif *m_exif;
-
-};
-
-};
-
profile = mobile-3.0
# C Sources
-USER_SRCS = src/main/control/ivug-context.c src/common/ivug-uuid.c src/medialist/ivug-mediadata.c src/main/popup/ivug-popup.c src/slideshow/effect/ivug-fade.c src/slideshow/effect/ivug-effect.c src/medialist/ivug-filter.c src/main/view/ivug-name-view.c src/main/control/ivug-parameter.c src/common/ivug-exif.c src/slideshow/effect/ivug-anim.c src/medialist/ivug-data-list.c src/common/ivug-file-info.c src/common/ivug-message.c src/common/debug.c src/common/statistics.c src/common/ivug-util.c src/common/ivug-language-mgr.c src/common/ivug-config.c src/common/ivug-db.c src/main/control/ivug-ext-ug.c src/common/ivug-callback.c src/slideshow/effect/ivug-slide.c src/common/ivug-file-util.c src/main/decolayer/iv-button.cpp src/medialist/ivug-medialist.cpp src/main/control/ivug-crop-ug.cpp src/main/thumblist/ivug-thumblist.cpp src/main/view/ivug-main-view-menu.cpp src/main/view/ivug-photocam.cpp src/main/decolayer/ivug-decolayer.cpp src/medialist/ivug-mediainfo.cpp src/slideshow/control/ivug-slideshow.cpp src/common/ivug-dir.cpp src/ug-image-viewer.cpp src/main/slider/ivug-slider-new.cpp src/main/ivug-base.cpp src/main/view/ivug-slideshow-view.cpp src/main/view/ivug-main-view-toolbar.cpp src/main/view/ivug-main-view.cpp
+USER_SRCS = src/main/control/ivug-context.c src/common/ivug-uuid.c src/medialist/ivug-mediadata.c src/main/popup/ivug-popup.c src/slideshow/effect/ivug-fade.c src/slideshow/effect/ivug-effect.c src/medialist/ivug-filter.c src/main/view/ivug-name-view.c src/main/control/ivug-parameter.c src/slideshow/effect/ivug-anim.c src/medialist/ivug-data-list.c src/common/ivug-file-info.c src/common/ivug-message.c src/common/debug.c src/common/statistics.c src/common/ivug-util.c src/common/ivug-language-mgr.c src/common/ivug-config.c src/common/ivug-db.c src/main/control/ivug-ext-ug.c src/common/ivug-callback.c src/slideshow/effect/ivug-slide.c src/common/ivug-file-util.c src/main/decolayer/iv-button.cpp src/medialist/ivug-medialist.cpp src/main/control/ivug-crop-ug.cpp src/main/thumblist/ivug-thumblist.cpp src/main/view/ivug-main-view-menu.cpp src/main/view/ivug-photocam.cpp src/main/decolayer/ivug-decolayer.cpp src/slideshow/control/ivug-slideshow.cpp src/common/ivug-dir.cpp src/ug-image-viewer.cpp src/main/slider/ivug-slider-new.cpp src/main/ivug-base.cpp src/main/view/ivug-slideshow-view.cpp src/main/view/ivug-main-view-toolbar.cpp src/main/view/ivug-main-view.cpp
# EDC Sources
USER_EDCS =
# User Includes
## C Compiler
-USER_INC_DIRS = inc res/edje/sounds res/po shared/res src/common src/feature src/main/control src/main/decolayer src/main/popup src/main/slider src/main/thumblist src/main/view src/medialist src/slideshow/control src/slideshow/effect res/edje/icons res/edje/images
+USER_INC_DIRS = inc res/edje/sounds res/po shared/res src/common src/main/control src/main/decolayer src/main/popup src/main/slider src/main/thumblist src/main/view src/medialist src/slideshow/control src/slideshow/effect res/edje/icons res/edje/images
USER_INC_DIRS_ABS =
USER_INC_FILES =
USER_INC_FILES_ABS =
## C++ Compiler
-USER_CPP_INC_DIRS = inc res/edje/icons res/edje/images res/edje/sounds res/po shared/res src/common src/feature src/main/control src/main/decolayer src/main/popup src/main/slider src/main/thumblist src/main/view src/medialist src/slideshow/control src/slideshow/effect
+USER_CPP_INC_DIRS = inc res/edje/icons res/edje/images res/edje/sounds res/po shared/res src/common src/main/control src/main/decolayer src/main/popup src/main/slider src/main/thumblist src/main/view src/medialist src/slideshow/control src/slideshow/effect
USER_CPP_INC_DIRS_ABS =
USER_CPP_INC_FILES =
USER_CPP_INC_FILES_ABS =
common/ivug-file-info.c
common/ivug-language-mgr.c
common/ivug-util.c
- common/statistics.c
common/ivug-callback.c
common/ivug-db.c
- common/ivug-exif.c
common/ivug-file-util.c
common/ivug-message.c
common/ivug-uuid.c
- #feature/ivug-comment.cpp
- #feature/ivug-motion.cpp
- #feature/ivug-transcoder.cpp
- #feature/ivug-vibration.c
- #feature/jpeg.cpp
main/ivug-base.cpp
main/control/ivug-context.c
main/control/ivug-crop-ug.cpp
medialist/ivug-data-list.c
medialist/ivug-filter.c
medialist/ivug-mediadata.c
- medialist/ivug-mediainfo.cpp
medialist/ivug-medialist.cpp
slideshow/control/ivug-slideshow.cpp
slideshow/effect/ivug-anim.c
*
*/
-//#include "ivug-common.h"
#include "ivug-define.h"
#include "ivug-datatypes.h"
#include "ivug-uuid.h"
#include <system_settings.h>
#include <app_preference.h>
-#include "statistics.h"
#include "ivug-debug.h"
#include "ivug-config.h"
+++ /dev/null
-/*
-* Copyright (c) 2000-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.
-*
-*/
-
-
-/**
- * The Exif specification defines an Orientation Tag to indicate the orientation of the
- * camera relative to the captured scene. This can be used by the camera either to
- * indicate the orientation automatically by an orientation sensor,
- * or to allow the user to indicate the orientation manually by a menu switch,
- * without actually transforming the image data itself.
- * Here is an explanation given by TsuruZoh Tachibanaya in
- * his description of the Exif file format:
- *
- * The orientation of the camera relative to the scene, when the image was captured.
- * The relation of the '0th row' and '0th column' to visual position is shown as below.
- *
- * Value 0th Row 0th Column
- * 1 top left side
- * 2 top right side
- * 3 bottom right side
- * 4 bottom left side
- * 5 left side top
- * 6 right side top
- * 7 right side bottom
- * 8 left side bottom
- *
- * Read this table as follows (thanks to Peter Nielsen for clarifying this - see also below):
- * Entry #6 in the table says that the 0th row in the stored image is the right side of
- * the captured scene, and the 0th column in the stored image is the top side of
- * the captured scene.
- *
- * Here is another description given by Adam M. Costello:
- *
- * For convenience, here is what the letter F would look like if it were tagged correctly
- * and displayed by a program that ignores the orientation tag
- * (thus showing the stored image):
- *
- * 1 2 3 4 5 6 7 8
- *
- * 888888 888888 88 88 8888888888 88 88 8888888888
- * 88 88 88 88 88 88 88 88 88 88 88 88
- * 8888 8888 8888 8888 88 8888888888 8888888888 88
- * 88 88 88 88
- * 88 88 888888 888888
-*/
-
-#include "ivug-debug.h"
-#include "ivug-exif.h"
-#include "ivug-file-util.h"
-
-#undef LOG_LVL
-#define LOG_LVL (DBG_MSG_LVL_HIGH | DBG_MSG_LVL_DEBUG)
-
-#undef LOG_CAT
-#define LOG_CAT "IV-EXIF"
-
-#define gl_dbgE MSG_ERROR
-#define gl_dbgW MSG_WARN
-
-#define gl_dbg MSG_MED
-
-#define gl_sdbgE MSG_SEC
-
-#define GL_CHECK_VAL(expr, val) \
- do { \
- if (!expr) { \
- MSG_ERROR("[%s] Return value %d", #expr, val);\
- return (val); \
- } \
- } while (0)
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <Elementary.h>
-
-#define GL_EXIF_BUF_LEN_MAX 65536L
-#define GL_EXIF_BUF_TIME_LEN_MAX 20
-#define GL_EXIF_DEFAULT_YEAR 1900
-
-#define GL_EXIF_SOI 0xD8
-#define GL_EXIF_TAG 0xFF
-#define GL_EXIF_APP0 0xE0
-#define GL_EXIF_APP1 0xE1
-#define GL_EXIF_JFIF_00 0x00
-#define GL_EXIF_JFIF_01 0x01
-#define GL_EXIF_JFIF_02 0x02
-
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_BYTE 1
-#define GL_EXIF_IFD_DATA_FORMAT_ASCII_STRINGS 1
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_SHORT 2
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_LONG 4
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_RATIONAL 8
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_BYTE 1
-#define GL_EXIF_IFD_DATA_FORMAT_UNDEFINED 1
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_SHORT 2
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_LONG 4
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_RATIONAL 8
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_FLOAT 4
-#define GL_EXIF_IFD_DATA_FORMAT_DOUBLE_FLOAT 8
-
-#define GL_EXI_TMP_JPEG_FILE "/opt/usr/media/.gallery_tmp_write_exif.jpg"
-
-/* Write one byte, testing for EOF */
-static int __gl_exif_write_1_byte(FILE *fd, int c)
-{
- if (fputc(c, fd) < 0) {
- gl_dbgE("fputc failed!");
- return -1;
- }
-
- return 0;
-}
-
-/* Read one byte, testing for EOF */
-static int __gl_exif_read_1_byte(FILE *fd)
-{
- int c = 0;
-
- /* Return next input byte, or EOF if no more */
- c = getc(fd);
- if (c == EOF) {
- gl_dbgE("Premature EOF in JPEG file!");
- return -1;
- }
-
- return c;
-}
-
-/* Read 2 bytes, convert to unsigned int */
-/* All 2-byte quantities in JPEG markers are MSB first */
-static int __gl_exif_read_2_bytes(FILE *fd, unsigned int *len)
-{
- int c1 = 0;
- int c2 = 0;
-
- /* Return next input byte, or EOF if no more */
- c1 = getc(fd);
- if (c1 == EOF) {
- gl_dbgE("Premature EOF in JPEG file!");
- return -1;
- }
-
- /* Return next input byte, or EOF if no more */
- c2 = getc(fd);
- if (c2 == EOF) {
- gl_dbgE("Premature EOF in JPEG file!");
- return -1;
- }
-
- if (len)
- *len = (((unsigned int)c1) << 8) + ((unsigned int)c2);
-
- return 0;
-}
-
-/* Add raw exif tag and data */
-static int __gl_exif_add_header(FILE *fd, unsigned int *orientation)
-{
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(fd, -1);
- int i = 0;
- int ret = -1;
- char *time_buf = NULL;
- unsigned int offset = 0;
-
- /* raw EXIF header data */
- const unsigned char exif1[] = {
- GL_EXIF_TAG, GL_EXIF_SOI, GL_EXIF_TAG, GL_EXIF_APP1
- };
- /* Write File head, check for JPEG SOI + Exif APP1 */
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif1[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- /* SET the marker parameter length count */
- /* Length includes itself, so must be at least 2
- Following Exif data length must be at least 6; 30+36 bytes*/
- const unsigned char exif2[] = { 0x00, 0x42 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif2[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- /* Write Exif head -- "Exif" */
- const unsigned char exif3[] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 };
- for (i = 0; i < 6; i++) {
- if (__gl_exif_write_1_byte(fd, exif3[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- /* Set byte order and Tag Mark , "II(0x4949)" */
- const unsigned char exif4[] = { 0x49, 0x49, 0x2A, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif4[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 4;
-
- /* Set first IFD offset (offset to IFD0) , II-08000000 */
- const unsigned char exif5[] = { 0x08, 0x00, 0x00, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif5[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 4;
-
- /* IFD: Image File Directory */
- /* Set the number of directory entries contained in this IFD, - EEEE ;
- * 2 entry: orientation, data time */
- const unsigned char exif6[] = { 0x02, 0x00 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif6[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 2;
-
- /* Add Orientation Tag in IFD0; 0x0112 */
- const unsigned char exif7[] = { 0x12, 0x01 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif7[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 2;
-
- gl_dbg("Write: %d", *orientation);
- const unsigned char exif8[] = { 0x03, 0x00, 0x01, 0x00, 0x00, 0x00 };
- for (i = 0; i < 6; i++) {
- if (__gl_exif_write_1_byte(fd, exif8[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 6;
-
- /* Set the Orientation value */
- if (__gl_exif_write_1_byte(fd, (unsigned char)(*orientation)) < 0)
- goto GL_EXIF_FAILED;
-
- const unsigned char exif9[] = { 0x00, 0x00, 0x00 };
- for (i = 0; i < 3; i++) {
- if (__gl_exif_write_1_byte(fd, exif9[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 4;
-
- /* Add Data Time Tag in IFD0; 0x0132 */
- const unsigned char exif10[] = { 0x32, 0x01 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif10[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 2;
-
- /* Type: strings */
- const unsigned char exif11[] = { 0x02, 0x00 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif11[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 2;
-
- /* Data lengh, byte count */
- const unsigned char exif12[] = { 0x14, 0x00, 0x00, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif12[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- offset += 8;
-
- /* 20 bytes larger than 4 bytes,
- * so next 4 bytes is data offset start from "II"(0x4949)*/
-
- gl_dbg("offset: %2X", offset + 8);
- /* Too add data offset, plus 4 bytes self and plus 4 bytes IFD terminator */
- if (__gl_exif_write_1_byte(fd, (unsigned char)(offset + 4)) < 0)
- goto GL_EXIF_FAILED;
-
- const unsigned char exif13[] = { 0x00, 0x00, 0x00 };
- for (i = 0; i < 3; i++) {
- if (__gl_exif_write_1_byte(fd, exif13[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- /*After last directory entry, there is a 4bytes of data('LLLLLLLL' at the chart),
- * it means an offset to next IFD. If its value is '0x00000000',
- * it means this is the last IFD and there is no linked IFD */
- const unsigned char exif14[] = { 0x00, 0x00, 0x00, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif14[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- /* Date Time of image was last modified.
- * Data format is "YYYY:MM:DD HH:MM:SS"+0x00, total 20bytes
- */
- time_t t;
- struct tm tms;
- struct tm *tm;
-
- t = time (NULL);
- tm = localtime_r(&t, &tms);
- if (tm == NULL) {
- goto GL_EXIF_FAILED;
- }
-
- time_buf = (char *)calloc(1, GL_EXIF_BUF_TIME_LEN_MAX);
- if (time_buf == NULL) {
- gl_dbgE("Faild to allocate memory!");
- goto GL_EXIF_FAILED;
- }
- snprintf(time_buf, GL_EXIF_BUF_TIME_LEN_MAX,
- "%04i:%02i:%02i %02i:%02i:%02i",
- tm->tm_year + GL_EXIF_DEFAULT_YEAR, tm->tm_mon + 1,
- tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
-
- gl_dbg("time_buf: %s", time_buf);
- if (fwrite(time_buf, 1, GL_EXIF_BUF_TIME_LEN_MAX, fd) != GL_EXIF_BUF_TIME_LEN_MAX) {
- gl_dbgW("Write size are diff!");
- goto GL_EXIF_FAILED;
- }
-
- ret = 0;
-
- GL_EXIF_FAILED:
-
- gl_dbg("All done");
- if (time_buf)
- free(time_buf);
- return ret;
-}
-
-/* Add exif to jfif , don't have exif */
-static int __gl_exif_add_exif_to_jfif (const char *file_path, unsigned int *orientation)
-{
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(file_path, -1);
- unsigned char tmp[GL_EXIF_BUF_LEN_MAX] = { 0, };
- FILE *fd = NULL;
- int ret = -1;
-
- if ((fd = fopen(file_path, "rb+")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
-
- char *tmp_file = GL_EXI_TMP_JPEG_FILE;
- FILE *tmp_fd = NULL;
- if ((tmp_fd = fopen(tmp_file, "wb+")) == NULL) {
- gl_dbgE("Can't open %s!", tmp_file);
- goto GL_EXIF_FAILED;
- }
-
- /* Add raw EXIF header data */
- if (__gl_exif_add_header(tmp_fd, orientation) < 0)
- goto GL_EXIF_FAILED;
-
- size_t r_size = 0;
- /* Remove start of JPEG image data section, 20 bytes */
- r_size = fread(tmp, sizeof(char), 20, fd);
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write JPEG image data to tmp file after EXIF header */
- while ((r_size = fread(tmp, 1, sizeof(tmp), fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, tmp_fd) != r_size)
- gl_dbgW("Write and read size are diff!");
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
-
- fclose(fd);
- fd = fopen(file_path, "wb");
- if (!fd) {
- gl_sdbgE("Error creating file %s!", file_path);
- goto GL_EXIF_FAILED;
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write back tmp file after to JPEG image */
- if (fseek(tmp_fd, 0, SEEK_SET) != 0) {
- gl_dbgE("Can't seek the file.");
- goto GL_EXIF_FAILED;
- }
- while ((r_size = fread(tmp, 1, sizeof(tmp), tmp_fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, fd) != r_size)
- gl_dbgW("Write and read size are diff!");
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
-
- ret = 0;
-
- GL_EXIF_FAILED:
-
- if (fd)
- fclose(fd);
- if (tmp_fd)
- fclose(tmp_fd);
-
- /* Delete tmp file */
- if (!ivug_file_unlink(tmp_file))
- gl_dbgE("Delete file failed");
-
- gl_dbg("All done");
- return ret;
- }
-
-/* Add orientation tag to jpegs which have exif tag but do not have orientation tag: include jfif and exif*/
-static int __gl_exif_add_orientation_tag(const char *file_path,
- unsigned int *orientation) {
-
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(file_path, -1);
- unsigned char tmp[GL_EXIF_BUF_LEN_MAX] = { 0, };
- FILE *fd = NULL;
- int ret = -1;
- int tmp_exif = -1;
- int i = 0;
- unsigned int length = 0;
- bool is_motorola = false; /* Flag for byte order */
- unsigned int offset = 0;
- size_t r_size = 0;
- const unsigned char ifd_data_format[13] = {
- /*add 0 to ifd_data_format[0] ,for easy to use*/
- 0,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_BYTE,
- GL_EXIF_IFD_DATA_FORMAT_ASCII_STRINGS,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_SHORT,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_LONG,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_RATIONAL,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_BYTE,
- GL_EXIF_IFD_DATA_FORMAT_UNDEFINED,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_SHORT,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_LONG,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_RATIONAL,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_FLOAT,
- GL_EXIF_IFD_DATA_FORMAT_DOUBLE_FLOAT
-
- };
-
- if ((fd = fopen(file_path, "rb+")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
-
- char *tmp_file = GL_EXI_TMP_JPEG_FILE;
- FILE *tmp_fd = NULL;
- if ((tmp_fd = fopen(tmp_file, "wb+")) == NULL) {
- gl_dbgE("Can't open %s!", tmp_file);
- goto GL_EXIF_FAILED;
- }
- /* Find APP1 */
- bool b_tag_ff = false;
- while (1) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- /*copy data from jpeg to tmp_fd (from "FF D8" to " FF E1",because those data we needn't modify)*/
- if (__gl_exif_write_1_byte(tmp_fd, tmp_exif) < 0)
- goto GL_EXIF_FAILED;
-
- tmp[0] = (unsigned char)tmp_exif;
-
- gl_dbg("- %02X", tmp[0]);
- if (!b_tag_ff) {
- /* Get first tag */
- if (tmp[0] == GL_EXIF_TAG) {
- gl_dbgW("0xFF!");
- b_tag_ff = true;
- }
- continue;
- }
-
- /* Get APP1 */
- if (tmp[0] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- break;
- } else {
- gl_dbgW("0x%02X!",tmp[0]);
- b_tag_ff = false;
- }
- }
-
- /* Get the marker parameter length count */
- if (__gl_exif_read_2_bytes(fd, &length) < 0)
- goto GL_EXIF_FAILED;
- gl_dbg("length: %d", length);
- /* Length includes itself, so must be at least 2
- Following Exif data length must be at least 6 */
- if (length < 8) {
- gl_dbgE("length < 8");
- goto GL_EXIF_FAILED;
- }
- /*modify the marker parameter length, orientation tag is 12*/
- length += 12;
- gl_dbgW("modified length: %d", length);
- tmp[0] =(length >> 8)& 0xff ;
- tmp[1] = length & 0xff ;
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 6; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- if (tmp[0] == 0x45 && tmp[1] == 0x78 && tmp[2] == 0x69 && tmp[3] == 0x66 &&
- tmp[4] == 0x00 && tmp[5] == 0x00) {
- gl_dbgW("Met Exif!");
- } else {
- gl_dbgW("Not met Exif!");
- goto GL_EXIF_FAILED;
- }
- /* Read Exif body */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
- tmp[i] = (unsigned char)tmp_exif;
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- /* Check byte order and Tag Mark , "II(0x4949)" or "MM(0x4d4d)" */
- if (tmp[0] == 0x49 && tmp[1] == 0x49 && tmp[2] == 0x2A &&
- tmp[3] == 0x00) {
- gl_dbg("Intel");
- is_motorola = false;
- } else if (tmp[0] == 0x4D && tmp[1] == 0x4D && tmp[2] == 0x00 &&
- tmp[3] == 0x2A) {
- gl_dbg("Motorola");
- is_motorola = true;
- } else {
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0)
- goto GL_EXIF_FAILED;
- }
-
- /* Get first IFD offset (offset to IFD0) , MM-08000000, II-00000008 */
- if (is_motorola) {
- if (tmp[0] != 0 && tmp[1] != 0)
- goto GL_EXIF_FAILED;
- offset = tmp[2];
- offset <<= 8;
- offset += tmp[3];
- } else {
- if (tmp[3] != 0 && tmp[2] != 0)
- goto GL_EXIF_FAILED;
- offset = tmp[1];
- offset <<= 8;
- offset += tmp[0];
- }
- gl_dbg("offset: %d", offset);
- /*if offset >8, copy data from there to IFD start position*/
- if (offset > 8) {
- unsigned int i;
- for (i = 0; i < (offset - 8); i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0)
- goto GL_EXIF_FAILED;
- }
- }
-
- /* IFD: Image File Directory */
- /* Get the number of directory entries contained in this IFD, - 2 bytes, EE */
- unsigned int tags_cnt = 0;
- for (i = 0; i < 2; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- if (is_motorola) {
- tags_cnt = tmp[0];
- tags_cnt <<= 8;
- tags_cnt += tmp[1];
- } else {
- tags_cnt = tmp[1];
- tags_cnt <<= 8;
- tags_cnt += tmp[0];
- }
- gl_dbg("tags_cnt: %d", tags_cnt);
- /*modify tags num,add orientation tag */
- tags_cnt += 1;
- gl_dbg("modified tags_cnt: %d", tags_cnt);
- if (is_motorola) {
- tmp[0] = (tags_cnt >> 8) & 0xff;
- tmp[1] = tags_cnt & 0xff;
- } else {
- tmp[0] = tags_cnt & 0xff;
- tmp[1] = (tags_cnt >> 8) & 0xff;
- }
- for (i = 0; i < 2; i++) {
- gl_dbg("modified- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0)
- goto GL_EXIF_FAILED;
-
- }
- /* Add Orientation Tag in IFD0 */
- unsigned int tag_num = 0;
- unsigned char orientation_tag[12] = { 0, };
- bool b_found_position = false;
- int j = 0;
- unsigned int data_type = 0;
- unsigned int unit_num = 0;
- unsigned int data_length = 0;
- unsigned int offset_value = 0;
- /*initialize orientation_tag value*/
- if (is_motorola) {
- orientation_tag[0] = 0x01;
- orientation_tag[1] = 0x12;
-
- orientation_tag[2] = 0x00;
- orientation_tag[3] = 0x03;
-
- orientation_tag[4] = 0x00;
- orientation_tag[5] = 0x00;
- orientation_tag[6] = 0x00;
- orientation_tag[7] = 0x01;
-
- orientation_tag[8] = 0x00;
- orientation_tag[9] = (unsigned char)(*orientation);
- orientation_tag[10] = 0x00;
- orientation_tag[11] = 0x00;
-
- } else {
- orientation_tag[0] = 0x12;
- orientation_tag[1] = 0x01;
- orientation_tag[2] = 0x03;
- orientation_tag[3] = 0x00;
- orientation_tag[4] = 0x01;
- orientation_tag[5] = 0x00;
- orientation_tag[6] = 0x00;
- orientation_tag[7] = 0x00;
- orientation_tag[8] = (unsigned char)(*orientation);
- orientation_tag[9] = 0x00;
- orientation_tag[10] = 0x00;
- orientation_tag[11] = 0x00;
- }
- /*if there is no other tag, then only insert orientation_tag,don't go to the while (1)*/
- if (tags_cnt == 1) {
- for (j = 0; j < 12 ;j++) {
- gl_dbg("orientation_tag- %02X", orientation_tag[j]);
- if (__gl_exif_write_1_byte(tmp_fd, orientation_tag[j]) < 0)
- goto GL_EXIF_FAILED;
- }
- }
- while (1) {
- if (--tags_cnt == 0) {
- break;
- }
-
- /* Every directory entry size is 12 */
- for (i = 0; i < 12; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- /* Get Tag number */
- if (is_motorola) {
- tag_num = tmp[0];
- tag_num <<= 8;
- tag_num += tmp[1];
- } else {
- tag_num = tmp[1];
- tag_num <<= 8;
- tag_num += tmp[0];
- }
- gl_dbgW("tag num %02X!" , tag_num);
- /* to find Orientation Tag position */
- if (tag_num < 0x0112) {
-
- } else if (tag_num > 0x0112) {
- if (!b_found_position) {
- for (j = 0; j < 12 ;j++) {
- gl_dbg("orientation_tag- %02X", orientation_tag[j]);
- if (__gl_exif_write_1_byte(tmp_fd, orientation_tag[j]) < 0)
- goto GL_EXIF_FAILED;
- }
- b_found_position = true;
- }
- if (is_motorola) {
- data_type = tmp[2];
- data_type <<= 8;
- data_type += tmp[3];
-
- unit_num = tmp[4];
- unit_num <<= 8;
- unit_num += tmp[5];
- unit_num <<= 8;
- unit_num += tmp[6];
- unit_num <<= 8;
- unit_num += tmp[7];
- } else {
- data_type = tmp[3];
- data_type <<= 8;
- data_type += tmp[2];
-
- unit_num = tmp[7];
- unit_num <<= 8;
- unit_num += tmp[6];
- unit_num <<= 8;
- unit_num += tmp[5];
- unit_num <<= 8;
- unit_num += tmp[4];
- }
- gl_dbgW("data_type %02X!" , data_type);
- gl_dbgW("unit_num %02X!" , unit_num);
- if ((data_type < 1) ||(data_type > 12)) {
- gl_dbgE("Wrong data type!");
- goto GL_EXIF_FAILED;
- }
-
- data_length = ifd_data_format[data_type] * unit_num;
- gl_dbgW("data_length %02X!" , data_length);
- /*data_length >4 ,next 4 bytes store the offset, so need to modify the offset*/
- if (data_length > 4) {
- if (is_motorola) {
- offset_value = tmp[8];
- offset_value <<= 8;
- offset_value += tmp[9];
- offset_value <<= 8;
- offset_value += tmp[10];
- offset_value <<= 8;
- offset_value += tmp[11];
- gl_dbgW("offset_value %02X!" , offset_value);
- /*add orientation offset*/
- offset_value += 12;
- gl_dbgW("changed offset_value %02X!" , offset_value);
- tmp[8] = (offset_value >> 24) & 0xff;
- tmp[9] = (offset_value >> 16) & 0xff;
- tmp[10] = (offset_value >> 8) & 0xff;
- tmp[11] = offset_value & 0xff;
- gl_dbg("tmp[8] %02X!" , tmp[8]);
- gl_dbg("tmp[9] %02X!" , tmp[9]);
- gl_dbg("tmp[10] %02X!" , tmp[10]);
- gl_dbg("tmp[11] %02X!" , tmp[11]);
- } else {
- offset_value = tmp[11];
- offset_value <<= 8;
- offset_value += tmp[10];
- offset_value <<= 8;
- offset_value += tmp[9];
- offset_value <<= 8;
- offset_value += tmp[8];
- gl_dbgW("offset_value %02X!" , offset_value);
- /*add orientation offset*/
- offset_value += 12;
- gl_dbgW("changed offset_value %02X!" , offset_value);
-
- tmp[11] = (offset_value >> 24) & 0xff;
- tmp[10] = (offset_value >> 16) & 0xff;
- tmp[9] = (offset_value >> 8) & 0xff;
- tmp[8] = offset_value & 0xff;
- gl_dbg("tmp[8] %02X!" , tmp[8]);
- gl_dbg("tmp[9] %02X!" , tmp[9]);
- gl_dbg("tmp[10] %02X!" , tmp[10]);
- gl_dbg("tmp[11] %02X!" , tmp[11]);
-
- }
-
- }
-
- }
- for (i = 0; i < 12 ;i++) {
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd,tmp[i]) < 0)
- goto GL_EXIF_FAILED;
-
- }
- memset(tmp, 0x00, 12);
-
- }
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write JPEG image data to tmp file after EXIF header */
- while ((r_size = fread(tmp, 1, sizeof(tmp), fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, tmp_fd) != r_size)
- gl_dbgW("Write and read size are diff!");
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
- fclose(fd);
- fd = NULL;
- fd = fopen(file_path, "wb");
- if (!fd) {
- gl_sdbgE("Error creating file %s!", file_path);
- goto GL_EXIF_FAILED;
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write back tmp file after to JPEG image */
- if (fseek(tmp_fd, 0, SEEK_SET) != 0) {
- gl_dbgE("Cannot seek the file");
- goto GL_EXIF_FAILED;
- }
- while ((r_size = fread(tmp, 1, sizeof(tmp), tmp_fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, fd) != r_size)
- gl_dbgW("Write and read size are diff!");
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
-
- ret = 0;
-
- GL_EXIF_FAILED:
-
- if (fd) {
- fclose(fd);
- fd = NULL;
- }
-
- if (tmp_fd) {
- fclose(tmp_fd);
- tmp_fd = NULL;
- }
-
- /* Delete tmp file */
- if (!ivug_file_unlink(tmp_file))
- gl_dbgE("Delete file failed");
-
- gl_dbg("All done");
- return ret;
-}
-
-static int __gl_exif_rw_jfif (FILE *fd, const char *file_path,
- unsigned int *orientation, bool b_write)
-{
- GL_CHECK_VAL(fd, -1);
- GL_CHECK_VAL(file_path, -1);
- GL_CHECK_VAL(orientation, -1);
- unsigned char tmp[GL_EXIF_BUF_LEN_MAX] = { 0, };
- int i = 0;
- unsigned int length = 0;
- int tmp_exif = -1;
- bool is_motorola = false; /* Flag for byte order */
- unsigned int offset = 0;
- int ret = -1;
- /*unsigned char version = 0x00; */
-
- if (__gl_exif_read_2_bytes(fd, &length) < 0)
- goto GL_EXIF_FAILED;
- gl_dbg("length: %d", length);
-
- for (i = 0; i < 5; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
- tmp[i] = (unsigned char)tmp_exif;
- }
-
- /* JFIF0 */
- if (tmp[0] != 0x4A || tmp[1] != 0x46 || tmp[2] != 0x49 ||
- tmp[3] != 0x46 || tmp[4] != 0x00) {
- gl_dbgE("Not met Jfif!");
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 2; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
- tmp[i] = (unsigned char)tmp_exif;
- }
-
- /* Check JFIF version */
- if (tmp[0] == 0x01 && tmp[1] == GL_EXIF_JFIF_00) {
- gl_dbg("Jfif 1.00");
- } else if (tmp[0] == 0x01 && tmp[1] == GL_EXIF_JFIF_01) {
- gl_dbg("Jfif 1.01");
- } else if (tmp[0] == 0x01 && tmp[1] == GL_EXIF_JFIF_02) {
- gl_dbg("Jfif 1.02");
- } else {
- gl_dbgE("Unknow Jfif version[%d.%d]!", tmp[0], tmp[1]);
- goto GL_EXIF_FAILED;
- }
-
- /* Save version */
- /*version = tmp[1]; */
-
- /* Find APP1 */
- bool b_tag_ff = false;
- while (1) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[0] = (unsigned char)tmp_exif;
-
- gl_dbg("- %02X", tmp[0]);
- if (!b_tag_ff) {
- /* Get first tag */
- if (tmp[0] == GL_EXIF_TAG) {
- gl_dbgW("0xFF!");
- b_tag_ff = true;
- }
- continue;
- }
-
- /* Get APP1 */
- if (tmp[0] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- break;
- }
-
- gl_dbgW("No Exif in APP1!");
-
- /* Close file */
- fclose(fd);
- if (!b_write) {
- /* Normal orientation = 0degree = 1 */
- *orientation = 1;
- return 0;
- }
- return __gl_exif_add_exif_to_jfif (file_path, orientation);
- }
-
- /* Find Exif */
- while (1) {
- for (i = 0; i < 6; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- gl_dbgW("Not met Exif!");
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- }
- if (tmp[0] == 0x45 && tmp[1] == 0x78 && tmp[2] == 0x69 && tmp[3] == 0x66 &&
- tmp[4] == 0x00 && tmp[5] == 0x00) {
- gl_dbgW("Met Exif!");
- break;
- } else {
- gl_dbg("Not met Exif!");
- if (fseek(fd, -5, SEEK_CUR) < 0) {
- gl_dbgE("fseek failed!");
- goto GL_EXIF_FAILED;
- }
- continue;
- }
- }
-
- /* Read Exif body */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
- tmp[i] = (unsigned char)tmp_exif;
- }
-
- /* Check byte order and Tag Mark , "II(0x4949)" or "MM(0x4d4d)" */
- if (tmp[0] == 0x49 && tmp[1] == 0x49 && tmp[2] == 0x2A &&
- tmp[3] == 0x00) {
- gl_dbg("Intel");
- is_motorola = false;
- } else if (tmp[0] == 0x4D && tmp[1] == 0x4D && tmp[2] == 0x00 &&
- tmp[3] == 0x2A) {
- gl_dbg("Motorola");
- is_motorola = true;
- } else {
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- }
-
- /* Get first IFD offset (offset to IFD0) , MM-08000000, II-00000008 */
- if (is_motorola) {
- if (tmp[0] != 0 && tmp[1] != 0)
- goto GL_EXIF_FAILED;
- offset = tmp[2];
- offset <<= 8;
- offset += tmp[3];
- } else {
- if (tmp[3] != 0 && tmp[2] != 0)
- goto GL_EXIF_FAILED;
- offset = tmp[1];
- offset <<= 8;
- offset += tmp[0];
- }
- gl_dbg("offset: %d", offset);
-
- /* IFD: Image File Directory */
- /* Get the number of directory entries contained in this IFD, - 2 bytes, EE */
- unsigned int tags_cnt = 0;
- for (i = 0; i < 2; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- if (is_motorola) {
- tags_cnt = tmp[0];
- tags_cnt <<= 8;
- tags_cnt += tmp[1];
- } else {
- tags_cnt = tmp[1];
- tags_cnt <<= 8;
- tags_cnt += tmp[0];
- }
- gl_dbg("tags_cnt: %d", tags_cnt);
- if (tags_cnt == 0) {
- gl_dbgE("tags_cnt == 0,no found orientation tag!");
- if (b_write) {
- gl_dbgW("to add an orientation tag!");
- fclose(fd);
- fd = NULL;
- return __gl_exif_add_orientation_tag(file_path, orientation);
-
- } else{
- /* Normal orientation = 0degree = 1 */
- *orientation = 1;
- ret = 0;
- }
- goto GL_EXIF_FAILED;
- }
-
- /* Search for Orientation Tag in IFD0 */
- unsigned int tag_num = 0;
- while (1) {
- /* Every directory entry size is 12 */
- for (i = 0; i < 12; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- /* Get Tag number */
- if (is_motorola) {
- tag_num = tmp[0];
- tag_num <<= 8;
- tag_num += tmp[1];
- } else {
- tag_num = tmp[1];
- tag_num <<= 8;
- tag_num += tmp[0];
- }
- /* found Orientation Tag */
- if (tag_num == 0x0112) {
- gl_dbgW("Found orientation tag!");
- break;
- }
- if (--tags_cnt == 0) {
- gl_dbgW("tags_cnt == 0, no found orientation tag!");
- if (b_write) {
- gl_dbgW("to add an orientation tag!");
- fclose(fd);
- fd = NULL;
- return __gl_exif_add_orientation_tag(file_path, orientation);
-
- } else{
- /* Normal orientation = 0degree = 1 */
- *orientation = 1;
- ret = 0;
- }
- goto GL_EXIF_FAILED;
- }
- }
-
- /* |TT|ff|NNNN|DDDD| --- TT - 2 bytes, tag NO. ;ff - 2 bytes, data format
- NNNN - 4 bytes, entry count; DDDD - 4 bytes Data value */
- if (b_write) {
- gl_dbg("Write: %d", *orientation);
- /* Set the Orientation value */
- if (is_motorola)
- tmp[9] = (unsigned char)(*orientation);
- else
- tmp[8] = (unsigned char)(*orientation);
-
- /* Move pointer back to the entry start point */
- if (fseek(fd, -12, SEEK_CUR) < 0) {
- gl_dbgE("fseek failed!");
- goto GL_EXIF_FAILED;
- }
- fwrite(tmp, 1, 10, fd);
- } else {
- /* Get the Orientation value */
- if (is_motorola) {
- if (tmp[8] != 0) {
- gl_dbgE("tmp[8] != 0");
- goto GL_EXIF_FAILED;
- }
- *orientation = (unsigned int)tmp[9];
- } else {
- if (tmp[9] != 0) {
- gl_dbgE("tmp[9] != 0");
- goto GL_EXIF_FAILED;
- }
- *orientation = (unsigned int)tmp[8];
- }
- if (*orientation > 8) {
- gl_dbgE("*orient > 8");
- goto GL_EXIF_FAILED;
- }
- gl_dbg("Read: %d", *orientation);
- }
-
- ret = 0;
-
- GL_EXIF_FAILED:
-
- fclose(fd);
- gl_dbg("All done");
- return ret;
-}
-bool _gl_exif_check_img_type(char *file_path)
-{
- GL_CHECK_VAL(file_path, -1);
- int tmp_exif = -1;
- unsigned int i = 0;
- unsigned char exif_data[4] = { 0, };
- FILE *fd = NULL;
- bool ret = false;
-
- if ((fd = fopen(file_path, "rb")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
-
-
- /* Read File head, check for JPEG SOI + Exif APP1 */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- if (exif_data[0] == GL_EXIF_TAG && exif_data[1] == GL_EXIF_SOI) {
- gl_dbg("JPEG file");
- } else {
- gl_dbgE("Not a JPEG file!");
- goto GL_EXIF_FAILED;
- }
-
- if (exif_data[2] == GL_EXIF_TAG && exif_data[3] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- ret = true;
- } else if (exif_data[2] == GL_EXIF_TAG &&
- exif_data[3] == GL_EXIF_APP0) {
- gl_dbgW("Jfif in APP0!");
- ret = true;
- } else {
- gl_dbgE("Not a Exif in APP1 or Jiff in APP2[%d]!", exif_data[3]);
- ret = false;
- }
- GL_EXIF_FAILED:
-
- fclose(fd);
- gl_dbg("");
- return ret;
-}
-
-static int __gl_exif_rw_orient(const char *file_path, unsigned int *orient, bool b_write)
-{
- GL_CHECK_VAL(file_path, -1);
- gl_dbg("b_write: %d", b_write);
- unsigned int length = 0;
- unsigned int i = 0;
- bool is_motorola = false; /* Flag for byte order */
- unsigned int offset = 0;
- unsigned int jfif_offset = 0;
- unsigned int tags_cnt = 0;
- unsigned int tag_num = 0;
- int tmp_exif = -1;
- unsigned char exif_data[GL_EXIF_BUF_LEN_MAX] = { 0, };
- FILE *fd = NULL;
- int ret = -1;
-
- if (b_write) {
- if ((fd = fopen(file_path, "rb+")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
- } else {
- if ((fd = fopen(file_path, "rb")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
- }
-
- /* Read File head, check for JPEG SOI + Exif APP1 */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- if (exif_data[0] == GL_EXIF_TAG && exif_data[1] == GL_EXIF_SOI) {
- gl_dbg("JPEG file");
- } else {
- gl_dbgE("Not a JPEG file!");
- goto GL_EXIF_FAILED;
- }
-
- if (exif_data[2] == GL_EXIF_TAG && exif_data[3] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- } else if (exif_data[2] == GL_EXIF_TAG &&
- exif_data[3] == GL_EXIF_APP0) {
- gl_dbgW("Jfif in APP0!");
- int ret = __gl_exif_rw_jfif(fd, file_path, orient, b_write);
- return ret;
- } else {
- gl_dbgE("Not a Exif in APP1 or Jiff in APP2[%d]!", exif_data[3]);
- goto GL_EXIF_FAILED;
- }
-
- /* Get the marker parameter length count */
- if (__gl_exif_read_2_bytes(fd, &length) < 0)
- goto GL_EXIF_FAILED;
- gl_dbg("length: %d", length);
- /* Length includes itself, so must be at least 2
- Following Exif data length must be at least 6 */
- if (length < 8) {
- gl_dbgE("length < 8");
- goto GL_EXIF_FAILED;
- }
- length -= 8;
-
- /* Length of an IFD entry */
- if (length < 12) {
- gl_dbgE("length < 12");
- goto GL_EXIF_FAILED;
- }
-
- /* Read Exif head, check for "Exif" */
- for (i = 0; i < 6; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
-
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- if (exif_data[0] != 0x45 || exif_data[1] != 0x78 ||
- exif_data[2] != 0x69 || exif_data[3] != 0x66 ||
- exif_data[4] != 0x00 || exif_data[5] != 0x00) {
- gl_dbgE("Not met Exif!");
- for (i = 0; i < 6; i++)
- gl_dbg("- %02X", exif_data[i]);
- goto GL_EXIF_FAILED;
- }
-
- /* Read Exif body */
- for (i = 0; i < length; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0)
- goto GL_EXIF_FAILED;
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- /* Check byte order and Tag Mark , "II(0x4949)" or "MM(0x4d4d)" */
- if (exif_data[0] == 0x49 && exif_data[1] == 0x49 &&
- exif_data[2] == 0x2A && exif_data[3] == 0x00) {
- gl_dbg("Intel");
- is_motorola = false;
- } else if (exif_data[0] == 0x4D && exif_data[1] == 0x4D &&
- exif_data[2] == 0x00 && exif_data[3] == 0x2A) {
- gl_dbg("Motorola");
- is_motorola = true;
- } else {
- goto GL_EXIF_FAILED;
- }
-
- /* Get first IFD offset (offset to IFD0) , MM-00000008, II-08000000 */
- if (is_motorola) {
- if (exif_data[4] != 0 && exif_data[5] != 0)
- goto GL_EXIF_FAILED;
- offset = exif_data[6];
- offset <<= 8;
- offset += exif_data[7];
- } else {
- if (exif_data[7] != 0 && exif_data[6] != 0)
- goto GL_EXIF_FAILED;
- offset = exif_data[5];
- offset <<= 8;
- offset += exif_data[4];
- }
- /* check end of data segment */
- if (offset > length - 2) {
- gl_dbgE("offset > length - 2");
- goto GL_EXIF_FAILED;
- }
-
- /* IFD: Image File Directory */
- /* Get the number of directory entries contained in this IFD, - EEEE */
- if (is_motorola) {
- tags_cnt = exif_data[offset];
- tags_cnt <<= 8;
- tags_cnt += exif_data[offset+1];
- } else {
- tags_cnt = exif_data[offset+1];
- tags_cnt <<= 8;
- tags_cnt += exif_data[offset];
- }
- if (tags_cnt == 0) {
- gl_dbgE("tags_cnt == 0 - 2");
- goto GL_EXIF_FAILED;
- }
- offset += 2;
-
- /* check end of data segment */
- if (offset > length - 12) {
- gl_dbgE("offset > length - 12");
- goto GL_EXIF_FAILED;
- }
-
- /* Search for Orientation Tag in IFD0 */
- while (1) {
- /* Get Tag number */
- if (is_motorola) {
- tag_num = exif_data[offset];
- tag_num <<= 8;
- tag_num += exif_data[offset+1];
- } else {
- tag_num = exif_data[offset+1];
- tag_num <<= 8;
- tag_num += exif_data[offset];
- }
- /* found Orientation Tag */
- if (tag_num == 0x0112) {
- gl_dbgW("Found orientation tag!");
- break;
- }
- if (--tags_cnt == 0) {
- gl_dbgW("tags_cnt == 0, no found orientation tag!");
- if (b_write) {
- gl_dbgW("to add an orientation tag!");
- fclose(fd);
- fd = NULL;
- return __gl_exif_add_orientation_tag(file_path, orient);
-
- } else{
- /* Normal orientation = 0degree = 1 */
- *orient = 1;
- ret = 0;
- }
- goto GL_EXIF_FAILED;
- }
-
- /* Every directory entry size is 12 */
- offset += 12;
- }
-
- if (b_write) {
- gl_dbg("Write: %d", *orient);
- /* Set the Orientation value */
- if (is_motorola)
- exif_data[offset+9] = (unsigned char)(*orient);
- else
- exif_data[offset+8] = (unsigned char)(*orient);
-
- if (fseek(fd, jfif_offset + (4 + 2 + 6 + 2) + offset, SEEK_SET) < 0) {
- gl_dbgE("fseek failed!");
- goto GL_EXIF_FAILED;
- }
- fwrite(exif_data + 2 + offset, 1, 10, fd);
- } else {
- /* Get the Orientation value */
- if (is_motorola) {
- if (exif_data[offset+8] != 0) {
- gl_dbgE("exif_data[offset+8] != 0");
- goto GL_EXIF_FAILED;
- }
- *orient = (unsigned int)exif_data[offset+9];
- } else {
- if (exif_data[offset+9] != 0) {
- gl_dbgE("exif_data[offset+9] != 0");
- goto GL_EXIF_FAILED;
- }
- *orient = (unsigned int)exif_data[offset+8];
- }
- if (*orient > 8) {
- gl_dbgE("*orient > 8");
- goto GL_EXIF_FAILED;
- }
- gl_dbg("Read: %d", *orient);
- }
-
- ret = 0;
-
- GL_EXIF_FAILED:
-
- fclose(fd);
- gl_dbg("All done");
- return ret;
-}
-
-
-
-/* 1 : top left
- 2 : top right
- 3 : bottom right
- 4 : bottom left
- 5 : left top
- 6 : right top
- 7 : right bottom
- 8 : left bottom */
-
-#define IVUG_EXIF_ROTATE_0 (1)
-#define IVUG_EXIF_ROTATE_90 (6)
-#define IVUG_EXIF_ROTATE_180 (3)
-#define IVUG_EXIF_ROTATE_270 (8)
-
-
-int ivug_exif_get_rotate(const char *file, int *degree)
-{
- MSG_ASSERT(file != NULL);
-
- unsigned int orientation = 0;
-
- int ret = __gl_exif_rw_orient(file, &orientation, false);
- if (-1 != ret)
- {
- switch (orientation)
- {
- case 0: // Invalid. treat as 0 degree
- *degree = 0;
- break;
- case IVUG_EXIF_ROTATE_0:
- *degree = 0;
- break;
- case IVUG_EXIF_ROTATE_90:
- *degree = 90;
- break;
- case IVUG_EXIF_ROTATE_180:
- *degree = 180;
- break;
- case IVUG_EXIF_ROTATE_270:
- *degree = 270;
- break;
- default:
- *degree = 0;
- gl_dbgE("Invalid Orientation : %d", orientation);
- break;
- }
-
- gl_dbg("Get Degree: %d' %s", *degree, file);
- return 0;
-
- }
-
- gl_dbgE("Unknown Degree: %s", file);
- return -1;
-}
-
-
-
-int ivug_exif_set_rotate(const char *file, int degree)
-{
- MSG_ASSERT(file != NULL);
-
- gl_dbg("Set Degree: %d' %s", degree, file);
-
- unsigned int orientation;
-
- switch (degree) {
- case 0:
- case 360:
- orientation = IVUG_EXIF_ROTATE_0;
- break;
- case 90:
- case -270:
- orientation = IVUG_EXIF_ROTATE_90;
- break;
- case 180:
- case -180:
- orientation = IVUG_EXIF_ROTATE_180;
- break;
- case 270:
- case -90:
- orientation = IVUG_EXIF_ROTATE_270;
- break;
- default:
- orientation = IVUG_EXIF_ROTATE_0;;
- gl_dbgE("Invalid Degree : %d", degree);
- break;
- }
-
- int ret = __gl_exif_rw_orient(file, &orientation, true);
-
- return ret;
-}
-
-
#include "ivug-util.h"
#include "ivug-file-util.h"
-//#include <libexif/exif-data.h> //for exif
#include <metadata_extractor.h>
#include <string.h>
#include <Evas.h>
#include <Ecore_Evas.h>
-#include <Ecore_File.h> // file get
+#include <Ecore_File.h>
#include <Evas.h>
#include <mime_type.h>
}
return NULL;
}
-/*sri
-static bool _get_exif_string(ExifData *ed, ExifTag tag, const char *buf, int buf_len)
-{
- ExifEntry *entry = NULL;
- //get exifentry
- entry = exif_data_get_entry(ed, tag);
- if (!entry)
- {
- return false;
- }
-
- // get value of the entry
- if (exif_entry_get_value(entry, (char *)buf, buf_len) == NULL)
- {
- return false;
- }
- return true;
-}
-
-static bool _get_exif_short(ExifData *ed, ExifTag tag, int *value)
-{
- ExifEntry *entry = NULL;
- // get exifentry/
- entry = exif_data_get_entry(ed, tag);
- if (!entry)
- {
- return false;
- }
-
- // get value of the entry
- *value = exif_get_short(entry->data, exif_data_get_byte_order(entry->parent->parent));
-
- return true;
-}
-*/
bool _get_video_gps_info(const char *filepath, double *latitude, double *longitude)
{
return true;
}
-/* LATITUDE : -90 ~ +90, LONGITUDE : -180 ~ +180) *//*
-bool _get_gps_info_from_exifdata(ExifData *ed, double *latitude, double *longitude)
-{
- IV_ASSERT(ed != NULL);
- IV_ASSERT(latitude != NULL);
- IV_ASSERT(longitude != NULL);
-
- ExifIfd ifd;
- ExifTag tag;
-
- char buf[BUF_LEN+1] = {'\0',};
-
- double multiplier = 1.0;
-
- ifd = EXIF_IFD_GPS;
- tag = EXIF_TAG_GPS_LATITUDE_REF;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
-
- if (buf[0] == 'S') // SOUTH
- {
- multiplier = -1.0;
- }
-
- tag = EXIF_TAG_GPS_LATITUDE;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
-
- {
- buf[strlen(buf)] = '\0';
- double tmp_arr[3] = { 0.0, 0.0, 0.0 };
- int count = 0;
- char* p = strtok(buf, ", ");
- // split the buf by ,
- while (p != NULL)
- {
- tmp_arr[count] = ivug_atod(p);
- count++;
- p=strtok(NULL, ", ");
- }
-
- if (count != 3)
- {
- MSG_UTIL_ERROR("Cannot get latitude info : %s", p);
- return false;
- }
- *latitude = multiplier*(tmp_arr[0] + tmp_arr[1]/60 + tmp_arr[2]/3600);
- }
-
- multiplier = 1.0;
- tag = EXIF_TAG_GPS_LONGITUDE_REF;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
-
- if (buf[0] == 'W') // WEST
- {
- multiplier = -1.0;
- }
-
- tag = EXIF_TAG_GPS_LONGITUDE;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
-
- {
- buf[strlen(buf)] = '\0';
- double tmp_arr[3] = { 0.0, 0.0, 0.0 };
- int count = 0;
- char* p = strtok(buf, ", ");
- // split the buf by ,
- while (p != NULL)
- {
- tmp_arr[count] = ivug_atod(p);
- count++;
- p=strtok(NULL, ", ");
- }
-
- if (count != 3)
- {
- MSG_UTIL_ERROR("Cannot get Longitude info : %s", p);
- return false;
- }
-
- *longitude = multiplier*(tmp_arr[0] + tmp_arr[1]/60 + tmp_arr[2]/3600);
- }
-
- return true;
-}
-
-bool _get_image_gps_info(const char* filepath, double *latitude, double *longitude)
-{
- IV_ASSERT(filepath != NULL);
- IV_ASSERT(latitude != NULL);
- IV_ASSERT(longitude != NULL);
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(filepath);
- if (!ed)
- {
- return false;
- }
-
- if (_get_gps_info_from_exifdata(ed, latitude, longitude) == false)
- {
- exif_data_unref(ed);
- return false;
- }
-
- exif_data_unref(ed);
-
- return true;
-}
-
-bool _get_orientation_from_exifdata(ExifData *ed, int *orient)
-{
- MSG_DETAIL_HIGH("_get_orientation_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_ORIENTATION;
-
- if (_get_exif_short(ed, tag, orient) == false)
- {
- return false;
- }
-
- MSG_DETAIL_HIGH("orientation = %d", *orient);
- // 1 : top left
- // 2 : top right
- // 3 : bottom right
- // 4 : bottom left
- // 5 : left top
- // 6 : right top
- // 7 : right bottom
- // 8 : left bottom
- return true;
-}
-
-// out value must be freed
-static bool _get_maker_from_exifdata(ExifData *ed, char **maker)
-{
- MSG_DETAIL_HIGH("_get_maker_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- char buf[BUF_LEN+1] = {'\0',};
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_MAKE;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
- MSG_DETAIL_HIGH("Maker = %s", buf);
-
- *maker = strdup(buf);
- return true;
-}
-
-//out value must be freed
-static bool _get_model_from_exifdata(ExifData *ed, char **model)
-{
- MSG_DETAIL_HIGH("_get_model_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- char buf[BUF_LEN+1] = {'\0',};
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_MODEL;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
- MSG_DETAIL_HIGH("Model = %s", buf);
-
- *model = strdup(buf);
- return true;
-}
-
-bool _get_flash_from_exifdata(ExifData *ed, int *status)
-{
- MSG_DETAIL_HIGH("_get_flash_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_FLASH;
-
- if (_get_exif_short(ed, tag, status) == false)
- {
- return false;
- }
-
- MSG_DETAIL_HIGH("Flash status = %d", *status);
- // LSB
- // 0b : Flash did not fire
- // 1b : Flash fired
- return true;
-}
-
-//out value must be freed
-static bool _get_focal_length_from_exifdata(ExifData *ed, char **length)
-{
- MSG_DETAIL_HIGH("_get_focal_length_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- char buf[BUF_LEN+1] = {'\0',};
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_FOCAL_LENGTH;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
- MSG_DETAIL_HIGH("Focal length = %s", buf);
-
- *length = strdup(buf);
- return true;
-}
-
-bool _get_white_balance_from_exifdata(ExifData *ed, int *white_balance)
-{
- MSG_DETAIL_HIGH("_get_white_balance_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_WHITE_BALANCE;
-
- if (_get_exif_short(ed, tag, white_balance) == false)
- {
- return false;
- }
-
- MSG_DETAIL_HIGH("White balance = %d", *white_balance);
- // 0 : auto white balance
- // 1 : menual white balance
- return true;
-}
-
-bool _get_aperture_from_exifdata(ExifData *ed, char **aperture)
-{
- MSG_DETAIL_HIGH("_get_aperture_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- char buf[BUF_LEN+1] = {'\0',};
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_APERTURE_VALUE;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
- MSG_DETAIL_HIGH("Aperture = %s", buf);
-
- *aperture = strdup(buf);
- return true;
-}
-
-bool _get_exposure_time_from_exifdata(ExifData *ed, char **exposure)
-{
- MSG_DETAIL_HIGH("_get_exposure_time_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- char buf[BUF_LEN+1] = {'\0',};
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_EXPOSURE_TIME;
-
- if (_get_exif_string(ed, tag, buf, BUF_LEN) == false)
- {
- return false;
- }
- MSG_DETAIL_HIGH("Exposure time = %s", buf);
-
- *exposure = strdup(buf);
- return true;
-}
-
-bool _get_iso_from_exifdata(ExifData *ed, int *iso)
-{
- MSG_DETAIL_HIGH("_get_iso_from_exifdata");
- ExifIfd ifd;
- ExifTag tag;
-
- ifd = EXIF_IFD_EXIF;
- tag = EXIF_TAG_ISO_SPEED_RATINGS;
-
- if (_get_exif_short(ed, tag, iso) == false)
- {
- return false;
- }
- MSG_DETAIL_HIGH("ISO = %d", *iso);
-
- return true;
-}
-*/
-/*
-static bool _get_image_resolution(const char *path, int * pWidth, int *pHeight)
-{
- IV_ASSERT(path != NULL);
-
- int width = 0;
- int height = 0;
-
- Evas *canvas;
- Ecore_Evas *ee;
-
- ee = ecore_evas_buffer_new(1, 1);
- if (!ee)
- {
- MSG_DETAIL_ERROR("Cannot get EVAS");
- return false;
- }
-
- canvas = ecore_evas_get(ee);
-
- evas_image_cache_set(canvas, 0);
-
- Evas_Object *img = evas_object_image_add(canvas);
-
- evas_object_image_file_set(img, NULL, NULL);
- //evas_object_image_load_orientation_set(img, EINA_TRUE);
- evas_object_image_load_scale_down_set(img, 0);
-
- evas_object_image_file_set(img, path, NULL);
- Evas_Load_Error error = evas_object_image_load_error_get(img);
- if (error != EVAS_LOAD_ERROR_NONE)
- {
- MSG_DETAIL_ERROR("Decoding Error(%d) : %s", error, path);
- evas_object_del(img);
- ecore_evas_free(ee);
- return false;
- }
-
- evas_object_image_size_get(img, &width, &height);
-
- evas_object_image_file_set(img, NULL, NULL);
- evas_object_del(img);
-
- ecore_evas_free(ee);
-
- *pWidth = width;
- *pHeight = height;
-
- MSG_DETAIL_HIGH("widht & height is [%d, %d]", width, height);
-
- return true;
-}
-*/
-
static bool
_get_video_resolution(const char *path, int * /* OUT */ pWidth, int * /* OUT */pHeight)
{
type = NULL;
return mime_type;
}
-/*sri
-char *ivug_fileinfo_get_focal_length(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return NULL;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return NULL;
- }
-
- char *length = NULL;
- if (_get_focal_length_from_exifdata(ed, &length) == false)
- {
- exif_data_unref(ed);
- return NULL;
- }
-
- exif_data_unref(ed);
-
- return length;
-}
-
-char *ivug_fileinfo_get_model_name(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return NULL;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return NULL;
- }
-
- char *model = NULL;
- if (_get_model_from_exifdata(ed, &model) == false)
- {
- exif_data_unref(ed);
- return NULL;
- }
-
- exif_data_unref(ed);
-
- return model;
-}
-
-char *ivug_fileinfo_get_maker_name(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return NULL;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return NULL;
- }
-
- char *maker = NULL;
- if (_get_maker_from_exifdata(ed, &maker) == false)
- {
- exif_data_unref(ed);
- return NULL;
- }
-
- exif_data_unref(ed);
-
- return maker;
-}
-
-int ivug_fileinfo_get_flash_status(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return -1;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return -1;
- }
-
- int status = 0;
- if (_get_flash_from_exifdata(ed, &status) == false)
- {
- exif_data_unref(ed);
- return -1;
- }
-
- exif_data_unref(ed);
-
- return status;
-}
-
-int ivug_fileinfo_get_orientation(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return IVUG_FILE_INFO_ERR_PATH_IS_NULL;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return IVUG_FILE_INFO_ERR_INTERNAL;
- }
-
- int orient = 0;
- if (_get_orientation_from_exifdata(ed, &orient) == false)
- {
- exif_data_unref(ed);
- return IVUG_FILE_INFO_ERR_INTERNAL;
- }
-
- exif_data_unref(ed);
-
- return orient;
-}
-
-int ivug_fileinfo_get_white_balance(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return -1;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return -1;
- }
-
- int status = 0;
- if (_get_white_balance_from_exifdata(ed, &status) == false)
- {
- exif_data_unref(ed);
- return -1;
- }
-
- exif_data_unref(ed);
-
- return status;
-}
-
-char *ivug_fileinfo_get_aperture(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return NULL;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return NULL;
- }
-
- char *aperture = NULL;
- if (_get_aperture_from_exifdata(ed, &aperture) == false)
- {
- exif_data_unref(ed);
- return NULL;
- }
-
- exif_data_unref(ed);
-
- return aperture;
-}
-
-char *ivug_fileinfo_get_exposure_time(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return NULL;
- }
-
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return NULL;
- }
-
- char *exposure = NULL;
- if (_get_exposure_time_from_exifdata(ed, &exposure) == false)
- {
- exif_data_unref(ed);
- return NULL;
- }
-
- exif_data_unref(ed);
-
- return exposure;
-}
-
-char *ivug_fileinfo_get_iso(const char *path)
-{
- if (path == NULL)
- {
- MSG_UTIL_ERROR("Cannot get mine type. path is NULL");
- return NULL;
- }
-
- char buf[BUF_LEN] = {0,};
- ExifData *ed = NULL;
-
- // get exifdata
- ed = exif_data_new_from_file(path);
- if (!ed)
- {
- return NULL;
- }
-
- int iso = -1;
- if (_get_iso_from_exifdata(ed, &iso) == false)
- {
- exif_data_unref(ed);
- return NULL;
- }
-
- exif_data_unref(ed);
-
- snprintf(buf, sizeof(buf), "%d", iso);
-
- return strdup(buf);
-}*/
-
*
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "ivug-uuid.h"
-#include <stdio.h> // for NULL
-#include <stdlib.h> // free
-#include <string.h> // strdup
inline UUID uuid_assign(UUID id)
{
#include <string.h>
#include <assert.h>
#include <time.h>
-
-#include "statistics.h"
#include "debug.h"
+++ /dev/null
-/*
-* Copyright (c) 2000-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 "ivug-comment.h"
-
-#include "jpeg.h"
-
-using namespace iv;
-
-extern "C" Handle ivug_comment_loadfile(const char *fname)
-{
- MSG_ASSERT(fname != NULL);
-
- CJPEG *pJpeg = new CJPEG();
-
- if (pJpeg->ParseJPEG(fname) == false) {
- delete pJpeg;
- return NULL;
- }
-
- return (Handle)pJpeg;
-}
-
-
-extern "C" const char *ivug_comment_get(Handle handle)
-{
- MSG_ASSERT(handle != NULL);
-
- return ((CJPEG *)handle)->GetUserComment();
-}
-
-
-extern "C" void ivug_comment_set(Handle handle, const char *comment)
-{
- MSG_ASSERT(handle != NULL);
-
- CJPEG *pJpeg = (CJPEG *)handle;
-
- pJpeg->SetUserComment(comment);
-}
-
-
-extern "C" void ivug_comment_savefile(Handle handle, const char *fname)
-{
- MSG_ASSERT(handle != NULL);
-
- CJPEG *pJpeg = (CJPEG *)handle;
-
- pJpeg->WriteJPEG(fname);
-}
-
-
-extern "C" void ivug_comment_closefile(Handle handle)
-{
- MSG_ASSERT(handle != NULL);
-
- CJPEG *pJpeg = (CJPEG *)handle;
-
- delete pJpeg;
-}
+++ /dev/null
-/*
-* Copyright (c) 2000-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 "ivug-debug.h"
-#include "ivug-motion.h"
-
-#include <Elementary.h>
-#include <sensor.h>
-
-#include <list>
-#include <algorithm>
-
-#include <Ecore.h>
-using namespace std;
-
-#undef TEST_SENSOR_ERROR
-
-#undef LOG_LVL
-#define LOG_LVL DBG_MSG_LVL_HIGH
-
-#undef LOG_CAT
-#define LOG_CAT "IV-MOTION"
-
-class CClient
-{
-
-private:
- CClient() {
- throw "Use CClient(motion_callback_t func, void *data)";
- };
-
-public:
- CClient(motion_callback_t func, void *data): cb_func(func), cb_data(data) {
- };
-
- ~CClient() {
- };
-
- void call(motion_handle_t handle, int dx, int dy) {
- if (cb_func) {
- cb_func(handle, dx, dy, cb_data);
- }
- };
-
- bool operator==(const CClient & value) const {
- if ((value.cb_func == cb_func) && (value.cb_data == cb_data)) {
- return true;
- }
-
- return false;
- };
-private:
- motion_callback_t cb_func;
- void *cb_data;
-};
-
-class CComparator
-{
-public:
- CComparator(const CClient & data): client(data) {
- };
-
- bool operator()(const CClient * value)const {
- if (client == *value) {
- return true;
- }
-
- return false;
- };
-private:
-
- const CClient & client;
-};
-
-//#define USE_SENSOR_THREAD
-class CMotion
-{
-private:
- static void thSensorStartBlockingTilt(void *data, Ecore_Thread *thread) {
- CMotion *thiz = (CMotion *)data;
-
- thiz->start_tilt();
-
- MSG_HIGH("Tilt Sensor start in thread!");
- };
-
- static void thSensorStartBlockingPanning(void *data, Ecore_Thread *thread) {
- CMotion *thiz = (CMotion *)data;
-
- thiz->start_panning();
-
- MSG_HIGH("Panning Sensor start in thread!");
- };
-
- static void thSensorStartCancel(void *data, Ecore_Thread *thread) {
- MSG_HIGH("Sensor start cancelled!.");
- };
-
- static void thSensorStartEnd(void *data, Ecore_Thread *thread) {
- MSG_HIGH("Sensor start end!.");
- };
-
- static void on_motion(unsigned long long timestamp, int x, int y, void *data);
-
-public:
- bool start_tilt() {
- if (bInit_tilt == false) {
- MSG_ERROR("Tilt Sensor already started");
- return false;
- }
-
-// int ret = -1;
-
- /*PERF_CHECK_BEGIN(LVL5, "sensor_start");
- ret = sensor_start(mhandle_tilt, SENSOR_MOTION_TILT);
- PERF_CHECK_END(LVL5, "sensor_start");
- if(ret != SENSOR_ERROR_NONE)
- {
- MSG_ERROR("sensor_start SENSOR_MOTION_TILT fail. %d", ret);
- bStarted_tilt = false;
- return false;
- }*/
-
- bStarted_tilt = true;
-
- return true;
-
- }
-
- bool start_panning() {
- if (bInit_panning == false) {
- MSG_ERROR("Panning Sensor already started");
- return false;
- }
-
-// int ret = -1;
-
-// PERF_CHECK_BEGIN(LVL5, "sensor_start");
-// ret = sensor_start(mhandle_panning, SENSOR_MOTION_PANNING_BROWSE);
-// PERF_CHECK_END(LVL5, "sensor_start");
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("sensor_start SENSOR_MOTION_PANNING_BROWSE fail. %d", ret);
-// bStarted_panning = false;
-// return false;
-// }
-
- bStarted_panning = true;
- return true;
-
- }
-
- bool start_async_tilt() {
- m_thread_tilt = ecore_thread_run(thSensorStartBlockingTilt, NULL, NULL, this);
- MSG_WARN("thread func addr = 0x%08x, 0x%08x, 0x%08x", thSensorStartBlockingTilt, thSensorStartEnd, thSensorStartCancel);
- return true;
- }
-
- bool start_async_panning() {
- m_thread_panning = ecore_thread_run(thSensorStartBlockingPanning, NULL, NULL, this);
- MSG_WARN("thread func addr = 0x%08x, 0x%08x, 0x%08x", thSensorStartBlockingPanning, thSensorStartEnd, thSensorStartCancel);
- return true;
- }
-
- bool stop_async_tilt() {
- if (m_thread_tilt) {
- ecore_thread_cancel(m_thread_tilt);
- m_thread_tilt = NULL;
- }
- return true;
- }
-
- bool stop_async_panning() {
- if (m_thread_panning) {
- ecore_thread_cancel(m_thread_panning);
- m_thread_panning = NULL;
- }
- return true;
- }
-
- bool stop_tilt() {
- if (bInit_tilt == false) {
- MSG_ERROR("Tilt Sensor already stopped");
- return false;
- }
-
-// int ret = -1;
-
- /*ret = sensor_stop(mhandle_tilt, SENSOR_MOTION_TILT);
- if(ret != SENSOR_ERROR_NONE)
- {
- MSG_ERROR("sensor_stop SENSOR_MOTION_TILT fail. %d", ret);
- bStarted_tilt = true;
- return false;
- }*/
-
- bStarted_tilt = false;
- return true;
- }
-
- bool stop_panning() {
- if (bInit_panning == false) {
- MSG_ERROR("Panning Sensor already stopped");
- return false;
- }
-
-// int ret = -1;
-
-// ret = sensor_stop(mhandle_panning, SENSOR_MOTION_PANNING_BROWSE);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("sensor_stop SENSOR_MOTION_PANNING_BROWSE fail. %d", ret);
-// bStarted_panning = true;
-// return false;
-// }
-
- bStarted_panning = false;
-
- return true;
- }
-
-public:
- CMotion() : rotate(0), bStarted_tilt(false), bStarted_panning(false), bInit_tilt(false), bInit_panning(false),
- m_thread_tilt(NULL), m_thread_panning(NULL) {
- };
- virtual ~ CMotion() {
- // it is called after main loop end, because motion var is static
- //deinit_sensor();
-
- //stop_async();
- };
-
- bool init_sensor_tilt();
- bool init_sensor_panning();
- bool deinit_sensor_tilt();
- bool deinit_sensor_panning();
-
- CClient *register_sensor_tilt(motion_callback_t cb_func, void *data) {
- const CClient find(cb_func, data);
-
- CComparator compare(find);
-
- list < CClient * >::iterator it =
- find_if(client_list.begin(), client_list.end(), compare);
-
- if (it != client_list.end()) {
- MSG_HIGH("Same client is exist.");
- return *it;
- // Founded
- }
-
- CClient *client = new CClient(cb_func, data);
-
- client_list.push_back(client);
-
- if (client_list.size() == 1) {
- MSG_HIGH("Start tilt sensor");
-#ifdef USE_SENSOR_THREAD
- PERF_CHECK_BEGIN(LVL5, "sensor_start_async");
- start_async_tilt();
- PERF_CHECK_END(LVL5, "sensor_start_async");
-#else
- start_tilt();
-#endif
- }
-
- MSG_HIGH("Add client. Client=%d Handle=0x%08x",
- client_list.size(), client);
-
- return client;
- }
-
- CClient *register_sensor_panning(motion_callback_t cb_func, void *data) {
- const CClient find(cb_func, data);
-
- CComparator compare(find);
-
- list < CClient * >::iterator it =
- find_if(client_list.begin(), client_list.end(), compare);
-
- if (it != client_list.end()) {
- MSG_HIGH("Same client is exist.");
- return *it;
- // Founded
- }
-
- CClient *client = new CClient(cb_func, data);
-
- client_list.push_back(client);
-
- if (client_list.size() == 1) {
- MSG_HIGH("Start panning sensor");
-#ifdef USE_SENSOR_THREAD
- PERF_CHECK_BEGIN(LVL5, "sensor_start_async");
- start_async_panning();
- PERF_CHECK_END(LVL5, "sensor_start_async");
-#else
- start_panning();
-#endif
- }
-
- MSG_HIGH("Add client. Client=%d Handle=0x%08x",
- client_list.size(), client);
-
- return client;
- }
-
- void unregister_sensor_tilt(CClient * client) {
- list < CClient * >::iterator it =
- find(client_list.begin(), client_list.end(), client);
-
- if (it == client_list.end()) {
- MSG_HIGH("Not found client Handle=0x%08x", client);
- return;
- // Founded
- }
-
- client_list.remove(client);
-
- if (client_list.size() == 0) {
- MSG_HIGH("Stop tilt sensor");
-
- if (stop_tilt() == true) {
- bStarted_tilt = true;
- } else {
- bStarted_tilt = false;
- }
- stop_async_tilt();
- }
-
- MSG_HIGH("Remove client. Client=%d Handle=0x%08x",
- client_list.size(), client);
-
- delete client;
- }
-
- void unregister_sensor_panning(CClient * client) {
- list < CClient * >::iterator it =
- find(client_list.begin(), client_list.end(), client);
-
- if (it == client_list.end()) {
- MSG_HIGH("Not found client Handle=0x%08x", client);
- return;
- // Founded
- }
-
- client_list.remove(client);
-
- if (client_list.size() == 0) {
- MSG_HIGH("Stop panning sensor");
-
- if (stop_panning() == true) {
- bStarted_panning = true;
- } else {
- bStarted_panning = false;
- }
- stop_async_panning();
- }
-
- MSG_HIGH("Remove client. Client=%d Handle=0x%08x",
- client_list.size(), client);
-
- delete client;
- }
-
- list < CClient * > client_list;
-
- void swap(int &a, int &b) {
- int tmp;
-
- tmp = a;
- a = b;
- b = tmp;
- }
-
- void inform_client(int dx, int dy) {
-
- if (bStarted_panning == false && bStarted_tilt == false) {
- MSG_HIGH("ignore motion event.");
- return ;
- }
-
- switch (rotate) {
- case 0:
- dy = -dy;
- break;
- case 90:
- swap(dx, dy);
- break;
- case 180:
- break;
- case 270:
- swap(dx, dy);
- dy = -dy;
- break;
- default:
- break;
- }
-
- for (list < CClient * >::iterator it = client_list.begin(); it != client_list.end(); it++) {
- (*it)->call(static_cast<motion_handle_t>(*it), dx, dy);
- }
-
- MSG_HIGH("x:y = [%5d:%5d] rot=%d", dx, dy, rotate);
- };
-
- void set_rotate(int rotate) {
- this->rotate = rotate;
- };
-
-private:
- sensor_h mhandle_tilt; // Motion tilt handle
- sensor_h mhandle_panning; // Motion panning handle
-
- int rotate;
- bool bStarted_tilt;
- bool bStarted_panning;
- bool bInit_tilt;
- bool bInit_panning;
-
- Ecore_Thread *m_thread_tilt;
- Ecore_Thread *m_thread_panning;
-
-};
-
-/************************ MOTION SENSOR *************************/
-
-void CMotion::on_motion(unsigned long long timestamp, int x, int y, void *data)
-{
- CMotion *thiz = (CMotion *) data;
- IV_ASSERT(data != NULL);
-
-// int rot = elm_win_rotation_get((Evas_Object *) ug_get_window()); [ToDo] Check Appropriate replacement
- int rot = 90;
-
- thiz->set_rotate(rot);
-
- thiz->inform_client(x, y);
-}
-
-bool CMotion::init_sensor_tilt()
-{
-// int ret = -1;
-
- if (bInit_tilt == true) {
- MSG_WARN("already sensor is initialized");
- return true;
- }
-
-#ifdef TEST_SENSOR_ERROR
- MSG_ERROR("motion sensor attach fail.");
- return false;
-#endif
- MSG_HIGH("init sensor");
-
- PERF_CHECK_BEGIN(LVL4, "sensor_create");
-// ret = sensor_create(&mhandle_tilt);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("tilt sensor_create fail. %d", ret);
-// return false;
-// }
-// PERF_CHECK_END(LVL4, "sensor_create");
-//
-// PERF_CHECK_BEGIN(LVL4, "sensor_motion_tilt_set_cb");
-// ret = sensor_motion_tilt_set_cb(mhandle_tilt, on_motion, (void *)this);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("sensor_motion_tilt_set_cb fail. %d", ret);
-// sensor_destroy(mhandle_tilt);
-// return false;
-// }
- PERF_CHECK_END(LVL4, "sensor_motion_tilt_set_cb");
-
- MSG_HIGH("sensor init succeded");
-
- bInit_tilt = true;
- return true;
-
-}
-
-bool CMotion::init_sensor_panning()
-{
-// int ret = -1;
-
- if (bInit_panning == true) {
- MSG_WARN("already sensor is initialized");
- return true;
- }
-
-#ifdef TEST_SENSOR_ERROR
- MSG_ERROR("motion sensor attach fail.");
- return false;
-#endif
- MSG_HIGH("init sensor");
-
-// PERF_CHECK_BEGIN(LVL4, "sensor_create");
-// ret = sensor_create(&mhandle_panning);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("panning sensor_create fail. %d", ret);
-// return false;
-// }
-// PERF_CHECK_END(LVL4, "sensor_create");
-//
-// PERF_CHECK_BEGIN(LVL4, "sensor_motion_panning_browse_set_cb");
-// ret = sensor_motion_panning_browse_set_cb(mhandle_panning, on_motion, (void *)this);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("sensor_motion_panning_set_cb fail. %d", ret);
-// sensor_destroy(mhandle_panning);
-// return false;
-// }
- PERF_CHECK_END(LVL4, "sensor_motion_panning_browse_set_cb");
-
- MSG_HIGH("sensor init succeded");
-
- bInit_panning = true;
- return true;
-}
-
-
-bool CMotion::deinit_sensor_tilt()
-{
-// int ret = -1;
-
- if (bInit_tilt == false) {
- return true;
- }
-
- if (client_list.size() != 0) {
- MSG_HIGH("Client is remain");
- return false;
- }
-
- bInit_tilt = false;
-
- MSG_HIGH("deinit sensor tilt");
-
-// ret = sensor_motion_tilt_unset_cb(mhandle_tilt);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("sensor_motion_tilt_unset_cb fail. %d", ret);
-// }
-//
-// ret = sensor_destroy(mhandle_tilt);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("tilt sensor_destroy fail. %d", ret);
-// }
-
- return true;
-}
-
-bool CMotion::deinit_sensor_panning()
-{
-// int ret = -1;
-
- if (bInit_panning == false) {
- return true;
- }
-
- if (client_list.size() != 0) {
- MSG_HIGH("Client is remain");
- return false;
- }
-
- bInit_panning = false;
-
- MSG_HIGH("deinit sensor panning");
-
-// ret = sensor_motion_panning_browse_unset_cb(mhandle_panning);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("sensor_motion_panning_browse_unset_cb fail. %d", ret);
-// }
-//
-// ret = sensor_destroy(mhandle_panning);
-// if(ret != SENSOR_ERROR_NONE)
-// {
-// MSG_ERROR("paning sensor_destroy fail. %d", ret);
-// }
-
- return true;
-}
-
-
-CMotion motion;
-
-extern "C" motion_handle_t ivug_motion_register_sensor(motion_type_e type, motion_callback_t
- cb_func, void *data)
-{
- CClient *client = NULL;
-
- if (type == IV_MOTION_TILT) {
- motion.init_sensor_tilt();
-
- PERF_CHECK_BEGIN(LVL4, "register_sensor");
- client = motion.register_sensor_tilt(cb_func, data);
- PERF_CHECK_END(LVL4, "register_sensor");
- } else if (type == IV_MOTION_PANNING) {
- motion.init_sensor_panning();
-
- PERF_CHECK_BEGIN(LVL4, "register_sensor");
- client = motion.register_sensor_panning(cb_func, data);
- PERF_CHECK_END(LVL4, "register_sensor");
- }
-
- return (motion_handle_t) client;
-
-}
-
-extern "C" void ivug_motion_unregister_sensor(motion_type_e type, motion_handle_t handle)
-{
- CClient *client = (CClient *) handle;
-
- if (type == IV_MOTION_TILT) {
- motion.unregister_sensor_tilt(client);
-
- motion.deinit_sensor_tilt();
- } else if (type == IV_MOTION_PANNING) {
- motion.unregister_sensor_panning(client);
-
- motion.deinit_sensor_panning();
- }
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2000-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 "ivug-define.h"
-#include "ivug-debug.h"
-#include "ivug-transcoder.h"
-
-#include "ivug-file-info.h"
-
-extern "C" bool ivug_trancoder_convert_video(const char *jpg, const char *wav, const char *outfile, IVTransConfig *config)
-{
- //MSG_ERROR("Feature is disabled");
- return false;
-}
+++ /dev/null
-/*
-* Copyright (c) 2000-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 "ivug-vibration.h"
-#include "ivug-debug.h"
-
-#include <stdio.h>
-#ifdef USE_MAXLENGTH_VIBE
-#include <dd-haptic.h>
-
-static const char *_conver_error(int err)
-{
- switch (err)
- {
- case HAPTIC_ERROR_NONE:
- return "Successful";
- case HAPTIC_ERROR_INVALID_PARAMETER:
- return "Invalid parameter";
- case HAPTIC_ERROR_NOT_INITIALIZED:
- return "Not initialized";
- case HAPTIC_ERROR_OPERATION_FAILED:
- return "Operation failed";
- case HAPTIC_ERROR_NOT_SUPPORTED_DEVICE:
- return "Not supported device";
- default:
- {
- static char error[128];
- snprintf(error, 128, "Unknow Error : %d(0x%08x)", err, err);
- return error;
- }
- }
-
- return NULL;
-
-}
-
-
-vibration_h ivug_vibration_create()
-{
- int ret = HAPTIC_ERROR_NONE;
- haptic_device_h handle = NULL;
-
- ret = haptic_open(HAPTIC_DEVICE_ALL, &handle);
-
- if (ret != HAPTIC_ERROR_NONE)
- {
- MSG_UTIL_ERROR("device_haptic_open failed. %s", _conver_error(ret));
- return NULL;
- }
-
- MSG_UTIL_HIGH("Vibration init. Handle=%x", handle);
-
- return (vibration_h)handle;
-}
-
-bool ivug_vibration_play(vibration_h v_handle, int duration)
-{
- IV_ASSERT(v_handle!=NULL);
- int ret = HAPTIC_ERROR_NONE;
- haptic_device_h handle = (haptic_device_h)v_handle;
-
- MSG_UTIL_HIGH("Vibration start. Handle=%x duration=%d", handle, duration);
-
- ret = haptic_vibrate_monotone(handle, duration, NULL);
-
- if (ret != HAPTIC_ERROR_NONE)
- {
- MSG_UTIL_ERROR("haptic_vibrate_monotone error Handle=%x. %s", handle, _conver_error(ret));
- return false;
- }
-
- return true;
-}
-
-bool ivug_vibration_stop(vibration_h v_handle)
-{
- IV_ASSERT(v_handle!=NULL);
- int ret = HAPTIC_ERROR_NONE;
- haptic_device_h handle = (haptic_device_h)v_handle;
-
- MSG_UTIL_HIGH("Vibration stop. Handle=%x", handle);
-
- ret = haptic_stop_all_effects(handle);
- if (ret != 0)
- {
- MSG_UTIL_ERROR("haptic_stop_device failed. %s", _conver_error(ret));
- }
-
- return true;
-}
-
-
-bool ivug_vibration_delete(vibration_h v_handle)
-{
- IV_ASSERT(v_handle!=NULL);
- int ret = HAPTIC_ERROR_NONE;
- haptic_device_h handle = (haptic_device_h)v_handle;
-
- MSG_UTIL_HIGH("Vibration deinit. Handle=%x", handle);
-
- ret = haptic_close(handle);
-
- if (ret != HAPTIC_ERROR_NONE)
- {
- MSG_UTIL_ERROR("device_haptic_close failed. %s", _conver_error(ret));
- }
-
- return true;
-}
-#endif
-
+++ /dev/null
-/*
-* Copyright (c) 2000-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.
-*
-*/
-
-/*
-Orientation.
- Load
- JFIF format --> 0
-
- EXIF format -> Check 0th IFD
- if found orientation : return value.
- if not : return 0.
-
-// Impossible because MakerNote offset
-// Save
-// JFIF format.
-// Write FFD8
-// Create TIFF Header. Make 0th IFD.
-// Save SOI ~ End
-//
-// EXIF format
-// if found : just replace value itself.
-// not found : add interopebility and resize 0th IFD. Adjust all offset.
-//
-
-
-Comment.
- Load
- JFIF format --> check JFIF comment
-
- EXIF format --> Find UserComment
- if found
- use this value.
- else if not found
- find JFIF comment
- else
- No Comment
-
-// Impossible because MakerNote offset
-// Save
-// JFIF format
-// Create basic EXIF header & User comment
-//
-// EXIF format.
-// Offset Modified : Next IFD, StripOffset, GPS IFD Pointer
-
-*/
-
-#include <string.h> // memcmp
-#include <memory.h>
-#include <stdlib.h>
-
-#include "File.h"
-#include "exif.h"
-#include "jpeg.h"
-
-#include <list>
-#include <string>
-
-using namespace std;
-using namespace iv;
-
-
-int CJPEG::ReadAppN(CFile &file, int marker, int len)
-{
- int size;
-
- size = len;
-
- MSG_DEBUG("marker=0x%02x Size=%d", marker, size);
-
- switch (marker) {
- case M_APP0: { // JFIF or JFXX
- byte *buffer;
-
- buffer = (byte *)malloc(size);
-
- if (buffer == NULL) {
- return -1;
- }
-
- if (file.Read(buffer, size) != size) {
- MSG_ERROR("Cannot read file. size=%u", size);
- free(buffer);
- return -1;
- }
-
- if (memcmp(buffer, "JFIF", sizeof("JFIF")) == 0) {
- int vMajor = buffer[5];
- int vMinor = buffer[6];
-
- int unit = buffer[7];
- int Xdensity = buffer[8] << 8 | buffer[9];
- int Ydensity = buffer[10] << 8 | buffer[11];
-
- int Xthumbnail = buffer[12];
- int Ythumbnail = buffer[13];
-
- MSG_DEBUG("JFIF v%1d.%02d Unit=%d XYDensity(%d,%d), XYThumbnail(%d,%d)", vMajor, vMinor, unit, Xdensity, Ydensity, Xthumbnail, Ythumbnail);
- } else if (memcmp(buffer, "JFXX", sizeof("JFXX")) == 0) {
- MSG_DEBUG("JFXX");
- } else {
- MSG_DEBUG("Invalid APP0");
- }
- free(buffer);
- }
-
- break;
- case M_APP1: { // EXIF or XMP
- // Read 6 bytes.
- char header[6];
- int bytes;
-
- bytes = file.Read(header, 6);
-
- if (bytes < 6) {
- MSG_ERROR("Not a vaild EXIF");
- return -1;
- }
-
- int read;
-
- if (memcmp(header, "Exif\00", sizeof("Exif\00") - 1) == 0) {
- if (m_exif != NULL) {
- // There is jpeg has 2 Exifs segment. we ignore that.
- MSG_WARN("M_APP1 appears two times. Ignore this");
- break;
- }
-
- int offset = file.Tell();
-
- byte *buffer = (byte *)malloc(size);
-
- if (buffer == NULL) {
- return -1;
- }
-
- read = file.Read(buffer, size);
-
- if (read != size) {
- MSG_ERROR("Try to read %d bytes but %d bytes read", size, read);
- free(buffer);
- break;
- }
-
- m_exif = new CExif;
-
- if (m_exif->Parse(buffer, size, offset) == false) {
- MSG_ERROR("EXIF Parse Error. Size=%d bytes offset=%d", size, offset);
- }
-
- free(buffer);
- } else if (memcmp(header, "http:", sizeof("http:") - 1) == 0) {
- MSG_WARN("XMP parser is not implemented");
- // XMP
- }
-
- }
-
- break;
- default:
- MSG_DEBUG("Unknown marker(0x%02X)", marker);
- break;
- }
-
- return 0;
-}
-
-int CJPEG::ReadSegment(CFile &file)
-{
-// SOI - APP1 - (APP2) - DQT - DHT - (DRI) - SOF - SOS - ... - EOI - Sound&Image Data
- int f = file.GetChar();
-
- if (f != 0xFF || file.GetChar() != M_SOI) {
- MSG_DEBUG("Not a valid jpeg file");
- return -1;
- }
-
- m_seglist.push_back(CSegment(M_SOI, 0, 0, "SOI"));
-
- int marker;
- int len;
-
- for (int a = file.GetChar(); a == 0xFF; a = file.GetChar()) {
- marker = file.GetChar();
-
-// MSG_DEBUG("Found Segment 0x%02X", marker);
- len = readLength(file) - 2; // JPEG Len include 2byte for size itself
-
- if ((marker & 0xF0) == 0xE0) {
- char buf[10];
-
- snprintf(buf, 10, "APP%d", marker & 0x0F);
-
- int offset = file.Tell();
-
- MSG_DEBUG("Found %s(0x%02X) - Off(%d) Len(%d)", buf, marker, offset, len);
-
- m_seglist.push_back(CSegment(marker, len, offset, buf));
-
-// TODO : Read whole section.
- if (marker == M_APP0 || marker == M_APP1) {
- if (ReadAppN(file, marker, len) < 0) {
- MSG_ERROR("Parse Error. but ignore. %s", file.GetFilename());
- }
- }
-
- if (offset > -1) {
- file.Seek(offset, CFile::eSet); // Reset
- }
- file.Seek(len, CFile::eCur); // skip to next segment. - 2 is segment header
- continue;
- }
-
- switch (marker) {
- case M_DHT:
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "DHT"));
- break;
- case M_DQT:
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "DQT"));
- break;
-
- case M_SOS:
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "SOS"));
- break;
-
- case M_SOF0:
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "SOSF0"));
- break;
-
- case M_EOI:
- // Never reached here. because we cannot get compressed data len.
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "EOI"));
- break;
-
- case M_DRI:
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "DRI"));
- break;
-
- case M_COM: {
- // Read Comment & Store.
- char *buf = (char *)malloc(len);
- if (buf == NULL) {
- break;
- }
- int offset = file.Tell();
-
- if (buf != NULL && offset > 0) {
- file.Read(buf, len);
-
- file.Seek(offset, CFile::eSet);
-
- m_comment.assign(buf, len);
-
- MSG_HIGH("Found Comment in JPEG. %s", m_comment.c_str());
-
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "COM"));
- }
- free(buf);
- }
- break;
- default:
- MSG_WARN("Unhandled Marker=0x%02X", marker);
- m_seglist.push_back(CSegment(marker, len, file.Tell(), "NOTPARSED"));
- break;
- };
-
- file.Seek(len, CFile::eCur); // - 2 is segment header len
- }
-
-// Save remainder of file.
- long offset = file.Tell() - 1; // -1 is GetChar() in for statement.
-
- size_t size = file.GetSize();
-
- m_seglist.push_back(CSegment(0xFF, size - offset, offset, "DATA"));
-
- return 0;
-}
-
-
-bool CJPEG::WriteJPEG(const char *fname)
-{
-
- if (bModified == false) {
- MSG_ERROR("Jpeg does not changed. ");
- return false;
- }
-
- MSG_DEBUG("Write to file. %s", fname);
- string dfile;
- string sfile;
-
- bool bSamedest = false;
-
-// Make tmp and Rename
- dfile = fname;
-
- if (strcmp(file.GetFilename(), fname) == 0) {
- MSG_ERROR("Source file & Dst file name are same.");
-
- bSamedest = true;
- dfile += ".tmp";
- }
-
- sfile = file.GetFilename();
-
- CFile dst;
-
-// dst.Open(fname, CFile::eModeWrite);
- dst.Open(dfile.c_str(), CFile::eModeWrite);
-
- try {
-
-// TODO : If needed, make APP1 segment for EXIF
- for (list<CSegment>::iterator itor = m_seglist.begin(); itor != m_seglist.end(); itor++) {
- CSegment &seg = *itor;
-
- // MSG_DEBUG("%s(0x%02X) Length=%d", (*itor).name_.c_str(), (*itor).T_, (*itor).L_);
-
- switch (seg.T_) {
- case M_SOI: {
- byte buf[2] = { 0xFF, 0xD8 };
- dst.Write(buf, 2);
- }
- break;
- case 0xFF: { // Compresssed image Data
- // Read from src.
- if (file.Seek(seg.offset_, CFile::eSet) < 0) {
- MSG_ERROR("Cannot seek. Offset=0x%u", seg.offset_);
- throw "Cannot parse";
- }
-
- byte *buffer;
-
- buffer = (byte *)malloc(seg.L_);
- if (buffer) {
- int cnt = file.Read(buffer, seg.L_);
- if (cnt < seg.L_) {
- MSG_DEBUG("Read fail. %d, %d", cnt, seg.L_);
- free(buffer);
- throw "Invalid Src";
- }
- dst.Write(buffer, cnt);
- free(buffer);
- }
- }
-
- break;
- default: {
- byte buf[4];
- int size = seg.L_ + 2; // +2 for size storage
-
- buf[0] = 0xFF;
- buf[1] = (byte)seg.T_;
- buf[2] = (0xFF00 & size) >> 8;
- buf[3] = 0x00FF & size;
-
- dst.Write(buf, 4); // Tag(2), Size(2)
-
- if (seg.buf == NULL) {
- // Read from src & write to dst.
- if (file.Seek(seg.offset_, CFile::eSet) < 0) {
- MSG_ERROR("Invalid offset. 0x%08x", seg.offset_);
- throw "Invalid Offset";
- }
-
- byte *buffer;
-
- buffer = (byte *)malloc(seg.L_);
-
- if (buffer != NULL) {
- int cnt = file.Read(buffer, seg.L_);
-
- if (cnt < seg.L_) {
- MSG_DEBUG("Read fail. %d, %d", cnt, seg.L_);
- free(buffer);
- throw "Invalid Src";
- }
-
- dst.Write(buffer, cnt);
-
- free(buffer);
- }
- } else {
- dst.Write(seg.buf, seg.L_);
- }
- }
- break;
- }
- }
-
- } catch (...) {
- dst.Close();
-
- unlink(dfile.c_str()); // Remove tmp file
-
- return false;
- }
-
- dst.Close();
-
-// Remove src & rename dst to src.
- if (bSamedest == true) {
- file.Close();
- unlink(sfile.c_str());
-
- if (rename(dfile.c_str(), sfile.c_str()) != 0) {
- MSG_ERROR("Rename failed. from %s to %s", dfile.c_str(), sfile.c_str());
- }
-
- }
-
- return true;
-}
MSG_IMAGEVIEW_HIGH("Screen WH(%dx%d) Indicator(%s,%s,%s)", w, h, szMode[Context->indi_mode], szOpacity[Context->indi_o_mode], szOverlap[Context->oMode]);
- PERF_CHECK_BEGIN(LVL2, "theme add");
-
Context->th = elm_theme_new();
IV_ASSERT(Context->th != NULL);
elm_theme_extension_add(Context->th, full_path(EDJ_PATH, "/ivug-custom.edj"));
- PERF_CHECK_END(LVL2, "theme add");
-
ContextList = eina_list_prepend(ContextList, Context);
MSG_IVUG_HIGH("Append to list. Context=0x%08x", Context);
#ifdef USE_NEW_DB_API
- PERF_CHECK_BEGIN(LVL2, "media svc connect");
-
ivug_db_create();
-
- PERF_CHECK_END(LVL2, "media svc connect");
#endif
Context->callback_handle = ivug_callback_register();
}
}
#ifdef USE_NEW_DB_API
- PERF_CHECK_BEGIN(LVL2, "ivug_db_destroy");
ivug_db_destroy();
- PERF_CHECK_END(LVL2, "ivug_db_destroy");
#endif
char *custom_edj_path = full_path(EDJ_PATH, "/ivug-custom.edj");
-
- PERF_CHECK_BEGIN(LVL2, "elm_theme_free");
if (Context && Context->th) {
elm_theme_extension_del(Context->th, custom_edj_path);
elm_theme_free(Context->th);
}
- PERF_CHECK_END(LVL2, "elm_theme_free");
-
MSG_IVUG_HIGH("Remove from list. Context=0x%08x", Context);
free(custom_edj_path);
Evas_Object *layout;
Evas_Object *parent;
-
-// Not using navi_bar
-// Evas_Object *navi_bar;
-// Elm_Object_Item *navi_it;
-
char *filepath;
-
bool bAddtoDB;
} ;
-#if 0
-static void
-_send_result(const char *key1, const char *val1, const char *key2, const char *val2)
-{
- app_control_h service = NULL;
- int ret = app_control_create(&service);
- if (ret != APP_CONTROL_ERROR_NONE) {
- MSG_ERROR("app_control_create failed");
- }
-
- if (key1 && val1) {
- MSG_SEC("Bundle 1 : [%s = %s]", key1, val1);
- ret = app_control_add_extra_data(service, key1, val1);
- if (ret != APP_CONTROL_ERROR_NONE) {
- MSG_HIGH("app_control_add_extra_data failed");
- }
- }
-
- if (key2 && val2) {
- MSG_SEC("Bundle 2 : [%s = %s]", key2, val2);
- ret = app_control_add_extra_data(service, key2, val2);
- if (ret != APP_CONTROL_ERROR_NONE) {
- MSG_HIGH("app_control_add_extra_data failed");
- }
- }
-
- app_control_reply_to_launch_request(service, gGetServiceHandle(), APP_CONTROL_RESULT_SUCCEEDED);
-
- app_control_destroy(service);
-}
-#endif
-
-#if 0
-static void _ivug_crop_view_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- IvugCropUG *crop_ug = (IvugCropUG *)data;
-
- char *path = (char *)event_info;
-
- evas_object_smart_callback_del(obj, "ok,clicked", _ivug_crop_view_ok_clicked_cb);
-
- if (crop_ug->bAddtoDB == true) {
- 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("crop_image_path", path, "http://tizen.org/appcontrol/data/selected", path);
-
- MSG_HIGH("Start destroy crop ug. bAddToDB=%d", crop_ug->bAddtoDB);
-
-// ivug_set_indicator_overlap_mode(false);
-// ug_destroy_me(gGetUGHandle());
- DESTROY_ME();
-
-}
-#endif
-
-#if 0
-static void _ivug_crop_view_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- //ivug_crop_ug_destroy((IvugCropUG *)data);
-
- evas_object_smart_callback_del(obj, "cancel,clicked", _ivug_crop_view_cancel_clicked_cb);
-
- _send_result("crop_image_path", NULL, "http://tizen.org/appcontrol/data/selected", NULL);
-
- MSG_HIGH("Start destroy ug.");
-
-// ivug_set_indicator_overlap_mode(false);
-// ug_destroy_me(gGetUGHandle());
- DESTROY_ME();
-
-}
-#endif
-
Evas_Object * ivug_crop_ug_get_layout(IvugCropUG * crop_ug)
{
IV_ASSERT(crop_ug != NULL);
#include "ivug-db.h"
#include "ivug-context.h"
-/*
- ug itself has responsibility to set indicator status. so I undefined this feature
-*/
-#undef USE_INDICATOR_STATE_SET
-
-//definition
-#define MESSAGE_UG_NAME "msg-composer-efl"
-#define S_NOTE_UG_NAME "smemo-efl"
-#define EMAIL_UG_NAME "email-composer-efl"
-#define CONTACT_UG_NAME "contacts-list-efl"
-#define MYFILE_DETAIL_UG_NAME "myfile-detail-efl"
-#define BLUETOOTH_UG_NAME "setting-bluetooth-efl"
-#define MYFILE_UG_NAME "myfile-efl"
-#define GALLERY_UG_NAME "gallery-efl"
-
-#define CONTACT_SELECT_UG_NAME "contacts-tabui-efl"
-#define CONTACT_EDIT_UG_NAME "contacts-details-efl"
-#define GL_UG_PKG_TAGBUDDY_SETTING "setting-tagbuddy-efl"
-
-
-#define VIDEOPLAYER_PKG_NAME "com.samsung.video-player"
-#define BLUETOOTH_PKG_NAME "com.samsung.bluetooth"
-#define BROWSER_PKG_NAME "com.samsung.browser"
-#define MESSAGE_PKG_NAME "com.samsung.message"
-#define EMAIL_PKG_NAME "com.samsung.email"
-#define FACEBOOK_PKG_NAME "com.samsung.facebook"
-#define IMAGE_EDITOR_PKG_NAME "com.samsung.image-editor"
-#define IMAGE_VIEWER_PKG_NAME "org.tizen.image-viewer"
-
-#define WIFI_FILE_TRANSFER_UG_NAME "fileshare-efl"
-
-#define PRINT_PKG_NAME "com.samsung.mobileprint"
-
-#define ALLSHARE_CAST_APP_NAME "com.samsung.allshare-cast-popup"
-
-#define OPERATION_NAME_PRINT "http://tizen.org/appcontrol/operation/print"
-
-#define APP_CONTROL_PRINT_FILES_TYPE "app_control_print_files_type"
-
-#define MIME_TYPE_LEN 255
-
-#define FILE_PREFIX "file://"
-
void ivug_ext_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
{
MSG_IMAGEVIEW_HIGH("ivug_ext_app_control_reply_cb");
}
}
-bool ivug_ext_launch_videoeditor(const char *uri, app_control_reply_cb callback, void *data)
-{
-/*
- Replay callback is not called when exit videoeditor.
- Callee app should call app_control_reply_request(). then Caller app can get reply callback.
-*/
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
- ret = app_control_add_extra_data(handle, "path", uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
- ret = app_control_add_extra_data(handle, "launching_application", "image_viewer");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
- ret = app_control_add_extra_data(handle, "edit_mode", "trim");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
- const char *pkgname = VIDEOPLAYER_PKG_NAME;
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
- if (callback == NULL)
- {
- callback = ivug_ext_app_control_reply_cb;
- data = NULL;
- }
-
- ret = app_control_send_launch_request(handle, callback, data);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto VIDEO_EDITOR_END;
- }
-
-VIDEO_EDITOR_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-#ifdef IV_EXTENDED_FEATURES
-bool ivug_ext_launch_email(const char *uri)
-{
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, "http://tizen.org/appcontrol/operation/compose");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto EMAIL_END;
- }
-
- ret = app_control_set_uri(handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto EMAIL_END;
- }
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- ret = app_control_set_window(handle, win_id);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EMAIL_END;
- }
-
- ret = app_control_add_extra_data(handle, "RUN_TYPE", "5");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EMAIL_END;
- }
-
- if (ivug_is_web_uri(uri) == true)
- {
- ret = app_control_add_extra_data(handle, "BODY", uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EMAIL_END;
- }
- }
- else
- {
- ret = app_control_add_extra_data(handle, "ATTACHMENT", uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EMAIL_END;
- }
- }
-
- const char *pkgname = EMAIL_UG_NAME;
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_app_id failed, %d", ret);
- goto EMAIL_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto EMAIL_END;
- }
-
-EMAIL_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-#endif
-
bool ivug_ext_launch_videoplayer(const char *uri, bool isLockScreen)
{
MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
goto VIDEO_PLAYER_END;
}
- //do not set package
- /*const char *pkgname = VIDEOPLAYER_PKG_NAME;
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto VIDEO_PLAYER_END;
- }*/
-
ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
if (ret != APP_CONTROL_ERROR_NONE)
{
return (ret == APP_CONTROL_ERROR_NONE ? true : false);
}
-
-bool ivug_ext_launch_videoplayer_simple(const char *uri)
-{
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto VIDEO_PLAYER_SIMPLE_END;
- }
-
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto VIDEO_PLAYER_SIMPLE_END;
- }
-
- ret = app_control_add_extra_data(handle, "path", uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto VIDEO_PLAYER_SIMPLE_END;
- }
-
- // Camera -> Image Viewer -> Video player, In this case, launching_application bundle's value should be "light_play_view"
- ret = app_control_add_extra_data(handle, "launching_application", "light_play_view");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto VIDEO_PLAYER_SIMPLE_END;
- }
-
- const char *pkgname = VIDEOPLAYER_PKG_NAME;
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto VIDEO_PLAYER_SIMPLE_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto VIDEO_PLAYER_SIMPLE_END;
- }
-
-VIDEO_PLAYER_SIMPLE_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-bool ivug_ext_launch_twitter(const char *uri)
-{
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- if (ivug_is_web_uri(uri) == true)
- {
- ret = app_control_set_operation(handle, "http://tizen.org/appcotnrol/operation/share_text");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto TWITTER_END;
- }
- ret = app_control_add_extra_data(handle, APP_CONTROL_DATA_TEXT, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto TWITTER_END;
- }
- }
- else
- {
- ret = app_control_set_operation(handle, "http://tizen.org/appcotnrol/operation/share");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto TWITTER_END;
- }
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto TWITTER_END;
- }
- }
-
- const char *pkgname = "com.samsung.twitter";
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto TWITTER_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto TWITTER_END;
- }
-
-TWITTER_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-bool ivug_ext_launch_facebook(const char *uri)
-{
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- if (ivug_is_web_uri(uri) == true)
- {
- ret = app_control_set_operation(handle, "http://tizen.org/appcotnrol/operation/share_text");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto FACEBOOK_END;
- }
- ret = app_control_add_extra_data(handle, APP_CONTROL_DATA_TEXT, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto FACEBOOK_END;
- }
- }
- else
- {
- ret = app_control_set_operation(handle, "http://tizen.org/appcotnrol/operation/share");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto FACEBOOK_END;
- }
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto FACEBOOK_END;
- }
- media_handle file_handle = ivug_db_get_file_handle(uri);
- if (file_handle)
- {
- char *mime = ivug_db_get_mime_type(file_handle);
- ivug_db_destroy_file_handle(file_handle);
- if (mime)
- {
- ret = app_control_set_mime(handle, mime);
- free(mime);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_mime failed, %d", ret);
- goto FACEBOOK_END;
- }
- }
- }
- }
-
- const char *pkgname = "com.samsung.facebook";
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto FACEBOOK_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto FACEBOOK_END;
- }
-
-FACEBOOK_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-bool ivug_ext_launch_picasa(const char *uri)
-{
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
- char xwin_id_str[12] = {0,};
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, "http://tizen.org/appcotnrol/operation/share");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto PICASA_END;
- }
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto PICASA_END;
- }
-
- const char *pkgname = "com.samsung.picasa";
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto PICASA_END;
- }
-
-// Ecore_X_Window xwin_id = elm_win_xwindow_get(ug_get_window()); [ToDo] Check Appropriate replacement
- Ecore_X_Window xwin_id = -1;
- eina_convert_itoa(xwin_id, xwin_id_str);
- ret = app_control_add_extra_data(handle, "XWINDOW_ID", xwin_id_str);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto PICASA_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto PICASA_END;
- }
-
-PICASA_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-#ifdef IV_EXTENDED_FEATURES
-bool ivug_ext_launch_sns(const char *pkgname, const char *uri)
-{
- if (strcmp(pkgname, "com.samsung.twitter") == 0)
- {
- return ivug_ext_launch_twitter(uri);
- }
- else if (strcmp(pkgname, "com.samsung.facebook") == 0)
- {
- return ivug_ext_launch_facebook(uri);
- }
- else if (strcmp(pkgname, "com.samsung.picasa") == 0)
- {
- return ivug_ext_launch_picasa(uri);
- }
- else if (strcmp(pkgname, "com.samsung.youtube") == 0)
- {
- return ivug_ext_launch_default(uri, "http://tizen.org/appcotnrol/operation/share", pkgname, NULL, NULL);
- }
- else
- {
- MSG_IMAGEVIEW_ERROR("Unknown package name:%s", pkgname);
- }
-
- return true;
-}
-#endif
-
-bool ivug_ext_launch_browser(const char *uri)
-{
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto BROWSER_END;
- }
-
- ret = app_control_add_extra_data(handle, "url", uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto BROWSER_END;
- }
-
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto BROWSER_END;
- }
-
- const char *pkgname = BROWSER_PKG_NAME;
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto BROWSER_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto BROWSER_END;
- }
-
-BROWSER_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-bool ivug_ext_launch_print(const char *uri)
-{
-#define APP_CONTROL_PRINT_TITLE "Title"
-#define APP_CONTROL_PRINT_CONTENT "ContentPath"
-#define APP_CONTROL_PRINT_CONTENT_TYPE "ContentType"
-#define APP_CONTROL_PRINT_CONTENT_COUNT "ContentCount"
-
- MSG_IMAGEVIEW_HIGH("%s. URI=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
- const char *pkgname = PRINT_PKG_NAME;
-
- if (uri == NULL)
- {
- MSG_IMAGEVIEW_ERROR("URI is NULL");
- return false;
- }
-
- app_control_h handle;
- const char **files = NULL;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, OPERATION_NAME_PRINT);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto PRINT_END;
- }
-
- ret = app_control_set_app_id(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_app_id failed, %d", ret);
- goto PRINT_END;
- }
-
- /*ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto PRINT_END;
- }*/
-
- ret = app_control_add_extra_data(handle, APP_CONTROL_PRINT_TITLE, "From Gallery");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto PRINT_END;
- }
-
- files = (const char **)malloc(sizeof(char *));
- if (files == NULL)
- {
- MSG_IMAGEVIEW_ERROR("malloc has error");
- app_control_destroy(handle);
- return false;
- }
- files[0] = uri;
-
- ret = app_control_add_extra_data_array(handle, APP_CONTROL_PRINT_CONTENT, (const char **)files, 1);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto PRINT_END;
- }
-
- ret = app_control_add_extra_data(handle, APP_CONTROL_PRINT_CONTENT_COUNT, "1");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto PRINT_END;
- }
-
- ret = app_control_add_extra_data(handle, APP_CONTROL_PRINT_CONTENT_TYPE, "IMG");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto PRINT_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto PRINT_END;
- }
-
-PRINT_END:
- if (files)
- free(files);
-
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-#ifdef USE_EXT_SLIDESHOW
-ui_gadget_h ivug_ext_launch_select_music(ug_result_cb result_func, ug_destroy_cb destroy_func, void *data)
-{
- MSG_IMAGEVIEW_HIGH("%s", __func__);
-
- const char *pa_cur_ringtone = NULL;
- const char *dir_path = NULL;
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
- ui_gadget_h ug = NULL;
-
- pa_cur_ringtone = "/opt/share/settings/Ringtones/Over the horizon.mp3";
- dir_path = "/opt/share/settings/Ringtones/";
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return NULL;
- }
-
- /*ret = app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, %d", ret);
- goto MYFILE_END;
- }*/
-
- ret = app_control_add_extra_data(handle, "marked_mode", pa_cur_ringtone);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto MYFILE_END;
- }
-
- ret = app_control_add_extra_data(handle, "path", dir_path);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto MYFILE_END;
- }
-
- ret = app_control_add_extra_data(handle, "select_type", "SINGLE_FILE");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto MYFILE_END;
- }
-
- ret = app_control_add_extra_data(handle, "drm_type", "DRM_ALL");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto MYFILE_END;
- }
-
- /*const char *pkgname = MYFILE_UG_NAME;
-
- ret = app_control_set_package(handle, pkgname);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto MYFILE_END;
- }*/
-
- ug = _ivug_ext_launch_ug_with_result(MYFILE_UG_NAME, handle, result_func, destroy_func, data);
-
-MYFILE_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return NULL;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? ug : NULL);
-}
-#endif
-
-#ifdef IV_EXTENDED_FEATURES
-app_control_h ivug_ext_launch_image_editor(const char *uri, app_control_reply_cb callback, void *data)
-{
- MSG_IMAGEVIEW_HIGH("%s, uri=%s", __func__, uri);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- ret = app_control_set_window(handle, win_id);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto IE_END;
- }
-
- ret = app_control_set_app_id(handle, IMAGE_EDITOR_PKG_NAME);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_app_id failed, %d", ret);
- goto IE_END;
- }
-
- ret = app_control_set_uri (handle, uri);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, %d", ret);
- goto IE_END;
- }
-
- ret = app_control_send_launch_request(handle, callback, data);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto IE_END;
- }
-
- return handle;
-
-IE_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return NULL;
-}
-
-
-bool ivug_ext_launch_default(const char *uri, const char *operation, const char *pkg, const char *mime, void *data)
-{
-// Share Panel!
-
- MSG_IMAGEVIEW_SEC("operation = %s, uri = %s, mime = %s", operation, uri, mime);
-
- int ret = -1;
- int destroy_ret = -1;
-
- char buf[IVUG_MAX_FILE_PATH_LEN] = {0, };
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- ret = app_control_set_operation(handle, operation);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation %s failed, %d", operation, ret);
- goto LAUNCH_END;
- }
-
- snprintf(buf, (size_t)sizeof(buf), "%s", uri);
- if (ivug_is_web_uri(uri) == false && ivug_is_tel_uri(uri) == false)
- {
- if (strncmp(uri, FILE_PREFIX, strlen(FILE_PREFIX)) != 0)
- {
- snprintf(buf, (size_t)sizeof(buf), "%s%s", FILE_PREFIX, uri);
- MSG_IMAGEVIEW_SEC("changed uri = %s", buf);
- }
- }
-
- ret = app_control_set_uri (handle, buf);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri %s failed, %d", uri, ret);
- goto LAUNCH_END;
- }
-
- if (pkg)
- {
- ret = app_control_set_app_id(handle, pkg);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_app_id %s failed, %d", pkg, ret);
- goto LAUNCH_END;
- }
- }
- else
- {
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- ret = app_control_set_window(handle, win_id);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_window failed, %d", ret);
- goto LAUNCH_END;
- }
- }
-
- if (mime)
- {
- ret = app_control_set_mime(handle, mime);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_mime failed, %d", ret);
- goto LAUNCH_END;
- }
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto LAUNCH_END;
- }
-
-LAUNCH_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-#endif
-
-
-#ifdef IV_EXTENDED_FEATURES
-bool ivug_ext_launch_allshare_cast(const char *szMacAddr, void *pUserData)
-{
- app_control_h pService = NULL;
-
- int nRet = 0;
- nRet = app_control_create(&pService);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_create is fail [0x%x]", nRet);
- goto Execption;
- }
-
- MSG_IMAGEVIEW_ERROR("Mac Addr : %s", szMacAddr);
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- nRet = app_control_set_window(pService, win_id);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_set_window is fail [0x%x]", nRet);
- goto Execption;
- }
-
- nRet = app_control_add_extra_data(pService,"-t","connection_req");
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data is fail [0x%x]", nRet);
- goto Execption;
- }
-
- nRet = app_control_add_extra_data(pService,"mac",szMacAddr);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data is fail [0x%x]", nRet);
- goto Execption;
- }
-
- nRet = app_control_set_app_id(pService, ALLSHARE_CAST_APP_NAME);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_set_app_id is fail [0x%x]", nRet);
- goto Execption;
- }
-
- nRet = app_control_send_launch_request(pService, ivug_ext_app_control_reply_cb, pUserData);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request is fail [0x%x]", nRet);
- goto Execption;
- }
-
- app_control_destroy(pService);
- pService = NULL;
-
- return TRUE;
-
-Execption:
- if (pService) {
- app_control_destroy(pService);
- pService = NULL;
- }
- return FALSE;
-
-}
-
-bool ivug_ext_launch_map(double latitude, double longitude, void *pUserData)
-{
- app_control_h pService = NULL;
-
- char buf[IVUG_MAX_FILE_PATH_LEN] = {0, };
-
- int nRet = 0;
- nRet = app_control_create(&pService);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_create is fail [0x%x]", nRet);
- goto MAP_END;
- }
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- nRet = app_control_set_window(pService, win_id);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_set_window is fail [0x%x]", nRet);
- goto MAP_END;
- }
-
- nRet = app_control_set_operation(pService, "http://tizen.org/appcontrol/operation/view");
- if (nRet != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, [0x%x]", nRet);
- goto MAP_END;
- }
-
- snprintf(buf, (size_t)sizeof(buf), "geo:%lf,%lf", latitude, longitude);
- MSG_IMAGEVIEW_HIGH("app_control_set_uri %s", buf);
-
- nRet = app_control_set_uri(pService, buf);
- if (nRet != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, [0x%x]", nRet);
- goto MAP_END;
- }
-
- nRet = app_control_send_launch_request(pService, ivug_ext_app_control_reply_cb, pUserData);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request is fail [0x%x]", nRet);
- goto MAP_END;
- }
-
- app_control_destroy(pService);
- pService = NULL;
-
- return TRUE;
-
-MAP_END:
- if (pService) {
- app_control_destroy(pService);
- pService = NULL;
- }
- return FALSE;
-
-}
-
-
-bool ivug_ext_launch_map_direction(double d_latitude, double d_longitude, void *pUserData)
-{
- app_control_h pService = NULL;
-
- char buf[IVUG_MAX_FILE_PATH_LEN] = {0, };
-
- int nRet = 0;
- nRet = app_control_create(&pService);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_create is fail [0x%x]", nRet);
- goto MAP_END;
- }
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- nRet = app_control_set_window(pService, win_id);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_set_window is fail [0x%x]", nRet);
- goto MAP_END;
- }
-
- nRet = app_control_set_operation(pService, "http://tizen.org/appcontrol/operation/search_directions");
- if (nRet != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_operation failed, [0x%x]", nRet);
- goto MAP_END;
- }
-
- snprintf(buf, (size_t)sizeof(buf), "geo:0,0?dest_addr=%lf:%lf", d_latitude, d_longitude);
- MSG_IMAGEVIEW_HIGH("app_control_set_uri %s", buf);
-
- nRet = app_control_set_uri(pService, buf);
- if (nRet != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, [0x%x]", nRet);
- goto MAP_END;
- }
-
- nRet = app_control_send_launch_request(pService, ivug_ext_app_control_reply_cb, pUserData);
- if (nRet != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request is fail [0x%x]", nRet);
- goto MAP_END;
- }
-
- app_control_destroy(pService);
- pService = NULL;
-
- return TRUE;
-
-MAP_END:
- if (pService) {
- app_control_destroy(pService);
- pService = NULL;
- }
- return FALSE;
-
-}
-
-bool ivug_ext_launch_share_text(const char *text)
-{
- MSG_IMAGEVIEW_HIGH("%s, text=%s", __func__, text);
-
- int ret = -1;
- int destroy_ret = -1;
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- ret = app_control_set_window(handle, win_id);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto SHARE_TEXT_END;
- }
-
- ret = app_control_set_operation(handle, "http://tizen.org/appcontrol/operation/share_text");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- goto SHARE_TEXT_END;
- }
-
- ret = app_control_add_extra_data(handle, APP_CONTROL_DATA_TEXT, text);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto SHARE_TEXT_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto SHARE_TEXT_END;
- }
-
-SHARE_TEXT_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-}
-
-static bool _data_set(app_control_h service, const char *key, void *user_data)
-{
- char *value;
-
- app_control_h handle = (app_control_h)user_data;
-
- app_control_get_extra_data(service, key, &value);
- MSG_IVUG_HIGH(" %s : %s", key, value);
-
- int ret = app_control_add_extra_data(handle, key, value);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- }
-
- free(value);
-
- return true;
-}
-#endif
-
-bool ivug_ext_launch_slideshow(const char *path, int index)
-{
-#ifndef USE_THUMBLIST
- MSG_IMAGEVIEW_HIGH("%s, path=%s, index=%d", __func__, path, index);
-
- int ret = -1;
- int destroy_ret = -1;
- char str_index[12] = {0,};
-
- app_control_h handle;
-
- ret = app_control_create(&handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- return false;
- }
-
- Ecore_X_Window win_id = elm_win_xwindow_get(ug_get_window());
- ret = app_control_set_window(handle, win_id);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- ret = app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_create failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- ret = app_control_foreach_extra_data(handle, _data_set, handle);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_foreach_extra_data failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- ret = app_control_add_extra_data(handle, "View Mode", "SLIDESHOW");
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- ret = app_control_set_uri(handle, path);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_uri failed, [0x%x]", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- eina_convert_itoa(index, str_index);
- ret = app_control_add_extra_data(handle, "Index", str_index);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- ret = app_control_set_app_id(handle, IMAGE_VIEWER_PKG_NAME);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_set_app_id failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
- ret = app_control_send_launch_request(handle, ivug_ext_app_control_reply_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_send_launch_request failed, %d", ret);
- goto EXT_SLIDESHOW_END;
- }
-
-EXT_SLIDESHOW_END:
- destroy_ret = app_control_destroy(handle);
- if (destroy_ret != APP_CONTROL_ERROR_NONE)
- {
- MSG_IMAGEVIEW_ERROR("app_control_destroy failed, %d", destroy_ret);
- return false;
- }
-
- return (ret == APP_CONTROL_ERROR_NONE ? true : false);
-#else
- return false;
-#endif
-}
-
MSG_IMAGEVIEW_HIGH("Send load started event to caller");
}
-static void _on_base_deleted(void * data, Evas * e, Evas_Object * obj, void * event_info)
-{
- MSG_IMAGEVIEW_ERROR("_on_base_deleted");
-}
-
static void launch_image_viewer(app_control_h service, ug_data *ugd)
{
MSG_IMAGEVIEW_HIGH("Image Viewer BEGIN %s, ", __func__);
- PERF_CHECK_END(LVL0, "On Create -> On Start");
-
- PERF_CHECK_BEGIN(LVL0, "On Start");
-
if (!ugd) {
MSG_IMAGEVIEW_ERROR("Invalid UG. Data=0x%08x", ugd);
return ;
MSG_IMAGEVIEW_HIGH("Image Viewer : %s BaseGeometry(%d,%d,%d,%d)", __func__, ux, uy, uw, uh);
if (ugd->bError == true) {
- PERF_CHECK_END(LVL0, "On Start");
MSG_IMAGEVIEW_ERROR("UG create has ERROR");
notification_status_message_post(GET_STR(IDS_UNABLE_TO_OPEN_FILE));
- //ug_destroy_me(gGetUGHandle());
return;
}
if (ugd->main_view) {
- PERF_CHECK_BEGIN(LVL1, "main_view_start");
ivug_main_view_start(ugd->main_view, service);
- PERF_CHECK_END(LVL1, "main_view_start");
} else if (ugd->crop_ug) {
ivug_crop_ug_start(ugd->crop_ug);
}
ivug_add_reg_idler(ugd->main_view);
- PERF_CHECK_END(LVL0, "On Start");
-
if (ugd->ivug_param->bStandalone == true) {
_send_result_to_caller();
}
}
} else {
- PERF_CHECK_BEGIN(LVL1, "main_view_create");
-
ivug_set_indicator_visibility(ugd->window, false); // Set indicator visibility false.
ivug_set_indicator_overlap_mode(true); // Set comformant as no indicator mode
ugd->main_view = ivug_main_view_create(ugd->base, ugd->ivug_param);
- PERF_CHECK_END(LVL1, "main_view_create");
-
if (ugd->main_view == NULL) { //set main view.
MSG_ERROR("Main View Layout Loading Fail");
ugd->bError = true;
}
// Load list.
- PERF_CHECK_BEGIN(LVL1, "main_view_set_list");
if (ivug_main_view_set_list(ugd->main_view, ugd->ivug_param) == false) {
MSG_ERROR("Cannot load media list.");
Evas_Object *layout = ivug_main_view_object_get(ugd->main_view);
elm_object_part_content_set(ugd->base, "elm.swallow.content", layout); //swallow
-
- PERF_CHECK_END(LVL1, "main_view_set_list");
}
- PERF_CHECK_END(LVL0, "On Create");
-
-
- PERF_CHECK_BEGIN(LVL0, "On Create -> On Start");
-
evas_object_size_hint_weight_set(ugd->base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
int ux, uy, uw, uh;
MSG_MAIN_HIGH("Image Viewer : %s Base(0x%08x) Geometry(%d,%d,%d,%d)", __func__, ugd->base, ux, uy, uw, uh);
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_DEL, _on_base_deleted, ugd);
-
/*Added from on_start*/
launch_image_viewer(service, ugd);
return;
#include "ivug-common.h"
#include "ivug-util.h"
#include "ivug-popup.h"
-
#include "ivug-callback.h"
#include "ivug-context.h"
#include "ivug-language-mgr.h"
#include "ivug-base.h"
-void FreeUGData(ug_data *ug)
-{
- IV_ASSERT(ug != NULL);
-
- free(ug);
-}
-
-#ifdef TRACE_WINDOW
-static void _on_win_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Evas_Coord x, y, w, h;
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- MSG_IMAGEVIEW_HIGH("Parent win(0x%08x) resized geomtery XYWH(%d,%d,%d,%d) angle=%d", obj, x, y, w, h, elm_win_rotation_get((Evas_Object *)ug_get_window()));
-}
-
-static void _on_win_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Evas_Coord x, y, w, h;
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- MSG_IMAGEVIEW_HIGH("Parent win(0x%08x) moved geomtery XYWH(%d,%d,%d,%d) angle=%d", obj, x, y, w, h, elm_win_rotation_get((Evas_Object *)ug_get_window()));
-}
-#endif
-
-
-static void _on_base_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Evas_Coord x, y, w, h;
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- MSG_IMAGEVIEW_HIGH("Base layout(0x%08x) resized geomtery XYWH(%d,%d,%d,%d)", obj, x, y, w, h);
-}
-
-static void _on_base_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Evas_Coord x, y, w, h;
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- MSG_IMAGEVIEW_HIGH("Base layout(0x%08x) moved geomtery XYWH(%d,%d,%d,%d)", obj, x, y, w, h);
-}
-
-
-static void _on_base_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- MSG_IMAGEVIEW_HIGH("Base(0x%08x) layout show", obj);
-}
-
-static void _on_base_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- MSG_IMAGEVIEW_HIGH("Base(0x%08x) layout hide", obj);
-}
-
-static void _on_receive_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("Base layout(0x%08x) clicked : %s Layer=%d", obj, evas_object_name_get(obj), evas_object_layer_get(obj));
-}
-
static Eina_Bool _on_exit_timer_expired(void *data)
{
ivug_retv_if(!data, ECORE_CALLBACK_CANCEL);
}
}
-static void _on_base_deleted(void * data, Evas * e, Evas_Object * obj, void * event_info)
-{
- MSG_IMAGEVIEW_ERROR("_on_base_deleted");
-}
-
Evas_Object *create_layout(Evas_Object *parent, const char *edj, const char *group)
{
IV_ASSERT(parent != NULL);
MSG_MED("on_create.");
- /*Evas_Object *conform = (Evas_Object *)ug_get_conformant();
- IV_ASSERT(conform != NULL);*/
-
- PERF_CHECK_END(LVL0, "UG_MODULE_INIT -> On Create");
-
- PERF_CHECK_BEGIN(LVL0, "On Create");
-
MSG_MED("on_create. IV & PRIV");
if (!priv) {
evas_object_show(win);
elm_win_conformant_set(win, EINA_TRUE);
- PERF_CHECK_BEGIN(LVL1, "init context");
if (!ivug_context_init(win, conform)) {
MSG_ERROR("ivug_main_init error");
return false;
}
- PERF_CHECK_END(LVL1, "init context");
- PERF_CHECK_BEGIN(LVL1, "creating base");
ugd->base = create_fullview(conform);
elm_object_content_set(conform, ugd->base);
- PERF_CHECK_END(LVL1, "creating base");
-
if (ugd->base == NULL) {
MSG_ERROR("Cannot create base view");
ugd->bError = true;
MSG_MAIN_HIGH("UG base created : 0x%08x (%d,%d,%d,%d)", ugd->base, ux1, uy1, uw1, uh1);
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_MOUSE_DOWN, _on_receive_mouse_down, NULL);
-
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_RESIZE, _on_base_resize, ugd);
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_MOVE, _on_base_move, NULL);
-
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_SHOW, _on_base_show, NULL);
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_HIDE, _on_base_hide, NULL);
-
-#ifdef TRACE_WINDOW
- evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _on_win_resize, NULL);
- evas_object_event_callback_add(win, EVAS_CALLBACK_MOVE, _on_win_move, NULL);
-#endif
-
error_code = storage_set_changed_cb(STORAGE_TYPE_EXTERNAL, _on_mmc_state_changed, ugd);
if (error_code != STORAGE_ERROR_NONE) {
MSG_MAIN_ERROR("storage_set_state_changed_cb() failed!!");
{
MSG_IMAGEVIEW_HIGH("Image Viewer : %s(0x%08x) data=0x%08x", __func__, on_destroy, priv);
- PERF_CHECK_BEGIN(LVL0, "On Destroy");
-
if (!priv) {
MSG_MAIN_ERROR("Invalid UG. Priv=0x%08x",priv);
return ;
ugd->crop_ug = NULL;
}
- //destroy main view.
+ /*Destroy main view.*/
if (ugd->main_view) {
- PERF_CHECK_BEGIN(LVL1, "MainView");
ivug_main_view_destroy(ugd->main_view);
ugd->main_view = NULL;
- PERF_CHECK_END(LVL1, "MainView");
}
if (ugd->ss_view) {
- PERF_CHECK_BEGIN(LVL1, "SlideShowView");
ivug_slideshow_view_destroy(ugd->ss_view);
ugd->ss_view = NULL;
- PERF_CHECK_END(LVL1, "SlideShowView");
}
- //delete param.
+ /*Delete param.*/
if (ugd->ivug_param) {
ivug_param_delete(ugd->ivug_param);
ugd->ivug_param = NULL;
}
- //finalize data
- PERF_CHECK_BEGIN(LVL1, "Context");
+ /*Finalize data*/
if (!ivug_context_deinit()) {
MSG_IMAGEVIEW_ERROR("ivug_main_deinit failed");
}
- PERF_CHECK_END(LVL1, "Context");
- if (ugd->base) {
- PERF_CHECK_BEGIN(LVL1, "Base layout");
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_MOUSE_DOWN, _on_receive_mouse_down);
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_RESIZE, _on_base_resize);
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_MOVE, _on_base_move);
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _on_base_show);
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_HIDE, _on_base_hide);
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_DEL, _on_base_deleted);
+ if (ugd->base) {
evas_object_del(ugd->base);
ugd->base = NULL;
- PERF_CHECK_END(LVL1, "Base layout");
}
MSG_IMAGEVIEW_HIGH("Destroyed ug");
-
- PERF_CHECK_END(LVL0, "On Destroy");
-}
-
-void _language_changed_cb(void *user_data)
-{
- MSG_IMAGEVIEW_HIGH("Image Viewer : %s", __func__);
-
}
#include <efl_extension.h>
#include "ivug-popup.h"
-#include "ivug-vibration.h"
#include "ivug-name-view.h"
#include "ivug-language-mgr.h"
Popup_Response response;
-#ifdef USE_MAXLENGTH_VIBE
- vibration_h haptic_handle;
-#endif
-
Evas_Smart_Cb callback;
void *data;
{
Ivug_Popup *iv_popup = calloc(1, sizeof(Ivug_Popup));
-#ifdef USE_MAXLENGTH_VIBE
- iv_popup->haptic_handle = INVALID_HAPTIC_HANDLE;
-#endif
-
return iv_popup;
}
static void ivug_popup_delete(Ivug_Popup *iv_popup)
{
-#ifdef USE_MAXLENGTH_VIBE
- if (iv_popup->haptic_handle != INVALID_HAPTIC_HANDLE)
- {
- ivug_vibration_stop(iv_popup->haptic_handle);
- ivug_vibration_delete(iv_popup->haptic_handle);
-
- iv_popup->haptic_handle = INVALID_HAPTIC_HANDLE;
- }
-#endif
-
if (iv_popup->popup)
{
evas_object_del(iv_popup->popup);
free(content);
}
-void
-_ivug_rename_maxlength_reached(void *data, Evas_Object *obj, void *event_info)
-{
-#ifdef USE_MAXLENGTH_VIBE
- Ivug_Popup *iv_popup = (Ivug_Popup *)data;
- IV_ASSERT(iv_popup != NULL);
-
- if (iv_popup->haptic_handle == INVALID_HAPTIC_HANDLE)
- {
- iv_popup->haptic_handle = ivug_vibration_create();
- if (iv_popup->haptic_handle == INVALID_HAPTIC_HANDLE)
- {
- MSG_IMAGEVIEW_ERROR("ivug_vibration_create failed");
- return;
- }
- }
- else
- {
- ivug_vibration_stop(iv_popup->haptic_handle);
- }
-
- ivug_vibration_play(iv_popup->haptic_handle ,VIBRATION_DURATION);
-#endif
-}
-
Evas_Object *ivug_rename_popup_show(Evas_Object *parent, const char *filename, Evas_Smart_Cb response, void *data)
{
Evas_Object *popup = NULL;
MSG_IMAGEVIEW_ERROR("popup is NULL");
goto ENTRY_POPUP_FREE;
}
- //evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- //elm_object_style_set(popup, "menustyle");
+
elm_object_part_text_set(popup, "title,text", "Rename");
char *popup_edj = IVUG_POPUP_EDJ_NAME;
limit_filter_data.max_char_count = 64;
limit_filter_data.max_byte_count = 0;
elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
- evas_object_smart_callback_add(entry, "maxlength,reached", _ivug_rename_maxlength_reached, (void *)iv_popup);
evas_object_show(layout);
*
*/
-#include <algorithm> // std::swap
+#include <algorithm>
#include <pthread.h>
return NULL;
}
- PERF_CHECK_BEGIN(LVL3, "create slider layout");
-
slider_new->parent = parent;
slider_new->mainTID = pthread_self();
MSG_WARN("main tid = 0x%08x", slider_new->mainTID);
evas_object_smart_member_add(slider_new->icon_layer, _EDJ(slider_new->layout));
}
-#if 1
int x, y, w, h;
evas_object_geometry_get(gGetCurrentWindow(), &x, &y, &w, &h);
-#else
-// \B0\A1\B7η\CE \BD\C3\C0\DB\C7ϴ\C2 \B0\E6\BF\EC \B5\BF\C0\DB \C0̻\F3\C7\D4.
- int w, h;
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); // Portrait size.
-#endif
-
- PERF_CHECK_END(LVL3, "create slider layout");
-
- PERF_CHECK_BEGIN(LVL3, "QPhotoAPI::create()");
//Qphoto_init();
-
-#if (1)
evas_object_event_callback_add(slider_new->layout, EVAS_CALLBACK_RESIZE, _on_obj_resize, slider_new);
evas_object_event_callback_add(slider_new->layout, EVAS_CALLBACK_MOVE, _on_obj_move, slider_new);
evas_object_event_callback_add(slider_new->layout, EVAS_CALLBACK_SHOW, _on_obj_show, NULL);
evas_object_event_callback_add(slider_new->layout, EVAS_CALLBACK_HIDE, _on_obj_hide, NULL);
-#endif
+
return slider_new;
}
#include "ivug-file-info.h"
#include "ivug-thumblist.h"
-#include "ivug-exif.h"
-
#include <storage/storage.h>
#include <shortcut_manager.h>
#include <efl_extension.h>
#include "ivug-db.h"
#include "ivug-crop-view.h"
#include "ivug-util.h"
-#include "ivug-comment.h"
#include "ivug-config.h"
#include "ivug-language-mgr.h"
-#include "ivug-transcoder.h"
#define GALLERY_PKG_NAME "com.samsung.gallery"
#define SHORTCUT_PREFIX "gallery:imageviewer:"
#define SHORTCUT_PREFIX_LEN strlen(SHORTCUT_PREFIX)
-
-
-
-
#define ICON_EDJ_PATH full_path(EDJ_PATH, "/ivug-icons.edj")
#define ICON_NEAR_BY_PHONE "icon.nearby.phone"
#define ICON_NEAR_BY_UNKNOWN "icon.nearby.unknown"
return ECORE_CALLBACK_CANCEL;
}
-static void _launch_share_app(Ivug_MainView *pMainView, const char* filepath)
-{
- if (pMainView->back_timer) {
- ecore_timer_del(pMainView->back_timer);
- }
- pMainView->back_timer = ecore_timer_add(0.5, _on_back_timer_expired, pMainView);
- pMainView->bPreventBackKey = true;
-
-#ifdef IV_EXTENDED_FEATURES
- ivug_ext_launch_default(filepath, "http://tizen.org/appcontrol/operation/share", NULL, NULL, NULL);
-#endif
-}
-
bool ivug_is_agif(Ivug_MainView *pMainView, const char *filepath)
{
Evas_Object *obj = evas_object_image_add(evas_object_evas_get(gGetCurrentWindow()));
return evas_object_image_animated_get(obj);
}
-static void _on_add_tag_view_destroy(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("transition finished");
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- ivug_name_view_destroy(pMainView->pNameView);
- pMainView->pNameView = NULL;
-
- evas_object_smart_callback_del(pMainView->navi_bar, "transition,finished",
- _on_add_tag_view_destroy);
-}
-
-static void _on_add_tag_view_response(Ivug_NameView *pView, ivug_name_response resp, const char *str, void *pClientData)
-{
- Ivug_MainView *pMainView = (Ivug_MainView *)pClientData;
-
- switch (resp) {
- case NAME_VIEW_RESPONSE_OK:
-
- evas_object_smart_callback_add(pMainView->navi_bar, "transition,finished",
- _on_add_tag_view_destroy, pMainView);
-
- elm_naviframe_item_pop(pMainView->navi_bar);
-
- pMainView->navi_it = elm_naviframe_top_item_get(pMainView->navi_bar);
-
- break;
- case NAME_VIEW_RESPONSE_CANCEL:
- MSG_MAIN_HIGH("Add tag is canceled");
- evas_object_smart_callback_add(pMainView->navi_bar, "transition,finished",
- _on_add_tag_view_destroy, pMainView);
-
- elm_naviframe_item_pop(pMainView->navi_bar);
-
- pMainView->navi_it = elm_naviframe_top_item_get(pMainView->navi_bar);
-
- break;
- default:
- MSG_MAIN_ERROR("Unhandled mode : %d", resp);
- break;
- }
-
- ivug_main_view_set_hide_timer(pMainView);
-}
-
-#if 0
-static void _on_edit_weather_view_destroy(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("transition finished");
-
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- evas_object_smart_callback_del(pMainView->navi_bar, "transition,finished",
- _on_edit_weather_view_destroy);
-}
-#endif
-
-#if 0
-static void _ivug_crop_view_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- char *path = (char *)event_info;
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- MSG_MAIN_HIGH("_ivug_crop_view_ok_clicked_cb path=%s", path);
-
- evas_object_smart_callback_del(obj, "ok,clicked", _ivug_crop_view_ok_clicked_cb);
-
- if (path == NULL) {
- MSG_MAIN_ERROR("Crop failed! pMainView(0x%08x)", pMainView);
- return ;
- }
-
- media_handle m_handle = NULL;
-
- m_handle = ivug_db_insert_file_to_DB(path);
- if (m_handle == NULL) {
- MSG_MAIN_ERROR("ivug_db_insert_file_to_DB failed %s", path);
- } else {
- ivug_db_destroy_file_handle(m_handle);
- }
-
-
- Media_Item *mitem = ivug_medialist_prepend_item(pMainView->mList, path);
-
-#ifdef USE_THUMBLIST
- Media_Data *mdata = ivug_medialist_get_data(mitem);
- if (pMainView->thumbs) {
- bool bVideo = (mdata->slide_type == SLIDE_TYPE_VIDEO);
- Image_Object *img = ivug_thumblist_prepend_item(pMainView->thumbs, mdata->thumbnail_path, bVideo, mitem);
- ivug_thumblist_select_item(pMainView->thumbs, img); // set focus to cropped image
- }
-#endif
-
- ivug_medialist_set_current_item(pMainView->mList, mitem);
- ivug_slider_new_update_list(pMainView->pSliderNew, pMainView->mList);
-}
-#endif
-
-void *ivug_listpopup_item_get_data(Ivug_ListPopup_Item *item)
-{
- IV_ASSERT(item != NULL);
-
- return item->data;
-}
-
-const char *ivug_listpopup_item_get_text(Ivug_ListPopup_Item *item)
-{
- IV_ASSERT(item != NULL);
-
- return item->caption_id;
-}
-
-void _on_addtag_selected(void *data, Evas_Object *obj, void *event_info)
-{
- IV_ASSERT(data != NULL);
-
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)event_info;
-
- const char *label = ivug_listpopup_item_get_text(item);
-
- if (label == NULL) {
- MSG_MAIN_ERROR("label is NULL");
- evas_object_del(pMainView->ctx_popup2);
- pMainView->ctx_popup2 = NULL;
- ivug_main_view_set_hide_timer(pMainView);
- return;
- }
-
- MSG_MAIN_HIGH("text(%s) is clicked", label);
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
- if (mdata == NULL) {
- MSG_MAIN_ERROR("sd is NULL");
- evas_object_del(pMainView->ctx_popup2);
- pMainView->ctx_popup2 = NULL;
- ivug_main_view_set_hide_timer(pMainView);
- return;
- }
-
- if (strncmp(label, IDS_CREATE_TAG, strlen(label)) == 0) {
- pMainView->pNameView = ivug_name_view_create(pMainView->layout, NAME_VIEW_MODE_SINGLE_LINE);
- IV_ASSERT(pMainView->pNameView != NULL);
-
- ivug_name_view_set_title(pMainView->pNameView, IDS_CREATE_TAG);
- ivug_name_view_set_max_length(pMainView->pNameView, MAX_BYTE_LEN);
- ivug_name_view_set_guide_text(pMainView->pNameView, IDS_TAG);
-
- ivug_name_view_set_response_callback(pMainView->pNameView, _on_add_tag_view_response, (void*)pMainView);
-
- Evas_Object *layout = ivug_name_view_object_get(pMainView->pNameView);
-
- pMainView->navi_it = elm_naviframe_item_push(pMainView->navi_bar, NULL, NULL, NULL, layout, NULL);
-
- elm_naviframe_item_title_enabled_set(pMainView->navi_it, EINA_FALSE, EINA_FALSE);
- elm_object_item_signal_emit(pMainView->navi_it, "elm,state,toolbar,close", "");
-
- ivug_name_view_set_focus(pMainView->pNameView);
- } else if (strncmp(label, IDS_FAVOURITE, strlen(label)) == 0) {
- if (ivug_mediadata_set_favorite(mdata, true) == false) {
- MSG_MAIN_ERROR("Error!. Set favorite for ID=%s", uuid_getchar(mdata->mediaID));
- goto ADD_FAIL;
- }
-
- ivug_main_view_set_hide_timer(pMainView);
- } else {
- bool ret = ivug_mediadata_set_tag(mdata, (char *)label);
- if (ret == false) {
- goto ADD_FAIL;
- }
- ivug_main_view_set_hide_timer(pMainView);
- }
-
- evas_object_del(pMainView->ctx_popup2);
- pMainView->ctx_popup2 = NULL;
-
- return;
-ADD_FAIL:
- evas_object_del(pMainView->ctx_popup2);
- pMainView->ctx_popup2 = NULL;
-
- ivug_main_view_set_hide_timer(pMainView);
-
- return;
-
-}
-
static bool _save_to_folder(Ivug_MainView *pMainView, const char *path, const char *folder)
{
char dest_file[IVUG_MAX_FILE_PATH_LEN + 1] = {0,};
const char *new_filename = ivug_file_get(path);
char *temp_filename = NULL;
char error_msg[256] = {0,};
- //int err = 0;
if (new_filename == NULL) {
MSG_MAIN_ERROR("File does not exist filepath=%s", path);
MSG_MAIN_WARN("Destination path doesn't exist. %s", folder);
if (mkdir(folder, DIR_MASK_DEFAULT) != 0) {
if (errno != EEXIST) {
- //err = strerror_r(errno, error_msg, sizeof(error_msg));
MSG_MAIN_ERROR("Cannot make dir=%s error=%s", DIR_MASK_DEFAULT, strerror_r(errno, error_msg, sizeof(error_msg)));
- // return false; // TODO: Need to test.
}
}
}
return true;
}
-static void _on_save_view_destroy(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("transition finished");
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- ivug_name_view_destroy(pMainView->pNameView);
- pMainView->pNameView = NULL;
-
- evas_object_smart_callback_del(pMainView->navi_bar, "transition,finished",
- _on_save_view_destroy);
-}
-
-static void _on_save_view_response(Ivug_NameView *pView, ivug_name_response resp, const char *str, void *pClientData)
-{
- Ivug_MainView *pMainView = (Ivug_MainView *)pClientData;
- Media_Item *mitem = NULL;
- Media_Data *mdata = NULL;
-
- char buf[IVUG_MAX_FILE_PATH_LEN];
-
- switch (resp) {
- case NAME_VIEW_RESPONSE_OK:
- mitem = ivug_medialist_get_current_item(pMainView->mList);
- mdata = ivug_medialist_get_data(mitem);
-
- snprintf(buf, (size_t)sizeof(buf), "%s/%s", DEFAULT_IMAGE_FOLDER, str);
- _save_to_folder(pMainView, mdata->filepath, buf);
-
- evas_object_smart_callback_add(pMainView->navi_bar, "transition,finished",
- _on_save_view_destroy, pMainView);
-
- elm_naviframe_item_pop(pMainView->navi_bar);
-
- pMainView->navi_it = elm_naviframe_top_item_get(pMainView->navi_bar);
-
- break;
- case NAME_VIEW_RESPONSE_CANCEL:
- MSG_MAIN_HIGH("Create album is canceled");
- evas_object_smart_callback_add(pMainView->navi_bar, "transition,finished",
- _on_save_view_destroy, pMainView);
-
- elm_naviframe_item_pop(pMainView->navi_bar);
-
- pMainView->navi_it = elm_naviframe_top_item_get(pMainView->navi_bar);
-
- break;
- default:
- MSG_MAIN_ERROR("Unhandled mode : %d", resp);
- break;
- }
-
- ivug_main_view_set_hide_timer(pMainView);
-}
-
-void _on_save_selected(void *data, Evas_Object *obj, void *event_info)
-{
- IV_ASSERT(data != NULL);
-
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)event_info;
-
- const char *label = ivug_listpopup_item_get_text(item);
-
- if (label == NULL) {
- MSG_MAIN_ERROR("label is NULL");
- evas_object_del(pMainView->popup);
- pMainView->popup = NULL;
- ivug_main_view_set_hide_timer(pMainView);
- return;
- }
-
- MSG_MAIN_HIGH("Selected folder name = %s", label);
-
- char dst_file[IVUG_MAX_FILE_PATH_LEN + 1] = {0,};
- char *dst_path = (char *)ivug_listpopup_item_get_data(item);
- const char *filename = NULL;
- media_handle m_handle = NULL;
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
- if (mdata == NULL) {
- MSG_MAIN_ERROR("Cannot get slide data.");
- goto SAVE_FAIL;
- }
-
- if (strncmp(label, IDS_CREATE_ALBUM, strlen(label)) == 0) {
- pMainView->pNameView = ivug_name_view_create(pMainView->layout, NAME_VIEW_MODE_SINGLE_LINE);
- IV_ASSERT(pMainView->pNameView != NULL);
-
- ivug_name_view_set_title(pMainView->pNameView, IDS_CREATE_ALBUM);
- ivug_name_view_set_max_length(pMainView->pNameView, MAX_BYTE_LEN);
- ivug_name_view_set_guide_text(pMainView->pNameView, IDS_ENTER_NAME);
- ivug_name_view_set_filter_text(pMainView->pNameView, INVALID_FILENAME_CHAR);
-
- ivug_name_view_set_response_callback(pMainView->pNameView, _on_save_view_response, (void*)pMainView);
-
- Evas_Object *layout = ivug_name_view_object_get(pMainView->pNameView);
-
- pMainView->navi_it = elm_naviframe_item_push(pMainView->navi_bar, NULL, NULL, NULL, layout, NULL);
-
- elm_naviframe_item_title_enabled_set(pMainView->navi_it, EINA_FALSE, EINA_FALSE);
- elm_object_item_signal_emit(pMainView->navi_it, "elm,state,toolbar,close", "");
-
- ivug_name_view_set_focus(pMainView->pNameView);
- return;
- }
-
- filename = ivug_file_get(mdata->filepath);
- if (filename == NULL) {
- MSG_MAIN_ERROR("File does not existfilepath=%s", mdata->filepath);
- goto SAVE_FAIL;
- }
-
- snprintf(dst_file, IVUG_MAX_FILE_PATH_LEN, "%s/%s", dst_path, filename);
-
- if (!ivug_file_cp(mdata->filepath, dst_file)) {
- MSG_MAIN_ERROR("ivug_file_cp failed. From %s To %s", mdata->filepath, dst_file);
- goto SAVE_FAIL;
- }
-
- m_handle = ivug_db_insert_file_to_DB(dst_file);
- if (m_handle == NULL) {
- MSG_MAIN_ERROR("ivug_db_insert_file_to_DB failed %s", dst_file);
- } else {
- ivug_db_destroy_file_handle(m_handle);
- }
-
- if (dst_path) {
- free(dst_path);
- }
-
- evas_object_del(pMainView->popup);
- pMainView->popup = NULL;
-
- ivug_main_view_set_hide_timer(pMainView);
-
- return;
-
-SAVE_FAIL:
- if (dst_path) {
- free(dst_path);
- }
-
- evas_object_del(pMainView->popup);
- pMainView->popup = NULL;
-
- ivug_main_view_set_hide_timer(pMainView);
-
- return;
-}
-
static bool _idler_delete_end(void *data)
{
Ivug_MainView *pMainView = (Ivug_MainView *)data;
}
}
-void on_btn_copy_clicked(void *data, Evas_Object *obj, void *event_info)
-{
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
- IV_ASSERT(pMainView != NULL);
-
- // Destroy copy popup
- pMainView->longpress_popup = NULL;
- // object is removed automatically
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
-
- if (mdata == NULL) {
- MSG_MAIN_ERROR("slider data is NULL");
- return;
- }
-
- int len = 0;
- // This Will add to the article
- char buf[IVUG_MAX_FILE_PATH_LEN] = {0,};
- len = strlen(mdata->filepath) + strlen("file://") + 1;
- snprintf(buf, IVUG_MAX_FILE_PATH_LEN, "file://%s", mdata->filepath);
-
-
- if (len < IVUG_MAX_FILE_PATH_LEN) {
- Eina_Bool bRet;
-
- if (ivug_is_web_uri(buf) == false) {
- MSG_MAIN_HIGH("CNP As Image : Buf=\"%s\" len=%d", buf, strlen(buf));
- bRet = elm_cnp_selection_set(pMainView->layout, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_IMAGE, buf, strlen(buf));
- } else {
- MSG_MAIN_HIGH("CNP As Text : Buf=\"%s\" len=%d", buf, strlen(buf));
- bRet = elm_cnp_selection_set(pMainView->layout, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, buf, strlen(buf));
- }
-
- if (bRet == EINA_FALSE) {
- MSG_MAIN_ERROR("CNP Selection is failed");
- } else {
- MSG_MAIN_HIGH("CNP Selection is Success");
- }
- } else {
- MSG_MAIN_ERROR("slider file path is too long. len=%d", len);
- // No need failed????
- }
-}
-#if 0
-static void _on_name_view_destroy(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("transition finished");
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- ivug_name_view_destroy(pMainView->pNameView);
- pMainView->pNameView = NULL;// Will removed in add tag view.
-
- evas_object_smart_callback_del(pMainView->navi_bar, "transition,finished",
- _on_name_view_destroy);
-}
-#endif
static bool _is_exist(Media_Data *mdata, const char *file)
{
IV_ASSERT(mdata != NULL);
ivug_db_destroy_file_handle(mdata->m_handle);
- /*
- ivug_db_rename() Ŀ Media UUID ʴ´.
- */
mdata->m_handle = ivug_db_get_file_handle_from_media_id(mdata->mediaID);
MSG_MAIN_SEC("Rename %s -> %s", old_fullpath, new_fullpath);
if (_is_exist(mData, str)) {
MSG_MAIN_ERROR("%s already exist", str);
- //ivug_notification_create(IDS_RENAME_FILE_EXIST);
-
- /*toast popup: file name is already in use*/
ivug_notification_create(IDS_RENAME_FILE_EXIST);
ivug_name_view_show_imf(pMainView->pNameView);
- /*
- Evas_Object *popup = ivug_toast_popup_show(pMainView->layout, IDS_FILE_NAME_IN_USE, _on_rename_ctrl_timeout_cb, pMainView);
-
- if (!popup) {
- MSG_MAIN_ERROR("toast popup was created failed");
- }
- */
-
return;
} else {
if (_rename(mData, str) == false) {
return;
}
-bool _share_pkg_cb(app_control_h service, const char *package, void *user_data)
+void on_btn_slideshow_clicked(Ivug_MainView *pMainView)
{
- return true;
-}
+#ifdef USE_THUMBLIST
+ Eina_List *selected_list = NULL;
+ Eina_List *list = NULL;
+ Eina_List *l = NULL;
+ void *l_data = NULL;
+ Image_Object *img = NULL;
+ Media_Item *mitem = NULL;
+ Media_Data *mdata = NULL;
-void _on_mainview_share(Ivug_MainView *pMainView)
-{
- IV_ASSERT(pMainView != NULL);
+ if (pMainView->thumbs != NULL && ivug_thumblist_get_edit_mode(pMainView->thumbs) == EINA_TRUE) {
+ list = ivug_thumblist_get_items_checked(pMainView->thumbs);
+ if (list == NULL) {
+ MSG_MAIN_HIGH("checked item is null");
+ return;
+ }
- if (pMainView->popup) {
- MSG_MAIN_WARN("popup already exist");
- return;
- }
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
- IV_ASSERT(mdata != NULL);
-
- if (mdata->filepath == NULL) {
- MSG_MAIN_ERROR("File path is NULL");
- return;
- }
-
-#ifdef USE_SOUNDIMAGE_SHARE
- if (mdata->iType == MIMAGE_TYPE_SOUNDSCENE) {
- MSG_MAIN_HIGH("Sharing Sound&Image");
-
- ivug_main_view_del_hide_timer(pMainView);
-
- // Select popup shows.
- Evas_Object *popup = ivug_listpopup_add(pMainView->layout);
-
- ivug_listpopup_set_style(popup, IVUG_POPUP_STYLE_LIST);
-
- ivug_listpopup_title_set(popup, IDS_SHARE_AS);
- ivug_listpopup_item_append(popup, NULL, IDS_SHARE_AS_VIDEO, (void *)GET_STR(IDS_SHARE_AS_VIDEO));
- ivug_listpopup_item_append(popup, NULL, IDS_SHARE_AS_IMAGE, (void *)GET_STR(IDS_SHARE_AS_IMAGE));
-
- ivug_listpopup_popup_show(popup);
-
- pMainView->popup = popup;
- evas_object_smart_callback_add(popup, "popup,dismissed", _share_type_dismissed, (void *)pMainView);
- evas_object_smart_callback_add(popup, "popup,selected", _share_type_selected, (void *)pMainView);
-
- return;
- }
-#endif
-
- _launch_share_app(pMainView, mdata->filepath);
-}
-
-void _on_mainview_save(Ivug_MainView *pMainView)
-{
- IV_ASSERT(pMainView != NULL);
-
- if (pMainView->popup) {
- MSG_MAIN_ERROR("popup already exist");
- return;
- }
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
- IV_ASSERT(mdata != NULL);
-
- if (mdata->filepath == NULL) {
- MSG_MAIN_ERROR("File path is NULL");
- return;
- }
-
- MSG_MAIN_SEC("Web image filepath %s, fileurl %s", mdata->filepath, mdata->fileurl);
- return;
-}
-#ifndef USE_THUMBLIST
-static void _ivug_slideshow_ext_ug_destroy_cb(ui_gadget_h ug, void *priv)
-{
- IV_ASSERT(priv != NULL);
- Ivug_MainView *pMainView = (Ivug_MainView *)priv;
-
- ug_destroy(ug);
- //__gl_ext_destroy_ug(ad);
- /*Enable the focus permission of the app layout,or else the app layout can't flick the highlight*/
- elm_object_tree_focus_allow_set(pMainView->layout, EINA_TRUE);
- elm_object_focus_set(pMainView->layout, EINA_TRUE);
-}
-
-static void _ivug_slideshow_ext_ug_end_cb(ui_gadget_h ug, void *priv)
-{
- IV_ASSERT(priv != NULL);
- Ivug_MainView *pMainView = (Ivug_MainView *)priv;
-
- /*Enable the focus permission of the app layout,or else the app layout can't flick the highlight*/
- elm_object_tree_focus_allow_set(pMainView->layout, EINA_TRUE);
- elm_object_focus_set(pMainView->layout, EINA_TRUE);
-
- if (pMainView->bStartSlideshow == true) {
- // here , start slideshow
- //ivug_main_view_start_slideshow(pMainView, EINA_TRUE);
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
-
- ivug_ext_launch_slideshow(mdata->fileurl, mdata->index);
-
- pMainView->bStartSlideshow = false;
- }
-}
-
-static void _ivug_slideshow_ext_ug_result_cb(ui_gadget_h ug, app_control_h result, void *priv)
-{
- IV_ASSERT(priv != NULL);
- Ivug_MainView *pMainView = (Ivug_MainView *)priv;
-
- char *start = NULL;
- app_control_get_extra_data(result, "Result", &start);
- if (start) {
- if (!g_strcmp0(start, "StartSlideShow")) {
- /* Destory ug */
- //ug_destroy(ug);
-
- pMainView->bStartSlideshow = true;
-
- } else {
- pMainView->bStartSlideshow = false;
- }
- }
-}
-
-void _on_slideshow_selected(void *data, Evas_Object *obj, void *event_info)
-{
- IV_ASSERT(data != NULL);
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)event_info;
-
- const char *label = ivug_listpopup_item_get_text(item);
- if (label == NULL) {
- MSG_MAIN_ERROR("label is NULL");
- evas_object_del(obj);
- ivug_main_view_set_hide_timer(pMainView);
- return;
- }
-
- evas_object_del(obj);
-
-// This is not right way. but no other options.
-// When X window disappeared, they capture current frame for use when activate.
-// Evas renders screen when entering idle. so it is possibility for X win to capture screen before evas remove popup image.
-// So in here. force render is needed.
-// later this part should move to ivug-slide-show.cpp. right before X win capture.
- evas_render(evas_object_evas_get(pMainView->layout));
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
-
- if (strncmp(label, IDS_ALL_PICTURES, strlen(label)) == 0) {
- //ivug_main_view_start_slideshow(pMainView, EINA_TRUE);
- ivug_ext_launch_slideshow(mdata->fileurl, mdata->index);
- } else if (strncmp(label, IDS_SELECT_PICTURE, strlen(label)) == 0) {
- int retSvc;
- app_control_h serviceHandle;
- retSvc = app_control_create(&serviceHandle);
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_create Failed: 0x%x", retSvc);
- return;
- }
- ivug_view_by view_by = pMainView->view_by;
- if (view_by == IVUG_VIEW_BY_ALL) {
- retSvc = app_control_add_extra_data(serviceHandle, "view-by", "all");
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data Failed: 0x%x", retSvc);
- }
- } else if (view_by == IVUG_VIEW_BY_PLACES) {
- retSvc = app_control_add_extra_data(serviceHandle, "view-by", "places");
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data Failed: 0x%x", retSvc);
- }
- /* TODO : all gps info */
- } else if (view_by == IVUG_VIEW_BY_TIMELINE) {
- TODO("it is right?");
- retSvc = app_control_add_extra_data(serviceHandle, "view-by", "timeline");
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data Failed: 0x%x", retSvc);
- }
- } else if (view_by == IVUG_VIEW_BY_FAVORITES) {
- retSvc = app_control_add_extra_data(serviceHandle, "view-by", "favourites");
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data Failed: 0x%x", retSvc);
- }
- } else if (view_by == IVUG_VIEW_BY_TAG) {
- retSvc = app_control_add_extra_data(serviceHandle, "view-by", "tags");
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data Failed: 0x%x", retSvc);
- }
- /* TODO : add tag name */
- } else {
- retSvc = app_control_add_extra_data(serviceHandle, "view-by", "albums");
- if (retSvc != APP_CONTROL_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("app_control_add_extra_data Failed: 0x%x", retSvc);
- }
- }
- ivug_ext_launch_select_image(serviceHandle, NULL, _ivug_slideshow_ext_ug_destroy_cb, data);
- app_control_destroy(serviceHandle);
- } else if (strncmp(label, IDS_SETTINGS, strlen(label)) == 0) {
- ivug_ext_launch_setting_gallery(_ivug_slideshow_ext_ug_result_cb, _ivug_slideshow_ext_ug_destroy_cb, _ivug_slideshow_ext_ug_end_cb, data);
- }
-}
-
-void _on_slideshow_btn_cancel(void *data, Evas_Object *obj, void *event_info)
-{
- evas_object_del(obj);
-}
-
-void _ivug_slideshow_popup_create_menu(void *data, Evas_Object *obj, void *event_info)
-{
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
- IV_ASSERT(pMainView != NULL);
- Evas_Object* popup = NULL;
- popup = ivug_listpopup_add(pMainView->layout);
- ivug_listpopup_lang_set(popup, gGetLanguageHandle());
-
- ivug_listpopup_item_append(popup, NULL, IDS_ALL_PICTURES, GET_STR(IDS_ALL_PICTURES));
- ivug_listpopup_item_append(popup, NULL, IDS_SELECT_PICTURE, GET_STR(IDS_SELECT_PICTURE));
- ivug_listpopup_item_append(popup, NULL, IDS_SETTINGS, GET_STR(IDS_SETTINGS));
- ivug_listpopup_title_set(popup, IDS_SLIDE_SHOW);
-// ivug_listpopup_button_set(popup, IDS_CANCEL, NULL);
- ivug_listpopup_popup_show(popup);
-
- evas_object_smart_callback_add(popup, "popup,dismissed", _dismissed_cb, pMainView);
- evas_object_smart_callback_add(popup, "popup,selected", _on_slideshow_selected, pMainView);
- evas_object_smart_callback_add(popup, "popup,btn,selected", _on_slideshow_btn_cancel, pMainView);
-
- MSG_MAIN_HIGH("Create slideshow Popup(0x%08x)", popup);
-}
-#endif
-
-void on_btn_slideshow_clicked(Ivug_MainView *pMainView)
-{
-#ifdef USE_THUMBLIST
- Eina_List *selected_list = NULL;
- Eina_List *list = NULL;
- Eina_List *l = NULL;
- void *l_data = NULL;
- Image_Object *img = NULL;
- Media_Item *mitem = NULL;
- Media_Data *mdata = NULL;
-
- if (pMainView->thumbs != NULL && ivug_thumblist_get_edit_mode(pMainView->thumbs) == EINA_TRUE) {
- list = ivug_thumblist_get_items_checked(pMainView->thumbs);
- if (list == NULL) {
- MSG_MAIN_HIGH("checked item is null");
- return;
- }
-
- char *filepath = NULL; // start file path
+ char *filepath = NULL; // start file path
EINA_LIST_FOREACH(list, l, l_data) {
img = (Image_Object *)l_data;
}
-#ifdef IV_EXTENDED_FEATURES
-static void _ivug_ext_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
-{
- Ivug_MainView *pMainView = (Ivug_MainView *)user_data;
- IV_ASSERT(pMainView != NULL);
-
- MSG_IMAGEVIEW_HIGH("ivug_ext_app_control_reply_cb");
-
-// Enable menu again
- edje_object_signal_emit(_EDJ(pMainView->lyContent), "elm,state,enable,toolbtn", "user");
-
- switch (result) {
- case APP_CONTROL_RESULT_SUCCEEDED:
- MSG_IMAGEVIEW_HIGH("APP_CONTROL_RESULT_SUCCEEDED");
- break;
- case APP_CONTROL_RESULT_FAILED:
- MSG_IMAGEVIEW_HIGH("APP_CONTROL_RESULT_FAILED");
- break;
- case APP_CONTROL_RESULT_CANCELED:
- MSG_IMAGEVIEW_HIGH("APP_CONTROL_RESULT_CANCELED");
- break;
- default:
- MSG_IMAGEVIEW_ERROR("unhandled value %d", result);
- break;
- }
-
- pMainView->ext_svc = NULL;
-}
-#endif
-
-void _on_mainview_edit(Ivug_MainView *pMainView)
-{
- IV_ASSERT(pMainView != NULL);
-
- Media_Item *mitem = ivug_medialist_get_current_item(pMainView->mList);
- Media_Data *mdata = ivug_medialist_get_data(mitem);
- IV_ASSERT(mdata != NULL);
-
- if (mdata->slide_type == SLIDE_TYPE_IMAGE) {
- edje_object_signal_emit(_EDJ(pMainView->lyContent), "elm,state,disable,toolbtn", "user");
- //ivug_ext_launch_default(mdata->filepath, APP_CONTROL_OPERATION_EDIT, NULL, NULL, NULL);
-#ifdef IV_EXTENDED_FEATURES
- pMainView->ext_svc = ivug_ext_launch_image_editor(mdata->filepath, _ivug_ext_app_control_reply_cb, pMainView);
-#endif
- } else if (mdata->slide_type == SLIDE_TYPE_VIDEO) {
- ivug_ext_launch_videoeditor(mdata->filepath, NULL, NULL);
- }
-
-}
-
#include <Ecore_File.h>
-#if 0
-static void _on_add_comment_view_destroy(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("transition finished");
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- ivug_name_view_destroy(pMainView->pNameView);
- pMainView->pNameView = NULL; // Will removed in add tag view.
- evas_object_smart_callback_del(pMainView->navi_bar, "transition,finished",
- _on_add_comment_view_destroy);
-}
-#endif
static void
_ivug_ctxpopup_download_sel_cb(void *data, Evas_Object *obj, void *event_info)
{
_on_btn_rename_clicked(pMainView);
}
-Evas_Object *ivug_listpopup_add(Evas_Object *parent)
-{
- Evas_Object *obj = NULL;
-
-// Creating dummy object because we cannot get determine popup or ctxpopup here.
- obj = elm_box_add(parent);
-
- ListPopup *pListPopup = (ListPopup *)calloc(1, sizeof(ListPopup));
-
- if (pListPopup != NULL) {
- pListPopup->parent = parent;
- pListPopup->list = NULL;
- pListPopup->obj = obj;
- pListPopup->style = IVUG_POPUP_STYLE_LIST;
- pListPopup->eStatus = IVUG_LISTPOPUP_TYPE_HIDDEN;
- pListPopup->show_count = 0;
- evas_object_data_set(obj, "LISTPOPUP", (void *)pListPopup);
- }
-
- MSG_MAIN_HIGH("List popup is added. obj=0x%08x", obj);
-
- return obj;
-}
-
-void ivug_listpopup_lang_set(Evas_Object *obj, language_handle_t hLang)
-{
- ListPopup *pListPopup = IV_LISTPOPUP(obj);
-
- if (pListPopup != NULL) {
- pListPopup->hLang = hLang;
- }
-}
-
-static char *
-_on_label_set(void *data, Evas_Object *obj, const char *part)
-{
- IV_ASSERT(data != NULL);
-
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)data;
-
- MSG_LOW("_on_label_set Part %s", part);
-
- return strdup(GET_STR(item->caption_id)); //dump
-}
-
-static void _on_item_del(void *data, Evas_Object *obj)
-{
- IV_ASSERT(data != NULL);
-
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)(data);
-
- MSG_MED("Remove item. obj=0x%08x", obj);
-
- if (item->caption_id)
- eina_stringshare_del(item->caption_id);
- item->caption_id = NULL;
-
- if (item->iconpath)
- eina_stringshare_del(item->iconpath);
- item->iconpath = NULL;
-
- free(item);
-}
-
-static void
-_on_genlist_selected(void *data, Evas_Object *obj, void *event_info)
-{
-// MSG_ASSERT(data != NULL);
- IV_ASSERT(data != NULL);
-
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)(data);
- ListPopup *pListPopup = item->pListPopup;
-
- int index;
-
- index = item->index;
- MSG_HIGH("Selected Index = %d", index);
-
-// pListPopup->selected_index = index;
- pListPopup->item_selected = item;
-
- MSG_SEC("Genlist item selected. item=0x%08x %s", item, item->caption_id);
-
- elm_genlist_item_update(item->item);
-
- evas_object_smart_callback_call(item->obj, "popup,selected", item);
-
- elm_genlist_item_selected_set(item->item, EINA_FALSE);
-}
-
-static Evas_Object*
-_on_content_set(void *data, Evas_Object *obj, const char *part)
-{
- IV_ASSERT(data != NULL);
-
- Ivug_ListPopup_Item *item = (Ivug_ListPopup_Item *)data;
- ListPopup *pListPopup = item->pListPopup;
-
- Evas_Object *radio;
-
- if (strcmp(part, "elm.icon.2") == 0)
- {
- radio = elm_radio_add(obj);
- elm_radio_state_value_set(radio, item->index);
-
- elm_radio_group_add(radio, pListPopup->rgroup);
-
- if (pListPopup->item_selected == item)
- {
- elm_radio_value_set(radio, item->index);
- }
-
- evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- return radio;
- }
- else if (strcmp(part, "elm.icon.1") == 0)
- {
- Evas_Object *icon;
-
- icon = elm_icon_add(obj);
- char *icon_edj_path = full_path(EDJ_PATH, "/ivug-icons.edj");
-// snprintf(edc_path, 100,"%s/res/edje/%s/ivug-icons.edj", PREFIX, PACKAGE);
- elm_image_file_set(icon, icon_edj_path, item->iconpath);
-// elm_image_file_set(icon, edc_path,item->iconpath);
-
- free(icon_edj_path);
- return icon;
- }
-
- MSG_MAIN_HIGH("_on_content_set Part %s", part);
-
- return NULL;
-}
-
-Ivug_ListPopup_Item *ivug_listpopup_item_append(Evas_Object *obj, const char *iconpath, const char *caption_id, void *data)
-{
- ListPopup *pListPopup = IV_LISTPOPUP(obj);
-
- if (pListPopup == NULL) {
- return NULL;
- }
-
- Ivug_ListPopup_Item *pItem = (Ivug_ListPopup_Item *)calloc(1,sizeof(Ivug_ListPopup_Item));
-
- if (pItem != NULL) {
- pItem->obj = obj;
- }
-
- if (iconpath && pItem != NULL)
- {
- pItem->iconpath = eina_stringshare_add(iconpath);
- pListPopup->bIconUsed = true;
- }
-
- if (caption_id && pItem != NULL)
- {
- pItem->caption_id = eina_stringshare_add(caption_id);
- }
-
- if (pItem != NULL) {
- pItem->bDisabled = false;
- pItem->data = data;
- pItem->pListPopup = pListPopup;
- }
-
- MSG_MAIN_HIGH("Item append: %s", caption_id);
-
- pListPopup->list = eina_list_append(pListPopup->list, pItem);
-
- int newIndex = eina_list_count(pListPopup->list);
-
-// If already showed. need to update dynamically
- if (pListPopup->eStatus == IVUG_LISTPOPUP_TYPE_POPUP && pItem != NULL)
- {
- static Elm_Genlist_Item_Class itc = {0,};
-
- itc.version = ELM_GENLIST_ITEM_CLASS_VERSION;
-
- if (pListPopup->style == IVUG_POPUP_STYLE_RADIO)
- {
- itc.item_style = "1text.2icon.6/popup";
- itc.func.content_get = _on_content_set;
- }
- else
- {
- itc.item_style = "1text/popup";
- itc.func.content_get = NULL;
- }
-
- itc.func.text_get = _on_label_set;
- itc.func.state_get = NULL;
- itc.func.del = _on_item_del;
-
- Elm_Object_Item *gItem;
-
- MSG_MAIN_HIGH("Add popup item. %s", pItem->caption_id);
- gItem = elm_genlist_item_append(pListPopup->genlist, &itc, pItem, NULL /* parent */, ELM_GENLIST_ITEM_NONE, _on_genlist_selected, pItem);
- pItem->item = gItem;
- pItem->index = newIndex;
-
- elm_object_item_disabled_set(gItem, pItem->bDisabled);
-
-// When item count is increase, popup height should be increased..
- unsigned int idx;
-
- idx = pListPopup->show_count;
-
- if (pListPopup->show_count == 0)
- {
- // Default policy.
- idx = newIndex;
-
- // if (count < 2) idx = 2;
-
- // Check landscape mode also.
- if (newIndex > 4) idx = 4;
- }
- else
- {
- idx = pListPopup->show_count;
- }
-
- evas_object_size_hint_min_set(pListPopup->box, GET_POPUP_WIDTH(idx) * elm_config_scale_get(), GET_POPUP_HEIGHT(idx) * elm_config_scale_get());
-
- }
-
- return pItem;
-}
-
-bool ivug_listpopup_context_set_rotate_enable(Evas_Object *obj, bool enable)
-{
- ListPopup *pListPopup = IV_LISTPOPUP(obj);
-
- if (pListPopup != NULL) {
- pListPopup->bRotationEnable = enable;
- }
-
- return true;
-}
-
-bool ivug_listpopup_context_get_rotate_enable(Evas_Object *obj)
-{
- ListPopup *pListPopup = IV_LISTPOPUP(obj);
-
- if (pListPopup != NULL) {
- return pListPopup->bRotationEnable;
- } else {
- return false;
- }
-}
-
static void _on_btn_back_clicked(void *data, Evas_Object *obj, void *event_info)
{
ListPopup *pListPopup = (ListPopup *)data;
}
}
-static void _on_ctxpopup_deleted(void * data, Evas * e, Evas_Object * obj, void * event_info)
-{
- ListPopup *pListPopup = (ListPopup *)data;
-
- MSG_MAIN_HIGH("Remove ctx popup. pListPopup=0x%08x", pListPopup);
-
- if (pListPopup->title)
- eina_stringshare_del(pListPopup->title);
-
- pListPopup->title = NULL;
-
- int i = 0;
-
- for (i = 0; i < MAX_BUTTON; i++)
- {
- if (pListPopup->btn_caption[i])
- {
- eina_stringshare_del(pListPopup->btn_caption[i]);
- }
- }
-
- void *item;
-
- EINA_LIST_FREE(pListPopup->list, item)
- {
- _on_item_del(item, NULL);
- }
-
- pListPopup->list = NULL;
-
- if (pListPopup->popup)
- {
- evas_object_del(pListPopup->popup);
- }
-
- free(pListPopup);
-}
-
-static void _on_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- ListPopup *pListPopup = (ListPopup *)data;
-
- MSG_MAIN_HIGH("Ctx Popup Dismissed. pListPopup=0x%08x", pListPopup);
-
- pListPopup->state = IVUG_LISTPOPUP_STATE_DISMISSED;
- evas_object_smart_callback_call(pListPopup->obj, "popup,dismissed", NULL);
-}
-
static void
_on_ctxpopup_selected(void *data, Evas_Object *obj, void *event_info)
{
evas_object_smart_callback_call(item->obj, "popup,selected", item);
}
-bool ivug_listpopup_context_show(Evas_Object *obj, Evas_Object *hover, int x, int y)
-{
- ListPopup *pListPopup = IV_LISTPOPUP(obj);
-
- if (pListPopup == NULL) {
- return false;
- }
-
- if (pListPopup->popup)
- {
- MSG_MAIN_WARN("Previous popup is remained");
- }
-
- Evas_Object* ctxpopup = NULL;
- ctxpopup = elm_ctxpopup_add(hover);
-
- if (!ctxpopup)
- {
- MSG_MAIN_ERROR("Error : popup create failed.");
- return false;
- }
-
- pListPopup->popup = ctxpopup;
-
-// elm_object_style_set(ctxpopup, "more/default"); // for more
-
- elm_ctxpopup_hover_parent_set(ctxpopup, hover);
-
- {
- Evas_Object *obj = hover;
- int x, y, w, h;
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- Eina_Bool repeat = evas_object_repeat_events_get(obj);
- Eina_Bool pass = evas_object_pass_events_get(obj);
- Eina_Bool visible = evas_object_visible_get(obj);
- Eina_Bool propagate = evas_object_propagate_events_get(obj);
-
- MSG_MAIN_HIGH("Obj=%s(%s,0x%08x) (%d,%d,%d,%d) P%d|R%d|V%d|E%d", evas_object_name_get(obj), evas_object_type_get(obj), obj, x, y, w, h, pass, repeat, visible, propagate);
- }
-
- elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_DOWN,
- ELM_CTXPOPUP_DIRECTION_UP,
- ELM_CTXPOPUP_DIRECTION_RIGHT,
- ELM_CTXPOPUP_DIRECTION_LEFT);
-
-
-// Ivug_ListPopup_Item *pItem = NULL;
- void *pItem = NULL;
- Eina_List *tmp;
- Elm_Object_Item *gItem;
-
- Evas_Object *icon;
-
- EINA_LIST_FOREACH(pListPopup->list, tmp, pItem)
- {
- MSG_MAIN_HIGH("Add popup item. %s", ((Ivug_ListPopup_Item *)pItem)->caption_id);
- char edc_path[100];
-
- if (((Ivug_ListPopup_Item *)pItem)->iconpath)
- {
- icon = elm_icon_add(ctxpopup);
-
-// snprintf(edc_path, 100,"%s/res/edje/%s/ivug-icons.edj", PREFIX,PACKAGE);
-
- elm_image_file_set(icon, full_path(EDJ_PATH, "/ivug-icons.edj"), ((Ivug_ListPopup_Item *)pItem)->iconpath);
- elm_image_file_set(icon, edc_path,((Ivug_ListPopup_Item *)pItem)->iconpath);
- }
- else if (pListPopup->bIconUsed == true) // For icon align
- {
- icon = elm_icon_add(ctxpopup);
-// snprintf(edc_path, 100, "%s/res/edje/%s/ivug-icons.edj", PREFIX, PACKAGE);
-
- elm_image_file_set(icon, full_path(EDJ_PATH, "/ivug-icons.edj"), "icon.mainmenu.transparent");
-// elm_image_file_set(icon, edc_path, "icon.mainmenu.transparent");
- }
- else
- {
-
- icon = NULL;
- }
-
- gItem = elm_ctxpopup_item_append(ctxpopup, GET_STR(((Ivug_ListPopup_Item *)pItem)->caption_id), icon, _on_ctxpopup_selected, ((Ivug_ListPopup_Item *)pItem));
- ((Ivug_ListPopup_Item *)pItem)->pListPopup = pListPopup;
- ((Ivug_ListPopup_Item *)pItem)->item = gItem;
-
- elm_object_item_disabled_set(gItem, ((Ivug_ListPopup_Item *)pItem)->bDisabled);
- }
-
- evas_object_event_callback_add(pListPopup->obj, EVAS_CALLBACK_DEL, _on_ctxpopup_deleted, pListPopup);
-
- evas_object_smart_callback_add(ctxpopup, "dismissed", _on_dismissed_cb, pListPopup);
-
- if (pListPopup->bRotationEnable)
- elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
-
- evas_object_move(ctxpopup, x, y);
-
- MSG_SEC("Show Context Popup(%d,%d)", x, y);
- pListPopup->eStatus = IVUG_LISTPOPUP_TYPE_CTX_POPUP;
-
- eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, _on_btn_back_clicked, pListPopup);
- eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, _on_btn_back_clicked, pListPopup); // When pressed backbutton 2 time, closed ctx popup
-
- evas_object_show(ctxpopup);
-
- return true;
-}
-
static void _ivug_move_more_ctxpopup( Evas_Object *win, Evas_Object *ctxpopup)
{
Evas_Coord w, h;
IV_ASSERT(mdata != NULL);
if (pMainView->bShowMenu == true) {
- // If menu is visible, do not hide menu during popup is displaying
ivug_main_view_del_hide_timer(pMainView);
}
_ivug_ctxpopup_add_callbacks(pMainView, ctxpopup);
}
}
-
edje_object_signal_emit(_EDJ(obj), "image,dim", "prog");
}
-
-static void _on_btn_share_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- MSG_MAIN_HIGH("Btn Share clicked");
-
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- _on_mainview_share(pMainView);
-}
-
-
static void _on_btn_delete_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
MSG_MAIN_HIGH("Btn Delete clicked");
_on_mainview_delete(pMainView);
}
-
-static void _on_btn_save_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- MSG_MAIN_HIGH("Btn Save clicked");
-
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- _on_mainview_save(pMainView);
-}
-
static void _on_btn_nearby_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
MSG_MAIN_HIGH("Btn AllShare clicked");
}
-static void _on_btn_edit_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- MSG_MAIN_HIGH("Btn Edit clicked");
-
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- _on_mainview_edit(pMainView);
-}
-
/*
Used for only view type is select
*/
elm_object_part_content_set(pMainView->lyContent, "ivug.swallow.btn2", btnShare); //swallow
pMainView->toolbtns.share = btnShare;
- elm_layout_signal_callback_add(btnShare, "image_click", "ivug.btn.share", _on_btn_share_cb, pMainView);
-
Evas_Object *btnNearBy;
btnNearBy = create_layout(pMainView->lyContent, edj_path, "ivug.btn.nearby");
elm_object_part_content_set(pMainView->lyContent, "ivug.swallow.btn2", btnEdit); //swallow
pMainView->toolbtns.edit = btnEdit;
- elm_layout_signal_callback_add(btnEdit, "image_click", "ivug.btn.edit", _on_btn_edit_cb, pMainView);
-
Evas_Object *btnShare;
btnShare = create_layout(pMainView->lyContent, edj_path, "ivug.btn.share");
elm_object_part_content_set(pMainView->lyContent, "ivug.swallow.btn3", btnShare); //swallow
pMainView->toolbtns.share = btnShare;
- elm_layout_signal_callback_add(btnShare, "image_click", "ivug.btn.share", _on_btn_share_cb, pMainView);
-
Evas_Object *btnNearBy;
btnNearBy = create_layout(pMainView->lyContent, edj_path, "ivug.btn.nearby");
elm_object_part_content_set(pMainView->lyContent, "ivug.swallow.btn1", btnShare); //swallow
pMainView->toolbtns.share = btnShare;
- elm_layout_signal_callback_add(btnShare, "image_click", "ivug.btn.share", _on_btn_share_cb, pMainView);
-
Evas_Object *btnSave;
btnSave = create_layout(pMainView->lyContent, edj_path, "ivug.btn.save");
elm_object_part_content_set(pMainView->lyContent, "ivug.swallow.btn2", btnSave); //swallow
pMainView->toolbtns.download = btnSave;
-
- elm_layout_signal_callback_add(btnSave, "image_click", "ivug.btn.save", _on_btn_save_cb, pMainView);
}
}
free(edj_path);
#include "ivug-slideshow.h"
#include "ivug-thumblist.h"
#include "ivug-ext-ug.h"
-#include "ivug-decolayer.h"
-#include "ivug-comment.h"
#include "ivug-language-mgr.h"
#include "ivug-file-info.h"
#include "ivug-main-view-priv.h"
ivug_main_view_set_hide_timer(pMainView);
}
-/*
-Evas_Object *create_layout(Evas_Object *parent, const char *edj, const char *group)
-{
- IV_ASSERT(parent != NULL);
-// MSG_ASSERT(parent != NULL);
-
- Evas_Object *layout;
- layout = elm_layout_add(parent);
-
- if (layout == NULL) {
- MSG_MAIN_ERROR("Cannot create layout");
- return NULL;
- }
-
- if (elm_layout_file_set(layout, edj, group) == EINA_FALSE) {
- MSG_MAIN_ERROR("Layout file set failed! %s in %s", group, edj);
- evas_object_del(layout);
- return NULL;
- }
-
- evas_object_size_hint_expand_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_fill_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
-// evas_object_show(layout);
- return layout;
-}*/
Evas_Object* create_favorite_button(Evas_Object *parent)
{
DESTROY_ME();
-// ivug_set_indicator_overlap_mode(false);
-
return EINA_TRUE;
-
}
static void _on_cancel_btn_clicked(void *data, Evas_Object *obj, const char * s, const char *dest)
return ECORE_CALLBACK_CANCEL;
}
-bool ivug_listpopup_context_move(Evas_Object *obj, int x, int y)
-{
- ListPopup *pListPopup = IV_LISTPOPUP(obj);
-
- if (pListPopup != NULL) {
- evas_object_move(pListPopup->popup, x, y);
- }
-
- return true;
-}
-
static void _on_layout_resize(void *data, Evas_Object *obj, void *event_info)
{
Ivug_MainView *pMainView = static_cast<Ivug_MainView *>(data);
return;
}
-/*
-static void
-_on_slider_playburst_icon_clicked(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_MAIN_HIGH("Play Burst icon Clicked");
- IV_ASSERT(data != NULL);
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- _on_play_continous_shot(pMainView);
-}
-*/
static void
_on_slider_playvideo_icon_clicked(void *data, Evas_Object *obj, const char *source, const char *emission)
{
} else {
ivug_ext_launch_videoplayer(mdata->filepath, false);
}
- //ivug_ext_launch_default(mdata->filepath, APP_CONTROL_OPERATION_VIEW, NULL, NULL, NULL);
-
-
}
void
return;
}
- /*if (ivug_mediadata_get_file_state(mdata) != DATA_STATE_LOADED)
- {
- MSG_MAIN_ERROR("Long pressed. but state is not ready");
- return;
- }*/
-
if (mdata->slide_type != SLIDE_TYPE_IMAGE) {
MSG_MAIN_ERROR("Long pressed. but it is not image");
return;
return;
}
- /*if(pMainView->thumbs && ivug_thumblist_get_edit_mode(pMainView->thumbs) == EINA_TRUE)
- {
- return;
- }*/
-
ivug_main_view_del_hide_timer(pMainView);
MSG_MAIN_HIGH("Event layer clicked : %s %s Layer=%d", evas_object_name_get(obj), evas_object_type_get(obj), evas_object_layer_get(obj));
return;
}
- /*if(pMainView->thumbs && ivug_thumblist_get_edit_mode(pMainView->thumbs) == EINA_TRUE)
- {
- return;
- }*/
-
ivug_main_view_set_hide_timer(pMainView);
}
#endif
-static void
-_on_menu_state_changed(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- Ivug_MainView *pMainView = static_cast<Ivug_MainView *>(data);
- if (NULL == pMainView) {
- return;
- }
-
- MSG_MAIN_HIGH("Receive %s %s", emission, source);
-
- if (strncmp(emission, "menu,show,finished", strlen(emission)) == 0) {
- //enable menu
- } else {
- //disable menu
- }
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// External APIs
-//
-
static char * _ivug_get_folder_name(char *filepath)
{
char *folder = ivug_get_directory(filepath);
}
static void
-_edit_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
-{
- Ivug_MainView *pMainView = (Ivug_MainView *)data;
-
- if (ivug_thumblist_checked_item_is(pMainView->thumbs) == EINA_FALSE) {
- edje_object_signal_emit(_EDJ(pMainView->lyContent), "elm,state,hide,toolbtn", "user");
- } else {
- edje_object_signal_emit(_EDJ(pMainView->lyContent), "elm,state,show,toolbtn1", "user");
- }
-}
-
-static void
_thumb_mode_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
Ivug_MainView *pMainView = (Ivug_MainView *)data;
MSG_MAIN_HIGH("Creating main view.");
- PERF_CHECK_BEGIN(LVL2, "Create layout");
-
-//create main view layout
Ivug_MainView *pMainView = (Ivug_MainView *)calloc(1, sizeof(Ivug_MainView));
IV_ASSERT(pMainView != NULL);
pMainView->media_type = param->media_type;
Evas_Object *layout = create_layout(parent, IVUG_MAIN_EDJ, "mainview,selected");
- if (layout == NULL) { //if failed
+ if (layout == NULL) {
MSG_MAIN_ERROR("main layout create failed");
free(pMainView);
pMainView = NULL;
pMainView->layout = layout;
evas_object_name_set(pMainView->layout, "Main Layout");
- PERF_CHECK_END(LVL2, "Create layout");
-
- edje_object_signal_callback_add(_EDJ(pMainView->layout),
- "menu,hide,finished",
- "edc",
- _on_menu_state_changed,
- (void *)pMainView);
-
- edje_object_signal_callback_add(_EDJ(pMainView->layout),
- "menu,show,finished",
- "edc",
- _on_menu_state_changed,
- (void *)pMainView);
-
// Navigation bar
- PERF_CHECK_BEGIN(LVL2, "elm_naviframe_add");
pMainView->navi_bar = elm_naviframe_add(layout);
if (pMainView->navi_bar == NULL) {
eext_object_event_callback_add(pMainView->navi_bar, EEXT_CALLBACK_MORE, on_btn_more_clicked, pMainView);
}
-// Layout life cycle is controlled by application explictily.
-// Because for ex, "Add tag" view is pushed, then previous view is removed. so app control life cycle directly. --> Not true
-// elm_naviframe_content_preserve_on_pop_set(pMainView->navi_bar, EINA_TRUE);
-
if (pMainView->mode != IVUG_MODE_SETAS) {
-#if 1
+
#ifdef USE_CUSTOM_STYLE
elm_object_theme_set(pMainView->navi_bar, gGetSystemTheme());
#endif
} else {
MSG_MAIN_ERROR("Unknown profile : %s", profile);
}
-#endif
}
- elm_object_part_content_set(layout, "mainview.navibar", pMainView->navi_bar); //swallow
-
- PERF_CHECK_END(LVL2, "elm_naviframe_add");
-
- PERF_CHECK_BEGIN(LVL2, "elm_layout_add");
+ elm_object_part_content_set(layout, "mainview.navibar", pMainView->navi_bar);
char *main_edj_path = IVUG_MAIN_EDJ;
pMainView->lyContent = create_layout(layout, main_edj_path, "navi_content");
}
evas_object_name_set(pMainView->lyContent, "Navi content");
- PERF_CHECK_END(LVL2, "elm_layout_add");
-
-#ifdef BACK_BTN
- PERF_CHECK_BEGIN(LVL2, "ivug_button_add");
- pMainView->back_btn = elm_button_add(pMainView->navi_bar);
- elm_object_style_set(pMainView->back_btn, "naviframe/end_btn/default");
- PERF_CHECK_END(LVL2, "ivug_button_add");
-#endif
-
- PERF_CHECK_BEGIN(LVL2, "Init slider");
pMainView->pSliderNew = ivug_slider_new_init(pMainView->layout, pMainView);
if (pMainView->pSliderNew == NULL) {
}
}
- elm_object_part_content_set(pMainView->lyContent, "mainview.slider", sn_layout); //swallow
+ elm_object_part_content_set(pMainView->lyContent, "mainview.slider", sn_layout);
- PERF_CHECK_END(LVL2, "Init slider");
-
- PERF_CHECK_BEGIN(LVL2, "elm_naviframe_item_push");
if (pMainView->mode != IVUG_MODE_SETAS && pMainView->mode != IVUG_MODE_SELECT) {
pMainView->navi_it = elm_naviframe_item_push(pMainView->navi_bar, NULL, NULL, NULL, pMainView->lyContent, NULL);
evas_object_show(pSavebtn);
}
- elm_naviframe_item_pop_cb_set(pMainView->navi_it, _on_btn_back_clicked, pMainView); //pop�� ���� �ݹ� ���.
-
- PERF_CHECK_END(LVL2, "elm_naviframe_item_push");
- PERF_CHECK_BEGIN(LVL2, "add event handler");
+ elm_naviframe_item_pop_cb_set(pMainView->navi_it, _on_btn_back_clicked, pMainView);
-// PERF_CHECK_BEGIN(LVL2, "Register callback");
// 3ms
if (pMainView->mode != IVUG_MODE_SETAS && pMainView->mode != IVUG_MODE_HIDDEN) {
elm_object_signal_callback_add(sn_layout, "play", "elm", _on_slider_playvideo_icon_clicked, pMainView);
evas_object_event_callback_add(sn_layout, EVAS_CALLBACK_MOUSE_MOVE, _on_slider_mouse_moved, pMainView);
evas_object_event_callback_add(sn_layout, EVAS_CALLBACK_MOUSE_UP, _on_slider_mouse_up, pMainView);
}
-// PERF_CHECK_END(LVL2, "Register callback");
if ((pMainView->view_by != IVUG_VIEW_BY_FILE)
&& (pMainView->view_by != IVUG_VIEW_BY_INVAILD)) {
- PERF_CHECK_BEGIN(LVL2, "Create thumblist");
#ifdef USE_THUMBLIST
pMainView->thumbs = ivug_thumblist_add(pMainView->layout);
elm_object_theme_set(pMainView->thumbs, gGetSystemTheme());
evas_object_name_set(pMainView->thumbs, "Thumblist");
-// elm_object_part_content_set(pMainView->lyContent, "thumblist", pMainView->thumbs);
-
evas_object_event_callback_add(pMainView->thumbs, EVAS_CALLBACK_MOUSE_DOWN, _on_receive_mouse_down, pMainView);
evas_object_event_callback_add(pMainView->thumbs, EVAS_CALLBACK_MOUSE_UP, _on_receive_mouse_up, pMainView);
evas_object_smart_callback_add(pMainView->thumbs, "item,realized", _thumb_realized_cb, pMainView);
evas_object_smart_callback_add(pMainView->thumbs, "changed,mode", _thumb_mode_changed_cb, pMainView);
- evas_object_smart_callback_add(pMainView->thumbs, "item,edit,selected", _edit_item_selected_cb, pMainView);
#endif
- PERF_CHECK_END(LVL2, "Create thumblist");
}
if (pMainView->mode == IVUG_MODE_DISPLAY) {
pMainView->keydown_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _on_key_down, (void *)pMainView);
- {
- int bx, by, bw, bh;
- evas_object_geometry_get(pMainView->navi_bar, &bx, &by, &bw, &bh);
-
- MSG_MAIN_HIGH("Navibar(0x%08x) Created. (%d,%d,%d,%d)", pMainView->navi_bar, bx, by, bw, bh);
- }
-
- {
- int bx, by, bw, bh;
- evas_object_geometry_get(pMainView->lyContent, &bx, &by, &bw, &bh);
-
- MSG_MAIN_HIGH("Content layout(0x%08x) Created. (%d,%d,%d,%d)", pMainView->lyContent, bx, by, bw, bh);
- }
-
- int bx, by, bw, bh;
- evas_object_geometry_get(pMainView->layout, &bx, &by, &bw, &bh);
-
- MSG_MAIN_HIGH("MainView Layout(0x%08x) Created. (%d,%d,%d,%d)", pMainView->layout, bx, by, bw, bh);
-
-
-
// creating photo cam
ivug_create_new_photocam_image(pMainView, &pMainView->photocam, "imageview_area");
ivug_slider_new_set_photocam(pMainView->pSliderNew, pMainView->photocam);
&& pMainView->mode != IVUG_MODE_SETAS && pMainView->mode != IVUG_MODE_SELECT && pMainView->mode != IVUG_MODE_HIDDEN) {
pMainView->btn_favorite = create_favorite_button(pMainView->lyContent);
evas_object_smart_callback_add(pMainView->btn_favorite, "clicked", _on_btn_favorite_cb, pMainView);
- elm_object_part_content_set(pMainView->lyContent, "elm.swallow.favorite", pMainView->btn_favorite); //swallow
+ elm_object_part_content_set(pMainView->lyContent, "elm.swallow.favorite", pMainView->btn_favorite);
}
-// For debugging.
-// DELETE_NOTIFY(pMainView->layout);
-
- PERF_CHECK_END(LVL2, "add event handler");
return pMainView;
-
}
{
MSG_MAIN_HIGH("Load media list. pMainView=0x%08x", pMainView);
- PERF_CHECK_BEGIN(LVL2, "create media list");
if (NULL == pMainView) {
return false;
}
MSG_MAIN_ERROR("Creating media list failed");
return false;
}
- PERF_CHECK_END(LVL2, "create media list");
- PERF_CHECK_BEGIN(LVL2, "create filter");
Filter_struct *filter = ivug_param_create_filter(ivug_param);
if (filter == NULL) {
//do not use ivug_param->view_by after here
- PERF_CHECK_END(LVL2, "create filter");
-
Media_Item *current = NULL;
Media_Data *pData = NULL;
current = ivug_medialist_load(mlist, filter);
MSG_MAIN_ERROR("current data is NULL");
goto LOAD_LIST_FAILED;
}
- //ULC changes
+
ivug_medialist_set_current_item(mlist, current);
- //ULC changes
+
if (pData->fileurl == NULL) {
MSG_MAIN_ERROR("current fileurl is NULL");
MSG_MAIN_ERROR("current data is NULL");
goto LOAD_LIST_FAILED;
}
- //ULC changes
+
ivug_medialist_set_current_item(mlist, current);
- //ULC changes
if (pData->fileurl == NULL) {
MSG_MAIN_ERROR("current fileurl is NULL");
} else if (filter->view_by == IVUG_VIEW_BY_HIDDEN_ALL) {
pMainView->album_name = strdup(IDS_HIDDEN);
} else if (filter->view_by == IVUG_VIEW_BY_FOLDER) {
- /*
- media_handle m_handle = ivug_db_get_folder_handle(ivug_dir_get(ivug_param->filepath));
- if (m_handle == NULL)
- {
- MSG_IVUG_FATAL("View by Folder. but media handle is NULL" );
- return NULL;
- }
-
- pMainView->album_name = ivug_db_get_folder_name(m_handle);
- */
pMainView->album_name = _ivug_get_folder_name(ivug_param->filepath);
if (pMainView->album_name == NULL) {
pMainView->album_name = strdup(IDS_NO_NAME);
}
} else if (filter->view_by == IVUG_VIEW_BY_HIDDEN_FOLDER) {
- /*
- media_handle m_handle = ivug_db_get_folder_handle(ivug_dir_get(ivug_param->filepath));
- if (m_handle == NULL)
- {
- MSG_IVUG_FATAL("View by Folder. but media handle is NULL" );
- return NULL;
- }
-
- pMainView->album_name = ivug_db_get_folder_name(m_handle);
- */
pMainView->album_name = _ivug_get_folder_name(ivug_param->filepath);
if (pMainView->album_name == NULL) {
pMainView->album_name = strdup(IDS_NO_NAME);
}
}
pMainView->mList = mlist;
- PERF_CHECK_BEGIN(LVL2, "media list set");
if (ivug_medialist_get_count(mlist) == 1) {
if (ivug_param->mode == IVUG_MODE_DISPLAY) {
ivug_slider_new_set_list(pMainView->pSliderNew, mlist, current);
- PERF_CHECK_END(LVL2, "media list set");
-
return true;
LOAD_LIST_FAILED:
// Stop animation & movie play before slideshow is started.
current = ivug_medialist_get_current_item(pMainView->mList);
-// ivug_prohibit_lcd_off();
- //ivug_main_view_hide_menu_bar(pMainView);
-
if (pMainView->ssHandle) {
ivug_ss_delete(pMainView->ssHandle);
pMainView->ssHandle = NULL;
// Update Main View.
if (pMainView->bShowMenu == true) {
- PERF_CHECK_BEGIN(LVL5, "Update main view");
_update_main_view(pMainView);
- PERF_CHECK_END(LVL5, "Update main view");
}
if (count != -1 && currentindex != -1 && currentindex + 1 < count) {
{
IV_ASSERT(pMainView != NULL);
-#if 0
- if (ivug_slider_new_get_mode(pMainView->pSliderNew) != SLIDER_MODE_SINGLE) {
- ivug_medialist_set_update_callback(pMainView->mList);
- }
-#endif
-
if (pMainView->ssHandle) {
ivug_ss_stop(pMainView->ssHandle);
}
ivug_main_view_del_hide_timer(pMainView);
-
- // Stop photocam If AGIF
}
__attribute__((used)) void dump_obj(Evas_Object *obj, int lvl)
#include "ivug-name-view.h"
#include "ivug-popup.h"
#include "ivug-media.h"
-#include "ivug-vibration.h"
#include "ivug-util.h"
#include "ivug-language-mgr.h"
-#include <notification.h>
#undef LOG_LVL
#define LOG_LVL DBG_MSG_LVL_HIGH
char *guide_txt;
char *init_txt;
-#ifdef USE_MAXLENGTH_VIBE
- vibration_h haptic_handle;
-#endif
-
FNResponse fnresponse;
void *clientdata;
}
static void
-_on_keypad_show(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_ASSERT(data != NULL);
-
-#ifdef HIDE_TITLE_AT_LANDSCAPE
- Ivug_NameView *pNameView = (Ivug_NameView *)data;
-
- Elm_Object_Item *navi_it = elm_naviframe_top_item_get(pNameView->navibar);
-
- int rot = gGetRotationDegree();
- if (rot == 90 || rot == 270) {
- elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
- }
-#endif
-}
-
-static void
-_on_keypad_hide(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_ASSERT(data != NULL);
-
-#ifdef HIDE_TITLE_AT_LANDSCAPE
- Ivug_NameView *pNameView = (Ivug_NameView *)data;
-
- Elm_Object_Item *navi_it = elm_naviframe_top_item_get(pNameView->navibar);
-
- elm_naviframe_item_title_enabled_set(navi_it, EINA_TRUE, EINA_FALSE);
-#endif
-
-}
-
-void _on_btn_more_clicked(void *data, Evas_Object *obj, void *event_info)
-{
-}
-
-static void
_ivug_rename_view_on_entry_actiavated(void *data, Evas_Object *obj, void *event_info)
{
Ivug_NameView *pNameView = (Ivug_NameView *)data;
Ivug_NameView *pNameView = (Ivug_NameView *)data;
MSG_ASSERT(pNameView != NULL);
-#ifdef USE_MAXLENGTH_VIBE
- if (pNameView->haptic_handle == INVALID_HAPTIC_HANDLE) {
- pNameView->haptic_handle = ivug_vibration_create();
- if (pNameView->haptic_handle == INVALID_HAPTIC_HANDLE) {
- MSG_ERROR("ivug_vibration_create failed");
- return;
- }
- } else {
- ivug_vibration_stop(pNameView->haptic_handle);
- }
-
- ivug_vibration_play(pNameView->haptic_handle ,VIBRATION_DURATION);
-#else
char message[50] = {0,};
int ret = -1;
snprintf(message, 50, GET_STR(IDS_MAX_CHAR_LENGTH_REACHED), MAX_CHAR_LEN);
if (ret != NOTIFICATION_ERROR_NONE) {
MSG_IMAGEVIEW_ERROR("notification_status_message_post() ERROR [0x%x]", ret);
}
-#endif
}
static void
if (strlen(content) == 0) {
MSG_HIGH("Input string is NULL");
ivug_elm_object_part_text_set(gGetLanguageHandle(), pNameView->entry, "elm.guide", pNameView->guide_txt);
-
- if (pNameView->bAllowNull == EINA_FALSE) {
- elm_object_disabled_set(pNameView->btn_done, EINA_TRUE);
- }
+ elm_object_disabled_set(pNameView->btn_done, EINA_TRUE);
} else if (_ivug_validate_text(content, pNameView->filter_txt) == false) {
MSG_HIGH("invalid char ISF : %s", content);
int position = elm_entry_cursor_pos_get(pNameView->entry);
pNameView->ivTemp_entry = content;
}
-static void _ivug_name_view_on_entry_changed_user(void *data, Evas_Object *obj, void *event_info)
-{
- MSG_HIGH("Entry changed by user");
-}
-
static void _ivug_name_view_on_entry_preedit_changed(void *data, Evas_Object *obj, void *event_info)
{
MSG_HIGH("_ivug_name_view_on_entry_preedit_changed");
evas_object_smart_callback_add(editfield, "clicked", _ivug_rename_view_on_entry_clicked, pNameView);
evas_object_smart_callback_add(editfield, "changed", _ivug_name_view_on_entry_changed, pNameView);
evas_object_smart_callback_add(editfield, "preedit,changed", _ivug_name_view_on_entry_preedit_changed, pNameView);
- evas_object_smart_callback_add(editfield, "changed,user", _ivug_name_view_on_entry_changed_user, pNameView);
evas_object_smart_callback_add(editfield, "maxlength,reached", (Evas_Smart_Cb)_ivug_name_view_maxlength_reached, pNameView);
evas_object_smart_callback_add(editfield, "longpressed", (Evas_Smart_Cb)_ivug_name_view_callback_long_clicked_cb, pNameView);
return NULL;
}
-#ifdef USE_MAXLENGTH_VIBE
- pNameView->haptic_handle = INVALID_HAPTIC_HANDLE;
-#endif
-
pNameView->popup = elm_popup_add(parent);
char *popup_edj = IVUG_POPUP_EDJ_NAME;
MSG_HIGH("Destroy Name View");
-#ifdef USE_MAXLENGTH_VIBE
- if (pNameView->haptic_handle != INVALID_HAPTIC_HANDLE) {
- ivug_vibration_stop(pNameView->haptic_handle);
- ivug_vibration_delete(pNameView->haptic_handle);
-
- pNameView->haptic_handle = INVALID_HAPTIC_HANDLE;
- }
-#endif
-
if (pNameView->navibar) {
evas_object_del(pNameView->navibar);
pNameView->navibar = NULL;
free(pNameView->filter_txt);
}
- Evas_Object *conformant = gGetCurrentConformant();//ug_get_conformant();
-
- evas_object_smart_callback_del(conformant, "virtualkeypad,state,on", _on_keypad_show);
- evas_object_smart_callback_del(conformant, "virtualkeypad,state,off", _on_keypad_hide);
- evas_object_smart_callback_del(conformant, "clipboard,state,on", _on_keypad_show);
- evas_object_smart_callback_del(conformant, "clipboard,state,off", _on_keypad_hide);
-
free(pNameView);
pNameView = NULL;
MSG_HIGH("Name view removed");
}
-
-Evas_Object *
-ivug_name_view_object_get(Ivug_NameView *pNameView)
-{
- MSG_ASSERT(pNameView != NULL);
-
- return pNameView->layout;
-}
-
void
ivug_name_view_set_response_callback(Ivug_NameView *pNameView, FNResponse resp, void *data)
{
pNameView->filter_txt = strdup(filter_text);
}
-
-void ivug_name_view_allow_null_set(Ivug_NameView *pNameView, Eina_Bool bNullAllowed)
-{
- MSG_ASSERT(pNameView != NULL);
-
- pNameView->bAllowNull = bNullAllowed;
-
- if (pNameView->bAllowNull == EINA_TRUE) {
- elm_object_disabled_set(pNameView->btn_done, EINA_FALSE);
- }
-}
-
void ivug_name_view_show_imf(Ivug_NameView *pNameView)
{
MSG_ASSERT(pNameView != NULL);
elm_object_focus_set(pNameView->entry, EINA_TRUE);
}
}
-
// Update Main View.
if (pMainView->bShowMenu == true) {
- PERF_CHECK_BEGIN(LVL5, "Update main view");
_update_main_view(pMainView);
- PERF_CHECK_END(LVL5, "Update main view");
}
ivug_medialist_get_data(pMainView->cur_mitem);
// Update Main View.
if (pMainView->bShowMenu == true) {
- PERF_CHECK_BEGIN(LVL5, "Update main view");
_update_main_view(pMainView);
- PERF_CHECK_END(LVL5, "Update main view");
}
ivug_medialist_get_data(pMainView->cur_mitem);
char *edj_file = DEFAULT_THUMBNAIL_PATH;
// Update Main View.
if (pMainView->bShowMenu == true) {
- PERF_CHECK_BEGIN(LVL5, "Update main view");
_update_main_view(pMainView);
- PERF_CHECK_END(LVL5, "Update main view");
}
if (prev_mitem) {
Media_Data *pmData = ivug_medialist_get_data(prev_mitem);
// Update Main View.
if (pMainView->bShowMenu == true) {
- PERF_CHECK_BEGIN(LVL5, "Update main view");
_update_main_view(pMainView);
- PERF_CHECK_END(LVL5, "Update main view");
}
if (next_mitem) {
Media_Data *pmData = ivug_medialist_get_data(next_mitem);
*/
#include "ivug-define.h"
-
#include "ivug-data-list.h"
#include "ivug-uuid.h"
-
#include "ivug-debug.h"
#include "ivug-media.h"
#include "ivug-mediadata.h"
-
#include "ivug-file-info.h"
-
#include "ivug-db.h"
-
#include "ivug-dir.h"
#include "ivug-util.h"
-
#include "ivug-filter.h"
#include <Eina.h>
-
#include <media_content.h>
-//#include <media_info_comm_feature.h>
static char *_strerror_db(int error)
{
snprintf(buf, 40, "Error Code=%d", error);
return buf;
}
-
}
}
return slide_list;
}
-Eina_List *
-ivug_list_load_DB_items_list(const Filter_struct *filter, Eina_List *list)
-{
- IV_ASSERT(filter != NULL);
-
- DB_Filter *db_filter = filter->db_filter;
- char *string = NULL;
-
- filter_handle media_filter = NULL;
- ivug_db_create_filter(&media_filter);
-
- if (filter->view_by == IVUG_VIEW_BY_PLACES)
- {
- string = calloc(1, sizeof(char)*IVUG_MAX_CONDITION_LEN);
-
- if (string != NULL) {
- snprintf(string, IVUG_MAX_CONDITION_LEN,
- "(MEDIA_LONGITUDE >= %f AND MEDIA_LONGITUDE <= %f AND MEDIA_LATITUDE >= %f AND MEDIA_LATITUDE <= %f)",
- db_filter->place.min_longitude, db_filter->place.max_longitude,
- db_filter->place.min_latitude, db_filter->place.max_latitude);
- _change_comma_to_dot(string);
- }
- }
- else if (filter->view_by == IVUG_VIEW_BY_TIMELINE)
- {
- string = calloc(1, sizeof(char)*IVUG_MAX_CONDITION_LEN);
- if (string != NULL) {
- snprintf(string, IVUG_MAX_CONDITION_LEN,
- "(MEDIA_TIMELINE BETWEEN %ld AND %ld)",
- db_filter->time.start, db_filter->time.end);
- }
- }
-
- ivug_db_set_filter(media_filter, filter->view_by, filter->media_type, string);
-
- Eina_List *l = NULL;
- void *data = NULL;
- int index = -1;
- Eina_List *item_list = NULL;
- int start = -1;
- int end = -1;
-
- EINA_LIST_FOREACH(list, l, data)
- {
- index = (int)data;
- if (start == -1)
- {
- start = index;
- end = start;
- continue;
- }
- else if (index == end+1)
- {
- end = index;
- continue;
- }
- else
- {
- _load_list_db(filter, media_filter, start, end, &item_list);
-
- start = index;
- end = index;
- }
- }
- _load_list_db(filter, media_filter, start, end, &item_list); //load remain
-
- ivug_db_destroy_filter(media_filter);
-
- MSG_SDATA_HIGH("DB Item loaded %d items", eina_list_count(item_list));
-
-// Creating media_list.
- Eina_List *slide_list = NULL;
-
- Eina_List *item;
- media_info_h mitem = NULL;
-
- Media_Data *mdata = NULL;
-
- int i = 0;
-
- EINA_LIST_FOREACH(item_list, item, mitem)
- {
- mdata = ivug_alloc_mediadata_from_media_handle(mitem);
- if (mdata == NULL)
- {
- MSG_SDATA_ERROR("mdata create error!");
- continue;
- }
- mdata->index = i;
-
- i++;
-
- IV_ASSERT(mdata != NULL);
-
- MSG_SDATA_LOW("Add Mdata. Mdata=0x%08x %s", mdata, mdata->filepath);
- slide_list = eina_list_append(slide_list, mdata);
- }
-
- EINA_LIST_FREE(item_list, mitem)
- {
- media_info_destroy(mitem);
- }
-
- MSG_SDATA_HIGH("Item header=0x%08x Item loaded %d items", slide_list, eina_list_count(slide_list));
-
- return slide_list;
-}
-
-
int ivug_list_get_item_cnt(const Filter_struct *filter)
{
filter_h media_filter = NULL;
return -1;
}
-int ivug_list_get_burst_item_cnt(const Filter_struct *filter, const char * burst_id)
-{
- filter_h media_filter = NULL;
-
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- int count = 0;
-
- char *string = NULL;
-
- ivug_db_create_filter((filter_handle*)&media_filter);
-
- string = calloc(1, sizeof(char)*IVUG_MAX_CONDITION_LEN);
-
- if (string != NULL) {
- snprintf(string, IVUG_MAX_CONDITION_LEN, "(%s=%s)", MEDIA_BURST_ID, burst_id);
- ivug_db_set_image_time_asc_filter(media_filter, string);
- }
-
- ret = media_info_get_media_count_from_db(media_filter, &count);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- {
- MSG_SDATA_ERROR("media_info_get_media_count_from_db is failed, err = %s", _strerror_db(ret));
- goto GET_COUNT_ERROR;
- }
-
- MSG_SDATA_HIGH("ivug_db_get_count success, count = %d", count);
-
- ivug_db_destroy_filter(media_filter);
- return count;
-
-GET_COUNT_ERROR:
- MSG_SDATA_ERROR("ivug_db_get_count FAILED");
-
- ivug_db_destroy_filter(media_filter);
- return -1;
-}
-
-
void ivug_list_delete_items(Eina_List *items)
{
Media_Data* mdata;
}
Eina_List *
-ivug_list_load_burst_items(const Filter_struct *filter, const char *burst_id, int stp, int endp)
-{
- IV_ASSERT(filter != NULL);
-
- char *string = NULL;
-
- filter_handle media_filter = NULL;
- ivug_db_create_filter(&media_filter);
-
- string = calloc(1, sizeof(char)*IVUG_MAX_CONDITION_LEN);
-
- if (string != NULL) {
- snprintf(string, IVUG_MAX_CONDITION_LEN, "(%s=%s)", MEDIA_BURST_ID, burst_id);
- ivug_db_set_image_time_asc_filter(media_filter, string);
- }
-
- Eina_List *item_list = NULL;
-
- _load_list_db(filter, media_filter, stp, endp, &item_list);
-
- ivug_db_destroy_filter(media_filter);
-
-// Creating media_list.
- Eina_List *slide_list = NULL;
-
- Eina_List *item;
- media_info_h mitem = NULL;
-
- Media_Data *mdata = NULL;
-
- int i = 0;
-
- EINA_LIST_FOREACH(item_list, item, mitem)
- {
- mdata = ivug_alloc_mediadata_from_media_handle(mitem);
- if (mdata == NULL)
- {
- MSG_SDATA_ERROR("mdata create error!");
- continue;
- }
- mdata->index = i + stp; // stp~
-
- i++;
-
- IV_ASSERT(mdata != NULL);
-
- MSG_SDATA_LOW("Add Mdata. Mdata=0x%08x %s", mdata, mdata->filepath);
- slide_list = eina_list_append(slide_list, mdata);
- }
-
- EINA_LIST_FREE(item_list, mitem)
- {
- media_info_destroy(mitem);
- }
-
- MSG_SDATA_HIGH("Item header=0x%08x Item loaded(%d~%d)", slide_list, stp, endp);
-
- return slide_list;
-}
-
-Eina_List *
ivug_list_load_file_list(const Filter_struct *filter, Eina_List *list)
{
IV_ASSERT(filter != NULL);
#include "ivug-mediadata.h"
#include "ivug-util.h"
#include "ivug-file-info.h"
-#include "ivug-mediainfo.h"
#include "ivug-db.h"
#include <media_content.h>
return NULL;
}
-Media_Data *ivug_alloc_mediadata_from_url(const char *url)
-{
- IV_ASSERT(url != NULL);
-
- Media_Data * mdata = NULL;
- mdata = (Media_Data *) calloc(1, sizeof(Media_Data));
- if (mdata == NULL)
- {
- MSG_SDATA_ERROR("Cannot allocate memory");
- return NULL;
- }
-
- //file url
- mdata->fileurl = strdup(url);
- if (mdata->fileurl == NULL)
- {
- MSG_SDATA_ERROR("strdup return NULL");
- free(mdata);
- return NULL;
- }
-
- mdata->state = DATA_STATE_READY;
-
- return mdata;
-}
-
void ivug_free_mediadata(Media_Data * mdata)
{
IV_ASSERT(mdata != NULL);
free(mdata);
}
-bool ivug_mediadata_set_tag(Media_Data *data, const char *newtag)
-{
- ivug_retv_if(!newtag, false);
-
- MSG_UTIL_HIGH("Add Tag : uuid(%s), tag_name=%s", uuid_getchar(data->mediaID), newtag);
-
- tag_handle tag = NULL;
- bool ret = ivug_db_create_tag(&tag, newtag);
- if (ret == false)
- {
- MSG_SDATA_WARN("tag already created");
- tag = ivug_db_get_tag_handle(newtag);
- if (tag == NULL)
- {
- MSG_SDATA_ERROR("ivug_db_get_tag_handle ERROR");
- return false;
- }
- }
-
- ret = ivug_db_set_tag(data->m_handle, tag);
- if (ret == false)
- {
- MSG_SDATA_ERROR("ivug_db_set_tag ERROR");
- }
-
- ivug_db_destroy_tag(tag);
-
- return ret;
-}
-
bool ivug_mediadata_set_favorite(Media_Data *data, bool bFavorite)
{
MSG_UTIL_HIGH("Add Favorite : uuid(%s), bFavorite=%d", uuid_getchar(data->mediaID), bFavorite);
return ret;
}
-
-
bool ivug_mediadata_delete(Media_Data * mdata)
{
IV_ASSERT(mdata != NULL);
}
}
-void ivug_mediadata_request_file(Media_Data *mdata, mdata_callback_t callback, void *data)
-{
- if (mdata->state == DATA_STATE_LOADING)
- {
- MSG_SITEM_HIGH("data is loading");
- callback(mdata, DATA_STATE_LOADING, data);
- return;
- }
-
- if (callback)
- {
- mdata->file_callback = callback;
- mdata->cb_data = data;
- }
-
- Media_Item *cur_item = ivug_medialist_get_current_item(mdata->p_mList);
- Media_Data *cur_mdata = ivug_medialist_get_data(cur_item);
-
- MSG_SITEM_SEC("cur %s, mdata %s", cur_mdata->fileurl, mdata->fileurl);
-
- if (mdata->state == DATA_STATE_LOADED)
- {
- MSG_SITEM_HIGH("data is already loaded");
- _ivug_mediadata_call_file_callback(mdata, DATA_STATE_LOADED);
- return;
- }
-
- mdata->state = DATA_STATE_LOADING;
-
- switch (mdata->slide_type)
- {
- case SLIDE_TYPE_IMAGE:
- case SLIDE_TYPE_VIDEO:
- _ivug_mediadata_call_file_callback(mdata, DATA_STATE_LOADED);
- break;
- case SLIDE_TYPE_UNKNOWN:
- MSG_SITEM_ERROR("Unknown image. %s", ivug_get_filename(mdata->filepath));
- _ivug_mediadata_call_file_callback(mdata, DATA_STATE_ERROR);
- break;
-
- default:
- MSG_SITEM_ERROR("slide type invaild. Type=%d", mdata->slide_type);
- _ivug_mediadata_call_file_callback(mdata, DATA_STATE_ERROR);
- break;
- }
-}
-
-void ivug_mediadata_cancel_request_file(Media_Data *mdata)
-{
- MSG_SITEM_SEC("ivug_mediadata_cancel_request_file, %s", mdata->fileurl);
-
- mdata->file_callback = NULL;
-
- switch (mdata->slide_type)
- {
- case SLIDE_TYPE_IMAGE:
- case SLIDE_TYPE_VIDEO:
- break;
- case SLIDE_TYPE_UNKNOWN:
- MSG_SITEM_ERROR("Unknown image. %s", ivug_get_filename(mdata->filepath));
- break;
-
- default:
- MSG_SITEM_ERROR("slide type invaild. Type=%d", mdata->slide_type);
- break;
-
- }
-
- if (mdata->state != DATA_STATE_LOADED)
- {
- mdata->state = DATA_STATE_READY;
- }
-}
-
const char* ivug_mediadata_get_filepath(Media_Data *mdata)
{
return mdata->filepath;
{
return mdata->thumbnail_state;
}
-
+++ /dev/null
-/*
-* Copyright (c) 2000-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 "ivug-define.h"
-#include "ivug-debug.h"
-
-#include "ivug-media.h"
-
-#include <string.h>
-
-#undef LOG_LVL
-#define LOG_LVL DBG_MSG_LVL_HIGH
-
-#undef LOG_CAT
-#define LOG_CAT "IV-MINFO"
-
-static bool _is_bestpic(const char *file)
-{
- const char szBest[] = "_bestshot"; // sizeof(szBest) = 10;
-
- const char *find = NULL;
-
- find = strrchr(file, '.');
-
- if (find == NULL) {
- // All files should have extension
- return false;
- }
-
- unsigned int dist = find - file;
-
- if (dist < sizeof(szBest) - 1) {
- return false;
- }
-
- if (strncmp(find - sizeof(szBest) + 1 , szBest , sizeof(szBest) - 1) == 0) {
- return true;
- }
-
- return false;
-
-}
-
-
-static bool _is_soundscene(const char *file)
-{
- return false;
-}
-
-extern "C" MImageType MINfo_GetMediaType(const char *fname)
-{
- if (_is_bestpic(fname) == true) {
- MSG_HIGH("Bestphoto : %s", fname);
- return MIMAGE_TYPE_BESTSHOT;
- }
-
- if (_is_soundscene(fname) == true) {
- MSG_HIGH("Soundscene : %s", fname);
- return MIMAGE_TYPE_SOUNDSCENE;
- }
-
- return MIMAGE_TYPE_NORMAL;
-}
-
-
-
{
Eina_List *header = NULL;
-#ifdef UT_USE_DB
- {
- if (filter->selected_list) {
- //header = ivug_list_load_DB_items_list(filter, filter->selected_list);
- header = ivug_list_load_DB_items(filter, stp, endp);
- } else {
- header = ivug_list_load_DB_items(filter, stp, endp);
- }
- }
-#else
- Eina_List *header = NULL;
-
- int i;
- Media_Data *data;
-
- for (i = stp; i <= endp; i++) {
- data = malloc(sizeof(Media_Data));
- data->index = i;
-
- header = eina_list_append(header, data);
+ if (filter->selected_list) {
+ header = ivug_list_load_DB_items(filter, stp, endp);
+ } else {
+ header = ivug_list_load_DB_items(filter, stp, endp);
}
-#endif
MSG_SDATA_HIGH("Loaded : %d ~ %d", stp, endp);
-
return header;
}
if (endp == Total - 1) {
bRightEnd = true;
}
-
-#ifdef USE_ECORE_CHECK
if (ecore_thread_check(thread) == EINA_TRUE) { // if pending cancelation
MSG_SDATA_HIGH("Check True");
ivug_list_delete_items(right);
break;
}
-#else
- if (_mList->bTerminate == EINA_TRUE) {
- MSG_SDATA_HIGH("Check True");
- ivug_list_delete_items(right);
- return;
- }
-#endif
+
IV_ASSERT(right != NULL);
_mList->header = eina_list_merge(_mList->header, right);
_ivug_medialist_set_medialist_to_media_item((Media_List *)_mList);
bLeftEnd = true;
}
-#ifdef USE_ECORE_CHECK
if (ecore_thread_check(thread) == EINA_TRUE) { // if pending cancelation
MSG_SDATA_HIGH("Check True");
ivug_list_delete_items(left);
break;
}
-#else
- if (_mList->bTerminate == EINA_TRUE) {
- MSG_SDATA_HIGH("Check True");
- ivug_list_delete_items(left);
- return;
- }
-#endif
+
IV_ASSERT(left != NULL);
_mList->header = eina_list_merge(left, _mList->header);
static void loader_end(void *data, Ecore_Thread *thread)
{
-// ThreadParam *pParam = data;
-
- // MSG_SDATA_HIGH("Thread Ended. EinaCount=%d Count=%d", eina_list_count(pParam->_mList), pParam->_mList->count);
MSG_SDATA_HIGH("Thread Ended. Ecore tID=0x%08x", thread);
-
- //PERF_CHECK_END(LVL3, "Deffered loading");
}
static void loader_cancel(void *data, Ecore_Thread *thread)
{
-// ThreadParam *pParam = data;
-
MSG_SDATA_HIGH("Thread canceled. Ecore tID=0x%08x", thread);
-
- //PERF_CHECK_END(LVL3, "Deffered loading");
}
static int _sort_cb(const void *d1, const void *d2)
return (rand() % 4 - 2) ;
}
-#ifdef DEBUG_DUMP_LIST
-static void _print_shuffle(void *data)
-{
- MSG_SDATA_HIGH("Item : %d", (int)data);
-}
-
-static void _dump_list(Eina_List *list, void (*func)(void *))
-{
- Eina_List *l;
- void *data;
-
- EINA_LIST_FOREACH(list, l, data) {
- func(data);
- }
-
-}
-#endif
-
static void _ivug_medialist_set_filter(Media_List *mList, Filter_struct *filter)
{
IV_ASSERT(mList != NULL);
MSG_SDATA_FATAL("Header is not NULL");
return NULL;
}
-// _mList->filter = ivug_data_filter_copy(filter);
- PERF_CHECK_BEGIN(LVL3, "MediaList - Get list count");
-
- //_mList->count = ivug_list_get_dir_cnt(filter->dir_filter->basedir);
_mList->header = ivug_list_load_dir_items(filter->dir_filter->basedir);
_mList->count = eina_list_count(_mList->header);
if (_mList->count == 0) {
MSG_SDATA_ERROR("No file founded");
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return NULL;
}
cur = (Media_Item *)l;
}
}
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
if (cur == NULL) {
MSG_SDATA_ERROR("Not found current");
MSG_SDATA_HIGH("Starting thread");
- //PERF_CHECK_BEGIN(LVL3, "Deffered loading");
-
// do not use "thread end", "thread cancel" callback
// it can be called after ug unloaded
_mList->thread = ecore_thread_run(loader_heavy, NULL, NULL, pParam);
MSG_SDATA_HIGH("Total=%d Current=%d Bound(%d~%d)", _mList->count, db_idx, lBound, uBound);
- PERF_CHECK_BEGIN(LVL3, "MediaList - load first block");
// Load Center
header = _load_partial(filter, lBound, uBound);
_mList->lBound = lBound;
_mList->uBound = uBound;
- PERF_CHECK_END(LVL3, "MediaList - load first block");
-
if (header == NULL) {
- //MSG_SDATA_FATAL("MediaList is NULL");
MSG_SDATA_ERROR("MediaList is NULL");
return NULL;
}
_ivug_medialist_set_medialist_to_media_item(mList);
-// find current data;
- PERF_CHECK_BEGIN(LVL3, "MediaList - Find current");
-
Eina_List *current = eina_list_nth_list(header, db_idx - lBound);
- PERF_CHECK_END(LVL3, "MediaList - Find current");
-
if (current == NULL) {
MSG_SDATA_HIGH("current is NULL");
return NULL;
}
- PERF_CHECK_BEGIN(LVL3, "MediaList - shuffle");
-
_create_shuffle_list(_mList);
- PERF_CHECK_END(LVL3, "MediaList - shuffle");
-
- // _dump_list(_mList->shufflelist, _print_shuffle);
- // MSG_SDATA_HIGH("ParamPath=%s CurrentPath=%s", param->filepath, _mList->current->filepath);
-
if ((lBound == 0) && (uBound == (_mList->count - 1))) {
MSG_SDATA_HIGH("Deffered loading is not needed. LoadedCount=%d", eina_list_count(header));
_call_loaded_callback(_mList);
MSG_SDATA_FATAL("Header is not NULL");
return NULL;
}
-// _mList->filter = ivug_data_filter_copy(filter);
if (filter->view_by == IVUG_VIEW_BY_HIDDEN_ALL || filter->view_by == IVUG_VIEW_BY_HIDDEN_FOLDER) {
_mList->bHidden = true;
int db_idx = 0;
-#ifdef UNIT_TEST
- _mList->count = UT_TOTAL;
- db_idx = UT_INDEX;
-#else
- PERF_CHECK_BEGIN(LVL3, "MediaList - Get list count");
-
if (filter->file_list) {
_mList->count = eina_list_count(filter->file_list);
if (_mList->count == 0) {
MSG_SDATA_ERROR("No file founded");
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return NULL;
}
- PERF_CHECK_BEGIN(LVL3, "MediaList - load file list");
_mList->header = ivug_list_load_file_list(filter, filter->file_list); // Load all
- PERF_CHECK_END(LVL3, "MediaList - load file list");
if (_mList->header == NULL) {
MSG_SDATA_ERROR("MediaList is NULL");
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return NULL;
}
_ivug_medialist_set_medialist_to_media_item(mList);
_create_shuffle_list(_mList);
Media_Item *cur = ivug_medialist_find_item_by_filename(mList, filter->filepath);
_call_loaded_callback(_mList);
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return cur;
}
_mList->count = ivug_list_get_item_cnt(filter);
if (_mList->count == 0) {
MSG_SDATA_ERROR("No file founded");
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return NULL;
}
- PERF_CHECK_BEGIN(LVL3, "MediaList - load all block");
_mList->header = _load_partial(filter, 0, _mList->count - 1); // Load all
- PERF_CHECK_END(LVL3, "MediaList - load all block");
if (_mList->header == NULL) {
MSG_SDATA_ERROR("MediaList is NULL");
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return NULL;
}
_ivug_medialist_set_medialist_to_media_item(mList);
_create_shuffle_list(_mList);
Media_Item *cur = ivug_medialist_find_item_by_filename(mList, filter->filepath);
_call_loaded_callback(_mList);
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
return cur;
} else {
_mList->count = ivug_list_get_item_cnt(filter);
}
- PERF_CHECK_END(LVL3, "MediaList - Get list count");
-
MSG_SDATA_HIGH("Total item count=%d", _mList->count);
-/*
- TitleIndex : ¿ÜºÎ(Gallery)¿¡¼ È£ÃâµÇ´Â Index = [1~]
- mDataIndex : Mdata->index, db_index´Â [0~]
-*/
+
db_idx = filter->index - 1;
-#endif
Media_Item *current = _ivug_media_load_list(mList, filter, db_idx);
switch (filter->view_by) {
case IVUG_VIEW_BY_DIRECTORY :
- PERF_CHECK_BEGIN(LVL2, "media list load - directory");
current = _ivug_medialist_load_from_directory(mList, filter);
- PERF_CHECK_END(LVL2, "media list load - directory");
break;
default:
- PERF_CHECK_BEGIN(LVL2, "media list load");
current = _ivug_medialist_load_default(mList, filter);
- PERF_CHECK_END(LVL2, "media list load");
break;
}
return current;
switch (filter->view_by) {
case IVUG_VIEW_BY_DIRECTORY :
- PERF_CHECK_BEGIN(LVL2, "media list load - directory");
list = ivug_list_load_dir_items(filter->dir_filter->basedir);
count = eina_list_count(list);
- PERF_CHECK_END(LVL2, "media list load - directory");
break;
case IVUG_VIEW_BY_FOLDER:
case IVUG_VIEW_BY_HIDDEN_FOLDER:
- PERF_CHECK_BEGIN(LVL2, "media list load");
count = ivug_list_get_item_cnt(filter);
list = _load_partial(filter, 0, count - 1); // Load all
- PERF_CHECK_END(LVL2, "media list load");
break;
default: {
- PERF_CHECK_BEGIN(LVL2, "media list load");
count = ivug_list_get_item_cnt(filter);
int lBound;
list = _load_partial(filter, lBound, uBound);
- PERF_CHECK_END(LVL2, "media list load");
-
if ((lBound != 0) && (uBound != (_mList->count - 1))) {
bUseThread = true;
}
return (Media_Data *)eina_list_data_get((Eina_List *)item);
}
-
void ivug_medialist_delete_item(Media_List *mList, Media_Item *item, bool deleteItem)
{
- PERF_CHECK_BEGIN(LVL1, "MediaList - delete");
-
IV_ASSERT(mList != NULL);
_Media_List *_mList = (_Media_List *)mList;
_mList->prev_mitem = temp_prev_mitem;
_mList->cur_mitem = temp_next_mitem;
-// _mList->prev_mitem = NULL; // reset prev as NULL
-// _mList->cur_mitem = NULL; // reset cur as NULL
-
// Shuffle list?
_mList->count--;
_mList->shufflelist = eina_list_remove(_mList->shufflelist, found);
MSG_SDATA_HIGH("Item removed. Total=%d", _mList->count);
-
- PERF_CHECK_END(LVL1, "MediaList - delete");
-}
-
-
-Media_Item *ivug_medialist_get_random_item(Media_List *mList)
-{
- IV_ASSERT(mList != NULL);
- _Media_List *_mList = (_Media_List *)mList;
-
- int count = eina_list_count(_mList->header);
-
- if (count != 0) {
- return (Media_Item *)eina_list_nth_list(_mList->header, random() % count);
- } else {
- return NULL;
- }
-}
-
-Media_Item *
-ivug_medialist_find_item_by_index(Media_List *mList, int index)
-{
- IV_ASSERT(mList != NULL);
-
- MSG_IVUG_MED("ivug_medialist_find_item_by_index %d", index);
-
- _Media_List *_mList = (_Media_List *)mList;
-
- Eina_List *l = NULL;
- void *data;
-
- EINA_LIST_FOREACH(_mList->header, l, data) {
- Media_Data *mdata = (Media_Data *)data;
- if (mdata == NULL) {
- MSG_IVUG_ERROR("album list is NULL");
- break;
- }
- if (mdata->index == index) {
- return (Media_Item *)l;
- }
- }
- return NULL;
-}
-
-Media_Item * ivug_medialist_append_item(Media_List *mList, const char *filepath)
-{
- IV_ASSERT(mList != NULL);
-
- _Media_List *_mList = (_Media_List *)mList;
-
- _mList->header = ivug_list_append_item(_mList->header, filepath);
-
- _ivug_medialist_set_medialist_to_media_item(mList);
-
- _mList->count++;
-
- int index = 0;
- Eina_List *l;
- void *data;
-
- EINA_LIST_FOREACH(_mList->header, l, data) {
- Media_Data *mdata = (Media_Data *)data;
-
- mdata->index = index++;
- }
-
- return (Media_Item *)eina_list_last(_mList->header);
-}
-
-Media_Item * ivug_medialist_prepend_item(Media_List *mList, const char *filepath)
-{
- IV_ASSERT(mList != NULL);
-
- _Media_List *_mList = (_Media_List *)mList;
-
- _mList->header = ivug_list_prepend_item(_mList->header, filepath);
-
- _ivug_medialist_set_medialist_to_media_item(mList);
-
- _mList->count++;
-
- int index = 0;
- Eina_List *l;
-
- void *data;
-
- EINA_LIST_FOREACH(_mList->header, l, data) {
- Media_Data *mdata = (Media_Data *)data;
-
- mdata->index = index++;
- }
-
- return (Media_Item *)_mList->header;
}
bool ivug_medialist_set_current_item(Media_List *mList, Media_Item *mitem)
return;
}
-Eina_List *ivug_medialist_get_burst_item_list(Media_List *mList, const char *burst_id)
-{
- IV_ASSERT(mList != NULL);
- _Media_List *_mList = (_Media_List *)mList;
-
- int total_cnt = ivug_list_get_burst_item_cnt(_mList->filter_str, burst_id);
-
- Eina_List *list = ivug_list_load_burst_items(_mList->filter_str, burst_id, 0, total_cnt - 1);
-
- return list;
-}
-
-void ivug_medialist_del_burst_item_list(Eina_List *list)
-{
- ivug_list_delete_items(list);
-}
-
Filter_struct * ivug_medialist_get_filter(Media_List *mList)
{
IV_ASSERT(mList != NULL);
#include <device/power.h>
#include <assert.h>
-#include "statistics.h"
-
#define DEFAULT_THUMBNAIL "/opt/usr/share/media/.thumb/thumb_default.png"
#undef LOG_LVL
evas_object_resize(pSlideShow->sLayout[(pSlideShow->sCurrent + 1) % 2].layout, ow, oh);
}
-static void
-_shown(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
- MSG_HIGH("SlideShow is Shown");
-}
-
-static void
-_hidden(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
- MSG_HIGH("SlideShow is Hidden");
-}
-
static bool _ivug_ss_set_content(Slide_Layout *pSlide, Media_Item *item)
{
Media_Data *mdata;
y);
}
-#if 0
-static bool _ivug_ss_load_next_image(SlideShow *pSlideShow)
-{
- ivug_retv_if(!pSlideShow, false);
- MSG_HIGH("");
-
- Slide_Layout* sLyCurrent = &pSlideShow->sLayout[pSlideShow->sCurrent];
- Slide_Layout* sLy = &pSlideShow->sLayout[(pSlideShow->sCurrent + 1) % 2];
-
- Media_Item *next = NULL;
- Media_Item *current = sLyCurrent->mitem;
- do {
- next = ivug_ss_get_next_item(pSlideShow->media_list,
- pSlideShow->ss_Header,
- current,
- pSlideShow->ss_mode);
-
- if (next == NULL) {
- sLy->mitem = NULL;
- return false;
- }
- current = next;
- } while (!_ivug_ss_set_content(sLy, next));
-
- if (next) {
- evas_object_show(sLy->layout);
- }
-
- return true;
-}
-#endif
-
void _ivug_ss_effect_finished(void *data)
{
ivug_ret_if(!data);
pSlideShow->bSS_StopFlag = EINA_FALSE;
}
- //EFL::dump_obj(pSlideShow->obj, 0);
}
Evas_Object *_ivug_ss_create_layout(Evas_Object *parent, const char *edj_path, const char *group)
return ECORE_CALLBACK_CANCEL;
}
-// EFL::dump_obj(pSlideShow->obj, 0);
-
pSlideShow->cur_item = sLyNext->mitem;
ivug_effect_start(pSlideShow->effect_engine, _ivug_ss_effect_finished, pSlideShow);
return EFFECT_NONE;
}
-
-
-
void _ivug_ss_on_mouse_down(void *data, Evas *e,
Evas_Object *obj, void *event_info)
{
}
}
-void _ivug_ss_on_mouse_move(void *data, Evas *e,
- Evas_Object *obj, void *event_info)
-{
- MSG_LOW("_ivug_ss_on_mouse_move");
- return;
-}
-
static Eina_Bool _ivug_ss_clicked_timer_cb(void *data)
{
MSG_HIGH("-------------_ivug_ss_clicked_timer_cb--------------");
return;
}
-// Evas_Load_Error error = static_cast<Evas_Load_Error>(reinterpret_cast<int >(event_info));//check
- /*int *error = (int *)event_info;
- if (*error != EVAS_LOAD_ERROR_NONE) {
- MSG_SEC("Image loading failed. Error=%d File=%s",
- *error, mdata->filepath);
- _ivug_ss_load_next_image((SlideShow *)sLy->pSlideshow);
- return;
- }*/
edje_object_signal_emit(_EDJ(pSlideShow->sLayout[pSlideShow->sCurrent].layout), "elm,state,hide_thumbnail", "slideshow");
MSG_SEC("Photocam Pre-loaded. File=%s",
pSlideShow->effect_type = _ivug_ss_get_trans_effect(ivug_effect);
-// If Non-DALI slideshow.
char *edj_path = IVUG_SS_LY_EDJ_PATH;
pSlideShow->obj = _ivug_ss_create_layout(parent, edj_path, "view.slideshow");
free(edj_path);
evas_object_show(pSlideShow->event);
evas_object_repeat_events_set(pSlideShow->event, EINA_TRUE);
- //EFL::dump_obj(pSlideShow->obj, 0);
-
evas_object_event_callback_add(pSlideShow->obj, EVAS_CALLBACK_MOVE, _moved, pSlideShow);
evas_object_event_callback_add(pSlideShow->obj, EVAS_CALLBACK_RESIZE, _resized, pSlideShow);
- evas_object_event_callback_add(pSlideShow->obj, EVAS_CALLBACK_SHOW, _shown, pSlideShow);
- evas_object_event_callback_add(pSlideShow->obj, EVAS_CALLBACK_HIDE, _hidden, pSlideShow);
// Event
evas_object_event_callback_add(pSlideShow->event, EVAS_CALLBACK_MOUSE_DOWN, _ivug_ss_on_mouse_down, pSlideShow);
- evas_object_event_callback_add(pSlideShow->event, EVAS_CALLBACK_MOUSE_MOVE, _ivug_ss_on_mouse_move, pSlideShow);
evas_object_event_callback_add(pSlideShow->event, EVAS_CALLBACK_MOUSE_UP, _ivug_ss_on_mouse_up, pSlideShow);
return pSlideShow;
pSlideShow->state = SLIDE_SHOW_RUNNING;
-// EFL::dump_obj(pSlideShow->obj, 0);
-
if (pSlideShow->ss_timer) {
ecore_timer_del(pSlideShow->ss_timer);
}
}
evas_object_event_callback_del(pSlideShow->event, EVAS_CALLBACK_MOUSE_DOWN, _ivug_ss_on_mouse_down);
- evas_object_event_callback_del(pSlideShow->event, EVAS_CALLBACK_MOUSE_MOVE, _ivug_ss_on_mouse_move);
evas_object_event_callback_del(pSlideShow->event, EVAS_CALLBACK_MOUSE_UP, _ivug_ss_on_mouse_up);
if (pSlideShow->effect_engine) {
IVUG_FUNC_LEAVE();
}
-
-
Evas_Object *ivug_ss_object_get(SlideShow *pSlideShow)
{
MSG_ASSERT(pSlideShow != NULL);
-
return pSlideShow->obj;
-
}
void
ivug_ss_set_stop(SlideShow *pSlideShow)
{
MSG_ASSERT(pSlideShow != NULL);
-
pSlideShow->state = SLIDE_SHOW_STOPPED;
}
-
-
-
#include "ivug-debug.h"
#include "ivug-define.h"
-
#include "ivug-base.h"
-
-/*
- When turn on TRACE_MEMORY, you should set sticky bit to memsp.
-
- #chmod 4777 /usr/bin/memps
-*/
#undef TRACE_MEMORY
#ifdef TRACE_MEMORY
int main(int argc, char *argv[])
{
-
struct _ug_data ugd;
MSG_IMAGEVIEW_HIGH("IMAGE_VIEWER_MODULE ENTRANCE. Ver=12.0. RunCount=%d", nRunCount);
ui_app_lifecycle_callback_s ops;
-/* int ret = APP_ERROR_NONE;
-
- app_event_handler_h hLanguageChangedHandle;
- app_event_handler_h hRegionFormatChangedHandle;
-*/
memset(&ops, 0x0, sizeof(ui_app_lifecycle_callback_s));
memset(&ugd, 0x0, sizeof(struct _ug_data));
ops.resume = on_resume;
ops.app_control = ivug_param_create_from_bundle;
- /*ret = ui_app_add_event_handler(&hRegionFormatChangedHandle, APP_EVENT_REGION_FORMAT_CHANGED, _language_changed_cb, (void*)&ugd);
- if (ret != APP_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("APP_EVENT_REGION_FORMAT_CHANGED ui_app_add_event_handler failed : [%d]!!!", ret);
- return -1;
- }
-
- ret = ui_app_add_event_handler(&hLanguageChangedHandle, APP_EVENT_LANGUAGE_CHANGED, _language_changed_cb, (void*)&ugd);
- if (ret != APP_ERROR_NONE) {
- MSG_IMAGEVIEW_ERROR("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", ret);
- return -1;
- }*/
return ui_app_main(argc, argv, &ops, &ugd);
}