delete progress bar implementation
[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 "GlIContentFileDeleteManager.h"
36 #include "GlResourceManager.h"
37 #include "GlThumbnailEventListener.h"
38 #include "GlThumbnailProvider.h"
39 #include "GlTypes.h"
40
41 class AlbumInfo;
42 class IAlbumRenameEventListener;
43
44 class AlbumListPresentationModel
45         : public Tizen::Base::Object
46         , public IContentFileDeleteManager
47         , public IThumbnailEventListener
48         , public Tizen::Content::IContentScanListener
49         , public Tizen::System::IDeviceEventListener
50 {
51 public:
52         static AlbumListPresentationModel* GetInstance(void);
53
54 public:
55         result AddPresentationModelListener(IAlbumEventListener* listener);
56         result RemovePresentationModelListener(IAlbumEventListener& listner);
57
58         static void AddContentEventListener(const IFormContentUpdateEventListener* listener);
59         static void RemoveContentEventListener(const IFormContentUpdateEventListener& listener);
60
61         void RequestThumbnail(const int folderIndex, int pathIndex);
62         void CancelThumbnailRequest(const int folderIndex);
63         void ClearThumbnailRequests(bool appTerminating = false);
64         result StartAppControl(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId,
65                         const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType,
66                         const Tizen::Base::Collection::HashMap* pDataList, Tizen::App::IAppControlResponseListener* pListener);
67
68         void InitializeAlbumInfoList(const Tizen::Content::ContentType& contentType);
69         void CallAlbumChangedEvent(void);
70         int GetFolderCount(void);
71
72         Tizen::Graphics::Bitmap* CreateMergeBitmapN(int index);
73         Tizen::Base::Collection::IList* GetAlbumInfoList(void);
74
75         AppControlMode GetAppControlMode(void) const;
76         AppControlMediaType GetAppControlMediaType(void) const;
77         AppControlSelectionMode GetAppControlSelectionMode(void) const;
78
79         result RenameAlbum(const Tizen::Base::String&, const Tizen::Base::String&, IAlbumRenameEventListener*);
80
81         virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList);
82         virtual result DeleteContentFile(const Tizen::Content::ContentId& contentId);
83
84         virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg);
85
86         virtual void OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r);
87
88         void OnContentCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
89         void OnContentUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
90         void OnContentDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
91
92         virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
93         void SetUpdateProgressStatus(bool status);
94
95 private:
96         AlbumListPresentationModel(void);
97         virtual ~AlbumListPresentationModel(void);
98         AlbumListPresentationModel(const AlbumListPresentationModel&);
99         const AlbumListPresentationModel& operator = (const AlbumListPresentationModel&);
100
101         result Construct(void);
102         static void CreateInstance(void);
103         static void DestroyInstance(void);
104
105         void DrawPartialImage(Tizen::Graphics::Canvas& canvas, AlbumInfo* pAlbumInfo,
106                         const Tizen::Graphics::Rectangle& rectNew);
107         void DrawFontImage(Tizen::Graphics::Canvas& canvas, AlbumInfo* pAlbumInfo, int index);
108
109         Tizen::Base::String GetDirectoryName(Tizen::Base::String& directoryPath);
110         Tizen::Base::Collection::IList* GetContentIdListInDirectoryN(const Tizen::Base::String& directoryPath,
111                         Tizen::Content::ContentType contentType) const;
112         Tizen::Base::String GetDirectoryNameFromFullPath(const Tizen::Base::String& fullPath) const;
113
114 private:
115         static AlbumListPresentationModel* __pPresentationModelInstance;
116         static ThumbnailProvider* __pThumbnailProvider;
117
118         Tizen::Graphics::Bitmap* __pFolderBackgroundBitmap;
119         static ThumbnailEvent* __pThumbnailEvent;
120         Tizen::Content::ContentManager* __pContentManager;
121
122         static Tizen::Base::Collection::ArrayList* __pContentEventListener;
123         static Tizen::Base::Collection::ArrayList* __pPresentationModelListener;
124         static Tizen::Base::Collection::IList* __pAlbumInfoList;
125
126         IAlbumRenameEventListener* __pAlbumListener;
127         RequestId __reqId;
128
129         AppControlMode __appControlMode;
130         AppControlMediaType __appControlMediaType;
131         AppControlSelectionMode __appControlSelectionMode;
132         bool __updateProgressStatus;
133 };
134
135 #endif /* _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ */