1.Set as Contact fix 2.File size limit set to 255
[apps/osp/ImageViewer.git] / inc / IvImageViewerPresentationModel.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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                IvImageViewerPresentationModel.h
19  * @brief               This is the header file for ImageViewerPresentationModel class.
20  */
21
22 #ifndef _IV_VIEWER_PRESENTATION_MODEL_H_
23 #define _IV_VIEWER_PRESENTATION_MODEL_H_
24
25 #include <FContent.h>
26 #include "IvImageProviderEventListener.h"
27 #include "IvTypes.h"
28
29 class ImageEvent;
30 class ImageInfo;
31 class ImageProvider;
32 class IImageViewerEventListener;
33 class SettingPresentationModel;
34 class IFileUpdateEventListener;
35
36 class ImageViewerPresentationModel
37         : public IImageProviderEventListener
38         , public Tizen::Content::IContentUpdateEventListener
39 {
40 public:
41         static ImageViewerPresentationModel* GetInstance();
42
43 public:
44         result AddListener(IImageViewerEventListener* pListener);
45         result RemoveListener(IImageViewerEventListener& listner);
46
47         result AddFileUpdateListener(IFileUpdateEventListener* pListener);
48         result RemoveFileUpdateListener(IFileUpdateEventListener& listner);
49
50         void ClearImageRequests(bool isAppTerminating = false);
51         void DeleteFilePathAt(const int index);
52         void UpdateFilePathAt(const int index, const Tizen::Base::String& filePath);
53         Tizen::Base::String GetFilePathAt(const int index) const;
54         Tizen::Base::Collection::ArrayList* GetImageCache(void) const;
55         ImageInfo* GetImageCacheAt(const int index) const;
56         void AddImageCache(const Tizen::Base::String& filePath);
57
58         int GetFileCount(void) const;
59         Tizen::Base::String GetType(void) const;
60         int GetStartIndex(void) const;
61
62         Tizen::Base::String GetFileName(const Tizen::Base::String& filePath, bool isCheckExe = false) const;
63         void RequestImage(const Tizen::Base::String& filePath);
64         Tizen::Graphics::Bitmap* GetImage(const Tizen::Base::String& filePath);
65         Tizen::Content::ContentId GetFileContentId(const Tizen::Base::String& filePath) const;
66
67         int GetDurationOfSlideShow(void) const;
68         SlideShowTransitionEffect GetTransitionEffectOfSlideShow(void) const;
69
70         result StartAppControl(const Tizen::Base::String& providerId, const Tizen::Base::String&  operationId,
71                                 const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType,
72                                 const Tizen::Base::Collection::HashMap* pDataList, Tizen::App::IAppControlResponseListener* pListener);
73
74         virtual void OnImageReceivedN(Tizen::Base::Runtime::IEventArg& eventArg);
75
76         virtual void OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
77         virtual void OnContentFileUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
78         virtual void OnContentFileDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
79         virtual void OnContentDirectoryScanCompleted(const Tizen::Base::String& directoryPath, result r);
80
81 private:
82         ImageViewerPresentationModel(void);
83         ImageViewerPresentationModel(const ImageViewerPresentationModel&);
84         virtual ~ImageViewerPresentationModel(void);
85         ImageViewerPresentationModel& operator=(const ImageViewerPresentationModel&);
86
87         result Construct(void);
88         static void CreateInstance(void);
89         static void DestroyInstance(void);
90
91         void LoadSettingValue(void);
92         int GetImageCacheIndex(const Tizen::Base::String& );
93
94 private:
95         static ImageViewerPresentationModel* __pPresentationModelInstance;
96         static ImageProvider* __pImageProvider;
97         static ImageEvent* __pImageEvent;
98         static Tizen::Base::Collection::ArrayList* __pImageViewerListener;
99         Tizen::Base::Collection::ArrayList* __pFileUpdateListener;
100         Tizen::Base::Collection::ArrayList* __pImageCaches;
101         long long __contactId;
102         int __startIndex;
103         Tizen::Base::String __type;
104         int __durationOfSlideShow;
105         SlideShowTransitionEffect __transitionEffectOfSlideShow;
106         Tizen::Content::ContentManager* __pCntMgr;
107         SettingPresentationModel* __pSettingPresentationModel;
108         bool __isIvTriggeredEvent;
109         short __contentFileEventType;
110         Tizen::Content::ContentId __contentId;
111         bool __isIvTriggeredDeleteEvent;
112 };
113
114 #endif /* _IV_VIEWER_PRESENTATION_MODEL_H_ */