c4c28d1dad29feb194e0a35145a5f2c72bc1a705
[apps/osp/Gallery.git] / inc / GlAlbumListPresentationModel.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                GlAlbumListPresentationModel.h
19  * @brief               This is the header file for AlbumListPresentationModel class.
20  */
21
22 #ifndef _GL_ALBUM_LIST_PRESENTATION_MODEL_H_
23 #define _GL_ALBUM_LIST_PRESENTATION_MODEL_H_
24
25 #include <FApp.h>
26 #include <FBase.h>
27 #include <FContent.h>
28 #include <FCntIContentScanListener.h>
29 #include <FGraphics.h>
30 #include <FIo.h>
31 #include <FSystem.h>
32 #include <FUi.h>
33 #include "GlAlbumEventListener.h"
34 #include "GlFormContentUpdateEventListener.h"
35 #include "GlResourceManager.h"
36 #include "GlThumbnailEventListener.h"
37 #include "GlThumbnailProvider.h"
38 #include "GlTypes.h"
39
40 class AlbumInfo;
41 class IAlbumRenameEventListener;
42
43 class AlbumListPresentationModel
44         : public Tizen::Base::Object
45         , public IThumbnailEventListener
46         , public Tizen::Content::IContentScanListener
47         , public Tizen::System::IDeviceEventListener
48 {
49 public:
50         static AlbumListPresentationModel* GetInstance(void);
51
52 public:
53         result AddPresentationModelListener(IAlbumEventListener* listener);
54         result RemovePresentationModelListener(IAlbumEventListener& listner);
55
56         static void AddContentEventListener(const IFormContentUpdateEventListener* listener);
57         static void RemoveContentEventListener(const IFormContentUpdateEventListener& listener);
58
59         void RequestThumbnail(const int folderIndex, int pathIndex);
60         void CancelThumbnailRequest(const int folderIndex);
61         void ClearThumbnailRequests(bool appTerminating = false);
62         result StartAppControl(const Tizen::Base::String&  providerId, const Tizen::Base::String&  operationId,
63                         const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pDataList,
64                         Tizen::App::IAppControlResponseListener* pListener);
65
66         void InitializeAlbumInfoList(const Tizen::Content::ContentType& contentType);
67         result DeleteContentInfoInDirectory(int index, Tizen::Content::ContentType contentType);
68         void CallAlbumChangedEvent(void);
69         int GetFolderCount(void);
70
71         Tizen::Graphics::Bitmap* CreateMergeBitmapN(int index);
72         Tizen::Base::Collection::IList* GetAlbumInfoList(void);
73
74         AppControlMode GetAppControlMode(void) const;
75         AppControlMediaType GetAppControlMediaType(void) const;
76         AppControlSelectionMode GetAppControlSelectionMode(void) const;
77
78         result RenameAlbum(const Tizen::Base::String&, const Tizen::Base::String&, IAlbumRenameEventListener*);
79
80         virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg);
81
82         //From IContentScanListener
83         virtual void OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r);
84
85         void OnContentCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
86         void OnContentUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
87         void OnContentDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
88
89         virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
90
91 private:
92         AlbumListPresentationModel(void);
93         virtual ~AlbumListPresentationModel(void);
94         AlbumListPresentationModel(const AlbumListPresentationModel&);
95         const AlbumListPresentationModel& operator = (const AlbumListPresentationModel&);
96
97         result Construct(void);
98         static void CreateInstance(void);
99         static void DestroyInstance(void);
100
101         void DrawPartialImage(Tizen::Graphics::Canvas& canvas, AlbumInfo* pAlbumInfo,
102                         const Tizen::Graphics::Rectangle& rectNew);
103         void DrawFontImage(Tizen::Graphics::Canvas& canvas, AlbumInfo* pAlbumInfo, int index);
104
105         Tizen::Base::String GetDirectoryName(Tizen::Base::String& directoryPath);
106         Tizen::Base::Collection::IList* GetContentIdListInDirectoryN(const Tizen::Base::String& directoryPath,
107                         Tizen::Content::ContentType contentType) const;
108         Tizen::Base::String GetDirectoryNameFromFullPath(const Tizen::Base::String& fullPath) const;
109
110 private:
111         static AlbumListPresentationModel* __pPresentationModelInstance;
112         static ThumbnailProvider* __pThumbnailProvider;
113
114         Tizen::Graphics::Bitmap* __pFolderBackgroundBitmap;
115         static ThumbnailEvent* __pThumbnailEvent;
116         Tizen::Content::ContentManager* __pContentManager;
117
118         static Tizen::Base::Collection::ArrayList* __pContentEventListener;
119         static Tizen::Base::Collection::ArrayList* __pPresentationModelListener;
120         static Tizen::Base::Collection::IList* __pAlbumInfoList;
121
122         IAlbumRenameEventListener* __pAlbumListener;
123         RequestId __reqId;
124
125         AppControlMode __appControlMode;
126         AppControlMediaType __appControlMediaType;
127         AppControlSelectionMode __appControlSelectionMode;
128 };
129
130 #endif /* _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ */