2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file GlAlbumListPresentationModel.h
19 * @brief This is the header file for AlbumListPresentationModel class.
22 #ifndef _GL_ALBUM_LIST_PRESENTATION_MODEL_H_
23 #define _GL_ALBUM_LIST_PRESENTATION_MODEL_H_
28 #include <FCntIContentScanListener.h>
29 #include <FGraphics.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"
42 class IAlbumRenameEventListener;
44 class AlbumListPresentationModel
45 : public Tizen::Base::Object
46 , public IContentFileDeleteManager
47 , public IThumbnailEventListener
48 , public Tizen::Content::IContentScanListener
49 , public Tizen::System::IDeviceEventListener
52 static AlbumListPresentationModel* GetInstance(void);
55 result AddPresentationModelListener(IAlbumEventListener* listener);
56 result RemovePresentationModelListener(IAlbumEventListener& listner);
58 static void AddContentEventListener(const IFormContentUpdateEventListener* listener);
59 static void RemoveContentEventListener(const IFormContentUpdateEventListener& listener);
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);
68 void InitializeAlbumInfoList(const Tizen::Content::ContentType& contentType);
69 void CallAlbumChangedEvent(void);
70 int GetFolderCount(void);
72 Tizen::Graphics::Bitmap* CreateMergeBitmapN(int index);
73 Tizen::Base::Collection::IList* GetAlbumInfoList(void);
75 AppControlMode GetAppControlMode(void) const;
76 AppControlMediaType GetAppControlMediaType(void) const;
77 AppControlSelectionMode GetAppControlSelectionMode(void) const;
79 result RenameAlbum(const Tizen::Base::String&, const Tizen::Base::String&, IAlbumRenameEventListener*);
81 virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList);
82 virtual result DeleteContentFile(const Tizen::Content::ContentId& contentId);
84 virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg);
86 virtual void OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r);
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);
92 virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
93 void SetUpdateProgressStatus(bool status);
96 AlbumListPresentationModel(void);
97 virtual ~AlbumListPresentationModel(void);
98 AlbumListPresentationModel(const AlbumListPresentationModel&);
99 const AlbumListPresentationModel& operator = (const AlbumListPresentationModel&);
101 result Construct(void);
102 static void CreateInstance(void);
103 static void DestroyInstance(void);
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);
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;
115 static AlbumListPresentationModel* __pPresentationModelInstance;
116 static ThumbnailProvider* __pThumbnailProvider;
118 Tizen::Graphics::Bitmap* __pFolderBackgroundBitmap;
119 static ThumbnailEvent* __pThumbnailEvent;
120 Tizen::Content::ContentManager* __pContentManager;
122 static Tizen::Base::Collection::ArrayList* __pContentEventListener;
123 static Tizen::Base::Collection::ArrayList* __pPresentationModelListener;
124 static Tizen::Base::Collection::IList* __pAlbumInfoList;
126 IAlbumRenameEventListener* __pAlbumListener;
129 AppControlMode __appControlMode;
130 AppControlMediaType __appControlMediaType;
131 AppControlSelectionMode __appControlSelectionMode;
132 bool __updateProgressStatus;
135 #endif /* _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ */