From cfb9f658cdbcaa3aa942ebf0ee2f18ad92e7386a Mon Sep 17 00:00:00 2001 From: HyukSoon Choi Date: Sat, 13 Apr 2013 19:46:28 +0900 Subject: [PATCH] Fix slideshow error - QuickThumb Change-Id: I4d99dc9e18aa89ad8a5b1d69045f1c4948d40b97 Signed-off-by: HyukSoon Choi --- inc/IvImageProvider.h | 1 + inc/IvImageViewerPresentationModel.h | 5 ++--- src/IvImageProvider.cpp | 13 ++++++++++++- src/IvImageViewerForm.cpp | 19 +++++++++++-------- src/IvImageViewerPresentationModel.cpp | 18 +++++++++++++++++- 5 files changed, 43 insertions(+), 13 deletions(-) diff --git a/inc/IvImageProvider.h b/inc/IvImageProvider.h index 438d389..181fcfa 100644 --- a/inc/IvImageProvider.h +++ b/inc/IvImageProvider.h @@ -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); diff --git a/inc/IvImageViewerPresentationModel.h b/inc/IvImageViewerPresentationModel.h index 19ea783..cad2162 100644 --- a/inc/IvImageViewerPresentationModel.h +++ b/inc/IvImageViewerPresentationModel.h @@ -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&); diff --git a/src/IvImageProvider.cpp b/src/IvImageProvider.cpp index 46b17ea..a737cf1 100644 --- a/src/IvImageProvider.cpp +++ b/src/IvImageProvider.cpp @@ -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; } - diff --git a/src/IvImageViewerForm.cpp b/src/IvImageViewerForm.cpp index 89a2445..abb9487 100644 --- a/src/IvImageViewerForm.cpp +++ b/src/IvImageViewerForm.cpp @@ -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())); } diff --git a/src/IvImageViewerPresentationModel.cpp b/src/IvImageViewerPresentationModel.cpp index 5016b35..f66561b 100644 --- a/src/IvImageViewerPresentationModel.cpp +++ b/src/IvImageViewerPresentationModel.cpp @@ -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 { -- 2.7.4