tizen 2.4 release
[apps/home/attach-panel-gallery.git] / include / ge-data-util.h
1 /*
2 * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18 #ifndef _GE_DATA_UTIL_H_
19 #define _GE_DATA_UTIL_H_
20
21 #include <stdio.h>
22 #include <glib.h>
23 #include <string.h>
24 #include <media_content.h>
25 #include "ge-debug.h"
26 #include "ge-strings.h"
27 #include "ge-data-type.h"
28 #include "ge-ugdata.h"
29
30 #ifdef _cplusplus
31 extern "C" {
32 #endif
33
34 /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music*/
35 #define GE_CONDITION_IMAGE_VIDEO "(MEDIA_TYPE=0 OR MEDIA_TYPE=1)"
36 #define GE_CONDITION_IMAGE       "(MEDIA_TYPE=0)"
37 #define GE_CONDITION_VIDEO       "(MEDIA_TYPE=1)"
38 /**< 0-not favourite, 1-favourite*/
39 #define GE_CONDITION_FAV_IMAGE_VIDEO "((MEDIA_TYPE=0 OR MEDIA_TYPE=1) AND MEDIA_FAVORITE=1)"
40
41 #define GE_CONDITION_FAVOR " AND MEDIA_FAVORITE=1"
42
43 #define GE_CONDITION_ORDER "MEDIA_TIMELINE, MEDIA_DISPLAY_NAME"
44 #define CONDITION_LENGTH 512
45 #define KEYWORD_LENGTH 128
46
47 #define GE_CAMERA_PATH_PHONE "/opt/usr/media/DCIM/Camera"
48 #define GE_CAMERA_PATH_MMC "/opt/storage/sdcard/DCIM/Camera"
49 #define GE_DOWNLOADS_PATH "/opt/usr/media/Downloads"
50
51 #define GE_ROOT_PATH_PHONE      "/opt/usr/media"
52 #define GE_ROOT_PATH_MMC        "/opt/storage/sdcard"
53 #define GE_DCIM "DCIM"
54
55 #define GE_ALBUM_ALL_ID "GALLERY_ALBUM_ALL_ALBUMS_ID"
56 /* String length of mtye item id */
57 #define GE_MTYPE_ITEN_ID_LEN_MAX 37
58
59 #define GE_BASE_WIN_WIDTH       720
60 #define GE_BASE_WIN_HEIGHT      1280
61 /* Indicator + naviframe title + naviframe bottom toobar */
62 #define GE_FIXED_HEIGHT_HIDE (111 + 98)
63 #define GE_FIXED_HEIGHT (60 + 111 + 98)
64
65 #define GE_GRID_ITEM_SIZE_W 202
66 #define GE_GRID_ITEM_SIZE_H 202
67 #define GE_GRID_ITEM_ZOOM_LEVEL_02 2
68 #define GE_GRID_ITEM_ZOOM_LEVEL_02_CNT 8
69
70 #define GE_ALBUM_COVER_THUMB_NUM 1
71
72 #define GE_SELINFO_TEXT_LEN_MAX 64
73 #define GE_ALBUM_DATE_LEN_MAX 256
74 #define GE_VIDEO_DURATION_MAX 256
75 #define GE_NOCONTENTS_LABEL_LEN_MAX 512
76 #define GE_FILE_PATH_LEN_MAX (4095 * GE_MAX_BYTES_FOR_CHAR + 1)
77 #define GE_DIR_PATH_LEN_MAX GE_FILE_PATH_LEN_MAX
78
79 #define GE_TIME_SECOND_MILLISECOND 1000 // 1s=1000ms
80 #define GE_TIME_USEC_PER_SEC 1000000L
81 #define GE_TIME_MINUTE_SECOND 60 // 1min=60s
82 #define GE_TIME_HOUR_MINUTE 60 // 1h=60min
83 #define GE_TIME_HOUR_SECOND (GE_TIME_HOUR_MINUTE * GE_TIME_MINUTE_SECOND) // 1h=(60x60)s
84
85 #define GE_FIRST_VIEW_START_POS 0
86 #define GE_GET_ONE_RECORD 1
87 #define GE_FIRST_VIEW_END_POS 47
88 #define GE_GET_UNTIL_LAST_RECORD 65536  /* Fixme: Do not use 65536. */
89 #define GE_GET_ALL_RECORDS -1
90
91 typedef struct _ge_transfer_data_t ge_transfer_data_s;
92
93 struct _ge_transfer_data_t {
94         void **userdata;
95         char *album_id;
96         bool with_meta;
97         bool b_mtype;
98         int list_type;
99 };
100
101 typedef struct _ge_filter_t ge_filter_s;
102
103 struct _ge_filter_t {
104         char cond[CONDITION_LENGTH];             /*set media type or favorite type, or other query statement*/
105         media_content_collation_e collate_type;  /*collate type*/
106         media_content_order_e sort_type;         /*sort type*/
107         char sort_keyword[KEYWORD_LENGTH];       /*sort keyword*/
108         int offset;                              /*offset*/
109         int count;                               /*count*/
110         bool with_meta;                          /*whether get image or video info*/
111         int list_type;
112 };
113
114 typedef enum {
115         GE_ALBUM_LIST_NONE,     /**<  */
116         GE_ALBUM_LIST_FIRST,    /**< Get first several albums except Camera and Downloads */
117         GE_ALBUM_LIST_PATH,     /**< Get a album via path */
118         GE_ALBUM_LIST_ALL,      /**< Get all albums except Camera and Downloads */
119 } ge_album_list_e;
120
121 typedef enum
122 {
123         GE_ALBUM_SNS_NONE,
124         GE_ALBUM_SNS_PICASA,
125         GE_ALBUM_SNS_FACEBOOK,
126 } ge_album_sns_type;
127
128 ge_item* _ge_data_util_calloc_geitem(void);
129 int _ge_data_util_free_geitem(ge_item* gitem);
130 int _ge_data_util_free_mtype_items(Eina_List **elist);
131 int _ge_data_util_free_cluster(ge_cluster* gcluster);
132 ge_cluster_list *_ge_data_util_calloc_clusters_list(void);
133 ge_cluster *_ge_data_util_calloc_cluster(void);
134 ge_cluster *_ge_data_util_new_cluster_all(ge_ugdata *ugd, int count);
135 ge_item *_ge_data_util_new_item_mitem(ge_media_s *mitem);
136 int _ge_data_util_free_item(ge_item *gitem);
137 ge_sel_item_s *_ge_data_util_new_sel_item(ge_item *gitem);
138 int _ge_data_util_free_sel_item(ge_sel_item_s *item);
139 ge_sel_album_s *_ge_data_util_new_sel_album(char *album_uuid);
140 int _ge_data_util_create_filter2(char *cond, char *keyword, int offset,
141                                  int count, filter_h *filter);
142 int _ge_data_util_create_filter(ge_filter_s *condition, filter_h *filter);
143 int _ge_data_util_destroy_filter(filter_h filter);
144 bool _ge_data_util_clone_media(media_info_h media, ge_media_s **pitem,
145                                bool b_meta);
146 int _ge_data_util_get_geo_cond(char *cond, double longmin, double longmax,
147                                double latmin, double latmax);
148 int _ge_data_util_get_type_cond(char *cond, int file_t);
149
150 #ifdef _cplusplus
151 }
152 #endif
153
154 #endif //_GE_DATA_UTIL_H_
155