wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / Content / ContentMedia.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #include <Commons/Exception.h>
19 #include "ContentMedia.h"
20 #include <aul/aul.h>
21 #include <Logger.h>
22
23 namespace DeviceAPI {
24 namespace Content {
25
26 MediacontentMedia::MediacontentMedia()
27 {
28         m_isChangedFavorite = false;
29         m_isChangedDisplayName = false;
30         m_createdDate = NULL;
31         m_releasedDate = NULL;
32         m_modifiedDate = NULL;
33
34         m_size = 0;
35         m_rating = 0;
36         m_favorite = false;  //unused.
37         m_editableAttrList.push_back("name");
38         m_editableAttrList.push_back("rating");
39         m_editableAttrList.push_back("description");
40 }
41
42 MediacontentMedia::~MediacontentMedia()
43 {
44     m_editableAttrList.clear();
45     if(m_createdDate != NULL)
46     {
47         free(m_createdDate);
48     }
49     if(m_releasedDate != NULL)
50     {
51         free(m_releasedDate);
52     }
53     if(m_modifiedDate != NULL)
54     {
55         free(m_modifiedDate);
56     }
57 }
58
59 string MediacontentMedia::getMediaUUID() const
60 {
61         return m_mediaUUID;
62 }
63
64 void MediacontentMedia::setMediaUUID(const string &value)
65 {
66         m_mediaUUID = value;
67 }
68
69 string MediacontentMedia::getMimeType()
70 {
71         LoggerD("MediacontentMedia::getMimeType");              
72         return m_mimeType;
73 }
74
75 string MediacontentMedia::getDisplayName() const
76 {
77     return m_displayName;
78 }
79
80 void MediacontentMedia::setMimeType(const string &value)
81 {
82         m_mimeType = value;
83 }
84
85 void MediacontentMedia::setDisplayName(const string &value, bool isChanged)
86 {
87         m_displayName = value;
88         if (isChanged)
89                 m_isChangedDisplayName = true;
90 }
91
92 string MediacontentMedia::getTitle() const
93 {
94     return m_title;
95 }
96
97 void MediacontentMedia::setTitle(const string &value)
98 {
99         m_title = value;
100 }
101
102 string MediacontentMedia::getFilePath() const
103 {
104         return m_filePath;
105
106 }
107
108 void MediacontentMedia::setFilePath(const string &value)
109 {
110         m_filePath = value;
111
112 }
113
114 string MediacontentMedia::getThumbnailPath() const
115 {
116         return m_thumbnailPath;
117 }
118
119
120 tm* MediacontentMedia::getCreatedDate() const
121 {
122         return m_createdDate;
123 }
124
125 tm* MediacontentMedia::getReleasedDate() const
126 {
127         return m_releasedDate;
128 }
129
130 void MediacontentMedia::setThumbnailPath(const string &value)
131 {
132         m_thumbnailPath = value;
133
134 }
135 tm* MediacontentMedia::getModifiedDate() const
136 {
137         return m_modifiedDate;
138 }
139
140 void MediacontentMedia::setCreatedDate(tm *value)
141 {
142         m_createdDate = value;
143
144 }
145
146 void MediacontentMedia::setReleasedDate(tm *value)
147 {
148         m_releasedDate = value;
149
150 }
151
152 void MediacontentMedia::setModifiedDate(tm *value)
153 {
154         m_modifiedDate = value;
155
156 }
157 bool MediacontentMedia::getFavorite() const
158 {
159         return m_favorite;
160 }
161 void MediacontentMedia::setFavorite(bool value)
162 {
163         m_favorite = value;
164         m_isChangedFavorite = true;
165
166 }
167 string MediacontentMedia::getMediaType() const
168 {
169         return m_mediaType;
170 }
171
172 void MediacontentMedia::setMediaType(const string &value) 
173 {
174         m_mediaType = value;
175 }
176
177 void MediacontentMedia::display() const
178 {
179
180         LoggerD("m_mediaUUID : " << m_mediaUUID);
181         LoggerD("m_mediaType : " << m_mediaType);
182 //      LoggerD("m_mimeType : " << m_mimeType);
183         LoggerD("m_displayName : " << m_displayName);
184         LoggerD("m_filePath : " << m_filePath);
185         LoggerD("m_thumbnailPath : " << m_thumbnailPath);
186         LoggerD("m_description : " << m_description);
187 //      LoggerD("m_createdDate : " << m_createdDate);
188 //      LoggerD("m_releasedDate : " << m_releasedDate);
189 //      LoggerD("m_modifiedDate : " << m_modifiedDate);
190         LoggerD("m_favorite : " << m_favorite);
191         
192
193 }
194 string MediacontentMedia::getDescription() const
195 {
196         return m_description;
197 }
198
199 void MediacontentMedia::setDescription(const string &value, bool isChanged)
200 {
201         m_description = value;
202         if ( isChanged )
203                 m_isChangedDescription = true;
204         
205 }
206
207 bool MediacontentMedia::getIsChangedFavorite() const
208 {
209         return m_isChangedFavorite;
210 }
211
212 bool MediacontentMedia::isChangedRating() const
213 {
214         return m_isChangedRating;
215 }
216
217 bool MediacontentMedia::isChangedDisplayName() const
218 {
219         return m_isChangedDisplayName;
220 }
221
222 bool MediacontentMedia::isChangedDescription() const
223 {
224         return m_isChangedDescription;
225 }
226
227 vector<std::string>     MediacontentMedia::getEditableAttr() const
228 {
229     return m_editableAttrList;
230 }
231
232 void MediacontentMedia::setSize(unsigned long long value)
233 {
234         m_size = value;
235 }
236
237 unsigned long long MediacontentMedia::getSize() const
238 {
239         return m_size;
240 }
241
242 void MediacontentMedia::setRating(int value, bool isChanged)
243 {
244         m_rating = value;
245         if ( isChanged )
246                 m_isChangedRating = true;
247 }
248
249 int MediacontentMedia::getRating() const
250 {
251         return m_rating;
252 }
253
254 }
255 }