Fixed jira issues
[apps/osp/Gallery.git] / inc / GlThumbnailProvider.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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  * @file                GlThumbnailProvider.h
19  * @brief               This is the header file for ThumbnailProvider class.
20  */
21
22 #ifndef _GL_THUMBNAIL_PROVIDER_H_
23 #define _GL_THUMBNAIL_PROVIDER_H_
24
25 #include <FBase.h>
26 #include <FGraphics.h>
27 #include "GlThumbnailInfo.h"
28
29 class ThumbnailEvent;
30
31 class ThumbnailProvider
32         : public Tizen::Base::Runtime::EventDrivenThread
33 {
34 public:
35         static ThumbnailProvider* GetInstance(void);
36
37 public:
38         static void Release(void);
39
40         void RequestThumbnail(const Tizen::Content::ContentId& contentId, const ThumbnailEvent* event);
41         void CancelThumbnailRequest(const Tizen::Content::ContentId& contentId, const ThumbnailEvent* event);
42         void ClearThumbnailRequests(bool appTerminating = false);
43
44         virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList * pArgs);
45         virtual bool OnStart(void);
46         virtual void OnStop(void);
47
48 private:
49         ThumbnailProvider(void);
50         virtual ~ThumbnailProvider(void);
51         ThumbnailProvider(ThumbnailProvider& value);
52         ThumbnailProvider& operator = (ThumbnailProvider&);
53
54         result Construct(void);
55         static void CreateInstance(void);
56         static void DestroyInstance(void);
57
58         ThumbnailInfo* GetThumbnailInfoN(const Tizen::Content::ContentId& contentId) const;
59         Tizen::Graphics::Bitmap* GetThumbnailByDecodeN(const Tizen::Base::String& filePath, const Tizen::Content::ContentType contentType) const;
60         Tizen::Base::String GetFileNameFromFullPath(const Tizen::Base::String& fullPath, bool withExt) const;
61
62 private:
63         static ThumbnailProvider* __pThumbnailProviderInstance;
64         static Tizen::Base::Collection::ArrayList* __pThumbnailEventListener;
65
66         Tizen::Base::Runtime::Mutex* __pMutexCmd;
67         Tizen::Base::Collection::ArrayList* __pCmdQueue;
68         unsigned long __requestId;
69         bool __appTerminating;
70 };
71
72 #endif /* _GL_THUMBNAIL_PROVIDER_H_ */