Fix slideshow error - QuickThumb
authorHyukSoon Choi <hs619.choi@samsung.com>
Sat, 13 Apr 2013 10:46:28 +0000 (19:46 +0900)
committerHyukSoon Choi <hs619.choi@samsung.com>
Sat, 13 Apr 2013 10:46:28 +0000 (19:46 +0900)
Change-Id: I4d99dc9e18aa89ad8a5b1d69045f1c4948d40b97
Signed-off-by: HyukSoon Choi <hs619.choi@samsung.com>
inc/IvImageProvider.h
inc/IvImageViewerPresentationModel.h
src/IvImageProvider.cpp
src/IvImageViewerForm.cpp
src/IvImageViewerPresentationModel.cpp

index 438d389..181fcfa 100644 (file)
@@ -32,6 +32,7 @@ class ImageProvider
 {
 public:
        void RequestImage(const Tizen::Base::String& filePath, const ImageEvent* pRequestEvent);
+       Tizen::Graphics::Bitmap* GetImage(const Tizen::Base::String& filePath);
        void ClearImageRequests(bool isAppTerminating = false);
 
        virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList * pArgs);
index 19ea783..cad2162 100644 (file)
@@ -67,7 +67,8 @@ public:
        int GetStartIndex(void) const;
 
        Tizen::Base::String GetFileName(const Tizen::Base::String& filePath, bool isCheckExe = false) const;
-       void RequestImage(const Tizen::Base::String& filePath) const;
+       void RequestImage(const Tizen::Base::String& filePath);
+       Tizen::Graphics::Bitmap* GetImage(const Tizen::Base::String& filePath);
        Tizen::Content::ContentId GetFileContentId(const Tizen::Base::String& filePath) const;
 
        int GetDurationOfSlideShow(void) const;
@@ -79,13 +80,11 @@ public:
 
        virtual void OnImageReceivedN(Tizen::Base::Runtime::IEventArg& eventArg);
 
-       //From IContentUpdateEventListener
        virtual void OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
        virtual void OnContentFileUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
        virtual void OnContentFileDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
        virtual void OnContentDirectoryScanCompleted(const Tizen::Base::String& directoryPath, result r);
 
-
 private:
        ImageViewerPresentationModel(void);
        ImageViewerPresentationModel(const ImageViewerPresentationModel&);
index 46b17ea..a737cf1 100644 (file)
@@ -200,6 +200,18 @@ ImageProvider::RequestImage(const String& filePath, const ImageEvent* event)
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
+Bitmap*
+ImageProvider::GetImage(const String& filePath)
+{
+       AppLogDebug("ENTER");
+
+       Bitmap* pBitmap = GetImageByDecodeN(filePath);
+
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+
+       return pBitmap;
+}
+
 void
 ImageProvider::ClearImageRequests(bool isAppTerminating)
 {
@@ -327,4 +339,3 @@ ImageProvider::GetImageByDecodeN(const String& filePath) const
 
        return pBitmap;
 }
-
index 89a2445..abb9487 100644 (file)
@@ -1132,7 +1132,12 @@ ImageViewerForm::CreateItem(int index)
        {
                pBitmap = GetQuickThumbnailN(filePath);
 
-               if (pBitmap == null)
+               if (pBitmap == null && __pGallery->IsSlideShowStarted() == true)
+               {
+                       pBitmap = __pPresentationModel->GetImage(filePath);
+                       __pPresentationModel->RequestImage(filePath);
+               }
+               else if (pBitmap == null)
                {
                        pBitmap = new (std::nothrow) Bitmap();
                        pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
@@ -1156,7 +1161,6 @@ ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
                curIndex = __pShuffledList[index];
        }
 
-
        ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(curIndex);
        pImageInfo->ClearBitmap();
        delete pItem;
@@ -1171,7 +1175,6 @@ ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
        AppLogDebug("ImageViewerForm::OnGalleryCurrentItemChanged index(%d)", index);
 
        String filePath = __pPresentationModel->GetFilePathAt(index);
-       AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
        __pPresentationModel->RequestImage(filePath);
 
        String strItemIdxText;
@@ -1241,15 +1244,17 @@ ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
 {
        AppLogDebug("ENTER");
        PowerManager::KeepScreenOnState(true, false);
+
+       int index = __pGallery->GetCurrentItemIndex();
+       String filePath = __pPresentationModel->GetFilePathAt(index);
+       __pPresentationModel->RequestImage(filePath);
+
        if (__isVisible  == true)
        {
                SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
                __pLabel->SetShowState(false);
 
-               int index = __pGallery->GetCurrentItemIndex();
-               String filePath = __pPresentationModel->GetFilePathAt(index);
                ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
-
                if (contentType == CONTENT_TYPE_VIDEO)
                {
                        __pPlayButton->SetShowState(false);
@@ -1274,7 +1279,6 @@ ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
 
        if (__isShuffle == true)
        {
-
                if (__pShuffelTimer == null)
                {
                        __pShuffelTimer = new (std::nothrow) Timer();
@@ -1288,7 +1292,6 @@ ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
                SlideShowStopped(index);
        }
 
-
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
index 5016b35..f66561b 100644 (file)
@@ -323,10 +323,14 @@ ImageViewerPresentationModel::GetImageCacheAt(const int index) const
 void
 ImageViewerPresentationModel::AddImageCache(const String& filePath)
 {
+       AppLogDebug("ENTER");
+
        ImageInfo* pImageInfo = null;
        pImageInfo = new (std::nothrow) ImageInfo();
        pImageInfo->Construct(filePath, null);
        __pImageCaches->Add(pImageInfo);
+
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 int
@@ -404,7 +408,7 @@ ImageViewerPresentationModel::StartAppControl(const String& providerId, const St
 }
 
 void
-ImageViewerPresentationModel::RequestImage(const Tizen::Base::String& filePath) const
+ImageViewerPresentationModel::RequestImage(const Tizen::Base::String& filePath)
 {
        AppLogDebug("ENTER");
 
@@ -413,6 +417,18 @@ ImageViewerPresentationModel::RequestImage(const Tizen::Base::String& filePath)
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
+Bitmap*
+ImageViewerPresentationModel::GetImage(const Tizen::Base::String& filePath)
+{
+       AppLogDebug("ENTER");
+
+       Bitmap* pBitmap = __pImageProvider->GetImage(filePath);
+
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+
+       return pBitmap;
+}
+
 ContentId
 ImageViewerPresentationModel::GetFileContentId(const String& filePath) const
 {