From: Divya Darshini Date: Mon, 8 Apr 2013 11:45:20 +0000 (+0530) Subject: rotate progress bar implementation X-Git-Tag: accepted/tizen_2.1/20130425.023637~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a96893a3d8e1232d2fbc1f2aa9067e110acfcfc4;p=apps%2Fosp%2FGallery.git rotate progress bar implementation Change-Id: Ifec79614dc27314cd9c40d6ec788a6aef0fc7d33 --- diff --git a/inc/GlAlbumListEditorForm.h b/inc/GlAlbumListEditorForm.h index 4078e92..b5262a1 100644 --- a/inc/GlAlbumListEditorForm.h +++ b/inc/GlAlbumListEditorForm.h @@ -32,7 +32,7 @@ #include #include "GlAlbumEventListener.h" #include "GlFormContentUpdateEventListener.h" -#include "GlFileDeleteTimer.h" +#include "GlFileUpdateTimer.h" class AlbumListPresentationModel; class AlbumListEditorForm @@ -104,7 +104,7 @@ private: Tizen::Ui::Controls::IconListView* __pEditorFolderIconList; Tizen::Ui::Controls::ContextMenu* __pShareContextMenu; Tizen::Ui::Controls::Popup* __pDeletePopup; - FileDeleteTimer* __pFileDeleteTimer; + FileUpdateTimer* __pFileUpdateTimer; AlbumListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlAlbumListPresentationModel.h b/inc/GlAlbumListPresentationModel.h index 5b7f81b..14e5180 100644 --- a/inc/GlAlbumListPresentationModel.h +++ b/inc/GlAlbumListPresentationModel.h @@ -32,7 +32,7 @@ #include #include "GlAlbumEventListener.h" #include "GlFormContentUpdateEventListener.h" -#include "GlIContentFileDeleteManager.h" +#include "GlIContentFileUpdateManager.h" #include "GlResourceManager.h" #include "GlThumbnailEventListener.h" #include "GlThumbnailProvider.h" @@ -45,7 +45,7 @@ class AlbumListPresentationModel : public Tizen::Base::Object , public Tizen::Content::IContentScanListener , public Tizen::System::IDeviceEventListener - , public IContentFileDeleteManager + , public IContentFileUpdateManager , public IThumbnailEventListener { public: @@ -58,6 +58,8 @@ public: static void AddContentEventListener(const IFormContentUpdateEventListener* listener); static void RemoveContentEventListener(const IFormContentUpdateEventListener& listener); + virtual result RotateImage(int index, RotateMode rotateMode); + virtual void RequestThumbnail(int index){}; void RequestThumbnail(const int folderIndex, int pathIndex); void CancelThumbnailRequest(const int folderIndex); void ClearThumbnailRequests(bool appTerminating = false); diff --git a/inc/GlAllListEditorPanel.h b/inc/GlAllListEditorPanel.h index 822c7cb..d6b3330 100644 --- a/inc/GlAllListEditorPanel.h +++ b/inc/GlAllListEditorPanel.h @@ -31,7 +31,7 @@ #include "GlThumbnailEventListener.h" class FileListPresentationModel; -class FileDeleteTimer; +class FileUpdateTimer; class AllListEditorPanel : public Tizen::Ui::Controls::Panel @@ -76,7 +76,7 @@ public: virtual result OnRequestMessage(void); virtual result OnRequestEmail(void); virtual result OnRequestSlideShow(void); - void OnRotateRequested(RotateMode rotateMode); + result OnRequestRotate(RotateMode rotateMode); virtual void OnFileOpInvalidate(enum FileActionMode __actionId); virtual void OnFileOpComplete(enum FileActionMode __actionId, enum FileActionCompleteRes); @@ -91,7 +91,7 @@ private: Tizen::Ui::Controls::Button* __pButtonSelectRegion; int __itemCount; bool __deleteInProgress; - FileDeleteTimer* __pFileDelete; + FileUpdateTimer* __pFileUpdateTimer; FileListEditorForm* __pFileListEditorForm; FileListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlAllListSelectionPanel.h b/inc/GlAllListSelectionPanel.h index 3626d34..c4dad7a 100644 --- a/inc/GlAllListSelectionPanel.h +++ b/inc/GlAllListSelectionPanel.h @@ -32,7 +32,7 @@ #include "GlFileOpInvalidateListener.h" class FileListPresentationModel; -class FileDeleteTimer; +class FileUpdateTimer; class AllListSelectionPanel : public Tizen::Ui::Controls::Panel @@ -57,7 +57,7 @@ public: result OnRequestEmail(void); result OnRequestMoveTo(Tizen::Base::String& destDirectory); result OnRequestSlideShow(void); - void OnRotateRequested(RotateMode rotateMode); + result OnRotateRequested(RotateMode rotateMode); virtual result OnInitializing(void); virtual result OnTerminating(void); @@ -91,7 +91,7 @@ private: Tizen::Base::Collection::IList* __pSeletedIndexList; int __itemCount; FileListEditorForm* __pFileListEditorForm; - FileDeleteTimer* __pFileDelete; + FileUpdateTimer* __pFileUpdateTimer; FileListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlFileListPresentationModel.h b/inc/GlFileListPresentationModel.h index fbc4adf..cd0d651 100644 --- a/inc/GlFileListPresentationModel.h +++ b/inc/GlFileListPresentationModel.h @@ -31,7 +31,7 @@ #include "GlAlbumEventListener.h" #include "GlFormContentUpdateEventListener.h" #include "GlCommonUtil.h" -#include "GlIContentFileDeleteManager.h" +#include "GlIContentFileUpdateManager.h" #include "GlResourceManager.h" #include "GlThumbnailEventListener.h" #include "GlTypes.h" @@ -42,7 +42,7 @@ class ThumbnailEvent; class FileListPresentationModel : public Tizen::Base::Object - , public IContentFileDeleteManager + , public IContentFileUpdateManager , public IThumbnailEventListener { public: @@ -53,7 +53,7 @@ public: Tizen::Graphics::Bitmap*& pThumbnail); result GetThumbnailVideoInSyncCacheN(const int index, Tizen::Base::String*& pName, Tizen::Graphics::Bitmap*& pThumbnail, Tizen::Base::String*& pDuration); - void RequestThumbnail(const int index); + virtual void RequestThumbnail(const int index); void CancelThumbnailRequest(const int index); void ClearThumbnailRequests(bool appTerminating = false); @@ -97,7 +97,7 @@ public: void OnContentUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r); void OnContentDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r); - void RotateImage(Tizen::Base::String& filePath, RotateMode rotateMode); + virtual result RotateImage(int index, RotateMode rotateMode); private: FileListPresentationModel(void); virtual ~FileListPresentationModel(void); @@ -153,7 +153,7 @@ private: bool __updateProgressStatus; friend class FileMoveTimer; - friend class FileDeleteTimer; + friend class FileUpdateTimer; }; #endif /* _GL_FILE_LIST_PRESENTATION_MODEL_H_ */ diff --git a/inc/GlFileMoveTimer.h b/inc/GlFileMoveTimer.h index 2365bc1..5403074 100644 --- a/inc/GlFileMoveTimer.h +++ b/inc/GlFileMoveTimer.h @@ -38,7 +38,7 @@ public : private: virtual Tizen::Base::Collection::IList * TimerStart(void); - virtual result TimerExpired(const ContentId& contentId); + virtual result TimerExpired(const Object* contentId); virtual void TimerCancel(int, enum FileActionCancelRes res); virtual void TimerComplete(int, enum FileActionCompleteRes res); diff --git a/inc/GlFileDeleteTimer.h b/inc/GlFileUpdateTimer.h similarity index 58% rename from inc/GlFileDeleteTimer.h rename to inc/GlFileUpdateTimer.h index 917b185..e732f87 100644 --- a/inc/GlFileDeleteTimer.h +++ b/inc/GlFileUpdateTimer.h @@ -15,33 +15,34 @@ // /** - * @file FileDeleteTimer.h - * @brief This is the header file for FileDeleteTimer class. + * @file FileUpdateTimer.h + * @brief This is the header file for FileUpdateTimer class. */ -#ifndef _GL_FILE_DELETE_TIMER_H_ -#define _GL_FILE_DELETE_TIMER_H_ +#ifndef _GL_FILE_UPDATE_TIMER_H_ +#define _GL_FILE_UPDATE_TIMER_H_ -#include "GlIContentFileDeleteManager.h" +#include "GlIContentFileUpdateManager.h" #include "GlTimerBase.h" class FileListPresentationModel; -class FileDeleteTimer +class FileUpdateTimer : public GlTimerBase { public: - FileDeleteTimer(Tizen::Base::Collection::IList*, IContentFileDeleteManager*, IFileOpInvalidateListener*); - virtual ~FileDeleteTimer(void); + FileUpdateTimer(Tizen::Base::Collection::IList*, IContentFileUpdateManager*, IFileOpInvalidateListener*, FileActionMode, RotateMode rotateMode = ROTATE_MODE_RIGHT); + virtual ~FileUpdateTimer(void); private: virtual Tizen::Base::Collection::IList * TimerStart(void); - virtual result TimerExpired(const ContentId& contentId); + virtual result TimerExpired(const Object* contentId); virtual void TimerCancel(int, enum FileActionCancelRes res); virtual void TimerComplete(int, enum FileActionCompleteRes res); private : - Tizen::Base::Collection::IList* __pDeleteIndexList; - IContentFileDeleteManager* __pFileDeleteManager; + Tizen::Base::Collection::IList* __pUpdateIndexList; + IContentFileUpdateManager* __pFileUpdateManager; + RotateMode __rotateMode; }; -#endif // _GL_FILE_DELETE_TIMER_H_ +#endif // _GL_FILE_UPDATE_TIMER_H_ diff --git a/inc/GlIContentFileDeleteManager.h b/inc/GlIContentFileUpdateManager.h similarity index 68% rename from inc/GlIContentFileDeleteManager.h rename to inc/GlIContentFileUpdateManager.h index d850ad6..42a3836 100644 --- a/inc/GlIContentFileDeleteManager.h +++ b/inc/GlIContentFileUpdateManager.h @@ -15,22 +15,26 @@ // /** - * @file GlIContentFileDeleteManager.h + * @file GlIContentFileUpdateManager.h * @brief This is the header file for IContentFileDeleteManager class. */ -#ifndef _GL_ICONTENT_FILE_DELETE_MANAGER_H_ -#define _GL_ICONTENT_FILE_DELETE_MANAGER_H_ +#ifndef _GL_ICONTENT_FILE_UPDATE_MANAGER_H_ +#define _GL_ICONTENT_FILE_UPDATE_MANAGER_H_ #include +#include "GlTypes.h" -class IContentFileDeleteManager +class IContentFileUpdateManager { public: - IContentFileDeleteManager(){} - virtual ~IContentFileDeleteManager(){} + IContentFileUpdateManager(){} + virtual ~IContentFileUpdateManager(){} + virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList) = 0; virtual result DeleteContentFile(const Tizen::Content::ContentId& contentId) = 0; + virtual result RotateImage(int index, RotateMode rotateMode) = 0; + virtual void RequestThumbnail(const int index) = 0; }; -#endif /* _GL_ICONTENT_FILE_DELETE_MANAGER_H_ */ +#endif /* _GL_ICONTENT_FILE_UPDATE_MANAGER_H_ */ diff --git a/inc/GlImageListEditorPanel.h b/inc/GlImageListEditorPanel.h index 28a7ba6..d3d12c6 100644 --- a/inc/GlImageListEditorPanel.h +++ b/inc/GlImageListEditorPanel.h @@ -30,7 +30,7 @@ #include "GlFileListEditorForm.h" class FileListPresentationModel; -class FileDeleteTimer; +class FileUpdateTimer; class ImageListEditorPanel : public Tizen::Ui::Controls::Panel @@ -81,7 +81,7 @@ private: Tizen::Ui::Controls::Label* __pLabelSelectCnt; int __itemCount; FileListPresentationModel* __pPresentationModel; - FileDeleteTimer* __pFileDelete; + FileUpdateTimer* __pFileDelete; FileListEditorForm* __pFileListEditorForm; }; diff --git a/inc/GlTimerBase.h b/inc/GlTimerBase.h index 3f96b5b..de333a7 100644 --- a/inc/GlTimerBase.h +++ b/inc/GlTimerBase.h @@ -51,7 +51,7 @@ public: protected: virtual Tizen::Base::Collection::IList * TimerStart(void) = 0; - virtual result TimerExpired(const ContentId&) = 0; + virtual result TimerExpired(const Object*) = 0; virtual void TimerCancel(int, enum FileActionCancelRes res) = 0; virtual void TimerComplete(int, enum FileActionCompleteRes res) = 0; @@ -59,13 +59,14 @@ private: void OnOpComplete(enum FileActionCompleteRes); void OnOpCancelled(enum FileActionCancelRes res); +protected: + enum FileActionMode __actionId; private: Timer __moveTimer; Tizen::Base::Collection::IList * __pContentIdList; int __moveToCount; GlProgressBar* __pMoveProBar; IFileOpInvalidateListener* __pInvalidate; - enum FileActionMode __actionId; }; #endif //__GL_TIMER_BASE_H_ diff --git a/inc/GlTypes.h b/inc/GlTypes.h index 608ab5c..b090beb 100644 --- a/inc/GlTypes.h +++ b/inc/GlTypes.h @@ -112,8 +112,9 @@ enum FileActionMode { FILE_DELETE_ACTION, FILE_MOVE_ACTION, + FILE_COPY_ACTION, FILE_RENAME_ACTION, - FILE_COPY_ACTION + FILE_ROTATE_ACTION }; enum FileActionCancelRes diff --git a/inc/GlVideoListEditorPanel.h b/inc/GlVideoListEditorPanel.h index be41898..6d8f522 100644 --- a/inc/GlVideoListEditorPanel.h +++ b/inc/GlVideoListEditorPanel.h @@ -29,7 +29,7 @@ #include "GlFileOpInvalidateListener.h" class FileListPresentationModel; -class FileDeleteTimer; +class FileUpdateTimer; class VideoListEditorPanel : public Tizen::Ui::Controls::Panel @@ -83,7 +83,7 @@ private: Tizen::Ui::Controls::Label* __pLabelSelectCnt; int __itemCount; FileListPresentationModel* __pPresentationModel; - FileDeleteTimer* __pFileDelete; + FileUpdateTimer* __pFileDelete; }; #endif /* _GL_VIDEO_LIST_EDITOR_PANEL_H_ */ diff --git a/src/GlAlbumListEditorForm.cpp b/src/GlAlbumListEditorForm.cpp index de07441..abb1b7f 100644 --- a/src/GlAlbumListEditorForm.cpp +++ b/src/GlAlbumListEditorForm.cpp @@ -65,7 +65,7 @@ AlbumListEditorForm::AlbumListEditorForm() , __pEditorFolderIconList(null) , __pShareContextMenu(null) , __pDeletePopup(null) - , __pFileDeleteTimer(null) + , __pFileUpdateTimer(null) , __pPresentationModel(null) { AppLogDebug("ENTER"); @@ -122,10 +122,10 @@ AlbumListEditorForm::OnTerminating(void) delete __pDeletePopup; __pDeletePopup = null; } - if (__pFileDeleteTimer != null) + if (__pFileUpdateTimer != null) { - delete __pFileDeleteTimer; - __pFileDeleteTimer = null; + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; } AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); @@ -412,17 +412,17 @@ AlbumListEditorForm::DeleteFolder() return E_FAILURE; } - if (__pFileDeleteTimer != null) + if (__pFileUpdateTimer != null) { - delete __pFileDeleteTimer; + delete __pFileUpdateTimer; } - __pFileDeleteTimer = new FileDeleteTimer(pIndexList, __pPresentationModel, this); - result r = __pFileDeleteTimer->StartTimer(); + __pFileUpdateTimer = new FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_DELETE_ACTION); + result r = __pFileUpdateTimer->StartTimer(); if (IsFailed(r)) { - delete __pFileDeleteTimer; - __pFileDeleteTimer = null; + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; return E_FAILURE; } else diff --git a/src/GlAlbumListPresentationModel.cpp b/src/GlAlbumListPresentationModel.cpp index 5d5127d..3e2c605 100644 --- a/src/GlAlbumListPresentationModel.cpp +++ b/src/GlAlbumListPresentationModel.cpp @@ -1133,6 +1133,12 @@ AlbumListPresentationModel::SetUpdateProgressStatus(bool status) AppLogDebug("EXIT"); } +result +AlbumListPresentationModel::RotateImage(int index, RotateMode rotateMode) +{ + return E_SUCCESS; +} + void AlbumListPresentationModel::RequestThumbnail(const int folderIndex, int pathIndex) { diff --git a/src/GlAlbumNameEditorForm.cpp b/src/GlAlbumNameEditorForm.cpp index 8c3ac37..56330c1 100644 --- a/src/GlAlbumNameEditorForm.cpp +++ b/src/GlAlbumNameEditorForm.cpp @@ -254,8 +254,6 @@ AlbumNameEditorForm::OnRenameAlbum(const String& strOri) __overlayMsg = false; delete __pMessageBox; __pMessageBox = null; - SceneManager* pSceneManager = SceneManager::GetInstance(); - pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId)); } } else diff --git a/src/GlAllListEditorPanel.cpp b/src/GlAllListEditorPanel.cpp index 0f32119..9722435 100644 --- a/src/GlAllListEditorPanel.cpp +++ b/src/GlAllListEditorPanel.cpp @@ -23,7 +23,7 @@ #include #include "GlAllListEditorPanel.h" #include "GlCommonUtil.h" -#include "GlFileDeleteTimer.h" +#include "GlFileUpdateTimer.h" #include "GlFileListEditorForm.h" #include "GlFileListPresentationModel.h" #include "GlResourceManager.h" @@ -61,7 +61,7 @@ AllListEditorPanel::AllListEditorPanel(void) , __pLabelSelectCnt(null) , __pButtonSelectRegion(null) , __itemCount(0) - , __pFileDelete(null) + , __pFileUpdateTimer(null) , __pFileListEditorForm(null) , __pPresentationModel(null) { @@ -72,7 +72,7 @@ AllListEditorPanel::AllListEditorPanel(void) AllListEditorPanel::~AllListEditorPanel(void) { AppLogDebug("ENTER"); - delete __pFileDelete; + delete __pFileUpdateTimer; AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -519,14 +519,14 @@ AllListEditorPanel::OnRequestDelete(void) return E_FAILURE; } - delete __pFileDelete; - __pFileDelete = new FileDeleteTimer(pIndexList, __pPresentationModel, this); - result r = __pFileDelete->StartTimer(); + delete __pFileUpdateTimer; + __pFileUpdateTimer = new FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_DELETE_ACTION); + result r = __pFileUpdateTimer->StartTimer(); if (IsFailed(r)) { - delete __pFileDelete; - __pFileDelete = null; + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; return E_FAILURE; } else @@ -787,36 +787,38 @@ AllListEditorPanel::SelectAllPressed(void) SetButtonState(); } -void -AllListEditorPanel::OnRotateRequested(RotateMode rotateMode) +result +AllListEditorPanel::OnRequestRotate(RotateMode rotateMode) { - AppLogDebug("ENTER"); IList* pIndexList = GetItemCheckedIndexListN(); if (pIndexList == null) { AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); - return; + return E_FAILURE; } + else if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); - Integer* pRealIndex = null; - int realIndex = -1; - ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); - pArrayList->Construct(); - int loopCount = pIndexList->GetCount(); + return E_FAILURE; + } - for (int i = 0; i < loopCount; ++i) + delete __pFileUpdateTimer; + __pFileUpdateTimer = new FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ROTATE_ACTION, rotateMode); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) { - pRealIndex = static_cast(pIndexList->GetAt(i)); - if (pRealIndex != null) - { - realIndex = pRealIndex->ToInt(); - pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(realIndex))); - String filePath = __pPresentationModel->GetContentFilePath(realIndex); - __pPresentationModel->RotateImage(filePath, rotateMode); - ContentManager::ScanFile(filePath); - __pPresentationModel->RequestThumbnail(realIndex); - } + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; } + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + return E_SUCCESS; } diff --git a/src/GlAllListSelectionPanel.cpp b/src/GlAllListSelectionPanel.cpp index 99a0d46..35ec1f0 100644 --- a/src/GlAllListSelectionPanel.cpp +++ b/src/GlAllListSelectionPanel.cpp @@ -27,7 +27,7 @@ #include "GlFileListPresentationModel.h" #include "GlResourceManager.h" #include "GlTypes.h" -#include "GlFileDeleteTimer.h" +#include "GlFileUpdateTimer.h" using namespace Tizen::App; using namespace Tizen::Base; @@ -54,7 +54,7 @@ AllListSelectionPanel::AllListSelectionPanel(void) , __pSeletedIndexList(null) , __itemCount(0) , __pFileListEditorForm(null) - , __pFileDelete(null) + , __pFileUpdateTimer(null) , __pPresentationModel(null) { AppLogDebug("ENTER"); @@ -64,7 +64,7 @@ AllListSelectionPanel::AllListSelectionPanel(void) AllListSelectionPanel::~AllListSelectionPanel(void) { AppLogDebug("ENTER"); - delete __pFileDelete; + delete __pFileUpdateTimer; AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -431,14 +431,14 @@ AllListSelectionPanel::OnRequestDelete(void) return E_FAILURE; } - delete __pFileDelete; - __pFileDelete = new FileDeleteTimer(pIndexList, __pPresentationModel, this); - result r = __pFileDelete->StartTimer(); + delete __pFileUpdateTimer; + __pFileUpdateTimer = new FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_DELETE_ACTION); + result r = __pFileUpdateTimer->StartTimer(); if (IsFailed(r)) { - delete __pFileDelete; - __pFileDelete = null; + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; return E_FAILURE; } else @@ -700,37 +700,38 @@ AllListSelectionPanel::SelectAllPressed(void) SetButtonState(); } -void +result AllListSelectionPanel::OnRotateRequested(RotateMode rotateMode) { - AppLogDebug("ENTER"); IList* pIndexList = GetItemCheckedIndexListN(); if (pIndexList == null) { AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); - return; + return E_FAILURE; } + else if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); - Integer* pRealIndex = null; - int realIndex = -1; - ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); - pArrayList->Construct(); - int loopCount = pIndexList->GetCount(); + return E_FAILURE; + } - for (int i = 0; i < loopCount; ++i) + delete __pFileUpdateTimer; + __pFileUpdateTimer = new FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ROTATE_ACTION, rotateMode); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) { - pRealIndex = static_cast(pIndexList->GetAt(i)); - if (pRealIndex != null) - { - realIndex = pRealIndex->ToInt(); - pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(realIndex))); - String filePath = __pPresentationModel->GetContentFilePath(realIndex); - __pPresentationModel->RotateImage(filePath, rotateMode); - ContentManager::ScanFile(filePath); - __pPresentationModel->RequestThumbnail(realIndex); - } + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; } - + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + return E_SUCCESS; } diff --git a/src/GlFileDeleteTimer.cpp b/src/GlFileDeleteTimer.cpp deleted file mode 100644 index 7084131..0000000 --- a/src/GlFileDeleteTimer.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/** - * @file FileDeleteTimer.cpp - * @brief This is the source file for FileDeleteTimer class. - */ - -#include -#include -#include -#include -#include - -#include "GlFileDeleteTimer.h" -#include "GlFileListPresentationModel.h" - -using namespace Tizen::Base; -using namespace Tizen::Base::Collection; -using namespace Tizen::Base::Utility; -using namespace Tizen::Content; -using namespace Tizen::Io; -using namespace Tizen::Ui; -using namespace Tizen::Ui::Controls; -using namespace Tizen::Ui::Scenes; - -FileDeleteTimer::FileDeleteTimer(Tizen::Base::Collection::IList* pDelList - , IContentFileDeleteManager* pFDM - , IFileOpInvalidateListener* invalidate) - : GlTimerBase(invalidate, FILE_DELETE_ACTION) - , __pDeleteIndexList(pDelList) - , __pFileDeleteManager(pFDM) -{ -} - -FileDeleteTimer::~FileDeleteTimer(void) -{ - delete __pDeleteIndexList; -} - -IList * FileDeleteTimer::TimerStart(void) -{ - return __pFileDeleteManager->GetContentIdListAtIndexN(*__pDeleteIndexList); -} - -result FileDeleteTimer::TimerExpired(const ContentId& contentId) -{ - return __pFileDeleteManager->DeleteContentFile(contentId); -} - -void FileDeleteTimer::TimerCancel(int, enum FileActionCancelRes res) -{ -} - -void FileDeleteTimer::TimerComplete(int, enum FileActionCompleteRes res) -{ -} diff --git a/src/GlFileListEditorForm.cpp b/src/GlFileListEditorForm.cpp index 3767cdc..fcd78a1 100644 --- a/src/GlFileListEditorForm.cpp +++ b/src/GlFileListEditorForm.cpp @@ -669,7 +669,7 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId) if (pEditorPanel != null) { RotateMode rotateMode = ROTATE_MODE_LEFT; - pEditorPanel->OnRotateRequested(rotateMode); + pEditorPanel->OnRequestRotate(rotateMode); } } else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) @@ -695,7 +695,7 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId) if (pEditorPanel != null) { RotateMode rotateMode = ROTATE_MODE_RIGHT; - pEditorPanel->OnRotateRequested(rotateMode); + pEditorPanel->OnRequestRotate(rotateMode); } } else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) diff --git a/src/GlFileListPresentationModel.cpp b/src/GlFileListPresentationModel.cpp index c03abf0..8f93fe8 100644 --- a/src/GlFileListPresentationModel.cpp +++ b/src/GlFileListPresentationModel.cpp @@ -1586,8 +1586,8 @@ FileListPresentationModel::SetUpdateProgressStatus(bool status) AppLogDebug("EXIT"); } -void -FileListPresentationModel::RotateImage(String& filePath, RotateMode rotateMode) +result +FileListPresentationModel::RotateImage(int index, RotateMode rotateMode) { result r = E_SUCCESS; ImageBuffer* pRotatedBuffer = null; @@ -1596,6 +1596,8 @@ FileListPresentationModel::RotateImage(String& filePath, RotateMode rotateMode) int width = 0; int height = 0; pRotatedBuffer = new (std::nothrow) ImageBuffer(); + + String filePath = GetContentFilePath(index); r = pRotatedBuffer->Construct(filePath); ImageBuffer::GetImageInfo(filePath, imageFormat, width, height); @@ -1612,9 +1614,10 @@ FileListPresentationModel::RotateImage(String& filePath, RotateMode rotateMode) } TryCatch(pRotatedBuffer1 != null, r = GetLastResult(), "RotateN failed:%s", GetErrorMessage(GetLastResult())); pRotatedBuffer1->EncodeToFile(filePath, imageFormat, true, 100); + ContentManager::ScanFile(filePath); delete pRotatedBuffer1; delete pRotatedBuffer; - return; + return r; CATCH: if (pRotatedBuffer != null) //this buffer is no longer used @@ -1625,5 +1628,5 @@ FileListPresentationModel::RotateImage(String& filePath, RotateMode rotateMode) { delete pRotatedBuffer1; } - return; + return r; } diff --git a/src/GlFileMoveTimer.cpp b/src/GlFileMoveTimer.cpp index bcc3450..b90b837 100644 --- a/src/GlFileMoveTimer.cpp +++ b/src/GlFileMoveTimer.cpp @@ -84,10 +84,10 @@ IList * FileMoveTimer::TimerStart(void) } } -result FileMoveTimer::TimerExpired(const ContentId& contentId) +result FileMoveTimer::TimerExpired(const Object* contentId) { AppLogDebug("ENTER"); - return __pPresentationModel->MoveToContentFile(contentId, __moveToDir, __isCopyOperation); + return __pPresentationModel->MoveToContentFile(*static_cast(contentId), __moveToDir, __isCopyOperation); } void FileMoveTimer::TimerCancel(int, enum FileActionCancelRes res) diff --git a/src/GlFileUpdateTimer.cpp b/src/GlFileUpdateTimer.cpp new file mode 100644 index 0000000..a3225f0 --- /dev/null +++ b/src/GlFileUpdateTimer.cpp @@ -0,0 +1,97 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FileUpdateTimer.cpp + * @brief This is the source file for FileUpdateTimer class. + */ + +#include +#include +#include +#include +#include + +#include "GlFileUpdateTimer.h" +#include "GlFileListPresentationModel.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Io; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +FileUpdateTimer::FileUpdateTimer(Tizen::Base::Collection::IList* pDelList + , IContentFileUpdateManager* pFDM + , IFileOpInvalidateListener* invalidate + , FileActionMode actionId + , RotateMode rotateMode) + : GlTimerBase(invalidate, actionId) + , __pUpdateIndexList(pDelList) + , __pFileUpdateManager(pFDM) + , __rotateMode(rotateMode) +{ +} + +FileUpdateTimer::~FileUpdateTimer(void) +{ + if (__actionId == FILE_DELETE_ACTION) + { + delete __pUpdateIndexList; + } +} + +IList * FileUpdateTimer::TimerStart(void) +{ + if (__actionId == FILE_DELETE_ACTION) + { + return __pFileUpdateManager->GetContentIdListAtIndexN(*__pUpdateIndexList); + } + else // if (__actionId == FILE_ROTATE_ACTION) + { + return __pUpdateIndexList; + } +} + +result FileUpdateTimer::TimerExpired(const Object* contentId) +{ + if (__actionId == FILE_DELETE_ACTION) + { + return __pFileUpdateManager->DeleteContentFile(*(static_cast(contentId))); + } + else // if (__actionId == FILE_ROTATE_ACTION) + { + result r = E_SUCCESS; + const Integer* pIndex = static_cast(contentId); + if (pIndex != null) + { + r = __pFileUpdateManager->RotateImage(pIndex->ToInt(), __rotateMode); + __pFileUpdateManager->RequestThumbnail(pIndex->ToInt()); + } + return r; + } +} + +void FileUpdateTimer::TimerCancel(int, enum FileActionCancelRes res) +{ +} + +void FileUpdateTimer::TimerComplete(int, enum FileActionCompleteRes res) +{ +} diff --git a/src/GlImageListEditorPanel.cpp b/src/GlImageListEditorPanel.cpp index b6b6afb..00e930d 100644 --- a/src/GlImageListEditorPanel.cpp +++ b/src/GlImageListEditorPanel.cpp @@ -28,7 +28,7 @@ #include "GlImageListEditorPanel.h" #include "GlResourceManager.h" #include "GlTypes.h" -#include "GlFileDeleteTimer.h" +#include "GlFileUpdateTimer.h" #include "GlFileListEditorForm.h" using namespace Tizen::App; diff --git a/src/GlProgressBar.cpp b/src/GlProgressBar.cpp index 0b77414..065fcd1 100644 --- a/src/GlProgressBar.cpp +++ b/src/GlProgressBar.cpp @@ -148,6 +148,9 @@ GlProgressBar::ShowFileProgressingPopup(int val, enum FileActionMode action) case FILE_COPY_ACTION: __pFileProgressingHeaderLabel->SetText(L"Copying..."); break; + case FILE_ROTATE_ACTION: + __pFileProgressingHeaderLabel->SetText(L"Rotating..."); + break; default: break; } diff --git a/src/GlTimerBase.cpp b/src/GlTimerBase.cpp index 05bea32..1f4e0f5 100644 --- a/src/GlTimerBase.cpp +++ b/src/GlTimerBase.cpp @@ -28,11 +28,11 @@ using namespace Tizen::Ui; GlTimerBase::GlTimerBase(IFileOpInvalidateListener* invalidateListener, enum FileActionMode actionId) - : __pContentIdList(null) + : __actionId(actionId) + , __pContentIdList(null) , __moveToCount(0) , __pMoveProBar(null) , __pInvalidate(invalidateListener) - , __actionId(actionId) { AppLogDebug("ENTER"); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); @@ -90,10 +90,9 @@ GlTimerBase::OnTimerExpired(Timer& timer) if (__moveToCount < __pContentIdList->GetCount()) { AppLogDebug("__pContentIdList count is %d", __pContentIdList->GetCount()); - ContentId* pContentId = static_cast(__pContentIdList->GetAt(__moveToCount)); - if (pContentId != null) + if (__pContentIdList->GetAt(__moveToCount) != null) { - result r = TimerExpired(*pContentId); + result r = TimerExpired(__pContentIdList->GetAt(__moveToCount)); if (IsFailed(r)) { AppLogDebug("OnTimerExpired EXIT(%s)", GetErrorMessage(r)); diff --git a/src/GlVideoListEditorPanel.cpp b/src/GlVideoListEditorPanel.cpp index c57b16f..287e426 100644 --- a/src/GlVideoListEditorPanel.cpp +++ b/src/GlVideoListEditorPanel.cpp @@ -29,7 +29,7 @@ #include "GlTypes.h" #include "GlVideoListEditorPanel.h" #include "GlFileListEditorForm.h" -#include "GlFileDeleteTimer.h" +#include "GlFileUpdateTimer.h" using namespace Tizen::App; using namespace Tizen::Base;