From: Sehong Na Date: Sat, 31 May 2014 03:29:06 +0000 (+0900) Subject: Initialize Tizen 2.3 X-Git-Tag: 2.3a_release X-Git-Url: http://review.tizen.org/git/?p=apps%2Fosp%2FGallery.git;a=commitdiff_plain;h=refs%2Ftags%2F2.3a_release Initialize Tizen 2.3 --- baa5b1ce00a7687ab6112780dfc27d486802c871 diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..a9a0efd --- /dev/null +++ b/.cproject @@ -0,0 +1,673 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..708a503 --- /dev/null +++ b/.project @@ -0,0 +1,89 @@ + + + Gallery + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + sbi-make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/Gallery/Debug-Tizen-Emulator} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + org.tizen.nativecpp.apichecker.core.builder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.tizen.nativecpp.apichecker.core.tizenCppNature + + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..49be476 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +# Target name and PKGID +## TODO : set application name and ID +SET(this_target Gallery) +SET(PKGID ijudt7w61q) + +# include directory +INCLUDE_DIRECTORIES( + /usr/include/osp + inc + ) + +# Source files +FILE(GLOB ${this_target}_SOURCE_FILES src/*.cpp) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") + +# Create executable +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") +ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES}) + +# Set link libraries and link options +## TODO : add more link libraries and options +TARGET_LINK_LIBRARIES(${this_target} -L/usr/lib/osp osp-appfw osp-uifw osp-media osp-image osp-content pthread) +TARGET_LINK_LIBRARIES(${this_target} -Xlinker --allow-shlib-undefined -pthread -pie) + +# Copy info, data, res, and icons directories +INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${PKGID}/bin) + +# Copy resource +INSTALL(FILES ${CMAKE_SOURCE_DIR}/manifest.xml DESTINATION ../usr/apps/${PKGID}/info) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ../usr/apps/${PKGID}) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/shared DESTINATION ../usr/apps/${PKGID}) diff --git a/LICENSE.Flora b/LICENSE.Flora new file mode 100644 index 0000000..571fe79 --- /dev/null +++ b/LICENSE.Flora @@ -0,0 +1,206 @@ +Flora License + +Version 1.1, April, 2013 + +http://floralicense.org/license/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and +all other entities that control, are controlled by, or are +under common control with that entity. For the purposes of +this definition, "control" means (i) the power, direct or indirect, +to cause the direction or management of such entity, +whether by contract or otherwise, or (ii) ownership of fifty percent (50%) +or more of the outstanding shares, or (iii) beneficial ownership of +such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice +that is included in or attached to the work (an example is provided +in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, +as a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, +or merely link (or bind by name) to the interfaces of, the Work and +Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor +for inclusion in the Work by the copyright owner or by an individual or +Legal Entity authorized to submit on behalf of the copyright owner. +For the purposes of this definition, "submitted" means any form of +electronic, verbal, or written communication sent to the Licensor or +its representatives, including but not limited to communication on +electronic mailing lists, source code control systems, and issue +tracking systems that are managed by, or on behalf of, the Licensor +for the purpose of discussing and improving the Work, but excluding +communication that is conspicuously marked or otherwise designated +in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +"Tizen Certified Platform" shall mean a software platform that complies +with the standards set forth in the Tizen Compliance Specification +and passes the Tizen Compliance Tests as defined from time to time +by the Tizen Technical Steering Group and certified by the Tizen +Association or its designated agent. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work +solely as incorporated into a Tizen Certified Platform, where such +license applies only to those patent claims licensable by such +Contributor that are necessarily infringed by their Contribution(s) +alone or by combination of their Contribution(s) with the Work solely +as incorporated into a Tizen Certified Platform to which such +Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim +in a lawsuit) alleging that the Work or a Contribution incorporated +within the Work constitutes direct or contributory patent infringement, +then any patent licenses granted to You under this License for that +Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof pursuant to the copyright license +above, in any medium, with or without modifications, and in Source or +Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works + a copy of this License; and + 2. You must cause any modified files to carry prominent notices stating + that You changed the files; and + 3. You must retain, in the Source form of any Derivative Works that + You distribute, all copyright, patent, trademark, and attribution + notices from the Source form of the Work, excluding those notices + that do not pertain to any part of the Derivative Works; and + 4. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable + copy of the attribution notices contained within such NOTICE file, + excluding those notices that do not pertain to any part of + the Derivative Works, in at least one of the following places: + within a NOTICE text file distributed as part of the Derivative Works; + within the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the Derivative Works, + if and wherever such third-party notices normally appear. + The contents of the NOTICE file are for informational purposes only + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum + to the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. You may add Your own + copyright statement to Your modifications and may provide additional or + different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works + as a whole, provided Your use, reproduction, and distribution of + the Work otherwise complies with the conditions stated in this License + and your own copyright statement or terms and conditions do not conflict + the conditions stated in the License including section 3. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Flora License to your work + +To apply the Flora License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Flora License, Version 1.1 (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. + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..1ac0202 --- /dev/null +++ b/NOTICE @@ -0,0 +1,3 @@ +Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Flora License, Version 1.1. +Please, see the LICENSE.Flora file for Flora License, Version 1.1 terms and conditions. \ No newline at end of file diff --git a/inc/GlAlbumEventListener.h b/inc/GlAlbumEventListener.h new file mode 100644 index 0000000..9840955 --- /dev/null +++ b/inc/GlAlbumEventListener.h @@ -0,0 +1,36 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumEventListener.h + * @brief This is the header file for AlbumEventListener class. + */ + +#ifndef _GL_ALBUM_EVENT_LISTENER_H_ +#define _GL_ALBUM_EVENT_LISTENER_H_ + +#include + +class IAlbumEventListener + : public Tizen::Base::Object +{ +public: + virtual ~IAlbumEventListener(void) {}; + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType) = 0; + virtual void OnThumbnailDecoded(const int index) = 0; +}; + +#endif /* _GL_ALBUM_EVENT_LISTENER_H_ */ diff --git a/inc/GlAlbumInfo.h b/inc/GlAlbumInfo.h new file mode 100644 index 0000000..07e76d9 --- /dev/null +++ b/inc/GlAlbumInfo.h @@ -0,0 +1,71 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumInfo.h + * @brief This is the header file for AlbumInfo class. + */ + +#ifndef _GL_ALBUM_INFO_H_ +#define _GL_ALBUM_INFO_H_ + +#include +#include "GlTypes.h" + +class AlbumInfo + : public Tizen::Base::Object +{ +public: + AlbumInfo(void); + virtual ~AlbumInfo(void); + + result Construct(void); + result Construct(const Tizen::Base::String& albumName, Tizen::Content::ContentType contentType, + const Tizen::Base::Collection::IList& directoryList, + const Tizen::Base::Collection::IList& contentIdList); + result Construct(const AlbumInfo& albumInfo); + + Tizen::Base::String GetAlbumName(void) const; + void SetAlbumName(const Tizen::Base::String& albumName); + Tizen::Base::String GetDirectory(int index) const; + Tizen::Base::Collection::IList* GetDirectoryListN(void) const; + void ClearDirectoryList(void); + void AppendDirectory(const Tizen::Base::String& directoryPath); + void AppendDirectoryList(const Tizen::Base::Collection::ICollection& directoryList); + int GetDirectoryCount(void) const; + + void ClearAll(void); + AlbumInfoType GetAlbumInfoType(void) const; + + Tizen::Graphics::Bitmap* GetFolderThumnailBitmap(void) const; + void SetFolderThumnailBitmap(Tizen::Graphics::Bitmap* folderThumnailBitmap); + + void ClearContentIdList(void); + Tizen::Base::Collection::IList* GetContentIdListN(void) const; + Tizen::Content::ContentId GetContentId(int index) const; + void AppendContentId(const Tizen::Content::ContentId& contentId); + void AppendContentIdList(const Tizen::Base::Collection::ICollection& contentIdList); + int GetContentIdCount(void) const; + result RemoveContentIdAt(const int index); + +private: + Tizen::Base::String __albumName; + Tizen::Base::Collection::IList* __pDirectoryFullPathList; + Tizen::Base::Collection::IList* __pContentIdList; + Tizen::Graphics::Bitmap* __pFolderThumnailBitmap; +}; + +#endif /* _GL_ALBUM_INFO_H_ */ diff --git a/inc/GlAlbumListEditorForm.h b/inc/GlAlbumListEditorForm.h new file mode 100644 index 0000000..9ecc126 --- /dev/null +++ b/inc/GlAlbumListEditorForm.h @@ -0,0 +1,122 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumListEditorForm.h + * @brief This is the header file for AlbumListEditorForm class. + */ + +#ifndef _GL_ALBUM_LIST_EDITOR_FORM_H_ +#define _GL_ALBUM_LIST_EDITOR_FORM_H_ + +#include +#include "GlAlbumEventListener.h" +#include "GlFileUpdateTimer.h" +#include "GlFormContentUpdateEventListener.h" + +class AlbumListPresentationModel; + +class AlbumListEditorForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::IPropagatedKeyEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener + , public IAlbumEventListener + , public IFileOpInvalidateListener + , public IFormContentUpdateEventListener +{ +public: + AlbumListEditorForm(void); + virtual ~AlbumListEditorForm(void); + + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + virtual bool OnKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;} + virtual bool OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo); + virtual bool OnPreviewKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;} + virtual bool OnPreviewKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;} + + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + virtual void OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView &view, int index, + Tizen::Ui::Controls::IconListViewItemStatus status); + virtual void OnIconListViewOverlayBitmapSelected(Tizen::Ui::Controls::IconListView &iconListView, int index, + int overlayBitmapId); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, + Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + virtual void OnFileOpInvalidate(enum FileActionMode actionId); + virtual void OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes); + virtual void OnScanDirStart(); + virtual void OnScanDirComplete(); + + virtual void ShowAnimation(void); + virtual void StopAnimation(void); + virtual void OnContentUpdated(void); + +private: + result InitializeControl(void); + result InitializePopup(void); + void CreateIconListView(void); + void SetAllCheckState(const bool state); + + void OnRequestMessage(void); + void OnRequestEmail(void); + + result DeleteFolder(void); + int GetCheckedFolderCount(void) const; + Tizen::Base::Collection::IList* GetItemCheckedIndexListN(void) const; + result Update(void); + void SetFooterButtonsState(const bool enableState); + void SetButtonState(void); + +private: + int __checkedCount; + Tizen::Ui::Controls::Label* __pSelectCountLabel; + Tizen::Ui::Controls::IconListView* __pEditorFolderIconList; + Tizen::Ui::Controls::ContextMenu* __pShareContextMenu; + Tizen::Ui::Controls::Popup* __pDeletePopup; + FileUpdateTimer* __pFileUpdateTimer; + AlbumListPresentationModel* __pPresentationModel; + bool __isScanProgress; +}; + +#endif /* _GL_ALBUM_LIST_EDITOR_FORM_H_ */ diff --git a/inc/GlAlbumListForm.h b/inc/GlAlbumListForm.h new file mode 100644 index 0000000..b900b2d --- /dev/null +++ b/inc/GlAlbumListForm.h @@ -0,0 +1,96 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumListForm.h + * @brief This is the header file for AlbumListForm class. + */ + +#ifndef _GL_ALBUM_LIST_FORM_H_ +#define _GL_ALBUM_LIST_FORM_H_ + +#include +#include +#include "GlAlbumEventListener.h" +#include "GlFormContentUpdateEventListener.h" + +class AlbumListPresentationModel; + +class AlbumListForm + : public IAlbumEventListener + , public IFormContentUpdateEventListener + , public Tizen::App::IAppControlResponseListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + AlbumListForm(void); + virtual ~AlbumListForm(void); + + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + virtual void OnContentUpdated(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + virtual void OnIconListViewItemStateChanged (Tizen::Ui::Controls::IconListView &view, + int index, Tizen::Ui::Controls::IconListViewItemStatus status); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + + virtual void OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, + const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, + const Tizen::Base::Collection::IMap* pExtraData); + virtual void ShowAnimation(void){} + virtual void StopAnimation(void){} +private: + result InitializeHeader(void); + result InitializeFooter(void); + void CreateIconListView(void); + result Update(void); + +private: + int __itemCount; + Tizen::Ui::Controls::IconListView* __pAlbumViewIconList; + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; + AlbumListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_ALBUM_LIST_FORM_H_ */ diff --git a/inc/GlAlbumListPresentationModel.h b/inc/GlAlbumListPresentationModel.h new file mode 100644 index 0000000..65c7765 --- /dev/null +++ b/inc/GlAlbumListPresentationModel.h @@ -0,0 +1,132 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumListPresentationModel.h + * @brief This is the header file for AlbumListPresentationModel class. + */ + +#ifndef _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ +#define _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ + +#include +#include +#include "GlAlbumEventListener.h" +#include "GlFormContentUpdateEventListener.h" +#include "GlIContentFileUpdateManager.h" +#include "GlResourceManager.h" +#include "GlThumbnailEventListener.h" +#include "GlThumbnailProvider.h" +#include "GlTypes.h" + +class AlbumInfo; +class IAlbumRenameEventListener; +class ITimerScanDirListener; + +class AlbumListPresentationModel + : public IContentFileUpdateManager + , public IThumbnailEventListener + , public Tizen::Base::Object + , public Tizen::System::IDeviceEventListener +{ +public: + static AlbumListPresentationModel* GetInstance(void); + + result AddPresentationModelListener(IAlbumEventListener* listener); + result RemovePresentationModelListener(IAlbumEventListener& listner); + + static void AddContentEventListener(const IFormContentUpdateEventListener* listener); + static void RemoveContentEventListener(const IFormContentUpdateEventListener& listener); + + virtual result RotateImage(const Tizen::Content::ContentId&, RotateMode rotateMode); + virtual void RequestThumbnail(int index){}; + virtual void RequestThumbnail(const Tizen::Content::ContentId& contentId){}; + void RequestThumbnail(const int folderIndex, const int pathIndex); + void ClearThumbnailRequests(const bool appTerminating = false); + result StartAppControl(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, + const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, + const Tizen::Base::Collection::HashMap* pDataList, Tizen::App::IAppControlResponseListener* pListener); + + void InitializeAlbumInfoList(const Tizen::Content::ContentType& contentType); + void CallAlbumChangedEvent(void); + int GetFolderCount(void) const; + + Tizen::Graphics::Bitmap* CreateMergeBitmapN(const int index); + Tizen::Base::Collection::IList* GetAlbumInfoList(void) const; + + AppControlMode GetAppControlMode(void) const; + AppControlMediaType GetAppControlMediaType(void) const; + AppControlSelectionMode GetAppControlSelectionMode(void) const; + + result RenameAlbum(const Tizen::Base::String&, const Tizen::Base::String&, IAlbumRenameEventListener*); + + virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList) const; + virtual result DeleteContentFile(const Tizen::Base::String& filePath); + + virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg); + + bool OnContentScanCompleted(const Tizen::Base::String &scanPath); + + void OnContentCreated(void); + void OnContentUpdated(void); + void OnContentDeleted(void); + + virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + void SetUpdateProgressStatus(const bool status); + void AddTimerScanListener(ITimerScanDirListener* pListener, int scanCount); + void RemoveTimerScanListener(void); + + void ShowAnimation(void); + void StopAnimation(void); +private: + AlbumListPresentationModel(void); + virtual ~AlbumListPresentationModel(void); + AlbumListPresentationModel(const AlbumListPresentationModel&); + const AlbumListPresentationModel& operator =(const AlbumListPresentationModel&); + + result Construct(void); + static void CreateInstance(void); + static void DestroyInstance(void); + + void DrawPartialImage(Tizen::Graphics::Canvas& canvas, AlbumInfo* pAlbumInfo, + const Tizen::Graphics::Rectangle& rectNew); + void DrawFontImage(Tizen::Graphics::Canvas& canvas, AlbumInfo* pAlbumInfo, int index); + + Tizen::Base::String GetDirectoryName(Tizen::Base::String& directoryPath) const; + Tizen::Base::Collection::IList* GetContentIdListInDirectoryN(const Tizen::Base::String& directoryPath, + Tizen::Content::ContentType contentType) const; + Tizen::Base::String GetDirectoryNameFromFullPath(const Tizen::Base::String& fullPath) const; + +private: + static AlbumListPresentationModel* __pPresentationModelInstance; + static ThumbnailProvider* __pThumbnailProvider; + static ThumbnailEvent* __pThumbnailEvent; + static Tizen::Base::Collection::ArrayList* __pContentEventListener; + static Tizen::Base::Collection::ArrayList* __pPresentationModelListener; + static Tizen::Base::Collection::IList* __pAlbumInfoList; + Tizen::Graphics::Bitmap* __pFolderBackgroundBitmap; + IAlbumRenameEventListener* __pAlbumListener; + RequestId __reqId; + AppControlMode __appControlMode; + AppControlMediaType __appControlMediaType; + AppControlSelectionMode __appControlSelectionMode; + bool __updateProgressStatus; + Tizen::Base::String __renameNewPath; + ITimerScanDirListener* __pTimerScanListener; + int __scanCount; +}; + +#endif /* _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ */ diff --git a/inc/GlAlbumNameEditorForm.h b/inc/GlAlbumNameEditorForm.h new file mode 100644 index 0000000..e82dbfb --- /dev/null +++ b/inc/GlAlbumNameEditorForm.h @@ -0,0 +1,116 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumNameEditorForm.h + * @brief This is the header file for AlbumNameEditorForm class. + */ + +#ifndef _GL_ALBUM_NAME_EDITOR_FORM_H_ +#define _GL_ALBUM_NAME_EDITOR_FORM_H_ + +#include +#include "GlAlbumRenameEventListener.h" +#include "GlBaseForm.h" +#include "GlFileOpInvalidateListener.h" +#include "GlTypes.h" + +class AlbumListPresentationModel; +class FileListPresentationModel; +class FileMoveTimer; +class ProgressAnimation; + +class AlbumNameEditorForm + : public BaseForm + , public IAlbumRenameEventListener + , public IFormContentUpdateEventListener + , public IFileOpInvalidateListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IKeypadEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::System::IDeviceEventListener + , public Tizen::Ui::ITextEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + AlbumNameEditorForm(void); + virtual ~AlbumNameEditorForm(void); + + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnContentUpdated(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + virtual void OnTextValueChanged(const Tizen::Ui::Control& source); + virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source); + + //IKeypadEventListener + virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction){}; + virtual void OnKeypadClosed(Tizen::Ui::Control& source); + virtual void OnKeypadOpened(Tizen::Ui::Control& source); + virtual void OnKeypadWillOpen(Tizen::Ui::Control& source){}; + + virtual void OnFileOpInvalidate(enum FileActionMode actionId); + virtual void OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes); + virtual void OnScanDirStart(){} + virtual void OnScanDirComplete(){} + + virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + virtual void OnAlbumRenameComplete(void); + virtual void CreateMessage(Tizen::Base::String& str); + virtual void ShowAnimation(void); + virtual void StopAnimation(void); +private: + void OnCreateAlbum(void); + void OnRenameAlbum(Tizen::Base::String& name); + +private: + Tizen::Ui::Controls::EditField* __pNameEditField; + Tizen::Base::String __nameEditFieldText; + Tizen::Base::String __nameEditFieldPreText; + Tizen::Base::String __nameEditFieldTempText; + Tizen::Base::String __originalText; + int __folderIndex; + int __modalMsgBoxResult; + int __textLength; + bool __mountState; + bool __isCreateAlbum; + bool __isKeyPadOpen; + AlbumNameEditorMode __albumNameEditorMode; + Tizen::Ui::Scenes::SceneId __callerSceneId; + Tizen::Ui::Scenes::SceneId __previousSceneId; + Tizen::Ui::Controls::MessageBox* __pMessageBox; + Tizen::Base::Collection::IList* __pMoveIndexList; + FileActionMode __fileActionMode; + FileMoveTimer* __pFileMove; + AlbumListPresentationModel* __pPresentationModel; + FileListPresentationModel* __pFilePresentationModel; +}; + +#endif /* _GL_ALBUM_NAME_EDITOR_FORM_H_ */ diff --git a/inc/GlAlbumRenameEventListener.h b/inc/GlAlbumRenameEventListener.h new file mode 100644 index 0000000..2f916d0 --- /dev/null +++ b/inc/GlAlbumRenameEventListener.h @@ -0,0 +1,32 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumRenameEventListener.h + * @brief This is the header file for GlAlbumRenameEventListener class. + */ + +#ifndef _GL_ALBUM_RENAME_LISTENER_H_ +#define _GL_ALBUM_RENAME_LISTENER_H_ + +class IAlbumRenameEventListener +{ +public: + virtual ~IAlbumRenameEventListener(void) {} + virtual void OnAlbumRenameComplete(void) = 0; +}; + +#endif /* _GL_ALBUM_RENAME_LISTENER_H_ */ diff --git a/inc/GlAllListEditorPanel.h b/inc/GlAllListEditorPanel.h new file mode 100644 index 0000000..873356f --- /dev/null +++ b/inc/GlAllListEditorPanel.h @@ -0,0 +1,100 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAllListEditorPanel.h + * @brief This is the header file for AllListEditorPanel class. + */ + +#ifndef _GL_ALL_LIST_EDITOR_PANEL_H_ +#define _GL_ALL_LIST_EDITOR_PANEL_H_ + +#include "GlAlbumEventListener.h" +#include "GlFormContentUpdateEventListener.h" +#include "GlFileListEditorForm.h" +#include "GlFileOpInvalidateListener.h" +#include "GlThumbnailEventListener.h" + +class FileListPresentationModel; +class FileUpdateTimer; + +class AllListEditorPanel + : public IAlbumEventListener + , public IFileOpInvalidateListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + AllListEditorPanel(void); + virtual ~AllListEditorPanel(void); + + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + int GetItemCheckedCount(void) const; + Tizen::Base::Collection::IList* GetItemCheckedIndexListN(void) const; + void OnSelectAllPressed(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnIconListViewItemStateChanged (Tizen::Ui::Controls::IconListView &view, + int index, Tizen::Ui::Controls::IconListViewItemStatus status); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + virtual result OnRequestDelete(void); + virtual result OnRequestMessage(void); + virtual result OnRequestEmail(void); + virtual result OnRequestSlideShow(void); + result OnRequestRotate(RotateMode rotateMode); + void CancelUpdateProgress(void); + + virtual void OnFileOpInvalidate(enum FileActionMode actionId); + virtual void OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes); + virtual void OnScanDirStart(); + virtual void OnScanDirComplete(); + + void ChangeOrientation(void); +private: + void ResetSelection(void); + void SetButtonState(void); + +private: + int __itemCount; + Tizen::Ui::Controls::IconListView* __pContentIconListView; + Tizen::Ui::Controls::Label* __pLabelSelectCnt; + Tizen::Ui::Controls::Button* __pButtonSelectRegion; + FileUpdateTimer* __pFileUpdateTimer; + FileListEditorForm* __pFileListEditorForm; + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_ALL_LIST_EDITOR_PANEL_H_ */ diff --git a/inc/GlAllListPanel.h b/inc/GlAllListPanel.h new file mode 100644 index 0000000..b4e0df7 --- /dev/null +++ b/inc/GlAllListPanel.h @@ -0,0 +1,71 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAllListPanel.h + * @brief This is the header file for AllListPanel class. + */ + +#ifndef _GL_ALL_LIST_PANEL_H_ +#define _GL_ALL_LIST_PANEL_H_ + +#include +#include "GlAlbumEventListener.h" +#include "GlFormContentUpdateEventListener.h" +#include "GlThumbnailEventListener.h" + +class FileListPresentationModel; + +class AllListPanel + : public IAlbumEventListener + , public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + AllListPanel(void); + virtual ~AllListPanel(void); + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnIconListViewItemStateChanged (Tizen::Ui::Controls::IconListView &view, + int index, Tizen::Ui::Controls::IconListViewItemStatus status); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + void ChangeOrientation(void); + void Refresh(void); + +private: + int __itemCount; + Tizen::Ui::Controls::IconListView* __pContentIconListView;\ + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_ALL_LIST_PANEL_H_ */ diff --git a/inc/GlAllListSelectionPanel.h b/inc/GlAllListSelectionPanel.h new file mode 100644 index 0000000..4329924 --- /dev/null +++ b/inc/GlAllListSelectionPanel.h @@ -0,0 +1,101 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAllListSelectionPanel.h + * @brief This is the header file for AllListSelectionPanel class. + */ + +#ifndef _GL_ALL_LIST_SELECTION_PANEL_H_ +#define _GL_ALL_LIST_SELECTION_PANEL_H_ + +#include +#include "GlAlbumEventListener.h" +#include "GlFormContentUpdateEventListener.h" +#include "GlThumbnailEventListener.h" +#include "GlFileOpInvalidateListener.h" + +class FileListPresentationModel; +class FileUpdateTimer; +class CommonUtil; +class FileListEditorForm; + +class AllListSelectionPanel + : public IAlbumEventListener + , public IFileOpInvalidateListener + , public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + AllListSelectionPanel(void); + virtual ~AllListSelectionPanel(void); + + result Initialize(void); + + int GetItemCheckedCount(void) const; + Tizen::Base::Collection::IList* GetItemCheckedIndexListN(void) const; + void OnSelectAllPressed(void); + + result OnRequestDelete(void); + result OnRequestMessage(void); + result OnRequestEmail(void); + result OnRequestMoveTo(Tizen::Base::String& destDirectory); + result OnRequestSlideShow(void); + result OnRotateRequested(RotateMode rotateMode); + void CancelUpdateProgress(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnIconListViewItemStateChanged (Tizen::Ui::Controls::IconListView &view, + int index, Tizen::Ui::Controls::IconListViewItemStatus status); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + virtual void OnFileOpInvalidate(enum FileActionMode); + virtual void OnFileOpComplete(enum FileActionMode, enum FileActionCompleteRes); + virtual void OnScanDirStart(); + virtual void OnScanDirComplete(); + void ChangeOrientation(void); + +private: + int GetRealindexFromVirtualIndex(const int virtualIndex) const; + int GetVirtualIndexFromRealIndex(const int realIndex) const; + void ResetSelection(void); + void SetButtonState(void); + +private: + int __itemCount; + Tizen::Ui::Controls::IconListView* __pContentIconListView; + Tizen::Base::Collection::IList* __pSeletedIndexList; + FileListEditorForm* __pFileListEditorForm; + FileUpdateTimer* __pFileUpdateTimer; + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_ALL_LIST_SELECTION_PANEL_H_ */ diff --git a/inc/GlBaseForm.h b/inc/GlBaseForm.h new file mode 100644 index 0000000..52f4dde --- /dev/null +++ b/inc/GlBaseForm.h @@ -0,0 +1,43 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlBaseForm.h + * @brief This is the header file for BaseForm class. + */ + +#ifndef _GL_BASE_FORM_H_ +#define _GL_BASE_FORM_H_ + +#include + +class FileListPresentationModel; + +class BaseForm + : public Tizen::Ui::Controls::Form +{ +public: + virtual ~BaseForm(void){}; + +protected: + Tizen::Base::Collection::IList* GetMoveFileIndexList(Tizen::Base::String&, Tizen::Base::Collection::IList*, + FileListPresentationModel*,bool isCopyOp = false); + +protected: + bool _overlayMsg; +}; + +#endif /* _GL_BASE_FORM_H_ */ diff --git a/inc/GlCommonUtil.h b/inc/GlCommonUtil.h new file mode 100644 index 0000000..ec3f072 --- /dev/null +++ b/inc/GlCommonUtil.h @@ -0,0 +1,36 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlCommonUtil.h + * @brief This is the header file for CommonUtil class. + */ + +#ifndef _GL_COMMON_UTIL_H_ +#define _GL_COMMON_UTIL_H_ + +using namespace Tizen::Base::Runtime; + +class IActionEventListener; + +class CommonUtil +{ +public: + static Tizen::Graphics::Bitmap* GetEmptyThumbnailN(void); + static Tizen::Base::String DurationToTimeString(const long duration); +}; + +#endif /* _GL_COMMON_UTIL_H_ */ diff --git a/inc/GlContentUpdateEventListener.h b/inc/GlContentUpdateEventListener.h new file mode 100644 index 0000000..4056f44 --- /dev/null +++ b/inc/GlContentUpdateEventListener.h @@ -0,0 +1,60 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlContentUpdateEventListener.h + * @brief This is the header file for FileListPresentationModel class. + */ + +#ifndef _GL_CONTENT_UPDATE_EVENT_LISTENER_H_ +#define _GL_CONTENT_UPDATE_EVENT_LISTENER_H_ + +#include + +class ContentUpdateEventListener + : public Tizen::Base::Object + , public Tizen::Content::IContentUpdateEventListener +{ +public: + static ContentUpdateEventListener* GetInstance(void); + void AddContentListener(void); + void RemoveContentListener(void); + bool GetChangeNotificationStatus(); + void SetTimerActive(void); + void ReSetTimerActive(void); + void ResumeOperation(); + Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath) const; +private: + ContentUpdateEventListener(void); + virtual ~ContentUpdateEventListener(void); + + result Construct(void); + static void CreateInstance(void); + static void DestroyInstance(void); + + 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: + static ContentUpdateEventListener* __pContentUpdateEventListener; + Tizen::Content::ContentManager* __pContentManager; + bool __isTimerActive; + bool __changeNotificationReceived; +}; + +#endif /* _GL_CONTENT_UPDATE_EVENT_LISTENER_H_ */ diff --git a/inc/GlDropDownCustomItem.h b/inc/GlDropDownCustomItem.h new file mode 100644 index 0000000..24ba37f --- /dev/null +++ b/inc/GlDropDownCustomItem.h @@ -0,0 +1,65 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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: DropDownCustomItem + *@brief: This class defines common behaviour of Drop down custom Item. + * + */ + +#ifndef _GL_DROPDOWN_CUSTOM_ITEM_H_ +#define _GL_DROPDOWN_CUSTOM_ITEM_H_ + +#include + +enum DropDownItemState +{ + DROP_DOWN_ITEM_STATE_OPENED = 0, + DROP_DOWN_ITEM_STATE_CLOSED +}; + +class DropDownCustomItem + : public Tizen::Ui::Controls::CustomItem +{ +public: + DropDownCustomItem(void); + virtual ~DropDownCustomItem(void); + + result Construct(int width, int height); + + DropDownItemState GetCurState(void) const; + Tizen::Base::String GetMainText(void) const; + Tizen::Base::String GetSubText(void) const; + result Make(int fontsize, int itemHeight); + void SetCurState(const DropDownItemState); + void SetMainText(const Tizen::Base::String& text); + void SetSubText(const Tizen::Base::String& text); + + protected: + static const int IDA_FORMAT_BITMAP; + static const int IDA_FORMAT_MAIN_STRING; + static const int IDA_FORMAT_SUB_STRING; + static const int IDA_FORMAT_DROPPER; + + private: + DropDownItemState __currentState; + int __height; + int __width; + Tizen::Base::String __mainText; + Tizen::Base::String __subText; + }; + +#endif /* _GL_DROPDOWN_CUSTOM_ITEM_H_ */ diff --git a/inc/GlFileListEditorForm.h b/inc/GlFileListEditorForm.h new file mode 100644 index 0000000..b25d965 --- /dev/null +++ b/inc/GlFileListEditorForm.h @@ -0,0 +1,110 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileListEditorForm.h + * @brief This is the header file for FileListEditorForm class. + */ + +#ifndef _GL_FILE_LIST_EDITOR_FORM_H_ +#define _GL_FILE_LIST_EDITOR_FORM_H_ + +#include +#include "GlBaseForm.h" +#include "GlFileMoveTimer.h" +#include "GlSlideSettingListener.h" + +class FileListPresentationModel; +class FileMoveTimer; +class ISlideSettingListener; +class SlideShowPopUp; + +class FileListEditorForm + : public BaseForm + , public IFileOpInvalidateListener + , public IFormContentUpdateEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener + , public ISlideSettingListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IPropagatedKeyEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + FileListEditorForm(void); + virtual ~FileListEditorForm(void); + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + virtual void OnContentUpdated(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + void SetTitleText(const Tizen::Base::String& titleText); + void SetProgressState(const bool progressState); + void RefreshFolderList(void); + void SetFooterButtonsState(const bool enableState); + result MoveToAlbum(const Tizen::Base::String& destDirectory); + + bool GetOverlayStatus(void) const; + + virtual void OnFileOpInvalidate(enum FileActionMode actionId); + virtual void OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes); + virtual void OnScanDirStart(); + virtual void OnScanDirComplete(); + + virtual void OnSlideSettingPopUpItemSelected(int index); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + + virtual void ShowAnimation(void); + virtual void OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + virtual void StopAnimation(void); + virtual bool OnKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false; } + virtual bool OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo); + virtual bool OnPreviewKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false; } + virtual bool OnPreviewKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false; } + +private: + result InitializeFooter(void); + Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath) const; + result SetUpPopup(void); + void SelectAllPressed(void); + +private: + Tizen::Ui::Controls::ContextMenu* __pShareContextMenu; + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; + Tizen::Ui::Controls::Popup* __pDeletePopup; + Tizen::Graphics::Point __morePosition; + Tizen::Base::Collection::IList* __pContentDirectoryList; + Tizen::Base::Collection::IList* __pContentDirectoryNameList; + SlideShowPopUp* __pPopUp; + FileMoveTimer* __pFileMove; + bool __isCopyOperation; + FileListPresentationModel* __pPresentationModel; + bool __isScanProgress; +}; + +#endif /* _GL_FILE_LIST_EDITOR_FORM_H_ */ diff --git a/inc/GlFileListForm.h b/inc/GlFileListForm.h new file mode 100644 index 0000000..01d2022 --- /dev/null +++ b/inc/GlFileListForm.h @@ -0,0 +1,82 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileListForm.h + * @brief This is the header file for FileListForm class. + */ + +#ifndef _GL_FILE_LIST_FORM_H_ +#define _GL_FILE_LIST_FORM_H_ + +#include +#include +#include "GlFormContentUpdateEventListener.h" +#include "GlSlideSettingListener.h" + +class FileListPresentationModel; +class ISlideSettingListener; +class SlideShowPopUp; + +class FileListForm + : public IFormContentUpdateEventListener + , public ISlideSettingListener + , public Tizen::App::IAppControlResponseListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener + , public Tizen::Ui::IOrientationEventListener +{ +public: + FileListForm(void); + virtual ~FileListForm(void); + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + virtual void OnContentUpdated(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + virtual void OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + void SetTitleText(const Tizen::Base::String& titleText); + + virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, + const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, + const Tizen::Base::Collection::IMap* pExtraData); + + virtual void OnSlideSettingPopUpItemSelected(int index); + + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + + void SetMenuState(bool state); + virtual void ShowAnimation(void){} + virtual void StopAnimation(void){} + +private: + result InitializeFooter(void); + +private: + bool __menuState; + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; + SlideShowPopUp* __pPopUp; + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_FILE_LIST_FORM_H_ */ diff --git a/inc/GlFileListPresentationModel.h b/inc/GlFileListPresentationModel.h new file mode 100644 index 0000000..a16bf46 --- /dev/null +++ b/inc/GlFileListPresentationModel.h @@ -0,0 +1,164 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileListPresentationModel.h + * @brief This is the header file for FileListPresentationModel class. + */ + +#ifndef _GL_FILE_LIST_PRESENTATION_MODEL_H_ +#define _GL_FILE_LIST_PRESENTATION_MODEL_H_ + +#include +#include + +#include "GlAlbumEventListener.h" +#include "GlFormContentUpdateEventListener.h" +#include "GlCommonUtil.h" +#include "GlIContentFileUpdateManager.h" +#include "GlResourceManager.h" +#include "GlThumbnailEventListener.h" +#include "GlTypes.h" + +class ThumbnailEvent; +class ThumbnailInfo; +class ThumbnailProvider; + +class FileListPresentationModel + : public IContentFileUpdateManager + , public IThumbnailEventListener + , public Tizen::Base::Object + , public Tizen::System::IDeviceEventListener +{ +public: + static FileListPresentationModel* GetInstance(void); + +public: + result GetThumbnailInSyncCacheN(const int index, Tizen::Base::String*& pName, + Tizen::Graphics::Bitmap*& pThumbnail); + result GetThumbnailVideoInSyncCacheN(const int index, Tizen::Base::String*& pName, + Tizen::Graphics::Bitmap*& pThumbnail, Tizen::Base::String*& pDuration) const; + virtual void RequestThumbnail(const int index); + virtual void RequestThumbnail(const Tizen::Content::ContentId& contentId); + void ClearThumbnailRequests(const bool appTerminating = false); + + static void AddPresentationModelListener(const IAlbumEventListener* listener); + static void RemovePresentationModelListener(const IAlbumEventListener& listener); + + virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + + static void AddContentEventListener(const IFormContentUpdateEventListener* listener); + static void RemoveContentEventListener(const IFormContentUpdateEventListener* listener); + + result DeleteContentFileList(const Tizen::Base::Collection::IList& contentIndexList); + Tizen::Base::Collection::IList* GetCollisionIndexListN(const Tizen::Base::Collection::IList& contentIndexList, + const Tizen::Base::String& destDirectory); + result MoveToContentFileList(const Tizen::Base::Collection::IList& contentIndexList, + const Tizen::Base::String& destDirectory); + result StartAppControl(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, + const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, + const Tizen::Base::Collection::HashMap* pDataList, Tizen::App::IAppControlResponseListener* pListener); + result SetCurrentAlbumInfo(const Tizen::Base::String& albumName, + const Tizen::Base::Collection::IList& directoryList); + result RefreshCurrentAlbumContentInfoList(const Tizen::Content::ContentType contentType); + Tizen::Base::String GetCurrentAlbumName(void) const; + void SetCurrentAlbumName(const Tizen::Base::String& albumName); + Tizen::Content::ContentType GetCurrentAlbumContentType(void) const; + void SetCurrentAlbumContentType(const Tizen::Content::ContentType contentType); + Tizen::Base::Collection::IList* GetAlbumDirectoryListN(void) const; + Tizen::Base::Collection::IList* GetAlbumContentInfoList(void) const; + Tizen::Content::ContentInfo* GetContentInfo(const int index) const; + int GetCurrentAlbumContentInfoCount(void) const; + Tizen::Content::ContentId GetContentInfoIndex(const int index) const; + Tizen::Base::String GetContentFilePath(const int index) const; + Tizen::Base::String ConvertToAlbumName(const Tizen::Base::String& targetPath) const; + + virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList) const; + + AppControlMode GetAppControlMode(void) const; + AppControlMediaType GetAppControlMediaType(void) const; + AppControlSelectionMode GetAppControlSelectionMode(void) const; + void SetUpdateProgressStatus(const bool status); + + void OnContentCreated(void); + void OnContentUpdated(void); + void OnContentDeleted(void); + void OnContentUpdated(const Tizen::Content::ContentId& contentId); + + virtual result RotateImage(const Tizen::Content::ContentId& contentId, RotateMode rotateMode); + + void ClearImageCache(void); + void ShowAnimation(void); + void StopAnimation(void); + void ClearProviderId(void); + void AddDirectoryIfNew(const Tizen::Base::String& fullPath); +private: + FileListPresentationModel(void); + virtual ~FileListPresentationModel(void); + FileListPresentationModel(FileListPresentationModel& value); + FileListPresentationModel& operator=(FileListPresentationModel&); + + result Construct(void); + static void CreateInstance(void); + static void DestroyInstance(void); + + result RefreshContentInfoList(const Tizen::Content::ContentType contentType); + Tizen::Base::String GetFileNameFromFullPath(const Tizen::Base::String& fullPath, const bool withExt) const; + Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath) const; + bool IsContainContentInDirectory(const Tizen::Base::String& directoryPath, + Tizen::Content::ContentType contentType) const; + ThumbnailInfo* GetThumbnailInfoFromInternalBufferN(const Tizen::Content::ContentId& contentId) const; + Tizen::Graphics::Bitmap* CoverVideoOverlayedImageOnThumbnailN(Tizen::Graphics::Bitmap& thumbnail, + const ThumbnailInfo& thumbmailInfo); + result DeleteContentFile(const Tizen::Base::String& filePath); + result MoveToContentFile(const Tizen::Base::String& filePath, + const Tizen::Base::String& destDirectory, const bool isCopyOperation); + Tizen::Graphics::Bitmap* GetShadedBackgroundBitmapN(Tizen::Graphics::Bitmap& bgBitmap, + const Tizen::Graphics::Bitmap& orgBitmap, const Tizen::Graphics::Rectangle& orgBitmapPosition) const; + Tizen::Base::Collection::IList* GetContentInfoListInDirectoryListN( + const Tizen::Base::Collection::IList& contentDirectoryList, + Tizen::Content::ContentType contentType) const; + + virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg); + + void OnTimerExpired(Timer& timer); + +private: + static FileListPresentationModel* __pPresentationModelInstance; + static ThumbnailProvider* __pThumbnailProvider; + static ThumbnailEvent* __pThumbnailEvent; + Tizen::Content::ContentManager* __pContentManager; + static Tizen::Base::Collection::ArrayList* __pPresentationModelListener; + static Tizen::Base::Collection::ArrayList* __pContentEventListener; + static Tizen::Base::Collection::ArrayList* __pIconListViewCache; + static Tizen::Base::Collection::IList* __pDirectoryList; + static Tizen::Base::Collection::IList* __pContentInfoList; + + Tizen::Base::String __albumName; + Tizen::Base::String __providerId; + Tizen::Content::ContentType __albumContentType; + AppControlMode __appControlMode; + AppControlMediaType __appControlMediaType; + AppControlSelectionMode __appControlSelectionMode; + + Tizen::Base::Collection::IList * __pContentIdList; + bool __updateProgressStatus; + + friend class FileMoveTimer; + friend class FileUpdateTimer; +}; + +#endif /* _GL_FILE_LIST_PRESENTATION_MODEL_H_ */ diff --git a/inc/GlFileMoveTimer.h b/inc/GlFileMoveTimer.h new file mode 100644 index 0000000..7420769 --- /dev/null +++ b/inc/GlFileMoveTimer.h @@ -0,0 +1,59 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 FileMoveTimer.h + * @brief This is the header file for FileMoveTimer class. + */ + +#ifndef _GL_FILE_MOVE_TIMER_H_ +#define _GL_FILE_MOVE_TIMER_H_ + +#include +#include "GlTimerBase.h" + +class FileListPresentationModel; + +class FileMoveTimer + : public GlTimerBase +{ +public : + FileMoveTimer(Tizen::Base::String&, Tizen::Base::Collection::IList*, FileListPresentationModel*, + IFileOpInvalidateListener*, bool isCopyOperation = false); + virtual ~FileMoveTimer(void); + + void SetCopy(void); + void ClearCopy(void); + +private: + virtual Tizen::Base::Collection::IList* TimerStart(void); + virtual result TimerExpired(const Tizen::Base::Object* contentId); + virtual void TimerCancel(int, enum FileActionCancelRes res); + virtual void TimerComplete(int, enum FileActionCompleteRes res); + result ScanDirectories(void); + virtual int GetDirScanCount(); + void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + +private : + Tizen::Base::Collection::IList* __pMoveIndexList; + Tizen::Base::String __moveToDir; + bool __isCopyOperation; + FileListPresentationModel* __pPresentationModel; + Tizen::Base::Collection::HashMap __scanDirMap; + Tizen::Content::ContentManager* __pContentManager; +}; + +#endif //_GL_FILE_MOVE_TIMER_H_ diff --git a/inc/GlFileOpInvalidateListener.h b/inc/GlFileOpInvalidateListener.h new file mode 100644 index 0000000..01e0398 --- /dev/null +++ b/inc/GlFileOpInvalidateListener.h @@ -0,0 +1,37 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileOpInvalidateListener.h + * @brief This is the header file for FileOpInvalidateListener class. + */ + +#ifndef _GL_FILE_OP_INVALIDATE_LISTENER_H_ +#define _GL_FILE_OP_INVALIDATE_LISTENER_H_ + +#include "GlTypes.h" + +class IFileOpInvalidateListener +{ +public: + virtual ~IFileOpInvalidateListener(void){} + virtual void OnFileOpInvalidate(enum FileActionMode) = 0; + virtual void OnFileOpComplete(enum FileActionMode, enum FileActionCompleteRes) = 0; + virtual void OnScanDirStart() = 0; + virtual void OnScanDirComplete() = 0; +}; + +#endif /* _GL_FILE_OP_INVALIDATE_LISTENER_H_ */ diff --git a/inc/GlFileUpdateTimer.h b/inc/GlFileUpdateTimer.h new file mode 100644 index 0000000..11912f6 --- /dev/null +++ b/inc/GlFileUpdateTimer.h @@ -0,0 +1,54 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileUpdateTimer.h + * @brief This is the header file for FileUpdateTimer class. + */ +#ifndef _GL_FILE_UPDATE_TIMER_H_ +#define _GL_FILE_UPDATE_TIMER_H_ + +#include +#include "GlTimerBase.h" + +class FileListPresentationModel; +class IContentFileUpdateManager; + +class FileUpdateTimer + : public GlTimerBase +{ +public: + 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 Tizen::Base::Object* contentId); + virtual result ScanDirectories(void); + virtual int GetDirScanCount(); + void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + virtual void TimerCancel(int, enum FileActionCancelRes res); + virtual void TimerComplete(int, enum FileActionCompleteRes res); + +private : + Tizen::Base::Collection::IList* __pUpdateIndexList; + IContentFileUpdateManager* __pFileUpdateManager; + RotateMode __rotateMode; + Tizen::Base::Collection::HashMap __scanDirMap; + Tizen::Content::ContentManager* __pContentManager; +}; + +#endif // _GL_FILE_UPDATE_TIMER_H_ diff --git a/inc/GlFormContentUpdateEventListener.h b/inc/GlFormContentUpdateEventListener.h new file mode 100644 index 0000000..6b4c443 --- /dev/null +++ b/inc/GlFormContentUpdateEventListener.h @@ -0,0 +1,40 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFormContentUpdateEventListener.h + * @brief This is the header file for ContentEventListener class. + */ + +#ifndef _GL_CONTENT_EVENT_LISTENER_H_ +#define _GL_CONTENT_EVENT_LISTENER_H_ + +class ProgressAnimation; + +class IFormContentUpdateEventListener + : public Tizen::Base::Runtime::IEventListener + , public Tizen::Base::Object +{ +public: + virtual ~IFormContentUpdateEventListener(void){}; + virtual void OnContentUpdated() = 0; + virtual void ShowAnimation(void) = 0; + virtual void StopAnimation(void) = 0; +protected: + ProgressAnimation* _pProgressAnim; +}; + +#endif /* _GL_CONTENT_EVENT_LISTENER_H_ */ diff --git a/inc/GlFormFactory.h b/inc/GlFormFactory.h new file mode 100644 index 0000000..a072a00 --- /dev/null +++ b/inc/GlFormFactory.h @@ -0,0 +1,36 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFormFactory.h + * @brief This is the header file for FormFactory class. + */ + +#ifndef _GL_FORM_FACTORY_H_ +#define _GL_FORM_FACTORY_H_ + +class FormFactory + : public Tizen::Ui::Scenes::IFormFactory +{ +public: + FormFactory(void); + virtual ~FormFactory(void); + + virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String& formId, + const Tizen::Ui::Scenes::SceneId& sceneId); +}; + +#endif /* _GL_FORM_FACTORY_H_ */ diff --git a/inc/GlGalleryApp.h b/inc/GlGalleryApp.h new file mode 100644 index 0000000..3ded69e --- /dev/null +++ b/inc/GlGalleryApp.h @@ -0,0 +1,76 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlGalleryApp.h + * @brief This is the header file for GalleryApp class. + */ + +#ifndef _GL_GALLERY_APP_H_ +#define _GL_GALLERY_APP_H_ + +#include +#include +#include "GlTypes.h" + +class AlbumListPresentationModel; +class FileListPresentationModel; + +class GalleryApp + : public Tizen::App::UiApp + , public Tizen::App::IAppControlProviderEventListener + , public Tizen::System::ISettingEventListener +{ +public: + static Tizen::App::UiApp* CreateInstance(void); + +public: + GalleryApp(void); + virtual ~GalleryApp(void); + + Tizen::Base::String GetAppControlOperationId(void) const; + Tizen::Base::String GetUriData(void) const; + Tizen::Base::String GetMimeType(void) const; + const Tizen::Base::Collection::IMap* GetAppControlArguments(void) const; + void SendAppControlResult(const Tizen::App::AppCtrlResult appControlResult, + const Tizen::Base::Collection::IMap* pExtraData); + + virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry); + virtual bool OnAppInitialized(void); + virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false); + virtual void OnForeground(void); + + virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, + const Tizen::Base::String* pUriScheme, const Tizen::Base::String* pDataType, + const Tizen::Base::Collection::IMap* pArgs); + + virtual void OnSettingChanged(Tizen::Base::String& key); + + void SetFrameEnabled(const bool enabled); + void SetFrameActivated(bool frameActivated); + bool GetFrameActivated(void) const; + +private: + RequestId __requestId; + Tizen::Base::String __operationId; + Tizen::Base::String __uriData; + Tizen::Base::String __mimeType; + const Tizen::Base::Collection::HashMap* __pArguments; + Tizen::App::AppCtrlResult __appControlResult; + bool __frameActivated; +}; + +#endif /* _GL_GALLERY_APP_H_ */ diff --git a/inc/GlIContentFileUpdateManager.h b/inc/GlIContentFileUpdateManager.h new file mode 100644 index 0000000..be831da --- /dev/null +++ b/inc/GlIContentFileUpdateManager.h @@ -0,0 +1,40 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlIContentFileUpdateManager.h + * @brief This is the header file for IContentFileDeleteManager class. + */ + +#ifndef _GL_ICONTENT_FILE_UPDATE_MANAGER_H_ +#define _GL_ICONTENT_FILE_UPDATE_MANAGER_H_ + +#include "GlTypes.h" + +class IContentFileUpdateManager +{ +public: + IContentFileUpdateManager(){} + virtual ~IContentFileUpdateManager(){} + + virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList) const = 0; + virtual result DeleteContentFile(const Tizen::Base::String& filePath) = 0; + virtual result RotateImage(const Tizen::Content::ContentId& contentId, RotateMode rotateMode) = 0; + virtual void RequestThumbnail(const int index) = 0; + virtual void RequestThumbnail(const Tizen::Content::ContentId& contentId) = 0; +}; + +#endif /* _GL_ICONTENT_FILE_UPDATE_MANAGER_H_ */ diff --git a/inc/GlImageCropForm.h b/inc/GlImageCropForm.h new file mode 100644 index 0000000..ef1fef5 --- /dev/null +++ b/inc/GlImageCropForm.h @@ -0,0 +1,106 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlImageCropForm.h + * @brief This is the implementation file for Image Crop. + */ + +#ifndef _GL_IMAGE_CROP_H_ +#define _GL_IMAGE_CROP_H_ + +#include +#include + +#include "GlFileListPresentationModel.h" + +enum TouchLocation +{ + INSIDE_CROPBOX = 0, + OUTSIDE_CROPBOX, + INSIDE_TOP_RECTANGLE, + INSIDE_BOTTOM_RECTANGLE, + INSIDE_LEFT_RECTANGLE, + INSIDE_RIGHT_RECTANGLE, + INSIDE_TOP_LEFT_RECTANGLE, + INSIDE_TOP_RIGHT_RECTANGLE, + INSIDE_BOTTOM_LEFT_RECTANGLE, + INSIDE_BOTTOM_RIGHT_RECTANGLE, +}; + +class ImageCropForm + : public IFormContentUpdateEventListener + , public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::ITouchEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + ImageCropForm(void); + ~ImageCropForm(void); + + bool Initialize(void); + void CheckCurrentPosition(const Tizen::Graphics::Point currentPosition); + void SetValue(void); + Tizen::Base::String GetFileName(const Tizen::Base::String& filePath, bool isCheckExe = false) const; + + virtual result OnInitializing(void); + virtual result OnDraw(void); + + virtual void OnContentUpdated(void); + virtual void ShowAnimation(void){}; + virtual void StopAnimation(void){}; + + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){} + virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){} + virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + +private: + Tizen::Base::String __sourceFilePath; + Tizen::Base::String __cropMode; + Tizen::Graphics::Canvas* __pCanvas; + Tizen::Graphics::Bitmap* __pCurrentBitmap; + Tizen::Graphics::Bitmap* __pRectangleBitmap; + Tizen::Graphics::Point __touchStart; + Tizen::Graphics::Rectangle __cropBox; + Tizen::Graphics::Rectangle __imageBox; + Tizen::Media::ImageBuffer* __imageBuffer; + Tizen::Media::ImageFormat __imageFormat; + TouchLocation __pointLocation; + bool __isOrientationChanged; + int __imageHeight; + int __imageWidth; + int __statusValue; + int __formHeight; + int __formWidth; + int __skipMoveEvent; + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_IMAGE_CROP_H_ */ diff --git a/inc/GlImageListEditorPanel.h b/inc/GlImageListEditorPanel.h new file mode 100644 index 0000000..5c113f8 --- /dev/null +++ b/inc/GlImageListEditorPanel.h @@ -0,0 +1,88 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlImageListEditorPanel.h + * @brief This is the header file for ImageListEditorPanel class. + */ + +#ifndef _GL_IMAGE_LIST_EDITOR_PANEL_H_ +#define _GL_IMAGE_LIST_EDITOR_PANEL_H_ + +#include "GlAlbumEventListener.h" +#include "GlThumbnailEventListener.h" +#include "GlFileOpInvalidateListener.h" +#include "GlFileListEditorForm.h" + +class FileListPresentationModel; +class FileUpdateTimer; + +class ImageListEditorPanel + : public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener + , public IAlbumEventListener + , public IFileOpInvalidateListener +{ +public: + ImageListEditorPanel(void); + virtual ~ImageListEditorPanel(void); + + result Initialize(void); + + void OnSelectAllPressed(void); + void OnRequestAppExitWithMultipleSelectionAppControlResult(void); + int GetItemCheckedCount(void) const; + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + void SetButtonState(void); + + virtual void OnIconListViewItemStateChanged (Tizen::Ui::Controls::IconListView &view, int index, + Tizen::Ui::Controls::IconListViewItemStatus status); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + virtual void OnFileOpInvalidate(enum FileActionMode actionId); + virtual void OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes); + virtual void OnScanDirStart(){} + virtual void OnScanDirComplete(){} + void ChangeOrientation(void); + +private: + Tizen::Base::Collection::IList* GetItemCheckedIndexListN(void) const; + +private: + int __itemCount; + Tizen::Ui::Controls::IconListView* __pContentIconListView; + Tizen::Ui::Controls::CheckButton* __pCheckButton; + Tizen::Ui::Controls::Label* __pLabelSelectCnt; + FileListPresentationModel* __pPresentationModel; + FileListEditorForm* __pFileListEditorForm; +}; + +#endif /* _GL_IMAGE_LIST_EDITOR_PANEL_H_ */ diff --git a/inc/GlImageListPanel.h b/inc/GlImageListPanel.h new file mode 100644 index 0000000..ad51432 --- /dev/null +++ b/inc/GlImageListPanel.h @@ -0,0 +1,67 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlImageListPanel.h + * @brief This is the header file for ImageListPanel class. + */ + +#ifndef _GL_IMAGE_LIST_PANEL_H_ +#define _GL_IMAGE_LIST_PANEL_H_ + +#include "GlAlbumEventListener.h" +#include "GlThumbnailEventListener.h" + +class FileListPresentationModel; + +class ImageListPanel + : public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Controls::IIconListViewItemEventListener + , public Tizen::Ui::Controls::IIconListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener + , public IAlbumEventListener +{ +public: + ImageListPanel(void); + virtual ~ImageListPanel(void); + + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnIconListViewItemStateChanged (Tizen::Ui::Controls::IconListView &view, int index, + Tizen::Ui::Controls::IconListViewItemStatus status); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::IconListViewItem* CreateItem(int index); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + +private: + int __itemCount; + Tizen::Ui::Controls::IconListView* __pContentIconListView; + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_IMAGE_LIST_PANEL_H_ */ diff --git a/inc/GlMainFrame.h b/inc/GlMainFrame.h new file mode 100644 index 0000000..f18ca45 --- /dev/null +++ b/inc/GlMainFrame.h @@ -0,0 +1,41 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlMainFrame.h + * @brief This is the header file for MainFrame class. + */ + +#ifndef _GL_MAIN_FRAME_H_ +#define _GL_MAIN_FRAME_H_ + +class MainFrame + : public Tizen::Ui::Controls::Frame + , public Tizen::Ui::Controls::IFrameEventListener +{ +public: + MainFrame(void); + virtual ~MainFrame(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnFrameActivated(const Tizen::Ui::Controls::Frame& source); + virtual void OnFrameDeactivated(const Tizen::Ui::Controls::Frame& source){} + virtual void OnFrameTerminating(const Tizen::Ui::Controls::Frame& source){} +}; + +#endif /* _GL_MAIN_FRAME_H_ */ diff --git a/inc/GlPanelFactory.h b/inc/GlPanelFactory.h new file mode 100644 index 0000000..394b981 --- /dev/null +++ b/inc/GlPanelFactory.h @@ -0,0 +1,38 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlPanelFactory.h + * @brief This is the header file for PanelFactory class. + */ + +#ifndef _GL_PANEL_FACTORY_H_ +#define _GL_PANEL_FACTORY_H_ + +#include + +class PanelFactory + : public Tizen::Ui::Scenes::IPanelFactory +{ +public: + PanelFactory(void); + virtual ~PanelFactory(void); + + virtual Tizen::Ui::Controls::Panel* CreatePanelN(const Tizen::Base::String& panelId, + const Tizen::Ui::Scenes::SceneId& sceneId); +}; + +#endif /* _GL_PANEL_FACTORY_H_ */ diff --git a/inc/GlProgressAnimation.h b/inc/GlProgressAnimation.h new file mode 100644 index 0000000..1a09226 --- /dev/null +++ b/inc/GlProgressAnimation.h @@ -0,0 +1,48 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlProgressAnimation.h + * @brief This is the header file for GlProgressAnimation class. + */ + +#ifndef _GL_PROGRESS_ANIMATION_H_ +#define _GL_PROGRESS_ANIMATION_H_ + +#include + +class ProgressAnimation + : public Tizen::Ui::Controls::Panel +{ +public: + ProgressAnimation(void); + virtual ~ProgressAnimation(void); + + result Construct(Tizen::Graphics::Rectangle rect); + + void AnimationStart(void); + void AnimationStop(void); + void ChangeOrientation(Tizen::Graphics::Rectangle rect); + +private: + static const int DURATION = 500; + static const int PROGRESS_COUNT = 30; + + Tizen::Ui::Controls::Animation* __pAnimation; + Tizen::Base::Collection::ArrayList* __pAnimationFrameList; +}; + +#endif /* _GL_PROGRESS_ANIMATION_H_ */ diff --git a/inc/GlProgressBar.h b/inc/GlProgressBar.h new file mode 100644 index 0000000..bfd714f --- /dev/null +++ b/inc/GlProgressBar.h @@ -0,0 +1,53 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlProgressBar.h + * @brief This is the header file for GlProgressBar class. + */ + +#ifndef _GL_PROGRESS_BAR_H_ +#define _GL_PROGRESS_BAR_H_ + +#include "GlTypes.h" + +class GlProgressBar +{ +public: + GlProgressBar(Tizen::Ui::IActionEventListener* listener,Tizen::Ui::IPropagatedKeyEventListener* __pPropagatedListener); + virtual ~GlProgressBar(void); + + void HideFileProgressingPopup(void); + void ShowFileProgressingPopup(const int val, enum FileActionMode action); + void IncProgress(const int count); + +private: + result CreateFileProgressingPopup(void); + +private: + int __totalVal; + int __curVal; + Tizen::Ui::Controls::Popup* __pFileProgressingPopup; + Tizen::Ui::Controls::Progress* __pFileProgressingProgress; + Tizen::Ui::Controls::Label* __pFileProgressingHeaderLabel; + Tizen::Ui::Controls::Label* __pFileProgressingLabel; + Tizen::Ui::Controls::Label* __pFileCounterLabel; + Tizen::Ui::Controls::Button* __pFileProgressingCancelButton; + Tizen::Ui::IActionEventListener* __pActionListener; + Tizen::Ui::IPropagatedKeyEventListener* __pPropagatedListener; +}; + +#endif /* _GL_PROGRESS_BAR_H_ */ diff --git a/inc/GlRadioCustomItem.h b/inc/GlRadioCustomItem.h new file mode 100644 index 0000000..7dabb8e --- /dev/null +++ b/inc/GlRadioCustomItem.h @@ -0,0 +1,52 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 IntRadioCustomItem.h + *@brief The RadioCustomItem defines radio custom item. + * + */ + +#ifndef _GL_RADIO_CUSTOM_ITEM_H_ +#define _GL_RADIO_CUSTOM_ITEM_H_ + +#include "GlTypes.h" + +class RadioCustomItem + : public Tizen::Ui::Controls::CustomItem +{ +public: + RadioCustomItem(void); + virtual ~RadioCustomItem(void); + + result Construct(int width, int height); + Tizen::Base::String GetText(void) const; + result Make(int fontSize); + void SetText(const Tizen::Base::String& text); + + +protected: + static const int IDA_FORMAT_STRING; + static const int IDA_FORMAT_RADIO_BUTTON; + +private: + bool __isSelected; + int __width; + int __height; + Tizen::Base::String __text; +}; + +#endif /* _GL_RADIO_CUSTOM_ITEM_H_ */ diff --git a/inc/GlResourceManager.h b/inc/GlResourceManager.h new file mode 100644 index 0000000..44cf2cc --- /dev/null +++ b/inc/GlResourceManager.h @@ -0,0 +1,38 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlResourceManager.h + * @brief This is the header file for ResourceManager class. + */ + +#ifndef _GL_RESOURCE_MANAGER_H_ +#define _GL_RESOURCE_MANAGER_H_ + +#include + +class ResourceManager +{ +public: + static Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& id); + static Tizen::Base::String GetString(const Tizen::Base::String& id); + +private: + ResourceManager(void); + virtual ~ResourceManager(void); +}; + +#endif /* _GL_RESOURCE_MANAGER_H_ */ diff --git a/inc/GlSettingMainForm.h b/inc/GlSettingMainForm.h new file mode 100644 index 0000000..a8a0373 --- /dev/null +++ b/inc/GlSettingMainForm.h @@ -0,0 +1,128 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlSettingMainForm.h + * @brief This is the header file for SettingMainForm class. + */ + +#ifndef _GL_SETTING_MAIN_FORM_H_ +#define _GL_SETTING_MAIN_FORM_H_ + +#include "GlFormContentUpdateEventListener.h" + +enum SettingListItemType +{ + ITEM_TYPE_NORMAL = 0, + ITEM_TYPE_TOGGLE, + ITEM_TYPE_DROPDOWN, + ITEM_TYPE_RADIO, +}; + +enum +{ + SETTING_INVALID = -1, + SETTING_SLIDESHOW_INTERVAL_TITLE = 0, + SETTING_INTERVAL_2, + SETTING_INTERVAL_3, + SETTING_INTERVAL_5, + SETTING_INTERVAL_10, + SETTING_INTERVAL_20, + SETTING_REPEAT, + SETTING_SHUFFLE, + SETTING_TRANSITION_EFFECT_TITLE, + SETTING_TRANSITION_PAGE, + SETTING_TRANSITION_DISSOLVE, + SETTING_TRANSITION_ZOOM, + SETTING_MAX +}; + +class SettingPresentationModel; + +class SettingMainForm + : public IFormContentUpdateEventListener + , public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemProvider + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public Tizen::System::ISettingEventListener + +{ +public: + SettingMainForm(void); + virtual ~SettingMainForm(void); + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + virtual void OnContentUpdated(void); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, + int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status){}; + void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, + int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status); + void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, + int itemIndex, Tizen::Ui::Controls::SweepDirection direction){}; + + virtual int GetGroupCount(void); + virtual int GetItemCount(int groupIndex); + virtual Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth); + virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth); + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth); + virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnSettingChanged(Tizen::Base::String& key); + virtual void ShowAnimation(void){} + virtual void StopAnimation(void){} + class SettingItemInfo + { + public: + SettingItemInfo(void); + virtual ~SettingItemInfo(void){}; + + public: + int childCount; + bool isOpen; + bool isSelected; + SettingListItemType itemType; + Tizen::Base::String titleText; + Tizen::Base::String subText; + }; + + int* pGroupItemCount; + SettingItemInfo settingInfo[SETTING_MAX]; + +private: + void InitializeSettingValues(void); + +private: + Tizen::Ui::Controls::GroupedListView* __pList; + SettingPresentationModel* __pPresentationModel; + bool __contentUpdated; +}; + +#endif /* _GL_SETTING_MAIN_FORM_H_ */ diff --git a/inc/GlSettingPresentationModel.h b/inc/GlSettingPresentationModel.h new file mode 100644 index 0000000..96d1947 --- /dev/null +++ b/inc/GlSettingPresentationModel.h @@ -0,0 +1,62 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlSettingPresentationModel.h + * @brief This is the header file for SettingPresentationModel class. + */ + +#ifndef _GL_SETTING_PRESENTATION_MODEL_H_ +#define _GL_SETTING_PRESENTATION_MODEL_H_ + +#include +#include + +class SettingPresentationModel + : public Tizen::Base::Object +{ +public: + static SettingPresentationModel* GetInstance(void); + +public: + result GetValue(const Tizen::Base::String& strSectionName, const Tizen::Base::String& entryName, + int& value) const; + result GetValue(const Tizen::Base::String& strSectionName, const Tizen::Base::String& entryName, + Tizen::Base::String& value) const; + result SetValue(const Tizen::Base::String& strSectionName, const Tizen::Base::String& entryName, int value); + result SetValue(const Tizen::Base::String& strSectionName, const Tizen::Base::String& entryName, + const Tizen::Base::String& value); + + result CreateDefaultRegistry(void); + + void DeleteRegistry(void); +private: + SettingPresentationModel(void); + virtual ~SettingPresentationModel(void); + SettingPresentationModel(SettingPresentationModel& value); + SettingPresentationModel& operator=(SettingPresentationModel&); + + result Construct(void); + static void CreateInstance(void); + static void DestroyInstance(void); + + +private: + Tizen::Io::Registry* __pDefaultGalleryRegistry; + static SettingPresentationModel* __pPresentationModelInstance; +}; + +#endif /* _GL_SETTING_PRESENTATION_MODEL_H_ */ diff --git a/inc/GlSettingToggleCustomItem.h b/inc/GlSettingToggleCustomItem.h new file mode 100644 index 0000000..39df99b --- /dev/null +++ b/inc/GlSettingToggleCustomItem.h @@ -0,0 +1,96 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlSettingToggleCustomItem.h + * @brief The SettingToggleCustomItem used to toggle the item. + */ + +#ifndef _INT_SETTING_TOGGLE_CUSTOM_ITEM_H_ +#define _INT_SETTING_TOGGLE_CUSTOM_ITEM_H_ + +#include "GlTypes.h" + +class SettingToggleCustomItem + : public Tizen::Ui::Controls::CustomItem +{ + +public: + /** + * @brief The Default constructor + */ + SettingToggleCustomItem(void); + + /** + * @brief The Default destructor + */ + virtual ~SettingToggleCustomItem(void); + + /** + * @brief Initializes this instance of %DropDownCustomItem. + * + * @return An error code + * @param[in] void An instance of the Rectangle class @n + * This instance represents the x and y coordinates of the top-left corner of the created window along with + * the width and height of the window. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Construct(int width, int height); + + //getter and setter methods for text + + /** + * @brief The method used to get the text of CustomItem + * + * @return A String + */ + Tizen::Base::String GetText(void) const; + + /** + * @brief Add all the required elements and create the Custom Item. + * + * @return An error code + * @param[in] void An instance of the Rectangle class @n + * This instance represents the x and y coordinates of the top-left corner of the created window along with + * the width and height of the window. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Make(int fontSize); + + /** + * @brief The method used to set the text of CustomItem + */ + + void SetText(const Tizen::Base::String& text); + +private: + int __width; ///Width of the SettingToggleCustomItem Instance + int __height; ///Height of the SettingToggleCustomItem Instance + Tizen::Base::String __text; ///The Text for the Toggle Button +}; + +#endif /* _INT_SETTING_TOGGLE_CUSTOM_ITEM_H_ */ diff --git a/inc/GlSlideSettingListener.h b/inc/GlSlideSettingListener.h new file mode 100644 index 0000000..ad35c63 --- /dev/null +++ b/inc/GlSlideSettingListener.h @@ -0,0 +1,34 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlISlideSettingListener.h + * @brief This is the header file for ISlideSettingListener class. + */ + +#ifndef _GL_SLIDE_SETTING_LISTENER_H_ +#define _GL_SLIDE_SETTING_LISTENER_H_ + +class ISlideSettingListener +{ +public: + ISlideSettingListener(void){}; + virtual ~ISlideSettingListener(void) {}; + + virtual void OnSlideSettingPopUpItemSelected(int index) = 0; +}; + +#endif /* _GL_SLIDE_SETTING_LISTENER_H_ */ diff --git a/inc/GlSlideShowPopUp.h b/inc/GlSlideShowPopUp.h new file mode 100644 index 0000000..af9adee --- /dev/null +++ b/inc/GlSlideShowPopUp.h @@ -0,0 +1,74 @@ +// +// Tizen Native SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlSlideShowPopUp.h + * @brief This header file contains the declarations of the SlideShowPopUp + * + */ + +#ifndef _GL_SLIDE_SHOW_POPUP_H_ +#define _GL_SLIDE_SHOW_POPUP_H_ + +#include + +class ISlideSettingListener; + +class SlideShowPopUp + : public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::Popup + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IPropagatedKeyEventListener +{ +public: + SlideShowPopUp(void); + virtual ~SlideShowPopUp(void); + + bool Initialize(void); + virtual result OnTerminating(void); + +public: + void SetEventListner(ISlideSettingListener* listner); + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, + int elementId, Tizen::Ui::Controls::ListContextItemStatus state){}; + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, + Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, + Tizen::Ui::Controls::SweepDirection direction){}; + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, + bool& invokeListViewItemCallback){}; + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual bool OnKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;}; + virtual bool OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo); + virtual bool OnPreviewKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;}; + virtual bool OnPreviewKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;}; + +private: + Tizen::Ui::Controls::ListView* __pList; + ISlideSettingListener* __pListener; +}; + +#endif /* _GL_SLIDE_SHOW_POPUP_H_ */ diff --git a/inc/GlThumbnailEvent.h b/inc/GlThumbnailEvent.h new file mode 100644 index 0000000..bb94ce8 --- /dev/null +++ b/inc/GlThumbnailEvent.h @@ -0,0 +1,40 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailEvent.h + * @brief This is the header file for ThumbnailEvent class. + */ + +#ifndef _GL_THUMBNAIL_EVENT_H_ +#define _GL_THUMBNAIL_EVENT_H_ + +#include + +class IThumbnailEventListener; + +class ThumbnailEvent + : public Tizen::Base::Runtime::Event +{ +public: + virtual ~ThumbnailEvent(void); + +protected: + virtual void FireImpl(Tizen::Base::Runtime::IEventListener& listener, + const Tizen::Base::Runtime::IEventArg& eventArg); +}; + +#endif /* _GL_THUMBNAIL_EVENT_H_ */ diff --git a/inc/GlThumbnailEventArg.h b/inc/GlThumbnailEventArg.h new file mode 100644 index 0000000..5a7e6f5 --- /dev/null +++ b/inc/GlThumbnailEventArg.h @@ -0,0 +1,39 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailEventArg.h + * @brief This is the header file for ThumbnailEventArg class. + */ + +#ifndef _GL_THUMBNAIL_EVENT_ARG_H_ +#define _GL_THUMBNAIL_EVENT_ARG_H_ + +class ThumbnailInfo; + +class ThumbnailEventArg + : public Tizen::Base::Runtime::IEventArg +{ +public: + ThumbnailEventArg(ThumbnailInfo* pThumbnailInfo); + virtual ~ThumbnailEventArg(void); + virtual ThumbnailInfo* GetThumbnailInfoN(void); + +protected: + ThumbnailInfo* _pThumbnailInfo; +}; + +#endif /* _GL_THUMBNAIL_EVENT_ARG_H_ */ diff --git a/inc/GlThumbnailEventListener.h b/inc/GlThumbnailEventListener.h new file mode 100644 index 0000000..f50af95 --- /dev/null +++ b/inc/GlThumbnailEventListener.h @@ -0,0 +1,33 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailEventListener.h + * @brief This is the header file for ThumbnailEventListener class. + */ + +#ifndef _GL_THUMBNAIL_EVENT_LISTENER_H_ +#define _GL_THUMBNAIL_EVENT_LISTENER_H_ + +class IThumbnailEventListener + : public Tizen::Base::Runtime::IEventListener +{ +public: + virtual ~IThumbnailEventListener(void) {}; + virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg) = 0; +}; + +#endif /* _GL_THUMBNAIL_EVENT_LISTENER_H_ */ diff --git a/inc/GlThumbnailInfo.h b/inc/GlThumbnailInfo.h new file mode 100644 index 0000000..19e2b4b --- /dev/null +++ b/inc/GlThumbnailInfo.h @@ -0,0 +1,59 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailInfo.h + * @brief This is the header file for ThumbnailInfo class. + */ + +#ifndef _GL_THUMBNAIL_INFO_H_ +#define _GL_THUMBNAIL_INFO_H_ + +#include + +class ThumbnailInfo + : public Tizen::Base::Object +{ +public: + ThumbnailInfo(void); + virtual ~ThumbnailInfo(void); + + void Construct(const Tizen::Content::ContentId& contentId, + const Tizen::Base::String& filePath, const Tizen::Graphics::Bitmap& bitmap, + const Tizen::Content::ContentType contentType, const long duration = 0); + + Tizen::Content::ContentId GetContentId(void) const; + Tizen::Base::String GetFilePath(void) const; + void SetFilePath(const Tizen::Base::String& filePath); + Tizen::Graphics::Bitmap* GetBitmapN(void) const; + void SetBitmap(const Tizen::Graphics::Bitmap& bitmap); + Tizen::Content::ContentType GetContentType(void) const; + void SetContentType(const Tizen::Content::ContentType contentType); + long GetDuration(void) const; + void SetDuration(const long duration); + +private: + Tizen::Graphics::Bitmap* CloneBitmapN(const Tizen::Graphics::Bitmap& bitmap) const; + +private : + Tizen::Content::ContentId __contentId; + Tizen::Base::String __filePath; + Tizen::Graphics::Bitmap* __pBitmap; + Tizen::Content::ContentType __contentType; + long __duration; +}; + +#endif /* _GL_THUMBNAIL_INFO_H_ */ diff --git a/inc/GlThumbnailJob.h b/inc/GlThumbnailJob.h new file mode 100644 index 0000000..6d12bc8 --- /dev/null +++ b/inc/GlThumbnailJob.h @@ -0,0 +1,51 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailJob.h + * @brief This is the header file for ThumbnailJob class. + */ + +#ifndef _GL_THUMBNAIL_JOB_H_ +#define _GL_THUMBNAIL_JOB_H_ + +class ThumbnailEvent; + +class ThumbnailJob + : public Tizen::Base::Object +{ +public: + ThumbnailJob(void); + virtual ~ThumbnailJob(void); + + void Construct(const Tizen::Content::ContentId& contentId, const unsigned long requestId, + const ThumbnailEvent* pRequestEvent); + + Tizen::Content::ContentId GetContentId(void) const; + unsigned long GetRequestId(void) const; + const ThumbnailEvent* GetEvent(void) const; + +private: + ThumbnailJob(const ThumbnailJob&); + ThumbnailJob& operator=(const ThumbnailJob&); + +private: + Tizen::Content::ContentId __contentId; + unsigned long __requestId; + const ThumbnailEvent* __pRequestEvent; +}; + +#endif /* _GL_THUMBNAIL_JOB_H_ */ diff --git a/inc/GlThumbnailProvider.h b/inc/GlThumbnailProvider.h new file mode 100644 index 0000000..216169b --- /dev/null +++ b/inc/GlThumbnailProvider.h @@ -0,0 +1,69 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailProvider.h + * @brief This is the header file for ThumbnailProvider class. + */ + +#ifndef _GL_THUMBNAIL_PROVIDER_H_ +#define _GL_THUMBNAIL_PROVIDER_H_ + +#include "GlThumbnailInfo.h" + +class ThumbnailEvent; + +class ThumbnailProvider + : public Tizen::Base::Runtime::EventDrivenThread +{ +public: + static ThumbnailProvider* GetInstance(void); + +public: + static void Release(void); + + void RequestThumbnail(const Tizen::Content::ContentId& contentId, const ThumbnailEvent* event); + void ClearThumbnailRequests(const bool appTerminating = false); + + virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList * pArgs); + virtual bool OnStart(void); + virtual void OnStop(void); + +private: + ThumbnailProvider(void); + virtual ~ThumbnailProvider(void); + ThumbnailProvider(ThumbnailProvider& value); + ThumbnailProvider& operator = (ThumbnailProvider&); + + result Construct(void); + static void CreateInstance(void); + static void DestroyInstance(void); + + ThumbnailInfo* GetThumbnailInfoN(const Tizen::Content::ContentId& contentId) const; + Tizen::Graphics::Bitmap* GetThumbnailByDecodeN(const Tizen::Base::String& filePath, const Tizen::Content::ContentType contentType) const; + Tizen::Base::String GetFileNameFromFullPath(const Tizen::Base::String& fullPath, bool withExt) const; + +private: + static ThumbnailProvider* __pThumbnailProviderInstance; + static Tizen::Base::Collection::ArrayList* __pThumbnailEventListener; + + Tizen::Base::Runtime::Mutex* __pMutexCmd; + Tizen::Base::Collection::ArrayList* __pCmdQueue; + unsigned long __requestId; + bool __isAppTerminating; +}; + +#endif /* _GL_THUMBNAIL_PROVIDER_H_ */ diff --git a/inc/GlTimerBase.h b/inc/GlTimerBase.h new file mode 100644 index 0000000..ff31bf0 --- /dev/null +++ b/inc/GlTimerBase.h @@ -0,0 +1,97 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlTimerBase.h + * @brief This is the header file for GlTimerBase class. + */ + +#ifndef _GL_TIMER_BASE_H_ +#define _GL_TIMER_BASE_H_ + +#include +#include +#include "GlFileOpInvalidateListener.h" +#include "GlTimerScanDirListener.h" +#include "GlTypes.h" + +class GlProgressBar; + +class GlTimerBase + : public Tizen::Ui::IActionEventListener + , public Tizen::Base::Runtime::ITimerEventListener + , public ITimerScanDirListener + , public Tizen::Ui::IPropagatedKeyEventListener + , public Tizen::System::IDeviceEventListener +{ +public: + + GlTimerBase(IFileOpInvalidateListener*, enum FileActionMode actionId); + virtual ~GlTimerBase(void); + + bool StartTimer(void); + void CancelTimer(void); + void SetActionMode(const enum FileActionMode actionId); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); + virtual void OnTimerScanDirComplete(); + + void Cancel(void); + bool IsStarted(void); + + + virtual bool OnKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false; }; + virtual bool OnKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo); + virtual bool OnPreviewKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false;}; + virtual bool OnPreviewKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){ return false;}; + + +protected: + virtual Tizen::Base::Collection::IList* TimerStart(void) = 0; + virtual result TimerExpired(const Tizen::Base::Object*) = 0; + virtual void TimerCancel(int, enum FileActionCancelRes res) = 0; + virtual void TimerComplete(int, enum FileActionCompleteRes res) = 0; + virtual result ScanDirectories(void) = 0; + virtual int GetDirScanCount() = 0; + int GetMovedCount() const; + virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state) = 0; + +private: + void OnOpComplete(enum FileActionCompleteRes); + void OnOpCancelled(enum FileActionCancelRes res); + +protected: + enum FileActionMode _actionId; + +private: + Tizen::Base::Runtime::Timer __moveTimer; + Tizen::Base::Collection::IList * __pContentIdList; + int __moveToCount; + GlProgressBar* __pMoveProBar; + IFileOpInvalidateListener* __pInvalidate; + bool __isStarted; + enum TimerCompleteOptions + { + CANCEL_SYS, + CANCEL_BY_USER, + TIMER_COMPLETE + }; + enum TimerCompleteOptions __timerRes; + }; + +#endif //_GL_TIMER_BASE_H_ diff --git a/inc/GlTimerScanDirListener.h b/inc/GlTimerScanDirListener.h new file mode 100644 index 0000000..dea8b6d --- /dev/null +++ b/inc/GlTimerScanDirListener.h @@ -0,0 +1,31 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlTimerScanDirListener.h + * @brief This is the header file for GlTimerScanDirListener class. + */ +#ifndef _GL_TIMER_SCANDIR_LISTENER_H_ +#define _GL_TIMER_SCANDIR_LISTENER_H_ + +class ITimerScanDirListener +{ +public: + virtual ~ITimerScanDirListener(void) {} + virtual void OnTimerScanDirComplete() = 0; +}; + +#endif //_GL_TIMER_SCANDIR_LISTENER_H_ diff --git a/inc/GlTypes.h b/inc/GlTypes.h new file mode 100644 index 0000000..8a52c55 --- /dev/null +++ b/inc/GlTypes.h @@ -0,0 +1,360 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlTypes.h + * @brief This is the header file for Types definition. + */ + +#ifndef _GL_TYPES_H_ +#define _GL_TYPES_H_ + +#include + +enum ACTION_ID_ +{ + IDA_BUTTON_CHECKED = 101, + IDA_BUTTON_CREATE_NAME_CANCEL = 102, + IDA_BUTTON_CREATE_NAME_SAVE = 103, + IDA_BUTTON_MOVE_TO_SELECTION = 104, + IDA_BUTTON_UNCHECKED = 105, + IDA_BUTTON_SAVE = 106, + IDA_ALBUM_LIST_SELECT_ALL = 201, + IDA_FILE_LIST_SELECT_ALL = 202, + IDA_CONTEXT_MENU_MESSAGE = 301, + IDA_CONTEXT_MENU_EMAIL = 302, + IDA_CONTEXT_MENU_MORE_ADD_TAG = 303, + IDA_CONTEXT_MENU_MORE_EDIT = 304, + IDA_CONTEXT_MENU_MORE_MOVE = 305, + IDA_CONTEXT_MENU_MORE_SLIDE_SHOW = 306, + IDA_CONTEXT_MENU_SHARE_MESSAGE = 307, + IDA_CONTEXT_MENU_SHARE_EMAIL = 308, + IDA_CONTEXT_MENU_MORE_COPY = 309, + IDA_CONTEXT_MENU_ROTATE_LEFT = 310, + IDA_CONTEXT_MENU_ROTATE_RIGHT = 311, + IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START = 401, + IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM = 600, + IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START = 601, + IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM = 800, + IDA_DELETE_POPUP_CANCEL = 801, + IDA_DELETE_POPUP_DEL = 802, + IDA_EDITE_FOLDER = 901, + IDA_FOOTER_CAMERA = 902, + IDA_FOOTER_CANCEL = 903, + IDA_FOOTER_CONFIRM = 904, + IDA_FOOTER_DELETE = 905, + IDA_FOOTER_EDIT = 906, + IDA_FOOTER_MORE = 907, + IDA_FOOTER_SHARE = 908, + IDA_FOOTER_SLIDESHOW = 909, + IDA_FORMAT_DURATION = 1001, + IDA_FORMAT_THUMBNAIL = 1002, + IDA_FORMAT_TITLE = 1003, + IDA_SELECTALL_CHECKED = 1101, + IDA_SELECTALL_UNCHECKED = 1102, + IDA_PROGRESSBAR_CANCEL = 1201 +}; + +enum AppControlMode +{ + APPCONTROL_MODE_MAIN, + APPCONTROL_MODE_PICK, + APPCONTROL_MODE_SETTING, + APPCONTROL_MODE_UNKNOWN +}; + +enum AppControlParamType +{ + APPCONTROL_PARAM_TYPE_MEDIA_TYPE, + APPCONTROL_PARAM_TYPE_SELECTION_MODE, + APPCONTROL_PARAM_TYPE_UNKNOWN +}; + +enum AppControlMediaType +{ + APPCONTROL_MEDIA_TYPE_IMAGE, + APPCONTROL_MEDIA_TYPE_VIDEO, + APPCONTROL_MEDIA_TYPE_UNKNOWN +}; + +enum AppControlSelectionMode +{ + APPCONTROL_SELECTION_MODE_SINGLE, + APPCONTROL_SELECTION_MODE_MULTIPLE, + APPCONTROL_SELECTION_MODE_UNKNOWN +}; + +enum AlbumInfoType +{ + ALBUM_INFO_TYPE_BASE, + ALBUM_INFO_TYPE_FOLDER, + ALBUM_INFO_TYPE_FILE +}; + +enum AlbumNameEditorMode +{ + ALBUM_NAME_EDITOR_MODE_RENAME, + ALBUM_NAME_EDITOR_MODE_CREATE, + ALBUM_NAME_EDITOR_MODE_NONE +}; + +enum FileActionMode +{ + FILE_ACTION_DELETE, + FILE_ACTION_MOVE, + FILE_ACTION_COPY, + FILE_ACTION_RENAME, + FILE_ACTION_ROTATE +}; + +enum FileActionCancelRes +{ + CANCEL_USER, + CANCEL_SYS_ERROR +}; + +enum FileActionCompleteRes +{ + COMPLETE_SUCCESS, + COMPLETE_SYS_PARTIAL, + COMPLETE_SYS_FAILURE +}; + +enum AlbumAction +{ + ALBUM_CREATE, + ALBUM_RENAME +}; + +enum RotateMode +{ + ROTATE_MODE_RIGHT = 0, + ROTATE_MODE_LEFT +}; + +extern const wchar_t* IDL_FORM_ALBUM_LIST; +extern const wchar_t* IDL_FORM_ALBUM_LIST_EDITOR; +extern const wchar_t* IDL_FORM_FILE_LIST; +extern const wchar_t* IDL_FORM_SETTING_MAIN; +extern const wchar_t* IDL_FORM_SETTING_INTERVAL; +extern const wchar_t* IDL_FORM_SETTING_TRANSITION; +extern const wchar_t* IDL_FORM_IMAGE_CROP; + +extern const wchar_t* IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED; + +extern const wchar_t* IDC_FORM_ALBUM_LIST; +extern const wchar_t* IDC_FORM_ALBUM_LIST_EDITOR; +extern const wchar_t* IDC_FORM_ALBUM_NAME_EDITOR; +extern const wchar_t* IDC_FORM_FILE_LIST; +extern const wchar_t* IDC_FORM_FILE_LIST_EDITOR; +extern const wchar_t* IDC_FORM_SETTING_MAIN; +extern const wchar_t* IDC_FORM_SETTING_INTERVAL; +extern const wchar_t* IDC_FORM_SETTING_TRANSITION; +extern const wchar_t* IDC_FORM_IMAGE_CROP; + +extern const wchar_t* IDC_PANEL_BLANK; +extern const wchar_t* IDC_PANEL_ALL_LIST; +extern const wchar_t* IDC_PANEL_IMAGE_LIST; +extern const wchar_t* IDC_PANEL_VIDEO_LIST; +extern const wchar_t* IDC_PANEL_ALL_LIST_EDITOR; +extern const wchar_t* IDC_PANEL_IMAGE_LIST_EDITOR; +extern const wchar_t* IDC_PANEL_VIDEO_LIST_EDITOR; +extern const wchar_t* IDC_PANEL_ALL_LIST_SELECTION; + +extern const wchar_t* IDSCN_ALBUM_LIST; +extern const wchar_t* IDSCN_ALBUM_LIST_EDITOR; +extern const wchar_t* IDSCN_ALBUM_NAME_EDITOR; +extern const wchar_t* IDSCN_ALL_LIST; +extern const wchar_t* IDSCN_IMAGE_LIST; +extern const wchar_t* IDSCN_VIDEO_LIST; +extern const wchar_t* IDSCN_ALL_LIST_EDITOR; +extern const wchar_t* IDSCN_IMAGE_LIST_EDITOR; +extern const wchar_t* IDSCN_VIDEO_LIST_EDITOR; +extern const wchar_t* IDSCN_ALL_LIST_SELECTION; +extern const wchar_t* IDSCN_SETTING_MAIN; +extern const wchar_t* IDSCN_SETTING_INTERVAL; +extern const wchar_t* IDSCN_SETTING_TRANSITION; +extern const wchar_t* IDSCN_IMAGE_CROP; + +extern const wchar_t* APPCONTROL_PROVIDER_ID_CAMERA; +extern const wchar_t* APPCONTROL_PROVIDER_ID_MESSAGE; +extern const wchar_t* APPCONTROL_PROVIDER_ID_EMAIL; +extern const wchar_t* APPCONTROL_PROVIDER_ID_IMAGE; + +extern const wchar_t* APPCONTROL_OPERATION_ID_PICK; +extern const wchar_t* APPCONTROL_OPERATION_ID_VIEW; +extern const wchar_t* APPCONTROL_OPERATION_ID_CAPTURE; +extern const wchar_t* APPCONTROL_OPERATION_ID_CREATE_CONTENT; +extern const wchar_t* APPCONTROL_OPERATION_ID_COMPOSE; +extern const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE; +extern const wchar_t* APPCONTROL_OPERATION_ID_MAIN; + +extern const wchar_t* APPCONTROL_KEY_TYPE; +extern const wchar_t* APPCONTROL_KEY_PATH; +extern const wchar_t* APPCONTROL_KEY_INDEX; +extern const wchar_t* APPCONTROL_KEY_SELECTION_MODE; +extern const wchar_t* APPCONTROL_KEY_DATA_SELECTED; +extern const wchar_t* APPCONTROL_KEY_MESSAGE_TYPE; +extern const wchar_t* APPCONTROL_KEY_CAMERA_ALLOW_SWITCH; +extern const wchar_t* APPCONTROL_KEY_IMAGEVIEWER_MODE; + +extern const wchar_t* APPCONTROL_URI_MMS_TO; +extern const wchar_t* APPCONTROL_URI_MAIL_TO; + +extern const wchar_t* APPCONTROL_MIME_IMAGE_JPG; +extern const wchar_t* APPCONTROL_MIME_IMAGE_ALL; + +extern const wchar_t* APPCONTROL_DATA_IMAGE; +extern const wchar_t* APPCONTROL_DATA_VIDEO; +extern const wchar_t* APPCONTROL_DATA_SINGLE; +extern const wchar_t* APPCONTROL_DATA_MULTIPLE; +extern const wchar_t* APPCONTROL_DATA_SLIDE_SHOW; +extern const wchar_t* APPCONTROL_DATA_SELECTION_MODE; +extern const wchar_t* APPCONTROL_DATA_TRUE; +extern const wchar_t* APPCONTROL_DATA_MMS; +extern const wchar_t* APPCONTROL_DATA_CROP_TYPE_AUTO; +extern const wchar_t* APPCONTROL_DATA_CROP_TYPE_FIT_TO_SCREEN; + +extern const wchar_t* APPCONTROL_RESULT_KEY_LEGACY_RESULT; + +extern const wchar_t* SETTING_KEY_LANGUAGE; +extern const wchar_t* SETTING_KEY_FONT_SIZE; + +extern const Tizen::Graphics::Dimension DIMENSION_DEFAULT_THUMBNAIL; +extern const int FOLDER_BITMAP_MAX; + +extern const wchar_t* EMPTY_SPACE; +extern const wchar_t* SINGLE_SPACE; + +extern const wchar_t* DIRECTORY_SEPARATOR; +extern const wchar_t* FILE_EXT_SEPARATOR; +extern const wchar_t* MULTI_ITEM_SEPARATOR; + +extern const wchar_t* CONTENT_EXT_PNG; +extern const wchar_t* CONTENT_EXT_BMP; +extern const wchar_t* CONTENT_EXT_JPG; +extern const wchar_t* CONTENT_EXT_GIF; +extern const wchar_t* CONTENT_EXT_TIF; +extern const wchar_t* CONTENT_EXT_MP4; +extern const wchar_t* CONTENT_EXT_3GP; +extern const wchar_t* CONTENT_EXT_AVI; +extern const wchar_t* CONTENT_EXT_RM; +extern const wchar_t* CONTENT_EXT_WMV; +extern const wchar_t* CONTENT_EXT_ASF; + +extern const wchar_t* SECTION_NAME_GALLERY; +extern const wchar_t* SECTION_NAME_IMAGE_VIEWER; +extern const wchar_t* SECTION_NAME_VIDEO_PLAYER; +extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL; +extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT; +extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_MUSIC; +extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE; +extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE; + +extern const wchar_t* ALL_ALBUMS_REAL_NAME; + +extern const wchar_t* FONT_SIZE_SETTING_INFO_KEY; + +extern const wchar_t* IDB_BUTTON_CIRCLE_BACKGROUND; +extern const wchar_t* IDB_BUTTON_RENAME; +extern const wchar_t* IDB_CONTROLBAR_CAMERA; +extern const wchar_t* IDB_CONTROLBAR_DELETE; +extern const wchar_t* IDB_CONTROLBAR_DELETE_DIM; +extern const wchar_t* IDB_CONTROLBAR_MORE; +extern const wchar_t* IDB_CONTROLBAR_MORE_DISABLED; +extern const wchar_t* IDB_CONTROLBAR_MORE_PRESSED; +extern const wchar_t* IDB_CONTROLBAR_SHARE; +extern const wchar_t* IDB_CONTROLBAR_SHARE_DIM; +extern const wchar_t* IDB_LISTVIEW_EMPTY; +extern const wchar_t* IDB_MAIN_FOLDER_BACKGROUND; +extern const wchar_t* IDB_VIDEOTHUMBNAIL_BG; +extern const wchar_t* IDB_VIDEOTHUMBNAIL_BOOKMARK; +extern const wchar_t* IDB_VIDEOTHUMBNAIL_FAVORITE; +extern const wchar_t* IDB_VIDEOTHUMBNAIL_PLAY; +extern const wchar_t* IDB_BUTTON_MOVE_SELECTION; +extern const wchar_t* IDB_NO_CONTENTS_BROKEN; +extern const wchar_t* IDB_LIST_EXPAND_CLOSED; +extern const wchar_t* IDB_LIST_EXPAND_CLOSED_PRESS; +extern const wchar_t* IDB_LIST_EXPAND_OPENED; +extern const wchar_t* IDB_LIST_EXPAND_OPENED_PRESS; +extern const wchar_t* IDB_ICON_SELECT_ALL; +extern const wchar_t* IDB_ICON_SELECT_ALL_PRESS; + +extern const wchar_t* DEVICE_STORAGE_CARD_MOUNTED; +extern const wchar_t* DEVICE_STORAGE_CARD_UNMOUNTED; +extern const wchar_t* IDB_ALBUM_EDIT_RENAME_BG; +extern const wchar_t* IDB_ALBUM_EDIT_RENAME; +extern const wchar_t* IDB_ALBUM_ICON_FOLDER; +extern const wchar_t* IDB_ALBUM_ICON_DOWNLOAD; +extern const wchar_t* IDB_ALBUM_ICON_CAMERA; + +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS1; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS2; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS3; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS4; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS5; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS6; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS7; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS8; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS9; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS10; + +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS11; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS12; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS13; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS14; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS15; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS16; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS17; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS18; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS19; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS20; + +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS21; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS22; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS23; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS24; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS25; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS26; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS27; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS28; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS29; +extern const wchar_t* IDB_ALBUM_RENAME_PROGRESS30; + +extern const wchar_t* IDB_IMAGE_CONTEXT_EMAIL_ICON; +extern const wchar_t* IDB_IMAGE_CONTEXT_MESSAGE_ICON; + +extern const wchar_t* IDB_IMAGE_CROP_RECTANGLE; + +static const unsigned int CUSTOM_COLOR_GREY = Tizen::Graphics::Color32<124,124,124>::Value; +static const unsigned int CUSTOM_COLOR_TRANSPARENT = Tizen::Graphics::Color32<0,0,0>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_LISTVIEW = Tizen::Graphics::Color32<236,240,242>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED = Tizen::Graphics::Color32<42, 137, 194>::Value; +static const unsigned int CUSTOM_COLOR_LISTVIEW_TEXT = Tizen::Graphics::Color32<249,249,249>::Value; +static const unsigned int CUSTOM_COLOR_BROWN = Tizen::Graphics::Color32<32, 32, 32>::Value; +static const unsigned int CUSTOM_COLOR_INFO_LABEL = Tizen::Graphics::Color32<68, 68, 68>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_PREVIEW_PANEL = Tizen::Graphics::Color32<81,81,81>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_PREVIEW_PANEL_INACTIVE = Tizen::Graphics::Color32<0,0,0,20>::Value; +static const unsigned int CUSTOM_COLOR_PREVIEW_PANEL_PRESSED_RECTANGLE = Tizen::Graphics::Color32<7,180,211>::Value; +static const unsigned int CUSTOM_COLOR_LISTVIEW_TEXT2 = Tizen::Graphics::Color32<70,70,70>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_TEXT = Tizen::Graphics::Color32<128, 128, 128>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND = Tizen::Graphics::Color32<248, 246, 239>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND = Tizen::Graphics::Color32<220, 218, 211>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_GROUPTITLE = Tizen::Graphics::Color32<59, 115, 182>::Value; +static const int ALBUM_FIRST_ELEMENT = 0; +static const int ALBUM_SECOND_ELEMENT = 1; + +#endif /* _GL_TYPES_H_ */ diff --git a/inc/GlVideoListEditorPanel.h b/inc/GlVideoListEditorPanel.h new file mode 100644 index 0000000..c527637 --- /dev/null +++ b/inc/GlVideoListEditorPanel.h @@ -0,0 +1,93 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlVideoListEditorPanel.h + * @brief This is the header file for VideoListEditorPanel class. + */ + +#ifndef _GL_VIDEO_LIST_EDITOR_PANEL_H_ +#define _GL_VIDEO_LIST_EDITOR_PANEL_H_ + +#include +#include "GlAlbumEventListener.h" +#include "GlFileOpInvalidateListener.h" + +class FileListEditorForm; +class FileUpdateTimer; + +class VideoListEditorPanel + : public IAlbumEventListener + , public IFileOpInvalidateListener + , public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + VideoListEditorPanel(void); + virtual ~VideoListEditorPanel(void); + + result Initialize(void); + + void OnSelectAllPressed(void); + void OnRequestAppExitWithMultipleSelectionAppControlResult(void); + int GetItemCheckedCount(void) const; + void SetButtonState(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, + Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, + Tizen::Ui::Controls::SweepDirection direction){}; + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, + int elementId, Tizen::Ui::Controls::ListContextItemStatus status){}; + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + + virtual void OnFileOpInvalidate(enum FileActionMode actionId); + virtual void OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes){}; + virtual void OnScanDirStart(){} + virtual void OnScanDirComplete(){} + + void ChangeOrientation(void); + +private: + Tizen::Base::Collection::IList* GetItemCheckedIndexListN(void) const; + +private: + Tizen::Ui::Controls::ListView* __pContentIconListView; + Tizen::Ui::Controls::CheckButton* __pCheckButton; + Tizen::Ui::Controls::Label* __pLabelSelectCnt; + int __itemCount; + FileListPresentationModel* __pPresentationModel; + FileUpdateTimer* __pFileDelete; + FileListEditorForm* __pFileListEditorForm; +}; + +#endif /* _GL_VIDEO_LIST_EDITOR_PANEL_H_ */ diff --git a/inc/GlVideoListPanel.h b/inc/GlVideoListPanel.h new file mode 100644 index 0000000..9bd0712 --- /dev/null +++ b/inc/GlVideoListPanel.h @@ -0,0 +1,69 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlVideoListPanel.h + * @brief This is the header file for VideoListPanel class. + */ + +#ifndef _GL_VIDEO_LIST_PANEL_H_ +#define _GL_VIDEO_LIST_PANEL_H_ + +#include "GlAlbumEventListener.h" + +class FileListPresentationModel; + +class VideoListPanel + : public IAlbumEventListener + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::Panel + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + VideoListPanel(void); + virtual ~VideoListPanel(void); + result Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, + Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, + Tizen::Ui::Controls::SweepDirection direction){}; + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, + int elementId, Tizen::Ui::Controls::ListContextItemStatus status){}; + + virtual int GetItemCount(void); + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId){}; + + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); + virtual void OnThumbnailDecoded(const int index); + +private: + int __itemCount; + Tizen::Ui::Controls::ListView* __pContentListView; + FileListPresentationModel* __pPresentationModel; +}; + +#endif /* _GL_VIDEO_LIST_PANEL_H_ */ diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..c20678f --- /dev/null +++ b/manifest.xml @@ -0,0 +1,92 @@ + + + ijudt7w61q + 1.0.0 + C++App + + true + true + + + 2.2 + + http://tizen.org/privilege/content.read + http://tizen.org/privilege/application.launch + http://tizen.org/privilege/content.write + + + + + + استوديو + Qalereya + Галерия + Galeria + Galerie + Galleri + Galerie + Συλλογή + Gallery + Gallery + Gallery + Galerii + Galeria + گالری + Galleria + Galerie + Galerie + Gailearaí + Galería + गैलरी + Album + Galéria + Պատկերասրահ + Gallerí + Galleria + ギャラリー + გალერეა + Галерея + 갤러리 + Galerija + Galerija + Галерија + Galerij + Galleri + Galeria + Galeria + Galeria + Galerie + Галерея + Galéria + Galerija + Galería + Galería + Galerija + Galleri + แกลเลอรี่ + Galeri + Галерея + گیلری + Galereya + 图库 + 媒體瀏覽器 + 画廊 + 媒體瀏覽器 + + + mainmenu.png + + + + image/* + video/* + http://tizen.org/appcontrol/operation/pick + + + http://tizen.org/appcontrol/operation/Configure + + + + + + diff --git a/packaging/apps.Gallery.spec b/packaging/apps.Gallery.spec new file mode 100644 index 0000000..828934d --- /dev/null +++ b/packaging/apps.Gallery.spec @@ -0,0 +1,79 @@ +Name: apps.Gallery +Summary: Gallery application +Version: 1.0.1 +Release: 1 +Group: TO_BE/FILLED_IN +License: Flora-1.1 +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(osp-appfw) +BuildRequires: pkgconfig(osp-content) +BuildRequires: pkgconfig(osp-image) +BuildRequires: pkgconfig(osp-image-core) +BuildRequires: pkgconfig(osp-locations) +BuildRequires: pkgconfig(osp-media) +BuildRequires: pkgconfig(osp-net) +BuildRequires: pkgconfig(osp-uifw) +BuildRequires: osp-appfw-internal-devel +BuildRequires: osp-image-internal-devel +BuildRequires: osp-media-internal-devel +BuildRequires: osp-net-internal-devel +BuildRequires: osp-uifw-internal-devel +BuildRequires: hash-signer + +Requires: osp-installer + +%description +Verification application: Gallery + +%prep +%setup -q + +%build +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%ifarch %{ix86} +%if 0%{?simulator} +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%else +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ " cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%endif +%else +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%endif + +# Call make instruction with smp support +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}/usr/share/license +cp LICENSE.Flora %{buildroot}/usr/share/license/%{name} +%make_install +###### for package signing step ###### +PKG_ID=ijudt7w61q +%define tizen_sign 1 +%define tizen_sign_base /usr/apps/${PKG_ID} +%define tizen_sign_level platform +%define tizen_author_sign 1 +%define tizen_dist_sign 1 + + +%post +/sbin/ldconfig +PKG_ID=ijudt7w61q +echo "/usr/etc/package-manager/backend/tpk -i /usr/apps/"${PKG_ID} +/usr/etc/package-manager/backend/tpk -i /usr/apps/${PKG_ID} +cp -f /usr/lib/osp/osp-ui-app-loader /usr/apps/${PKG_ID}/bin/Gallery + +%postun +/sbin/ldconfig +PKG_ID=ijudt7w61q +echo "/usr/etc/package-manager/backend/tpk -u "${PKG_ID} +/usr/etc/package-manager/backend/tpk -u ${PKG_ID} + +%files +%defattr(-,root,root,-) +/usr/apps/* +/usr/share/license/%{name} + + diff --git a/res/ara-AE.xml b/res/ara-AE.xml new file mode 100644 index 0000000..abe581e --- /dev/null +++ b/res/ara-AE.xml @@ -0,0 +1,99 @@ + + + + تم الوصول إلى أقصى عدد من الحروف + عرض الصور + تم تجاوز الحد الأقصى لعدد الملفات + إعدادات عرض الشرائح + اختيار الكل + مسح؟ + تعديل + رسالة + ملفات محملة + اسم الألبوم مستخدم بالفعل + حفظ + 20 ثانية + التفعيل + تدوير لليسار + ثانيتان + الرسائل + تمت + غير قادر على تغيير الاسم. جاري استخدام الملف + بريد إلكتروني + أحرف غير صالحة + تم النقل + إلغاء + محدد + مسح + الترجمات المصاحبة + إلغاء + تم بلوغ أقصى عدد من الأحرف (%d) + تم بلوغ أقصى عدد من الأحرف (%d) + عرض شرائح + شرائح + بدء عرض الشرائح + %s موجود بالفعل + جاري التحميل ... + الألبومات + يتعذر إعادة التسمية. اسم الألبوم مستخدم بالفعل + فشلت العملية + جاري الحفظ... + تأثير الانتقال + الموسيقى + تم تحديد %d عناصر + إنشاء مجلد؟ + فشل المسح + تم تحديد عنصر واحد + فيديو + زوم + نسخ + قوس قزح + فاصل عرض الشرائح + مشغل فيديو + عرض الشرائح + ثوان + تدوير لليسار + الصفحة + جاري النسخ... + 10 ثوان + جاري المعالجة... + استوديو + لا يوجد اسم + الصور + التلاشي التدريجي + تعديل + 5 ثوان + لم يتم اختيار عناصر + تم المسح + حذف؟ + موجود بالفعل. هل تريد الاستبدال؟ + جاري المسح... + تمت + 3 ثوان + ملفات الكاميرا + تدوير لليمين + تكرار + تم الحفظ + إذابة + الخلط + جاري النقل... + فشل النقل + الفيديو + نوع ملفات غير مدعم + تغيير الاسم + تمت + تحديد الكل + كافة الألبومات + تغييرالاسم + نقل + لا يمكن المسح + تدوير لليمين + الفترة + موجود مسبقا + إنشاء ألبوم + لا توجد عناصر + إخفاء + فشل الحفظ + diff --git a/res/aze-AZ.xml b/res/aze-AZ.xml new file mode 100644 index 0000000..01c2157 --- /dev/null +++ b/res/aze-AZ.xml @@ -0,0 +1,99 @@ + + + + Simvol sayı maksimuma çatıb + Slayd göstərmə + Faylların sayı maksimumu keçib + Slaydşou parametrləri + Hamısını seç + Silinsin? + Redaktə et + Mesaj + Yükləmələr + Albom adı artıq ist.edilir + Yaddaşa yaz + 20 saniyə + Aktivləşdirmə + Sola döndər + 2 saniyə + Mesajlar + Bitdi + Yenidən adlandırmaq mümkün deyildir + Elektron poçtlar + Simvollar səhvdir + Göndərildi + Ləğv et + Seçilmişi + Sil + Yarımbaşlıqlar + Ləğv et + Simvolların sayı maksimuma (%d) çatıb + Simvolların sayı maksimuma (%d) çatıb + Slyd nmyşi + Slayd + Slayd nümayişini dayandır + %s hazırda mövcuddur + Yüklənir... + Albomlar + Yenidən adlandırmaq mümkün deyil. Albom adı artıq istifadə edilir + Əməliyyat alınmadı + Yaddaşa yazılma + Keçid effekti + Musiqi + %d element seçildi + Qovluq yaradılsın? + Silmək mümkün olmadı + 1 element seçildi + Video + Yaxınlaşdırma/uzaqlaşdırma + Köçür + Diafraqma + Slaydşou intervalı + Video pleyer + Slaydşou + Saniyələr + Sola döndər + Səhifə + Köçürülmə... + 10 saniyə + Emal edilir... + Qalereya + Ad yoxdur + Təsvirlər + Tutqunlaşdır + Redaktə et + 5 saniyə + Heç bir element seçilməyib + Silindi + Silinsin? + Artıq mövcuddur. Üzərindən yazılsın? + Silinmə + Yerinə yetirildi + 3 saniyə + Kamera çarxı + Sağa döndər + Təkrar et + Yaddaşa yazıldı + Seç + Təsadüfi sıralama + Göndərilmə... + Keçmə alınmadı + Video + Dəstəklənməyən fayl növü + Adını dəyişdir + Tamamlandı + Hamsnı seç + Bütün albomlar + Adı dəyişdir + Göndər + Silmək mümkün deyil + Sağa döndər + İnterval + Artıq var + Albom yaradın + Elementlər yoxdur + Sayrışmaq + Yaddaşa yazmaq mümkün olmadı + diff --git a/res/bul-BG.xml b/res/bul-BG.xml new file mode 100644 index 0000000..9c39051 --- /dev/null +++ b/res/bul-BG.xml @@ -0,0 +1,99 @@ + + + + Достигнат максимален брой знаци + Слайдшоу + Надхвърлен е максималният брой файлове + Настройки на слайдшоу + Избери всички + Изтриване? + Редактиране + Съобщение + Изтеглени файлове + Име на албума вече се изп. + Запис + 20 секунди + Активиране + Завъртане наляво + 2 секунди + Съобщения + Готово + Не може да се преименува + Email + Невалидни знаци + Преместено + Отказ + Избрани + Изтриване + Субтитри + Отказ + Достигнат е максималният брой знаци (%d) + Достигнат е максималният брой знаци (%d) + Слайдшоу + Слайд + Започване на слайдшоу + %s вече съществува + Зареждане + Албуми + Не може да се преименува. Името на албума вече се използва + Операцията е неуспешна + Запазване + Ефект на преход + Музика + Избрани са %d елемента + Създаване на папка? + Неуспешно изтриване + Избран е 1 елемент + Видеоклип + Зум + Копиране + Ирис + Интервал на слайдшоуто + Видео плейър + Слайдшоу + секунди + Завъртане наляво + Страница + Копиране... + 10 секунди + Обработване... + Галерия + Без име + Изображения + Избледняване + Редактиране + 5 секунди + Няма избрани елементи + Изтрито + Премахване? + Вече съществува. Презапис? + Изтриване... + Готово + 3 секунди + Материал камера + Завъртане надясно + Повтаряне + Записан + Размиване + Разбъркано + Преместване + Неуспешно преместване + Видеоклипове + Неподдържан вид файл + Преименуване + Завършено + Изб.всички + Всички албуми + Промяна на име + Премести + Невъзможно изтриване + Завъртане надясно + Интервал + Вече съществува + Създаване на албум + Няма елементи + Щори + Запазване неуспешно + diff --git a/res/cat-ES.xml b/res/cat-ES.xml new file mode 100644 index 0000000..0b69fd1 --- /dev/null +++ b/res/cat-ES.xml @@ -0,0 +1,99 @@ + + + + S'ha assolit el nombre màxim de caràcters + Presentació de diapositives + S'ha excedit el nombre màxim de fitxers + Ajustaments de la presentació de diapositives + Seleccioni-ho tot + Esborrar? + Editar + Missatge + Descàrregues + Nom d'àlbum ja en ús + Desar + 20 segons + Activació + Girar cap a l'esquerra + 2 segons + Missatges + Finalit. + No es pot canviar nom + Correu electrònic + Caràcters no vàlids + Mogut + Cancel·lar + Seleccionat + Esborrar + Subtítols + Cancel·lar + S'ha assolit el nombre màxim de caràcters (%d) + S'ha assolit el nombre màxim de caràcters (%d) + Diaposit + Diapositiva + Iniciar presentació de diapositives + %s ja existeix + Carregant... + Àlbums + No es pot canviar el nom. El nom d'àlbum ja està en ús + Operació fallida + Desant... + Efecte de transició + Música + %d elements seleccionats + Crear carpeta? + Error en esborrar + 1 element seleccionat + Vídeo + Zoom + Copiar + Iris + Interval de la presentació de diapositives + Reproductor de vídeo + Presentació de diapositives + segons + Girar cap a l'esquerra + Pàgina + Copiant... + 10 segons + Processant... + Galeria + Sense nom + Imatges + Perdre intensitat + Editar + 5 segons + No s'ha seleccionat cap element + Esborrat + Eliminar? + Ja existeix. Sobreescriure? + Esborrant... + Finalitzat + 3 segons + Rodet càmera + Girar cap a la dreta + Repetir + Desat + Dissoldre + Ordre aleatori + Movent... + Error en moure + Vídeos + Tipus de fitxer no admès + Canviar nom + Completat + Selec tot + Tots els àlbums + Canviar nom + Moure + No es pot esborrar + Girar cap a la dreta + Interval + Ja existeix + Crear àlbum + No hi ha elements + Persiana + Error en desar + diff --git a/res/ces-CZ.xml b/res/ces-CZ.xml new file mode 100644 index 0000000..41cbff4 --- /dev/null +++ b/res/ces-CZ.xml @@ -0,0 +1,99 @@ + + + + Bylo dosaženo maximálního počtu znaků + Prezentace + Byl překročen maximální počet souborů + Nastavení prezentace + Vybrat vše + Odstranit? + Upravit + Zpráva + Stažené položky + Název alba je již použit + Uložit + 20 sekund + Aktivace + Otočit doleva + 2 sekund + Zprávy + Hotovo + Nelze přejmenovat + E-mail + Neplatné znaky + Přesunuto + Zrušit + Vybráno + Odstranit + Titulky + Zrušit + Bylo dosaženo maximálního počtu znaků (%d) + Bylo dosaženo maximálního počtu znaků (%d) + Prezent. + Sklouznutí + Spustit prezentaci + %s již existuje + Nahrávám... + Alba + Nelze přejmenovat. Název alba je již použit + Otevření se nezdařilo + Ukládání... + Přechodový efekt + Hudba + Vybrané položky: %d + Chcete vytvořit složku? + Odstranění se nezdařilo + Byla vybrána 1 položka + Video + Přiblížení + Kopírovat + Duha + Interval prezentace + Videopřeh. + Prezentace + sekundy + Otočit doleva + Stránka + Kopírování... + 10 sekund + Probíhá zpracování... + Galerie + Žádný název + Obrázky + Zvolna mizet + Upravit + 5 sekund + Nejsou vybrány žádné položky + Odstraněno + Odstranit? + Již existuje. Přepsat? + Odstraňování... + Hotovo + 3 sekundy + Soubory z fot. + Otočit doprava + Opakovat + Uloženo + Rozplynout + Náhodně + Probíhá přesouvání + Přesunutí se nezdařilo + Videa + Nepodporovaný typ souboru + Přejmenovat + Dokončeno + Vybrat vše + Všechna alba + Změnit název + Přesunout + Nelze odstranit + Otočit doprava + Interval + Již existuje + Vytvořit album + Žádné položky + Roleta + Uložení se nezdařilo + diff --git a/res/dan-DK.xml b/res/dan-DK.xml new file mode 100644 index 0000000..d87193a --- /dev/null +++ b/res/dan-DK.xml @@ -0,0 +1,99 @@ + + + + Det maksimale antal tegn er nået + Diasshow + Det maksimale antal filer er overskredet + Indstillinger for diasshow + Vælg alle + Slet? + Redigér + Meddelelse + Downloads + Albumnavn allerede i brug + Gem + 20 sekunder + Aktivering + Rotér mod uret + 2 sekunder + Meddelelser + Udført + Kunne ikke omdøbe + E-mail + Ugyldige tegn + Flyttet + Annullér + Valgte + Slet + Undertekster + Annullér + Det maksimale antal tegn (%d) er nået + Det maksimale antal tegn (%d) er nået + Diasshow + Dias + Start diasshow + %s eksisterer allerede + Indlæser data ... + Albums + Kan ikke omdøbe. Albumnavn allerede i brug + Handlingen mislykkedes + Gemmer ... + Overgangseffekt + Musik + %d elementer valgt + Opret mappe? + Sletning mislykkedes + 1 element valgt + Videoklip + Zoom + Kopiér + Iris + Interval for diasshow + Videoafspiller + Diasshow + sekunder + Rotér mod uret + Side + Kopierer ... + 10 sekunder + Behandler ... + Galleri + Intet navn + Billeder + Tone ud + Redigér + 5 sekunder + Ingen valgte elementer + Slettet + Fjern? + Findes allerede. Vil du overskrive? + Sletter ... + Udført + 3 sekunder + Kamerarolle + Rotér med uret + Gentag + Gemt + Opløs + Bland + Flytter ... + Flytning mislykkedes + Videoklip + Filtypen understøttes ikke + Omdøb + Udført + Vælg alle + Alle album + Skift navn + Flyt + Kunne ikke slette + Rotér med uret + Interval + Findes allerede + Opret album + Ingen elementer + Afblænd + Kunne ikke gemme + diff --git a/res/deu-DE.xml b/res/deu-DE.xml new file mode 100644 index 0000000..0538122 --- /dev/null +++ b/res/deu-DE.xml @@ -0,0 +1,99 @@ + + + + Maximal zulässige Zeichenanzahl erreicht. + Diashow + Maximale Anzahl an Dateien überschritten. + Diashoweinstellungen + Alle auswählen + Löschen? + Bearbeiten + Nachricht + Downloads + Albumn. wird bereits verw. + Speichern + 20 Sekunden + Aktivierung + Nach links drehen + 2 Sekunden + Nachrichten + OK + Umbenennen nicht möglich + E-Mail + Ungültige Zeichen + Verschoben + Abbrechen + Ausgewählt + Löschen + Untertitel + Abbrechen + Maximale Anzahl an Zeichen (%d) erreicht. + Maximale Anzahl an Zeichen (%d) erreicht. + Diashow + Gleiten + Diashow starten + %s ist bereits vorhanden + Lädt... + Alben + Umbenennen nicht möglich. Albumname wird bereits verwendet + Vorgang fehlgeschlagen + Speichern... + Übergangseffekt + Musik + %d Elemente ausgewählt + Ordner erstellen? + Löschen fehlgeschlagen + 1 Element ausgewählt + Video + Zoom + Kopieren + Iris + Diashowintervall + Video-Player + Diashow + Sekunden + Nach links drehen + Seite + Wird kopiert... + 10 Sekunden + Verarbeitung läuft ... + Galerie + Kein Name + Eigene Bilder + Ausblenden + Bearbeiten + 5 Sekunden + Keine Elemente ausgewählt + Gelöscht + Entfernen? + Bereits vorhanden. Überschreiben? + Löschen... + OK + 3 Sekunden + Filmrolle + Nach rechts drehen + Wiederholen + Gespeichert + Auflösen + Zufallswiedergabe + Verschiebevorgang aktiv... + Verschieben fehlgeschlagen + Videos + Dateityp nicht unterstützt + Umbenennen + Abgeschlossen + Alle ausw. + Alle Alben + Name ändern + Verschieben + Kann nicht gelöscht werden + Nach rechts drehen + Intervall + Bereits vorhanden + Album erstellen + Keine Elemente + Blenden + Speichern fehlgeschlagen + diff --git a/res/ell-GR.xml b/res/ell-GR.xml new file mode 100644 index 0000000..b687012 --- /dev/null +++ b/res/ell-GR.xml @@ -0,0 +1,99 @@ + + + + Ο μέγιστος αριθμός χαρακτήρων συμπληρώθηκε + Παρουσίαση + Έγινε υπέρβαση του μέγιστου αριθμού αρχείων + Ρυθμίσεις παρουσίασης + Επιλογή όλων + Διαγραφή; + Επεξεργασία + Μήνυμα + Λήψεις + Το όνομα άλμπουμ χρησ. ήδη + Αποθήκευση + 20 δευτερόλεπτα + Ενεργοποίηση + Περιστροφή προς τα αριστερά + 2 δευτερόλεπτα + Μηνύματα + Ok + Δεν είναι δυνατή η μετονομασία + Email + Μη έγκυροι χαρακτήρες + Μετακινήθηκε + Ακύρωση + Επιλεγμένο + Διαγραφή + Υπότιτλοι + Ακύρωση + Συμπληρώθηκε ο μέγιστος αριθμός χαρακτήρων (%d) + Συμπληρώθηκε ο μέγιστος αριθμός χαρακτήρων (%d) + Παρ/σίαση + Διαφάνεια + Έναρξη παρουσίασης + Το αρχείο %s υπάρχει ήδη + Φόρτωση... + Άλμπουμ + Δεν είναι δυνατή η μετονομασία. To όνομα άλμπουμ χρησιμοποιείται ήδη + Λειτουργία απέτυχε + Aποθήκευση... + Εφέ μετάβασης + Μουσική + Επιλέχθηκαν %d στοιχεία + Δημιουργία φακέλου; + Αποτυχία διαγραφής + Επιλέχθηκε 1 στοιχείο + Προσθήκη βίντεο + Ζουμ + Αντιγραφή + Ίριδα + Διάστημα παρουσίασης + Αναπαραγωγή Βίντεο + Παρουσίαση + δευτ. + Περιστροφή προς τα αριστερά + Σελίδα + Αντιγραφή... + 10 δευτερόλεπτα + Επεξεργασία... + Συλλογή + Κανένα όνομα + Εικόνες + Σταδιακή εμφάνιση + Επεξεργασία + 5 δευτερόλεπτα + Κανένα επιλεγμένο στοιχείο + Διαγράφηκε + Αφαίρεση; + Υπάρχει ήδη. Αντικατάσταση; + Διαγραφή... + Τέλος + 3 δευτερόλεπτα + Λήψεις με κάμερα + Περιστροφή προς τα δεξιά + Επανάληψη + Αποθηκεύτηκε + Αποσύνθεση + Τυχαία σειρά + Μετακίνηση... + Αποτυχία μετακίνησης + Βίντεο + Μη υποστηρ. τύπος αρχείου + Μετονομασία + Ολοκληρώθηκε + Επιλ. όλων + Όλα τα άλμπουμ + Αλλαγή ονόματος + Μετακίνηση + Δεν είναι δυνατή η διαγραφή + Περιστροφή προς τα δεξιά + Διάστημα + Υπάρχει ήδη + Δημιουργία άλμπουμ + Κανένα στοιχείο + Ρολό + Αποτυχία αποθήκευσης + diff --git a/res/eng-GB.xml b/res/eng-GB.xml new file mode 100644 index 0000000..c7a7e23 --- /dev/null +++ b/res/eng-GB.xml @@ -0,0 +1,99 @@ + + + + Maximum number of characters reached + Slide show + Maximum number of files exceeded + Slideshow settings + Select all + Delete? + Edit + Message + Downloads + Album name already in use + Save + 20 seconds + Activation + Rotate left + 2 seconds + Messages + Done + Unable to rename + Email + Invalid characters + Moved + Cancel + Selected + Delete + Subtitles + Cancel + Maximum number of characters (%d) reached + Maximum number of characters (%d) reached + Slide show + Slide + Start slideshow + %s already exists + Loading... + Albums + Unable to rename. Album name already in use. + Operation failed + Saving... + Transition effect + Music + %d items selected + Create folder? + Delete failed + 1 item selected + Video + Zoom + Copy + Iris + Slideshow interval + Video Player + Slideshow + seconds + Rotate left + Page + Copying... + 10 seconds + Processing... + Gallery + No name + Images + Fade + Edit + 5 seconds + No item selected + Deleted + Remove? + Already exists. Overwrite? + Deleting... + Done + 3 seconds + Camera roll + Rotate right + Repeat + Saved + Dissolve + Shuffle + Moving... + Moving failed + Videos + Unsupported file type + Rename + Completed + Select all + All albums + Change name + Move + Unable to delete + Rotate right + Interval + Already exists + Create album + No items + Blind + Saving failed + diff --git a/res/eng-PH.xml b/res/eng-PH.xml new file mode 100644 index 0000000..b2231b1 --- /dev/null +++ b/res/eng-PH.xml @@ -0,0 +1,99 @@ + + + + Maximum number of characters reached + Slide show + Maximum number of files exceeded + Slideshow settings + Select all + Delete? + Edit + Message + Downloads + Album name already in use + Save + 20 seconds + Activation + Rotate left + 2 seconds + Messages + Done + Unable to rename + Email + Invalid characters + Moved + Cancel + Selected + Delete + Subtitles + Cancel + Maximum number of characters (%d) reached + Maximum number of characters (%d) reached + Slide show + Slide + Start slideshow + %s already exists + Loading... + Albums + Unable to rename. Album name already in use + Operation failed + Saving... + Transition effect + Music + %d items selected + Create folder? + Delete failed + 1 item selected + Video + Zoom + Copy + Iris + Slideshow interval + Video Player + Slideshow + seconds + Rotate left + Page + Copying... + 10 seconds + Processing... + Gallery + No name + Images + Fade + Edit + 5 seconds + No items selected + Deleted + Remove? + Already exists. Overwrite? + Deleting... + Done + 3 seconds + Camera roll + Rotate right + Repeat + Saved + Dissolve + Shuffle + Moving... + Moving failed + Videos + Unsupported file type + Rename + Completed + Select all + All albums + Change name + Move + Unable to delete + Rotate right + Interval + Already exists + Create album + No items + Blind + Saving failed + diff --git a/res/eng-US.xml b/res/eng-US.xml new file mode 100644 index 0000000..f146f3f --- /dev/null +++ b/res/eng-US.xml @@ -0,0 +1,99 @@ + + + + Maximum number of characters reached + Slideshow + Maximum number of files exceeded + Slideshow settings + Select all + Delete? + Edit + Message + Downloads + Album name already in use + Save + 20 seconds + Activation + Rotate left + 2 seconds + Messages + Done + Unable to rename + Email + Invalid characters + Moved + Cancel + Selected + Delete + Subtitles + Cancel + Maximum number of characters (%d) reached + Maximum number of characters (%d) reached + Slide show + Slide + Start slideshow + %s already exists + Loading... + Albums + Unable to rename. Album name already in use. + Operation failed + Saving... + Transition effect + Music + %d items selected + Create folder? + Delete failed + 1 item selected + Video + Zoom + Copy + Iris + Slideshow interval + Video Player + Slideshow + Seconds + Rotate left + Page + Copying... + 10 seconds + Processing... + Gallery + No name + Images + Fade + Edit + 5 seconds + No items selected + Deleted + Remove? + Already exists. Overwrite? + Deleting... + Done + 3 seconds + Camera roll + Rotate right + Repeat + Saved + Dissolve + Shuffle + Moving... + Moving failed + Videos + Unsupported file type + Rename + Completed + Select all + All albums + Change name + Move + Unable to delete + Rotate right + Interval + Already exists + Create album + No items + Blind + Saving failed + diff --git a/res/est-EE.xml b/res/est-EE.xml new file mode 100644 index 0000000..198d820 --- /dev/null +++ b/res/est-EE.xml @@ -0,0 +1,99 @@ + + + + Lubatud arv märke on täis + Slaidiseanss + Failide maksimaalne arv on ületatud + Slaidiseansi seaded + Vali kõik + Kustutada? + Muuda + Sõnum + Allalaet. failid + Albumi nimi juba kasutusel + Salvesta + 20 sekundit + Aktiveerimine + Pööra vasakule + 2 sekundit + Sõnumid + Valmis + Ei saa ümber nimetada + E-post + Lubamatud tähemärgid + Teisaldatud + Tühista + Valitud + Kustuta + Subtiitrid + Tühista + Maksimaalne tähemärkide arv (%d) on saavutatud + Maksimaalne tähemärkide arv (%d) on saavutatud + Slaidis. + Slaid + Käivita slaidiseanss + %s on juba olemas + Laadimine... + Albumid + Ei saa ümber nimetada. Albumi nimi on juba kasutusel + Toiming nurjus + Salvestamine... + Ülemineku efekt + Muusika + %d üksust on valitud + Kas luua kaust? + BT-peakomplekt sees + 1 üksus on valitud + Video + Suumi + Kopeeri + Iiris + Slaidiseansi intervall + Videomängija + Slaidiseanss + sekundit + Pööra vasakule + Lehekülg + Kopeerimine... + 10 sekundit + Töötlemine... + Galerii + Nimi puudub + Pildid + Hajumine + Muuda + 5 sekundit + Ühtegi üksust ei ole valitud + Kustutatud + Eemaldada? + On juba olemas. Kas kirjutada üle? + Kustutamine... + Valmis + 3 sekundit + Kaamera rullik + Pööra paremale + Korda + Salvestatud + Lahuta + Juhuesitus + Teisaldamine... + Teisaldamine nurjus + Videod + Mittetoetatud failitüüp + Nimeta ümber + Lõpule viidud + Vali kõik + Kõik albumid + Muuda nime + Teisalda + Ei saa kustutada + Pööra paremale + Intervall + Juba olemas + Loo album + Üksusi ei ole + Vari + Salvestamine nurjus + diff --git a/res/eus-ES.xml b/res/eus-ES.xml new file mode 100644 index 0000000..450a54d --- /dev/null +++ b/res/eus-ES.xml @@ -0,0 +1,99 @@ + + + + Gehienezko karaktere kopurura heldu zara + Diapositiba aurkezpena + Gehienezko fitxategi kopurua gainditu duzu + Erakusketaren ezarpenak + Denak aukeratu + Ezabatu? + Editatu + Mezua + Deskargak + Izen hori erabilia dago + Gorde + 20 segundo + Aktibazioa + Ezkerrera biratu + 2 segundo + Mezuak + Amaituta + Ezin da berrizendatu + Posta elektroniko mezuak + Karaktere baliogabeak + Mugitua + Ezeztatu + Aukeratutakoa(k) + Ezabatu + Azpitituluak + Ezeztatu + Gehienezko karaktere kopurura (%d) iritsi zara + Gehienezko karaktere kopurura (%d) iritsi zara + Erakusketa + Diapositiba + Hasi diaporama + %s dagoeneko bada + Kargatzen... + Albumak + Ezin zaio izen berria jarri. Izen hori erabilia dago + Eragiketak huts egin du + Gordetzen + Trantsizio efektua + Musika + %d elementu hautatu dira + Karpeta sortu? + Akatsa ezabatzerakoan + Elementu 1 hautatu da + Bideoa + Zooma + Kopiatu + Irisa + Aurkzpen tartea + Bideo Jogailua + Aurkezpena + segundoak + Ezkerrera biratu + Orria + Kopiatzen... + 10 segundo + Prozesatzen... + Galeria + Izenik gabe + Irudiak + Koloregabetu + Editatu + 5 segundo + Ez da elementurik aukeratu + Ezabatua + Kendu? + Dagoeneko bada. Berridatzi? + Ezabatzen... + Amaituta + 3 segundo + Kamera erroilua + Eskuinera biratu + Errepikatu + Gordeta + Disolbatu + Ausazko ordena + Mugitzen... + Errorea mugitzerakoan + Bideoak + Fitx. mota ez da onartzen + Berrizendatu + Osatua + Haut. den. + Album guztiak + Izena aldatu + Mugitu + Ezin da ezabatu + Eskuinera biratu + Tartea + Dagoeneko badago + Albuma sortu + Elementurik ez + Itsua + Errorea gordetzerakoan + diff --git a/res/fas-AF.xml b/res/fas-AF.xml new file mode 100644 index 0000000..3eca367 --- /dev/null +++ b/res/fas-AF.xml @@ -0,0 +1,99 @@ + + + + تعداد کاراکترها به حداکثر رسیده + اسلايد شو + به حداکثر تعداد مجاز فایل رسیده اید + تنظیمات نمایش اسلاید + انتخاب همه + حذف شود؟ + تصحيح + پيام + دانلودها + نام آلبوم از قبل موجود است + ثبت + 20ثانیه + فعال سازی + چرخش به چپ + 2ثانیه + پيام ها + انجام + تغییر نام ممکن نیست.\nفایل در حال استفاده است + ایمیل + نویسه ها نامعتبر است + منتقل شد + لغو + منتخب + حذف + زیرنویس ها + لغو + به حداکثر تعداد کاراکتر های (%d) رسیده اید + به حداکثر تعداد کاراکتر های (%d) رسیده اید + اسلاید شو + کشویی + شروع نمایش اسلاید + %s از قبل وجود دارد + در حال دانلود... + آلبوم ها + تغییر نام امکانپذیر نیست. نام آلبوم از قبل موجود است + عملکرد انجام نشد + درحال ثبت… + جلوه تغییر وضعیت + موزیک + %d مورد انتخاب شد + ايجاد پوشه؟ + عدم موفقیت در حذف + 1 مورد انتخاب شد + فيلم + زوم + کپی + Iris + فاصله زمانی نمایش اسلاید + پخش کننده فیلم + نمایش اسلاید + ثانيه + چرخش به چپ + صفحه + در حال کپی... + 10ثانیه + در حال انجام... + گالری + بدون نام + تصاوير + ناپدید شدن تدریجی + تصحيح + 5 ثانيه + موردی برای انتخاب وجود ندارد + حذف شد + حذف؟ + از قبل وجود دارد. رونویسی شود؟ + در حال حذف... + انجام + 3ثانیه + فهرست دوربین + چرخش به راست + تکرار + ثبت شد + مخلوط شدن تصاویر + انتخاب دستگاه + در حال انتقال + عدم موفقیت در انتقال + فیلمها + نوع فایل پشتیبانی نشده + تعويض نام + انجام شد + انتخاب همه + همه آلبوم ها + تعويض نام + انتقال + غير قابل حذف + چرخش به راست + مدت زمان + موجود است + ایجاد آلبوم + موردی نیست + چراغ چشمک زن + عدم موفقیت در ذخیره سازی + diff --git a/res/fin-FI.xml b/res/fin-FI.xml new file mode 100644 index 0000000..2bcf2b3 --- /dev/null +++ b/res/fin-FI.xml @@ -0,0 +1,99 @@ + + + + Merkkien enimmäismäärä saavutettu + Diaesitys + Tiedostojen enimmäismäärä on ylitetty + Kuvaesityksen asetukset + Valitse kaikki + Poistetaanko? + Muokkaa + Viesti + Lataukset + Albumin nimi jo käytössä + Tallenna + 20 sekuntia + Aktivointi + Kierrä vastapäivään + 2 sekuntia + Viestit + Valmis + Ei voi nimetä uudelleen + Sähköposti + Virheellisiä merkkejä + Siirretty + Peruuta + Valittu + Poista + Tekstitys + Peruuta + Merkkien enimmäismäärä (%d) on saavutettu + Merkkien enimmäismäärä (%d) on saavutettu + Diaesitys + Dia + Käynnistä kuvaesitys + %s on jo olemassa + Ladataan... + Albumit + Ei voi nimetä uudelleen. Albumin nimi on jo käytössä + Toiminto epäonnistui + Tallennetaan... + Siirtymätehoste + Musiikki + %d kohdetta valittu + Luodaanko kansio? + Poisto epäonnistui + 1 kohde valittu + Video + Zoomaus + Kopioi + Iris + Kuvaesityksen aikaväli + Videosoitin + Kuvaesitys + sekuntia + Kierrä vastapäivään + Sivu + Kopioidaan... + 10 sekuntia + Käsitellään... + Galleria + Ei nimeä + Kuvat + Häivytä + Muokkaa + 5 sekuntia + Ei valittuja kohteita + Poistettu + Poistetaanko? + On jo olemassa. Päivitetäänkö? + Poistetaan... + Valmis + 3 sekuntia + Kamerarulla + Kierrä myötäpäivään + Toista + Tallennettu + Ristikuva + Sekoitus + Siirretään... + Siirto epäonnistui + Videot + Tiedostotyyppiä ei tueta + Nimeä uudelleen + Valmis + V. kaikki + Kaikki albumit + Vaihda nimi + Siirrä + Ei voi poistaa + Kierrä myötäpäivään + Väli + On jo olemassa + Luo albumi + Ei kohteita + Kaihdin + Tallentaminen epäonnistui + diff --git a/res/fra-CA.xml b/res/fra-CA.xml new file mode 100644 index 0000000..2a94a11 --- /dev/null +++ b/res/fra-CA.xml @@ -0,0 +1,99 @@ + + + + Nb. max. de caractères atteint + Diaporama + Nombre maximum de fichiers dépassé + Paramètres du diaporama + Sélectionner tout + Supprimer ? + Modifier + Message + Télécharg. + Nom d'album déjà utilisé + Enreg. + 20 secondes + Activation + Pivoter vers la gauche + 2 secondes + Messages + OK + Impossible de renommer l'élément + Courriel + Caractères non valides + Déplacé + Annuler + Sélectionné + Supprimer + Sous-titres + Annuler + Nombre maximum de caractères (%d) atteint + Nombre maximum de caractères (%d) atteint + Diaporama + Diapo + Lancer le diaporama + %s existe déjà + Chargement... + Albums + Impossible de renommer l'élément. Nom d'album déjà utilisé + Échec de l'opération + Enregistrement ... + Effet de transition + Musique + %d éléments sélectionnés + Créer un dossier ? + Échec de suppression + 1 élément sélectionné + Vidéo + Zoom + Copier + Iris + Intervalle du diaporama + Lecteur vidéo + Diaporama + secondes + Pivoter vers la gauche + Page + Copie ... + 10 secondes + Traitement… + Galerie + Aucun nom + Images + Fondu + Modifier + 5 secondes + Aucun élément sélectionné + Supprimé + Retirer? + Existe déjà. L'écraser? + Suppression ... + OK + 3 secondes + Pellicule + Pivoter vers la droite + Répéter + Enregistré + Fondu enchainé + Mode aléatoire + Déplacement... + Échec du déplacement + Vidéos + Type fichier non supporté + Renommer + OK + Sélectionner tout + Tous les albums + Modifier le nom + Déplacer + Suppression impossible + Pivoter vers la droite + Intervalle + Existe déjà + Créer un album + Aucun élément + Stores vénitiens + Échec de l'enregistrement + diff --git a/res/fra-FR.xml b/res/fra-FR.xml new file mode 100644 index 0000000..e89084e --- /dev/null +++ b/res/fra-FR.xml @@ -0,0 +1,99 @@ + + + + Nb. max. de caractères atteint + Diaporama + Nombre maximum de fichiers dépassé + Paramètres du diaporama + Sélect. tout + Supprimer ? + Modifier + Message + Téléchargements + Nom d'album déjà utilisé + Enregistrer + 20 secondes + Activation + Rotation à gauche + 2 secondes + Messages + Effectué + Impossible de renommer l'élément + Email + Caractères non valides + Déplacé + Annuler + Sélectionné + Supprimer + Sous-titres + Annuler + Le nombre maximum de caractères (%d) est atteint + Le nombre maximum de caractères (%d) est atteint + Diaporama + Défilement + Lancer le diaporama + %s existe déjà + Chargement en cours. + Albums + Impossible de renommer l'élément. Nom d'album déjà utilisé + Échec de l'opération + Enregistrement... + Effet de transition + Musique + %d éléments sélectionnés + Créer un dossier ? + Échec de suppression + 1 élément sélectionné + Vidéo + Zoom + Copier + Iris + Intervalle du diaporama + Lecteur vidéo + Diaporama + secondes + Rotation à gauche + Page + Copie... + 10 secondes + En cours... + Galerie + Aucun nom + Images + Fondu + Modifier + 5 secondes + Aucun élément sélectionné + Supprimé + Supprimer ? + Existe déjà. L' écraser ? + Suppression... + Effectué + 3 secondes + Pellicule + Rotation à droite + Répéter + Enregistré + Fondu enchaîné + Mode aléatoire + Déplacement... + Échec du déplacement + Vidéos + Type fichier non supporté + Renommer + OK + Sélect. tt + Tous les albums + Modifier le nom + Déplacer + Suppression impossible + Rotation à droite + Intervalle + Existe déjà + Créer un album + Aucun élément + Stores vénitiens + Échec de l'enregistrement + diff --git a/res/gle-IE.xml b/res/gle-IE.xml new file mode 100644 index 0000000..20bcd97 --- /dev/null +++ b/res/gle-IE.xml @@ -0,0 +1,99 @@ + + + + Uaslíon na gcarachtar bainte amach + Taispeántas sleamhnán + Uaslíon na gcomhad sáraithe + Socruithe taispeántais sleamhnán + Roghnaigh gach + Scrios? + Cuir in eagar + Teachtaireacht + Ioslódálacha + Ainm albaim in úsáid cheana + Sábháil + 20 soicind + Gníomhachtú + Rothlaigh ar chlé + 2 shoicind + Teachtaireachtaí + Déanta + Ní féidir athainmniú + R-phost + Carachtair neamhbhailí + Bogtha + Cuir ar ceal + Roghnaithe + Scrios + Fotheidil + Cuir ar ceal + Uaslíon na gcarachtar (%d) bainte amach + Uaslíon na gcarachtar (%d) bainte amach + Sleamhnán + Sleamhnán + Tosaigh ar thaispeántas sleamhnán + Tá %s ann cheana + Ag lódáil... + Albaim + Ní féidir athainmniú. Ainm an albaim in úsáid cheana + Theip ar oibríocht + Ag sábháil... + Maisíocht trasdula + Ceol + %d mír roghnaithe + Déan fillteán? + Theip ar scriosadh + 1 mhír roghnaithe + Físeán + Zúmáil + Cóipeáil + Feileastram + Eatramh taispeántais sleamhnán + Seinnteoir Físeán + Taispeántas sleamhnán + soicindí + Rothlaigh ar chlé + Leathanach + Ag cóipeáil... + 10 soicind + Ag próiseáil... + Gailearaí + Níl ainm ann + Íomhánna + Céimnigh + Cuir in eagar + 5 shoicind + Níor roghnaíodh míreanna + Scriosta + Bain? + Ann cheana. Forscríobh? + Ag scriosadh... + Déanta + 3 shoicind + Rolla ceamara + Rothlaigh ar dheis + Déan arís + Sábháilte + Leáigh + Suaitheadh + Ag bogadh... + Theip ar bhogadh + Físeáin + Cineál comhaid gan tacú + Athainmnigh + Curtha i gcrích + Rogh. gach + Gach albam + Athraigh ainm + Bog + Ní féidir scriosadh + Rothlaigh ar dheis + Eatramh + Ann cheana + Déan albam + Níl míreanna ann + Dallóg + Theip ar shábháil + diff --git a/res/glg-ES.xml b/res/glg-ES.xml new file mode 100644 index 0000000..f3e4e7f --- /dev/null +++ b/res/glg-ES.xml @@ -0,0 +1,99 @@ + + + + Número máximo de caracteres alcanzado + Presentación de diapositivas + Superouse o número máximo de arquivos + Axustes de presentación + Seleccionar todo + Eliminar? + Editar + Mensaxe + Descargas + Nome de álbum xa en uso + Gardar + 20 segundos + Activación + Xirar á esquerda + 2 segundos + Mensaxes + Finalizado + Non se pode cambiar o nome + Correo electrónico + Caracteres non válidos + Movido + Cancelar + Seleccionado + Eliminar + Subtítulos + Cancelar + Alcanzouse o número máximo de carácteres (%d) + Alcanzouse o número máximo de carácteres (%d) + Diapos + Diapositiva + Iniciar presentación de diapositivas + %s xa existe + Cargando... + Álbums + Non se pode cambiar o nome. Nome de álbum xa en uso + Fallo na operación + Gardando... + Efecto de transición + Música + %d elementos seleccionados + Crear carpeta? + Erro ao eliminar + 1 elemento seleccionado + Vídeo + Zoom + Copiar + Iris + Intervalo de presentación + Reprodutor de Vídeo + Presentación + segundos + Xirar á esquerda + Páxina + Copiando... + 10 segundos + Procesando... + Galería + Sen nome + Imaxes + Atenuar + Editar + 5 segundos + Non hai elementos seleccionados + Eliminado + Eliminar? + Xa existe. Sobrescribir? + Eliminando... + Finalizado + 3 segundos + Rolo de cámara + Xirar á dereita + Repetir + Gardado + Fundir + Orde aleatoria + Movendo... + Erro ao mover + Vídeos + Tipo de arq. non admitido + C. nome + Completada + Selec todo + Todos os álbums + Cambiar nome + Mover + Non se pode eliminar + Xirar á dereita + Intervalo + Xa existe + Crear álbum + Sen elementos + Persiana + Erro ao gardar + diff --git a/res/hin-IN.xml b/res/hin-IN.xml new file mode 100644 index 0000000..cb453cf --- /dev/null +++ b/res/hin-IN.xml @@ -0,0 +1,99 @@ + + + + वर्णो की संख्‍या अधिकतम पहुँची + स्लाइड शो + फ़ाइल की संख्‍या अधिकतम तक पहुँची + स्लाइड शो सेटिंग्स + सभी चुनें + हटाएँ? + संपादित करें + सन्देश + डाउनलोड + अल्बम नाम पहले से उपयोग में + सुरक्षित + 20 सेकंड + सक्रियण + बाएँ घुमाएँ + 2 सेकंड + सन्देश + हुआ + नाम बदलने में अक्षम + ईमेल + अमान्य वर्ण + ले जाया गया + रद्द करें + चुना गया + हटाएँ + उपशीर्षक + रद्द करें + वर्णों की अधिकतम संख्या (%d) तक पहुँच गया + वर्णों की अधिकतम संख्या (%d) तक पहुँच गया + स्लाइड शो + स्लाइड + स्लाइडशो प्रारंभ करें + %s पहले से मौजूद है + लोड हो रहा है... + एल्बम्स + पुनर्नामित करने में अक्षम. अल्बम नाम पहले से उपयोग में + कार्रवाई विफल + सुरक्षित हो रहा है... + परिवर्तन प्रभाव + संगीत + %d मदें चयनित + फोल्डर बनाएं? + हटाना विफल + 1 मद चयनित + विडियो + ज़ूम + कॉपी करें + आइरिस + स्लाइड शो अंतराल + वीडियो प्‍लेयर + स्लाइड शो + सेकेंड + बाएँ घुमाएँ + पेज + कॉपी कर रहा है… + 10 सेकंड + प्रोसेस हो रहा है… + गैलरी + नाम नहीं + छवियाँ + फीका + संपादित करें + 5 सेकंड + कोई मद चयनित नहीं + हटाया गया + हटाएँ? + पहले से मौजूद है। ओवरराइट करें? + हटाया जा रहा है… + हुआ + 3 सेकंड + कैमरा रोल + दाएँ घुमाएँ + दोहराव + सुरक्षित किया + विलय + शफ़ल + ले जा रहा है… + ले जाना विफल हुआ + विडियो + असमर्थित फ़ाइल प्रकार + पुन: नाम दें + पूर्ण + सभी चुनें + सभी एलबम्‍स + नाम बदलें + ले जाएँ + हटाने में अक्षम + दाएँ घुमाएँ + अन्तराल + पहले से ही मौजूद + अल्बम बनाएँ + कोई मदें नहीं + ब्लाइंड + सुरक्षित करना विफल + diff --git a/res/hrv-HR.xml b/res/hrv-HR.xml new file mode 100644 index 0000000..94a1d59 --- /dev/null +++ b/res/hrv-HR.xml @@ -0,0 +1,99 @@ + + + + Maks. broj znakova + Prezentacija + Maks. broj datoteka + Postavke prezentacije + Odaberi sve + Obrisati? + Uredi + Poruka + Skidanja + Već postoji naziv albuma + Spremi + 20 sek + Uključivanje + Rotiraj ulijevo + 2 sek + Poruke + OK + Nemoguće preimenovati + Email + Neispravni znakovi + Premješteno + Prekid + Odabrano + Obriši + Titlovi + Prekid + Maksimalan broj znakova (%d) + Maksimalan broj znakova (%d) + Prezentacija + Listanje + Pokreni prezentaciju + %s već postoji + Učitavanje... + Albumi + Nemoguće preimenovati. Već postoji naziv albuma + Neuspješno + Spremanje... + Efekt prijelaza + Glazba + %d odabranih stavki + Nova mapa? + Brisanje neuspješno + 1 stavka odabrana + Video + Zoom + Kopiraj + Iris + Interval prezentacije + Video Player + Prezentacija + sekundi + Rotiraj ulijevo + Stranica + Kopiranje... + 10 sek + Procesiranje... + Album + Nema imena + Slike + Zatamni + Uredi + 5 sek + Ništa odabrano + Obrisano + Ukloniti? + Već postoji. Piši preko? + Brisanje... + OK + 3 sek + Snimke kamere + Rotiraj udesno + Ponavljanje + Spremljeno + Razrijedi + Nasumično + Premještanje... + Premještanje neuspješno + Video + Nepodržana vrsta datoteka + Preimenuj + Obavljeno + Označi sve + Svi albumi + Promijenite ime + Premjesti + Brisanje nemoguće + Rotiraj udesno + Interval + Već postoji + Novi album + Nema stavki + Roleta + Spremanje neuspješno + diff --git a/res/hun-HU.xml b/res/hun-HU.xml new file mode 100644 index 0000000..02e98c5 --- /dev/null +++ b/res/hun-HU.xml @@ -0,0 +1,99 @@ + + + + Nincs hely több karakternek + Diavetítés + Elérte a fájlok maximális számát + Diabemutató beállításai + Összes kijelölése + Törli? + Szerkeszt + Üzenet + Letöltések + Ilyen albumnév már van + Ment + 20 másodperc + Aktivál + Forgatás balra + 2 másodperc + Üzenetek + Kész + Nem lehet átnevezni + E-mail + Érvénytelen karakterek + Áthelyezve + Mégse + Kiválasztott + Töröl + Feliratok + Mégse + Elérte a karakterek maximális számát (%d) + Elérte a karakterek maximális számát (%d) + Diavet. + Dia + Diabemutató indítása + Már van %s nevű fájl + Betöltés... + Albumok + Nem lehet átnevezni. Ilyen albumnév már van + Sikertelen művelet + Mentés... + Áttűnés + Zenék + %d tétel kijelölve + Mappát hoz létre? + Törlés sikertelen + 1 tétel kijelölve + Videó + Nagyítás + Másol + Írisz + Diabemutató intervalluma + Videolejátszó + Diabemutató + másodperc + Forgatás balra + Oldal + Másolás... + 10 másodperc + Feldolgozás folyamatban + Galéria + Nincs név + Képek + Áttűnés + Szerkeszt + 5 másodperc + Nincs kiválasztott tétel + Törölve + Törli? + Már létezik. Felülírja? + Törlés... + Kész + 3 másodperc + Filmszalag + Forgatás jobbra + Ismétlés + Mentve + Áttűnés + Véletlen sorrend + Áthelyezés... + Az áthelyezés sikertelen + Videók + Nem támogatott fájltípus + Átnevez + Kész + Mind kijel. + Összes album + Név módosítása + Áthelyez + Nem törölhető + Forgatás jobbra + Intervallum + Már létezik + Album létrehozása + Nincs tétel + Rács + A mentés nem sikerült + diff --git a/res/hye-AM.xml b/res/hye-AM.xml new file mode 100644 index 0000000..f68f465 --- /dev/null +++ b/res/hye-AM.xml @@ -0,0 +1,99 @@ + + + + Հասել եք նիշերի առավելագույն քանակին + Սլայդ շոու + Ֆայլերի առավելագույն քանակը գերազանցվել է + Սահկահանդեսի ընտրանքները + Ընտրել բոլորը + Ջնջե՞լ + Խմբագրել + Հաղորդագրություն + Բեռնումներ + Ալբմի անունն արդեն գրծվմ է + Պահպանել + 20 վայրկյան + Ակտիվացում + Պտտել ձախ + 2 վայրկյան + Հղրդգրթ + Պատրաստ + Հնարավոր չէ վերանվանել + Էլ.փոստ + Անվավեր նիշեր + Տեղափոխված է + Չեղարկել + Ընտրված + Ջնջել + Ենթավերնագրեր + Չեղարկել + Հասել է նիշերի առավելագույն քանակին (%d) + Հասել է նիշերի առավելագույն քանակին (%d) + Սլյդ շոու + Սլայդ + Սկսել սլայդերի ցուցադրում + %s-ն արդեն գոյություն ունի + Բեռնում է... + Ալբոմներ + Անհնար է վերանվանել: Ալբոմի անունն արդեն գործածվում է + Գործողությունը ձախողվեց + Պահպանում է... + Փոխանցման էֆեկտ + Երաժշտությն + %d տարր է ընտրվել + Ստեղծե՞լ թղթապանակ + Ջնջումը ձախողվեց + 1 տարր է ընտրվել + Վիդեո + Մասշտաբ + Պատճենել + Ծիածան + Սահկահանդեսի միջակայքը + Տեսանվագարկիչ + Սահկահանդես + վայրկյաններ + Պտտել ձախ + Էջ + Պատճենում է... + 10 վայրկյան + Ընթացքում է + Պատկերասրահ + Անուն չկա + Պատկերներ + Անհետացող + Խմբագրել + 5 վայրկյան + Որևէ տարր ընտրված չէ + Ջնջված է + Հեռացնե՞լ + Արդեն գոյություն ունի: Վերագրանցե՞լ + Ջնջվում է... + Կատարված է + 3 վայրկյան + Խցիկի հոլովակ + Պտտել աջ + Կրկնել + Պահպանվեց + Լուծել + Պատահական + Տեղափոխում... + Տեղափոխումը ձախողվեց + Տեսահոլովակներ + Ֆայլի չապահովված տիպ + Վերանվանել + Ավարտված է + Ընտրել բլր + Բոլոր ալբոմները + Փոխել անունը + Տեղափոխել + Անհար է ջնջել + Պտտել աջ + Դադար + Արդեն գոյություն ունի + Ստեղծել ալբոմ + Տարրեր չկան + Գալարավարագույր + Պահպանումը ձախողվեց + diff --git a/res/isl-IS.xml b/res/isl-IS.xml new file mode 100644 index 0000000..32f9bc7 --- /dev/null +++ b/res/isl-IS.xml @@ -0,0 +1,99 @@ + + + + Hámarksfjölda stafa hefur verið náð + Glærusýning + Komið er fram yfir hámarksfjölda skráa + Stillingar skyggnusýningar + Velja allt + Á að eyða? + Breyta + Skilaboð + Niðurhal + Heitið er þegar í notkun + Vista + 20 sekúndur + Virkjun + Snúið til vinstri + 2 sekúndur + Skilaboð + Lokið + Mistókst að breyta heiti + Tölvupóstur + Ógildir stafir + Flutt + Hætta við + Valið + Eyða + Texti + Hætta við + Hámarkfjölda stafa (%d) hefur verið náð + Hámarkfjölda stafa (%d) hefur verið náð + Skyggnur + Glæra + Hefja skyggnusýningu + %s er til fyrir + Hleð... + Möppur + Mistókst að endurnefna. Heitið er þegar í notkun + Aðgerð mistókst + Vista... + Skipting + Tónlist + %d atriði valin + Á að búa til möppu? + Ekki tókst að eyða + 1 atriði valið + Myndskeið + Aðdráttur + Afrita + Augasteinn + Tími milli mynda + Myndspilari + Skyggnusýning + sekúndur + Snúið til vinstri + Síða + Afritun stendur yfir... + 10 sekúndur + Vinnsla í gangi... + Gallerí + Ekkert heiti + Myndir + Lækka + Breyta + 5 sekúndur + Það eru engir hlutir valdir + Eytt + Á að fjarlægja? + Er þegar til. Viltu skrifa yfir? + Verið er að eyða... + Lokið + 3 sekúndur + Myndarúlla + Snúið til hægri + Endurtaka + Vistað + Leysa upp + Stokka + Verið er að flytja... + Ekki tókst að flytja + Myndskeið + Óstudd skráargerð + Endurnefna + Lokið + Velja allt + Allar plötur + Breyta heiti + Færa + Það er ekki hægt að eyða + Snúið til hægri + Bil + Er þegar til + Búa til albúm + Engin atriði + Rimlagardína + Mistókst að vista + diff --git a/res/ita-IT.xml b/res/ita-IT.xml new file mode 100644 index 0000000..0454e0b --- /dev/null +++ b/res/ita-IT.xml @@ -0,0 +1,99 @@ + + + + Raggiunto numero massimo di caratteri + Presentazione + Superato numero massimo di file + Impostazioni presentazione + Seleziona tutto + Eliminare? + Modifica + Messaggio + Download + Nome album già in uso + Salva + 20 secondi + Attivazione + Ruota a sinistra + 2 secondi + Messaggi + Fatto + Impossibile rinominare + E-mail + Caratteri non validi + Spostato + Annulla + Selezionato + Elimina + Sottotitoli + Annulla + Raggiunto numero massimo di caratteri (%d) + Raggiunto numero massimo di caratteri (%d) + Present. + Scorrimento + Avvia presentazione + %s esiste già + Caricamento... + Album + Impossibile rinominare. Nome album già in uso + Operazione non eseguita + Salvataggio... + Effetto di transizione + Musica + %d elementi selezionati + Creare cartella? + Eliminazione non riuscita + 1 elemento selezionato + Video + Zoom + Copia + Iride + Intervallo presentazione + Lettore video + Presentazione + secondi + Ruota a sinistra + Pagina + Copia... + 10 secondi + Elaborazione... + Galleria + Nessun nome + Immagini + Sfumatura + Modifica + 5 secondi + Nessun elemento selezionato + Eliminato/i + Rimuovere? + Già esistente. Sovrascrivere? + Eliminazione... + Fatto + 3 secondi + Foto personali + Ruota a destra + Ripeti + Salvato + Dissolvenza + Riproduzione casuale + Spostamento... + Spostamento non riuscito + Video + Tipo di file non support. + Rinomina + Fatto + Sel. tutto + Tutti gli album + Cambia nome + Sposta + Impossibile eliminare + Ruota a destra + Intervallo + Già esiste + Crea album + Nessun elemento + Veneziana + Errore durante il salvataggio + diff --git a/res/jpn-JP.xml b/res/jpn-JP.xml new file mode 100644 index 0000000..0a46aad --- /dev/null +++ b/res/jpn-JP.xml @@ -0,0 +1,99 @@ + + + + 最大文字数に達しました。 + スライドショー + ファイルの最大件数を超えています。 + スライドショーの設定 + 全て選択 + 削除しますか? + 編集 + メッセージ + ダウンロード + アルバム名は既に使用しています。 + 保存 + 20秒 + アクティベーション + 左に回転 + 2秒 + メッセージ + 完了 + 名前を変更できません。 + Eメール + 無効な文字です。 + 移動しました。 + キャンセル + 選択済み + 削除 + 字幕 + キャンセル + 最大文字数(%d)に達しました。 + 最大文字数(%d)に達しました。 + スライドショー + スライド + スライドショーを開始 + %sは既に存在します。 + 読み込み中... + アルバム + 名前​を​変更​できません。​アルバム名​は​既に​使用​されて​います + 操作に失敗しました。 + 保存中... + 通過効果 + 音楽 + %d件選択 + フォルダを作成しますか? + 削除できませんでした。 + 1件選択 + 動画 + ズーム + コピー + アイリス + スライドショーの間隔 + 動画 + スライドショー + 秒 + 左に回転 + ページ + コピー中... + 10秒 + 処理中... + ギャラリー + 名前なし + 画像 + フェード + 編集 + 5秒 + アイテムを選択していません。 + 削除しました。 + 削除しますか? + 同名ファイルがあります。上書きしますか? + 削除中... + 完了 + 3秒 + カメラロール + 右に回転 + 繰り返し + 保存しました。 + ディゾルブ + シャッフル + 移動中... + 移動に失敗しました。 + 動画 + 未対応のファイルです + 名前を変更 + 完了しました。 + 全て選択 + 全アルバム + 名前を変更 + 移動 + 削除できません。 + 右に回転 + 間隔 + 既に登録されています。 + アルバム​作成 + アイテムがありません。 + ブラインド + 保存に失敗しました。 + diff --git a/res/kat-GE.xml b/res/kat-GE.xml new file mode 100644 index 0000000..d715dee --- /dev/null +++ b/res/kat-GE.xml @@ -0,0 +1,99 @@ + + + + მიღწეულია სიმბოლოების მაქსიმალური რაოდენობა + სლაიდშოუ + გადაჭარბებულია ფაილების მაქსიმალური რაოდენობა + სლაიდ–შოუს პარამეტრები + ყველას არჩევა + წაიშალოს? + შეცვლა + შეტყობინება + გადმოწერილები + ალბომის სახელი უკვე არის + შენახვა + 20 წამი + გააქტიურება + მარცხნივ მოტრიალება + 2 წამი + შეტყობინებები + შესრულდა + სახელს ვერ შეცვლით + ელ-ფოსტა + სიმბოლოები არასწორია + გადატანილია + გაუქმება + შერჩეული + წაშლა + სუბტიტრები + გაუქმება + მიღწეულია სიმბოლოების მაქსიმალური რაოდენობა (%d) + მიღწეულია სიმბოლოების მაქსიმალური რაოდენობა (%d) + სლაიდ–შოუ + სლაიდი + სლაიდშოუს დაწყება + %s უკვე არსებობს + იტვირთება... + ალბომები + სახელს ვერ შეცვლით. ალბომის სახელი უკვე გამოყენებულია + ოპერაცია ვერ შესრულდა + ინახება... + გადასვლის ეფექტი + მუსიკა + არჩეულია %d ელემენტი + შექმნით საქაღალდეს? + წაშლა არ მოხერხდა + არჩეულია 1 ელემენტი + ვიდეო + მასშტაბი + ასლი + ირისი + სლაიდ–შოუს ინტერვალი + ვიდეო პლეერი + სლაიდ–შოუ + წამი + მარცხნივ მოტრიალება + გვერდი + კოპირდება... + 10 წამი + მუშავდება... + გალერეა + უსახელო + გამოსახულებები + ნელ-ნელა ჩაქრობა + შეცვლა + 5 წამი + ელემენტი არ არის შერჩეული + წაშლილია + წაიშალოს? + უკვე არსებობს. გადავაწერო? + წაშლა... + შესრულებულია + 3 წამი + ვიდეოფრაგმენტი + მარჯვნივ მოტრიალება + გამეორება + შენახულია + თანდათან გაქრობა + გადანაცვლება + გადატანა... + გადატანა ვერ შესრულდა + ვიდეოები + ფაილის ტიპი გაუთვალისწინ. + ხელახლა დასათაურება + დასრულდა + ყველა + ყველა ალბომი + სახელის შეცვლა + გადატანა + წაშლა შეუძლებელია + მარჯვნივ მოტრიალება + ინტერვალი + უკვე არის + ალბომის შექმნა + ელემენტები არ არის + დაბინდვა + ვერ შეინახა + diff --git a/res/kaz-KZ.xml b/res/kaz-KZ.xml new file mode 100644 index 0000000..cb945a7 --- /dev/null +++ b/res/kaz-KZ.xml @@ -0,0 +1,99 @@ + + + + Таңбалардың ен көп саны артты + Слайд-шоу + Ең көп файлдар санынан асып кетті + Слайдшоу параметрлері + Бәрін бөлектеу + Өшіресіз бе? + Өзгерту + Хабарлама + Жазылған + Альбом атауы пайдаланылуда + Сақтау + 20 секунд + Активтеу + Солға бұру + 2 секунд + Хабарламалар + Дайын + Атын өзгерту мүмкін емес + Эл. пошта + Қате әріптер + Орналастырылды + Тоқтату + Таңдалды + Жою + Субтитрлер + Тоқтату + Ең көп таңбалар санына (%d) жетті + Ең көп таңбалар санына (%d) жетті + Слайдшоу + Слайд + Слайдшоуды бастау + %s бар + Жазылуда... + Альбомдар + Атауын өзгерту мүмкін емес. Альбомның атауы пайдаланылуда + Әрекет сәтсіз аяқталды + Сақталуда... + Өтпелі әсер + Музыка + %d элемент таңдалды + Қалта құрасыз ба? + Жою үстінде үзіліп кетті + 1 элемент таңдалды + Бейне + Ауқымы + Көшіру + Жыланқияқ + Слайдшоу аралығы + Бейне ойнатқыш + Слайдшоу + секунд + Солға бұру + Бет + Көшірілуде... + 10 секунд + Өңделуде... + Галерея + Ондай есім жоқ + Суреттер + Тегіс пайда болу + Өзгерту + 5 секунд + Мазмұны таңдалған жоқ + Жойылды + Жоясыз ба? + Бар. Қайта жазу керек пе? + Жойылуда... + Аяқталды + 3 секунд + Камера білігі + Оңға бұру + Қайталау + Сақталған + Жоқ болу + Кездейсоқ тәртіп + Орналастырылды + Орналастырылмады + Бейнежазбалар + Қолданылмайтын файл түрі + Атын өзгерту + Аяқталды + Барл. таң. + Барлық альбомдар + Атын өзгерту + Орналастыру + Жою мүмкін емес + Оңға бұру + Аралық + Қолданыста бар + Альбом жасау + Баптар жоқ + Көрінбейді + Сақтау сәтсіз + diff --git a/res/kor-KR.xml b/res/kor-KR.xml new file mode 100644 index 0000000..e17ff69 --- /dev/null +++ b/res/kor-KR.xml @@ -0,0 +1,99 @@ + + + + 입력 가능한 최대 글자수를 초과하였습니다 + 슬라이드쇼 + 최대 파일 수를 초과하였습니다 + 슬라이드쇼 설정 + 모두 선택 + 삭제할까요? + 편집 + 메시지 + 다운로드 관리 + 사용 중인 이름입니다 + 저장 + 20초 + 실행 + 왼쪽으로 회전 + 2초 + 메시지 + 완료 + 이름을 변경할 수 없습니다 + 이메일 + 글자가 바르지 않습니다 + 이동되었습니다 + 취소 + 단일 선택 + 삭제 + 자막 + 취소 + 최대 글자 수(%d개)를 초과하였습니다 + 최대 글자 수(%d개)를 초과하였습니다 + 슬라이드쇼 + 슬라이드 + 슬라이드쇼 시작 + %s이(가) 저장되어 있습니다 + 로딩 중... + 앨범 + 사용 중인 앨범 이름이므로 변경할 수 없습니다 + 작업을 수행하지 못하였습니다 + 저장 중... + 전환 효과 + 음악 + %d개의 항목이 선택되었습니다 + 폴더를 추가할까요? + 삭제하지 못하였습니다 + 1개의 항목이 선택되었습니다 + 동영상 + 확대/축소 + 복사 + 아이리스 + 슬라이드쇼 전환 간격 + 비디오 플레이어 + 슬라이드쇼 + 초 + 왼쪽으로 회전 + 페이지 + 복사 중... + 10초 + 처리 중... + 갤러리 + 이름이 없습니다 + 이미지 + 페이드 + 편집 + 5초 + 선택된 항목이 없습니다 + 삭제되었습니다 + 제거할까요? + 사용 중인 이름입니다. 덮어쓸까요? + 삭제 중... + 완료 + 3초 + 카메라 앨범 + 오른쪽으로 회전 + 반복 + 저장되었습니다 + 디졸브 + 셔플 + 이동 중... + 이동하지 못하였습니다 + 동영상 + 지원되지 않는 파일 형식입니다 + 이름 변경 + 완료되었습니다 + 모두 선택 + 모든 앨범 + 이름 변경 + 이동 + 삭제할 수 없습니다 + 오른쪽으로 회전 + 간격 + 이미 저장되어 있습니다 + 앨범 추가 + 항목이 없습니다 + 블라인드 + 저장하지 못하였습니다 + diff --git a/res/lav-LV.xml b/res/lav-LV.xml new file mode 100644 index 0000000..75f04fa --- /dev/null +++ b/res/lav-LV.xml @@ -0,0 +1,99 @@ + + + + Sasniegts maksimālais rakstzīmju skaits + Slaidrāde + Pārsniegts maksimālais failu skaits + Slaidrādes iestatījumi + Izv. visu + Vai dzēst? + Rediģēt + Ziņa + Lejupielādes + Alb.nosauk. jau tiek liet. + Saglabāt + 20 sekundes + Aktivizēšana + Pagriezt pa kreisi + 2 sekundes + Ziņas + Gatavs + Nevar pārdēvēt + E-pasts + Nederīgas rakstzīmes + Pārvietots + Atcelt + Izvēlēts + Dzēst + Subtitri + Atcelt + Sasniegts maksimālais rakstzīmju skaits (%d) + Sasniegts maksimālais rakstzīmju skaits (%d) + Slaidrāde + Slaids + Sākt slaidrādi + %s jau pastāv + Ielādē... + Albumi + Nevar pārdēvēt. Albuma nosaukums jau tiek lietots + Darbība neizdevās + Saglabā... + Pārejas efekts + Mūzika + Ir izvēlēti %d objekti + Vai izveidot mapi? + Neizdevās izdzēst + Ir izvēlēts 1 objekts + Video + Tālummaiņa + Kopēt + Varavīksne + Slaidrādes intervāls + Video atskaņotājs + Slaidrāde + sekundes + Pagriezt pa kreisi + Lapa + Kopē... + 10 sekundes + Notiek apstrāde... + Galerija + Nav vārda + Attēli + Izgaist + Rediģēt + 5 sekundes + Nav izvēlētu objektu + Izdzēsts + Vai noņemt? + Jau pastāv. Vai pārrakstīt? + Dzēš... + Gatavs + 3 sekundes + Kam.fotoatt.rul. + Pagriezt pa labi + Atkārtot + Saglabāts + Izšķīdināt + Jaukt + Pārvieto... + Pārvietošana neizdevās + Video + Neatbalstīts faila tips + Pārdēvēt + Pabeigts + Izv. visu + Visi albumi + Mainīt vārdu + Pārvietot + Nevar izdzēst + Pagriezt pa labi + Intervāls + Jau pastāv + Izveidot albumu + Nav vienumu + Aizēnošana + Saglabāšana neizdevās + diff --git a/res/lit-LT.xml b/res/lit-LT.xml new file mode 100644 index 0000000..fd405be --- /dev/null +++ b/res/lit-LT.xml @@ -0,0 +1,99 @@ + + + + Pasiektas didžiausias simbolių skaičius + Skaidrių demonstravimas + Viršytas didžiausias leistinas failų skaičius + Skaidrių rodymo nustatymai + Pasirinkti viską + Ar trinti? + Redaguoti + Žinutė + Atsisiųsti elem. + Albumo pavadinimas jau yra + Išsaugoti + 20 sekundžių + Aktyvinimas + Sukti į kairę + 2 sekundės + Žinutės + Atlikta + Neįmanoma pervardinti + El. paštas + Neteisingi simboliai + Perkelta + Atšaukti + Pasirinkta + Trinti + Subtitrai + Atšaukti + Pasiektas didžiausias simbolių skaičius (%d) + Pasiektas didžiausias simbolių skaičius (%d) + Skaid.rod. + Skaidrė + Pradėti skaidrių rodymą + %s jau yra + Įkeliama... + Albumai + Neįmanoma pakeisti pavadinimo. Toks albumo pavadinimas jau yra + Veiksmas nepavyko + Įrašoma... + Perėjimo efektas + Muzika + Pasirinkta elementų: %d + Ar kurti aplanką? + Ištrinti nepavyko + Pasirinktas 1 elementas + Vaizdo įrašas + Mastelio keitimas + Kopijuoti + Rainelė + Skaidrių rodymo intervalas + Vaizdo įrašų leistuvas + Skaidrių rodymas + sekundės + Sukti į kairę + Puslapis + Kopijuojama... + 10 sekundžių + Apdorojama... + Galerija + Nėra vardo + Vaizdai + Išblukimas + Redaguoti + 5 sekundės + Niekas nepasirinkta + Ištrinta + Ar šalinti? + Jau yra. Perrašyti? + Trinama... + Atlikta + 3 sekundės + Nuotr. rodymas + Sukti į dešinę + Kartoti + Išsaugota + Panaikinti + Maišyti + Perkeliama... + Perkelti nepavyko + Vaizdo įrašai + Nepalaikomas failo tipas + Pervardyti + Atlikta + Rin. Viską + Visi albumai + Keisti vardą + Perkelti + Ištrinti nepavyko + Sukti į dešinę + Intervalas + Jau yra + Sukurti albumą + Elementų nėra + Žaliuzės + Išsaugoti nepavyko + diff --git a/res/mkd-MK.xml b/res/mkd-MK.xml new file mode 100644 index 0000000..99abc99 --- /dev/null +++ b/res/mkd-MK.xml @@ -0,0 +1,99 @@ + + + + Достигнат е максималниот број знаци + Слајдови + Максималниот број фајлови е надминат + Опции за слајдовите + Избери ги сите + Да се избрише? + Измени + Порака + Преземено + Името на албумот постои + Сочувај + 20 секунди + Активирање + Ротирај лево + 2 секунди + Пораки + Готово + Не може да се преименува + Е-пошта + Погрешни знаци + Преместено + Откажи + Избраните + Избриши + Титли + Откажи + Достигнат е максималниот број знаци (%d) + Достигнат е максималниот број знаци (%d) + Слајдови + Слајд + Почни слајдови + %s веќе постои + Активирање... + Албуми + Не може да се преименува. Името на албумот постои + Неуспешна операција + Се снима... + Премин + Музика + Избрани се %d записи + Направи нова папка? + Неуспешно бришење + Избран е 1 запис + Видео-запис + Зголемено + Копирај + Зеница + Период на слајдовите + Видео-плеер + Слајдови + секунди + Ротирај лево + Страна + Се копира... + 10 секунди + Обработување... + Галерија + Нема име + Слики + Затемнување + Измени + 5 секунди + Не се избрани содржини + Избришано + Отстрани? + Веќе постои. Пресними? + Се брише... + Извршено + 3 секунди + Ролна на камера + Ротирај десно + Повторување + Меморирано + Растворање + Произволно + Се преместува... + Неуспешно преместување + Видео-записи + Неподдржан вид фајл + Преименувај + Завршено + Изб. сите + Сите албуми + Смени име + Премести + Не може да се избрише + Ротирај десно + Интервал + Веќе постои + Нов албум + Нема записи + Ролетна + Неуспешно снимање + diff --git a/res/nld-NL.xml b/res/nld-NL.xml new file mode 100644 index 0000000..c8b65d3 --- /dev/null +++ b/res/nld-NL.xml @@ -0,0 +1,99 @@ + + + + Maximumaantal tekens bereikt + Diapresentatie + Maximumaantal bestanden overschreden + Instellingen diashow + Alles selecteren + Verwijderen? + Bewerken + Bericht + Downloads + Albumnaam al in gebruik + Opslaan + 20 seconden + Inschakelen + Linksom draaien + 2 seconden + Berichten + Gereed + Kan de naam niet wijzigen + E-mail + Ongeldige tekens + Verplaatst + Annuleren + Geselecteerd + Wissen + Ondertitels + Annuleren + Maximumaantal tekens (%d) bereikt + Maximumaantal tekens (%d) bereikt + Diashow + Pictogram + Diashow starten + %s bestaat al + Laden... + Albums + Kan de naam niet wijzigen. Albumnaam al in gebruik + Bewerking is mislukt + Opslaan... + Overgangseffect + Muziek + %d items geselecteerd + Map maken? + Verwijderen mislukt + 1 item geselecteerd + Video + Zoomen + Kopiëren + Iris + Interval diashow + Videospeler + Diashow + seconden + Linksom draaien + Pagina + Kopiëren... + 10 seconden + Verwerken... + Galerij + Geen naam + Afbeeldingen + Uitvloeien + Bewerken + 5 seconden + Geen items geselecteerd + Verwijderd + Verwijderen? + Bestaat al. Overschrijven? + Verwijderen... + Gereed + 3 seconden + Camerarol + Rechtsom draaien + Herhalen + Opgeslagen + Oplossen + Willekeurig + Verplaatsen... + Verplaatsen is mislukt + Video's + Niet-onderst. bestandtype + Naam wijzigen + Voltooid + Alles sel. + Alle albums + Naam wijzigen + Verplaatsen + Kan niet verwijderen + Rechtsom draaien + Interval + Bestaat al + Album maken + Geen items + Jaloezie + Opslaan mislukt + diff --git a/res/nob-NO.xml b/res/nob-NO.xml new file mode 100644 index 0000000..3bb6b9c --- /dev/null +++ b/res/nob-NO.xml @@ -0,0 +1,99 @@ + + + + Nådd maksimalt antall tegn + Bildefremvisning + Maks. antall filer overskredet + Bildefremvisninginnstillinger + Merk alt + Slette? + Rediger + Melding + Nedlastinger + Albumnavn allerede i bruk + Lagre + 20 sekunder + Aktivering + Roter mot klokken + 2 sekunder + Meldinger + Utført + Kan ikke gi nytt navn + E-post + Ugyldige tegn + Flyttet + Avbryt + Valgt + Slett + Undertekster + Avbryt + Maksimalt antall tegn (%d) er nådd + Maksimalt antall tegn (%d) er nådd + Bildevisn + Lysbilde + Start bildefremvisning + %s finnes allerede + Åpner... + Album + Kan ikke gi nytt navn. Albumnavnet er allerede i bruk + Operasjonen mislyktes + Lagrer... + Overgangseffekt + Musikk + %d elementer valgt + Opprette mappe? + Kunne ikke slette + 1 element valgt + Videoklipp + Zoom + Kopier + Iris + Bildefremvisningsintervall + Videospiller + Bildefremvisning + sekunder + Roter mot klokken + Side + Kopierer... + 10 sekunder + Behandler... + Galleri + Ingen navn + Bilder + Fade + Rediger + 5 sekunder + Det er ikke valgt noen elementer + Slettet + Fjerne? + Finnes allerede. Vil du overskrive? + Sletter... + Utført + 3 sekunder + Kamerabilder + Roter med klokken + Gjenta + Lagret + Oppløs + Tilfeldig avspilling + Flytter... + Flyttingen mislyktes + Videoklipp + Filtypen støttes ikke + Endre navn + Fullført + Velg alle + Alle album + Endre navn + Flytt + Kan ikke slette + Roter med klokken + Intervall + Finnes allerede + Lag album + Ingen elementer + Persienne + Kunne ikke lagre + diff --git a/res/pol-PL.xml b/res/pol-PL.xml new file mode 100644 index 0000000..c848cca --- /dev/null +++ b/res/pol-PL.xml @@ -0,0 +1,99 @@ + + + + Osiągnięto maksymalną liczbę znaków + Pokaz slajdów + Przekroczono maksymalną liczbę plików + Ustawienia pokazu slajdów + Zaznacz wszystko + Usunąć? + Edytuj + Wiadomość + Pobrane + Nazwa albumu już w użyciu + Zapisz + 20 sek. + Aktywacja + Obróć w lewo + 2 sek. + Wiadomości + Gotowe + Nie można zmienić nazwy + E-mail + Nieprawidłowe znaki + Przeniesiono + Anuluj + Wybrany + Usuń + Napisy + Anuluj + Osiągnięto maksymalną liczbę znaków (%d) + Osiągnięto maksymalną liczbę znaków (%d) + Pok. slajd + Slajd + Rozpocznij pokaz slajdów + %s już istnieje + Ładuję... + Albumy + Nie można zmienić nazwy. Nazwa albumu już w użyciu + Operacja nie powiodła się + Zapisywanie... + Efekt przejścia menu + Muzyka + Wybrane elementy: %d + Utworzyć katalog ? + Błąd usuwania + Wybrane elementy: 1 + Film + Powiększenie + Kopiuj + Koło + Czas wyświetlania slajdów + Odtwarzacz wideo + Pokaz slajdów + s + Obróć w lewo + Strony + Kopiowanie... + 10 sek. + Przetwarzanie... + Galeria + Bez nazwy + Obrazy + Zanikanie + Edytuj + 5 sek. + Nie wybrano elementów + Usunięto + Usunąć? + Już istnieje. Zamienić? + Usuwanie... + Gotowe + 3 sek. + Rolka aparatu + Obróć w prawo + Powtórz + Zapisano + Przenikanie + Kolejność losowa + Przenoszenie... + Błąd przenoszenia + Filmy + Nieobsługiwany typ pliku + Zmień nazwę + Zakończono + Zazn. wsz. + Wszystkie albumy + Zmień nazwę + Przenieś + Nie można usunąć + Obróć w prawo + Okres + Już istnieje + Utwórz album + Brak elementów + Zasłona + Błąd zapisywania + diff --git a/res/por-BR.xml b/res/por-BR.xml new file mode 100644 index 0000000..5c8140f --- /dev/null +++ b/res/por-BR.xml @@ -0,0 +1,99 @@ + + + + Número máximo de caracteres atingido + Exibição de slides + Número máximo de arquivos excedido + Configurações da apresentação de slides + Selecionar tudo + Apagar? + Editar + Mensagem + Downloads + Nome de álbum existente + Salvar + 20 segundos + Ativação + Girar para a esquerda + 2 segundos + Mensagens + Concluído + Impossível renomear + E-mail + Caracteres inválidos + Movido + Cancelar + Selecionado + Apagar + Legendas + Cancelar + Número máximo de caracteres (%d) atingido + Número máximo de caracteres (%d) atingido + Ver slides + Transição + Iniciar apresentação de slides + %s já existente + Carregando... + Álbuns + Impossível renomear. Nome de álbum já utilizado + Operação falhou + Salvando... + Efeito de transição + Músicas + %d itens selecionados + criar pasta? + Erro ao apagar + 1 item selecionado + Vídeo + Zoom + Copiar + Iris + Intervalo da apresentação de slides + Video Player + Apresentação de slides + segundos + Girar para a esquerda + Página + Copiando... + 10 segundos + Processando… + Galeria + Sem nome + Imagens + Desbotar + Editar + 5 segundos + Sem itens selecionados + Apagado + Remover? + Já existe. Substituir? + Apagando… + Concluído + 3 segundos + Giro da câmera + Girar para a direita + Repetir + Salvo + Dissolver + Modo aleatório + Movendo… + Erro ao mover + Vídeos + Tipo de arq. não suportado + Renomear + Concluído + Sel. Tudo + Todos os álbuns + Alterar nome + Mover + Impossível apagar + Girar para a direita + Intervalo + Já existe + Criar álbum + Sem itens + Persiana + Erro ao salvar + diff --git a/res/por-PT.xml b/res/por-PT.xml new file mode 100644 index 0000000..fa9f2fd --- /dev/null +++ b/res/por-PT.xml @@ -0,0 +1,99 @@ + + + + Número máximo de caracteres atingido. + Apresentação de slides + Número máximo de ficheiros excedido + Definições da apresentação de slides + Seleccionar tudo + Eliminar? + Editar + Mensagem + Transferências + Nome de álbum já utilizado + Guardar + 20 segundos + Activação + Rodar para a esquerda + 2 segundos + Mensagem + Concluído + Impossível mudar nome + E-mail + Caracteres inválidos + Movido + Cancelar + Seleccionado + Eliminar + Legendas + Cancelar + Número máximo de caracteres (%d) atingido + Número máximo de caracteres (%d) atingido + Diaporama + Slide + Iniciar apresentação de slides + %s já existente + A carregar... + Álbuns + Impossível mudar o nome. Nome de álbum já utilizado + Operação falhou + A guardar... + Efeito de transição + Música + %d itens seleccionados + Criar pasta? + Falha ao apagar + 1 item seleccionado + Vídeo + Zoom + Copiar + Íris + Duração da apresentação + Leitor de Vídeo + Apresentação de slides + segundos + Rodar para a esquerda + Página + A copiar... + 10 segundos + A processar... + Galeria + Sem nome + Imagens + Saída gradual + Editar + 5 segundos + Sem itens seleccionados + Eliminado + Remover? + Já existe. Substituir? + A eliminar... + Concluído + 3 segundos + Rolo da câmara + Rodar para a direita + Repetir + Guardado + Dissolver + Aleatório + A mover... + Falha ao mover + Vídeos + Tipo fich. não suportado + Mudar nome + Concluída + Selec. tudo + Todos os álbuns + Alterar nome + Mover + Impossível apagar. + Rodar para a direita + Intervalo + Já existe + Criar álbum + Sem itens + Persiana + Falha ao gravar + diff --git a/res/ron-RO.xml b/res/ron-RO.xml new file mode 100644 index 0000000..d70d126 --- /dev/null +++ b/res/ron-RO.xml @@ -0,0 +1,99 @@ + + + + Adăugare la marcaje + Expuneri diapozitive + Numărul maxim de fişiere a fost depăşit + Setări expunere diapozitive + Selectare toate + Ştergeţi? + Editare + Mesaj + Descărcări + Numele este deja în uz + Salvare + 20 secunde + Activare + Rotire stânga + 2 secunde + Mesaje + Gata + Imposibil de redenumit + Email + Caractere nevalide + Mutat + Anulare + Selectat + Ştergere + Subtitrare + Anulare + Numărul maxim de caractere (%d) a fost atins + Numărul maxim de caractere (%d) a fost atins + Ex. diap. + Diapozitiv + Începere expunere de diapozitive + %s există deja + Încărcare... + Albume + Imposibil de redenumit. Numele albumului este deja în uz + Operaţie nereuşită + Se salvează... + Efect de tranziţie + Muzică + %d elemente selectate + Creaţi folder? + Ştergerea nu a reuşit + 1 element selectat + Videoclip + Panoramare + Copiere + Curcubeu + Interval expunere diapozitive + Player video + Expunere diapozitive + secunde + Rotire stânga + Pagină + Copiere... + 10 secunde + Se procesează... + Galerie + Nici un nume + Imagini + Estompare + Editare + 5 secunde + Niciun element selectat + Şters + Eliminare? + Există deja. Suprascrieţi? + Se şterge... + Efectuat + 3 secunde + Capturi cameră + Rotire dreapta + Repetare + Salvat + Dizolvare + Amestecare + Mutare + Mutarea nu a reuşit + Videoclipuri + Tip de fişier neacceptat + Redenumire + Finalizat + Sel. int. + Toate albumele + Schimbare nume + Mutare + Imposibil de şters + Rotire dreapta + Interval + Există deja + Creare album + Niciun element + Jaluzele + Salvare nereuşită + diff --git a/res/rus-RU.xml b/res/rus-RU.xml new file mode 100644 index 0000000..812d3bd --- /dev/null +++ b/res/rus-RU.xml @@ -0,0 +1,99 @@ + + + + Достигнуто максимальное число символов + Слайд-шоу + Превышено максимальное число файлов + Параметры + Выбрать все + Удалить? + Изменить + Сообщение + Загрузки + Имя альбома используется + Соxранить + 20 секунд + Активация + Повернуть влево + 2 секунды + Сообщения + Готово + Невозможно переименовать + E-mail + Недопустимые символы + Перемещено + Отмена + Выбрано + Удалить + Субтитры + Отмена + Достигнуто максимальное число символов (%d) + Достигнуто максимальное число символов (%d) + Слайд-шоу + Слайд-шоу + Запустить + %s уже существует + Загрузка... + Альбомы + Невозможно переименовать. Имя альбома уже используется + Сбой операции + Сохранение... + Эффект перехода + Музыка + Выбрано элементов: %d + Создать папку? + Сбой удаления + Выбран 1 элемент + Видео + Масштаб + Копировать + Радуга + Интервал для слайд-шоу + Видео\nплеер + Слайд-шоу + сек. + Повернуть влево + Страница + Копирование... + 10 секунд + Обработка... + Галерея + Нет имени + Картинки + Растворение + Изменить + 5 секунд + Элементы не выбраны + Удалено + Удалить? + Уже существует. Перезаписать? + Удаление... + Готово + 3 секунды + Каталог фото + Повернуть вправо + Повторить + Соxранено + Растворение + Случайный порядок + Перемещение... + Сбой перемещения + Видео + Неподдерживаемый тип файла + Переименовать + Завершено + Выбр. все + Все альбомы + Изменить имя + Переместить + Невозможно удалить + Повернуть вправо + Интервал + Уже существует + Создать альбом + Нет элементов + Жалюзи + Сбой сохранения + diff --git a/res/screen-density-xhigh/00_button_radio.png b/res/screen-density-xhigh/00_button_radio.png new file mode 100644 index 0000000..83a1a54 Binary files /dev/null and b/res/screen-density-xhigh/00_button_radio.png differ diff --git a/res/screen-density-xhigh/00_button_radio_selected.png b/res/screen-density-xhigh/00_button_radio_selected.png new file mode 100644 index 0000000..aa2a5c1 Binary files /dev/null and b/res/screen-density-xhigh/00_button_radio_selected.png differ diff --git a/res/screen-density-xhigh/00_circle_button_Expand_closed.png b/res/screen-density-xhigh/00_circle_button_Expand_closed.png new file mode 100644 index 0000000..83e6762 Binary files /dev/null and b/res/screen-density-xhigh/00_circle_button_Expand_closed.png differ diff --git a/res/screen-density-xhigh/00_circle_button_Expand_open.png b/res/screen-density-xhigh/00_circle_button_Expand_open.png new file mode 100644 index 0000000..85e99f9 Binary files /dev/null and b/res/screen-density-xhigh/00_circle_button_Expand_open.png differ diff --git a/res/screen-density-xhigh/00_icon_more_dim.png b/res/screen-density-xhigh/00_icon_more_dim.png new file mode 100644 index 0000000..cd80dce Binary files /dev/null and b/res/screen-density-xhigh/00_icon_more_dim.png differ diff --git a/res/screen-density-xhigh/00_icon_more_press.png b/res/screen-density-xhigh/00_icon_more_press.png new file mode 100644 index 0000000..2e0c742 Binary files /dev/null and b/res/screen-density-xhigh/00_icon_more_press.png differ diff --git a/res/screen-density-xhigh/00_icon_select_all_press_web.png b/res/screen-density-xhigh/00_icon_select_all_press_web.png new file mode 100644 index 0000000..57e1eed Binary files /dev/null and b/res/screen-density-xhigh/00_icon_select_all_press_web.png differ diff --git a/res/screen-density-xhigh/00_icon_select_all_web.png b/res/screen-density-xhigh/00_icon_select_all_web.png new file mode 100644 index 0000000..56e3fbb Binary files /dev/null and b/res/screen-density-xhigh/00_icon_select_all_web.png differ diff --git a/res/screen-density-xhigh/00_list_expand_closed.png b/res/screen-density-xhigh/00_list_expand_closed.png new file mode 100644 index 0000000..a3f639e Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_closed.png differ diff --git a/res/screen-density-xhigh/00_list_expand_closed_press.png b/res/screen-density-xhigh/00_list_expand_closed_press.png new file mode 100644 index 0000000..b421ad1 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_closed_press.png differ diff --git a/res/screen-density-xhigh/00_list_expand_opened.png b/res/screen-density-xhigh/00_list_expand_opened.png new file mode 100644 index 0000000..377dbc9 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_opened.png differ diff --git a/res/screen-density-xhigh/00_list_expand_opened_press.png b/res/screen-density-xhigh/00_list_expand_opened_press.png new file mode 100644 index 0000000..1b49c94 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_opened_press.png differ diff --git a/res/screen-density-xhigh/00_list_process_01.png b/res/screen-density-xhigh/00_list_process_01.png new file mode 100644 index 0000000..cb74cb2 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_01.png differ diff --git a/res/screen-density-xhigh/00_list_process_02.png b/res/screen-density-xhigh/00_list_process_02.png new file mode 100644 index 0000000..bc43e8b Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_02.png differ diff --git a/res/screen-density-xhigh/00_list_process_03.png b/res/screen-density-xhigh/00_list_process_03.png new file mode 100644 index 0000000..280f431 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_03.png differ diff --git a/res/screen-density-xhigh/00_list_process_04.png b/res/screen-density-xhigh/00_list_process_04.png new file mode 100644 index 0000000..bf6f99d Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_04.png differ diff --git a/res/screen-density-xhigh/00_list_process_05.png b/res/screen-density-xhigh/00_list_process_05.png new file mode 100644 index 0000000..a1f3fc5 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_05.png differ diff --git a/res/screen-density-xhigh/00_list_process_06.png b/res/screen-density-xhigh/00_list_process_06.png new file mode 100644 index 0000000..3202a29 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_06.png differ diff --git a/res/screen-density-xhigh/00_list_process_07.png b/res/screen-density-xhigh/00_list_process_07.png new file mode 100644 index 0000000..8a29aea Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_07.png differ diff --git a/res/screen-density-xhigh/00_list_process_08.png b/res/screen-density-xhigh/00_list_process_08.png new file mode 100644 index 0000000..532cd07 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_08.png differ diff --git a/res/screen-density-xhigh/00_list_process_09.png b/res/screen-density-xhigh/00_list_process_09.png new file mode 100644 index 0000000..8c508a0 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_09.png differ diff --git a/res/screen-density-xhigh/00_list_process_10.png b/res/screen-density-xhigh/00_list_process_10.png new file mode 100644 index 0000000..679bcb8 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_10.png differ diff --git a/res/screen-density-xhigh/00_list_process_11.png b/res/screen-density-xhigh/00_list_process_11.png new file mode 100644 index 0000000..910f2b0 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_11.png differ diff --git a/res/screen-density-xhigh/00_list_process_12.png b/res/screen-density-xhigh/00_list_process_12.png new file mode 100644 index 0000000..35fb68f Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_12.png differ diff --git a/res/screen-density-xhigh/00_list_process_13.png b/res/screen-density-xhigh/00_list_process_13.png new file mode 100644 index 0000000..adcf94f Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_13.png differ diff --git a/res/screen-density-xhigh/00_list_process_14.png b/res/screen-density-xhigh/00_list_process_14.png new file mode 100644 index 0000000..283858b Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_14.png differ diff --git a/res/screen-density-xhigh/00_list_process_15.png b/res/screen-density-xhigh/00_list_process_15.png new file mode 100644 index 0000000..3167602 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_15.png differ diff --git a/res/screen-density-xhigh/00_list_process_16.png b/res/screen-density-xhigh/00_list_process_16.png new file mode 100644 index 0000000..26e691c Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_16.png differ diff --git a/res/screen-density-xhigh/00_list_process_17.png b/res/screen-density-xhigh/00_list_process_17.png new file mode 100644 index 0000000..1a059dd Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_17.png differ diff --git a/res/screen-density-xhigh/00_list_process_18.png b/res/screen-density-xhigh/00_list_process_18.png new file mode 100644 index 0000000..6c7f410 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_18.png differ diff --git a/res/screen-density-xhigh/00_list_process_19.png b/res/screen-density-xhigh/00_list_process_19.png new file mode 100644 index 0000000..3a33a95 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_19.png differ diff --git a/res/screen-density-xhigh/00_list_process_20.png b/res/screen-density-xhigh/00_list_process_20.png new file mode 100644 index 0000000..6076f52 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_20.png differ diff --git a/res/screen-density-xhigh/00_list_process_21.png b/res/screen-density-xhigh/00_list_process_21.png new file mode 100644 index 0000000..b09d472 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_21.png differ diff --git a/res/screen-density-xhigh/00_list_process_22.png b/res/screen-density-xhigh/00_list_process_22.png new file mode 100644 index 0000000..cffed12 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_22.png differ diff --git a/res/screen-density-xhigh/00_list_process_23.png b/res/screen-density-xhigh/00_list_process_23.png new file mode 100644 index 0000000..987562c Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_23.png differ diff --git a/res/screen-density-xhigh/00_list_process_24.png b/res/screen-density-xhigh/00_list_process_24.png new file mode 100644 index 0000000..a73d472 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_24.png differ diff --git a/res/screen-density-xhigh/00_list_process_25.png b/res/screen-density-xhigh/00_list_process_25.png new file mode 100644 index 0000000..02cfd95 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_25.png differ diff --git a/res/screen-density-xhigh/00_list_process_26.png b/res/screen-density-xhigh/00_list_process_26.png new file mode 100644 index 0000000..e5b6871 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_26.png differ diff --git a/res/screen-density-xhigh/00_list_process_27.png b/res/screen-density-xhigh/00_list_process_27.png new file mode 100644 index 0000000..7caf896 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_27.png differ diff --git a/res/screen-density-xhigh/00_list_process_28.png b/res/screen-density-xhigh/00_list_process_28.png new file mode 100644 index 0000000..6d30d39 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_28.png differ diff --git a/res/screen-density-xhigh/00_list_process_29.png b/res/screen-density-xhigh/00_list_process_29.png new file mode 100644 index 0000000..8d90522 Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_29.png differ diff --git a/res/screen-density-xhigh/00_list_process_30.png b/res/screen-density-xhigh/00_list_process_30.png new file mode 100644 index 0000000..e6e392f Binary files /dev/null and b/res/screen-density-xhigh/00_list_process_30.png differ diff --git a/res/screen-density-xhigh/T01-1_crop_rectangle.png b/res/screen-density-xhigh/T01-1_crop_rectangle.png new file mode 100644 index 0000000..6e89c37 Binary files /dev/null and b/res/screen-density-xhigh/T01-1_crop_rectangle.png differ diff --git a/res/screen-density-xhigh/T01_1_face_tag_icon_email.png b/res/screen-density-xhigh/T01_1_face_tag_icon_email.png new file mode 100644 index 0000000..fe2d41f Binary files /dev/null and b/res/screen-density-xhigh/T01_1_face_tag_icon_email.png differ diff --git a/res/screen-density-xhigh/T01_1_face_tag_icon_message.png b/res/screen-density-xhigh/T01_1_face_tag_icon_message.png new file mode 100644 index 0000000..44e0058 Binary files /dev/null and b/res/screen-density-xhigh/T01_1_face_tag_icon_message.png differ diff --git a/res/screen-density-xhigh/T01_Nocontents_broken.png b/res/screen-density-xhigh/T01_Nocontents_broken.png new file mode 100644 index 0000000..c200d0c Binary files /dev/null and b/res/screen-density-xhigh/T01_Nocontents_broken.png differ diff --git a/res/screen-density-xhigh/T01_Nocontents_picture.png b/res/screen-density-xhigh/T01_Nocontents_picture.png new file mode 100644 index 0000000..0f98480 Binary files /dev/null and b/res/screen-density-xhigh/T01_Nocontents_picture.png differ diff --git a/res/screen-density-xhigh/T01_album_edit_rename.png b/res/screen-density-xhigh/T01_album_edit_rename.png new file mode 100644 index 0000000..4a2a2ae Binary files /dev/null and b/res/screen-density-xhigh/T01_album_edit_rename.png differ diff --git a/res/screen-density-xhigh/T01_album_edit_rename_bg.png b/res/screen-density-xhigh/T01_album_edit_rename_bg.png new file mode 100644 index 0000000..01a75d8 Binary files /dev/null and b/res/screen-density-xhigh/T01_album_edit_rename_bg.png differ diff --git a/res/screen-density-xhigh/T01_album_icon_camera.png b/res/screen-density-xhigh/T01_album_icon_camera.png new file mode 100644 index 0000000..f3d63dd Binary files /dev/null and b/res/screen-density-xhigh/T01_album_icon_camera.png differ diff --git a/res/screen-density-xhigh/T01_album_icon_download.png b/res/screen-density-xhigh/T01_album_icon_download.png new file mode 100644 index 0000000..e424ba8 Binary files /dev/null and b/res/screen-density-xhigh/T01_album_icon_download.png differ diff --git a/res/screen-density-xhigh/T01_album_icon_folder.png b/res/screen-density-xhigh/T01_album_icon_folder.png new file mode 100644 index 0000000..1ef79e8 Binary files /dev/null and b/res/screen-density-xhigh/T01_album_icon_folder.png differ diff --git a/res/screen-density-xhigh/T01_btn_play.png b/res/screen-density-xhigh/T01_btn_play.png new file mode 100644 index 0000000..b25d19c Binary files /dev/null and b/res/screen-density-xhigh/T01_btn_play.png differ diff --git a/res/screen-density-xhigh/T01_button_circle_bg_normal.png b/res/screen-density-xhigh/T01_button_circle_bg_normal.png new file mode 100644 index 0000000..981d624 Binary files /dev/null and b/res/screen-density-xhigh/T01_button_circle_bg_normal.png differ diff --git a/res/screen-density-xhigh/T01_button_circle_bg_normal_press.png b/res/screen-density-xhigh/T01_button_circle_bg_normal_press.png new file mode 100644 index 0000000..bc5f8b2 Binary files /dev/null and b/res/screen-density-xhigh/T01_button_circle_bg_normal_press.png differ diff --git a/res/screen-density-xhigh/T01_button_rename.png b/res/screen-density-xhigh/T01_button_rename.png new file mode 100644 index 0000000..39c5de5 Binary files /dev/null and b/res/screen-density-xhigh/T01_button_rename.png differ diff --git a/res/screen-density-xhigh/T01_button_reveal.png b/res/screen-density-xhigh/T01_button_reveal.png new file mode 100644 index 0000000..973b0ea Binary files /dev/null and b/res/screen-density-xhigh/T01_button_reveal.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_addtag.png b/res/screen-density-xhigh/T01_controlbar_icon_addtag.png new file mode 100644 index 0000000..a554ce3 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_addtag.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_camera.png b/res/screen-density-xhigh/T01_controlbar_icon_camera.png new file mode 100644 index 0000000..e243ff2 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_camera.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_delete.png b/res/screen-density-xhigh/T01_controlbar_icon_delete.png new file mode 100644 index 0000000..2980bdc Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_delete.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_done.png b/res/screen-density-xhigh/T01_controlbar_icon_done.png new file mode 100644 index 0000000..46304a4 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_done.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_download.png b/res/screen-density-xhigh/T01_controlbar_icon_download.png new file mode 100644 index 0000000..0df0c27 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_download.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_edit.png b/res/screen-density-xhigh/T01_controlbar_icon_edit.png new file mode 100644 index 0000000..ed90f86 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_edit.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_more.png b/res/screen-density-xhigh/T01_controlbar_icon_more.png new file mode 100644 index 0000000..cda9b31 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_more.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_move.png b/res/screen-density-xhigh/T01_controlbar_icon_move.png new file mode 100644 index 0000000..99e3cd7 Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_move.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_save.png b/res/screen-density-xhigh/T01_controlbar_icon_save.png new file mode 100644 index 0000000..39baa6a Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_save.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_share02.png b/res/screen-density-xhigh/T01_controlbar_icon_share02.png new file mode 100644 index 0000000..f58e87e Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_share02.png differ diff --git a/res/screen-density-xhigh/T01_controlbar_icon_slideshow.png b/res/screen-density-xhigh/T01_controlbar_icon_slideshow.png new file mode 100644 index 0000000..79c2ebd Binary files /dev/null and b/res/screen-density-xhigh/T01_controlbar_icon_slideshow.png differ diff --git a/res/screen-density-xhigh/T01_grid_select_check.png b/res/screen-density-xhigh/T01_grid_select_check.png new file mode 100644 index 0000000..f131f47 Binary files /dev/null and b/res/screen-density-xhigh/T01_grid_select_check.png differ diff --git a/res/screen-density-xhigh/T01_icon_thumbnail_bookmark.png b/res/screen-density-xhigh/T01_icon_thumbnail_bookmark.png new file mode 100644 index 0000000..bdb690a Binary files /dev/null and b/res/screen-density-xhigh/T01_icon_thumbnail_bookmark.png differ diff --git a/res/screen-density-xhigh/T01_icon_thumbnail_favorite.png b/res/screen-density-xhigh/T01_icon_thumbnail_favorite.png new file mode 100644 index 0000000..aa9c8ef Binary files /dev/null and b/res/screen-density-xhigh/T01_icon_thumbnail_favorite.png differ diff --git a/res/screen-density-xhigh/T01_main_folder_bg.png b/res/screen-density-xhigh/T01_main_folder_bg.png new file mode 100644 index 0000000..16d1d59 Binary files /dev/null and b/res/screen-density-xhigh/T01_main_folder_bg.png differ diff --git a/res/screen-density-xhigh/T01_places_thumbnail_bg.png b/res/screen-density-xhigh/T01_places_thumbnail_bg.png new file mode 100644 index 0000000..5b0fb27 Binary files /dev/null and b/res/screen-density-xhigh/T01_places_thumbnail_bg.png differ diff --git a/res/screen-density-xhigh/T01_toolbar_icon_delete_dim_web.png b/res/screen-density-xhigh/T01_toolbar_icon_delete_dim_web.png new file mode 100644 index 0000000..08e773b Binary files /dev/null and b/res/screen-density-xhigh/T01_toolbar_icon_delete_dim_web.png differ diff --git a/res/screen-density-xhigh/T01_toolbar_icon_share_dim_web.png b/res/screen-density-xhigh/T01_toolbar_icon_share_dim_web.png new file mode 100644 index 0000000..47ee62e Binary files /dev/null and b/res/screen-density-xhigh/T01_toolbar_icon_share_dim_web.png differ diff --git a/res/screen-size-normal/IDL_DEL_PROGRESSING_POPUP.xml b/res/screen-size-normal/IDL_DEL_PROGRESSING_POPUP.xml new file mode 100644 index 0000000..3c470a0 --- /dev/null +++ b/res/screen-size-normal/IDL_DEL_PROGRESSING_POPUP.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_FORM_ALBUM_LIST.xml b/res/screen-size-normal/IDL_FORM_ALBUM_LIST.xml new file mode 100644 index 0000000..9c1b3fb --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_ALBUM_LIST.xml @@ -0,0 +1,21 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+
diff --git a/res/screen-size-normal/IDL_FORM_ALBUM_LIST_EDITOR.xml b/res/screen-size-normal/IDL_FORM_ALBUM_LIST_EDITOR.xml new file mode 100644 index 0000000..24abc78 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_ALBUM_LIST_EDITOR.xml @@ -0,0 +1,31 @@ + + + + + 720 +
+ + + + +
+ + + + + +
+
+ + + + +
+ +
diff --git a/res/screen-size-normal/IDL_FORM_ALBUM_NAME_EDITOR.xml b/res/screen-size-normal/IDL_FORM_ALBUM_NAME_EDITOR.xml new file mode 100644 index 0000000..011d6b6 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_ALBUM_NAME_EDITOR.xml @@ -0,0 +1,26 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+ + + + + +
diff --git a/res/screen-size-normal/IDL_FORM_FILE_LIST.xml b/res/screen-size-normal/IDL_FORM_FILE_LIST.xml new file mode 100644 index 0000000..a785490 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_FILE_LIST.xml @@ -0,0 +1,21 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+
diff --git a/res/screen-size-normal/IDL_FORM_FILE_LIST_EDITOR.xml b/res/screen-size-normal/IDL_FORM_FILE_LIST_EDITOR.xml new file mode 100644 index 0000000..ee99223 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_FILE_LIST_EDITOR.xml @@ -0,0 +1,26 @@ + + + + + 720 +
+ + + + +
+ + + + + +
+
+ + + + +
+
diff --git a/res/screen-size-normal/IDL_FORM_IMAGE_CROP.xml b/res/screen-size-normal/IDL_FORM_IMAGE_CROP.xml new file mode 100644 index 0000000..ff005c6 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_IMAGE_CROP.xml @@ -0,0 +1,18 @@ + + + + + + 720 +
+ + + + +
+ + +
+
diff --git a/res/screen-size-normal/IDL_FORM_SETTING_MAIN.xml b/res/screen-size-normal/IDL_FORM_SETTING_MAIN.xml new file mode 100644 index 0000000..502cb54 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_SETTING_MAIN.xml @@ -0,0 +1,22 @@ + + + + + 720 +
+ + + + +
+ + +
+ + + + + +
diff --git a/res/screen-size-normal/IDL_SLIDESHOW_SETTING_POPUP.xml b/res/screen-size-normal/IDL_SLIDESHOW_SETTING_POPUP.xml new file mode 100644 index 0000000..b70e9b0 --- /dev/null +++ b/res/screen-size-normal/IDL_SLIDESHOW_SETTING_POPUP.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/res/slk-SK.xml b/res/slk-SK.xml new file mode 100644 index 0000000..3dd8fad --- /dev/null +++ b/res/slk-SK.xml @@ -0,0 +1,99 @@ + + + + Bol dosiahnutý maximálny počet znakov + Prezentácia + Prekročil sa maximálny počet súborov + Nastavenia prezentácie + Vybrať všetky + Odstrániť? + Upraviť + Správa + Stiahnuté položky + Názov albumu sa už používa + Uložiť + 20 sekúnd + Aktivácia + Otočiť doľava + 2 sekundy + Správy + Hotovo + Nedá sa premenovať + E-mail + Neplatné znaky + Presunuté + Zrušiť + Vybrané + Odstrániť + Titulky + Zrušiť + Dosiahol sa maximálny počet znakov (%d) + Dosiahol sa maximálny počet znakov (%d) + Prezent. + Vysunutie + Spustiť prezentáciu + %s už existuje + Načítava sa... + Albumy + Nedá sa premenovať. Názov albumu sa už používa + Operácia zlyhala + Ukladanie... + Efekt prechodu + Hudba + Vybraté položky: %d + Vytvoriť priečinok? + Vymazanie sa nepodarilo + 1 vybratá položka + Video + Zoom + Kopírovať + Clona + Interval prezentácie + Prehrávač videí + Prezentácia + sekundy + Otočiť doľava + Stránka + Kopírovanie... + 10 sekúnd + Prebieha spracovanie... + Galéria + Žiadny názov + Obrázky + Stmievanie + Upraviť + 5 sekúnd + Nie sú vybraté žiadne položky + Odstránené + Odstrániť? + Už existuje. Prepísať? + Odstraňovanie... + Hotovo + 3 sekundy + Kat. fotoaparátu + Otočiť doprava + Opakovať + Uložené + Prelínanie + Náhodné poradie + Presúvanie... + Presunutie sa nepodarilo + Videá + Nepodporovaný typ súboru + Premenovať + Dokončené + Vybrať vš. + Všetky albumy + Zmeniť názov + Presunúť + Nedá sa odstrániť + Otočiť doprava + Interval + Už existuje + Vytvoriť album + Žiadne položky + Roleta + Uloženie sa nepodarilo + diff --git a/res/slv-SI.xml b/res/slv-SI.xml new file mode 100644 index 0000000..629b2dd --- /dev/null +++ b/res/slv-SI.xml @@ -0,0 +1,99 @@ + + + + Doseženo je največje dovoljeno število znakov + Diaprojekcija + Največje dovoljeno število datotek je preseženo + Nastavitve diaprojekcije + Izberi vse + Izbrišem? + Uredi + Sporočilo + Prenosi + Ime albuma se že uporablja + Shrani + 20 sekund + Vklop + Zavrti v levo + 2 sekundi + Sporočila + Končano + Ni mogoče preimenovati + E-pošta + Neveljavni znaki + Premaknjeno + Prekliči + Izbrano + Izbriši + Podnapisi + Prekliči + Doseženo je največje število znakov (%d) + Doseženo je največje število znakov (%d) + Diaproj. + Prehod + Začni diaprojekcijo + %s že obstaja + Nalaganje... + Albumi + Ni mogoče preimenovati. Ime albuma se že uporablja + Postopek ni uspel + Shranjujem + Učinek prehoda + Glasba + %d predmetov izbranih + Ustvarim mapo? + Brisanje ni uspelo + 1 predmet je izbran + Video + Povečava + Kopiraj + Mavrica + Interval diaprojekcije + Video predvajalnik + Diaprojekcija + sekund + Zavrti v levo + Stran + Kopiram ... + 10 sekund + Obdelujem... + Galerija + Brez imena + Slike + Zatemnitev + Uredi + 5 sekund + Ni izbranih predmetov + Izbrisano + Odstranim? + Že obstaja. Prepišem? + Brišem + Končano + 3 sekunde + Mapa s slikami + Zavrti v desno + Ponovi + Shranjeno + Raztopi + Naključno + Premikam + Premikanje ni uspelo + Videoposnetki + Nepodprta vrsta datoteke + Preimenuj + Končano + Izberi vse + Vsi albumi + Spremeni ime + Premakni + Brisanje ni mogoče + Zavrti v desno + Interval + Že obstaja + Ustvari album + Ni predmetov + Zastor + Shranjevanje ni uspelo + diff --git a/res/spa-ES.xml b/res/spa-ES.xml new file mode 100644 index 0000000..650c027 --- /dev/null +++ b/res/spa-ES.xml @@ -0,0 +1,99 @@ + + + + Alcanzado el número máximo de caracteres + Presentación de diapositivas + Alcanzado el número máximo de archivos + Configuración de presentación de diapositivas + Seleccionar todo + ¿Eliminar? + Editar + Mensajes + Descargas + Nombre de álbum ya en uso + Guardar + 20 segundos + Activación + Girar a la izquierda + 2 segundos + Mensajes + Hecho + Imposible cambiar el nombre + Correo electrónico + Caracteres no válidos + Movido + Cancelar + Seleccionado + Eliminar + Subtítulos + Cancelar + Número máximo de caracteres (%d) alcanzado + Número máximo de caracteres (%d) alcanzado + Pres diap + Diapositiva + Iniciar presentación de diapositivas + %s ya existe + Cargando... + Álbumes + No se puede cambiar el nombre. Nombre de álbum ya en uso + Error de funcionamiento + Guardando... + Efecto de transición + Música + %d elementos seleccionados + ¿Crear carpeta? + Error al borrar + 1 elemento seleccionado + Vídeo + Zoom + Copiar + Iris + Intervalo de presentación de diapositivas + Reproductor de vídeo + Presentación de diapositivas + segundos + Girar a la izquierda + Página + Copiando... + 10 segundos + Procesando... + Galería + Sin nombre + Imágenes + Desaparición + Editar + 5 segundos + Ningún elemento seleccionado + Eliminado + ¿Eliminar? + Ya existe. ¿Desea reemplazarlo? + Eliminando... + Eliminar + 3 segundos + Carrete + Girar a la derecha + Repetir + Guardado + Fundir + Reproducción aleatoria + Moviendo... + Error al mover + Vídeos + Tipo de archiv no admitido + Renombrar + Finalizado + Seleccionar todo + Todos los álbumes + Cambiar nombre + Mover + No se puede eliminar + Girar a la derecha + Intervalo + Ya existe + Crear álbum + Ningún elemento + Efecto persiana + Error al guardar + diff --git a/res/spa-MX.xml b/res/spa-MX.xml new file mode 100644 index 0000000..95c416c --- /dev/null +++ b/res/spa-MX.xml @@ -0,0 +1,99 @@ + + + + Se ha alcanzado el número máximo de caracteres + Presentación de diapositivas + Se ha excedido el número máximo de archivos + Configuración de presentación de diapositivas + Todo + ¿Eliminar? + Editar + Mensaje + Descargas + Nombre de álbum ya existe + Guardar + 20 segundos + Activación + Girar a la izquierda + 2 segundos + Mensajes + Realizado + No se puede renombrar + Correo + Caracteres no válidos + Movido + Cancelar + Seleccionado + Eliminar + Subtítulos + Cancelar + Número máximo de caracteres (%d) alcanzado + Número máximo de caracteres (%d) alcanzado + Pres diap + Deslizar + Iniciar presentación de diapositivas + %s ya existe + Cargando... + Álbumes + No se puede renombrar. Nombre de álbum ya existe + Error de funcionamiento + Guardando... + Efecto de transición + Música + %d elementos seleccionados + crear carpeta? + Error al eliminar + 1 elemento seleccionado + Video + Zoom + Copiar + Iris + Intervalo de presentación de diapositivas + Reproductor de Video + Presentación de diapositivas + segundos + Girar a la izquierda + Página + Copiando... + 10 segundos + Procesando... + Galería + Sin nombre + Imágenes + Aparecer + Editar + 5 segundos + No se ha seleccionado nada + Eliminado + ¿Eliminar? + Ya existe. ¿Desea sustituirlo? + Eliminando... + Realizado + 3 segundos + Carrete + Girar a la derecha + Repetir + Guardado + Fundir + Aleatorio + Moviendo… + Error al mover + Videos + Tipo de arch. no admitido + Renombrar + Completo + Todo + Todos los álbumes + Renombrar + Mover + No puede eliminar + Girar a la derecha + Intervalo + Ya existe + Crear álbum + Ningún elemento + Persiana + Error al guardar + diff --git a/res/srp-RS.xml b/res/srp-RS.xml new file mode 100644 index 0000000..02c2fd1 --- /dev/null +++ b/res/srp-RS.xml @@ -0,0 +1,99 @@ + + + + Dostignut maksimalan broj karaktera + Slajd-šou + Dostignut je maksimalan broj fajlova + Podešavanja za slajd-šou + Izaberi sve + Obriši? + Izmeni + Poruka + Preuzimanja + Naziv albuma već u upotr. + Sačuvaj + 20 sekundi + Aktivacija + Rotiraj ulevo + 2 sekunde + Poruke + Gotovo + Nemoguće preimenovati + E-pošta + Neispravni karakteri + Premešteno + Poništi + Označeno + Obriši + Titlovi + Poništi + Dostignut maksimalan broj karaktera (%d) + Dostignut maksimalan broj karaktera (%d) + Slajd-šou + Slajd + Pokreni slajd-šou + %s već postoji + Učitavanje... + Albumi + Nemoguće preimenovati. Naziv albuma već u upotrebi + Operacija neuspešna + Memorisanje... + Efekat prelaza + Muzika + %d stavke/i označene/o + Kreiraj folder? + Brisanje neuspešno + 1 stavka izabrana + Video zapis + Zumiranje + Kopiraj + Iris + Interval za slajd-šou + Video plejer + Slajd-šou + sekunde + Rotiraj ulevo + Strana + Kopiranje... + 10 sekundi + Obrada... + Galerija + Nema imena + Slike + Izbledi + Izmeni + 5 sekundi + Nema izabranih stavki + Obrisano + Ukloni? + Već postoji. Prebriši? + Brisanje... + Gotovo + 3 sekunde + Traka kamere + Rotiraj udesno + Ponovi + Sačuvano + Rastvori + Nasumično + Premeštanje + Premeštanje neuspešno + Video zapisi + Nepodržani tip fajla + Preimenuj + Završeno + Izab. sve + Svi albumi + Promeni ime + Premesti + Nemoguće obrisati + Rotiraj udesno + Interval + Već postoji + Kreiraj album + Nema stavki + Roletna + Memorisanje neuspešno + diff --git a/res/swe-SE.xml b/res/swe-SE.xml new file mode 100644 index 0000000..951e9bf --- /dev/null +++ b/res/swe-SE.xml @@ -0,0 +1,99 @@ + + + + Maximalt antal tecken har använts + Bildspel + Högstsa antal filer har överskridits + Bildspelsinställningar + Välj alla + Radera? + Redigera + Meddelande + Nedladdningar + Albumnamnet används redan + Spara + 20 sekunder + Aktivera + Rotera moturs + 2 sekunder + Meddelanden + Klar + Kan inte byta namn + E-post + Ogiltiga tecken + Flyttad + Avbryt + Markerade + Radera + Textning + Avbryt + Högsta antal tecken (%d) har uppnåtts + Högsta antal tecken (%d) har uppnåtts + Bildspel + Bild + Starta bildspel + %s finns redan + Laddar... + Album + Kan inte byta namn. Albumnamnet används redan + Åtgärden misslyckades + Sparar... + Övergångseffekt + Musik + %d objekt valda + Skapa mapp? + Radering misslyckades + 1 valt objekt + Videoklipp + Zoom + Kopiera + Iris + Bildspelsintervall + Videospelare + Bildspel + sekunder + Rotera moturs + Sida + Kopierar... + 10 sekunder + Bearbetar... + Galleri + Inget namn + Bilder + Tona + Redigera + 5 sekunder + Inga objekt valda + Raderad + Ta bort? + Används redan.\nSkriv över? + Raderar... + Klar + 3 sekunder + Kamerarulle + Rotera medurs + Upprepa + Sparad + Lös upp + Blanda + Flyttar... + Det gick inte att flytta + Videoklipp + Filtypen stöds ej + Byt namn + Slutförd + Välj allt + Alla album + Byt namn + Flytta + Kan inte radera + Rotera medurs + Intervall + Finns redan + Skapa album + Inga objekt + Fördragning + Det gick inte att spara + diff --git a/res/tha-TH.xml b/res/tha-TH.xml new file mode 100644 index 0000000..d1abb35 --- /dev/null +++ b/res/tha-TH.xml @@ -0,0 +1,99 @@ + + + + จำนวนตัวอักษรเกินขอบเขต + เลื่อนชม + เกิน​จำนวน​ไฟล์​สูง​สุด​แล้ว + การ​กำหนด​การ​แสดง​สไลด์ + เลือก​ทั้ง​หมด + ลบ? + แก้ไข + ข้อ​ความ + ดาวน์​โหลด + ชื่อ​อัลบั้ม​ใช้​อยู่​แล้ว + บันทึก + 20 ​วินาที + ใช้​งาน + หมุน​ซ้าย + 2 ​วินาที + ข้อความ + เรียบร้อย + เปลี่ยน​ชื่อ​ไม่​ได้ + อีเมล์ + อักขระ​ไม่​ถูก​ต้อง + ย้าย​เรียบ​ร้อย + ยก​เลิก + เลือก + ลบ + คำ​บรรยาย + ยก​เลิก + ถึง​จำนวน​ตัว​อักษร​สูง​สุด (%d) + ถึง​จำนวน​ตัว​อักษร​สูง​สุด (%d) + สไลด์​โชว์ + สไลด์ + เริ่ม​การ​แสดง​สไลด์ + %s มีอยู่แล้ว + โหลด... + อัลบั้ม + ไม่​สามารถ​เปลี่ยน​ชื่อ ชื่อ​อัลบั้ม​ใช้​อยู่​แล้ว + การ​ทำ​งาน​ล้ม​เหลว + บันทึก...   + เอ​ฟเฟ็กต์​การ​เปลี่ยน + เพลง + เลือก %d ​รายการแล้ว + สร้าง​แฟ้มใหม่? + ลบ​ผิด​พลาด + เลือก 1 ​รายการ + วี​ดี​โอ + ซูม + คัด​ลอก + ไอ​ริ​ส + ช่วง​เวลา​การ​แสดง​แบบ​สไลด์ + เครื่อง​เล่น​วีดีโอ + สไลด์โชว์ + วินาที + หมุน​ซ้าย + หน้า + กำลัง​คัด​ลอก... + 10 วินาที + ดำเนิน​การ... + แกลเลอรี่ + ไม่​มี​ชื่อ + รูป​ภาพ + จางหายไป + แก้ไข + 5 ​วินาที + ไม่​มี​รายการ​ที่​เลือก + ลบ​แล้ว + ลบ? + มี​อยู่​แล้ว เขียน​ทับ? + ลบ... + เรียบร้อย + 3 วินาที + การ​หมุน​กล้อง + หมุน​ขวา + ซ้ำ + บันทึก\nเรียบร้อย + ละลาย + สับ​เพลง + กำลัง​ย้าย... + การ​ย้าย\n​ผิด​พลาด + วี​ดี​โอ + ไม่​รอง​รับ​\nชนิด​ไฟล์ + เปลี่ยน​ชื่อ + เรียบ​ร้อย + เลือก​หมด + อัลบั้ม​ทั้ง​หมด + เปลี่ยน​ชื่อ + ย้าย + ลบ​ไม่​ได้ + หมุน​ขวา + ช่วง​เวลา + มี​อยู่​แล้ว + สร้าง​อัลบั้ม​ใหม่ + ไม่มีรายการ + บัง + การ​บันทึก​ผิด​พลาด + diff --git a/res/tur-TR.xml b/res/tur-TR.xml new file mode 100644 index 0000000..0c7cd7b --- /dev/null +++ b/res/tur-TR.xml @@ -0,0 +1,99 @@ + + + + Maksimum karakter sayısına ulaşıldı + Slayt gösterisi + Maksimum dosya sayısı aşıldı + Slayt gösterisi ayarları + Hepsini seç + Sil? + Düzenle + Mesaj + İndirilenler + Albüm adı zaten kullanılıyor + Kaydet + 20 saniye + Etkinleştirme + Saat yönünün tersine döndür + 2 saniye + Mesajlar + Kaydet + Yeniden adlandırılamıyor. Dosya kullanımda. + E-posta + Geçersiz karakter + Taşındı + İptal + Seçili + Sil + Altyazılar + İptal + Maksimum karakter sayısına (%d) ulaşıldı + Maksimum karakter sayısına (%d) ulaşıldı + Slayt şov + Slayt + Slayt gösterisini başlat + %s zaten var + Yükleniyor... + Albümler + Yeniden adlandırılamıyor. Albüm adı zaten kullanılıyor + İşlem başarısız + Kaydediliyor… + Geçiş efekti + Müzik + %d öğe seçildi + Klasör oluşturulsun mu? + Silinemedi + 1 öğe seçildi + Video + Yakınlaştır + Kopyala + İris + Slayt gösterisi aralığı + Video Oynatıcı + Slayt gösterisi + saniye + Saat yönünün tersine döndür + Sayfa + Kopyalanıyor... + 10 saniye + Uygulanıyor... + Galeri + İsim yok + Resimler + Soldur + Düzenle + 5 saniye + Seçili öğe yok + Silindi + Kaldır? + Zaten var. Üzerine yazılsın mı? + Siliniyor... + Tamamlandı + 3 saniye + Kamera klasörü + Saat yönünde döndür + Tekrarla + Kaydedildi + Çöz + Karışık + Taşıyor... + Taşıma başarısız + Videolar + Desteklenmeyen dosya türü + Yeniden adlandır + Tamamlandı + Tümünü seç + Tüm albümler + İsim değiştir + Taşı + Silinemiyor + Saat yönünde döndür + Aralık + Zaten var + Albüm oluştur + Öğe yok + Kör + Kaydetme başarısız + diff --git a/res/ukr-UA.xml b/res/ukr-UA.xml new file mode 100644 index 0000000..f950606 --- /dev/null +++ b/res/ukr-UA.xml @@ -0,0 +1,99 @@ + + + + Досягнуто максимальної кількості символів + Слайд-шоу + Перевищено максимальну кількість файлів + Установки слайд-шоу + Вибрати всі + Видалити? + Редагувати + Повідомлення + Завантаження + Ім’я альбому вже викор. + Зберегти + 20 секунд + Активація + Обернути ліворуч + 2 секунди + Повідомлення + Готово + Неможливо перейменувати + Email + Хибні символи + Переміщено + Скасувати + Вибране + Видалити + Субтитри + Скасувати + Досягнуто максимальної кількості символів: %d + Досягнуто максимальної кількості символів: %d + Слайд-шоу + Слайд + Розпочати слайд-шоу + %s вже існує + Завантаження... + Альбоми + Неможливо перейменувати. Ім’я альбому вже використовується + Збій операції + Збереження... + Ефект переходу + Музика + Вибрано %d об’єктів + Створити папку? + Збій видалення + Вибрано 1 об’єкт + Відео + Масштаб + Копіювати + Ірісова діафрагма + Інтервал слайд-шоу + Відеоплеєр + Слайд-шоу + секунди + Обернути ліворуч + Сторінка + Копіювання... + 10 секунд + Обробка... + Галерея + Немає імені + Зображення + Загасання + Редагувати + 5 секунд + Об’єкти не вибрані + Видалено + Видалити? + Вже існує. Переписати? + Видалення... + Готово + 3 секунди + Плівка камери + Обернути праворуч + Повторення + Збережено + Розчинення + Випадковий порядок + Переміщення... + Збій переміщення + Відео + Непідтримуваний тип файла + Перейменувати + Завершено + Вибр. всі + Усі альбоми + Змінити ім'я + Перемістити + Неможливо видалити + Обернути праворуч + Інтервал + Вже існує + Створити альбом + Немає об’єктів + Жалюзі + Збій збереження + diff --git a/res/urd-IN.xml b/res/urd-IN.xml new file mode 100644 index 0000000..e648629 --- /dev/null +++ b/res/urd-IN.xml @@ -0,0 +1,99 @@ + + + + کریکٹر کی حد ہو گئی + سلائیڈ شو + فائلوں کی زیادہ سے زیادہ تعداد تجاوز کرگئی + سلائڈ شو سیٹنگیں + تمام منتخب کریں + مٹانا؟ + تبدیلی + پیغام + ڈاؤن لوڈز + البم نام پہلے استعمال میں + محفوظ + 20 سیکنڈز + ایکٹیویشن + بائيں گھمائيں + 2 سیکینڈ + پیغامات + ٹھیک ہے + نیا نام دینے سے قاصر + ای میل + ناجائز حروف + منتقل ہوا + منسوخ + انتخاب ہوگیا + مٹانا + ذیلی عنوانات + منسوخ + حروف کی انتہائی تعداد (%d) آن پہنچی + حروف کی انتہائی تعداد (%d) آن پہنچی + سلائڈ شو + سلائیڈ + سلائڈ شو شروع کریں + %s پہلے سے موجود ہے + لوڈنگ... + البمز + نیا نام دینے سے قاصر۔ البم نام پہلے سے استعمال میں ہے + عملیہ ناکام ہوگیا + محفوظ۔۔۔ + تبدیل کا اثر + میوزک + %d اشیا منتخب ہوگئیں + فولڈر تخلیق کریں؟ + مٹانا فیل + 1 شے منتخب ہوگئی + ویڈیو + زوم + کاپی + Iris + وقفہ سلائڈ شو + ویڈیو پلیئر + سلائڈ شو + سیکنڈز + بائيں گھمائيں + صفحہ + کاپی ہورہی ہے... + 10 سیکنڈز + پروسیسنگ + گیلری + نام نہیں + تصویر + فیڈ + تبدیلی + 5 سیکنڈز + کوئی آئٹم پشند نہیں کیا + مٹ گیا + مٹائیں؟ + پہلے سے موجود ہے۔ اس کے اوپر لکھیں؟ + مٹ رہا ہے... + ٹھیک ہے + 3 سیکینڈ + کیمرا رول کریں + دائيں طرف گھمائيں + دھرائیں + محفوظ ہوا + گھل جانا + شفل + بھیج رہا ہے... + ہلانے فیل + ویڈیوز + غیر تائید کردہ فائل قسم + نام بدلیں + مکمل + سب منتخب + تمام البمز + نام میں تبدیلی + منتقل + مٹا نہیں سکا + دائيں طرف گھمائيں + وقفہ + پہلے سے موجود + البم تخلیق کریں + ائیٹمز نہیں ہے + چلمن + مہفوظ کرنا فیل + diff --git a/res/uzb-UZ.xml b/res/uzb-UZ.xml new file mode 100644 index 0000000..690a353 --- /dev/null +++ b/res/uzb-UZ.xml @@ -0,0 +1,99 @@ + + + + Belgilar soni ruxsat etilgan maksimal miqdorga yetdi + Slayd-shou + Fayllar soni maksimal miqdordan oshib ketdi + Slayd-shou parametrlari + Barchasini tanlash + O'chirilsinmi? + Tahrirlash + Xabar + Yuklanishlar + Albom nomi ishlatilmoqda + Saqlash + 20 soniya + Faollashtirish + Chapga aylantir. + 2 soniya + Xabarlar + Bajarildi + Nomini o‘zgartirib bo‘lmaydi + E-pochta + Mumkin bo‘lmagan belgilar + Ko‘chirilgan + Bekor qilish + Tanlangan + O'chirish + Tagsarlavhalar + Bekor qilish + Belgilar soni ruxsat etilgan maksimal miqdorga (%d) yetdi + Belgilar soni ruxsat etilgan maksimal miqdorga (%d) yetdi + Slayd-shou + Slayd + Slayd-shouni boshlash + %s avvaldan mavjud + Yuklanmoqda... + Albom + Nomni o‘zgartirib bo‘lmaydi. Albom nomi avvaldan ishlatilmoqda + Operatsiya bajarilmadi + Saqlanmoqda... + Almashuvchi effekt + Musiqa + %d element tanlangan + Jild yaratilsinmi? + Yo‘q qilish bajarilmadi + 1 element tanlangan + Video + Masshtabni o‘zgartirish + Nusxa olish + Gulsapsar + Slayd-shou intervali + Video pleyer + Slayd-shou + soniya + Chapga aylantir. + Sahifa + Nusxa ko‘chirilmoqda... + 10 soniya + Bajarilmoqda... + Galereya + Nom yo‘q + Tasvirlar + Xiralashish + Tahrirlash + 5 soniya + Element tanlanmagan + O'chirildi + Olib tashlansinmi? + Avvaldan mavjud. Ustidan yozilsinmi? + O'chirilmoqda… + Bajarildi + 3 soniya + Kamera roli + O‘ngga aylantir. + Takrorlash + Saqlandi + Erish + Tasodifiy + Ko‘chirilmoqda... + Ko‘chirib bo‘lmadi + Videolar + Quvvat-maydigan fayl turi + Nom o‘zgartirish + Yakunlandi + Bar. tanla + Barcha albomlar + Nomni o‘zgartirish + Ko‘chirish + Yo‘q qilib bo‘lmaydi + O‘ngga aylantir. + Interval + Avvaldan mavjud + Albom yaratish + Elementlar yo‘q + Jalyuzi + Saqlab bo‘lmadi + diff --git a/res/zho-CN.xml b/res/zho-CN.xml new file mode 100644 index 0000000..d579042 --- /dev/null +++ b/res/zho-CN.xml @@ -0,0 +1,99 @@ + + + + 已达到最大字符限制 + 幻灯片 + 已超过最大文件数 + 幻灯片播放设定 + 全选 + 删除? + 编辑 + 信息 + 下载列表 + 相册名已使用 + 存储 + 20 秒 + 激活 + 向左旋转 + 2 秒 + 信息 + 完成 + 无法重命名 + 电子邮件 + 字符无效 + 已移动 + 取消 + 已选择 + 删除 + 字幕 + 取消 + 已达到最大字符数(%d) + 已达到最大字符数(%d) + 幻灯片 + 幻灯片 + 开始播放幻灯片 + %s 已存在 + 载入中… + 相册 + 无法重命名。相册名已使用 + 操作失败 + 正在保存... + 转换效果 + 音乐 + 已选择%d个项目 + 创建文件夹吗? + 删除失败 + 已选择1个项目 + 录像 + 缩放 + 复制 + 彩色效果 + 幻灯片播放间隔 + 视频播放器 + 幻灯片 + 秒 + 向左旋转 + 页面 + 正在复制... + 10 秒 + 处理中... + 图库 + 无名称 + 图片 + 淡出 + 编辑 + 5 秒 + 未选择项目 + 已删除 + 移除? + 已存在。覆盖? + 删除中.. + 完成 + 3 秒 + 滚动照相机 + 向右旋转 + 重复 + 已保存 + 溶解 + 随机播放 + 移动中... + 移动失败 + 视频 + 不支持的文件类型 + 重命名 + 已完成 + 选择全部 + 所有相册 + 更改名称 + 移动 + 无法删除 + 向右旋转 + 间隔 + 已经存在 + 新建相册 + 无项目 + 百叶窗 + 储存失败 + diff --git a/res/zho-HK.xml b/res/zho-HK.xml new file mode 100644 index 0000000..c98e831 --- /dev/null +++ b/res/zho-HK.xml @@ -0,0 +1,99 @@ + + + + 字元數目已達上限 + 投影片播放 + 已超過檔案數量上限 + 投影片設定 + 選擇全部 + 刪除嗎? + 編輯 + 訊息 + 下載項目 + 相簿名稱已使用 + 儲存 + 20 秒 + 啟動 + 左轉 + 2 秒 + 訊息 + 完成 + 無法重新命名 + 電子郵件 + 字元無效 + 已移動 + 取消 + 已選擇 + 刪除 + 字幕 + 取消 + 已達字元數目上限 (%d) + 已達字元數目上限 (%d) + 投影片放映 + 滑動 + 開始播放投影片 + %s 已存在 + 正在載入... + 相薄 + 無法重新命名。相簿名稱已使用 + 操作失敗 + 正在儲存... + 過場效果 + 音樂 + 已選擇 %d 個項目 + 要建立資料夾嗎? + 刪除失敗 + 已選擇 1 個項目 + 影片 + 縮放 + 複製 + 光圈 + 投影片間隔 + 影片播放器 + 投影片 + 秒 + 左轉 + 頁面 + 正在複製... + 10 秒 + 正在處理... + 媒體瀏覽器 + 無名稱 + 圖像 + 褪色 + 編輯 + 5 秒 + 未選擇項目 + 已刪除 + 要移除嗎? + 已存在。要覆蓋嗎? + 正在刪除... + 完成 + 3 秒 + 相簿 + 右轉 + 重複 + 已儲存 + 融化 + 隨機播放 + 正在移動... + 移動失敗 + 影片 + 不支援的檔案類型 + 重新命名 + 已完成 + 選擇全部 + 全部專輯 + 更改名稱 + 移動 + 無法刪除 + 右轉 + 間隔 + 已存在 + 建立相簿 + 無項目 + 百葉窗 + 儲存失敗 + diff --git a/res/zho-SG.xml b/res/zho-SG.xml new file mode 100644 index 0000000..9e4ffef --- /dev/null +++ b/res/zho-SG.xml @@ -0,0 +1,99 @@ + + + + 已达最大字符数量 + 幻灯片播放 + 已超过最大文件数 + 幻灯片播放设定 + 全选 + 删除? + 编辑 + 讯息 + 下载 + 相册名已使用 + 储存 + 20秒 + 启动 + 向左旋转 + 2秒 + 讯息 + 已完成 + 无法重命名 + 电邮 + 字符无效 + 已移动 + 取消 + 已选定 + 删除 + 说明字幕 + 取消 + 已达到最大字符数(%d) + 已达到最大字符数(%d) + 幻灯片 + 滑动 + 开始播放幻灯片 + %s 已存在 + 裝载中… + 相册 + 无法重命名。相册名已使用 + 操作失败 + 储存中… + 转换效果 + 音乐 + 已选择%d个项目 + 创建文件夹吗? + 删除失败 + 已选择1个项目 + 录像 + 变焦 + 复制 + Iris 效果 + 幻灯片播放间隔 + 视频播放器 + 幻灯片 + 秒 + 向左旋转 + 页面 + 复制中… + 10 秒 + 处理中… + 画廊 + 无名称 + 图像 + 淡出 + 编辑 + 5秒 + 未选择项目 + 已删除 + 移除? + 已存在。覆盖? + 删除中… + 已完成 + 3秒 + 滚动照相机 + 向右旋转 + 重复 + 已储存 + 溶化 + 随机播放 + 移动中… + 移动失败 + 录像 + 不支持的文件类型 + 重命名 + 已完成 + 选择全部 + 所有相册 + 更改名称 + 移动 + 无法删除 + 向右旋转 + 间隔 + 已经存在 + 新建相册 + 无项目 + 百叶窗 + 储存失败 + diff --git a/res/zho-TW.xml b/res/zho-TW.xml new file mode 100644 index 0000000..5f8c14b --- /dev/null +++ b/res/zho-TW.xml @@ -0,0 +1,99 @@ + + + + 已達字元數上限 + 投影片放映 + 已超過檔案數量上限 + 投影片設定 + 全選 + 要刪除嗎? + 編輯 + 訊息 + 下載 + 相簿名稱已被使用 + 儲存 + 20 秒 + 啟動 + 向左旋轉 + 2 秒 + 訊息 + 完成 + 無法重新命名 + 電子郵件 + 字元無效 + 已移動 + 取消 + 已選擇 + 刪除 + 字幕 + 取消 + 達到%d個最大字元 + 達到%d個最大字元 + 投影片放映 + 投影片 + 開始播放投影片 + %s 已存在 + 正在載入... + 相簿 + 無法重新命名。相簿名稱已被使用 + 操作失敗 + 正在儲存... + 轉換效果 + 音樂 + 已選擇 %d 項目 + 要建立資料夾嗎? + 刪除失敗 + 已選擇 1 項目 + 影片 + 縮放 + 複製 + 光圈 + 投影片放映間隔 + 影片播放器 + 投影片 + 秒 + 向左旋轉 + 頁面 + 正在複製... + 10 秒 + 正在處理... + 媒體瀏覽器 + 無姓名 + 圖像 + 淡化 + 編輯 + 5 秒 + 無已選項目 + 已刪除 + 要移除嗎? + 已存在。要覆寫嗎? + 正在刪除... + 完成 + 3 秒 + 相簿 + 向右旋轉 + 重複 + 已儲存 + 分解 + 隨機播放 + 正在移動... + 移動失敗 + 影片 + 不支援的檔案類型 + 重新命名 + 已完成 + 選擇所有 + 所有相簿 + 變更名稱 + 移動 + 無法刪除 + 向右旋轉 + 間隔 + 已存在 + 建立專輯 + 無項目 + 百頁窗 + 儲存失敗 + diff --git a/shared/data/GalleryDefaultSettings.ini b/shared/data/GalleryDefaultSettings.ini new file mode 100644 index 0000000..6a88ee0 --- /dev/null +++ b/shared/data/GalleryDefaultSettings.ini @@ -0,0 +1,5 @@ +#IMAGE_VIEWER_SETTING +SLIDESHOW_INTERVAL_VALUE=3 +TRANSITION_EFFECT_VALUE=0 +REPEAT_VALUE=0 +SHUFFLE_VALUE=0 \ No newline at end of file diff --git a/shared/res/screen-density-xhigh/mainmenu.png b/shared/res/screen-density-xhigh/mainmenu.png new file mode 100644 index 0000000..34aacd0 Binary files /dev/null and b/shared/res/screen-density-xhigh/mainmenu.png differ diff --git a/shared/trusted/nofile.dummy b/shared/trusted/nofile.dummy new file mode 100644 index 0000000..e69de29 diff --git a/src/GlAlbumInfo.cpp b/src/GlAlbumInfo.cpp new file mode 100644 index 0000000..5225570 --- /dev/null +++ b/src/GlAlbumInfo.cpp @@ -0,0 +1,388 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumInfo.cpp + * @brief This is the implementation file for AlbumInfo class. + */ + +#include "GlAlbumInfo.h" +#include "GlTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; + +AlbumInfo::AlbumInfo(void) + : __pDirectoryFullPathList(null) + , __pContentIdList(null) + , __pFolderThumnailBitmap(null) +{ +} + +AlbumInfo::~AlbumInfo(void) +{ + if (__pDirectoryFullPathList != null) + { + delete __pDirectoryFullPathList; + } + + if (__pContentIdList != null) + { + delete __pContentIdList; + } + + if (__pFolderThumnailBitmap != null) + { + delete __pFolderThumnailBitmap; + } +} + +String +AlbumInfo::GetAlbumName(void) const +{ + String returnValue; + if ((__albumName != null) && (__albumName.GetLength() > 0)) + { + returnValue = __albumName; + } + + return returnValue; +} + +void +AlbumInfo::SetAlbumName(const String& albumName) +{ + if (&albumName == null) + { + __albumName = EMPTY_SPACE; + } + else + { + __albumName = String(albumName); + } +} + +String +AlbumInfo::GetDirectory(int index) const +{ + String fullDirPath = *(static_cast(__pDirectoryFullPathList->GetAt(index))); + return fullDirPath; +} + +IList* +AlbumInfo::GetDirectoryListN(void) const +{ + if (__pDirectoryFullPathList == null) + { + return null; + } + + IList* pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + IEnumerator* pEnum = __pDirectoryFullPathList->GetEnumeratorN(); + String* pItem = null; + while (pEnum->MoveNext() == E_SUCCESS) + { + pItem = new (std::nothrow) String((static_cast(pEnum->GetCurrent()))->GetPointer()); + pDirectoryFullPathList->Add(pItem); + } + delete pEnum; + + return pDirectoryFullPathList; +} + +void +AlbumInfo::ClearDirectoryList(void) +{ + if (__pDirectoryFullPathList != null) + { + delete __pDirectoryFullPathList; + } + + __pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter); +} + +void +AlbumInfo::AppendDirectory(const String& directoryPath) +{ + if (&directoryPath == null || directoryPath == EMPTY_SPACE) + { + return; + } + + if (__pDirectoryFullPathList == null) + { + __pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter); + } + + __pDirectoryFullPathList->Add(new (std::nothrow) String(directoryPath)); +} + +void +AlbumInfo::AppendDirectoryList(const ICollection& directoryList) +{ + if (&directoryList == null || directoryList.GetCount() == 0) + { + return; + } + if (__pDirectoryFullPathList == null) + { + __pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter); + } + IEnumerator* pEnum = directoryList.GetEnumeratorN(); + String* pItem = null; + + while (pEnum->MoveNext() == E_SUCCESS) + { + pItem = new (std::nothrow) String((static_cast(pEnum->GetCurrent()))->GetPointer()); + __pDirectoryFullPathList->Add(pItem); + } + delete pEnum; +} + +int +AlbumInfo::GetDirectoryCount(void) const +{ + if (__pDirectoryFullPathList == null) + { + return 0; + } + else + { + return __pDirectoryFullPathList->GetCount(); + } +} + +IList* +AlbumInfo::GetContentIdListN(void) const +{ + if (__pContentIdList == null) + { + return null; + } + + IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + IEnumerator* pEnum = __pContentIdList->GetEnumeratorN(); + ContentId* pItem; + while (pEnum->MoveNext() == E_SUCCESS) + { + pItem = new (std::nothrow) ContentId(*static_cast(pEnum->GetCurrent())); + pContentIdList->Add(pItem); + } + delete pEnum; + + return pContentIdList; +} + +ContentId +AlbumInfo::GetContentId(int index) const +{ + ContentId contentId = *(static_cast(__pContentIdList->GetAt(index))); + return contentId; +} + +result +AlbumInfo::Construct(void) +{ + __albumName = EMPTY_SPACE; + __pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter); + __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + result r = E_SUCCESS; + if (GetLastResult() != E_SUCCESS || __pDirectoryFullPathList == null || __pContentIdList == null) + { + delete __pDirectoryFullPathList; + __pDirectoryFullPathList = null; + delete __pContentIdList; + __pContentIdList = null; + r = E_FAILURE; + } + + return r; +} + +result +AlbumInfo::Construct(const String& albumName, ContentType contentType, const IList& directoryList, + const IList& contentIdList) +{ + if (&albumName == null) + { + __albumName = EMPTY_SPACE; + } + else + { + __albumName = albumName; + } + + if (&directoryList == null) + { + ClearDirectoryList(); + } + else + { + ClearDirectoryList(); + AppendDirectoryList(directoryList); + } + + if (&contentIdList == null) + { + ClearContentIdList(); + } + else + { + AppendContentIdList(contentIdList); + } + + return E_SUCCESS; +} + +result +AlbumInfo::Construct(const AlbumInfo& albumInfo) +{ + if (&albumInfo == null) + { + __albumName = EMPTY_SPACE; + ClearDirectoryList(); + ClearContentIdList(); + return E_SUCCESS; + } + __albumName = albumInfo.GetAlbumName(); + + ClearDirectoryList(); + IList* pDirList = albumInfo.GetDirectoryListN(); + AppendDirectoryList(*pDirList); + delete pDirList; + + ClearContentIdList(); + IList* pContentIdList = albumInfo.GetContentIdListN(); + AppendContentIdList(*pContentIdList); + delete pContentIdList; + + return E_SUCCESS; +} + +void +AlbumInfo::ClearContentIdList(void) +{ + if (__pContentIdList != null) + { + delete __pContentIdList; + } + + __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); +} + +void +AlbumInfo::AppendContentId(const ContentId& contentId) +{ + if (&contentId == null) + { + return; + } + + if (__pContentIdList == null) + { + __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + } + ContentId* pItem = new (std::nothrow) ContentId(contentId); + __pContentIdList->Add(pItem); +} + +void +AlbumInfo::AppendContentIdList(const ICollection& contentIdList) +{ + if (&contentIdList == null || contentIdList.GetCount() == 0) + { + return; + } + + if (__pContentIdList == null) + { + __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + } + + IEnumerator* pEnum = contentIdList.GetEnumeratorN(); + ContentId* pItem = null; + + while (pEnum->MoveNext() == E_SUCCESS) + { + pItem = new (std::nothrow) ContentId(*(static_cast(pEnum->GetCurrent()))); + __pContentIdList->Add(pItem); + } + delete pEnum; +} + +void +AlbumInfo::ClearAll(void) +{ + if (__pDirectoryFullPathList != null) + { + delete __pDirectoryFullPathList; + __pDirectoryFullPathList = null; + } + + if (__pContentIdList != null) + { + delete __pContentIdList; + __pContentIdList = null; + } +} + +int +AlbumInfo::GetContentIdCount(void) const +{ + if (__pContentIdList == null) + { + return 0; + } + else + { + return __pContentIdList->GetCount(); + } +} + +result +AlbumInfo::RemoveContentIdAt(const int index) +{ + result r = E_SUCCESS; + + if (__pContentIdList != null) + { + r = __pContentIdList->RemoveAt(index, true); + } + + return r; +} + +void +AlbumInfo::SetFolderThumnailBitmap(Bitmap* pFolderThumnailBitmap) +{ + __pFolderThumnailBitmap = pFolderThumnailBitmap; +} + +Bitmap* +AlbumInfo::GetFolderThumnailBitmap(void) const +{ + return __pFolderThumnailBitmap; +} + +AlbumInfoType +AlbumInfo::GetAlbumInfoType(void) const +{ + return ALBUM_INFO_TYPE_FOLDER; +} diff --git a/src/GlAlbumListEditorForm.cpp b/src/GlAlbumListEditorForm.cpp new file mode 100644 index 0000000..5b90aac --- /dev/null +++ b/src/GlAlbumListEditorForm.cpp @@ -0,0 +1,1143 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumListEditorForm.cpp + * @brief This is the implementation file for AlbumListEditorForm class. + */ + +#include "GlAlbumInfo.h" +#include "GlAlbumListEditorForm.h" +#include "GlAlbumListPresentationModel.h" +#include "GlProgressAnimation.h" +#include "GlResourceManager.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value; +static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value; +static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value; +static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera" + DIRECTORY_SEPARATOR; +static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera" + DIRECTORY_SEPARATOR; +static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath(); +static const String RESERVED_EXTERNAL_MEDIA_PATH = Environment::GetExternalStoragePath(); + +static const int GAP_W_POPUP_ITEM = 10; +static const int W_DELETE_POPUP = 688; +static const int H_DELETE_POPUP = 230; +static const int H_DELETE_LABEL = 80; +static const int Y_DELETE_BUTTON = 132; +static const int H_DELETE_BUTTON = 74; +static const int W_DELETE_BUTTON = 318; +static const int Y_DELETE_LABEL = 32; + +static const int FORMAT_BUFFER_SIZE = 256; + +static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK)); +static const int ALPHA_FOLDER_BITMAP_DIM = 70; + +static const int IDA_ALBUM_EDIT = 503; + +AlbumListEditorForm::AlbumListEditorForm(void) + : __checkedCount(0) + , __pSelectCountLabel(null) + , __pEditorFolderIconList(null) + , __pShareContextMenu(null) + , __pDeletePopup(null) + , __pFileUpdateTimer(null) + , __pPresentationModel(null) + , __isScanProgress(false) +{ + AppLogDebug("ENTER"); + _pProgressAnim = null; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AlbumListEditorForm::~AlbumListEditorForm(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumListEditorForm::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Form::Construct(IDL_FORM_ALBUM_LIST_EDITOR); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumListEditorForm::OnInitializing(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + + SetOrientation(ORIENTATION_AUTOMATIC); + AddOrientationEventListener(*this); + + __pPresentationModel = AlbumListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + r = __pPresentationModel->AddPresentationModelListener(this); + + SetFormBackEventListener(this); + GetHeader()->AddActionEventListener(*this); + GetFooter()->AddActionEventListener(*this); + + r = InitializeControl(); + if (r != E_SUCCESS) + { + AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r)); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumListEditorForm::OnTerminating(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + r = __pPresentationModel->RemovePresentationModelListener(*this); + __pPresentationModel->RemoveContentEventListener(*this); + + if (__pDeletePopup != null) + { + delete __pDeletePopup; + __pDeletePopup = null; + } + if (__pFileUpdateTimer != null) + { + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +AlbumListEditorForm::ShowAnimation(void) +{ + Rectangle clientRect= GetClientAreaBounds(); + Rectangle rect(0, 0, clientRect.width, clientRect.height); + _pProgressAnim = new (std::nothrow) ProgressAnimation; + _pProgressAnim->Construct(rect); + AddControl(_pProgressAnim); + SetControlAlwaysOnTop(*_pProgressAnim,true); + _pProgressAnim->SetShowState(true); + GetFooter()->SetEnabled(false); + _pProgressAnim->AnimationStart(); + _pProgressAnim->Draw(); +} +void +AlbumListEditorForm::StopAnimation(void) +{ + if (_pProgressAnim) + { + _pProgressAnim->AnimationStop(); + _pProgressAnim->SetShowState(false); + RemoveControl(_pProgressAnim); + GetFooter()->SetEnabled(true); + _pProgressAnim = null; + } +} + +void +AlbumListEditorForm::OnContentUpdated(void) +{ + AppLogDebug("ENTER"); + int maxCount = __pPresentationModel->GetFolderCount(); + if (__pDeletePopup != null) + { + if (__pDeletePopup->IsVisible() == true) + { + __pDeletePopup->Destroy(); + __pDeletePopup = null; + InitializePopup(); + } + } + + for (int i = 0; i < maxCount; ++i) + { + __pEditorFolderIconList->SetItemChecked(i, false); + } + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumListEditorForm::InitializeControl(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + String tempString; + + __pSelectCountLabel = static_cast(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED")); + AppAssert(__pSelectCountLabel); + + CreateIconListView(); + __checkedCount = GetCheckedFolderCount(); + + + r = InitializePopup(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumListEditorForm::InitializePopup(void) +{ + AppLogDebug("ENTER"); + if (__pDeletePopup == null) + { + __pDeletePopup = new (std::nothrow) Popup(); + __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP)); + __pDeletePopup->SetPropagatedKeyEventListener(this); + + Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds(); + + Label* pLabel = new (std::nothrow) Label(); + pLabel->Construct(Rectangle(0, Y_DELETE_LABEL, popupClientBounds.width, H_DELETE_LABEL), + ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q")); + pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD); + + Button* pDeleteButton = new (std::nothrow) Button(); + pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), + ResourceManager::GetString(L"IDS_COM_BODY_DELETE")); + pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL); + pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED); + pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT); + pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL); + pDeleteButton->AddActionEventListener(*this); + + Button* pCancelButton = new (std::nothrow) Button(); + pCancelButton->Construct(Rectangle(16, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), + ResourceManager::GetString(L"IDS_COM_POP_CANCEL")); + pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL); + pCancelButton->AddActionEventListener(*this); + + __pDeletePopup->AddControl(pLabel); + __pDeletePopup->AddControl(pDeleteButton); + __pDeletePopup->AddControl(pCancelButton); + } + else + { + __pDeletePopup->SetShowState(true); + __pDeletePopup->Show(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +AlbumListEditorForm::CreateIconListView(void) +{ + AppLogDebug("ENTER"); + + + __pEditorFolderIconList = new IconListView(); + __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()), + Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT); + __pEditorFolderIconList->SetTouchAnimationEnabled(false); + __pEditorFolderIconList->SetItemProvider(*this); + __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pEditorFolderIconList->AddIconListViewItemEventListener(*this); + + Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + + if (pBitmap != null) + { + __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap); + delete pBitmap; + } + + __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + + AddControl(__pEditorFolderIconList); + + __pEditorFolderIconList->SetShowState(true); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +AlbumListEditorForm::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pPresentationModel->GetFolderCount(); +} + +IconListViewItem* +AlbumListEditorForm::CreateItem(int index) +{ + AppLogDebug("ENTER : index(%d)", index); + Bitmap* pBitmap = null; + Canvas* pEditAlbumCanvas = null; + Bitmap* pEditAlbumBitmap = null; + Bitmap* pBitmapRenameBg = null; + Bitmap* pBitmapRename = null; + String albumName; + int canvasWidth = 75; + int canvasHeight = 75; + + IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem(); + + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(index)); + + Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap(); + if (pAlbumBitmap == null) + { + __pPresentationModel->RequestThumbnail(index, 0); + } + + pBitmap = __pPresentationModel->CreateMergeBitmapN(index); + + if (__pEditorFolderIconList->IsItemChecked(index) == true) + { + if (pBitmap != null) + { + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + Color dimColor(COLOR_FOLDER_BITMAP_DIM); + dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM); + Canvas canvas; + canvas.Construct(bufferInfo); + canvas.FillRectangle(dimColor, canvas.GetBounds()); + Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap(); + pSelectedBitmap->Construct(canvas, canvas.GetBounds()); + pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap); + delete pSelectedBitmap; + } + } + else + { + pIconListviewItem->Construct(*pBitmap); + } + + if (pBitmap != null) + { + delete pBitmap; + } + + pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG); + pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME); + + if (pBitmapRenameBg != null && pBitmapRename != null) + { + + pEditAlbumCanvas = new (std::nothrow) Canvas(); + pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight)); + pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRenameBg); + pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRename); + + + pEditAlbumBitmap = new (std::nothrow) Bitmap(); + + if (pEditAlbumBitmap != NULL) + { + pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight)); + + } + delete pEditAlbumCanvas; + + albumName = pAlbumInfo->GetAlbumName(); + + if (albumName == ALL_ALBUMS_REAL_NAME) + { + albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS"); + } + + String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB"); + String albumPath = pAlbumInfo->GetDirectory(0); + albumPath.Append(DIRECTORY_SEPARATOR); + + if (index == 0 || (reservedCameraName.Equals(albumName, true) && + (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true))) + || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true)) + { + // rename disabled + } + else + { + pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP); + } + + if (pEditAlbumBitmap != null) + { + delete pEditAlbumBitmap; + } + } + + if (pBitmapRenameBg) + { + delete pBitmapRenameBg; + } + if (pBitmapRename) + { + delete pBitmapRename; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pIconListviewItem; +} + +void +AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + + if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED) + { + if (status == ICON_LIST_VIEW_ITEM_CHECKED) + { + ++__checkedCount; + } + else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED) + { + --__checkedCount; + } + + String tempString; + if (__checkedCount == 0) + { + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (__checkedCount == 1) + { + tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount); + } + + __pSelectCountLabel->SetText(tempString); + __pSelectCountLabel->RequestRedraw(); + __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index, + int overlayBitmapId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + + ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter); + pSelectedIndex->Construct(); + //Adding the Action Type + pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME)); + pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE)); + pSelectedIndex->Add(new (std::nothrow) Integer(index)); + + if (__pEditorFolderIconList->IsItemChecked(index) == false) + { + __pEditorFolderIconList->SetItemChecked(index,true); + } + else + { + __pEditorFolderIconList->SetItemChecked(index,false); + } + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +result +AlbumListEditorForm::DeleteFolder(void) +{ + + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + + if (__pFileUpdateTimer != null) + { + delete __pFileUpdateTimer; + } + __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) + { + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; + } + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + return E_SUCCESS; +} + +IList* +AlbumListEditorForm::GetItemCheckedIndexListN(void) const +{ + AppLogDebug("ENTER"); + IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + Integer* pIndex = null; + + if (__pEditorFolderIconList!=null) + { + int loopCount = __pPresentationModel->GetFolderCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pEditorFolderIconList->IsItemChecked(i) == true) + { + pIndex = new (std::nothrow) Integer(i); + pList->Add(pIndex); + AppLogDebug("checked index(%d)", i); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pList; +} + +void +AlbumListEditorForm::SetAllCheckState(const bool state) +{ + AppLogDebug("ENTER"); + + int maxCount = __pPresentationModel->GetFolderCount(); + String tempString; + + if (state == true) + { + if (maxCount == 1) + { + tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;"); + } + else + { + tempString.Format(FORMAT_BUFFER_SIZE, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount); + } + } + else + { + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + + for (int i = 0; i < maxCount; ++i) + { + __pEditorFolderIconList->SetItemChecked(i, state); + __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + + __pEditorFolderIconList->Draw(); + __pSelectCountLabel->SetText(tempString); + __pSelectCountLabel->RequestRedraw(); + __checkedCount = GetCheckedFolderCount(); + + SetButtonState(); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +AlbumListEditorForm::GetCheckedFolderCount(void) const +{ + AppLogDebug("ENTER"); + int maxCount = __pPresentationModel->GetFolderCount(); + int count = 0; + + for (int i = 0; i < maxCount; ++i) + { + if (__pEditorFolderIconList->IsItemChecked (i)) + { + ++count; + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return count; +} + +void +AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + switch (actionId) + { + case IDA_ALBUM_LIST_SELECT_ALL: + { + if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount()) + { + SetAllCheckState(false); + } + else + { + SetAllCheckState(true); + } + } + break; + + case IDA_FOOTER_DELETE: + { + __pDeletePopup->SetShowState(true); + __pDeletePopup->Show(); + } + break; + + case IDA_FOOTER_SHARE: + { + + if (__pShareContextMenu != NULL) + { + delete __pShareContextMenu; + __pShareContextMenu = null; + } + + + Bitmap* pBitmapEmailContextItem = null; + Bitmap* pBitmapMessageContextItem = null; + pBitmapEmailContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_EMAIL_ICON); + pBitmapMessageContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_MESSAGE_ICON); + + __pShareContextMenu = new (std::nothrow) ContextMenu(); + __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height + __pSelectCountLabel->GetHeight() + 5), + CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD); + + if ( pBitmapMessageContextItem != null) + { + __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), + IDA_CONTEXT_MENU_MESSAGE , *pBitmapMessageContextItem, null, null); + + delete pBitmapMessageContextItem; + } + + if ( pBitmapEmailContextItem != null) + { + __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL, + *pBitmapEmailContextItem, null, null); + + delete pBitmapEmailContextItem; + } + + __pShareContextMenu->SetFocusable(true); + __pShareContextMenu->AddActionEventListener(*this); + __pShareContextMenu->SetShowState(true); + __pShareContextMenu->Show(); + } + break; + + case IDA_CONTEXT_MENU_MESSAGE: + { + OnRequestMessage(); + } + break; + + case IDA_CONTEXT_MENU_EMAIL: + { + OnRequestEmail(); + } + break; + + case IDA_DELETE_POPUP_DEL: + { + __pDeletePopup->SetShowState(false); + __pDeletePopup->Show(); + DeleteFolder(); + } + break; + + case IDA_DELETE_POPUP_CANCEL: + { + __pDeletePopup->SetShowState(false); + __pDeletePopup->Show(); + } + break; + + default: + break; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + if(__isScanProgress) + { + return; + } +} + +void +AlbumListEditorForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("ENTER"); + if(__isScanProgress) + { + return; + } + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER OnSceneActivatedN"); + String tempString; + + + int count = __pPresentationModel->GetFolderCount(); + + __pPresentationModel->AddContentEventListener(this); + + __checkedCount = GetCheckedFolderCount(); + + if (previousSceneId == IDSCN_ALBUM_NAME_EDITOR) + { + + if (__checkedCount == 0) + { + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else + { + tempString.Format(FORMAT_BUFFER_SIZE, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount); + } + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL); + + for (int index = 0; index < count; ++index) + { + __pEditorFolderIconList->SetItemChecked(index,false); + } + + __pEditorFolderIconList->UpdateList(); + __checkedCount = 0; + + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + + __pSelectCountLabel->SetText(tempString); + __pSelectCountLabel->Invalidate(true); + + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(*this); + + if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR) + { + int loopCount = __pPresentationModel->GetFolderCount(); + + for (int count = 0; count < loopCount; ++count) + { + __pEditorFolderIconList->SetItemChecked(count,false); + } + __pEditorFolderIconList->UpdateList(); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + Update(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId) +{ + Invalidate(true); +} + +void +AlbumListEditorForm::OnScanDirStart() +{ + AppLogDebug("SANTHOSH ENTER"); + GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, false); + Invalidate(true); + __isScanProgress = true; + AppLogDebug("SANTHOSH EXIT"); +} +void +AlbumListEditorForm::OnScanDirComplete() +{ + AppLogDebug("SANTHOSH ENTER"); + GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, true); + Invalidate(true); + __isScanProgress = false; + AppLogDebug("SANTHOSH EXIT"); +} + +void +AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res) +{ + AppLogDebug("ENTER"); + __pPresentationModel->SetUpdateProgressStatus(false); + SetAllCheckState(false); + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL); + __pEditorFolderIconList->UpdateList(); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +AlbumListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo) +{ + AppLogDebug("ENTER"); + + if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC) + { + __pDeletePopup->SetShowState(false); + __pDeletePopup->Show(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return false; +} + +result +AlbumListEditorForm::Update(void) +{ + AppLogDebug("ENTER"); + result r = __pEditorFolderIconList->UpdateList(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +AlbumListEditorForm::OnRequestMessage(void) +{ + AppLogDebug("ENTER"); + + int checkCount = GetCheckedFolderCount(); + + if (checkCount <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + + int maxCount = __pPresentationModel->GetFolderCount(); + ContentManager contentManager; + result r = contentManager.Construct(); + if (r == E_SUCCESS) + { + if (maxCount <= 0) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + return; + } + + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + for (int i = 0; i < maxCount; ++i) + { + if (__pEditorFolderIconList->IsItemChecked (i)) + { + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(i)); + IList* pContentIdList = pAlbumInfo->GetContentIdListN(); + int loopCount = pContentIdList->GetCount(); + for (int k = 0; k < loopCount; ++k) + { + ContentId* pContentId = static_cast(pContentIdList->GetAt(k)); + ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId); + + if (pContentInfo == null) + { + break; + } + + pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath())); + } + + if (i == 0) + { + break; + } + } + } + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, + null, null, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::OnRequestEmail(void) +{ + AppLogDebug("ENTER"); + + int checkCount = GetCheckedFolderCount(); + + if (checkCount <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + + int maxCount = __pPresentationModel->GetFolderCount(); + ContentManager contentManager; + result r = contentManager.Construct(); + if (r == E_SUCCESS) + { + if (maxCount <= 0) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + return; + } + + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + for (int i = 0; i < maxCount; ++i) + { + if (__pEditorFolderIconList->IsItemChecked(i)) + { + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(i)); + IList* pContentIdList = pAlbumInfo->GetContentIdListN(); + int loopCount = pContentIdList->GetCount(); + for (int k = 0; k < loopCount; ++k) + { + ContentId* pContentId = static_cast(pContentIdList->GetAt(k)); + ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId); + + if (pContentInfo == null) + { + break; + } + + pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath())); + } + + if (i == 0) + { + break; + } + } + } + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE, + new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::SetFooterButtonsState(const bool enableState) +{ + AppLogDebug("ENTER"); + Footer* pFooter = GetFooter(); + AppAssert(pFooter); + + if (enableState == true) + { + pFooter->SetItemEnabled(0, true); + pFooter->SetItemEnabled(1, true); + } + else + { + pFooter->SetItemEnabled(0, false); + pFooter->SetItemEnabled(1, false); + } + + pFooter->RequestRedraw(true); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListEditorForm::SetButtonState(void) +{ + AppLogDebug("ENTER"); + if (GetCheckedFolderCount() > 0) + { + AppLogDebug("BUTTONSTATE : Request Enable"); + SetFooterButtonsState(true); + } + else + { + AppLogDebug("BUTTONSTATE : Request disable"); + SetFooterButtonsState(false); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + + +void +AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + + IList* pIndexList = GetItemCheckedIndexListN(); + + if (__pEditorFolderIconList != null) + { + RemoveControl(__pEditorFolderIconList); + } + + __pEditorFolderIconList = new IconListView(); + + if (orientationStatus == ORIENTATION_STATUS_PORTRAIT) + { + __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()), + Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + } + else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + int horizontalSpacing = 8; + int verticalSpacing = 60; + int height = 424; + int width = 410; + + __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()), + Dimension(width, height), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + + __pEditorFolderIconList->SetItemSpacing(horizontalSpacing, verticalSpacing); + __pEditorFolderIconList->SetMargin(MARGIN_TYPE_TOP,40); + } + + Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + + if (pBitmap != null) + { + __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap); + delete pBitmap; + } + + __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT); + __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pEditorFolderIconList->SetTouchAnimationEnabled(false); + __pEditorFolderIconList->SetItemProvider(*this); + __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pEditorFolderIconList->AddIconListViewItemEventListener(*this); + + AddControl(__pEditorFolderIconList); + + int loopCount = pIndexList->GetCount(); + int index = -1; + for (int count = 0; count < loopCount; ++count) + { + Integer* pRealIndex = static_cast(pIndexList->GetAt(count)); + index = pRealIndex->ToInt(); + __pEditorFolderIconList->SetItemChecked(index, true); + __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + + if (_pProgressAnim != null) + { + _pProgressAnim->ChangeOrientation(Form::GetBounds()); + _pProgressAnim->Invalidate(true); + } +} diff --git a/src/GlAlbumListForm.cpp b/src/GlAlbumListForm.cpp new file mode 100644 index 0000000..6c1a022 --- /dev/null +++ b/src/GlAlbumListForm.cpp @@ -0,0 +1,568 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumListForm.cpp + * @brief This is the implementation file for AlbumListForm class. + */ + +#include "GlAlbumInfo.h" +#include "GlAlbumListForm.h" +#include "GlAlbumListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlResourceManager.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const int W_FOLDER_SIZE = 348; +static const int H_FOLDER_SIZE = 348; + +AlbumListForm::AlbumListForm(void) + : __itemCount(0) + , __pAlbumViewIconList(null) + , __pOptionMenu(null) + , __pPresentationModel(null) + +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AlbumListForm::~AlbumListForm(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumListForm::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Form::Construct(IDL_FORM_ALBUM_LIST); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumListForm::OnInitializing(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + + SetOrientation(ORIENTATION_AUTOMATIC); + AddOrientationEventListener(*this); + + __pPresentationModel = AlbumListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_IMAGE) + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_IMAGE); + } + else if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_VIDEO) + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_VIDEO); + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_VIDEO); + } + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL); + } + + AppLogDebug("ENTER __pPresentationModel(%x)", __pPresentationModel); + + r = InitializeHeader(); + if (r != E_SUCCESS) + { + AppLogDebug("[%s] Unable to set header.", GetErrorMessage(r)); + } + + r = InitializeFooter(); + if (r != E_SUCCESS) + { + AppLogDebug("[%s] Unable to set footer.", GetErrorMessage(r)); + } + + __itemCount = __pPresentationModel->GetFolderCount(); + CreateIconListView(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumListForm::InitializeHeader(void) +{ + AppLogDebug("ENTER"); + Header* pHeader = GetHeader(); + if (pHeader == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_SYSTEM; + } + + result r = pHeader->SetStyle(HEADER_STYLE_TITLE); + if (r != E_SUCCESS) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + return r; + } + + pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_GALLERY")); + pHeader->AddActionEventListener(*this); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return E_SUCCESS; +} + +result +AlbumListForm::InitializeFooter(void) +{ + AppLogDebug("ENTER"); + Footer* pFooter = GetFooter(); + if (pFooter == null) + { + AppLogDebug("EXIT 1"); + return E_SYSTEM; + } + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + SetFormBackEventListener(this); + pFooter->SetShowState(false); + } + else + { + pFooter->SetShowState(true); + pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON); + pFooter->RemoveAllItems(); + + FooterItem itemCamera; + itemCamera.Construct(IDA_FOOTER_CAMERA); + itemCamera.SetText(ResourceManager::GetString(L"EMPTY_SPACE")); + Bitmap* pBitmap1 = ResourceManager::GetBitmapN(IDB_CONTROLBAR_CAMERA); + if (pBitmap1 != null) + { + itemCamera.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmap1); + } + pFooter->AddItem(itemCamera); + delete pBitmap1; + + __pOptionMenu = new (std::nothrow) OptionMenu(); + __pOptionMenu->Construct(); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"),IDA_FOOTER_EDIT); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); + __pOptionMenu->SetShowState(false); + __pOptionMenu->AddActionEventListener(*this); + SetFormMenuEventListener(this); + SetFormBackEventListener(this); + } + + pFooter->AddActionEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +AlbumListForm::CreateIconListView(void) +{ + AppLogDebug("ENTER"); + Dimension itemSize(W_FOLDER_SIZE, H_FOLDER_SIZE); + + __pAlbumViewIconList = new IconListView(); + __pAlbumViewIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), + Dimension(W_FOLDER_SIZE, H_FOLDER_SIZE), ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + __pAlbumViewIconList->SetItemProvider(*this); + __pAlbumViewIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pAlbumViewIconList->AddIconListViewItemEventListener(*this); + + + + Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + + if (pBitmap != null) + { + __pAlbumViewIconList->SetBitmapOfEmptyList(pBitmap); + delete pBitmap; + } + __pAlbumViewIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + + AddControl(__pAlbumViewIconList); + + __pAlbumViewIconList->SetShowState(true); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +AlbumListForm::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +IconListViewItem* +AlbumListForm::CreateItem(int index) +{ + AppLogDebug("ENTER : index(%d)", index); + + Bitmap* pBitmap = null; + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + if (pAlbumInfoList != null) + { + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(index)); + if (pAlbumInfo != null) + { + Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap(); + + if (pAlbumBitmap == null) + { + __pPresentationModel->RequestThumbnail(index, 0); + } + + pBitmap = __pPresentationModel->CreateMergeBitmapN(index); + + if (pBitmap != null) + { + IconListViewItem* pIconListview = new (std::nothrow) IconListViewItem(); + pIconListview->Construct(*pBitmap); + delete pBitmap; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return pIconListview; + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return null; +} + +void +AlbumListForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + if (status == ICON_LIST_VIEW_ITEM_SELECTED) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(index)); + AlbumInfo* pSendAlbumInfo = new (std::nothrow) AlbumInfo(); + pSendAlbumInfo->Construct(*pAlbumInfo); + + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + pArrayList->Add(pSendAlbumInfo); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_IMAGE) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_LIST_EDITOR), pArrayList); + } + else if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_VIDEO) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_VIDEO_LIST_EDITOR), pArrayList); + } + else + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_LIST_EDITOR), pArrayList); + } + } + else + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST), pArrayList); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +AlbumListForm::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +result +AlbumListForm::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemovePresentationModelListener(*this); + __pPresentationModel->RemoveContentEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +AlbumListForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + + switch (actionId) + { + case IDA_FOOTER_CAMERA: + { + const String mimeType = APPCONTROL_MIME_IMAGE_JPG; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_CAMERA_ALLOW_SWITCH), + new (std::nothrow) String(APPCONTROL_DATA_TRUE)); + __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CAMERA, + APPCONTROL_OPERATION_ID_CREATE_CONTENT, null, &mimeType, pDataList, this); + + } + break; + + case IDA_FOOTER_EDIT: + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST_EDITOR)); + } + break; + + default: + break; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("ENTER"); + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null && pApp->GetFrameActivated() == true) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_CANCELED, null); + pApp->Terminate(); + } + } + else + { + AppLogDebug("APP_CONTROL_MODE_MAIN"); + UiApp* pApp = UiApp::GetInstance(); + pApp->Terminate(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + __pPresentationModel->AddContentEventListener(this); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_IMAGE) + { + __pPresentationModel->ClearThumbnailRequests(false); + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_IMAGE); + } + else if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_VIDEO) + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_VIDEO); + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_VIDEO); + } + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL); + } + __itemCount = __pPresentationModel->GetFolderCount(); + + if (__pAlbumViewIconList != null) + { + __pAlbumViewIconList->UpdateList(); + } + + Invalidate(true); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnContentUpdated(void) +{ + AppLogDebug("ENTER"); + + if (__pOptionMenu != null && __pOptionMenu ->GetShowState() == true) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Show(); + } + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_IMAGE) + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_IMAGE); + } + else if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_VIDEO) + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_VIDEO); + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_VIDEO); + } + } + else + { + __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL); + } + + __itemCount = __pPresentationModel->GetFolderCount(); + __pAlbumViewIconList->UpdateList(); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + Update(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + __pAlbumViewIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Tizen::Base::String& operationId, + AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData) +{ + AppLogDebug("OnAppControlCompleteResponseReceived : %d", appControlResult); + + GalleryApp* pGalleryApp = static_cast(GalleryApp::GetInstance()); + TryReturnVoid(pGalleryApp != null, "pGalleryApp is null"); + pGalleryApp->SetFrameEnabled(true); +} + +result +AlbumListForm::Update(void) +{ + AppLogDebug("ENTER"); + result r = __pAlbumViewIconList->UpdateList(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +AlbumListForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + + if (__pOptionMenu == null || GetItemCount() == 0) + { + return; + } + + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); +} + +void +AlbumListForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + if (__pAlbumViewIconList != null) + { + RemoveControl(__pAlbumViewIconList); + } + + __pAlbumViewIconList = new IconListView(); + + if (orientationStatus == ORIENTATION_STATUS_PORTRAIT) + { + __pAlbumViewIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), + Dimension(W_FOLDER_SIZE, H_FOLDER_SIZE), ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + } + else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + int horizontalSpacing = 8; + int verticalSpacing = 60; + int height = 424; + int width = 410; + + __pAlbumViewIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), + Dimension(width, height), ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + + __pAlbumViewIconList->SetItemSpacing(horizontalSpacing, verticalSpacing); + __pAlbumViewIconList->SetMargin(MARGIN_TYPE_TOP,60); + } + + Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + + if (pBitmap != null) + { + __pAlbumViewIconList->SetBitmapOfEmptyList(pBitmap); + delete pBitmap; + } + + __pAlbumViewIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + + __pAlbumViewIconList->SetItemProvider(*this); + __pAlbumViewIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pAlbumViewIconList->AddIconListViewItemEventListener(*this); + + AddControl(__pAlbumViewIconList); + +} diff --git a/src/GlAlbumListPresentationModel.cpp b/src/GlAlbumListPresentationModel.cpp new file mode 100644 index 0000000..477d0a3 --- /dev/null +++ b/src/GlAlbumListPresentationModel.cpp @@ -0,0 +1,1251 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumListPresentationModel.cpp + * @brief This is the implementation file for AlbumListPresentationModel class. + */ + +#include +#include +#include + +#include "GlAlbumInfo.h" +#include "GlAlbumListPresentationModel.h" +#include "GlAlbumRenameEventListener.h" +#include "GlContentUpdateEventListener.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlThumbnailEvent.h" +#include "GlThumbnailEventArg.h" +#include "GlThumbnailProvider.h" +#include "GlTimerScanDirListener.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; +using namespace Tizen::System; +using namespace Tizen::Ui::Controls; + +static const int ICON_CAP = 3; +static const int FOLDER_CAP = 8; +static const int ICON_SIZE = 107; +static const int FOLDER_SIZE_WIDTH = 348; +static const int FOLDER_SIZE_HEIGHT = 348; + +static const int CANVAS_HEIGHT = 71; +static const int CANVAS_WIDTH = 326; + +static const int FONT_SIZE_FOLDER_NAME = 32; +static const int FONT_SIZE_FOLDER_DATE = 25; +static const int FONT_SIZE_FOLDER_COUNT = 45; +static const int FONT_SIZE_FOLDER_COUNT_SMALL = 35; + +static const int CANVAS_IMAGE_FOLDER_HEIGHT = 48; +static const int CANVAS_IMAGE_FOLDER_WIDTH = 48; +static const int IMAGE_COUNT_WIDTH = 100; +static const int IMAGE_COUNT_HEIGHT = 60; +static const int CANVAS_MARGIN_LEFT = 10; +static const int GAP = 10; +static const int HEIGHT_OFFSET = 5; +static const int Y_POS_CANVAS = 260; +static const int FOLDER_NAME_WIDTH = 165; +static const int FOLDER_NAME_HEIGHT = 38; + + +static const int ALPHA_BG = 110; + +static const Color COLOR_CANVAS_BG (Color::GetColor(COLOR_ID_BLACK)); + +static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath(); +static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera"; +static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera"; +static const String RESERVED_DOWNLOAD_PATH = Environment::GetMediaPath() + L"Downloads"; +static const String DATE_TIME = L"DateTime"; + +static const int FORMAT_BUFFER_SIZE = 256; + +static const int DOUBLE_NUMBER = 2; +static const int TRIPLE_NUMBER = 3; + +AlbumListPresentationModel* AlbumListPresentationModel::__pPresentationModelInstance = null; +ArrayList* AlbumListPresentationModel::__pPresentationModelListener = null; +ArrayList* AlbumListPresentationModel::__pContentEventListener = null; +ThumbnailProvider* AlbumListPresentationModel::__pThumbnailProvider = null; +ThumbnailEvent* AlbumListPresentationModel::__pThumbnailEvent = null; +IList* AlbumListPresentationModel::__pAlbumInfoList = null; + +AlbumListPresentationModel::AlbumListPresentationModel(void) + : __pFolderBackgroundBitmap(null) + , __pAlbumListener(null) + , __appControlMode(APPCONTROL_MODE_MAIN) + , __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE) + , __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE) + , __updateProgressStatus(false) + , __pTimerScanListener(null) + , __scanCount(0) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AlbumListPresentationModel::~AlbumListPresentationModel(void) +{ + AppLogDebug("ENTER"); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + delete __pFolderBackgroundBitmap; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AlbumListPresentationModel* +AlbumListPresentationModel::GetInstance(void) +{ + AppLogDebug("ENTER"); + if (__pPresentationModelInstance == null) + { + CreateInstance(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pPresentationModelInstance; +} + +result +AlbumListPresentationModel::Construct(void) +{ + AppLogDebug("ENTER"); + __pPresentationModelListener = new (std::nothrow) ArrayList(); + __pPresentationModelListener->Construct(); + + ContentUpdateEventListener::GetInstance(); + __pContentEventListener = new (std::nothrow) ArrayList(); + __pContentEventListener->Construct(); + + IThumbnailEventListener* pThumbnailEventListener = static_cast(this); + __pThumbnailEvent = new (std::nothrow) ThumbnailEvent(); + __pThumbnailEvent->AddListener(*pThumbnailEventListener, true); + + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + + __pThumbnailProvider = ThumbnailProvider::GetInstance(); + AppLogDebug("ENTER1"); + GalleryApp* pApp = static_cast(GalleryApp::GetInstance()); + const IMap* pArguments = pApp->GetAppControlArguments(); + String operationId = pApp->GetAppControlOperationId(); + + if (operationId.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0) + { + __appControlMode = APPCONTROL_MODE_MAIN; + } + else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0) + { + __appControlMode = APPCONTROL_MODE_PICK; + + String mimeType = pApp->GetMimeType(); + if (mimeType.IsEmpty() != true) + { + if (mimeType.StartsWith(APPCONTROL_DATA_VIDEO, 0) == true) + { + __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO; + } + } + if (pArguments != null) + { + const String* selectionMode = + static_cast(pArguments->GetValue(String(APPCONTROL_KEY_SELECTION_MODE))); + if (selectionMode != null && selectionMode->CompareTo(APPCONTROL_DATA_MULTIPLE) == 0) + { + __appControlSelectionMode = APPCONTROL_SELECTION_MODE_MULTIPLE; + } + } + } + else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0) + { + __appControlMode = APPCONTROL_MODE_SETTING; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +AlbumListPresentationModel::CreateInstance(void) +{ + AppLogDebug("ENTER"); + __pPresentationModelInstance = new (std::nothrow) AlbumListPresentationModel; + result r = __pPresentationModelInstance->Construct(); + + if (IsFailed(r) == true) + { + delete __pPresentationModelInstance; + __pPresentationModelInstance = null; + AppLogDebug("EXIT false"); + return; + } + std::atexit(DestroyInstance); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListPresentationModel::DestroyInstance(void) +{ + AppLogDebug("ENTER"); + + delete __pThumbnailEvent; + __pThumbnailEvent = null; + + if (__pAlbumInfoList != null) + { + delete __pAlbumInfoList; + __pAlbumInfoList = null; + } + + if (__pPresentationModelListener != null) + { + delete __pPresentationModelListener; + __pPresentationModelListener = null; + } + + if (__pContentEventListener != null) + { + delete __pContentEventListener; + __pContentEventListener = null; + } + + delete __pPresentationModelInstance; + __pPresentationModelInstance = null; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumListPresentationModel::AddPresentationModelListener(IAlbumEventListener* listener) +{ + AppLogDebug("ENTER"); + result r = __pPresentationModelListener->Add(listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumListPresentationModel::RemovePresentationModelListener(IAlbumEventListener& listner) +{ + AppLogDebug("ENTER"); + result r = __pPresentationModelListener->Remove(listner); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +AlbumListPresentationModel::AddContentEventListener(const IFormContentUpdateEventListener* listener) +{ + AppLogDebug("ENTER"); + if (__pContentEventListener != null) + { + __pContentEventListener->RemoveAll(); + __pContentEventListener->Add((Object*)listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + } +} + +void +AlbumListPresentationModel::RemoveContentEventListener(const IFormContentUpdateEventListener& listener) +{ + AppLogDebug("ENTER"); + __pContentEventListener->Remove(listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListPresentationModel::CallAlbumChangedEvent(void) +{ + AppLogDebug("ENTER"); + if (__pPresentationModelListener->GetCount() > 0) + { + IEnumerator* pEnum = __pPresentationModelListener->GetEnumeratorN(); + + while (pEnum->MoveNext() == E_SUCCESS) + { + IAlbumEventListener* pListener = null; + pListener = static_cast(pEnum->GetCurrent()); + pListener->OnFileInfoChanged(CONTENT_TYPE_ALL); + } + + delete pEnum; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumListPresentationModel::RenameAlbum(const String& orgPath, const String& newPath, + IAlbumRenameEventListener* pAlbumListener) +{ + AppLogDebug("ENTER"); + result r = Directory::Rename(orgPath, newPath); + if (IsFailed(r)) + { + AppLogDebug("Album Rename failed(%s)", GetErrorMessage(r)); + } + else + { + __pAlbumListener = pAlbumListener; + __renameNewPath = newPath; + r = ContentManager::ScanDirectory(newPath, true, NULL, __reqId); + AppLogDebug("Content scan failed (%s)", GetErrorMessage(r)); + r = ContentManager::ScanDirectory(orgPath, true, NULL, __reqId); + AppLogDebug("Content scan failed (%s)", GetErrorMessage(r)); + } + AppLogDebug("EXIT"); + return r; +} + +void +AlbumListPresentationModel::ShowAnimation(void) +{ + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->ShowAnimation(); + } + delete pEventEnum; +} + +void +AlbumListPresentationModel::StopAnimation(void) +{ + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->StopAnimation(); + } + delete pEventEnum; +} + +void +AlbumListPresentationModel::AddTimerScanListener(ITimerScanDirListener* pListener, int scanCount) +{ + __pTimerScanListener = pListener; + __scanCount = scanCount; +} + +void +AlbumListPresentationModel::RemoveTimerScanListener(void) +{ + __pTimerScanListener = null; + __scanCount = 0; +} + +bool +AlbumListPresentationModel::OnContentScanCompleted (const Tizen::Base::String &scanPath) +{ + AppLogDebug("ENTER"); + if (__pTimerScanListener) + { + __scanCount--; + if ( __scanCount == 0 ) + { + __pTimerScanListener->OnTimerScanDirComplete(); + } + return false; + } + if (__pAlbumListener && ( scanPath == __renameNewPath)) + { + InitializeAlbumInfoList(CONTENT_TYPE_ALL); + __pAlbumListener->OnAlbumRenameComplete(); + __renameNewPath = L""; + AppLogDebug("EXIT"); + return true; + } + AppLogDebug("EXIT"); + return false; +} + +void +AlbumListPresentationModel::DrawPartialImage(Canvas& canvas, AlbumInfo* pAlbumInfo, const Rectangle& rectNew) +{ + AppLogDebug("ENTER"); + if (&canvas == null || __pFolderBackgroundBitmap == null || pAlbumInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + + canvas.DrawBitmap(rectNew, *__pFolderBackgroundBitmap); + + Bitmap* pBitmap = pAlbumInfo->GetFolderThumnailBitmap(); + + if (pBitmap != null) + { + Rectangle rectFirst(ICON_CAP+FOLDER_CAP, ICON_CAP, + ICON_CAP * DOUBLE_NUMBER + ICON_SIZE * TRIPLE_NUMBER, + ICON_CAP * DOUBLE_NUMBER + ICON_SIZE * TRIPLE_NUMBER); + canvas.DrawBitmap(rectFirst, *pBitmap); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListPresentationModel::DrawFontImage(Canvas& canvas, AlbumInfo* pAlbumInfo, int index) +{ + AppLogDebug("ENTER"); + + if (&canvas == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + Point pointText; + String strCnt; + Bitmap* pBitmap = null; + Font ftFolderName, ftDate, ftCnt,ftCntSmall; + EnrichedText enText; + EnrichedText enTextCount; + TextElement textElement; + TextElement textElementCount; + + int allContentCount = pAlbumInfo->GetContentIdCount(); + strCnt.Format(FORMAT_BUFFER_SIZE, L"%d", allContentCount); + + String strFolderName = pAlbumInfo->GetAlbumName(); + + if (strFolderName == ALL_ALBUMS_REAL_NAME) + { + strFolderName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS"); + } + + String strDirectory = pAlbumInfo->GetDirectory(0); + AppLog("The directory path is %ls" , strDirectory.GetPointer()); + + Rectangle rectCanvas(ICON_CAP + FOLDER_CAP, Y_POS_CANVAS, CANVAS_WIDTH, CANVAS_HEIGHT); + Color bgColor(COLOR_CANVAS_BG); + bgColor.SetAlpha(ALPHA_BG); + canvas.FillRectangle(bgColor, rectCanvas); + + + if (strDirectory == RESERVED_DOWNLOAD_PATH) + { + pBitmap = ResourceManager::GetBitmapN(IDB_ALBUM_ICON_DOWNLOAD); + } + else if (strDirectory == RESERVED_CAMERA_PATH || strDirectory == RESERVED_CAMERA_PATH_EXT) + { + pBitmap = ResourceManager::GetBitmapN(IDB_ALBUM_ICON_CAMERA); + } + else + { + pBitmap = ResourceManager::GetBitmapN(IDB_ALBUM_ICON_FOLDER); + } + + if (pBitmap != null) + { + canvas.DrawBitmap(Rectangle(ICON_CAP + FOLDER_CAP, rectCanvas.y + HEIGHT_OFFSET, CANVAS_IMAGE_FOLDER_WIDTH, + CANVAS_IMAGE_FOLDER_HEIGHT), *pBitmap); + delete pBitmap; + } + + ftFolderName.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_NAME); + ftDate.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_DATE); + ftCnt.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_COUNT); + ftCntSmall.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_COUNT_SMALL); + + enText.Construct(Dimension(FOLDER_NAME_WIDTH, FOLDER_NAME_HEIGHT)); + enText.SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT); + + textElement.Construct(strFolderName); + textElement.SetFont(ftFolderName); + textElement.SetTextColor(Color::GetColor(COLOR_ID_WHITE)); + enText.SetTextAbbreviationEnabled(true); + enText.Add(textElement); + + enTextCount.Construct(Dimension(IMAGE_COUNT_WIDTH, IMAGE_COUNT_HEIGHT)); + enTextCount.SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT); + + textElementCount.Construct(strCnt); + + if (strCnt.GetLength() > 3) + { + textElementCount.SetFont(ftCntSmall); + } + else + { + textElementCount.SetFont(ftCnt); + } + textElementCount.SetTextColor(Color::GetColor(COLOR_ID_WHITE)); + enTextCount.SetTextAbbreviationEnabled(true); + enTextCount.Add(textElementCount); + + pointText = Point(CANVAS_MARGIN_LEFT + CANVAS_IMAGE_FOLDER_WIDTH + GAP + FOLDER_NAME_WIDTH, + rectCanvas.y + HEIGHT_OFFSET); + canvas.SetFont(ftCnt); + canvas.SetForegroundColor(Color::GetColor(COLOR_ID_WHITE)); + canvas.DrawText(pointText, enTextCount); + + pointText = Point(CANVAS_MARGIN_LEFT + CANVAS_IMAGE_FOLDER_WIDTH + GAP, + rectCanvas.y + GAP + HEIGHT_OFFSET); + canvas.SetForegroundColor(Color::GetColor(COLOR_ID_WHITE)); + canvas.DrawText(pointText, enText); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +Bitmap* +AlbumListPresentationModel::CreateMergeBitmapN(const int index) +{ + AppLogDebug("ENTER index(%d)", index); + + if (__pAlbumInfoList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + AlbumInfo* pAlbumInfo = static_cast(__pAlbumInfoList->GetAt(index)); + + Bitmap* pBitmapNew = new (std::nothrow) Bitmap(); + BufferInfo bufferinfo; + Canvas canvas; + Rectangle rectNew(0, 0, FOLDER_SIZE_WIDTH, FOLDER_SIZE_HEIGHT); + Dimension size(FOLDER_SIZE_WIDTH, FOLDER_SIZE_HEIGHT); + + result r = pBitmapNew->Construct(size, BITMAP_PIXEL_FORMAT_ARGB8888); + if (r != E_SUCCESS) + { + delete pBitmapNew; + AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + pBitmapNew->Lock(bufferinfo); + r = canvas.Construct(bufferinfo); + if (r != E_SUCCESS) + { + delete pBitmapNew; + AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + DrawPartialImage(canvas, pAlbumInfo, rectNew); + DrawFontImage(canvas, pAlbumInfo, index); + + pBitmapNew->Unlock(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pBitmapNew; +} + +result +AlbumListPresentationModel::StartAppControl(const String& providerId, const String& operationId, + const String* pUriData, const String* pMimeType, const HashMap* pDataList, + IAppControlResponseListener* pListener) +{ + AppLogDebug("ENTER"); + FileListPresentationModel::GetInstance()->ClearProviderId(); + AppControl* pAc = AppManager::FindAppControlN(providerId, operationId); + if (pAc == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + result r = pAc->Start(pUriData, pMimeType, pDataList, pListener); + + if (r == E_SUCCESS) + { + GalleryApp* pGalleryApp = static_cast(GalleryApp::GetInstance()); + pGalleryApp->SetFrameEnabled(false); + } + + delete pAc; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +String +AlbumListPresentationModel::GetDirectoryName(String& directoryPath) const +{ + AppLogDebug("ENTER"); + String directoryName; + int lastIndex = -1; + + directoryPath.LastIndexOf(DIRECTORY_SEPARATOR, directoryPath.GetLength() - 1, lastIndex); + directoryPath.SubString(lastIndex + 1, directoryName); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return directoryName; +} + +int +AlbumListPresentationModel::GetFolderCount(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pAlbumInfoList->GetCount(); +} + +void +AlbumListPresentationModel::InitializeAlbumInfoList(const ContentType& contentType) +{ + AppLogDebug("ENTER"); + + if (__pFolderBackgroundBitmap == null) + { + __pFolderBackgroundBitmap = ResourceManager::GetBitmapN(IDB_MAIN_FOLDER_BACKGROUND); + } + + if (__pAlbumInfoList != null) + { + delete __pAlbumInfoList; + } + __pAlbumInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + ContentDirectory directory; + + if (contentType == CONTENT_TYPE_ALL) + { + IListT* pListT = new (std::nothrow) ArrayListT(); + TryReturnVoid(pListT != null, "Unable to Create ArrayListT"); + pListT->Add(CONTENT_TYPE_IMAGE); + pListT->Add(CONTENT_TYPE_VIDEO); + + result r = directory.Construct(*pListT); + delete pListT; + + if (r != E_SUCCESS) + { + delete __pAlbumInfoList; + __pAlbumInfoList = null; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(r)); + return; + } + } + else + { + result r = directory.Construct(contentType); + if (r != E_SUCCESS) + { + delete __pAlbumInfoList; + __pAlbumInfoList = null; + AppLogDebug("EXIT 2(%s)", GetErrorMessage(r)); + return; + } + } + + IList* pContentDirectoryPathList = directory.GetContentDirectoryPathListN(SORT_ORDER_ASCENDING); + String* pDirPath = null; + AlbumInfo* pAlbumInfo = null; + + AlbumInfo* pAllAlbumInfo = new (std::nothrow) AlbumInfo(); + AlbumInfo* pCameraAlbumInfo = new (std::nothrow) AlbumInfo(); + AlbumInfo* pDownloadAlbumInfo = new (std::nothrow) AlbumInfo(); + AlbumInfo* pNoNameAlbumInfo = new (std::nothrow) AlbumInfo(); + + result r = pAllAlbumInfo->Construct(); + TryCatch(IsFailed(r) == E_SUCCESS,,"new pNoNameAlbumInfo is %s",GetErrorMessage(r)); + pAllAlbumInfo->SetAlbumName(ALL_ALBUMS_REAL_NAME); + + r = pCameraAlbumInfo->Construct(); + TryCatch(IsFailed(r) == E_SUCCESS,,"new pNoNameAlbumInfo is %s",GetErrorMessage(r)); + pCameraAlbumInfo->SetAlbumName(ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB")); + + r = pDownloadAlbumInfo->Construct(); + TryCatch(IsFailed(r) == E_SUCCESS,,"new pNoNameAlbumInfo is %s",GetErrorMessage(r)); + pDownloadAlbumInfo->SetAlbumName(ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS")); + + r = pNoNameAlbumInfo->Construct(); + TryCatch(IsFailed(r) == E_SUCCESS,,"new pNoNameAlbumInfo is %s",GetErrorMessage(r)); + pNoNameAlbumInfo->SetAlbumName(ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME")); + + if ((pContentDirectoryPathList != null) && (pContentDirectoryPathList->GetCount() > 0)) + { + IEnumerator* pEnum = pContentDirectoryPathList->GetEnumeratorN(); + while (pEnum->MoveNext() == E_SUCCESS) + { + pDirPath = static_cast(pEnum->GetCurrent()); + String mediaPath = RESERVED_MEDIA_PATH; + int length = mediaPath.GetLength(); + mediaPath.Remove(length-1,1); + + if (pDirPath == null) + { + continue; + } + if ((*pDirPath == RESERVED_CAMERA_PATH) ||(*pDirPath == RESERVED_CAMERA_PATH_EXT)) + { + IList* pContentIdList = GetContentIdListInDirectoryN(*pDirPath, contentType); + + if (pContentIdList != null) + { + pCameraAlbumInfo->AppendDirectory(*pDirPath); + pCameraAlbumInfo->AppendContentIdList(*pContentIdList); + + pAllAlbumInfo->AppendDirectory(*pDirPath); + pAllAlbumInfo->AppendContentIdList(*pContentIdList); + delete pContentIdList; + } + } + else if (*pDirPath == RESERVED_DOWNLOAD_PATH) + { + IList* pContentIdList = GetContentIdListInDirectoryN(*pDirPath, contentType); + + if (pContentIdList != null) + { + pDownloadAlbumInfo->AppendDirectory(*pDirPath); + pDownloadAlbumInfo->AppendContentIdList(*pContentIdList); + + pAllAlbumInfo->AppendDirectory(*pDirPath); + pAllAlbumInfo->AppendContentIdList(*pContentIdList); + + pContentIdList->RemoveAll(true); + delete pContentIdList; + } + } + else if (*pDirPath == mediaPath) + { + IList* pContentIdList = GetContentIdListInDirectoryN(*pDirPath, contentType); + + if (pContentIdList != null) + { + pNoNameAlbumInfo->AppendDirectory(*pDirPath); + pNoNameAlbumInfo->AppendContentIdList(*pContentIdList); + + pAllAlbumInfo->AppendDirectory(*pDirPath); + pAllAlbumInfo->AppendContentIdList(*pContentIdList); + + pContentIdList->RemoveAll(true); + delete pContentIdList; + } + } + else + { + IList* pContentIdList = GetContentIdListInDirectoryN(*pDirPath, contentType); + + if (pContentIdList != null) + { + if (pContentIdList->GetCount() > 0) + { + pAlbumInfo = new (std::nothrow) AlbumInfo(); + IList* pSubDirList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + pSubDirList->Add(new (std::nothrow) String(*pDirPath)); + + pAlbumInfo->Construct(GetDirectoryNameFromFullPath(*pDirPath), contentType, *pSubDirList, + *pContentIdList); + + pAllAlbumInfo->AppendDirectory(*pDirPath); + pAllAlbumInfo->AppendContentIdList(*pContentIdList); + + pSubDirList->RemoveAll(true); + delete pSubDirList; + } + + if (pContentIdList != NULL) + { + pContentIdList->RemoveAll(true); + delete pContentIdList; + } + } + if (pAlbumInfo != null && pAlbumInfo->GetContentIdCount() > 0) + { + __pAlbumInfoList->Add(pAlbumInfo); + AppLog("Adding album"); + } + else + { + delete pAlbumInfo; + } + pAlbumInfo = null; + } + } + + int insertIndex = 0; + if (pAllAlbumInfo->GetContentIdCount() > 0) + { + __pAlbumInfoList->InsertAt((Object&)*pAllAlbumInfo, insertIndex++); + } + else + { + delete pAllAlbumInfo; + } + + if (pCameraAlbumInfo->GetContentIdCount() > 0) + { + __pAlbumInfoList->InsertAt((Object&)*pCameraAlbumInfo, insertIndex++); + } + else + { + delete pCameraAlbumInfo; + } + + if (pDownloadAlbumInfo->GetContentIdCount() > 0) + { + __pAlbumInfoList->InsertAt((Object&)*pDownloadAlbumInfo, insertIndex++); + } + else + { + delete pDownloadAlbumInfo; + } + + if (pNoNameAlbumInfo->GetContentIdCount() > 0) + { + __pAlbumInfoList->InsertAt((Object&)*pNoNameAlbumInfo, insertIndex++); + } + else + { + delete pNoNameAlbumInfo; + } + + delete pEnum; + } + else + { + delete pAllAlbumInfo; + delete pCameraAlbumInfo; + delete pDownloadAlbumInfo; + delete pNoNameAlbumInfo; + } + + if (pContentDirectoryPathList != null) + { + pContentDirectoryPathList->RemoveAll(true); + delete pContentDirectoryPathList; + } + ClearThumbnailRequests(false); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return; + +CATCH: +if (pContentDirectoryPathList != null) +{ + pContentDirectoryPathList->RemoveAll(true); + delete pContentDirectoryPathList; +} + delete pAllAlbumInfo; + delete pCameraAlbumInfo; + delete pDownloadAlbumInfo; + delete pNoNameAlbumInfo; +} + +String +AlbumListPresentationModel::GetDirectoryNameFromFullPath(const String& fullPath)const +{ + AppLogDebug("ENTER"); + if (fullPath == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + String delim(DIRECTORY_SEPARATOR); + StringTokenizer st(fullPath,delim); + String token; + while (st.HasMoreTokens()) + { + st.GetNextToken(token); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return token; +} + +IList* +AlbumListPresentationModel::GetContentIdListInDirectoryN(const String& directoryPath, ContentType contentType)const +{ + AppLogDebug("ENTER"); + + if (&directoryPath == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return null; + } + + ContentDirectory directory; + const String contentDirectoryPath = directoryPath; + if (contentType == CONTENT_TYPE_ALL) + { + IListT* pListT = new (std::nothrow) ArrayListT(); + pListT->Add(CONTENT_TYPE_IMAGE); + pListT->Add(CONTENT_TYPE_VIDEO); + result r = directory.Construct(*pListT); + delete pListT; + if (r != E_SUCCESS) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + return null; + } + } + else + { + result r = directory.Construct(contentType); + if (r != E_SUCCESS) + { + AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); + return null; + } + } + + int pageNo = 1; + int countPerPage = directory.GetContentDirectoryItemCount(contentDirectoryPath); + + IList* pContentInfoList = directory.GetContentDirectoryItemListN(contentDirectoryPath, pageNo, countPerPage, + DATE_TIME, SORT_ORDER_DESCENDING); + + IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + if ((pContentInfoList != null) && (pContentInfoList->GetCount() > 0)) + { + IEnumerator* pEnum = pContentInfoList->GetEnumeratorN(); + ContentId* pItem; + while (pEnum->MoveNext() == E_SUCCESS) + { + ContentInfo* pContentInfo = static_cast(pEnum->GetCurrent()); + pItem = new (std::nothrow) ContentId(pContentInfo->GetContentId()); + pContentIdList->Add(pItem); + } + delete pEnum; + } + + if (pContentInfoList != NULL) + { + pContentInfoList->RemoveAll(true); + delete pContentInfoList; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pContentIdList; +} + +result +AlbumListPresentationModel::DeleteContentFile(const String& filePath) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + r = File::Remove(filePath); + AppLogDebug("Exit"); + return r; +} + +AppControlMode +AlbumListPresentationModel::GetAppControlMode(void) const +{ + AppLogDebug("Enter"); + AppLogDebug("Exit"); + return __appControlMode; +} + +AppControlMediaType +AlbumListPresentationModel::GetAppControlMediaType(void) const +{ + AppLogDebug("Enter"); + AppLogDebug("Exit"); + return __appControlMediaType; +} + +AppControlSelectionMode +AlbumListPresentationModel::GetAppControlSelectionMode(void) const +{ + AppLogDebug("Enter"); + AppLogDebug("Exit"); + return __appControlSelectionMode; +} + +IList* +AlbumListPresentationModel::GetAlbumInfoList(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pAlbumInfoList; +} + +IList* AlbumListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const +{ + AppLogDebug("ENTER"); + ContentDirectory directory; + IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + IListT* pListT = new (std::nothrow) ArrayListT(); + TryReturn(pListT != null,null, "Unable to Create ArrayListT"); + pListT->Add(CONTENT_TYPE_IMAGE); + pListT->Add(CONTENT_TYPE_VIDEO); + + result r = directory.Construct(*pListT); + delete pListT; + + if (r != E_SUCCESS) + { + AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); + delete pContentIdList; + return null; + } + + if (static_cast(indexList.GetAt(0))->ToInt() == 0) //if all-album is selected, get all files for delete + { + IList* pContentDirectoryPathList = directory.GetContentDirectoryPathListN(SORT_ORDER_ASCENDING); + String* pDirPath = null; + if ((pContentDirectoryPathList != null) && (pContentDirectoryPathList->GetCount() > 0)) + { + int loopCount = pContentDirectoryPathList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pDirPath = static_cast(pContentDirectoryPathList->GetAt(i)); + pContentIdList->AddItems(*(GetContentIdListInDirectoryN(*pDirPath, CONTENT_TYPE_ALL))); + } + } + } + else + { + if(__pAlbumInfoList != null) + { + int loopCount = indexList.GetCount(); + AlbumInfo* pInfo = null; + for (int i = 0; i < loopCount; ++i) + { + int index = static_cast(indexList.GetAt(i))->ToInt(); + pInfo = static_cast(__pAlbumInfoList->GetAt(index)); + + if(pInfo != null) + { + IList* pList = pInfo->GetContentIdListN(); + if(pList != null) + { + pContentIdList->AddItems(*pList); + } + } + } + } + } + return pContentIdList; +} + +void +AlbumListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg) +{ + AppLogDebug("ENTER"); + if (&eventArg != null) + { + ThumbnailEventArg* pThumbnailEventArg = static_cast(&eventArg); + if (pThumbnailEventArg == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + ThumbnailInfo* pThumbnailInfo = pThumbnailEventArg->GetThumbnailInfoN(); + if (pThumbnailInfo == null) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + ContentId contentId = pThumbnailInfo->GetContentId(); + ArrayList* pUpdateFolderIndex = new (std::nothrow) ArrayList(SingleObjectDeleter); + + if (__pAlbumInfoList != null) + { + int outterLoopCount = __pAlbumInfoList->GetCount(); + for (int x = 0; x < outterLoopCount; ++x) + { + AlbumInfo* pAlbumInfo = static_cast(__pAlbumInfoList->GetAt(x)); + int innerLoopCount = pAlbumInfo->GetContentIdCount(); + for (int i = 0; i < innerLoopCount; ++i) + { + if (i >= FOLDER_BITMAP_MAX) + { + break; + } + + if (contentId == pAlbumInfo->GetContentId(i)) + { + if (pAlbumInfo->GetFolderThumnailBitmap() == null) + { + pAlbumInfo->SetFolderThumnailBitmap(pThumbnailInfo->GetBitmapN()); + pUpdateFolderIndex->Add(new (std::nothrow) Integer(x)); + } + } + } + } + } + + delete pThumbnailInfo; + + if (__pPresentationModelListener->GetCount() > 0) + { + IEnumerator* pEnum = __pPresentationModelListener->GetEnumeratorN(); + while (pEnum->MoveNext() == E_SUCCESS) + { + IAlbumEventListener* pListener = null; + pListener = static_cast(pEnum->GetCurrent()); + + int loopCount = pUpdateFolderIndex->GetCount(); + for (int k = 0; k < loopCount; ++k) + { + Integer *pIndex = (Integer*)pUpdateFolderIndex->GetAt(k); + int folderIndex = pIndex->ToInt(); + pListener->OnThumbnailDecoded(folderIndex); + } + } + delete pEnum; + } + + delete pUpdateFolderIndex; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListPresentationModel::OnContentCreated(void) +{ + AppLogDebug("ENTER"); + if (__updateProgressStatus == true) + { + AppLogDebug("EXIT update in application"); + return; + } + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + if (pInterface != null) + { + pInterface->OnContentUpdated(); + } + } + delete pEventEnum; + AppLogDebug("EXIT"); +} + +void +AlbumListPresentationModel::OnContentUpdated(void) +{ + AppLogDebug("ENTER"); + if (__updateProgressStatus == true) + { + AppLogDebug("EXIT update in application"); + return; + } + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + AppLogDebug("EXIT"); +} + +void +AlbumListPresentationModel::OnContentDeleted(void) +{ + AppLogDebug("ENTER"); + if (__updateProgressStatus == true) + { + AppLogDebug("EXIT update in application"); + return; + } + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + AppLogDebug("EXIT"); +} + +void +AlbumListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state) +{ + AppLogDebug("ENTER"); + if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED) + { + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumListPresentationModel::SetUpdateProgressStatus(const bool status) +{ + AppLogDebug("ENTER status = %d",status); + __updateProgressStatus = status; + AppLogDebug("EXIT"); +} + +result +AlbumListPresentationModel::RotateImage(const ContentId&, RotateMode rotateMode) +{ + return E_SUCCESS; +} + +void +AlbumListPresentationModel::RequestThumbnail(const int folderIndex, const int pathIndex) +{ + AppLogDebug("ENTER : folderIndex(%d), pathIndex(%d)", folderIndex, pathIndex); + + ContentId contentId; + if (__pAlbumInfoList != null) + { + AlbumInfo* pAlbumInfo = static_cast(__pAlbumInfoList->GetAt(folderIndex)); + contentId = pAlbumInfo->GetContentId(pathIndex); + } + + __pThumbnailProvider->RequestThumbnail(contentId, __pThumbnailEvent); + AppLogDebug("EXIT"); +} + +void +AlbumListPresentationModel::ClearThumbnailRequests(const bool appTerminating) +{ + AppLogDebug("ENTER"); + if (__pThumbnailProvider != null) + { + __pThumbnailProvider->ClearThumbnailRequests(appTerminating); + } + AppLogDebug("EXIT"); +} diff --git a/src/GlAlbumNameEditorForm.cpp b/src/GlAlbumNameEditorForm.cpp new file mode 100644 index 0000000..f706bbc --- /dev/null +++ b/src/GlAlbumNameEditorForm.cpp @@ -0,0 +1,801 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAlbumNameEditorForm.cpp + * @brief This is the implementation file for AlbumNameEditorForm class. + */ + +#include +#include + +#include "GlAlbumInfo.h" +#include "GlAlbumListPresentationModel.h" +#include "GlAlbumNameEditorForm.h" +#include "GlFileListPresentationModel.h" +#include "GlFileMoveTimer.h" +#include "GlProgressAnimation.h" +#include "GlResourceManager.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; +using namespace Tizen::System; +using namespace Tizen::Text; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const unsigned int COLOR_NAME_EDIT_FIELD = Color32<255, 255, 255>::Value; + +AlbumNameEditorForm::AlbumNameEditorForm(void) + : __pNameEditField(null) + , __folderIndex(0) + , __modalMsgBoxResult(0) + , __textLength(0) + , __mountState(false) + , __isCreateAlbum(false) + , __isKeyPadOpen(false) + , __albumNameEditorMode(ALBUM_NAME_EDITOR_MODE_RENAME) + , __pMessageBox(null) + , __pMoveIndexList(null) + , __fileActionMode(FILE_ACTION_MOVE) + , __pFileMove(null) + , __pPresentationModel(null) + , __pFilePresentationModel(null) +{ + AppLogDebug("ENTER"); + _overlayMsg = false; + _pProgressAnim = null; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AlbumNameEditorForm::~AlbumNameEditorForm(void) +{ + AppLogDebug("ENTER"); + delete __pFileMove; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumNameEditorForm::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(L"IDL_FORM_ALBUM_NAME_EDITOR"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AlbumNameEditorForm::OnInitializing(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + __pFilePresentationModel = FileListPresentationModel::GetInstance(); + + SetOrientation(ORIENTATION_AUTOMATIC); + AddOrientationEventListener(*this); + + Header* pHeader = GetHeader(); + + pHeader->SetStyle(HEADER_STYLE_TITLE); + + FooterItem itemSave; + itemSave.Construct(IDA_BUTTON_CREATE_NAME_SAVE); + itemSave.SetText(ResourceManager::GetString(L"IDS_COM_OPT_SAVE")); + + GetFooter()->AddItem(itemSave); + GetFooter()->AddActionEventListener(*this); + GetFooter()->Invalidate(true); + + SetFormBackEventListener(this); + SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true); + + __pNameEditField = static_cast(GetControl(L"IDC_EDITFIELD_NAME")); + __pNameEditField->AddTextEventListener(*this); + __pNameEditField->SetColor(EDIT_STATUS_NORMAL, COLOR_NAME_EDIT_FIELD); + __pNameEditField->SetOverlayKeypadCommandButtonVisible(false); + __pNameEditField->AddKeypadEventListener(*this); + __pNameEditField->AddActionEventListener(*this); + + return E_SUCCESS; +} + +void +AlbumNameEditorForm::OnTextValueChanged(const Control& source) +{ + String currentInput; + String currentText; + String specialCharacters(L"/"); + String byteCountForInput; + int byteCount = 0; + int inputLength = 0; + int tempLength = 255; + int textToCheck = 0; + MessageBox messageBox; + Utf8Encoding utf8; + + FooterItemStatus currentStatus = FOOTER_ITEM_STATUS_NORMAL; + + result r = E_SUCCESS; + + if (__pNameEditField != null) + { + byteCountForInput = __pNameEditField->GetText(); + r = utf8.GetByteCount(byteCountForInput, byteCount); + AppLogDebug("result is %s",GetErrorMessage(r)); + AppLogDebug("Byte count is %d",byteCount); + } + + if (__pNameEditField != null) + { + currentText = __pNameEditField->GetText(); + textToCheck = currentText.GetLength() - __textLength; + if (currentText.IsEmpty()) + { + if (GetFooter() != null) + { + GetFooter()->SetItemEnabled(0, false); + GetFooter()->Invalidate(true); + } + } + else + { + if (GetFooter() != null) + { + GetFooter()->GetItemStatus(0, currentStatus); + + if (currentStatus == FOOTER_ITEM_STATUS_DISABLED) + { + GetFooter()->SetItemEnabled(0,true); + GetFooter()->Invalidate(true); + } + } + } + + if (currentText.StartsWith(".", 0)) + { + String invalidCharacterString; + String validString; + String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS"); + CreateMessage(msg); + validString = __pNameEditField->GetText(); + + if (validString.GetLength() > 1) + { + validString.Remove(0,1); + __pNameEditField->SetText(validString); + } + else + { + __pNameEditField->SetText(""); + + if (GetFooter() != null) + { + GetFooter()->SetItemEnabled(0, false); + GetFooter()->Invalidate(true); + } + } + __pNameEditField->ShowKeypad(); + } + + currentInput = __pNameEditField->GetText(); + + if (currentInput.Contains(specialCharacters[0])) + { + String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS"); + CreateMessage(msg); + currentInput.Replace("/", ""); + __pNameEditField->SetText(currentInput); + + if (currentInput == L"") + { + if (GetFooter() != null) + { + GetFooter()->SetItemEnabled(0, false); + GetFooter()->Invalidate(true); + } + } + } + + byteCountForInput = __pNameEditField->GetText(); + r = utf8.GetByteCount(byteCountForInput, inputLength); + + if ( inputLength == tempLength ) + { + String msg = ResourceManager::GetString(L"IDS_COM_POP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED"); + CreateMessage(msg); + __pNameEditField->ShowKeypad(); + return; + } + else if (inputLength > tempLength) + { + String maxCharacterString; + String currentInputCharacter; + int checkByteCount = 0; + int lengthOfFinalString = 0; + int currentCharacter = 0; + + String msg = ResourceManager::GetString(L"IDS_COM_POP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED"); + CreateMessage(msg); + currentText = __pNameEditField->GetText(); + + for (currentCharacter=0; checkByteCount < tempLength; ++currentCharacter) + { + currentInputCharacter.Clear(); + currentInputCharacter = currentText[currentCharacter]; + r = utf8.GetByteCount(currentInputCharacter, byteCount); + if (r != E_SUCCESS) + { + break; + } + AppLogDebug("result of byte count is %s",GetErrorMessage(r)); + checkByteCount = checkByteCount + byteCount; + + if (checkByteCount < tempLength) + { + ++lengthOfFinalString; + } + } + + r = __pNameEditField->GetText().SubString(0, lengthOfFinalString, currentInput); + AppLogDebug("current input is %S", currentInput.GetPointer()); + r = __pNameEditField->SetText(currentInput); + __pNameEditField->ShowKeypad(); + return; + } + + r = utf8.GetByteCount(__pNameEditField->GetText(), byteCount); + __textLength = byteCount; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::OnTextValueChangeCanceled(const Control& source) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AlbumNameEditorForm::OnTerminating(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void AlbumNameEditorForm::OnFileOpInvalidate(enum FileActionMode actionId) +{ + Invalidate(true); +} + +void AlbumNameEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res) +{ + _overlayMsg = false; + if (res != COMPLETE_SUCCESS) + { + __pNameEditField->SetText(__nameEditFieldPreText); + __pNameEditField->HideKeypad(); + __pNameEditField->Draw(); + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId)); + } +} + +void +AlbumNameEditorForm::OnRenameAlbum(String& strOri) +{ + AppLogDebug("Rename Album"); + String path; + int index = 0; + strOri.Reverse(); + strOri.IndexOf(DIRECTORY_SEPARATOR, 0, index); + strOri.Reverse(); + strOri.SubString(0, (strOri.GetLength() - index), path); + path.Append(__nameEditFieldText); + + //Rename + result r = __pPresentationModel->RenameAlbum(strOri, path, this); + + if (IsFailed(r)) + { + AppLogDebug("Unable to rename Album %s", GetErrorMessage(r)); + if (__pMessageBox == null) + { + __pMessageBox = new (std::nothrow) MessageBox(); + if (r == E_FILE_ALREADY_EXIST) + { + __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_MEDIABR_BODY_UNABLE_TO_RENAME_ALBUM_NAME_ALREADY_IN_USE_ABB"), + MSGBOX_STYLE_NONE, 3000); + + } + else + { + __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_MEDIABR_POP_UNABLE_TO_RENAME"), + MSGBOX_STYLE_NONE, 3000); + } + int modalResult = 0; + _overlayMsg = true; + __pMessageBox->ShowAndWait(modalResult); + _overlayMsg = false; + delete __pMessageBox; + __pMessageBox = null; + __pNameEditField->SetEnabled(true); + __pNameEditField->ShowKeypad(); + } + } + else + { + //Add a popup here + Rectangle clientRect = Form::GetBounds(); + Rectangle rect(0, 0, clientRect.width, clientRect.height); + _pProgressAnim = new (std::nothrow) ProgressAnimation; + _pProgressAnim->Construct(rect); + AddControl(_pProgressAnim); + _pProgressAnim->SetShowState(true); + GetFooter()->SetEnabled(false); + _pProgressAnim->AnimationStart(); + _pProgressAnim->Draw(); + _overlayMsg = true; + } +} + +void +AlbumNameEditorForm::ShowAnimation() +{ + Rectangle clientRect= GetClientAreaBounds(); + Rectangle rect(0, 0, clientRect.width, clientRect.height); + _pProgressAnim = new (std::nothrow) ProgressAnimation; + _pProgressAnim->Construct(rect); + AddControl(_pProgressAnim); + _pProgressAnim->SetShowState(true); + GetFooter()->SetEnabled(false); + _pProgressAnim->AnimationStart(); + _pProgressAnim->Draw(); + _overlayMsg = true; +} + +void +AlbumNameEditorForm::StopAnimation(void) +{ + if (_pProgressAnim) + { + _pProgressAnim->AnimationStop(); + _pProgressAnim->SetShowState(false); + RemoveControl(_pProgressAnim); + GetFooter()->SetEnabled(true); + _pProgressAnim = null; + _overlayMsg = false; + } +} + +void +AlbumNameEditorForm::OnCreateAlbum(void) +{ + String path; + path.Append(Tizen::System::Environment::GetMediaPath()); + path.Append(__nameEditFieldText); + + if (__previousSceneId != IDSCN_ALL_LIST_EDITOR && __previousSceneId != IDSCN_ALL_LIST_SELECTION) + { + Directory::Create(path, true); + } + + __nameEditFieldPreText = __nameEditFieldText; + + if (path.IsEmpty()) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete __pMoveIndexList; + __pMoveIndexList = null; + return; + } + + if (__pMoveIndexList == null || __pMoveIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + delete __pMoveIndexList; + __pMoveIndexList = null; + return; + } + + delete __pFileMove; + __pFileMove = new (std::nothrow) FileMoveTimer(path, __pMoveIndexList, __pFilePresentationModel, this); + if (__fileActionMode == FILE_ACTION_COPY) + { + AppLogDebug("Rash: Setting to Copy in AlbumNameEditor"); + __pFileMove->SetCopy(); + } + else + { + __pFileMove->ClearCopy(); + } + result r = __pFileMove->StartTimer(); + + if (IsFailed(r)) + { + delete __pFileMove; + __pFileMove = null; + __pNameEditField->SetText(__nameEditFieldPreText); + __pNameEditField->HideKeypad(); + __pNameEditField->Draw(); + + String msg = ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"); + CreateMessage(msg); + AppLogDebug("MoveToContentFileList content failed (%s)", GetErrorMessage(r)); + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId)); + } + else + { + AppLogDebug("MoveToContentFileList content in progress"); + _overlayMsg = true; + __fileActionMode = FILE_ACTION_MOVE; + } +} + +void +AlbumNameEditorForm::OnAlbumRenameComplete(void) +{ + //Hide popup here.. + _pProgressAnim->AnimationStop(); + _pProgressAnim->SetShowState(false); + RemoveControl(_pProgressAnim); + _overlayMsg = false; + GetFooter()->SetEnabled(true); + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoBackward((BackwardSceneTransition(IDSCN_ALBUM_LIST))); +} + +void +AlbumNameEditorForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + String path; + __nameEditFieldText = __pNameEditField->GetText(); + + if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME) + { + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(__folderIndex)); + path = pAlbumInfo->GetDirectory(0); + } + + switch (actionId) + { + case IDA_BUTTON_CREATE_NAME_SAVE: + { + __pNameEditField->SetEnabled(false); + __isCreateAlbum = false; + GetFooter()->SetItemEnabled(0, false); + + if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE) + { + if (__isKeyPadOpen == true ) + { + __pNameEditField->HideKeypad(); + __isCreateAlbum = true; + } + else + { + OnCreateAlbum(); + } + + } + else if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME) + { + String albumName = __pNameEditField->GetText(); + if (__originalText.Equals(albumName, true)) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoBackward(BackwardSceneTransition()); + } + else + { + OnRenameAlbum(path); + } + } + break; + } + + default: + break; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("ENTER"); + if (_pProgressAnim != null) + { + if (_pProgressAnim->GetShowState()) + { + return; + } + } + + if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(__callerSceneId)); + } + else + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST_EDITOR)); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + __pPresentationModel = AlbumListPresentationModel::GetInstance(); + __previousSceneId = previousSceneId; + + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + __pPresentationModel->AddContentEventListener(this); + + if (pArgs != null) + { + Integer* pAlbumTypePtr = static_cast(pArgs->GetAt(ALBUM_FIRST_ELEMENT)); + if (pAlbumTypePtr->ToInt() == ALBUM_CREATE) + { + AppLogDebug("ALBUM_NAME_EDITOR_MODE_CREATE"); + __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_CREATE; + } + else if (pAlbumTypePtr->ToInt() == ALBUM_RENAME) + { + AppLogDebug("ALBUM_NAME_EDITOR_MODE_RENAME"); + __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_RENAME; + } + pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true); + } + + if (pArgs != null) + { + Integer* operationTypePtr = static_cast(pArgs->GetAt(ALBUM_FIRST_ELEMENT)); + if (operationTypePtr->ToInt() == FILE_ACTION_MOVE) + { + AppLogDebug("Rash: FILE_MOVE_ACTION"); + __fileActionMode = FILE_ACTION_MOVE; + } + else if (operationTypePtr->ToInt() == FILE_ACTION_COPY) + { + AppLogDebug("Rash: FILE_COPY_ACTION"); + __fileActionMode = FILE_ACTION_COPY; + } + pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true); + } + + if (previousSceneId == IDSCN_ALBUM_LIST_EDITOR) + { + if (pArgs != null) + { + IEnumerator* pEnum = pArgs->GetEnumeratorN(); + if (pEnum->MoveNext() == E_SUCCESS) + { + Integer *index = static_cast(pEnum->GetCurrent()); + if (index != null) + { + __folderIndex = index->ToInt(); + } + } + delete pEnum; + delete pArgs; + pArgs = NULL; + } + } + + if (previousSceneId == IDSCN_ALL_LIST_EDITOR + || previousSceneId == IDSCN_IMAGE_LIST_EDITOR + || previousSceneId == IDSCN_VIDEO_LIST_EDITOR + || previousSceneId == IDSCN_ALL_LIST_SELECTION) + { + if (previousSceneId == IDSCN_ALL_LIST_EDITOR) + { + AppLogDebug("[MOVE] previousSceneId = IDSCN_ALL_LIST_EDITOR"); + } + else if (previousSceneId == IDSCN_ALL_LIST_SELECTION) + { + AppLogDebug("[MOVE] previousSceneId = IDSCN_ALL_LIST_SELECTION"); + } + + __callerSceneId = previousSceneId; + } + else + { + __callerSceneId = EMPTY_SPACE; + } + + if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE) + { + __nameEditFieldText = EMPTY_SPACE; + __nameEditFieldPreText = EMPTY_SPACE; + __pNameEditField->SetText(__nameEditFieldText); + __nameEditFieldTempText = __nameEditFieldText; + __pNameEditField->ShowKeypad(); + __pNameEditField->SetFocus(); + + GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM")); + GetFooter()->SetItemEnabled(0, false); + GetFooter()->Invalidate(true); + } + else + { + int byteCount = 0; + Utf8Encoding utf8; + IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList(); + AlbumInfo* pAlbumInfo = static_cast(pAlbumInfoList->GetAt(__folderIndex)); + + String strName = pAlbumInfo->GetAlbumName(); + __nameEditFieldText = strName; + __nameEditFieldPreText = strName; + __pNameEditField->SetText(__nameEditFieldText); + __nameEditFieldTempText = __nameEditFieldText; + GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_RENAME")); + __pNameEditField->SetOverlayKeypadCommandButtonVisible(false); + __pNameEditField->ShowKeypad(); + __pNameEditField->SetFocus(); + __originalText = __pNameEditField->GetText(); + utf8.GetByteCount(__nameEditFieldText, byteCount); + __textLength = byteCount; + GetFooter()->SetItemEnabled(0, true); + GetFooter()->Invalidate(true); + } + + if (pArgs != NULL) + { + __pMoveIndexList = pArgs; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + + if(__pNameEditField->IsEnabled() == false) + { + __pNameEditField->SetEnabled(true); + } + + __isKeyPadOpen = false; + + __pPresentationModel->RemoveContentEventListener(*this); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::OnContentUpdated(void) +{ + AppLogDebug("ENTER"); + + if (__mountState == false) + { + if (__pFileMove && __pFileMove->IsStarted()) + { + __pFileMove->Cancel(); + delete __pFileMove; + __pFileMove = null; + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + } + else + { + __mountState = false; + } +} + +void +AlbumNameEditorForm::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state) +{ + AppLogDebug("ENTER"); + + if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED) + { + if (__pFileMove && __pFileMove->IsStarted()) + { + __pFileMove->Cancel(); + delete __pFileMove; + __pFileMove = null; + } + __mountState = false; + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + } + else + { + __mountState = true; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::CreateMessage(String& str) +{ + if (__pMessageBox == null) + { + __pMessageBox = new(std::nothrow) MessageBox; + + if (__pMessageBox != null) + { + __pMessageBox->Construct(L"", str, MSGBOX_STYLE_OK, 3000); + __pMessageBox->ShowAndWait(__modalMsgBoxResult); + + delete __pMessageBox; + __pMessageBox = null; + __modalMsgBoxResult = 0; + } + } +} + +void +AlbumNameEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + if (_pProgressAnim != null) + { + _pProgressAnim->ChangeOrientation(Form::GetBounds()); + _pProgressAnim->Invalidate(true); + } +} + +void +AlbumNameEditorForm::OnKeypadClosed(Tizen::Ui::Control& source) +{ + AppLogDebug("ENTER"); + + if ( __isCreateAlbum == true) + { + OnCreateAlbum(); + __isCreateAlbum = false; + } + __isKeyPadOpen = false; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AlbumNameEditorForm::OnKeypadOpened(Tizen::Ui::Control& source) +{ + AppLogDebug("ENTER"); + __isKeyPadOpen = true; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlAllListEditorPanel.cpp b/src/GlAllListEditorPanel.cpp new file mode 100644 index 0000000..d019e21 --- /dev/null +++ b/src/GlAllListEditorPanel.cpp @@ -0,0 +1,951 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAllListEditorPanel.cpp + * @brief This is the implementation file for AllListEditorPanel class. + */ + +#include +#include "GlAllListEditorPanel.h" +#include "GlCommonUtil.h" +#include "GlFileUpdateTimer.h" +#include "GlFileListEditorForm.h" +#include "GlFileListPresentationModel.h" +#include "GlResourceManager.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const float H_COUNT_LABEL = 48.0f; +static const float H_COUNT_LABEL_BUTTON = 42.0f; +static const float W_COUNT_LABEL_BUTTON = 42.0f; +static const int COUNT_LABEL_FONT_SIZE = 33; +static const int H_CONTENT_MARGIN = 9; +static const int W_CONTENT_MARGIN = 6; +static const int W_CONTENT_SPACE = 6; +static const int H_CONTENT_SPACE = 6; +static const int LENGTH_COUNT_LABEL = 256; +static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value; +static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value; +static const unsigned int COLOR_COUNT_LABEL_BUTTON = Color32<120, 120, 120>::Value; +static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK)); +static const int ALPHA_THUMBNAIL_DIM = 70; + +static const Rectangle RECT_INITIAL (0, 0, 10, 10); + +AllListEditorPanel::AllListEditorPanel(void) + : __itemCount(0) + , __pContentIconListView(null) + , __pLabelSelectCnt(null) + , __pButtonSelectRegion(null) + , __pFileUpdateTimer(null) + , __pFileListEditorForm(null) + , __pPresentationModel(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AllListEditorPanel::~AllListEditorPanel(void) +{ + AppLogDebug("ENTER"); + delete __pFileUpdateTimer; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AllListEditorPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(RECT_INITIAL); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListEditorPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + + FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF(); + SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height); + + + __pContentIconListView = new (std::nothrow) IconListView(); + __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL), + DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN); + __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __pLabelSelectCnt = new (std::nothrow) Label(); + String strTmp; + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED").GetPointer(); + __pLabelSelectCnt->Construct( + FloatRectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), strTmp); + __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL); + __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT)); + __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD); + AddControl(__pLabelSelectCnt); + __pLabelSelectCnt->Invalidate(true); + + __pButtonSelectRegion = new (std::nothrow) Button(); + __pButtonSelectRegion->Construct(FloatRectangle(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10, + clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON), + EMPTY_SPACE); + __pButtonSelectRegion->SetActionId(IDA_BUTTON_MOVE_TO_SELECTION); + __pButtonSelectRegion->SetColor(BUTTON_STATUS_NORMAL, COLOR_COUNT_LABEL_BUTTON); + Bitmap* pSelectionBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MOVE_SELECTION); + if (pSelectionBitmap != null) + { + Rectangle buttonRegionRect = __pButtonSelectRegion->GetBounds(); + pSelectionBitmap->Scale(Dimension(buttonRegionRect.width, buttonRegionRect.height)); + __pButtonSelectRegion->SetNormalBitmap(Point(buttonRegionRect.width, buttonRegionRect.height), + *pSelectionBitmap); + } + AddControl(__pButtonSelectRegion); + + if (pSelectionBitmap != null) + { + delete pSelectionBitmap; + } + __pButtonSelectRegion->AddActionEventListener(*this); + + __itemCount = 0; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +AllListEditorPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemovePresentationModelListener(*this); + __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +AllListEditorPanel::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + switch (actionId) + { + case IDA_BUTTON_CHECKED: + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i=0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == false) + { + __pContentIconListView->SetItemChecked(i, true); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + int checkedCount = GetItemCheckedCount(); + String strTmp; + + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + SetButtonState(); + } + break; + + case IDA_BUTTON_UNCHECKED: + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == true) + { + __pContentIconListView->SetItemChecked(i,false); + } + } + int checkedCount = GetItemCheckedCount(); + String strTmp; + + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + __pContentIconListView->UpdateList(); + SetButtonState(); + } + break; + + case IDA_BUTTON_MOVE_TO_SELECTION: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + IList* pList = GetItemCheckedIndexListN(); + if (pList == null) + { + pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + } + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_SELECTION), pList); + } + else + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_SELECTION)); + } + } + break; + + default: + break; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +AllListEditorPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +IconListViewItem* +AllListEditorPanel::CreateItem(int index) +{ + AppLogDebug("ENTER : index(%d)", index); + IconListViewItem* pIconListviewItem; + Bitmap* pBitmap = null; + String* pItemText = null; + result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap); + if (pBitmap == null || r == E_FAILURE) + { + __pPresentationModel->RequestThumbnail(index); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + if (pItemText == null) + { + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE")) + { + delete pItemText; + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + if (__pContentIconListView->IsItemChecked(index) == true) + { + if (pBitmap != null) + { + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + Color dimColor(COLOR_THUMBNAIL_DIM); + dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM); + + Canvas canvas; + canvas.Construct(bufferInfo); + canvas.FillRectangle(dimColor, canvas.GetBounds()); + + Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap(); + pSelectedBitmap->Construct(canvas, canvas.GetBounds()); + pIconListviewItem = new (std::nothrow) IconListViewItem(); + pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap); + delete pSelectedBitmap; + } + else + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete pItemText; + return null; + } + } + else + { + pIconListviewItem = new (std::nothrow) IconListViewItem(); + pIconListviewItem->Construct(*pBitmap, pItemText); + } + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pIconListviewItem; +} + +bool +AllListEditorPanel::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +AllListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED) + { + int checkedCount = GetItemCheckedCount(); + String strTmp; + + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if (contentType == CONTENT_TYPE_ALL + || contentType == CONTENT_TYPE_IMAGE + || contentType == CONTENT_TYPE_VIDEO) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + if (index >= 0) + { + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + + ChangeOrientation(); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + __pFileListEditorForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturnVoid(__pFileListEditorForm != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + __pPresentationModel->AddContentEventListener(__pFileListEditorForm); + + if (previousSceneId == IDSCN_ALL_LIST_SELECTION) + { + if (pArgs != null) + { + if (__pContentIconListView != null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + __pContentIconListView->SetItemChecked(i, false); + } + __pContentIconListView->UpdateList(); + } + + if (pArgs->GetCount() > 0) //SomeItems are Still Selected. + { + IList* pSeletedIndexList = pArgs; + int loopCount = pSeletedIndexList->GetCount(); + if (__pContentIconListView != null) + { + for (int i = 0; i < loopCount; ++i) + { + int index = static_cast(pSeletedIndexList->GetAt(i))->ToInt(); + __pContentIconListView->SetItemChecked(index, true); + } + __pContentIconListView->UpdateList(); + } + } + } + + int checkedCount = GetItemCheckedCount(); + String strTmp; + + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + } + else if (previousSceneId == IDSCN_ALL_LIST) + { + ResetSelection(); + } + + SetButtonState(); + + __pFileListEditorForm->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT")); + + if (pArgs != null && pArgs->GetCount() > 0 && previousSceneId != IDSCN_ALL_LIST_SELECTION) + { + String* pDirectory = static_cast(pArgs->GetAt(0)); + if (pDirectory != null && pDirectory->GetLength() > 0) + { + __pFileListEditorForm->MoveToAlbum(*pDirectory); + } + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +AllListEditorPanel::GetItemCheckedCount(void) const +{ + AppLogDebug("ENTER"); + int count = 0; + if (__pContentIconListView != null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + ++count; + } + else + { + AppLog("Index i = %d is Not Checked", i); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return count; +} + +IList* +AllListEditorPanel::GetItemCheckedIndexListN(void) const +{ + AppLogDebug("ENTER"); + IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + Integer* pIndex = null; + + if (__pContentIconListView!=null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == true) + { + pIndex = new (std::nothrow) Integer(i); + pList->Add(pIndex); + AppLogDebug("checked index(%d)", i); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pList; +} + +result +AllListEditorPanel::OnRequestDelete(void) +{ + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + delete __pFileUpdateTimer; + __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) + { + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; + } + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + return E_SUCCESS; +} + +void AllListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId) +{ + __pFileListEditorForm->Invalidate(true); +} + +void AllListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res) +{ + __pPresentationModel->SetUpdateProgressStatus(false); + + __pLabelSelectCnt->SetText(ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED")); + __pLabelSelectCnt->RequestRedraw(true); + + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (GetItemCount() > 0) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY)); + } + else + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY)); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::ChangeOrientation(void) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + const Form* pForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF(); + SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height); + __pContentIconListView->SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL); + __pLabelSelectCnt->SetBounds(0.0f, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL); + __pButtonSelectRegion->SetBounds(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10.0f, + clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4.0f, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON); +} + +result +AllListEditorPanel::OnRequestMessage(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null || pIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + Integer* pIndex = null; + int checkedIndex; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pIndex = static_cast(pIndexList->GetAt(i)); + if (pIndex != null) + { + checkedIndex = pIndex->ToInt(); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex))); + } + } + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, null, + null, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListEditorPanel::OnRequestEmail(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null || pIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + Integer* pIndex = null; + int checkedIndex; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pIndex = static_cast(pIndexList->GetAt(i)); + if (pIndex != null) + { + checkedIndex = pIndex->ToInt(); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex))); + } + } + + const String uriData = APPCONTROL_URI_MAIL_TO; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE, + &uriData, null, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListEditorPanel::OnRequestSlideShow(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + + Integer* pRealIndex = null; + int realIndex = -1; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pRealIndex = static_cast(pIndexList->GetAt(i)); + if (pRealIndex != null) + { + realIndex = pRealIndex->ToInt(); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(realIndex))); + } + } + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + const String mimeType = APPCONTROL_MIME_IMAGE_ALL; + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, + &mimeType, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + delete pIndexList; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +AllListEditorPanel::ResetSelection(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + + for (int index = 0; index < __itemCount; ++index) + { + __pContentIconListView->SetItemChecked(index, false); + __pContentIconListView->RefreshList(index,LIST_REFRESH_TYPE_ITEM_MODIFY); + } + + String strTmp; + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::SetButtonState(void) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + if (GetItemCheckedCount() > 0) + { + AppLogDebug("BUTTONSTATE : Request Enable"); + __pFileListEditorForm->SetFooterButtonsState(true); + __pButtonSelectRegion->SetShowState(true); + } + else + { + AppLogDebug("BUTTONSTATE : Request disable"); + __pFileListEditorForm->SetFooterButtonsState(false); + __pButtonSelectRegion->SetShowState(false); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListEditorPanel::OnSelectAllPressed(void) +{ + bool needToSelectAll = true; + int checkedCount = GetItemCheckedCount(); + int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + if (checkedCount == totalFileCount) + { + needToSelectAll = false; + } + + if (needToSelectAll == true) + { + for (int i = 0; i < totalFileCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == false) + { + __pContentIconListView->SetItemChecked(i,true); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + else + { + for (int i = 0; i < totalFileCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == true) + { + __pContentIconListView->SetItemChecked(i, false); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + + String tempString; + if (needToSelectAll == true) + { + tempString.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount); + } + else + { + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + + __pLabelSelectCnt->SetText(tempString); + __pLabelSelectCnt->RequestRedraw(true); + SetButtonState(); +} + +result +AllListEditorPanel::OnRequestRotate(RotateMode rotateMode) +{ + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + else if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + delete __pFileUpdateTimer; + __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_ROTATE, rotateMode); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) + { + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; + } + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + return E_SUCCESS; +} + +void AllListEditorPanel::CancelUpdateProgress(void) +{ + if (__pFileUpdateTimer!= null && __pFileUpdateTimer->IsStarted()) + { + __pFileUpdateTimer->Cancel(); + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + } +} + +void +AllListEditorPanel::OnScanDirStart() +{ + AppLogDebug("ENTER"); + __pFileListEditorForm->SetProgressState(true); + AppLogDebug("EXIT"); +} +void +AllListEditorPanel::OnScanDirComplete() +{ + AppLogDebug("ENTER"); + __pFileListEditorForm->SetProgressState(false); + AppLogDebug("EXIT"); +} diff --git a/src/GlAllListPanel.cpp b/src/GlAllListPanel.cpp new file mode 100644 index 0000000..21a7cdb --- /dev/null +++ b/src/GlAllListPanel.cpp @@ -0,0 +1,415 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAllListPanel.cpp + * @brief This is the implementation file for AllListPanel class. + */ + +#include "GlAlbumInfo.h" +#include "GlAllListPanel.h" +#include "GlCommonUtil.h" +#include "GlFileListForm.h" +#include "GlFileListPresentationModel.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const Rectangle RECT_INITIAL (0, 0, 10, 10); +static const int W_CLIENT = 720; +static const int H_CONTENT_MARGIN = 9; +static const int W_CONTENT_MARGIN = 6; +static const int W_CONTENT_SPACE = 6; +static const int H_CONTENT_SPACE = 6; + +AllListPanel::AllListPanel(void) + : __itemCount(0) + , __pContentIconListView(null) + , __pPresentationModel(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AllListPanel::~AllListPanel(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListPanel::Refresh(void) +{ + AppLogDebug("ENTER"); + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_IMAGE) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE); + } + else if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_VIDEO) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_VIDEO); + } + else + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_VIDEO); + } + } + else + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + } + + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + if (__itemCount == 0) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_DESTROY_OPTION_KEEP)); + } + else + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + FileListForm* pFileListForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + if (pFileListForm != null) + { + pFileListForm->SetMenuState(true); + } + } + + __pContentIconListView->UpdateList(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AllListPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(RECT_INITIAL); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + AppAssert(pForm); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + clientAreaBounds.x = clientAreaBounds.y = 0; + SetBounds(clientAreaBounds); + + __pContentIconListView = new (std::nothrow) IconListView(); + __pContentIconListView->Construct(Rectangle(0, 0, W_CLIENT, clientAreaBounds.height), + DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN); + __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + result r = AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __itemCount = 0; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST) + { + FileListForm* pFileListForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + __pPresentationModel->RemoveContentEventListener(pFileListForm); + } + __pPresentationModel->RemovePresentationModelListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +int +AllListPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +IconListViewItem* +AllListPanel::CreateItem(int index) +{ + AppLogDebug("ENTER : index(%d)", index); + Bitmap* pBitmap=null; + String* pItemText=null; + result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap); + if (r != E_SUCCESS) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return null; + } + + IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem(); + + if (pBitmap == null) + { + __pPresentationModel->RequestThumbnail(index); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + if (pItemText == null) + { + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE")) + { + delete pItemText; + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + if (pItemText != null) + { + pIconListviewItem->Construct(*pBitmap, pItemText); + } + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pIconListviewItem; +} + +bool +AllListPanel::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER : index(%d)", index); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +AllListPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + if (status == ICON_LIST_VIEW_ITEM_SELECTED) + { + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + + ArrayList* pArrayList = new (std::nothrow) ArrayList(); + pArrayList->Construct(); + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + + for (int i = 0; i < loopCount; ++i) + { + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i))); + } + + String listIndex; + listIndex.Format(10, L"%d", index); + const String mimeType = APPCONTROL_MIME_IMAGE_ALL; + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_IMAGE)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pArrayList); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_INDEX), new (std::nothrow) String(listIndex)); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, + &mimeType, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + String* pTemp = null; + loopCount = pArrayList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pTemp = static_cast(pArrayList->GetAt(i)); + AppLog("print temp(%ls)", pTemp->GetPointer()); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if (contentType == CONTENT_TYPE_ALL || contentType == CONTENT_TYPE_IMAGE + || contentType == CONTENT_TYPE_VIDEO) + { + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + if (index >= 0) + { + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListPanel::ChangeOrientation(void) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + const Form* pForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height); + __pContentIconListView->SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height); +} + +void +AllListPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + ChangeOrientation(); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + + if (currentSceneId == IDSCN_ALL_LIST) + { + if (previousSceneId == IDSCN_ALBUM_LIST && pArgs != null) + { + AlbumInfo* pAlbumInfo = static_cast(pArgs->GetAt(0)); + if (pAlbumInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + IList* pDirectoryList = pAlbumInfo->GetDirectoryListN(); + __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList); + if (pDirectoryList != null) + { + delete pDirectoryList; + } + + delete pArgs; + + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + else + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + } + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST) + { + FileListForm* pFileListForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + if (pFileListForm != null) + { + pFileListForm->SetTitleText(__pPresentationModel->GetCurrentAlbumName()); + + if (__itemCount == 0) + { + pFileListForm->SetMenuState(false); + } + else + { + pFileListForm->SetMenuState(true); + } + + } + __pPresentationModel->AddContentEventListener(pFileListForm); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListPanel::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST) + { + FileListForm* pFileListForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + __pPresentationModel->RemoveContentEventListener(pFileListForm); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlAllListSelectionPanel.cpp b/src/GlAllListSelectionPanel.cpp new file mode 100644 index 0000000..51c2f45 --- /dev/null +++ b/src/GlAllListSelectionPanel.cpp @@ -0,0 +1,808 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlAllListSelectionPanel.cpp + * @brief This is the implementation file for AllListSelectionPanel class. + */ + +#include "GlAllListSelectionPanel.h" +#include "GlCommonUtil.h" +#include "GlFileListEditorForm.h" +#include "GlFileListPresentationModel.h" +#include "GlResourceManager.h" +#include "GlTypes.h" +#include "GlFileUpdateTimer.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const int LENGTH_COUNT_LABEL = 256; +static const int H_CONTENT_MARGIN = 9; +static const int W_CONTENT_MARGIN = 6; +static const int W_CONTENT_SPACE = 6; +static const int H_CONTENT_SPACE = 6; +static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK)); +static const int ALPHA_THUMBNAIL_DIM = 70; + +static const Rectangle RECT_INITIAL (0, 0, 10, 10); + +AllListSelectionPanel::AllListSelectionPanel(void) + : __itemCount(0) + , __pContentIconListView(null) + , __pSeletedIndexList(null) + , __pFileListEditorForm(null) + , __pFileUpdateTimer(null) + , __pPresentationModel(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +AllListSelectionPanel::~AllListSelectionPanel(void) +{ + AppLogDebug("ENTER"); + delete __pFileUpdateTimer; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +AllListSelectionPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return Construct(RECT_INITIAL); // Should be set proper area at OnInitializing() +} + +result +AllListSelectionPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + clientAreaBounds.x = clientAreaBounds.y = 0; + result r = SetBounds(clientAreaBounds); + + __pContentIconListView = new (std::nothrow) IconListView(); + __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height), + DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN); + __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __itemCount = 0; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListSelectionPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + __pPresentationModel->RemovePresentationModelListener(*this); + if (__pSeletedIndexList != null) + { + delete __pSeletedIndexList; + __pSeletedIndexList = null; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +int +AllListSelectionPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +IconListViewItem* +AllListSelectionPanel::CreateItem(int index) +{ + AppLogDebug("ENTER : index(%d)", index); + IconListViewItem* pIconListviewItem; + Bitmap* pBitmap = null; + String* pItemText = null; + + int realIndex = GetRealindexFromVirtualIndex(index); + result r = __pPresentationModel->GetThumbnailInSyncCacheN(realIndex, pItemText, pBitmap); + if (pBitmap == null || r == E_FAILURE) + { + __pPresentationModel->RequestThumbnail(realIndex); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + if (pItemText == null) + { + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE")) + { + delete pItemText; + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + if (__pContentIconListView->IsItemChecked(index) == true) + { + if (pBitmap != null) + { + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + + Color dimColor(COLOR_THUMBNAIL_DIM); + dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM); + + Canvas canvas; + canvas.Construct(bufferInfo); + canvas.FillRectangle(dimColor, canvas.GetBounds()); + + Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap(); + pSelectedBitmap->Construct(canvas, canvas.GetBounds()); + pIconListviewItem = new (std::nothrow) IconListViewItem(); + pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap); + delete pSelectedBitmap; + } + else + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete pItemText; + return null; + } + + } + else + { + pIconListviewItem = new (std::nothrow) IconListViewItem(); + pIconListviewItem->Construct(*pBitmap, pItemText); + } + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pIconListviewItem; +} + +bool +AllListSelectionPanel::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +AllListSelectionPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + String strTmp; + strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", + ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), GetItemCheckedCount()); + __pFileListEditorForm->SetTitleText(strTmp); + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + if (index >= 0) + { + int virtualIndex = -1; + int loopCount = __pSeletedIndexList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + virtualIndex = GetVirtualIndexFromRealIndex(index); + if (virtualIndex >= 0) + { + __pContentIconListView->RefreshList(virtualIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + break; + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + + ChangeOrientation(); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + __pFileListEditorForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturnVoid(__pFileListEditorForm != null, "[%s] fail to get FileListEditorForm.", GetErrorMessage(GetLastResult())); + __pPresentationModel->AddContentEventListener(__pFileListEditorForm); + + if (previousSceneId == IDSCN_ALL_LIST_EDITOR) + { + if (pArgs != null) + { + __pSeletedIndexList = pArgs; + } + ResetSelection(); + int loopCount = __pSeletedIndexList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + __pContentIconListView->SetItemChecked(i, true); + __pContentIconListView->RequestRedraw(true); + } + } + SetButtonState(); + + if (pArgs != null && pArgs->GetCount() > 0) + { + String* pDirectory = static_cast(pArgs->GetAt(0)); + if (pDirectory != null && pDirectory->GetLength() > 0) + { + __pFileListEditorForm->MoveToAlbum(*pDirectory); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +AllListSelectionPanel::GetItemCheckedCount(void) const +{ + AppLogDebug("ENTER"); + int count = 0; + if (__pContentIconListView != null && __pSeletedIndexList != null) + { + int loopCount = __pSeletedIndexList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + ++count; + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return count; +} + +IList* +AllListSelectionPanel::GetItemCheckedIndexListN(void) const +{ + AppLogDebug("ENTER"); + IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + Integer* pIndex = null; + + if (__pContentIconListView!=null) + { + int realIndex = -1; + int loopCount = __pSeletedIndexList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + realIndex = GetRealindexFromVirtualIndex(i); + pIndex = new (std::nothrow) Integer(realIndex); + pList->Add(pIndex); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pList; +} + +int +AllListSelectionPanel::GetRealindexFromVirtualIndex(const int virtualIndex) const +{ + if (__pSeletedIndexList == null || __pSeletedIndexList->GetCount() == 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return -1; + } + + Integer* pRealIndex = static_cast(__pSeletedIndexList->GetAt(virtualIndex)); + int realIndex = -1; + if (pRealIndex != null) + { + realIndex = pRealIndex->ToInt(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return realIndex; +} + +int +AllListSelectionPanel::GetVirtualIndexFromRealIndex(const int realIndex) const +{ + int returnValue = -1; + int loopCount = __pSeletedIndexList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + Integer* pRealIndex = static_cast(__pSeletedIndexList->GetAt(i)); + int index = -1; + if (pRealIndex != null) + { + index = pRealIndex->ToInt(); + } + + if (index == realIndex) + { + returnValue = i; + break; + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return returnValue; +} + +result +AllListSelectionPanel::OnRequestDelete(void) +{ + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + delete __pFileUpdateTimer; + __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) + { + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; + } + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + + return E_SUCCESS; +} + +void AllListSelectionPanel::OnFileOpInvalidate(enum FileActionMode actionId) +{ + __pFileListEditorForm->Invalidate(true); +} + +void AllListSelectionPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res) +{ + __pPresentationModel->SetUpdateProgressStatus(false); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", + GetErrorMessage(GetLastResult())); + + String strTmp; + String selectString = ResourceManager::GetString(L"IDS_COM_BODY_SELECTED"); + strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", selectString.GetPointer(), 0); + __pFileListEditorForm->SetTitleText(strTmp); + + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + + if (GetItemCount() > 0) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY)); + } + else + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::ChangeOrientation() +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + const Form* pForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height); + __pContentIconListView->SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height); +} + +result +AllListSelectionPanel::OnRequestMessage(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null || pIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + Integer* pIndex = null; + int checkedIndex; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pIndex = static_cast(pIndexList->GetAt(i)); + if (pIndex != null) + { + checkedIndex = pIndex->ToInt(); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex))); + } + } + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, null, + null, pDataList, null); + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListSelectionPanel::OnRequestEmail(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null || pIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + Integer* pIndex = null; + int checkedIndex; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pIndex = static_cast(pIndexList->GetAt(i)); + if (pIndex != null) + { + checkedIndex = pIndex->ToInt(); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex))); + } + } + + const String uriData = APPCONTROL_URI_MAIL_TO; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE, + &uriData, null, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +AllListSelectionPanel::OnRequestSlideShow(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + + Integer* pRealIndex = null; + int realIndex = -1; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pRealIndex = static_cast(pIndexList->GetAt(i)); + if (pRealIndex != null) + { + realIndex = pRealIndex->ToInt(); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(realIndex))); + } + } + + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + const String mimeType = APPCONTROL_MIME_IMAGE_ALL; + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, + &mimeType, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +AllListSelectionPanel::ResetSelection(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL); + if (__pSeletedIndexList == null) + { + __itemCount = 0; + } + else + { + __itemCount = __pSeletedIndexList->GetCount(); + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + String strTmp; + String bodyText = ResourceManager::GetString(L"IDS_COM_BODY_SELECTED"); + strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", bodyText.GetPointer(), __itemCount); + __pFileListEditorForm->SetTitleText(strTmp); + + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::SetButtonState(void) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + if (GetItemCheckedCount() > 0) + { + AppLogDebug("BUTTONSTATE : Request Enable"); + __pFileListEditorForm->SetFooterButtonsState(true); + } + else + { + AppLogDebug("BUTTONSTATE : Request disable"); + __pFileListEditorForm->SetFooterButtonsState(false); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +AllListSelectionPanel::OnSelectAllPressed(void) +{ + bool needToSelectAll = true; + int checkedCount = GetItemCheckedCount(); + if (checkedCount == __itemCount) + { + needToSelectAll = false; + } + + if (needToSelectAll == true) + { + for (int i = 0; i < __itemCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == false) + { + __pContentIconListView->SetItemChecked(i, true); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + else + { + for (int i = 0; i < __itemCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == true) + { + __pContentIconListView->SetItemChecked(i, false); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + String tempString; + if (needToSelectAll == true) + { + tempString.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", + ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), __itemCount); + } + else + { + tempString.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", + ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0); + } + __pFileListEditorForm->SetTitleText(tempString); + + SetButtonState(); +} + +result +AllListSelectionPanel::OnRotateRequested(RotateMode rotateMode) +{ + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + if (pIndexList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + else if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + delete __pFileUpdateTimer; + __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_ROTATE, rotateMode); + result r = __pFileUpdateTimer->StartTimer(); + + if (IsFailed(r)) + { + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + return E_FAILURE; + } + else + { + __pPresentationModel->SetUpdateProgressStatus(true); + } + return E_SUCCESS; +} + +void AllListSelectionPanel::CancelUpdateProgress(void) +{ + if (__pFileUpdateTimer!= null && __pFileUpdateTimer->IsStarted()) + { + __pFileUpdateTimer->Cancel(); + delete __pFileUpdateTimer; + __pFileUpdateTimer = null; + } +} + +void +AllListSelectionPanel::OnScanDirStart() +{ + AppLogDebug("ENTER"); + __pFileListEditorForm->SetProgressState(true); + AppLogDebug("EXIT"); +} +void +AllListSelectionPanel::OnScanDirComplete() +{ + AppLogDebug("ENTER"); + __pFileListEditorForm->SetProgressState(false); + AppLogDebug("EXIT"); +} diff --git a/src/GlBaseForm.cpp b/src/GlBaseForm.cpp new file mode 100644 index 0000000..cfe5ba4 --- /dev/null +++ b/src/GlBaseForm.cpp @@ -0,0 +1,115 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlBaseForm.cpp + * @brief This is the implementation file for GlBaseForm class. + */ + +#include "GlFileListPresentationModel.h" +#include "GlBaseForm.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Base::Utility; + +IList* +BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList, FileListPresentationModel* pPresentationModel, bool isCopyOp) +{ + if (&moveDir == null || moveDir.IsEmpty()) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return null; + } + + if (pMoveIndexList == null || pMoveIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + return null; + } + + IList* pCollisionList = pPresentationModel->GetCollisionIndexListN(*pMoveIndexList, moveDir); + + if (pCollisionList != null) + { + int loopCount = pCollisionList->GetCount(); + int collisionCount = 0; + for (int i = 0; i < loopCount; ++i) + { + String* pCollisionString = const_cast(static_cast(pCollisionList->GetAt(i))); + String tmpString; + + if (pCollisionString != null) + { + tmpString = (*pCollisionString); + } + + String delim(MULTI_ITEM_SEPARATOR); + StringTokenizer st(tmpString, delim); + String token; + + int collisionIndex; + String fileName; + + if (st.HasMoreTokens() == true) + { + st.GetNextToken(token); + Integer::Parse(token, collisionIndex); + + if (st.HasMoreTokens() == true) + { + st.GetNextToken(fileName); + } + + int innerLoopCount = pMoveIndexList->GetCount(); + for (int j = 0; j < innerLoopCount; ++j) + { + if (collisionIndex == (const_cast(static_cast + (pMoveIndexList->GetAt(j))))->ToInt()) + { + pMoveIndexList->RemoveAt(j, true); + --j; + --innerLoopCount; + ++collisionCount; + } + } + } + } + + pCollisionList->RemoveAll(true); + delete pCollisionList; + + if (collisionCount > 0) + { + MessageBox messageBox; + + if ( isCopyOp) + { + messageBox.Construct(L"", L"Unable to copy some files. Same files exists", + MSGBOX_STYLE_NONE, 3000); + } + else + { + messageBox.Construct(L"", L"Unable to move some files. Same files exists", + MSGBOX_STYLE_NONE, 3000); + } + int modalResult; + messageBox.ShowAndWait(modalResult); + } + } + return pMoveIndexList; +} diff --git a/src/GlCommonUtil.cpp b/src/GlCommonUtil.cpp new file mode 100644 index 0000000..c148472 --- /dev/null +++ b/src/GlCommonUtil.cpp @@ -0,0 +1,66 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlCommonUtil.cpp + * @brief This is the implementation file for CommonUtil class. + */ + +#include + +#include "GlCommonUtil.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Graphics; + +static const int W_DEFAULT_THUMBNAIL = 171; +static const int H_DEFAULT_THUMBNAIL = 127; +static const int BASE_STANDARD = 1000; +static const int FORMAT_TIME = 10; +static const String DATETIME_FORMAT = L"%02d:%02d:%02d"; + +Bitmap* +CommonUtil::GetEmptyThumbnailN(void) +{ + Rectangle mainRect(0, 0, W_DEFAULT_THUMBNAIL, H_DEFAULT_THUMBNAIL); + Bitmap* pBitmap = new (std::nothrow) Bitmap(); + result r = pBitmap->Construct(mainRect); + if (r != E_SUCCESS) + { + delete pBitmap; + return null; + } + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + Canvas mainCanvas; + mainCanvas.Construct(bufferInfo); + mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), mainCanvas.GetBounds()); + mainCanvas.DrawBitmap(mainRect, *pBitmap); + return pBitmap; +} + +String +CommonUtil::DurationToTimeString(const long duration) +{ + String strTime; + DateTime dateTime; + dateTime.AddSeconds(duration / BASE_STANDARD); + strTime.Format(FORMAT_TIME, DATETIME_FORMAT.GetPointer(), dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond()); + return strTime; +} diff --git a/src/GlContentUpdateEventListener.cpp b/src/GlContentUpdateEventListener.cpp new file mode 100644 index 0000000..6025d6f --- /dev/null +++ b/src/GlContentUpdateEventListener.cpp @@ -0,0 +1,284 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlContentUpdateEventListener.cpp + * @brief This is the implementation file for ContentUpdateEventListener class. + */ + +#include +#include +#include "GlContentUpdateEventListener.h" +#include "GlFileListPresentationModel.h" +#include "GlAlbumListPresentationModel.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; + +ContentUpdateEventListener* ContentUpdateEventListener::__pContentUpdateEventListener = null; + +ContentUpdateEventListener::ContentUpdateEventListener(void) + : __pContentManager(null) + , __isTimerActive(false) + , __changeNotificationReceived(false) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT"); +} + +ContentUpdateEventListener::~ContentUpdateEventListener(void) +{ + AppLogDebug("ENTER"); + + if(__pContentManager != null) + { + __pContentManager->RemoveContentUpdateEventListener(*this); + delete __pContentManager; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ContentUpdateEventListener* +ContentUpdateEventListener::GetInstance(void) +{ + AppLogDebug("ENTER"); + + if (__pContentUpdateEventListener == null) + { + CreateInstance(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pContentUpdateEventListener; +} + +void ContentUpdateEventListener::AddContentListener(void) +{ + if(__pContentManager != null) + { + __pContentManager->AddContentUpdateEventListener(*this); + } +} + +void ContentUpdateEventListener::RemoveContentListener(void) +{ + if(__pContentManager != null) + { + __pContentManager->RemoveContentUpdateEventListener(*this); + } +} + +result +ContentUpdateEventListener::Construct(void) +{ + AppLogDebug("ENTER"); + + __pContentManager = new (std::nothrow) ContentManager(); + + if (__pContentManager != null) + { + __pContentManager->Construct(); + __pContentManager->AddContentUpdateEventListener(*this); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return E_SUCCESS; +} + +void +ContentUpdateEventListener::CreateInstance(void) +{ + AppLogDebug("ENTER"); + __pContentUpdateEventListener = new (std::nothrow) ContentUpdateEventListener(); + + if (__pContentUpdateEventListener != null) + { + result r = __pContentUpdateEventListener->Construct(); + + if (IsFailed(r) == true) + { + delete __pContentUpdateEventListener; + __pContentUpdateEventListener = null; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + } + + std::atexit(DestroyInstance); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ContentUpdateEventListener::DestroyInstance(void) +{ + AppLogDebug("ENTER"); + + if (__pContentUpdateEventListener != null) + { + delete __pContentUpdateEventListener; + __pContentUpdateEventListener = null; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +ContentUpdateEventListener::GetChangeNotificationStatus() +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT"); + return __changeNotificationReceived; +} + +void +ContentUpdateEventListener::ResumeOperation() +{ + AppLogDebug("ENTER"); + AlbumListPresentationModel::GetInstance()->OnContentDeleted(); + FileListPresentationModel::GetInstance()->OnContentDeleted(); + __changeNotificationReceived = false; + AppLogDebug("EXIT"); +} + +String +ContentUpdateEventListener::GetDirecotyNameFromFullPath(const String& fullPath)const +{ + AppLogDebug("ENTER"); + if (fullPath == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + String delim(DIRECTORY_SEPARATOR); + StringTokenizer st(fullPath,delim); + String token; + String tokenPrev; + while (st.HasMoreTokens()) + { + tokenPrev = token; + st.GetNextToken(token); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return tokenPrev; +} + +void +ContentUpdateEventListener::OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) +{ + AppLogDebug("ENTER"); + if ( !__isTimerActive && ( contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO) ) + { + Tizen::Content::ContentInfo* cntInfo = __pContentManager->GetContentInfoN(contentId); + + if ( cntInfo != NULL) + { + String path = cntInfo->GetContentPath(); + String dirName = GetDirecotyNameFromFullPath(path); + + FileListPresentationModel* pFileListPM = FileListPresentationModel::GetInstance(); + pFileListPM->AddDirectoryIfNew(dirName); + AlbumListPresentationModel::GetInstance()->OnContentCreated(); + pFileListPM->OnContentCreated(); + } + } + + AppLogDebug("EXIT"); +} + +void +ContentUpdateEventListener::OnContentFileUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) +{ + AppLogDebug("ENTER"); + + if ( !__isTimerActive && ( contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO) ) + { + AlbumListPresentationModel::GetInstance()->OnContentUpdated(); + FileListPresentationModel::GetInstance()->OnContentUpdated(); + } + else + { + FileListPresentationModel::GetInstance()->OnContentUpdated(contentId); + } + AppLogDebug("EXIT"); +} + +void +ContentUpdateEventListener::OnContentFileDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) +{ + AppLogDebug("ENTER"); + + if ( !__isTimerActive && ( contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO) ) + { + Tizen::App::UiApp* appPtr = Tizen::App::UiApp::GetInstance(); + if (appPtr->GetAppUiState() == Tizen::App::APP_UI_STATE_FOREGROUND) + { + AlbumListPresentationModel::GetInstance()->OnContentDeleted(); + FileListPresentationModel::GetInstance()->OnContentDeleted(); + } + else + { + __changeNotificationReceived = true; + } + + } + AppLogDebug("EXIT"); +} + +void +ContentUpdateEventListener::OnContentDirectoryScanCompleted(const Tizen::Base::String& directoryPath, result r) +{ + AppLogDebug("ENTER"); + + if ( __isTimerActive ) + { + AlbumListPresentationModel::GetInstance()->OnContentScanCompleted( directoryPath ); + return; + } + Tizen::App::UiApp* appPtr = Tizen::App::UiApp::GetInstance(); + if (appPtr->GetAppUiState() == Tizen::App::APP_UI_STATE_FOREGROUND) + { + AlbumListPresentationModel::GetInstance()->OnContentDeleted(); + FileListPresentationModel::GetInstance()->OnContentDeleted(); + AlbumListPresentationModel::GetInstance()->OnContentScanCompleted(directoryPath); + } + else + { + bool renameHandled = AlbumListPresentationModel::GetInstance()->OnContentScanCompleted(directoryPath); + if (!renameHandled) + { + __changeNotificationReceived = true; + } + } + + AppLogDebug("EXIT"); +} +void +ContentUpdateEventListener::SetTimerActive(void) +{ + __isTimerActive = true; +} + +void +ContentUpdateEventListener::ReSetTimerActive(void) +{ + __isTimerActive = false; +} diff --git a/src/GlDropDownCustomItem.cpp b/src/GlDropDownCustomItem.cpp new file mode 100644 index 0000000..37e143d --- /dev/null +++ b/src/GlDropDownCustomItem.cpp @@ -0,0 +1,131 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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: DropDownCustomItem + *@brief: To create Drop Down custom item + * + */ + +#include +#include "GlDropDownCustomItem.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + +const int DropDownCustomItem::IDA_FORMAT_BITMAP = 101; +const int DropDownCustomItem::IDA_FORMAT_MAIN_STRING = 102; +const int DropDownCustomItem::IDA_FORMAT_SUB_STRING = 103; +const int DropDownCustomItem::IDA_FORMAT_DROPPER = 104; + +DropDownCustomItem::DropDownCustomItem(void) + : __currentState(DROP_DOWN_ITEM_STATE_CLOSED) + , __height(0) + , __width(0) +{ +} + +DropDownCustomItem::~DropDownCustomItem(void) +{ +} + +result +DropDownCustomItem::Construct(int width, int height) +{ + __width = width; + __height = height + 28; + Dimension dim(__width, __height); + result r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL); + return r; +} + +void +DropDownCustomItem::SetMainText(const Tizen::Base::String& text) +{ + __mainText = text; +} + +String +DropDownCustomItem::GetMainText(void) const +{ + return __mainText; +} + +void +DropDownCustomItem::SetSubText(const Tizen::Base::String& text) +{ + __subText = text; +} + +String +DropDownCustomItem::GetSubText(void) const +{ + return __subText; +} + +result +DropDownCustomItem::Make(int fontsize, int itemHeight) +{ + AppLogDebug("DropDownCustomItem::Make entered"); + + int xMargin = 26; + int yMargin = 22; + int subTextHeight = 42; + int mainTextHeight = itemHeight - yMargin - subTextHeight + 15; + + Tizen::Graphics::Bitmap* pDropperBitmapNormal = null; + Tizen::Graphics::Bitmap* pDropperBitmapPressed = null; + + AddElement(Rectangle(xMargin, yMargin, __width - 126, mainTextHeight), IDA_FORMAT_MAIN_STRING,__mainText, fontsize, + CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT); + AddElement(Rectangle(xMargin, yMargin + mainTextHeight, __width - 126, subTextHeight), IDA_FORMAT_SUB_STRING,__subText, 34, CUSTOM_COLOR_GREY , CUSTOM_COLOR_LISTVIEW_TEXT, CUSTOM_COLOR_LISTVIEW_TEXT); + + AppResource* pAppResource = UiApp::GetInstance()->GetAppResource(); + if (pAppResource) + { + if (GetCurState() == DROP_DOWN_ITEM_STATE_CLOSED) + { + pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED, BITMAP_PIXEL_FORMAT_ARGB8888); + pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + } + else + { + pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED, BITMAP_PIXEL_FORMAT_ARGB8888); + pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + } + + AddElement(Rectangle(__width - 85, (__height - 64) / 2, 64, 64), IDA_FORMAT_DROPPER, *pDropperBitmapNormal, pDropperBitmapPressed, pDropperBitmapNormal); + delete pDropperBitmapNormal; + delete pDropperBitmapPressed; + } + + return E_SUCCESS; +} + +DropDownItemState +DropDownCustomItem::GetCurState(void) const +{ + return __currentState; +} + +void +DropDownCustomItem::SetCurState(const DropDownItemState state) +{ + __currentState = state; +} diff --git a/src/GlFileListEditorForm.cpp b/src/GlFileListEditorForm.cpp new file mode 100644 index 0000000..30f36f9 --- /dev/null +++ b/src/GlFileListEditorForm.cpp @@ -0,0 +1,1430 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileListEditorForm.cpp + * @brief This is the implementation file for FileListEditorForm class. + */ + +#include "GlAllListEditorPanel.h" +#include "GlAllListSelectionPanel.h" +#include "GlFileListEditorForm.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlImageListEditorPanel.h" +#include "GlProgressAnimation.h" +#include "GlResourceManager.h" +#include "GlSlideSettingListener.h" +#include "GlSlideShowPopUp.h" +#include "GlTypes.h" +#include "GlVideoListEditorPanel.h" +#include "GlFileMoveTimer.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; +using namespace Tizen::Base::Utility; + +static const int GAP_W_POPUP_ITEM = 10; +static const int W_DELETE_POPUP = 688; +static const int H_DELETE_POPUP = 230; +static const int H_DELETE_LABEL = 80; +static const int Y_DELETE_BUTTON = 132; +static const int H_DELETE_BUTTON = 74; +static const int W_DELETE_BUTTON = 318; +static const int H_TOAST_LABEL = 48; +static const int Y_DELETE_LABEL = 32; + +static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value; +static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value; +static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value; + +static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath(); + +FileListEditorForm::FileListEditorForm(void) + : __pShareContextMenu(null) + , __pOptionMenu(null) + , __pDeletePopup(null) + , __morePosition(Point(0, 0)) + , __pContentDirectoryList(null) + , __pContentDirectoryNameList(null) + , __pPopUp(null) + , __pFileMove(null) + , __isCopyOperation(false) + , __pPresentationModel(null) + , __isScanProgress(false) +{ + AppLogDebug("ENTER"); + _overlayMsg = false; + _pProgressAnim = null; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +FileListEditorForm::~FileListEditorForm(void) +{ + AppLogDebug("ENTER"); + if (__pContentDirectoryList != null) + { + __pContentDirectoryList->RemoveAll(true); + delete __pContentDirectoryList; + __pContentDirectoryList = null; + } + + if (__pPopUp != null) + { + delete __pPopUp; + __pPopUp = null; + } + + if (__pContentDirectoryNameList != null) + { + __pContentDirectoryNameList->RemoveAll(true); + delete __pContentDirectoryNameList; + __pContentDirectoryNameList = null; + } + delete __pFileMove; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +FileListEditorForm::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER | FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE | FORM_STYLE_PORTRAIT_INDICATOR_AUTO_HIDE); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +FileListEditorForm::ShowAnimation() +{ + AppLogDebug("ENTER"); + Rectangle clientRect= GetClientAreaBounds(); + Rectangle rect(0, 0, clientRect.width, clientRect.height); + _pProgressAnim = new (std::nothrow) ProgressAnimation; + _pProgressAnim->Construct(rect); + AddControl(_pProgressAnim); + _pProgressAnim->SetShowState(true); + GetFooter()->SetEnabled(false); + _pProgressAnim->AnimationStart(); + _pProgressAnim->Draw(); + _overlayMsg = true; + AppLogDebug("EXIT"); +} + +void +FileListEditorForm::StopAnimation(void) +{ + AppLogDebug("ENTER"); + if (_pProgressAnim) + { + _pProgressAnim->AnimationStop(); + _pProgressAnim->SetShowState(false); + RemoveControl(_pProgressAnim); + GetFooter()->SetEnabled(true); + _pProgressAnim = null; + _overlayMsg = false; + } + AppLogDebug("EXIT"); +} + +result +FileListEditorForm::OnInitializing(void) +{ + AppLogDebug("ENTER"); + Header* pHeader = GetHeader(); + TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult())); + + SetOrientation(ORIENTATION_AUTOMATIC); + AddOrientationEventListener(*this); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + + pHeader->SetStyle(HEADER_STYLE_TITLE); + pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT")); + + if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK + && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false) + { + Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL); + Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS); + ButtonItem selectAll; + selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL); + selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap); + selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap); + pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll); + delete pNormalBitmap; + delete pPressBitmap; + } + + pHeader->AddActionEventListener(*this); + + InitializeFooter(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +FileListEditorForm::InitializeFooter(void) +{ + AppLogDebug("ENTER"); + Footer* pFooter = GetFooter(); + TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult())); + pFooter->RemoveAllItems(); + + result r = E_SUCCESS; + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE) + { + pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); + + FooterItem footerConfirm; + footerConfirm.Construct(IDA_FOOTER_CONFIRM); + footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE")); + pFooter->AddItem(footerConfirm); + pFooter->SetItemEnabled(0, false); + pFooter->SetShowState(true); + pFooter->Invalidate(true); + } + else + { + pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT); + pFooter->SetShowState(false); + pFooter->Invalidate(true); + } + + SetFormBackEventListener(this); + + } + else + { + pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT); + SetFormMenuEventListener(this); + + FooterItem footerShare; + r = footerShare.Construct(IDA_FOOTER_SHARE); + TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r)); + Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE); + Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM); + + if (pBitmapShare != null && pBitmapShareDim != null) + { + footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare); + footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim); + } + + r = pFooter->AddItem(footerShare); + delete pBitmapShare; + delete pBitmapShareDim; + TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r)); + + FooterItem footerDelete; + r = footerDelete.Construct(IDA_FOOTER_DELETE); + TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r)); + Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE); + Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM); + + if (pBitmapDelete != null && pBitmapDeleteDim != null) + { + footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete); + footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim); + } + + r = pFooter->AddItem(footerDelete); + delete pBitmapDelete; + delete pBitmapDeleteDim; + TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r)); + + SetFormBackEventListener(this); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + int checkedCount = 0; + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + checkedCount = pEditorPanel->GetItemCheckedCount(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + checkedCount = pSelectionPanel->GetItemCheckedCount(); + } + } + + AppLogDebug("GetItemCheckedCount(%d)", checkedCount); + + if (__pOptionMenu != null) + { + delete __pOptionMenu; + __pOptionMenu = null; + } + + __pOptionMenu = new (std::nothrow) OptionMenu(); + __pOptionMenu->Construct(); + __pOptionMenu->AddActionEventListener(*this); + + if (__pContentDirectoryNameList != null) + { + __pContentDirectoryNameList->RemoveAll(true); + delete __pContentDirectoryNameList; + __pContentDirectoryNameList = null; + } + + SetUpPopup(); + } + + pFooter->AddActionEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +String +FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const +{ + AppLogDebug("ENTER"); + if (fullPath == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + String delim(DIRECTORY_SEPARATOR); + StringTokenizer st(fullPath,delim); + String token; + while (st.HasMoreTokens()) + { + st.GetNextToken(token); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return token; +} + +result +FileListEditorForm::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(this); + + if (__pOptionMenu != null) + { + __pOptionMenu->RemoveActionEventListener(*this); + delete __pOptionMenu; + __pOptionMenu = null; + } + + if (__pShareContextMenu != null) + { + __pShareContextMenu->RemoveActionEventListener(*this); + delete __pShareContextMenu; + __pShareContextMenu = null; + } + + if (__pDeletePopup != null) + { + delete __pDeletePopup; + __pDeletePopup = null; + } + _overlayMsg = false; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +FileListEditorForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER(actionId=%d)", actionId); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + switch (actionId) + { + case IDA_FILE_LIST_SELECT_ALL: + SelectAllPressed(); + break; + + case IDA_FOOTER_SHARE: + { + if (__pShareContextMenu != NULL) + { + delete __pShareContextMenu; + __pShareContextMenu = null; + } + + Bitmap* pBitmapEmailContextItem = null; + Bitmap* pBitmapMessageContextItem = null; + pBitmapEmailContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_EMAIL_ICON); + pBitmapMessageContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_MESSAGE_ICON); + + __pShareContextMenu = new (std::nothrow) ContextMenu(); + __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), + CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD); + + if ( pBitmapMessageContextItem != null) + { + __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), + IDA_CONTEXT_MENU_SHARE_MESSAGE, *pBitmapMessageContextItem, null, null); + delete pBitmapMessageContextItem; + } + + if ( pBitmapEmailContextItem != null) + { + __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), + IDA_CONTEXT_MENU_SHARE_EMAIL, *pBitmapEmailContextItem, null, null); + delete pBitmapEmailContextItem; + } + __pShareContextMenu->SetFocusable(true); + __pShareContextMenu->AddActionEventListener(*this); + + + Rectangle rect = source.GetBounds(); + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y)); + } + else + { + __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL)); + } + + __pShareContextMenu->SetShowState(true); + __pShareContextMenu->Show(); + + } + break; + + case IDA_FOOTER_DELETE: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0) + { + __pDeletePopup->SetShowState(true); + __pDeletePopup->Show(); + _overlayMsg = true; + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + ImageListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0) + { + __pDeletePopup->SetShowState(true); + __pDeletePopup->Show(); + _overlayMsg = true; + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR) + { + VideoListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0) + { + __pDeletePopup->SetShowState(true); + __pDeletePopup->Show(); + _overlayMsg = true; + } + } + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0) + { + __pDeletePopup->SetShowState(true); + __pDeletePopup->Show(); + _overlayMsg = true; + } + } + } + break; + + case IDA_CONTEXT_MENU_MORE_EDIT: + { + break; + } + + case IDA_CONTEXT_MENU_MORE_ADD_TAG: + { + break; + } + + case IDA_CONTEXT_MENU_MORE_COPY: + + case IDA_CONTEXT_MENU_MORE_MOVE: + { + if (actionId == IDA_CONTEXT_MENU_MORE_MOVE) + { + __isCopyOperation = false; + } + else if (actionId == IDA_CONTEXT_MENU_MORE_COPY) + { + __isCopyOperation = true; + } + + RefreshFolderList(); + + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); + + + } + break; + + case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW: + { + if (__pPopUp != NULL) + { + delete __pPopUp; + __pPopUp = NULL; + } + __pPopUp = new (std::nothrow) SlideShowPopUp(); + + if (__pPopUp != null) + { + __pPopUp->Initialize(); + __pPopUp->SetEventListner(this); + __pPopUp->SetShowState(true); + __pPopUp->Show(); + } + } + break; + + case IDA_CONTEXT_MENU_SHARE_MESSAGE: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnRequestMessage(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + pSelectionPanel->OnRequestMessage(); + } + } + } + break; + + case IDA_CONTEXT_MENU_SHARE_EMAIL: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnRequestEmail(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + pSelectionPanel->OnRequestEmail(); + } + } + } + break; + + case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pListEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pListEditorPanel) + { + IList* pList = pListEditorPanel->GetItemCheckedIndexListN(); + pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT); + if (__isCopyOperation) + { + pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT); + } + else + { + pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT); + } + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList); + } + + } + else + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) + { + IList* pList = pSelectionPanel->GetItemCheckedIndexListN(); + pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT); + if (__isCopyOperation) + { + pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT); + } + else + { + pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT); + } + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList); + } + } + } + } + break; + + case IDA_DELETE_POPUP_DEL: + { + _overlayMsg = false; + __pDeletePopup->SetShowState(false); + __pDeletePopup->Invalidate(true); + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + result r = pEditorPanel->OnRequestDelete(); + if (IsFailed(r)) + { + AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r)); + } + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) + { + result r = pSelectionPanel->OnRequestDelete(); + if (IsFailed(r)) + { + AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r)); + } + } + } + } + break; + + case IDA_DELETE_POPUP_CANCEL: + { + _overlayMsg = false; + __pDeletePopup->SetShowState(false); + __pDeletePopup->Invalidate(true); + } + break; + + case IDA_CONTEXT_MENU_ROTATE_LEFT: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + RotateMode rotateMode = ROTATE_MODE_LEFT; + pEditorPanel->OnRequestRotate(rotateMode); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) + { + RotateMode rotateMode = ROTATE_MODE_LEFT; + pSelectionPanel->OnRotateRequested(rotateMode); + } + } + } + break; + + case IDA_CONTEXT_MENU_ROTATE_RIGHT: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + RotateMode rotateMode = ROTATE_MODE_RIGHT; + pEditorPanel->OnRequestRotate(rotateMode); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) + { + RotateMode rotateMode = ROTATE_MODE_RIGHT; + pSelectionPanel->OnRotateRequested(rotateMode); + } + } + } + break; + + case IDA_FOOTER_CONFIRM: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + ImageListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR) + { + VideoListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult(); + } + } + } + break; + + default: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) && + (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000)) + { + if (__pContentDirectoryList == null) + { + return; + } + if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START) + { + String* pDirectory = static_cast + (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)); + + AllListEditorPanel* pEditorPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pEditorPanel != null) + { + delete __pFileMove; + IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN(); + __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this); + if (__isCopyOperation) + { + __pFileMove->SetCopy(); + } + + result r = __pFileMove->StartTimer(); + if (IsFailed(r)) + { + delete __pFileMove; + __pFileMove = null; + __isCopyOperation = false; + } + else + { + _overlayMsg = true; + } + } + } + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) && + (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000)) + { + if (__pContentDirectoryList == null) + { + + return; + } + if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START) + { + String* pDirectory = static_cast + (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)); + + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) + { + delete __pFileMove; + IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN(); + __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this); + if (__isCopyOperation) + { + __pFileMove->SetCopy(); + } + result r = __pFileMove->StartTimer(); + if (IsFailed(r)) + { + delete __pFileMove; + __pFileMove = null; + __isCopyOperation = false; + } + else + { + _overlayMsg = true; + } + } + } + } + } + break; + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId) +{ + Invalidate(true); +} + + +void +FileListEditorForm::OnScanDirStart() +{ + AppLogDebug("ENTER"); + GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, false); + __isScanProgress = true; + Invalidate(true); + AppLogDebug("EXIT"); +} +void +FileListEditorForm::OnScanDirComplete() +{ + AppLogDebug("ENTER"); + GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, true); + __isScanProgress = false; + Invalidate(true); + AppLogDebug("EXIT"); +} + + +bool +FileListEditorForm::GetOverlayStatus(void) const +{ + return _overlayMsg; +} + +void +FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res) +{ + AppLogDebug("ENTER"); + _overlayMsg = false; + __pPresentationModel->SetUpdateProgressStatus(false); + if (res != COMPLETE_SUCCESS) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000); + int modalResult = 0; + _overlayMsg = true; + messageBox.ShowAndWait(modalResult); + _overlayMsg = false; + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST)); + } + AppLogDebug("EXIT"); +} + +void +FileListEditorForm::OnContentUpdated() +{ + AppLogDebug("ENTER"); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if(__pDeletePopup != null) + { + if(__pDeletePopup->IsVisible() == true) + { + __pDeletePopup->Destroy(); + __pDeletePopup = null; + _overlayMsg = false; + SetUpPopup(); + } + } + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->CancelUpdateProgress(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + pSelectionPanel->CancelUpdateProgress(); + } + } + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK + && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY)); + + } + else if (_overlayMsg == false) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY)); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +FileListEditorForm::SetUpPopup(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + + if (__pDeletePopup != null) + { + delete __pDeletePopup; + __pDeletePopup = null; + } + + __pDeletePopup = new (std::nothrow) Popup(); + __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP)); + __pDeletePopup->SetPropagatedKeyEventListener(this); + + Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds(); + + Label* pLabelText = new (std::nothrow) Label(); + pLabelText->Construct(Rectangle(0, Y_DELETE_LABEL, popupClientBounds.width, H_DELETE_LABEL), + ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q")); + pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD); + __pDeletePopup->AddControl(pLabelText); + + Button* pDeleteButton = new (std::nothrow) Button(); + pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), + ResourceManager::GetString(L"IDS_COM_BODY_DELETE")); + pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL); + pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED); + pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT); + pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL); + pDeleteButton->AddActionEventListener(*this); + __pDeletePopup->AddControl(pDeleteButton); + + Button* pButtonCancel = new (std::nothrow) Button(); + pButtonCancel->Construct(Rectangle(16, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), + ResourceManager::GetString(L"IDS_COM_POP_CANCEL")); + pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL); + pButtonCancel->AddActionEventListener(*this); + __pDeletePopup->AddControl(pButtonCancel); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +FileListEditorForm::SetTitleText(const String& titleText) +{ + AppLogDebug("ENTER"); + Header* pHeader = GetHeader(); + TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult())); + pHeader->SetTitleText(titleText); + pHeader->Invalidate(true); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::RefreshFolderList(void) +{ + AppLogDebug("ENTER"); + ContentDirectory contentDirectory; + IListT* pContentTypeList = new (std::nothrow) ArrayListT(); + pContentTypeList->Add(CONTENT_TYPE_IMAGE); + pContentTypeList->Add(CONTENT_TYPE_VIDEO); + result r = contentDirectory.Construct(*pContentTypeList); + if (r != E_SUCCESS) + { + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return; + } + delete pContentTypeList; + + if (__pContentDirectoryList != null) + { + __pContentDirectoryList->RemoveAll(true); + delete __pContentDirectoryList; + __pContentDirectoryList = null; + } + __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE); + + if (__pContentDirectoryNameList != NULL) + { + __pContentDirectoryNameList->RemoveAll(true); + delete __pContentDirectoryNameList; + __pContentDirectoryNameList = null; + } + + __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter); + String* pDirPath = null; + String* pDirName = null; + String mediaPath = RESERVED_MEDIA_PATH; + int length = mediaPath.GetLength(); + mediaPath.Remove(length-1,1); + + int loopCount = __pContentDirectoryList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pDirPath = static_cast(__pContentDirectoryList->GetAt(i)); + pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath)); + + if (*pDirPath == mediaPath) + { + *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME"); + __pContentDirectoryNameList->Add(pDirName); + } + else + { + __pContentDirectoryNameList->Add(pDirName); + } + } + + __pOptionMenu->RemoveAllItems(); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"), + IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM); + + loopCount = __pContentDirectoryNameList->GetCount(); + + String dirAllAlbums = L"All albums"; + + for (int i = 0; i < loopCount; ++i) + { + pDirName = static_cast(__pContentDirectoryNameList->GetAt(i)); + + if (*pDirName != __pPresentationModel->GetCurrentAlbumName() || *pDirName == dirAllAlbums) + { + __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)), + IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i); + } + } + + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("ENTER"); + + if(__isScanProgress) + { + AppLog (" Skip the call"); + return; + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST)); + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR) + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST)); + } + } + else + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST)); + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST)); + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR) + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST)); + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true) + { + __pShareContextMenu->SetShowState(false); + } + else + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + IList* pList = pSelectionPanel->GetItemCheckedIndexListN(); + if (pList == null) + { + pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + } + + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList); + } + } + } + else + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST)); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::SetFooterButtonsState(const bool enableState) +{ + AppLogDebug("ENTER"); + Footer* pFooter = GetFooter(); + TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult())); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (enableState == true) + { + pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true); + pFooter->SetItemEnabled(0, true); + } + else + { + pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false); + pFooter->SetItemEnabled(0, false); + } + } + else + { + if (enableState == true) + { + pFooter->SetItemEnabled(0, true); + pFooter->SetItemEnabled(1, true); + } + else + { + pFooter->SetItemEnabled(0, false); + pFooter->SetItemEnabled(1, false); + } + } + pFooter->RequestRedraw(true); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GetCurrentScene(); + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->ChangeOrientation(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + ImageListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->ChangeOrientation(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR) + { + VideoListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->ChangeOrientation(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->ChangeOrientation(); + } + } + + if (_pProgressAnim != null) + { + _pProgressAnim->ChangeOrientation(Form::GetBounds()); + _pProgressAnim->Invalidate(true); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +FileListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo) +{ + AppLogDebug("ENTER"); + + if(keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC) + { + _overlayMsg = false; + __pDeletePopup->SetShowState(false); + __pDeletePopup->Invalidate(true); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return false; +} + +result +FileListEditorForm::MoveToAlbum(const String& destDirectory) +{ + AppLogDebug("ENTER"); + result r = E_FAILURE; + String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory); + if (albumName != EMPTY_SPACE) + { + IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pDirectoryList->Add(new (std::nothrow) String(destDirectory)); + __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList); + __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL); + delete pDirectoryList; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST)); + r = E_SUCCESS; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +FileListEditorForm::SelectAllPressed(void) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GetCurrentScene(); + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnSelectAllPressed(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + ImageListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnSelectAllPressed(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR) + { + VideoListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnSelectAllPressed(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnSelectAllPressed(); + } + } +} + +void +FileListEditorForm::OnSlideSettingPopUpItemSelected(int index) +{ + if (__pPopUp != NULL) + { + __pPopUp->SetShowState(false); + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (index == 0) + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + pEditorPanel->OnRequestSlideShow(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) + { + pSelectionPanel->OnRequestSlideShow(); + } + } + } + else if (index == 1) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN)); + } +} + +void +FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + __pPresentationModel->AddContentEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + if(__isScanProgress) + { + return; + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + int checkedCount = 0; + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + checkedCount = pEditorPanel->GetItemCheckedCount(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + checkedCount = pSelectionPanel->GetItemCheckedCount(); + } + } + + if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true) + { + __pShareContextMenu->SetShowState(false); + } + + if (checkedCount < 2 && __pPresentationModel->GetCurrentAlbumName() == ALL_ALBUMS_REAL_NAME ) + { + return; // no option Menu items in this case + } + + if (checkedCount > 0) + { + if (__pOptionMenu == null) + { + return; + } + + __pOptionMenu->RemoveAllItems(); + + if ( __pPresentationModel->GetCurrentAlbumName() != ALL_ALBUMS_REAL_NAME ) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"), + IDA_CONTEXT_MENU_MORE_MOVE); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"), + IDA_CONTEXT_MENU_MORE_COPY); + } + + if (checkedCount > 1) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), + IDA_CONTEXT_MENU_MORE_SLIDE_SHOW); + } + + if ( __pPresentationModel->GetCurrentAlbumName() != ALL_ALBUMS_REAL_NAME ) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT); + } + + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); + } +} + +void +FileListEditorForm::SetProgressState(const bool progressState) +{ + __isScanProgress = progressState; +} diff --git a/src/GlFileListForm.cpp b/src/GlFileListForm.cpp new file mode 100644 index 0000000..95fc7b1 --- /dev/null +++ b/src/GlFileListForm.cpp @@ -0,0 +1,369 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileListForm.cpp + * @brief This is the implementation file for FileListForm class. + */ + +#include "GlAlbumInfo.h" +#include "GlAllListPanel.h" +#include "GlFileListForm.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlResourceManager.h" +#include "GlSlideSettingListener.h" +#include "GlSlideShowPopUp.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; +using namespace Tizen::Content; + +FileListForm::FileListForm(void) + : __menuState(true) + , __pOptionMenu(null) + , __pPopUp(null) + , __pPresentationModel(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +FileListForm::~FileListForm(void) +{ + AppLogDebug("ENTER"); + + if (__pPopUp != NULL) + { + delete __pPopUp; + __pPopUp = NULL; + } + + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +FileListForm::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Form::Construct(IDL_FORM_FILE_LIST); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} +result +FileListForm::OnInitializing(void) +{ + AppLogDebug("ENTER"); + Header* pHeader = GetHeader(); + TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the Header.", GetErrorMessage(GetLastResult())); + + SetFormMenuEventListener(this); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + + InitializeFooter(); + SetFormBackEventListener(this); + SetOrientation(ORIENTATION_AUTOMATIC); + AddOrientationEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +FileListForm::OnTerminating(void) +{ + AppLogDebug("ENTER"); + + if (__pOptionMenu != null) + { + delete __pOptionMenu; + __pOptionMenu = null; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +FileListForm::OnContentUpdated() +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + static_cast(pSceneManager->GetCurrentScene()->GetPanel())->Refresh(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + switch (actionId) + { + case IDA_FOOTER_EDIT: + { + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR)); + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_LIST_EDITOR)); + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_VIDEO_LIST_EDITOR)); + } + else + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR)); + } + } + break; + + case IDA_FOOTER_SLIDESHOW: + { + + if (__pPopUp != NULL) + { + delete __pPopUp; + __pPopUp = NULL; + } + __pPopUp = new (std::nothrow) SlideShowPopUp(); + + if (__pPopUp != null) + { + __pPopUp->Initialize(); + __pPopUp->SetEventListner(this); + __pPopUp->SetShowState(true); + __pPopUp->Show(); + } + } + break; + + case IDA_FOOTER_CAMERA: + { + const String mimeType = APPCONTROL_MIME_IMAGE_JPG; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_CAMERA_ALLOW_SWITCH), new (std::nothrow) String(APPCONTROL_DATA_TRUE)); + __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CAMERA, APPCONTROL_OPERATION_ID_CREATE_CONTENT, + null, &mimeType, pDataList, this); + } + break; + + default: + break; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + + + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GetCurrentScene(); + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST) + { + AllListPanel* pListPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pListPanel != null) + { + pListPanel->ChangeOrientation(); + } + } +} + +result +FileListForm::InitializeFooter(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + Footer* pFooter = GetFooter(); + TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the Footer.", GetErrorMessage(GetLastResult())); + + pFooter->RemoveAllItems(); + pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON); + + FooterItem itemCamera; + itemCamera.Construct(IDA_FOOTER_CAMERA); + Bitmap* pBitmapCamera = ResourceManager::GetBitmapN(IDB_CONTROLBAR_CAMERA); + if (pBitmapCamera != null) + { + itemCamera.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapCamera); + } + pFooter->AddItem(itemCamera); + + delete pBitmapCamera; + + if (__pOptionMenu != null) + { + delete __pOptionMenu; + __pOptionMenu = null; + } + + __pOptionMenu = new (std::nothrow) OptionMenu(); + __pOptionMenu->Construct(); + + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() > 1) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), IDA_FOOTER_SLIDESHOW); + } + + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() == 0) + { + __pOptionMenu->SetEnabled(false); + } + else + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); + __pOptionMenu->AddActionEventListener(*this); + } + + pFooter->AddActionEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +FileListForm::SetTitleText(const String& titleText) +{ + AppLogDebug("ENTER"); + Header* pHeader = GetHeader(); + TryReturnVoid(pHeader != null, "[%s] fail to get the Header.", GetErrorMessage(GetLastResult())); + + if (titleText == ALL_ALBUMS_REAL_NAME) + { + String text = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS"); + pHeader->SetTitleText(text); + } + else + { + pHeader->SetTitleText(titleText); + } + + pHeader->Show(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListForm::OnSlideSettingPopUpItemSelected(int index) +{ + if (__pPopUp != NULL) + { + __pPopUp->SetShowState(false); + } + + if (index == 0) + { + result r = E_SUCCESS; + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + + for (int i = 0; i < loopCount; ++i) + { + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i))); + } + + const String mimeType = APPCONTROL_MIME_IMAGE_ALL; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + + r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, + &mimeType, pDataList, null); + + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + } + else if (index == 1) + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN)); + } +} + +void +FileListForm::SetMenuState(bool state) +{ + __menuState = state; +} + +void +FileListForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + + if (__menuState == true) + { + InitializeFooter(); + + if (__pOptionMenu == null) + { + return; + } + + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); + } +} + +void +FileListForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Tizen::Base::String& operationId, + AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData) +{ + AppLogDebug("OnAppControlCompleteResponseReceived : %d", appControlResult); + + GalleryApp* pGalleryApp = static_cast(GalleryApp::GetInstance()); + TryReturnVoid(pGalleryApp != null, "pGalleryApp is null"); + pGalleryApp->SetFrameEnabled(true); +} diff --git a/src/GlFileListPresentationModel.cpp b/src/GlFileListPresentationModel.cpp new file mode 100644 index 0000000..17020bf --- /dev/null +++ b/src/GlFileListPresentationModel.cpp @@ -0,0 +1,1763 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileListPresentationModel.cpp + * @brief This is the implementation file for FileListPresentationModel class. + */ + +#include +#include +#include +#include "GlCommonUtil.h" +#include "GlFileListPresentationModel.h" +#include "GlContentUpdateEventListener.h" +#include "GlGalleryApp.h" +#include "GlThumbnailEvent.h" +#include "GlThumbnailEventArg.h" +#include "GlThumbnailProvider.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; +using namespace Tizen::System; + +static const String CONTENT_INFO_ORDER = L"ContentFileName"; + +static const int SIZE_PAGE_NO = 1; +static const int SIZE_CONUNT_PER_PAGE = 3000; +static const int SIZE_ICON_LIST_CACHE = 50; +static const int W_DURATION_TEXT = 44; +static const int H_DURATION_TEXT = 4; +static const int W_DURATION = 171; +static const int H_DURATION = 32; +static const int W_DEFAULT_THUMBNAIL = 171; +static const int H_DEFAULT_THUMBNAIL = 127; +static const int W_WIDE_THUMBNAIL = 171; +static const int H_WIDE_THUMBNAIL = 127; +static const int W_PLAY_FG = 64; +static const int H_PLAY_FG = 64; +static const int GAP_W_PLAY_FG = (W_DEFAULT_THUMBNAIL -W_PLAY_FG)/2; +static const int GAP_H_PLAY_FG = (H_DEFAULT_THUMBNAIL - H_PLAY_FG)/2; +static const int GAP_H_DURATION = H_DEFAULT_THUMBNAIL - H_DURATION; +static const int ALPHA_DURATION = 70; +static const int FONT_SIZE_DURATION = 24; +static const Dimension DIMENSION_REAL_ICON (171,127); +static const Rectangle RECTANGLE_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127); +static const Rectangle RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127); +static const Color COLOR_DURATION_BG (Color::GetColor(COLOR_ID_BLACK)); +static const Color COLOR_TEXT_OUTLINE (Color::GetColor(COLOR_ID_WHITE)); + +static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath(); +static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera"; +static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera"; +static const String RESERVED_DOWNLOAD_PATH = Environment::GetMediaPath() + L"Downloads"; + +FileListPresentationModel* FileListPresentationModel::__pPresentationModelInstance = null; +ThumbnailProvider* FileListPresentationModel::__pThumbnailProvider = null; +ThumbnailEvent* FileListPresentationModel::__pThumbnailEvent = null; +ArrayList* FileListPresentationModel::__pPresentationModelListener = null; +ArrayList* FileListPresentationModel::__pContentEventListener = null; +ArrayList* FileListPresentationModel::__pIconListViewCache = null; +IList* FileListPresentationModel::__pDirectoryList = null; +IList* FileListPresentationModel::__pContentInfoList = null; + +FileListPresentationModel::FileListPresentationModel(void) + : __pContentManager(null) + , __albumContentType(CONTENT_TYPE_ALL) + , __appControlMode(APPCONTROL_MODE_MAIN) + , __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE) + , __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE) + , __pContentIdList(null) + , __updateProgressStatus(false) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +FileListPresentationModel::~FileListPresentationModel(void) +{ + AppLogDebug("ENTER"); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + if (__pContentIdList) + { + __pContentIdList->RemoveAll(true); + delete __pContentIdList; + __pContentIdList = null; + } + delete __pContentManager; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +FileListPresentationModel* +FileListPresentationModel::GetInstance(void) +{ + AppLogDebug("ENTER"); + if (__pPresentationModelInstance == null) + { + CreateInstance(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pPresentationModelInstance; +} + +result +FileListPresentationModel::Construct(void) +{ + AppLogDebug("ENTER"); + + IThumbnailEventListener* pThumbnailEventListener = static_cast(this); + __pThumbnailEvent = new (std::nothrow) ThumbnailEvent(); + __pThumbnailEvent->AddListener(*pThumbnailEventListener, true); + + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + + ContentUpdateEventListener::GetInstance(); + __pContentManager = new (std::nothrow) ContentManager(); + __pContentManager->Construct(); + + if (__pIconListViewCache != null) + { + __pIconListViewCache->RemoveAll(true); + delete __pIconListViewCache; + __pIconListViewCache = null; + } + __pIconListViewCache = new (std::nothrow) ArrayList(SingleObjectDeleter); + __pIconListViewCache->Construct(SIZE_ICON_LIST_CACHE); + + if (__pDirectoryList != null) + { + delete __pDirectoryList; + } + __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + if (__pContentInfoList != null) + { + delete __pContentInfoList; + } + __pContentInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + __pPresentationModelListener = new (std::nothrow) ArrayList(); + __pPresentationModelListener->Construct(); + + __pContentEventListener = new (std::nothrow) ArrayList(); + __pContentEventListener->Construct(); + + __pThumbnailProvider = ThumbnailProvider::GetInstance(); + + GalleryApp* pApp = static_cast(GalleryApp::GetInstance()); + const IMap* pArguments = pApp->GetAppControlArguments(); + String operationId = pApp->GetAppControlOperationId(); + + if (operationId.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0) + { + __appControlMode = APPCONTROL_MODE_MAIN; + } + else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0) + { + __appControlMode = APPCONTROL_MODE_PICK; + + String mimeType = pApp->GetMimeType(); + if (mimeType.IsEmpty() != true) + { + if (mimeType.StartsWith(APPCONTROL_DATA_VIDEO, 0) == true) + { + __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO; + } + } + if (pArguments != null) + { + const String* selectionMode = static_cast(pArguments->GetValue(String(APPCONTROL_KEY_SELECTION_MODE))); + + if (pApp->GetMimeType().StartsWith(APPCONTROL_DATA_VIDEO, 0) == true) + { + __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO; + } + + if (selectionMode != null && selectionMode->CompareTo(APPCONTROL_DATA_MULTIPLE) == 0) + { + __appControlSelectionMode = APPCONTROL_SELECTION_MODE_MULTIPLE; + } + } + } + else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0) + { + __appControlMode = APPCONTROL_MODE_SETTING; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +FileListPresentationModel::CreateInstance(void) +{ + AppLogDebug("ENTER"); + __pPresentationModelInstance = new (std::nothrow) FileListPresentationModel(); + result r = __pPresentationModelInstance->Construct(); + if (IsFailed(r) == true) + { + delete __pPresentationModelInstance; + __pPresentationModelInstance = null; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + std::atexit(DestroyInstance); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListPresentationModel::DestroyInstance(void) +{ + AppLogDebug("ENTER"); + + delete __pThumbnailEvent; + + if (__pIconListViewCache != null) + { + __pIconListViewCache->RemoveAll(true); + delete __pIconListViewCache; + __pIconListViewCache = null; + } + + if (__pDirectoryList != null) + { + delete __pDirectoryList; + __pDirectoryList = null; + } + + if (__pContentInfoList != null) + { + delete __pContentInfoList; + __pContentInfoList = null; + } + + if (__pPresentationModelListener != null) + { + delete __pPresentationModelListener; + __pPresentationModelListener = null; + } + + if (__pContentEventListener != null) + { + delete __pContentEventListener; + __pContentEventListener = null; + } + + delete __pPresentationModelInstance; + __pPresentationModelInstance = null; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +String +FileListPresentationModel::GetFileNameFromFullPath(const String& fullPath, const bool withExt) const +{ + AppLogDebug("ENTER"); + if (fullPath.CompareTo(EMPTY_SPACE) == 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return EMPTY_SPACE; + } + + String delim(DIRECTORY_SEPARATOR); + StringTokenizer st(fullPath,delim); + String token; + while (st.HasMoreTokens()) + { + st.GetNextToken(token); + } + + if (withExt == true) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return token; + } + else + { + String subDelim(FILE_EXT_SEPARATOR); + StringTokenizer subSt(token, subDelim); + String subToken; + subSt.GetNextToken(subToken); + AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); + + return subToken; + } +} + +String +FileListPresentationModel::GetDirecotyNameFromFullPath(const String& fullPath)const +{ + AppLogDebug("ENTER"); + if (fullPath == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + String delim(DIRECTORY_SEPARATOR); + StringTokenizer st(fullPath,delim); + String token; + while (st.HasMoreTokens()) + { + st.GetNextToken(token); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return token; +} + +bool +FileListPresentationModel::IsContainContentInDirectory(const String& directoryPath, ContentType contentType) const +{ + AppLogDebug("ENTER"); + IListT* pContentTypeList = new (std::nothrow) ArrayListT(); + if (&directoryPath == null || pContentTypeList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return false; + } + + if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL) + { + pContentTypeList->Add(CONTENT_TYPE_IMAGE); + } + if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL) + { + pContentTypeList->Add(CONTENT_TYPE_VIDEO); + } + + ContentDirectory contentDirectory; + result r = contentDirectory.Construct(*pContentTypeList); + if (pContentTypeList != null) + { + delete pContentTypeList; + } + TryReturn(r == E_SUCCESS, false, "[%s] Unable to construct ContentDirectory", GetErrorMessage(r)); + + bool returnValue = false; + int pageNo = SIZE_PAGE_NO; + int countPerPage = SIZE_CONUNT_PER_PAGE; + + IList* pContentList = contentDirectory.GetContentDirectoryItemListN(directoryPath, pageNo, countPerPage, + CONTENT_INFO_ORDER, SORT_ORDER_ASCENDING); + + if (pContentList == null || pContentList->GetCount() <= 0) + { + returnValue = false; + } + else + { + returnValue = true; + } + + if (pContentList != null) + { + delete pContentList; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return returnValue; +} + +result +FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pName, Bitmap*& pThumbnail) +{ + AppLogDebug("ENTER : index(%d)", index); + Bitmap* pOriginalBitmap = null; + Bitmap* pDestinationBitmap = null; + ContentInfo* pContentInfo = null; + + if (__pContentInfoList != null && index < __pContentInfoList->GetCount()) + { + pContentInfo = static_cast(__pContentInfoList->GetAt(index)); + if (pContentInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + } + else + { + AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index); + return E_FAILURE; + } + + ThumbnailInfo* pThumbnailInfo = GetThumbnailInfoFromInternalBufferN(pContentInfo->GetContentId()); + if (pThumbnailInfo != null) + { + pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath()); + pOriginalBitmap = pThumbnailInfo->GetBitmapN(); + } + + if ((pThumbnailInfo != null)&&(pThumbnailInfo->GetContentType() == CONTENT_TYPE_VIDEO)) + { + if (pOriginalBitmap != null) + { + pDestinationBitmap = CoverVideoOverlayedImageOnThumbnailN(*pOriginalBitmap, *pThumbnailInfo); + delete pOriginalBitmap; + } + } + else + { + pDestinationBitmap = pOriginalBitmap; + } + + if (pDestinationBitmap != null) + { + Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG); + Rectangle thumbnailRect(RECTANGLE_THUMBNAIL_OFFSET_POSION); + pDestinationBitmap->Scale(Dimension(RECTANGLE_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_THUMBNAIL_OFFSET_POSION.x + , RECTANGLE_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_THUMBNAIL_OFFSET_POSION.y)); + if (pThumbnailBgBitmap != null) + { + pThumbnailBgBitmap->Scale(DIMENSION_REAL_ICON); + pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pDestinationBitmap, thumbnailRect); + delete pThumbnailBgBitmap; + delete pDestinationBitmap; + } + else + { + pThumbnail = pDestinationBitmap; + } + } + else + { + pThumbnail = null; + } + + if (pThumbnailInfo != null) + { + delete pThumbnailInfo; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index, + String*& pName, Bitmap*& pThumbnail, String*& pDuration) const +{ + AppLogDebug("ENTER : index(%d)", index); + ContentInfo* pContentInfo = null; + Bitmap* pOriginalBitmap = null; + + if (__pContentInfoList != null && index < __pContentInfoList->GetCount()) + { + pContentInfo = static_cast(__pContentInfoList->GetAt(index)); + if (pContentInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + } + else + { + AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index); + return E_FAILURE; + } + + ThumbnailInfo* pThumbnailInfo = GetThumbnailInfoFromInternalBufferN(pContentInfo->GetContentId()); + if (pThumbnailInfo != null) + { + pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath()); + pOriginalBitmap = pThumbnailInfo->GetBitmapN(); + pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(pThumbnailInfo->GetDuration())); + } + else + { + pName = new (std::nothrow) String(EMPTY_SPACE); + pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(0)); + } + + if (pOriginalBitmap != null) + { + Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG); + Rectangle thumbnailRect(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION); + pOriginalBitmap->Scale(Dimension(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.x + , RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.y)); + if (pThumbnailBgBitmap != null) + { + pThumbnailBgBitmap->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL)); + pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pOriginalBitmap, thumbnailRect); + delete pThumbnailBgBitmap; + } + delete pOriginalBitmap; + } + else + { + pThumbnail = null; + } + + if (pThumbnail != null) + { + pThumbnail->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL)); + } + + if (pThumbnailInfo != null) + { + delete pThumbnailInfo; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +FileListPresentationModel::RequestThumbnail(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + ContentInfo* pContentInfo = null; + + if (__pContentInfoList != null && index < __pContentInfoList->GetCount()) + { + pContentInfo = static_cast(__pContentInfoList->GetAt(index)); + if (pContentInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + } + else + { + AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index); + + return; + } + + __pThumbnailProvider->RequestThumbnail(pContentInfo->GetContentId(), __pThumbnailEvent); + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::RequestThumbnail(const ContentId& contentId) +{ + __pThumbnailProvider->RequestThumbnail(contentId, __pThumbnailEvent); +} + +void +FileListPresentationModel::ClearThumbnailRequests(const bool appTerminating) +{ + AppLogDebug("ENTER"); + + if (__pThumbnailProvider != null) + { + __pThumbnailProvider->ClearThumbnailRequests(appTerminating); + } + + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg) +{ + AppLogDebug("ENTER"); + + if (&eventArg != null) + { + ThumbnailEventArg* pThumbnailEventArg = static_cast(&eventArg); + if (pThumbnailEventArg == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + ThumbnailInfo* pThumbnailInfo = pThumbnailEventArg->GetThumbnailInfoN(); + if (pThumbnailInfo == null) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + bool isMatch = false; + ContentId contentId = pThumbnailInfo->GetContentId(); + + if (__pIconListViewCache != null) + { + IEnumerator* pEnum = __pIconListViewCache->GetEnumeratorN(); + Bitmap* pBitmap = null; + while (pEnum->MoveNext() == E_SUCCESS) + { + ThumbnailInfo* pTempThumbnailInfo = static_cast(pEnum->GetCurrent()); + + if (contentId == pTempThumbnailInfo->GetContentId()) + { + AppLogDebug("[CHASEFIRE] PM receive (%ls)", pThumbnailInfo->GetFilePath().GetPointer()); + pBitmap = pThumbnailInfo->GetBitmapN(); + pTempThumbnailInfo->SetBitmap(*pBitmap); + delete pBitmap; + + pTempThumbnailInfo->SetContentType(pThumbnailInfo->GetContentType()); + pTempThumbnailInfo->SetDuration(pThumbnailInfo->GetDuration()); + delete pThumbnailInfo; + isMatch = true; + break; + } + } + + delete pEnum; + + if (isMatch == false) + { + if (SIZE_ICON_LIST_CACHE <= __pIconListViewCache->GetCount()) + { + __pIconListViewCache->RemoveAt(0, true); + } + AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)", __pIconListViewCache->GetCount(), + pThumbnailInfo->GetFilePath().GetPointer()); + __pIconListViewCache->Add(pThumbnailInfo); + } + } + + int index = -1; + int loopCount = __pContentInfoList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + if (contentId == (static_cast(__pContentInfoList->GetAt(i)))->GetContentId()) + { + index = i; + break; + } + } + + IAlbumEventListener* pInterface = null; + IEnumerator* pEventEnum = __pPresentationModelListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnThumbnailDecoded(index); + } + delete pEventEnum; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListPresentationModel::OnContentCreated(void) +{ + AppLogDebug("ENTER"); + if (__updateProgressStatus == true) + { + AppLogDebug("EXIT update in application"); + return; + } + IFormContentUpdateEventListener* pInterface = null; + if (__pContentEventListener == null) + { + AppLogDebug("EXIT"); + return; + } + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + if (pInterface != null) + { + pInterface->OnContentUpdated(); + } + } + delete pEventEnum; + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::OnContentUpdated(const ContentId& contentId) +{ + AppLogDebug("ENTER"); + RequestThumbnail(contentId); + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::OnContentUpdated(void) +{ + AppLogDebug("ENTER"); + if (__updateProgressStatus == true) + { + AppLogDebug("EXIT update in application"); + return; + } + //Clear the ImageCaches when content is updated like rotate. + if (__pContentEventListener->GetCount()) + { + ClearImageCache(); + } + + IFormContentUpdateEventListener* pInterface = null; + if (__pContentEventListener == null) + { + AppLogDebug("EXIT"); + return; + } + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::OnContentDeleted(void) +{ + AppLogDebug("ENTER"); + if (__updateProgressStatus == true) + { + AppLogDebug("EXIT update in application"); + return; + } + IFormContentUpdateEventListener* pInterface = null; + if (__pContentEventListener == null) + { + AppLogDebug("EXIT"); + return; + } + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + ClearThumbnailRequests(); + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::AddPresentationModelListener(const IAlbumEventListener* listener) +{ + AppLogDebug("ENTER"); + __pPresentationModelListener->Add((Object*)listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListPresentationModel::RemovePresentationModelListener(const IAlbumEventListener& listener) +{ + AppLogDebug("ENTER"); + __pPresentationModelListener->Remove(listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListPresentationModel::AddContentEventListener(const IFormContentUpdateEventListener* listener) +{ + AppLogDebug("ENTER"); + if (__pContentEventListener != null) + { + __pContentEventListener->RemoveAll(); + __pContentEventListener->Add((Object*)listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + } +} + +void +FileListPresentationModel::RemoveContentEventListener(const IFormContentUpdateEventListener* listener) +{ + AppLogDebug("ENTER"); + __pContentEventListener->Remove(*listener); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ThumbnailInfo* +FileListPresentationModel::GetThumbnailInfoFromInternalBufferN(const ContentId& contentId) const +{ + AppLogDebug("ENTER"); + ThumbnailInfo* pThumbnailInfo = null; + ThumbnailInfo* pTempThumbnailInfo = null; + if (__pIconListViewCache != null) + { + int loopCount = __pIconListViewCache->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pTempThumbnailInfo = static_cast(__pIconListViewCache->GetAt(i)); + if (contentId == pTempThumbnailInfo->GetContentId()) + { + + pThumbnailInfo = new (std::nothrow) ThumbnailInfo(); + Bitmap* pBitmap = pTempThumbnailInfo->GetBitmapN(); + pThumbnailInfo->Construct(pTempThumbnailInfo->GetContentId(), pTempThumbnailInfo->GetFilePath(), + *pBitmap, pTempThumbnailInfo->GetContentType(), pTempThumbnailInfo->GetDuration()); + delete pBitmap; + break; + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pThumbnailInfo; +} + +void +FileListPresentationModel::ShowAnimation(void) +{ + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->ShowAnimation(); + } + delete pEventEnum; +} + +void +FileListPresentationModel::StopAnimation(void) +{ + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->StopAnimation(); + } + delete pEventEnum; +} +result +FileListPresentationModel::DeleteContentFileList(const IList& contentIndexList) +{ + AppLogDebug("ENTER"); + if (&contentIndexList == null || contentIndexList.GetCount() <= 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; + } + + IList * pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + int loopCount = contentIndexList.GetCount(); + for (int i = 0; i < loopCount; ++i) + { + const Integer* pIndex = static_cast(contentIndexList.GetAt(i)); + + if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt()) + { + pContentIdList->Add(new (std::nothrow) ContentId((static_cast + (__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId())); + } + } + + loopCount = pContentIdList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + ContentId* pContentId = static_cast(pContentIdList->GetAt(i)); + if (pContentId != null) + { + ContentInfo* cntInfo = __pContentManager->GetContentInfoN(*pContentId); + if (cntInfo) + { + String filePath = cntInfo->GetContentPath(); + delete cntInfo; + DeleteContentFile(filePath); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +IList* +FileListPresentationModel::GetCollisionIndexListN(const IList& contentIndexList, const String& destDirectory) +{ + AppLogDebug("ENTER"); + if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null + || destDirectory.IsEmpty() == true) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + if (File::IsFileExist(destDirectory) == false) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + IList * pCollisionInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter); + ContentInfo* pContentInfo = null; + int loopCount = contentIndexList.GetCount(); + for (int i = 0; i < loopCount; ++i) + { + const Integer* pIndex = static_cast(contentIndexList.GetAt(i)); + + if ((pIndex != null) && (pIndex->ToInt()) >= 0 && __pContentInfoList->GetCount() > pIndex->ToInt()) + { + pContentInfo = const_cast(static_cast(__pContentInfoList->GetAt(pIndex->ToInt()))); + String filePath = pContentInfo->GetContentPath(); + String fileName = GetFileNameFromFullPath(filePath, true); + + String destPath; + if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true) + { + destPath.Append(destDirectory); + destPath.Append(fileName); + } + else + { + destPath.Append(destDirectory); + destPath.Append(DIRECTORY_SEPARATOR); + destPath.Append(fileName); + } + + if (File::IsFileExist(destPath) == true) + { + pCollisionInfoList->Add(*(new (std::nothrow) String(pIndex->ToString() + MULTI_ITEM_SEPARATOR + fileName))); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pCollisionInfoList; +} + +result +FileListPresentationModel::MoveToContentFileList(const IList& contentIndexList, const String& destDirectory) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null || destDirectory.IsEmpty() == true) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return r; + } + + if (File::IsFileExist(destDirectory) == false) + { + Directory::Create(destDirectory, true); + } + + delete __pContentIdList; + __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + int loopCount = contentIndexList.GetCount(); + for (int i = 0; i < loopCount; ++i) + { + const Integer* pIndex = static_cast(contentIndexList.GetAt(i)); + + if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt()) + { + __pContentIdList->Add(new (std::nothrow) ContentId((static_cast(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId())); + } + } + + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +FileListPresentationModel::DeleteContentFile(const String& filePath) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + r = File::Remove(filePath); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +FileListPresentationModel::MoveToContentFile(const String& filePath, const String& destDirectory, const bool isCopyOperation) +{ + AppLogDebug("ENTER"); + if (destDirectory.IsEmpty() == true) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + result r = E_SUCCESS; + + if (filePath.GetLength() < 4) + { + AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + + String destPath; + if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true) + { + destPath.Append(destDirectory); + destPath.Append(GetFileNameFromFullPath(filePath, true)); + } + else + { + destPath.Append(destDirectory); + destPath.Append(DIRECTORY_SEPARATOR); + destPath.Append(GetFileNameFromFullPath(filePath, true)); + } + + if (destPath.CompareTo(filePath) == 0) + { + AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + + while (File::IsFileExist(destPath) == true) + { + int index = 0; + r = destPath.IndexOf(FILE_EXT_SEPARATOR, 0, index); + if (!IsFailed(r)) + { + if (index < 0) + { + return E_FAILURE; + } + else + { + destPath.Insert(Math::Rand()%10, index); + } + } + else + { + return E_FAILURE; + } + } + + r = File::Copy(filePath, destPath, false); + + if (r == E_STORAGE_FULL) + { + File::Remove(destPath); + } + + if (r == E_SUCCESS) + { + if (isCopyOperation == false) + { + File::Remove(filePath); // if Move Op remove original file + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +FileListPresentationModel::ClearProviderId(void) +{ + __providerId.Clear(); +} + +result +FileListPresentationModel::StartAppControl(const String& providerId, const String& operationId, + const String* pUriData, const Tizen::Base::String* pMimeType, const HashMap* pDataList, + IAppControlResponseListener* pListener) +{ + AppLogDebug("ENTER"); + AppControl* pAc = AppManager::FindAppControlN(providerId, operationId); + + ClearProviderId(); + __providerId.Append(providerId); + + if (pAc == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; + } + result r = pAc->Start(pUriData, pMimeType, pDataList, pListener); + + if (r == E_SUCCESS) + { + GalleryApp* pGalleryApp = static_cast(GalleryApp::GetInstance()); + pGalleryApp->SetFrameEnabled(false); + } + + delete pAc; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IList& directoryList) +{ + AppLogDebug("ENTER"); + + if (&directoryList != null) + { + if (__pDirectoryList != null && __pDirectoryList->GetCount() > 0) + { + bool isMatched = false; + int outterLoopCount = __pDirectoryList->GetCount(); + int innerLoopCount = 0; + for (int i = 0; i < outterLoopCount; ++i) + { + isMatched = false; + innerLoopCount = directoryList.GetCount(); + for (int j = 0; j < innerLoopCount; ++j) + { + if (static_cast(__pDirectoryList->GetAt(i))->CompareTo( + *(const_cast(static_cast(directoryList.GetAt(j))))) == 0) + { + isMatched = true; + break; + } + } + } + + outterLoopCount = directoryList.GetCount(); + for (int i = 0; i < outterLoopCount; ++i) + { + isMatched = false; + innerLoopCount = __pDirectoryList->GetCount(); + for (int j = 0; j < innerLoopCount; ++j) + { + if (const_cast(static_cast(directoryList.GetAt(i)))->CompareTo( + *(static_cast(__pDirectoryList->GetAt(j)))) == 0) + { + isMatched = true; + break; + } + } + } + } + } + + __albumName = albumName; + __providerId.Clear(); + + if (__pDirectoryList != null) + { + delete __pDirectoryList; + } + __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + int loopCount = directoryList.GetCount(); + for (int i = 0; i < loopCount; ++i) + { + __pDirectoryList->Add(new (std::nothrow) String(*(const_cast + (static_cast(directoryList.GetAt(i)))))); + } + + if (__pContentInfoList != null) + { + delete __pContentInfoList; + __pContentInfoList = null; + } + + if (GetAppControlMode() == APPCONTROL_MODE_PICK) + { + AppControlMediaType appControlMediaType = GetAppControlMediaType(); + if (appControlMediaType == APPCONTROL_MEDIA_TYPE_IMAGE) + { + __albumContentType = CONTENT_TYPE_IMAGE; + } + else if (appControlMediaType == APPCONTROL_MEDIA_TYPE_VIDEO) + { + __albumContentType = CONTENT_TYPE_VIDEO; + } + } + __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType) +{ + AppLogDebug("ENTER"); + result r = RefreshContentInfoList(contentType); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +FileListPresentationModel::AddDirectoryIfNew(const String& dirName) +{ + + bool isMatched = false; + int dirCount = __pDirectoryList->GetCount(); + String fullDirName; + fullDirName = Environment::GetMediaPath(); + fullDirName.Append(dirName); + + if (__albumName != ALL_ALBUMS_REAL_NAME) //we are not in All albums + { + return; + } + + for (int i = 0; i < dirCount; ++i) + { + if (static_cast(__pDirectoryList->GetAt(i))->CompareTo(fullDirName) == 0) + { + isMatched = true; + break; + } + } + + if (!isMatched) + { + __pDirectoryList->Add(new (std::nothrow) String(fullDirName)); + } +} + +result +FileListPresentationModel::RefreshContentInfoList(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if ((contentType != CONTENT_TYPE_ALL) && (contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO)) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; + } + + if ((__pDirectoryList == null) || (__pDirectoryList->GetCount() <= 0)) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; + } + + __albumContentType = contentType; + + if (__pContentInfoList != null) + { + delete __pContentInfoList; + __pContentInfoList = null; + } + + __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +String +FileListPresentationModel::GetCurrentAlbumName(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __albumName; +} + +void +FileListPresentationModel::SetCurrentAlbumName(const String& albumName) +{ + AppLogDebug("ENTER"); + if (&albumName == null) + { + __albumName = EMPTY_SPACE; + } + else + { + __albumName = albumName; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ContentType +FileListPresentationModel::GetCurrentAlbumContentType(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __albumContentType; +} + +void +FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType) +{ + AppLogDebug("ENTER"); + __albumContentType = contentType; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +IList* +FileListPresentationModel::GetAlbumDirectoryListN(void) const +{ + AppLogDebug("ENTER"); + IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter); + if (__pDirectoryList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return pAlbumDirectoryList; + } + + String* pDirectory = null; + int loopCount = __pDirectoryList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pDirectory = static_cast(__pDirectoryList->GetAt(i)); + pAlbumDirectoryList->Add(new (std::nothrow) String(*pDirectory)); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pAlbumDirectoryList; +} + +IList* +FileListPresentationModel::GetAlbumContentInfoList(void) const +{ + AppLogDebug("ENTER"); + IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter); + if (__pContentInfoList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return pContentList; + } + + ContentInfo* pContentInfo = null; + int loopCount = __pContentInfoList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pContentInfo = static_cast(__pContentInfoList->GetAt(i)); + pContentList->Add(pContentInfo); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pContentList; +} + +ContentInfo* +FileListPresentationModel::GetContentInfo(const int index) const +{ + AppLogDebug("ENTER"); + if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + if (index < 0 || index >= __pContentInfoList->GetCount()) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + ContentInfo* pContentInfo = static_cast(__pContentInfoList->GetAt(index)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pContentInfo; +} + +IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const +{ + AppLogDebug("ENTER"); + IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter); + int loopCount = indexList.GetCount(); + for (int i = 0; i < loopCount; ++i) + { + const Integer* pIndex = static_cast(indexList.GetAt(i)); + + if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt()) + { + ContentInfo* pContentInfo = const_cast(static_cast(__pContentInfoList->GetAt(pIndex->ToInt()))); + pContentIdList->Add(new (std::nothrow) ContentId(pContentInfo->GetContentId())); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return pContentIdList; +} + +int +FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const +{ + AppLogDebug("ENTER"); + if (__pContentInfoList == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return 0; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pContentInfoList->GetCount(); +} + +ContentId +FileListPresentationModel::GetContentInfoIndex(const int index) const +{ + AppLogDebug("ENTER"); + if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return 0; + } + + if (index < 0 || index >= __pContentInfoList->GetCount()) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return 0; + } + ContentInfo* pContentInfo = static_cast(__pContentInfoList->GetAt(index)); + ContentId contentId = pContentInfo->GetContentId(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return contentId; +} + +String +FileListPresentationModel::GetContentFilePath(const int index) const +{ + AppLogDebug("ENTER index(%d)", index); + if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return EMPTY_SPACE; + } + + if (index < 0 || index >= __pContentInfoList->GetCount()) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return EMPTY_SPACE; + } + + ContentInfo* pContentInfo = static_cast(__pContentInfoList->GetAt(index)); + String contentPath = pContentInfo->GetContentPath(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return contentPath; +} + +Bitmap* +FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnail, + const ThumbnailInfo& thumbmailInfo) +{ + AppLogDebug("ENTER"); + Bitmap* pOverlayedImage = null; + + if (&thumbmailInfo != null) + { + long duration = thumbmailInfo.GetDuration(); + + Canvas mainCanvas; + if (&thumbnail != null) + { + BufferInfo bufferInfo; + thumbnail.Lock(bufferInfo, INFINITE); + thumbnail.Unlock(); + mainCanvas.Construct(bufferInfo); + } + else + { + Rectangle mainRect(0, 0, W_DEFAULT_THUMBNAIL, H_DEFAULT_THUMBNAIL); + mainCanvas.Construct(mainRect); + mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_BLACK), mainRect); + } + + Rectangle playRect(GAP_W_PLAY_FG, GAP_H_PLAY_FG, W_PLAY_FG, H_PLAY_FG); + Bitmap* playBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_PLAY); + if (playBitmap != null) + { + mainCanvas.DrawBitmap(playRect, *playBitmap); + delete playBitmap; + } + + Canvas durCanvas; + Rectangle durSize(0, 0, W_DURATION, H_DURATION); + Rectangle durRect(0, GAP_H_DURATION, W_DURATION, H_DURATION); + Color durColor(COLOR_DURATION_BG); + durColor.SetAlpha(ALPHA_DURATION); + durCanvas.Construct(durSize); + durCanvas.FillRectangle(durColor, durSize); + Font durFont; + durFont.Construct(FONT_STYLE_PLAIN, FONT_SIZE_DURATION); + durCanvas.SetFont(durFont); + durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT), + CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE); + Bitmap durBitmap; + durBitmap.Construct(durCanvas, durCanvas.GetBounds()); + mainCanvas.DrawBitmap(durRect, durBitmap); + + pOverlayedImage = new (std::nothrow) Bitmap(); + pOverlayedImage->Construct(mainCanvas, mainCanvas.GetBounds()); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pOverlayedImage; +} + +Bitmap* +FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap, + const Bitmap& originalBitmap, const Rectangle& originalBitmapPosition) const +{ + AppLogDebug("ENTER"); + if (&originalBitmap == null || &originalBitmap == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return null; + } + + BufferInfo bufferInfo; + bgBitmap.Lock(bufferInfo, INFINITE); + bgBitmap.Unlock(); + Canvas mainCanvas; + mainCanvas.Construct(bufferInfo); + mainCanvas.Clear(); + mainCanvas.DrawBitmap(originalBitmapPosition, originalBitmap); + + Bitmap* pMainImage = new (std::nothrow) Bitmap(); + pMainImage->Construct(mainCanvas,mainCanvas.GetBounds()); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pMainImage; +} + +IList* +FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& contentDirectoryList, + ContentType contentType)const +{ + AppLogDebug("ENTER"); + IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter); + + if ((&contentDirectoryList == null) || (contentDirectoryList.GetCount() == 0) + || ((contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO) && (contentType != CONTENT_TYPE_ALL))) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return pContentList; + } + + ContentDirectory contentDirectory; + IListT* pContentTypeList = new (std::nothrow) ArrayListT(); + if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL) + { + pContentTypeList->Add(CONTENT_TYPE_IMAGE); + } + if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL) + { + pContentTypeList->Add(CONTENT_TYPE_VIDEO); + } + result r = contentDirectory.Construct(*pContentTypeList); + delete pContentTypeList; + + if (r == E_SUCCESS) + { + int pageNo = SIZE_PAGE_NO; + int countPerPage = SIZE_CONUNT_PER_PAGE; + String* pContentDirectory = null; + + int loopCount = contentDirectoryList.GetCount(); + for (int i = 0; i < loopCount; ++i) + { + IList* pIList = null; + pContentDirectory = const_cast(static_cast(contentDirectoryList.GetAt(i))); + if (pContentDirectory != null) + { + pIList = contentDirectory.GetContentDirectoryItemListN(*pContentDirectory, pageNo, countPerPage, + CONTENT_INFO_ORDER, SORT_ORDER_NONE); + + if (pIList != null) + { + pContentList->AddItems(*pIList); + } + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pContentList; +} + +String +FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const +{ + AppLogDebug("ENTER"); + String albumName; + if (&targetPath == null || targetPath.GetLength() == 0) + { + return albumName; + } + + String mediaPath = RESERVED_MEDIA_PATH; + int length = mediaPath.GetLength(); + mediaPath.Remove(length-1,1); + + + if (targetPath == RESERVED_CAMERA_PATH || targetPath == RESERVED_CAMERA_PATH_EXT) + { + albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB"); + } + else if (targetPath == RESERVED_DOWNLOAD_PATH) + { + albumName = ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS"); + } + else if (targetPath == mediaPath) + { + + albumName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME"); + } + else + { + String directoryName = GetDirecotyNameFromFullPath(targetPath); + albumName = directoryName; + } + + return albumName; +} + +AppControlMode +FileListPresentationModel::GetAppControlMode(void) const +{ + AppLogDebug("Enter"); + AppLogDebug("Exit"); + + return __appControlMode; +} + +AppControlMediaType +FileListPresentationModel::GetAppControlMediaType(void) const +{ + AppLogDebug("Enter"); + AppLogDebug("Exit"); + + return __appControlMediaType; +} + +AppControlSelectionMode +FileListPresentationModel::GetAppControlSelectionMode(void) const +{ + AppLogDebug("Enter"); + AppLogDebug("Exit"); + + return __appControlSelectionMode; +} + +void +FileListPresentationModel::SetUpdateProgressStatus(const bool status) +{ + AppLogDebug("ENTER status = %d",status); + __updateProgressStatus = status; + AppLogDebug("EXIT"); +} + +result +FileListPresentationModel::RotateImage(const Tizen::Content::ContentId& contentId, RotateMode rotateMode) +{ + result r = E_SUCCESS; + ImageBuffer rotateBuffer; + ImageBuffer* pRotatedBuffer = null; + ImageFormat imageFormat; + Image img; + ContentInfo* cntInfo = __pContentManager->GetContentInfoN(contentId); + if (!cntInfo) + { + return E_FAILURE; + } + String filePath = cntInfo->GetContentPath(); + delete cntInfo; + + ContentType contentType = ContentManagerUtil::CheckContentType(filePath); + if (contentType == CONTENT_TYPE_VIDEO) + { + return r; + } + + r = img.Construct(); + + if (r == E_SUCCESS) + { + imageFormat = img.GetImageFormat(filePath); + + r = rotateBuffer.Construct(filePath); + if (r == E_SUCCESS) + { + if (rotateMode == ROTATE_MODE_RIGHT) + { + pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90); + } + else + { + pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270); + } + } + + if (pRotatedBuffer != null) + { + r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100); + delete pRotatedBuffer; + ContentManager::ScanFile(filePath); + } + } + + return r; +} + +void +FileListPresentationModel::ClearImageCache(void) +{ + AppLogDebug("ENTER"); + + if(__pIconListViewCache != null) + { + bool clearThumbnailReq = true; + while(__pIconListViewCache->GetCount() != 0) + { + //This is to Clear the Thumbnail Reuqests only Once + if(clearThumbnailReq == true) + { + ClearThumbnailRequests(); + clearThumbnailReq = false; + } + __pIconListViewCache->RemoveAt(0, true); + } + } + AppLogDebug("EXIT"); +} + +void +FileListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state) +{ + AppLogDebug("ENTER"); + if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED) + { + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlFileMoveTimer.cpp b/src/GlFileMoveTimer.cpp new file mode 100644 index 0000000..818436f --- /dev/null +++ b/src/GlFileMoveTimer.cpp @@ -0,0 +1,282 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 FileMoveTimer.cpp + * @brief This is the source file for FileMoveTimer class. + */ + +#include +#include +#include +#include +#include + +#include "GlFileListPresentationModel.h" +#include "GlFileMoveTimer.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::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +FileMoveTimer::FileMoveTimer(String& destDirectory, IList* list, FileListPresentationModel* presentationModel, + IFileOpInvalidateListener* pInvalidate, bool isCopyOperation) + : GlTimerBase(pInvalidate, FILE_ACTION_MOVE) + , __pMoveIndexList(list) + , __moveToDir(destDirectory) + , __isCopyOperation(false) + , __pPresentationModel(presentationModel) + , __scanDirMap(SingleObjectDeleter) + , __pContentManager(null) +{ + AppLogDebug("ENTER"); + __scanDirMap.Construct(); + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + AppLogDebug("EXIT"); +} + +FileMoveTimer::~FileMoveTimer(void) +{ + AppLogDebug("ENTER"); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + ScanDirectories(); + delete __pMoveIndexList; + delete __pContentManager; + AppLogDebug("EXIT"); +} + +IList * +FileMoveTimer::TimerStart(void) +{ + AppLogDebug("ENTER"); + if (&__moveToDir == null || __moveToDir.IsEmpty()) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return null; + } + + if (__pMoveIndexList == null || __pMoveIndexList->GetCount() <= 0) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + return null; + } + + if (__pMoveIndexList->GetCount() > 0) + { + __pContentManager = new (std::nothrow) ContentManager(); + __pContentManager->Construct(); + if (__isCopyOperation == true) + { + SetActionMode(FILE_ACTION_COPY); + } + if (File::IsFileExist(__moveToDir) == false) + { + result r = Directory::Create(__moveToDir, true); + AppLog("The directory create result is 2(%s)", GetErrorMessage(r)); + + if ( r == E_STORAGE_FULL) + { + return null; + } + + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + IList* pCntIdList = __pPresentationModel->GetContentIdListAtIndexN(*__pMoveIndexList); + return pCntIdList; + } + else + { + return null; + } +} + +result +FileMoveTimer::TimerExpired(const Object* contentId) +{ + AppLogDebug("ENTER"); + const ContentId* cntId = static_cast(contentId); + if(cntId == null) + { + return E_FAILURE; + } + ContentInfo* cntInfo = __pContentManager->GetContentInfoN(*cntId); + if (cntInfo) + { + String filePath = cntInfo->GetContentPath(); + delete cntInfo; + result r = __pPresentationModel->MoveToContentFile(filePath, __moveToDir, __isCopyOperation); + if (!IsFailed(r)) + { + if (__isCopyOperation == false) + { + //For Move operation, add the directory being moved from for scanning + String dirPath; + int index =0; + result r = filePath.LastIndexOf(DIRECTORY_SEPARATOR, filePath.GetLength() - 1, index); + TryReturn(r == E_SUCCESS, false, "[%s] Unable to get Dirpath", GetErrorMessage(r)); + filePath.SubString(0, index, dirPath); + if(!__scanDirMap.ContainsKey(dirPath)) + { + __scanDirMap.Add(new String(dirPath), new Integer(0)); + } + } + if (!__scanDirMap.ContainsKey(__moveToDir)) + { + __scanDirMap.Add(new String(__moveToDir), new Integer(0)); + } + } + return r; + } + return E_FAILURE; +} + +result +FileMoveTimer::ScanDirectories(void) +{ + AppLogDebug("ENTER"); + RequestId reqId; + result r = E_FAILURE; + if (__scanDirMap.GetCount() > 0) + { + AppLogDebug("Print AlbumScanMoveToDirPath 2(%d)", __scanDirMap.GetCount()); + IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN(); + String* pKey = null; + while (pMapEnum->MoveNext() == E_SUCCESS) + { + pKey = static_cast< String* > (pMapEnum->GetKey()); + r = ContentManager::ScanDirectory(*(pKey), true, null, reqId); + } + __scanDirMap.RemoveAll(); + delete pMapEnum; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(r)); + return r; +} + +void +FileMoveTimer::TimerCancel(int, enum FileActionCancelRes res) +{ + AppLogDebug("ENTER"); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + if (res == CANCEL_USER || (res == CANCEL_SYS_ERROR && GetMovedCount() > 0) ) + { + String albumName = __pPresentationModel->ConvertToAlbumName(__moveToDir); + + if (albumName != EMPTY_SPACE) + { + IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pDirectoryList->Add(new (std::nothrow) String(__moveToDir)); + __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList); + __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL); + delete pDirectoryList; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST)); + } + } + else if (res == CANCEL_SYS_ERROR && GetMovedCount() == 0) + { + if (__isCopyOperation == true) + { + MessageBox messageBox; + messageBox.Construct(L"", L"Unable to copy files.", + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + } + AppLogDebug("EXIt"); +} + +int +FileMoveTimer::GetDirScanCount() +{ + AppLogDebug("ENTER"); + IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN(); + String* pKey = null; + while (pMapEnum->MoveNext() == E_SUCCESS) + { + pKey = static_cast< String* > (pMapEnum->GetKey()); + if (File::IsFileExist(*pKey) == false) + { + __scanDirMap.Remove(*pKey); + } + } + delete pMapEnum; + return __scanDirMap.GetCount(); +} + +void +FileMoveTimer::TimerComplete(int, enum FileActionCompleteRes res) +{ + AppLogDebug("ENTER"); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + String albumName = __pPresentationModel->ConvertToAlbumName(__moveToDir); + + if (albumName != EMPTY_SPACE) + { + IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pDirectoryList->Add(new (std::nothrow) String(__moveToDir)); + __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList); + __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL); + delete pDirectoryList; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST)); + } + AppLogDebug("EXIt"); +} + +void +FileMoveTimer::SetCopy(void) +{ + __isCopyOperation = true; +} + +void +FileMoveTimer::ClearCopy(void) +{ + __isCopyOperation = false; +} + + +void +FileMoveTimer::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state) +{ + AppLogDebug("ENTER"); + if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED) + { + String sdcPath = Environment::GetExternalStoragePath(); + IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN(); + String* pKey = null; + while (pMapEnum->MoveNext() == E_SUCCESS) + { + pKey = static_cast< String* > (pMapEnum->GetKey()); + if (pKey->StartsWith(sdcPath, 0)) + { + __scanDirMap.Remove(*pKey); + } + } + delete pMapEnum; + } + AppLogDebug("EXIT"); +} diff --git a/src/GlFileUpdateTimer.cpp b/src/GlFileUpdateTimer.cpp new file mode 100644 index 0000000..1ef83cc --- /dev/null +++ b/src/GlFileUpdateTimer.cpp @@ -0,0 +1,211 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFileUpdateTimer.cpp + * @brief This is the source file for FileUpdateTimer class. + */ + +#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::System; +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) + , __scanDirMap(SingleObjectDeleter) + , __pContentManager(null) +{ + __scanDirMap.Construct(); + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); +} + +FileUpdateTimer::~FileUpdateTimer(void) +{ + AppLogDebug("ENTER"); + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + ScanDirectories(); + delete __pUpdateIndexList; + delete __pContentManager; + AppLogDebug("EXIT"); +} + +IList * +FileUpdateTimer::TimerStart(void) +{ + AppLogDebug("ENTER"); + __pContentManager = new (std::nothrow) ContentManager(); + __pContentManager->Construct(); + IList* pCntIdList = __pFileUpdateManager->GetContentIdListAtIndexN(*__pUpdateIndexList); + AppLogDebug("EXIT"); + return pCntIdList; +} + +result +FileUpdateTimer::TimerExpired(const Object* contentId) +{ + AppLogDebug("ENTER"); + if (_actionId == FILE_ACTION_DELETE) + { + const ContentId* cntId = static_cast(contentId); + if(cntId == null) + { + return E_FAILURE; + } + ContentInfo* cntInfo = __pContentManager->GetContentInfoN(*cntId); + if (cntInfo) + { + String filePath = cntInfo->GetContentPath(); + delete cntInfo; + result r = __pFileUpdateManager->DeleteContentFile(filePath); + if (!IsFailed(r)) + { + String dirPath; + int index =0; + result r = filePath.LastIndexOf(DIRECTORY_SEPARATOR, filePath.GetLength() - 1, index); + TryReturn(r == E_SUCCESS, false, "[%s] Unable to get Dirpath", GetErrorMessage(r)); + filePath.SubString(0, index, dirPath); + if(!__scanDirMap.ContainsKey(dirPath)) + { + __scanDirMap.Add(new String(dirPath), new Integer(0)); + } + } + return r; + } + else + { + return E_FAILURE; + } + } + else + { + result r = E_SUCCESS; + const ContentId* cntId = static_cast(contentId); + if (contentId != null) + { + r = __pFileUpdateManager->RotateImage(*cntId, __rotateMode); + if ( r == E_SUCCESS ) + { + __pFileUpdateManager->RequestThumbnail(*cntId); // do not request thumbnail for video files + } + else + { + return r; + } + } + return r; + } + AppLogDebug("EXIT"); +} + +result +FileUpdateTimer::ScanDirectories(void) +{ + AppLogDebug("ENTER"); + RequestId reqId; + result r = E_SUCCESS; + if (_actionId == FILE_ACTION_DELETE) + { + int scanCount = __scanDirMap.GetCount(); + if( scanCount == 0) + { + return r; + } + IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN(); + String* pKey = null; + while (pMapEnum->MoveNext() == E_SUCCESS) + { + pKey = static_cast< String* > (pMapEnum->GetKey()); + r = ContentManager::ScanDirectory(*(pKey), true, null, reqId); + } + __scanDirMap.RemoveAll(); + AppLogDebug("EXIT(%s)", GetErrorMessage(r)); + return r; + } + else + { + AppLogDebug("EXIT, nothing to be done"); + return E_SUCCESS; + } +} + +int +FileUpdateTimer::GetDirScanCount() +{ + IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN(); + String* pKey = null; + while (pMapEnum->MoveNext() == E_SUCCESS) + { + pKey = static_cast< String* > (pMapEnum->GetKey()); + if (File::IsFileExist(*pKey) == false) + { + __scanDirMap.Remove(*pKey); + } + } + delete pMapEnum; + return __scanDirMap.GetCount(); +} + +void +FileUpdateTimer::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state) +{ + AppLogDebug("ENTER"); + if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED && + _actionId == FILE_ACTION_DELETE) + { + String sdcPath = Environment::GetExternalStoragePath(); + IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN(); + String* pKey = null; + while (pMapEnum->MoveNext() == E_SUCCESS) + { + pKey = static_cast< String* > (pMapEnum->GetKey()); + if (pKey->StartsWith(sdcPath, 0)) + { + __scanDirMap.Remove(*pKey); + } + } + delete pMapEnum; + } + AppLogDebug("EXIT"); +} + +void +FileUpdateTimer::TimerCancel(int, enum FileActionCancelRes res) +{ + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); +} +void +FileUpdateTimer::TimerComplete(int, enum FileActionCompleteRes res) +{ + DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); +} diff --git a/src/GlFormFactory.cpp b/src/GlFormFactory.cpp new file mode 100644 index 0000000..f4161f2 --- /dev/null +++ b/src/GlFormFactory.cpp @@ -0,0 +1,109 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlFormFactory.cpp + * @brief This is the implementation file for FormFactory class. + */ + +#include "GlAlbumListEditorForm.h" +#include "GlAlbumListForm.h" +#include "GlAlbumNameEditorForm.h" +#include "GlFileListEditorForm.h" +#include "GlFileListForm.h" +#include "GlFormFactory.h" +#include "GlImageCropForm.h" +#include "GlSettingMainForm.h" +#include "GlTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +FormFactory::FormFactory(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +FormFactory::~FormFactory(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +Form* +FormFactory::CreateFormN(const String& formId, const SceneId& sceneId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + Form* pNewForm = null; + + if (formId == IDC_FORM_ALBUM_LIST) + { + AlbumListForm* pForm = new (std::nothrow) AlbumListForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + else if (formId == IDC_FORM_ALBUM_LIST_EDITOR) + { + AlbumListEditorForm* pForm = new (std::nothrow) AlbumListEditorForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + else if (formId == IDC_FORM_ALBUM_NAME_EDITOR) + { + AlbumNameEditorForm* pForm = new (std::nothrow) AlbumNameEditorForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + else if (formId == IDC_FORM_FILE_LIST) + { + FileListForm* pForm = new (std::nothrow) FileListForm(); + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDC_FORM_FILE_LIST_EDITOR) + { + FileListEditorForm* pForm = new (std::nothrow) FileListEditorForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + else if (formId == IDC_FORM_SETTING_MAIN) + { + SettingMainForm* pForm = new (std::nothrow) SettingMainForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + else if (formId == IDC_FORM_IMAGE_CROP) + { + ImageCropForm* pForm = new (std::nothrow) ImageCropForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pNewForm; +} diff --git a/src/GlGalleryApp.cpp b/src/GlGalleryApp.cpp new file mode 100644 index 0000000..8428b1c --- /dev/null +++ b/src/GlGalleryApp.cpp @@ -0,0 +1,257 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlGalleryApp.cpp + * @brief This is the implementation file for GalleryApp class. + */ + +#include +#include "GlAlbumListPresentationModel.h" +#include "GlContentUpdateEventListener.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlMainFrame.h" +#include "GlSettingPresentationModel.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Base::Utility; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +GalleryApp::GalleryApp(void) + : __requestId(0) + , __pArguments(null) + , __appControlResult(APP_CTRL_RESULT_SUCCEEDED) + , __frameActivated(false) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +GalleryApp::~GalleryApp(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +UiApp* +GalleryApp::CreateInstance(void) +{ + AppLogDebug("ENTER"); + UiApp* pUiApp = new (std::nothrow) GalleryApp(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pUiApp; +} + +String +GalleryApp::GetAppControlOperationId(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __operationId; +} + +String +GalleryApp::GetMimeType(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return __mimeType; +} + +const IMap* +GalleryApp::GetAppControlArguments(void) const +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pArguments; +} + +void +GalleryApp::SendAppControlResult(const AppCtrlResult appControlResult, const IMap* pExtraData) +{ + AppLogDebug("ENTER"); + AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance(); + result r = pAppManager->SendAppControlResult(__requestId, appControlResult, pExtraData); + if (r == E_MAX_EXCEEDED) + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + } + + AppLogDebug("appControlResult is %d", appControlResult); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +GalleryApp::OnAppInitializing(AppRegistry& appRegistry) +{ + AppLogDebug("ENTER"); + AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +bool +GalleryApp::OnAppInitialized(void) +{ + AppLogDebug("ENTER"); + MainFrame* pMainFrame = new (std::nothrow) MainFrame(); + pMainFrame->Construct(); + AddFrame(*pMainFrame); + + SettingInfo::AddSettingEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +bool +GalleryApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) +{ + AppLogDebug("ENTER"); + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + if (pContentListener) + { + pContentListener->RemoveContentListener(); + } + AlbumListPresentationModel* pAlbumListPresentationModel = AlbumListPresentationModel::GetInstance(); + if (pAlbumListPresentationModel != null) + { + pAlbumListPresentationModel->ClearThumbnailRequests(true); + } + FileListPresentationModel* pFileListPresentationModel = FileListPresentationModel::GetInstance(); + if (pFileListPresentationModel != null) + { + pFileListPresentationModel->ClearThumbnailRequests(true); + } + + delete __pArguments; + __pArguments = null; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +GalleryApp::OnForeground(void) +{ + AppLogDebug("ENTER"); + static bool bFirst = true; + if (bFirst) + { + bFirst = false; + return; + } + + MainFrame* pMainFrame = dynamic_cast(GetFrameAt(0)); + if (pMainFrame) + { + pMainFrame->SetEnabled(true); + pMainFrame->Invalidate(true); + } + + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + if (pContentListener->GetChangeNotificationStatus() == true) + { + pContentListener->ResumeOperation(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GalleryApp::OnAppControlRequestReceived(RequestId reqId, const String& operationId, + const String* pUriData, const String* pMimeType, const IMap* pExtraData) +{ + AppLogDebug("ENTER"); + __requestId = reqId; + __operationId = operationId; + + if (pMimeType != null) + { + __mimeType = *pMimeType; + } + if (pExtraData != null) + { + HashMap* pArguments = new (std::nothrow) HashMap(SingleObjectDeleter); + pArguments->Construct(); + + const String* pKey = null; + const String* pValue = null; + IList* pKeyList = pExtraData->GetKeysN(); + + int loopCount = pKeyList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pKey = static_cast(pKeyList->GetAt(i)); + pValue = static_cast(pExtraData->GetValue(*pKey)); + + pArguments->Add(new (std::nothrow) String(*pKey), new (std::nothrow) String(*pValue)); + } + __pArguments = pArguments; + delete pKeyList; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GalleryApp::OnSettingChanged(String& key) +{ + AppLogDebug("ENTER key(%ls)", key.GetPointer()); + if (key.CompareTo(SETTING_KEY_LANGUAGE) == 0 || key.CompareTo(SETTING_KEY_FONT_SIZE) == 0) + { + UiApp::GetInstance()->Terminate(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GalleryApp::SetFrameEnabled(const bool enabled) +{ + MainFrame* pMainFrame = dynamic_cast(GetFrameAt(0)); + if (pMainFrame) + { + pMainFrame->SetEnabled(enabled); + } +} + +void +GalleryApp::SetFrameActivated(bool frameActivated) +{ + __frameActivated = frameActivated; +} + +bool +GalleryApp::GetFrameActivated(void) const +{ + return __frameActivated; +} + diff --git a/src/GlGalleryEntry.cpp b/src/GlGalleryEntry.cpp new file mode 100644 index 0000000..4fb4032 --- /dev/null +++ b/src/GlGalleryEntry.cpp @@ -0,0 +1,56 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlGalleryEntry.cpp + * @brief This is the implementation file for GalleryEntry class. + */ + +#include "GlGalleryApp.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// +// The entry function of Tizen application called by the operating system. +// +_EXPORT_ int +OspMain(int argc, char *pArgv[]) +{ + AppLogDebug("ENTER"); + AppLogDebug("Application started."); + ArrayList args(SingleObjectDeleter); + args.Construct(); + for (int i = 0; i < argc; i++) + { + args.Add(new (std::nothrow) String(pArgv[i])); + } + + result r = Tizen::App::UiApp::Execute(GalleryApp::CreateInstance, &args); + TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r)); + AppLogDebug("Application finished."); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return static_cast(r); +} +#ifdef __cplusplus +} +#endif // __cplusplus diff --git a/src/GlImageCropForm.cpp b/src/GlImageCropForm.cpp new file mode 100644 index 0000000..28774ea --- /dev/null +++ b/src/GlImageCropForm.cpp @@ -0,0 +1,960 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlImageCrop.cpp + * @brief This is the implementation file for Image Crop. + */ + +#include +#include +#include +#include +#include "GlGalleryApp.h" +#include "GlImageCropForm.h" +#include "GlResourceManager.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; +using namespace Tizen::System; +using namespace Tizen::Text; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const unsigned int COLOR_GALLERY_BG = Color32<31,31,31>::Value; +static const unsigned int CROP_BOX_RECTANGLE_COLOR = Color32<199, 110, 6>::Value; +static const int CROP_BOX_LINE_WIDTH = 5; +static const int H_CROP_RECTANGLE = 20; +static const wchar_t* PATH_DATA_DIRECTORY_IN_CROP = L"data/"; +static const wchar_t* FILE_NAME_SEPARATOR = L"_"; +static const int MAX_FILE_LENGHT = 255; +static const int CROP_BOX_OFFSET = 20; + +ImageCropForm::ImageCropForm(void) + : __sourceFilePath(L"") + , __cropMode(APPCONTROL_DATA_CROP_TYPE_FIT_TO_SCREEN) + , __pCanvas(null) + , __pCurrentBitmap(null) + , __pRectangleBitmap(null) + , __imageFormat(IMG_FORMAT_NONE) + , __imageBuffer(null) + , __pointLocation(OUTSIDE_CROPBOX) + , __isOrientationChanged(false) + , __imageHeight(0) + , __imageWidth(0) + , __statusValue(-1) + , __formHeight(0) + , __formWidth(0) + , __skipMoveEvent(0) + +{ +} + +ImageCropForm::~ImageCropForm(void) +{ + if (__pCurrentBitmap != null) + { + delete __pCurrentBitmap; + } + if (__pRectangleBitmap != null) + { + delete __pRectangleBitmap; + } + if (__pCanvas != null) + { + delete __pCanvas; + } +} + +bool +ImageCropForm::Initialize(void) +{ + Form::Construct(IDL_FORM_IMAGE_CROP); + + return true; +} + +result +ImageCropForm::OnInitializing(void) +{ + AppLogDebug("OnInitializing"); + + AppResource* pAppResource = null; + pAppResource = UiApp::App::GetInstance()->GetAppResource(); + + if (pAppResource != null) + { + __pRectangleBitmap = pAppResource->GetBitmapN(IDB_IMAGE_CROP_RECTANGLE); + } + + Footer* pFooter = GetFooter(); + if (pFooter != null) + { + pFooter->AddActionEventListener(*this); + pFooter->RemoveAllItems(); + pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); + + FooterItem footerItem1; + footerItem1.Construct(IDA_BUTTON_SAVE); + footerItem1.SetText(ResourceManager::GetString(L"IDS_COM_OPT_SAVE")); + + pFooter->AddItem(footerItem1); + } + + __pPresentationModel = FileListPresentationModel::GetInstance(); + + AddTouchEventListener(*this); + AddOrientationEventListener(*this); + SetFormBackEventListener(this); + + return E_SUCCESS; +} + +result +ImageCropForm::OnDraw(void) +{ + AppLogDebug("OnDraw"); + result r = E_SUCCESS; + + if (__pCanvas != null) + { + __pCanvas->Clear(); + r = __pCanvas->SetLineWidth(CROP_BOX_LINE_WIDTH); + r = __pCanvas->DrawBitmap(Rectangle(__imageBox.x, __imageBox.y, __imageBox.width, __imageBox.height), *__pCurrentBitmap); // Image to be cropped + r = __pCanvas->DrawRectangle(Rectangle(__cropBox.x, __cropBox.y, __cropBox.width, __cropBox.height)); // Cropbox rectangle + r = __pCanvas->DrawBitmap(Rectangle((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2), __cropBox.y - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Top Rectangle + r = __pCanvas->DrawBitmap(Rectangle((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Bottom Rectangle + r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); //Left Rectangle + r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); //Right Rectangle + r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (H_CROP_RECTANGLE / 2), __cropBox.y - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Top Left Rectangle + r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2), __cropBox.y - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Top Right Rectangle + r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Bottom Right Rectangle + r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Bottom Left Rectangle + __pCanvas->SetBackgroundColor(COLOR_GALLERY_BG); + } + + return r; +} + +void +ImageCropForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("OnFormBackRequested"); + + SceneManager::GetInstance()->GoBackward(BackwardSceneTransition()); +} + +void +ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + AppLogDebug("OnActionPerformed"); + result r = E_SUCCESS; + + switch(actionId) + { + case IDA_BUTTON_SAVE: + { + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + + if (pApp != null && pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_PICK) + { + ImageBuffer* pCropBuffer = null; + int count = 1; + int index = 0; + + String destFilePath; + destFilePath.Append(App::GetInstance()->GetAppSharedPath()); + destFilePath.Append(PATH_DATA_DIRECTORY_IN_CROP); + destFilePath.Append(GetFileName(__sourceFilePath)); + destFilePath.Reverse(); + r = destFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); + destFilePath.Reverse(); + if (r != E_SUCCESS) + { + index = 0; + destFilePath.Append(FILE_EXT_SEPARATOR); + } + destFilePath.Insert(FILE_NAME_SEPARATOR, destFilePath.GetLength() - index - 1); + destFilePath.Insert(count, destFilePath.GetLength() - index - 1); + + if (__imageFormat != IMG_FORMAT_JPG || __imageFormat != IMG_FORMAT_PNG || __imageFormat != IMG_FORMAT_BMP) + { + destFilePath.Remove(destFilePath.GetLength() - index, index); + destFilePath.Append(CONTENT_EXT_JPG); + } + + while (File::IsFileExist(destFilePath) == true) + { + count++; + destFilePath.Clear(); + destFilePath.Append(App::GetInstance()->GetAppSharedPath()); + destFilePath.Append(PATH_DATA_DIRECTORY_IN_CROP); + destFilePath.Append(GetFileName(__sourceFilePath)); + destFilePath.Insert(FILE_NAME_SEPARATOR, destFilePath.GetLength() - index - 1); + destFilePath.Insert(count, destFilePath.GetLength() - index - 1); + if (__imageFormat != IMG_FORMAT_JPG || __imageFormat != IMG_FORMAT_PNG || __imageFormat != IMG_FORMAT_BMP) + { + destFilePath.Remove(destFilePath.GetLength() - index, index); + destFilePath.Append(CONTENT_EXT_JPG); + } + } + + AppCtrlResult appControlResult = APP_CTRL_RESULT_FAILED; + HashMap* pMap = null; + int inputLength = 0; + Utf8Encoding utf8; + r = utf8.GetByteCount(GetFileName(destFilePath), inputLength); + + while (inputLength > MAX_FILE_LENGHT) + { + destFilePath.IndexOf(FILE_NAME_SEPARATOR, 0, index); + destFilePath.Remove(index - 1, 1); + r = utf8.GetByteCount(GetFileName(destFilePath), inputLength); + } + + pCropBuffer = __imageBuffer->CropN(((__cropBox.x - __imageBox.x) * __imageWidth) / __imageBox.width, ((__cropBox.y - __imageBox.y) * __imageHeight) / __imageBox.height, + (__cropBox.width * __imageWidth) / __imageBox.width, (__cropBox.height * __imageHeight) / __imageBox.height); + + if (pCropBuffer != null) + { + if (__imageFormat == IMG_FORMAT_JPG || __imageFormat == IMG_FORMAT_PNG || __imageFormat == IMG_FORMAT_BMP) + { + r = pCropBuffer->EncodeToFile(destFilePath, __imageFormat, true, 100); + } + else + { + r = pCropBuffer->EncodeToFile(destFilePath, IMG_FORMAT_JPG, true, 100); + } + delete pCropBuffer; + + if (r == E_SUCCESS ) + { + ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pList->Add(new (std::nothrow) String(destFilePath)); + + pMap = new (std::nothrow) HashMap(SingleObjectDeleter); + pMap->Construct(); + pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), pList); + + appControlResult = APP_CTRL_RESULT_SUCCEEDED; + } + else + { + appControlResult = APP_CTRL_RESULT_FAILED; + } + } + else + { + appControlResult = APP_CTRL_RESULT_FAILED; + } + + pApp->SendAppControlResult(appControlResult, pMap); + pApp->Terminate(); + } + } + break; + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return; +} + +void +ImageCropForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus) +{ + AppLogDebug("OnOrientationChanged"); + + __isOrientationChanged = true; + SetValue(); + + if (__pCanvas != null) + { + __pCanvas->Clear(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageCropForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + AppLogDebug("OnTouchPressed"); + + __touchStart = currentPosition; + CheckCurrentPosition(currentPosition); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + if (++__skipMoveEvent % 5 != 0) + { + return; + } + else + { + __skipMoveEvent = 0; + } + + int deltaX = currentPosition.x - __touchStart.x; + int deltaY = currentPosition.y - __touchStart.y; + if (__cropMode.Equals(APPCONTROL_DATA_CROP_TYPE_AUTO, false)) + { + switch(__pointLocation) + { + case INSIDE_TOP_RECTANGLE: + { + if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (H_CROP_RECTANGLE * 3))) + { + __cropBox.y += deltaY; + __cropBox.height -= deltaY; + } + } + break; + + case INSIDE_BOTTOM_RECTANGLE: + { + if ((__cropBox.y + __cropBox.height + deltaY) < (__imageBox.y + __imageBox.height) + && (__cropBox.height + deltaY) > (H_CROP_RECTANGLE * 3)) + { + __cropBox.height += deltaY; + } + } + break; + + case INSIDE_LEFT_RECTANGLE: + { + if ((__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3)) + { + __cropBox.x += deltaX; + __cropBox.width -= deltaX; + } + } + break; + + case INSIDE_RIGHT_RECTANGLE: + { + if ((__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) + && __cropBox.width + deltaX > (H_CROP_RECTANGLE * 3)) + { + __cropBox.width += deltaX; + } + } + break; + + case INSIDE_TOP_LEFT_RECTANGLE: + { + if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (H_CROP_RECTANGLE * 3)) + && (__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3)) + { + __cropBox.y += deltaY; + __cropBox.height -= deltaY; + __cropBox.x += deltaX; + __cropBox.width -= deltaX; + } + } + break; + + case INSIDE_TOP_RIGHT_RECTANGLE: + { + if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (H_CROP_RECTANGLE * 3)) + && (__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (H_CROP_RECTANGLE * 3)) + { + __cropBox.width += deltaX; + __cropBox.y += deltaY; + __cropBox.height -= deltaY; + } + } + break; + + case INSIDE_BOTTOM_LEFT_RECTANGLE: + { + if ((__cropBox.y + __cropBox.height + deltaY) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (H_CROP_RECTANGLE * 3) + && (__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3)) + { + __cropBox.x += deltaX; + __cropBox.width -= deltaX; + __cropBox.height += deltaY; + } + } + break; + + case INSIDE_BOTTOM_RIGHT_RECTANGLE: + { + if ((__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (H_CROP_RECTANGLE * 3) + && (__cropBox.y + __cropBox.height + deltaY) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (H_CROP_RECTANGLE * 3)) + { + __cropBox.width += deltaX; + __cropBox.height += deltaY; + } + } + break; + + case INSIDE_CROPBOX: + { + if ((__cropBox.x + deltaX) > __imageBox.x) + { + __cropBox.x += deltaX; + } + else + { + __cropBox.x = __imageBox.x; + } + if ((__cropBox.y + deltaY) > __imageBox.y) + { + __cropBox.y += deltaY; + } + else + { + __cropBox.y = __imageBox.y; + } + if ((__cropBox.x + __cropBox.width + deltaX) > (__imageBox.x + __imageBox.width)) + { + __cropBox.x = __imageBox.x + __imageBox.width - __cropBox.width; + } + if ((__cropBox.y + __cropBox.height + deltaY) > (__imageBox.y + __imageBox.height)) + { + __cropBox.y = __imageBox.y + __imageBox.height - __cropBox.height; + } + } + break; + + default: + break; + } + } + else if (__cropMode.Equals(APPCONTROL_DATA_CROP_TYPE_FIT_TO_SCREEN, false)) + { + if (__pointLocation == INSIDE_LEFT_RECTANGLE || __pointLocation == INSIDE_BOTTOM_LEFT_RECTANGLE + || __pointLocation == INSIDE_TOP_LEFT_RECTANGLE) + { + int temp = __cropBox.height; + int height = (__formHeight * (__cropBox.width - (2 * deltaX))) /__formWidth; + temp = height - temp; + if ((__cropBox.width - (2 * deltaX) > (H_CROP_RECTANGLE * 3)) && (!(height >= __imageBox.height || (__cropBox.width - (2 * deltaX)) >= __imageBox.width))) + { + if (__cropBox.x + deltaX >= __imageBox.x && __cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width + && __cropBox.y - (temp / 2) >= __imageBox.y && __cropBox.y + __cropBox.height + (temp / 2) < __imageBox.y + __imageBox.height + && (__cropBox.width - (2 * deltaX) > (H_CROP_RECTANGLE * 3))) + { + __cropBox.x += deltaX; + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.height = height; + __cropBox.y = __cropBox.y - (temp / 2); + } + else if ((__cropBox.y + __cropBox.height) <= (__imageBox.y + __imageBox.height) + && __cropBox.width < __imageBox.width + && __cropBox.x + deltaX >= __imageBox.x && __cropBox.y - temp >= __imageBox.y ) + { + if (__cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width + && __cropBox.x + deltaX >= __imageBox.x) + { + __cropBox.x += deltaX; + } + else + { + __cropBox.x = __cropBox.x + (2 * deltaX); + } + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.height = height; + __cropBox.y = __cropBox.y - temp; + } + else if (__cropBox.y - (temp / 2) <= __imageBox.y && __cropBox.width - (deltaX) <= __imageBox.width + && __cropBox.x + deltaX >= __imageBox.x && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height) + { + if (__cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width) + { + __cropBox.x += deltaX; + } + else + { + __cropBox.x = __cropBox.x + (2 * deltaX); + } + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.height = height; + } + } + } + else if (__pointLocation == INSIDE_RIGHT_RECTANGLE || __pointLocation == INSIDE_BOTTOM_RIGHT_RECTANGLE + || __pointLocation == INSIDE_TOP_RIGHT_RECTANGLE) + { + deltaX *= -1; + int temp = __cropBox.height; + int height = (__formHeight * (__cropBox.width - (2 * deltaX))) / __formWidth; + temp = height - temp; + if ((__cropBox.width - (2 * deltaX) > (H_CROP_RECTANGLE * 3)) && (!(height >= __imageBox.height || (__cropBox.width - (2 * deltaX)) >= __imageBox.width))) + { + if (deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3)) + { + if (__cropBox.x + deltaX > __imageBox.x && __cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width + && __cropBox.y - (temp / 2) > __imageBox.y && __cropBox.y + __cropBox.height + (temp / 2) < __imageBox.y + __imageBox.height) + { + __cropBox.x += deltaX; + __cropBox.width = __cropBox.width - (2 * deltaX);; + __cropBox.height = height; + __cropBox.y = __cropBox.y - (temp / 2); + } + else if ((__cropBox.y + __cropBox.height + (temp / 2)) >= (__imageBox.y + __imageBox.height) + && __cropBox.x + __cropBox.width - (2 * deltaX) <= __imageBox.x + __imageBox.width + && __cropBox.x - deltaX >= __imageBox.x && __cropBox.y - temp >= __imageBox.y ) + { + if (__cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width + && __cropBox.x + deltaX >= __imageBox.x) + { + __cropBox.x += deltaX; + } + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.height = height; + __cropBox.y = __cropBox.y - temp; + } + else if (__cropBox.y - (temp / 2) <= __imageBox.y && __cropBox.width - (deltaX) <= __imageBox.width + && __cropBox.x + deltaX <= __imageBox.x && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height) + { + if (__cropBox.x + deltaX >= __imageBox.x) + { + __cropBox.x += deltaX; + } + else + { + __cropBox.x = __imageBox.x; + } + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.height = height; + } + else if (__cropBox.y - (temp / 2) <= __imageBox.y && __cropBox.x + deltaX >= __imageBox.x + && __cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width + && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height) + { + __cropBox.x += deltaX; + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.height = height; + } + else if (__cropBox.x + deltaX <= __imageBox.x && __cropBox.y - (temp / 2) >= __imageBox.y + && __cropBox.x + __cropBox.width - (2 * deltaX) <= __imageBox.x + __imageBox.width + && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height) + { + __cropBox.width = __cropBox.width - (2 * deltaX); + __cropBox.y = __cropBox.y - (temp / 2); + __cropBox.height = height; + } + } + } + } + else if (__pointLocation == INSIDE_TOP_RECTANGLE) + { + int temp = __cropBox.width; + int width = (__formWidth * (__cropBox.height - (2 * deltaY))) / __formHeight; + temp = width - temp; + if (__cropBox.height - (2 * deltaY) > (__formHeight * (H_CROP_RECTANGLE * 3)) / __formWidth && (!(__cropBox.height - (2 * deltaY) >= __imageBox.height || width >= __imageBox.width))) + { + if (__cropBox.x - (temp /2 ) > __imageBox.x && __cropBox.x + __cropBox.width + temp < __imageBox.x + __imageBox.width + && __cropBox.y + (deltaY) > __imageBox.y && __cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height) + { + __cropBox.y += deltaY; + __cropBox.height = __cropBox.height - (2 * deltaY); + __cropBox.width = width; + __cropBox.x = __cropBox.x - (temp / 2); + } + else if (__cropBox.x - (temp / 2) < __imageBox.x) + { + if (__cropBox.x + __cropBox.width + temp <= __imageBox.x + __imageBox.width) + { + __cropBox.width = width; + } + if (__cropBox.y + deltaY >= __imageBox.y) + { + __cropBox.y += deltaY; + } + if (__cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height) + { + __cropBox.height = __cropBox.height - (2 * deltaY); + } + } + else if (__cropBox.y + __cropBox.height - (2 * deltaY) >= __imageBox.x + __imageBox.height + && __cropBox.y + (2 * deltaY) >= __imageBox.y) + { + if (__cropBox.x - temp >= __imageBox.x + && __cropBox.x + __cropBox.width + temp > __imageBox.x + __imageBox.width) + { + __cropBox.x = __cropBox.x - temp; + } + else if (__cropBox.x - temp >= __imageBox.x) + { + __cropBox.x = __cropBox.x - temp / 2; + } + if (__cropBox.x + __cropBox.width + temp <= __imageBox.x + __imageBox.width) + { + __cropBox.width = width; + } + if (__cropBox.y + (2 * deltaY) >= __imageBox.y) + { + __cropBox.y = __cropBox.y + (2 * deltaY); + __cropBox.height = __cropBox.height - (2 * deltaY); + } + } + else if (__cropBox.x + __cropBox.width + (temp / 2) > __imageBox.x + __imageBox.width + && __cropBox.x - temp >= __imageBox.x && __cropBox.y + deltaY >= __imageBox.y + && __cropBox.y + __cropBox.height - (2 * deltaY) <= __imageBox.y + __imageBox.height) + { + __cropBox.x = __cropBox.x - temp; + __cropBox.width = width; + __cropBox.y += deltaY; + __cropBox.height = __cropBox.height - (2 * deltaY); + } + } + } + else if (__pointLocation == INSIDE_BOTTOM_RECTANGLE) + { + deltaY = deltaY * (-1); + int temp = __cropBox.width; + int width = (__formWidth * (__cropBox.height - (2 * deltaY))) / __formHeight; + temp = width - temp; + if (__cropBox.height - (2 * deltaY) > (__formHeight * (H_CROP_RECTANGLE * 3)) / __formWidth && (!(__cropBox.height - (2 * deltaY) >= __imageBox.height || width >= __imageBox.width))) + { + if (__cropBox.x - (temp / 2) >= __imageBox.x && __cropBox.x + __cropBox.width + temp < __imageBox.x + __imageBox.width + && __cropBox.y + deltaY > __imageBox.y && __cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height) + { + __cropBox.y += deltaY; + __cropBox.height = __cropBox.height - (2 * deltaY);; + __cropBox.width = width; + __cropBox.x = __cropBox.x - (temp / 2); + } + else if (__cropBox.y + deltaY < __imageBox.y && __cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height + && __cropBox.x - (temp / 2) > __imageBox.x && __cropBox.x + __cropBox.width + temp < __imageBox.x + __imageBox.width) + { + __cropBox.x = __cropBox.x - (temp / 2); + __cropBox.width = width; + __cropBox.height = __cropBox.height - (2 * deltaY); + } + else if (__cropBox.x + __cropBox.width + temp > __imageBox.x + __imageBox.width + && __cropBox.y + deltaY >= __imageBox.y && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height + && __cropBox.x - temp >= __imageBox.x) + { + __cropBox.x = __cropBox.x - temp; + __cropBox.y += deltaY; + __cropBox.width = width; + __cropBox.height = __cropBox.height - (2 * deltaY); + } + else if (__cropBox.x + __cropBox.width + temp >= __imageBox.x + __imageBox.width + && __cropBox.y + deltaY <= __imageBox.y && __cropBox.x - temp > __imageBox.x + && __cropBox.y + __cropBox.height + temp < __imageBox.y + __imageBox.height) + { + __cropBox.x -= temp; + __cropBox.width = width; + __cropBox.height = __cropBox.height - (2 * deltaY); + } + else if (__cropBox.x - temp < __imageBox.x && __cropBox.x + __cropBox.width + temp <= __imageBox.x + __imageBox.width + && __cropBox.y + __cropBox.height - (2 * deltaY) <= __imageBox.y + __imageBox.height) + { + if (__cropBox.y + deltaY >= __imageBox.y) + { + __cropBox.y += deltaY; + } + __cropBox.width = width; + __cropBox.height = __cropBox.height - (2 * deltaY); + } + } + } + else if (__pointLocation == INSIDE_CROPBOX) + { + if ((__cropBox.x + deltaX) > __imageBox.x) + { + __cropBox.x += deltaX; + } + else + { + __cropBox.x = __imageBox.x; + } + if ((__cropBox.y + deltaY) > __imageBox.y) + { + __cropBox.y += deltaY; + } + else + { + __cropBox.y = __imageBox.y; + } + if ((__cropBox.x + __cropBox.width + deltaX) > (__imageBox.x + __imageBox.width)) + { + __cropBox.x = __imageBox.x + __imageBox.width - __cropBox.width; + } + if ((__cropBox.y + __cropBox.height + deltaY) > (__imageBox.y + __imageBox.height)) + { + __cropBox.y = __imageBox.y + __imageBox.height - __cropBox.height; + } + } + } + RequestRedraw(false); + __touchStart = currentPosition; +} + +void +ImageCropForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + AppLogDebug("OnTouchReleased"); + + __pointLocation = OUTSIDE_CROPBOX; +} + +void +ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("OnSceneActivatedN"); + + __pPresentationModel->AddContentEventListener(this); + + if (pArgs != null) + { + __sourceFilePath = *(static_cast(pArgs->GetAt(0))); + pArgs->RemoveAll(true); + delete pArgs; + + if (__sourceFilePath.IsEmpty() == false) + { + if ( __imageBuffer != null) + { + delete __imageBuffer; + __imageBuffer = null; + } + + __imageBuffer = new (std::nothrow) ImageBuffer(); + + result r = __imageBuffer->Construct(__sourceFilePath.GetPointer()); + if (r == E_SUCCESS) + { + __imageWidth = __imageBuffer->GetWidth(); + __imageHeight = __imageBuffer->GetHeight(); + + int physicalHeight = CoordinateSystem::ConvertToPhysicalY(__imageHeight); + int physicalWidth = CoordinateSystem::ConvertToPhysicalX(__imageWidth); + __pCurrentBitmap = __imageBuffer->GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, physicalWidth, physicalHeight); + SetValue(); + + Image img; + r = img.Construct(); + if (r == E_SUCCESS) + { + __imageFormat = img.GetImageFormat(__sourceFilePath); + } + } + else + { + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null && pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_PICK) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_FAILED, null); + pApp->Terminate(); + } + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageCropForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLogDebug("OnSceneDeactivated"); + __pPresentationModel->RemoveContentEventListener(this); + RemoveOrientationEventListener(*this); +} + +void +ImageCropForm::CheckCurrentPosition(const Point currentPosition) +{ + AppLogDebug("CheckCurrentPosition"); + + if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < ((__cropBox.x + __cropBox.width / 2) + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > (__cropBox.y - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < (__cropBox.y + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_TOP_RECTANGLE; + } + else if (currentPosition.x > (__cropBox.x - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < (__cropBox.x + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > ((__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < ((__cropBox.y + __cropBox.height / 2) + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_LEFT_RECTANGLE; + } + else if (currentPosition.x > (__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < (__cropBox.x + __cropBox.width + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > ((__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < ((__cropBox.y + __cropBox.height / 2) + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_RIGHT_RECTANGLE; + } + else if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < ((__cropBox.x + __cropBox.width / 2) + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < (__cropBox.y + __cropBox.height + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_BOTTOM_RECTANGLE; + } + else if (currentPosition.x > (__cropBox.x - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < (__cropBox.x + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > (__cropBox.y - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < (__cropBox.y +(H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_TOP_LEFT_RECTANGLE; + } + else if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < (__cropBox.x + __cropBox.width + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > (__cropBox.y - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < (__cropBox.y +(H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_TOP_RIGHT_RECTANGLE; + } + else if (currentPosition.x > (__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < (__cropBox.x + __cropBox.width + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < (__cropBox.y + __cropBox.height + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_BOTTOM_RIGHT_RECTANGLE; + } + else if (currentPosition.x > (__cropBox.x - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.x < (__cropBox.x + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET) + && currentPosition.y > (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2) - CROP_BOX_OFFSET) && currentPosition.y < (__cropBox.y + __cropBox.height + (H_CROP_RECTANGLE / 2) + CROP_BOX_OFFSET)) + { + __pointLocation = INSIDE_BOTTOM_LEFT_RECTANGLE; + } + else if (currentPosition.x > __cropBox.x && currentPosition.x < (__cropBox.x + __cropBox.width) && currentPosition.y > __cropBox.y && currentPosition.y < (__cropBox.y + __cropBox.height)) + { + __pointLocation = INSIDE_CROPBOX; + } + else + { + __pointLocation = OUTSIDE_CROPBOX; + } + return; +} + +void +ImageCropForm::SetValue(void) +{ + int prevHeight = __imageBox.height; + int prevWidth = __imageBox.width; + int prevImageboxX = __imageBox.x; + int prevImageBoxY = __imageBox.y; + + if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) + { + __formHeight = Form::GetBounds().height; + __formWidth = Form::GetBounds().width; + } + else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + __formHeight = Form::GetBounds().width; + __formWidth = Form::GetBounds().height; + } + + float clientAreaRatio = (GetClientAreaBoundsF().height) / GetClientAreaBoundsF().width; + + if (__imageWidth >= GetClientAreaBounds().width || __imageHeight > GetClientAreaBounds().height) + { + float imageRatio = __imageHeight / (float) __imageWidth; + if (imageRatio < clientAreaRatio) + { + __imageBox.width = GetClientAreaBounds().width; + __imageBox.height = (__imageHeight * __imageBox.width) / __imageWidth; + __imageBox.x = GetClientAreaBounds().x; + __imageBox.y = GetClientAreaBounds().y + (GetClientAreaBounds().height - __imageBox.height) / 2; + } + else + { + __imageBox.height = GetClientAreaBounds().height; + __imageBox.width = (__imageWidth * __imageBox.height) / __imageHeight; + __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2; + __imageBox.y = GetClientAreaBounds().y; + } + } + else + { + __imageBox.height = __imageHeight; + __imageBox.width = __imageWidth; + __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2; + __imageBox.y = GetClientAreaBounds().y + (GetClientAreaBounds().height - __imageBox.height) / 2 ; + } + if (__isOrientationChanged == false) + { + if (__imageBox.height > __imageBox.width) + { + __cropBox.width = (2 * __imageBox.width) / 3; + __cropBox.height = (__formHeight * __cropBox.width / __formWidth); + if (__cropBox.height > __imageBox.height) + { + __cropBox.height = (2 * __imageBox.height) / 3; + __cropBox.width = (__cropBox.height * __formWidth) / __formHeight; + } + __cropBox.y = __imageBox.y + (__imageBox.height - __cropBox.height) / 2; + __cropBox.x = __imageBox.x + (__imageBox.width - __cropBox.width) / 2; + } + else + { + __cropBox.height = (2 *__imageBox.height) / 3; + __cropBox.width = (__formWidth * __cropBox.height / __formHeight); + if (__cropBox.width > __imageBox.width) + { + __cropBox.width = (2 * __imageBox.width) / 3; + __cropBox.height = (__formHeight * __cropBox.width) / __formWidth; + } + __cropBox.y = __imageBox.y + (__imageBox.height - __cropBox.height) / 2; + __cropBox.x = __imageBox.x + (__imageBox.width - __cropBox.width) / 2; + } + } + else + { + float temp = __imageBox.x + ((__cropBox.x - prevImageboxX) * __imageBox.width) / (float) prevWidth; + __cropBox.x = (temp + 0.5); + temp = __imageBox.y + ((__cropBox.y - prevImageBoxY) * __imageBox.height) / (float) prevHeight; + __cropBox.y = (temp + 0.5); + temp = (__cropBox.height * __imageBox.height) / (float) prevHeight; + __cropBox.height = (temp + 0.5); + temp = (__cropBox.width * __imageBox.width) / (float) prevWidth; + __cropBox.width = (temp + 0.5); + } + __pCanvas = GetCanvasN(0.0f, 0.0f, GetClientAreaBoundsF().width, GetClientAreaBoundsF().height); + if (__pCanvas != null) + { + __pCanvas->SetBackgroundColor(COLOR_GALLERY_BG); + __pCanvas->SetForegroundColor(CROP_BOX_RECTANGLE_COLOR); + } +} + +String +ImageCropForm::GetFileName(const String& filePath, bool isCheckExe) const +{ + String strResult; + int lastIndex = -1 ; + + filePath.LastIndexOf(DIRECTORY_SEPARATOR, filePath.GetLength() - 1, lastIndex); + filePath.SubString(lastIndex+1, strResult); + + if (isCheckExe == true) + { + String strTemp = strResult; + + lastIndex = -1; + strTemp.LastIndexOf(FILE_EXT_SEPARATOR, strTemp.GetLength() - 1, lastIndex); + strTemp.SubString(0, lastIndex, strResult); + } + + return strResult; +} + +void +ImageCropForm::OnContentUpdated() +{ + AppLogDebug("ENTER"); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + + AppLogDebug("EXIT(%s)"); +} diff --git a/src/GlImageListEditorPanel.cpp b/src/GlImageListEditorPanel.cpp new file mode 100644 index 0000000..90dd923 --- /dev/null +++ b/src/GlImageListEditorPanel.cpp @@ -0,0 +1,708 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlImageListEditorPanel.cpp + * @brief This is the implementation file for ImageListEditorPanel class. + */ + +#include +#include +#include "GlAlbumInfo.h" +#include "GlCommonUtil.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlImageListEditorPanel.h" +#include "GlResourceManager.h" +#include "GlTypes.h" +#include "GlFileUpdateTimer.h" +#include "GlFileListEditorForm.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const int H_SELECTALL_REGION = 112; +static const int COUNT_LABEL_FONT_SIZE = 33; +static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value; +static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value; +static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK)); +static const float H_COUNT_LABEL = 48.0f; +static const int LENGTH_COUNT_LABEL = 256; +static const int ALPHA_THUMBNAIL_DIM = 70; +static const Rectangle RECT_INITIAL (0, 0, 10, 10); +static const int H_CROP_RECTANGLE = 20; + +ImageListEditorPanel::ImageListEditorPanel(void) + : __itemCount(0) + , __pContentIconListView(null) + , __pCheckButton(null) + , __pLabelSelectCnt(null) + , __pPresentationModel(null) + , __pFileListEditorForm(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ImageListEditorPanel::~ImageListEditorPanel(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +ImageListEditorPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(RECT_INITIAL); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +ImageListEditorPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + __itemCount = 0; + + FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF(); + SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + __pContentIconListView = new (std::nothrow) IconListView(); + + if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE) + { + __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL), + DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK, + ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __pLabelSelectCnt = new (std::nothrow) Label(); + + __pLabelSelectCnt->Construct(FloatRectangle(0, clientAreaBounds.height - H_COUNT_LABEL, + clientAreaBounds.width, H_COUNT_LABEL), ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED")); + __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL); + __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT)); + __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD); + AddControl(__pLabelSelectCnt); + } + else + { + __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height), + DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_NORMAL, + ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + } + } + else + { + __pContentIconListView = new (std::nothrow) IconListView(); + __pContentIconListView->Construct(Rectangle(0, H_SELECTALL_REGION, clientAreaBounds.width, + clientAreaBounds.height - H_SELECTALL_REGION), DIMENSION_DEFAULT_THUMBNAIL, + ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __pLabelSelectCnt = new (std::nothrow) Label(); + __pLabelSelectCnt->Construct( + Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), + ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED")); + __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL); + __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT)); + AddControl(__pLabelSelectCnt); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +ImageListEditorPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemovePresentationModelListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +int +ImageListEditorPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +IconListViewItem* +ImageListEditorPanel::CreateItem(int index) +{ + AppLogDebug("ENTER : index(%d)", index); + IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem(); + Bitmap* pBitmap = null; + String* pItemText = null; + + result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap); + if (pBitmap == null || r == E_FAILURE) + { + __pPresentationModel->RequestThumbnail(index); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + if (pItemText == null) + { + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE")) + { + delete pItemText; + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + if (__pContentIconListView->IsItemChecked(index) == true) + { + if (pBitmap != null) + { + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + Color dimColor(COLOR_THUMBNAIL_DIM); + dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM); + + Canvas canvas; + canvas.Construct(bufferInfo); + canvas.FillRectangle(dimColor, canvas.GetBounds()); + + Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap(); + pSelectedBitmap->Construct(canvas, canvas.GetBounds()); + pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap); + delete pSelectedBitmap; + } + else + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete pIconListviewItem; + delete pItemText; + return null; + } + } + else + { + pIconListviewItem->Construct(*pBitmap, pItemText); + } + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pIconListviewItem; +} + +bool +ImageListEditorPanel::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +ImageListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + + if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED) + { + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE) + { + int checkedCount = GetItemCheckedCount(); + String strTmp; + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + else + { + int checkedCount = GetItemCheckedCount(); + String strTmp; + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + if (__pCheckButton->IsSelected()) + { + __pCheckButton->SetSelected(false); + } + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + + if ( __pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK + && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) + { + if (status == ICON_LIST_VIEW_ITEM_SELECTED) + { + GalleryApp* pApp = static_cast(GalleryApp::GetInstance()); + const IMap* pArguments = pApp->GetAppControlArguments(); + const String* cropMode = null; + + if (pArguments != null) + { + cropMode = static_cast(pArguments->GetValue(String(APPCONTROL_KEY_IMAGEVIEWER_MODE))); + } + + int width = 0; + int height = 0; + ImageFormat imageFormat = IMG_FORMAT_NONE; + result r = E_SUCCESS; + r = ImageBuffer::GetImageInfo(__pPresentationModel->GetContentFilePath(index), imageFormat, width, height); + + if (cropMode != null && r == E_SUCCESS && width > (H_CROP_RECTANGLE * 5) && height > (H_CROP_RECTANGLE * 5)) + { + ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index))); + SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList); + } + else + { + + HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter); + result r = pMap->Construct(); + if (r == E_SUCCESS) + { + + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + r = pArrayList->Construct(); + if (r == E_SUCCESS) + { + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index))); + pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList); + + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap); + pApp->Terminate(); + } + else + { + delete pMap; + } + } + else + { + delete pArrayList; + delete pMap; + } + } + else + { + delete pMap; + } + } + } + } + SetButtonState(); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListEditorPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if (contentType == CONTENT_TYPE_IMAGE) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListEditorPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)",index); + if (index >= 0) + { + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + + ChangeOrientation(); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (currentSceneId == IDSCN_IMAGE_LIST_EDITOR) + { + if (previousSceneId == IDSCN_ALBUM_LIST) + { + AlbumInfo* pAlbumInfo = static_cast(pArgs->GetAt(0)); + if (pAlbumInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + IList* pDirectoryList = pAlbumInfo->GetDirectoryListN(); + __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList); + + if (pDirectoryList != null) + { + delete pDirectoryList; + } + delete pArgs; + + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + } + } + else + { + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->RequestRedraw(true); + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + __pFileListEditorForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturnVoid(__pFileListEditorForm != null, "[%s] fail to get FileListEditorForm.", GetErrorMessage(GetLastResult())); + + String titleText = __pPresentationModel->GetCurrentAlbumName(); + + if (titleText == ALL_ALBUMS_REAL_NAME) + { + String text = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS"); + __pFileListEditorForm->SetTitleText(text); + } + else + { + __pFileListEditorForm->SetTitleText(titleText); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +ImageListEditorPanel::GetItemCheckedCount(void) const +{ + AppLogDebug("ENTER"); + int count = 0; + if (__pContentIconListView != null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + ++count; + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return count; +} + +IList* +ImageListEditorPanel::GetItemCheckedIndexListN(void) const +{ + AppLogDebug("ENTER"); + IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + Integer* pIndex = null; + + if (__pContentIconListView != null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + AppLogDebug("ENTER loopCount(%d)", loopCount); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + pIndex = new (std::nothrow) Integer(i); + AppLogDebug("ENTER loopCount(%d)", loopCount); + AppLogDebug("ENTER loopCount(%d)", pIndex->ToInt()); + pList->Add(pIndex); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pList; +} + +void ImageListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + FileListEditorForm* pFileListEditorForm = + dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.", + GetErrorMessage(GetLastResult())); + pFileListEditorForm->Invalidate(true); +} + +void ImageListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res) +{ +} + +void +ImageListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void) +{ + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + + if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + int loopCount = pIndexList->GetCount(); + Integer* pTemp = null; + for (int i = 0; i < loopCount; ++i) + { + pTemp = static_cast(pIndexList->GetAt(i)); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(pTemp->ToInt()))); + } + + HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter); + pMap->Construct(); + pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), pArrayList); + + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap); + pApp->Terminate(); + } + + delete pIndexList; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListEditorPanel::OnSelectAllPressed(void) +{ + bool needToSelectAll = true; + int checkedCount = GetItemCheckedCount(); + int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + if (checkedCount == totalFileCount) + { + needToSelectAll = false; + } + + if (needToSelectAll == true) + { + for (int i = 0; i < totalFileCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == false) + { + __pContentIconListView->SetItemChecked(i, true); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + if (__pFileListEditorForm != null) + { + __pFileListEditorForm->SetFooterButtonsState(true); + } + } + } + else + { + for (int i = 0; i < totalFileCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == true) + { + __pContentIconListView->SetItemChecked(i, false); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + if (__pFileListEditorForm != null) + { + __pFileListEditorForm->SetFooterButtonsState(false); + } + } + } + + String tempString; + if (needToSelectAll == true) + { + tempString.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount); + } + else + { + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + + __pLabelSelectCnt->SetText(tempString); + __pLabelSelectCnt->RequestRedraw(true); +} + +void +ImageListEditorPanel::SetButtonState(void) +{ + AppLogDebug("ENTER"); + + TryReturnVoid(__pFileListEditorForm != null, "[%s] __pFileListEditorForm is null", GetErrorMessage(GetLastResult())); + + if (GetItemCheckedCount() > 0) + { + AppLogDebug("BUTTONSTATE : Request Enable"); + __pFileListEditorForm->SetFooterButtonsState(true); + } + else + { + AppLogDebug("BUTTONSTATE : Request disable"); + __pFileListEditorForm->SetFooterButtonsState(false); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListEditorPanel::ChangeOrientation(void) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + const Form* pForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF(); + SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height); + if (__pLabelSelectCnt != NULL) + { + __pLabelSelectCnt->SetBounds(0.0f, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL); + } + __pContentIconListView->SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height -H_COUNT_LABEL); +} diff --git a/src/GlImageListPanel.cpp b/src/GlImageListPanel.cpp new file mode 100644 index 0000000..c63a939 --- /dev/null +++ b/src/GlImageListPanel.cpp @@ -0,0 +1,268 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlImageListPanel.cpp + * @brief This is the implementation file for ImageListPanel class. + */ + +#include +#include +#include "GlAlbumInfo.h" +#include "GlCommonUtil.h" +#include "GlFileListForm.h" +#include "GlFileListPresentationModel.h" +#include "GlImageListPanel.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const Rectangle RECT_INITIAL (0, 0, 10, 10); +static const int W_CLIENT = 720; +static const int H_CONTENT_MARGIN = 24; +static const int W_CONTENT_MARGIN = 14; +static const int W_CONTENT_SPACE = 20; +static const int H_CONTENT_SPACE = 24; + +ImageListPanel::ImageListPanel(void) + : __itemCount(0) + , __pContentIconListView(null) + , __pPresentationModel(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ImageListPanel::~ImageListPanel(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +ImageListPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(RECT_INITIAL); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +ImageListPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + clientAreaBounds.x = clientAreaBounds.y = 0; + SetBounds(clientAreaBounds); + __pContentIconListView = new (std::nothrow) IconListView(); + __pContentIconListView->Construct(Rectangle(0, 0, W_CLIENT, clientAreaBounds.height), + DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN); + __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN); + __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE); + __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT); + __pContentIconListView->AddIconListViewItemEventListener(*this); + __pContentIconListView->SetTouchAnimationEnabled(false); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + __itemCount = 0; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +ImageListPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemovePresentationModelListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +int +ImageListPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +IconListViewItem* +ImageListPanel::CreateItem(int index) +{ + AppLogDebug("ENTER"); + IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem(); + Bitmap* pBitmap = null; + String* pItemText = null; + result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap); + if (pBitmap == null || r == E_FAILURE) + { + __pPresentationModel->RequestThumbnail(index); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + if (pItemText == null) + { + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE")) + { + delete pItemText; + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + pIconListviewItem->Construct(*pBitmap, pItemText); + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pIconListviewItem; +} + +bool +ImageListPanel::DeleteItem(int index, IconListViewItem* pItem) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +ImageListPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status) +{ + AppLogDebug("ENTER"); + if (status == ICON_LIST_VIEW_ITEM_SELECTED) + { + ArrayList* pArrayList = new (std::nothrow) ArrayList(); + pArrayList->Construct(); + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + + for (int i = 0; i < loopCount; ++i) + { + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i))); + } + String listIndex; + listIndex.Format(10, L"%d", index); + + const String mimeType = APPCONTROL_MIME_IMAGE_ALL; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_IMAGE)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_INDEX), new (std::nothrow) String(listIndex)); + + __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, + &mimeType, pDataList, null); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if (contentType == CONTENT_TYPE_IMAGE) + { + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + if (index >= 0) + { + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + __pPresentationModel = FileListPresentationModel::GetInstance(); + + if (currentSceneId == IDSCN_IMAGE_LIST) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST) + { + FileListForm* pFileListForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + if (pFileListForm != null) + { + pFileListForm->SetTitleText(__pPresentationModel->GetCurrentAlbumName()); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ImageListPanel::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlMainFrame.cpp b/src/GlMainFrame.cpp new file mode 100644 index 0000000..975b73f --- /dev/null +++ b/src/GlMainFrame.cpp @@ -0,0 +1,127 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlMainFrame.cpp + * @brief This is the implementation file for MainFrame class. + */ + +#include +#include "GlGalleryApp.h" +#include "GlFormFactory.h" +#include "GlMainFrame.h" +#include "GlPanelFactory.h" +#include "GlTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +MainFrame::MainFrame(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +MainFrame::~MainFrame(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +MainFrame::OnInitializing(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + static FormFactory formFactory; + static PanelFactory panelFactory; + + AddFrameEventListener(*this); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + r = pSceneManager->RegisterFormFactory(formFactory); + r = pSceneManager->RegisterPanelFactory(panelFactory); + + r = pSceneManager->RegisterScene(IDSCN_ALBUM_LIST, IDC_FORM_ALBUM_LIST, IDC_PANEL_BLANK); + r = pSceneManager->RegisterScene(IDSCN_ALBUM_LIST_EDITOR, IDC_FORM_ALBUM_LIST_EDITOR, IDC_PANEL_BLANK); + r = pSceneManager->RegisterScene(IDSCN_ALBUM_NAME_EDITOR, IDC_FORM_ALBUM_NAME_EDITOR, IDC_PANEL_BLANK); + + r = pSceneManager->RegisterScene(IDSCN_ALL_LIST, IDC_FORM_FILE_LIST, IDC_PANEL_ALL_LIST); + r = pSceneManager->RegisterScene(IDSCN_IMAGE_LIST, IDC_FORM_FILE_LIST, IDC_PANEL_IMAGE_LIST); + r = pSceneManager->RegisterScene(IDSCN_VIDEO_LIST, IDC_FORM_FILE_LIST, IDC_PANEL_VIDEO_LIST); + + r = pSceneManager->RegisterScene(IDSCN_ALL_LIST_EDITOR, IDC_FORM_FILE_LIST_EDITOR, IDC_PANEL_ALL_LIST_EDITOR); + r = pSceneManager->RegisterScene(IDSCN_IMAGE_LIST_EDITOR, IDC_FORM_FILE_LIST_EDITOR, IDC_PANEL_IMAGE_LIST_EDITOR); + r = pSceneManager->RegisterScene(IDSCN_VIDEO_LIST_EDITOR, IDC_FORM_FILE_LIST_EDITOR, IDC_PANEL_VIDEO_LIST_EDITOR); + + r = pSceneManager->RegisterScene(IDSCN_ALL_LIST_SELECTION, IDC_FORM_FILE_LIST_EDITOR, + IDC_PANEL_ALL_LIST_SELECTION); + + r = pSceneManager->RegisterScene(IDSCN_SETTING_MAIN, IDC_FORM_SETTING_MAIN, IDC_PANEL_BLANK); + r = pSceneManager->RegisterScene(IDSCN_SETTING_INTERVAL, IDC_FORM_SETTING_INTERVAL, IDC_PANEL_BLANK); + r = pSceneManager->RegisterScene(IDSCN_SETTING_TRANSITION, IDC_FORM_SETTING_TRANSITION, IDC_PANEL_BLANK); + r = pSceneManager->RegisterScene(IDSCN_IMAGE_CROP, IDC_FORM_IMAGE_CROP, IDC_PANEL_BLANK); + + SceneId sceneId; + GalleryApp* pGalleryApp = static_cast(GalleryApp::GetInstance()); + + String operationID = pGalleryApp->GetAppControlOperationId(); + + if (operationID.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST), null); + } + else if (operationID.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST), null); + } + else if (operationID.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN), null); + } + else + { + pGalleryApp->Terminate(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +MainFrame::OnTerminating(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +MainFrame::OnFrameActivated(const Frame& source) +{ + AppLogDebug("OnFrameActivated"); + + GalleryApp* pGalleryApp = static_cast(GalleryApp::GetInstance()); + if (pGalleryApp != null) + { + pGalleryApp->SetFrameActivated(true); + } +} diff --git a/src/GlPanelFactory.cpp b/src/GlPanelFactory.cpp new file mode 100644 index 0000000..580c3e1 --- /dev/null +++ b/src/GlPanelFactory.cpp @@ -0,0 +1,108 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlPanelFactory.cpp + * @brief This is the implementation file for PanelFactory class. + */ + +#include "GlAllListEditorPanel.h" +#include "GlAllListPanel.h" +#include "GlAllListSelectionPanel.h" +#include "GlImageListEditorPanel.h" +#include "GlImageListPanel.h" +#include "GlPanelFactory.h" +#include "GlVideoListEditorPanel.h" +#include "GlVideoListPanel.h" +#include "GlTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +PanelFactory::PanelFactory() +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +PanelFactory::~PanelFactory() +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +Panel* +PanelFactory::CreatePanelN(const String& panelId, const SceneId& sceneId) +{ + AppLogDebug("ENTER"); + Panel* pNewPanel = null; + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + + if (panelId == IDC_PANEL_ALL_LIST) + { + AllListPanel* pPanel = new (std::nothrow) AllListPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + else if (panelId == IDC_PANEL_IMAGE_LIST) + { + ImageListPanel* pPanel = new (std::nothrow) ImageListPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + else if (panelId == IDC_PANEL_VIDEO_LIST) + { + VideoListPanel* pPanel = new (std::nothrow) VideoListPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + else if (panelId == IDC_PANEL_ALL_LIST_EDITOR) + { + AllListEditorPanel* pPanel = new (std::nothrow) AllListEditorPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + else if (panelId == IDC_PANEL_IMAGE_LIST_EDITOR) + { + ImageListEditorPanel* pPanel = new (std::nothrow) ImageListEditorPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + else if (panelId == IDC_PANEL_VIDEO_LIST_EDITOR) + { + VideoListEditorPanel* pPanel = new (std::nothrow) VideoListEditorPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + else if (panelId == IDC_PANEL_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pPanel = new (std::nothrow) AllListSelectionPanel(); + pPanel->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pPanel); + pNewPanel = pPanel; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pNewPanel; +} diff --git a/src/GlProgressAnimation.cpp b/src/GlProgressAnimation.cpp new file mode 100644 index 0000000..73352bc --- /dev/null +++ b/src/GlProgressAnimation.cpp @@ -0,0 +1,216 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlProgressAnimation.cpp + * @brief This is the implementation file for GlProgressAnimation class. + */ + +#include +#include "GlProgressAnimation.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; + +ProgressAnimation::ProgressAnimation(void) + : __pAnimation(null) + , __pAnimationFrameList(null) +{ +} + +ProgressAnimation::~ProgressAnimation(void) +{ + if (__pAnimationFrameList != null) + { + delete __pAnimationFrameList; + } +} + +result +ProgressAnimation::Construct(Tizen::Graphics::Rectangle rect) +{ + Panel::Construct(rect); + + AppResource *pAppResource = Application::GetInstance()->GetAppResource(); + if (pAppResource != null) + { + Bitmap *pBitmap0 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS1); + Bitmap *pBitmap1 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS2); + Bitmap *pBitmap2 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS3); + Bitmap *pBitmap3 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS4); + Bitmap *pBitmap4 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS5); + Bitmap *pBitmap5 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS6); + Bitmap *pBitmap6 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS7); + Bitmap *pBitmap7 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS8); + Bitmap *pBitmap8 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS9); + Bitmap *pBitmap9 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS10); + Bitmap *pBitmap10 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS11); + Bitmap *pBitmap11 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS12); + Bitmap *pBitmap12 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS13); + Bitmap *pBitmap13 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS14); + Bitmap *pBitmap14 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS15); + Bitmap *pBitmap15 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS16); + Bitmap *pBitmap16 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS17); + Bitmap *pBitmap17 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS18); + Bitmap *pBitmap18 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS19); + Bitmap *pBitmap19 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS20); + Bitmap *pBitmap20 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS21); + Bitmap *pBitmap21 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS22); + Bitmap *pBitmap22 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS23); + Bitmap *pBitmap23 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS24); + Bitmap *pBitmap24 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS25); + Bitmap *pBitmap25 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS26); + Bitmap *pBitmap26 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS27); + Bitmap *pBitmap27 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS28); + Bitmap *pBitmap28 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS29); + Bitmap *pBitmap29 = pAppResource->GetBitmapN(IDB_ALBUM_RENAME_PROGRESS30); + + // Create AnimationFrames + long duration = DURATION / PROGRESS_COUNT; + AnimationFrame *pAniFrame1 = new (std::nothrow) AnimationFrame(*pBitmap0, duration); + AnimationFrame *pAniFrame2 = new (std::nothrow) AnimationFrame(*pBitmap1, duration); + AnimationFrame *pAniFrame3 = new (std::nothrow) AnimationFrame(*pBitmap2, duration); + AnimationFrame *pAniFrame4 = new (std::nothrow) AnimationFrame(*pBitmap3, duration); + AnimationFrame *pAniFrame5 = new (std::nothrow) AnimationFrame(*pBitmap4, duration); + AnimationFrame *pAniFrame6 = new (std::nothrow) AnimationFrame(*pBitmap5, duration); + AnimationFrame *pAniFrame7 = new (std::nothrow) AnimationFrame(*pBitmap6, duration); + AnimationFrame *pAniFrame8 = new (std::nothrow) AnimationFrame(*pBitmap7, duration); + AnimationFrame *pAniFrame9 = new (std::nothrow) AnimationFrame(*pBitmap8, duration); + AnimationFrame *pAniFrame10 = new (std::nothrow) AnimationFrame(*pBitmap9, duration); + AnimationFrame *pAniFrame11 = new (std::nothrow) AnimationFrame(*pBitmap10, duration); + AnimationFrame *pAniFrame12 = new (std::nothrow) AnimationFrame(*pBitmap11, duration); + AnimationFrame *pAniFrame13 = new (std::nothrow) AnimationFrame(*pBitmap12, duration); + AnimationFrame *pAniFrame14 = new (std::nothrow) AnimationFrame(*pBitmap13, duration); + AnimationFrame *pAniFrame15 = new (std::nothrow) AnimationFrame(*pBitmap14, duration); + AnimationFrame *pAniFrame16 = new (std::nothrow) AnimationFrame(*pBitmap15, duration); + AnimationFrame *pAniFrame17 = new (std::nothrow) AnimationFrame(*pBitmap16, duration); + AnimationFrame *pAniFrame18 = new (std::nothrow) AnimationFrame(*pBitmap17, duration); + AnimationFrame *pAniFrame19 = new (std::nothrow) AnimationFrame(*pBitmap18, duration); + AnimationFrame *pAniFrame20 = new (std::nothrow) AnimationFrame(*pBitmap19, duration); + AnimationFrame *pAniFrame21 = new (std::nothrow) AnimationFrame(*pBitmap20, duration); + AnimationFrame *pAniFrame22 = new (std::nothrow) AnimationFrame(*pBitmap21, duration); + AnimationFrame *pAniFrame23 = new (std::nothrow) AnimationFrame(*pBitmap22, duration); + AnimationFrame *pAniFrame24 = new (std::nothrow) AnimationFrame(*pBitmap23, duration); + AnimationFrame *pAniFrame25 = new (std::nothrow) AnimationFrame(*pBitmap24, duration); + AnimationFrame *pAniFrame26 = new (std::nothrow) AnimationFrame(*pBitmap25, duration); + AnimationFrame *pAniFrame27 = new (std::nothrow) AnimationFrame(*pBitmap26, duration); + AnimationFrame *pAniFrame28 = new (std::nothrow) AnimationFrame(*pBitmap27, duration); + AnimationFrame *pAniFrame29 = new (std::nothrow) AnimationFrame(*pBitmap28, duration); + AnimationFrame *pAniFrame30 = new (std::nothrow) AnimationFrame(*pBitmap29, duration); + + // Create AnimationList + __pAnimationFrameList = new (std::nothrow) ArrayList(SingleObjectDeleter); + __pAnimationFrameList->Construct(); + __pAnimationFrameList->Add(*pAniFrame1); + __pAnimationFrameList->Add(*pAniFrame2); + __pAnimationFrameList->Add(*pAniFrame3); + __pAnimationFrameList->Add(*pAniFrame4); + __pAnimationFrameList->Add(*pAniFrame5); + __pAnimationFrameList->Add(*pAniFrame6); + __pAnimationFrameList->Add(*pAniFrame7); + __pAnimationFrameList->Add(*pAniFrame8); + __pAnimationFrameList->Add(*pAniFrame9); + __pAnimationFrameList->Add(*pAniFrame10); + __pAnimationFrameList->Add(*pAniFrame11); + __pAnimationFrameList->Add(*pAniFrame12); + __pAnimationFrameList->Add(*pAniFrame13); + __pAnimationFrameList->Add(*pAniFrame14); + __pAnimationFrameList->Add(*pAniFrame15); + __pAnimationFrameList->Add(*pAniFrame16); + __pAnimationFrameList->Add(*pAniFrame17); + __pAnimationFrameList->Add(*pAniFrame18); + __pAnimationFrameList->Add(*pAniFrame19); + __pAnimationFrameList->Add(*pAniFrame20); + __pAnimationFrameList->Add(*pAniFrame21); + __pAnimationFrameList->Add(*pAniFrame22); + __pAnimationFrameList->Add(*pAniFrame23); + __pAnimationFrameList->Add(*pAniFrame24); + __pAnimationFrameList->Add(*pAniFrame25); + __pAnimationFrameList->Add(*pAniFrame26); + __pAnimationFrameList->Add(*pAniFrame27); + __pAnimationFrameList->Add(*pAniFrame28); + __pAnimationFrameList->Add(*pAniFrame29); + __pAnimationFrameList->Add(*pAniFrame30); + + // Deallocate a Bitmap. + delete pBitmap0; + delete pBitmap1; + delete pBitmap2; + delete pBitmap3; + delete pBitmap4; + delete pBitmap5; + delete pBitmap6; + delete pBitmap7; + delete pBitmap8; + delete pBitmap9; + delete pBitmap10; + delete pBitmap11; + delete pBitmap12; + delete pBitmap13; + delete pBitmap14; + delete pBitmap15; + delete pBitmap16; + delete pBitmap17; + delete pBitmap18; + delete pBitmap19; + delete pBitmap20; + delete pBitmap21; + delete pBitmap22; + delete pBitmap23; + delete pBitmap24; + delete pBitmap25; + delete pBitmap26; + delete pBitmap27; + delete pBitmap28; + delete pBitmap29; + + // Create Animation + __pAnimation = new (std::nothrow) Animation(); + __pAnimation->Construct(Rectangle((rect.width / 2 - 60 / 2), (rect.height / 2 - 30), 60, 60), *__pAnimationFrameList); + __pAnimation->SetRepeatCount(10000); + AddControl(__pAnimation); + } + + return E_SUCCESS; +} + +void +ProgressAnimation::AnimationStart(void) +{ + __pAnimation->SetShowState(true); + __pAnimation->Play(); +} + +void +ProgressAnimation::AnimationStop(void) +{ + __pAnimation->Stop(); + __pAnimation->SetShowState(false); +} + +void +ProgressAnimation::ChangeOrientation(Tizen::Graphics::Rectangle rect) +{ + Panel::SetBounds(rect); + __pAnimation->SetBounds((rect.width / 2 - 60 / 2), (rect.height / 2 - 30), 60, 60); + __pAnimation->Invalidate(true); +} diff --git a/src/GlProgressBar.cpp b/src/GlProgressBar.cpp new file mode 100644 index 0000000..0e40399 --- /dev/null +++ b/src/GlProgressBar.cpp @@ -0,0 +1,207 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlProgressBar.cpp + * @brief This is the implementation file for GlProgressBar class. + */ + +#include +#include + +#include "GlProgressBar.h" +#include "GlResourceManager.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; + +GlProgressBar::GlProgressBar(IActionEventListener* listener, IPropagatedKeyEventListener* propagatedListener) + : __totalVal(1) + , __curVal(1) + , __pFileProgressingPopup(null) + , __pFileProgressingProgress(null) + , __pFileProgressingHeaderLabel(null) + , __pFileProgressingLabel(null) + , __pFileCounterLabel(null) + , __pFileProgressingCancelButton(null) + , __pActionListener(listener) + , __pPropagatedListener(propagatedListener) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +GlProgressBar::~GlProgressBar(void) +{ + AppLogDebug("ENTER"); + if (__pFileProgressingPopup != null) + { + delete __pFileProgressingPopup; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GlProgressBar::HideFileProgressingPopup(void) +{ + AppLogDebug("ENTER"); + if (__pFileProgressingPopup != null && __pFileProgressingPopup->IsVisible()) + { + __pFileProgressingPopup->SetShowState(false); + + delete __pFileProgressingPopup; + __pFileProgressingPopup = null; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +GlProgressBar::CreateFileProgressingPopup(void) +{ + AppLogDebug("ENTER"); + __pFileProgressingPopup = new (std::nothrow) Popup(); + result r = __pFileProgressingPopup->Construct(L"IDL_DEL_PROGRESSING_POPUP"); + + if (__pFileProgressingPopup != null && r == E_SUCCESS) + { + + __pFileProgressingPopup->SetPropagatedKeyEventListener(__pPropagatedListener); + + __pFileProgressingCancelButton = static_cast(__pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true)); + + if (__pFileProgressingCancelButton != null) + { + __pFileProgressingCancelButton->SetActionId(IDA_PROGRESSBAR_CANCEL); + __pFileProgressingCancelButton->AddActionEventListener(*__pActionListener); + __pFileProgressingCancelButton->SetShowState(true); + } + + __pFileProgressingProgress = static_cast(__pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true)); + + if (__pFileProgressingProgress != null) + { + __pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS"); + __pFileProgressingProgress->SetValue(0); + } + + __pFileProgressingHeaderLabel = static_cast(__pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true)); + + if (__pFileProgressingHeaderLabel != null) + { + __pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER"); + __pFileProgressingHeaderLabel->SetShowState(true); + } + + __pFileProgressingLabel = static_cast(__pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true)); + + if (__pFileProgressingLabel != null) + { + __pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL"); + __pFileProgressingLabel->SetShowState(true); + } + + __pFileCounterLabel = static_cast(__pFileProgressingPopup->GetControl(L"IDC_COUNTER_LABEL", true)); + + if (__pFileCounterLabel != null) + { + __pFileCounterLabel->SetText(L""); + __pFileCounterLabel->SetTextColor(CUSTOM_COLOR_GREY); + __pFileCounterLabel->SetShowState(true); + } + + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return r; +} + +void +GlProgressBar::ShowFileProgressingPopup(const int val, enum FileActionMode action) +{ + AppLogDebug("ENTER"); + CreateFileProgressingPopup(); + + if (val > 0) + { + __totalVal = val; + } + else + { + __totalVal = 1; + } + __pFileProgressingProgress->SetRange(1, val); + + if (__pFileProgressingPopup != null) + { + if (__pFileProgressingHeaderLabel != null) + { + switch (action) + { + case FILE_ACTION_MOVE: + __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_MOVING")); + break; + + case FILE_ACTION_DELETE: + __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_DELETING")); + break; + + case FILE_ACTION_COPY: + __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_COPYING_ING")); + break; + + case FILE_ACTION_ROTATE: + __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_PROCESSING")); + break; + + default: + break; + } + + __pFileProgressingHeaderLabel->Invalidate(true); + } + + __pFileProgressingPopup->SetShowState(true); + __pFileProgressingPopup->Show(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GlProgressBar::IncProgress(const int count) +{ + AppLogDebug("ENTER"); + String counter; + __curVal = count; + __pFileProgressingProgress->SetValue(count); + + counter.Append(count); + counter.Append(L"/"); + counter.Append(__totalVal); + + if (__pFileCounterLabel != null) + { + __pFileCounterLabel->SetText(counter); + __pFileCounterLabel->Invalidate(true); + } + + __pFileProgressingPopup->SetShowState(true); + __pFileProgressingPopup->Show(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlRadioCustomItem.cpp b/src/GlRadioCustomItem.cpp new file mode 100644 index 0000000..ce63003 --- /dev/null +++ b/src/GlRadioCustomItem.cpp @@ -0,0 +1,85 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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: RadioCustomItem.cpp + *@brief: The RadioCustomItem + */ + +#include +#include + +#include "GlRadioCustomItem.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + + +const int RadioCustomItem::IDA_FORMAT_STRING = 500; + + +RadioCustomItem::RadioCustomItem(void) + : __isSelected(false) + , __width(0) + , __height(0) +{ +} + +RadioCustomItem::~RadioCustomItem(void) +{ +} + +result +RadioCustomItem::Construct(int width, int height) +{ + result r = E_FAILURE; + __width = width; + __height = height; + const Dimension dim(width, height); + r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_RADIO); + + return r; +} + +void +RadioCustomItem::SetText(const Tizen::Base::String& text) +{ + __text = text; +} + +String +RadioCustomItem::GetText(void) const +{ + return __text; +} + +result +RadioCustomItem::Make(int fontSize) +{ + result r = E_FAILURE; + Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2; + Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT; + + AppLogDebug("RadioCustomItem::the text is %ls",__text.GetPointer()); + r = AddElement(Rectangle(16, 5, __width - 85 - 16, __height), IDA_FORMAT_STRING, __text, fontSize, textColor, textColor, textColor, true); + TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r)); + + CATCH: + return r; +} + diff --git a/src/GlResourceManager.cpp b/src/GlResourceManager.cpp new file mode 100644 index 0000000..d947425 --- /dev/null +++ b/src/GlResourceManager.cpp @@ -0,0 +1,58 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlResourceManager.cpp + * @brief This is the implementation file for ResourceManager class. + */ + +#include +#include "GlResourceManager.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; + +Bitmap* +ResourceManager::GetBitmapN(const String& id) +{ + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + if (pAppResource == null) + { + return null; + } + + return pAppResource->GetBitmapN(id); +} + +String +ResourceManager::GetString(const String& id) +{ + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + if (pAppResource == null) + { + return L""; + } + + String str; + result r = pAppResource->GetString(id, str); + + if (r != E_SUCCESS) + { + return L""; + } + return str; +} diff --git a/src/GlSettingMainForm.cpp b/src/GlSettingMainForm.cpp new file mode 100644 index 0000000..d0d079a --- /dev/null +++ b/src/GlSettingMainForm.cpp @@ -0,0 +1,793 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlSettingMainForm.cpp + * @brief This is the implementation file for SettingMainForm class. + */ + +#include "GlDropDownCustomItem.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlRadioCustomItem.h" +#include "GlResourceManager.h" +#include "GlSettingMainForm.h" +#include "GlSettingPresentationModel.h" +#include "GlSettingToggleCustomItem.h" +#include "GlTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +SettingMainForm::SettingMainForm(void) + : __pList(null) + , __pPresentationModel(null) + , __contentUpdated(false) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +SettingMainForm::~SettingMainForm(void) +{ + AppLogDebug("ENTER"); + if (pGroupItemCount) + { + delete[] pGroupItemCount; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +SettingMainForm::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Form::Construct(IDL_FORM_SETTING_MAIN); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +SettingMainForm::OnInitializing(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel = SettingPresentationModel::GetInstance(); + SettingInfo::AddSettingEventListener(*this); + + Header* pHeader = GetHeader(); + AppAssert(pHeader); + pHeader->SetStyle(HEADER_STYLE_TITLE); + pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_GALLERY")); + + __pList = static_cast(GetControl(L"IDC_SETTING_LIST")); + + if (__pList != null) + { + __pList->SetItemProvider(*this); + __pList->AddGroupedListViewItemEventListener(*this); + } + + SetFormBackEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +SettingMainForm::OnTerminating(void) +{ + AppLogDebug("ENTER"); + SettingInfo::RemoveSettingEventListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +void +SettingMainForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + + switch (actionId) + { + default: + { + break; + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +SettingMainForm::OnFormBackRequested(Form& source) +{ + AppLogDebug("ENTER"); + + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null) + { + if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_CONFIGURE) + { + if (pApp->GetFrameActivated() == true) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_TERMINATED, null); + pApp->Terminate(); + } + } + else + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (__contentUpdated) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + } + else + { + pSceneManager->GoBackward(BackwardSceneTransition()); + } + } + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +SettingMainForm::OnContentUpdated(void) +{ + AppLogDebug("ENTER"); + __contentUpdated = true; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +SettingMainForm::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + FileListPresentationModel::GetInstance()->AddContentEventListener(this); + __pPresentationModel->CreateDefaultRegistry(); + InitializeSettingValues(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +SettingMainForm::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __contentUpdated = false; + __pPresentationModel->DeleteRegistry(); + FileListPresentationModel::GetInstance()->RemoveContentEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +SettingMainForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status) +{ + int effectiveIndex = 0; + int inputValue = 0; + + effectiveIndex = effectiveIndex + itemIndex; + + if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN) + { + AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount); + if (settingInfo[effectiveIndex].isOpen == false) + { + settingInfo[effectiveIndex].isOpen = true; + settingInfo[effectiveIndex].childCount = 0; + for (int iter = effectiveIndex + 1; iter < SETTING_MAX; ++iter) + { + if (settingInfo[iter].itemType == ITEM_TYPE_RADIO) + { + ++settingInfo[effectiveIndex].childCount; + } + else + { + break; + } + } + listView.UpdateList(); + } + else + { + settingInfo[effectiveIndex].isOpen = false; + listView.UpdateList(); + } + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO) + { + int parentIndex = 0; + for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--) + { + if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN) + { + break; + } + } + settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText; + + for (int iter = 0; iter < settingInfo[parentIndex].childCount; ++iter) + { + if (parentIndex + iter + 1 != effectiveIndex) + { + AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1); + settingInfo[parentIndex + iter + 1].isSelected = false; + } + else + { + AppLogDebug("effectiveIndex %d set to true", effectiveIndex); + settingInfo[effectiveIndex].isSelected = true; + } + } + + Invalidate(true); + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE) + { + if (settingInfo[effectiveIndex].isSelected == true) + { + settingInfo[effectiveIndex].isSelected = false; + } + else + { + settingInfo[effectiveIndex].isSelected = true; + } + if (__pList != null) + { + __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected); + } + } + + switch (effectiveIndex) + { + case SETTING_INTERVAL_2: + { + inputValue = 2; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, + inputValue); + listView.UpdateList(); + } + break; + + case SETTING_INTERVAL_3: + { + inputValue = 3; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue); + listView.UpdateList(); + } + break; + + case SETTING_INTERVAL_5: + { + inputValue = 5; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue); + listView.UpdateList(); + } + break; + + case SETTING_INTERVAL_10: + { + inputValue = 10; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue); + listView.UpdateList(); + } + break; + + case SETTING_INTERVAL_20: + { + inputValue = 20; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue); + listView.UpdateList(); + } + break; + + case SETTING_TRANSITION_PAGE: + { + inputValue = 0; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, inputValue); + listView.UpdateList(); + } + break; + + case SETTING_TRANSITION_DISSOLVE: + { + inputValue = 1; + result r = __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, inputValue); + if (r == E_SUCCESS) + { + AppLogDebug(" Passed"); + } + + listView.UpdateList(); + } + break; + + case SETTING_TRANSITION_ZOOM: + { + inputValue = 2; + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, inputValue); + listView.UpdateList(); + } + break; + + case SETTING_REPEAT: + { + int repeatValue = 0; + + __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue); + + if (repeatValue == 0) + { + inputValue = 1; + } + else + { + inputValue = 0; + } + + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, inputValue); + } + break; + + case SETTING_SHUFFLE: + { + int shuffleValue = 0; + + __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, shuffleValue); + + if (shuffleValue == 0) + { + inputValue = 1; + } + else + { + inputValue = 0; + } + + __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, inputValue); + } + break; + + default: + break; + } +} + +GroupItem* +SettingMainForm::CreateGroupItem(int groupIndex, int itemWidth) +{ + GroupItem* pItem = new (std::nothrow) GroupItem(); + if (pItem == null) + { + return null; + } + result r = pItem->Construct(Dimension(itemWidth, 46)); + if (IsFailed(r)) + { + delete pItem; + return null; + } + + String text; + switch (groupIndex) + { + case 0: + text = ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"); + break; + + default: + break; + } + + pItem->SetElement(text, null); + + AppLogDebug("background color set result %s", GetErrorMessage(r)); + + pItem->SetTextColor(CUSTOM_COLOR_SETTINGS_GROUPTITLE); + return pItem; +} + +ListItemBase* +SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth) +{ + AppLog("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex, + itemWidth); + + result r = E_SUCCESS; + int effectiveIndex = 0; + const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND; + const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND; + const Color ITEM_BACKGROUND_COLOR_HIGHLIGHTED = CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED; + + effectiveIndex = effectiveIndex + itemIndex; + AppLogDebug("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex); + + String fontSizeStr; + int fontSize = 0; + int itemHeight = 0; + int defaultHeight = 112; + int defaultFontSize = 44; + + SettingInfo::GetValue("http://tizen.org/setting/font.size", fontSizeStr); + AppLog("the font value is %S",fontSizeStr.GetPointer()); + + if(fontSizeStr == "medium") + { + fontSize = 44; + itemHeight = defaultHeight + (fontSize - defaultFontSize); + } + else if(fontSizeStr == "huge") + { + fontSize = 81; + itemHeight = defaultHeight + (fontSize - defaultFontSize); + } + else if(fontSizeStr == "giant") + { + fontSize = 98; + itemHeight = defaultHeight + (fontSize - defaultFontSize); + } + else if(fontSizeStr == "small") + { + fontSize = 36; + itemHeight = defaultHeight + (fontSize - defaultFontSize); + } + else if(fontSizeStr == "large") + { + fontSize = 64; + itemHeight = defaultHeight + (fontSize - defaultFontSize); + } + else + { + fontSize = 44; + itemHeight = defaultHeight; + } + + + if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE) + { + SettingToggleCustomItem* pItem = new (std::nothrow) SettingToggleCustomItem(); + r = pItem->Construct(itemWidth, itemHeight); + + if (IsFailed(r)) + { + delete pItem; + return null; + } + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED); + + if (__pList != null) + { + __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected); + } + + pItem->SetText(settingInfo[effectiveIndex].titleText); + pItem->Make(fontSize); + + return pItem; + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN) + { + DropDownCustomItem* pItem = new (std::nothrow) DropDownCustomItem(); + r = pItem->Construct(itemWidth,itemHeight); + if (IsFailed(r)) + { + delete pItem; + return null; + } + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED); + + pItem->SetMainText(settingInfo[effectiveIndex].titleText); + pItem->SetSubText(settingInfo[effectiveIndex].subText); + if (settingInfo[effectiveIndex].isOpen) + { + pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED); + } + else + { + pItem->SetCurState(DROP_DOWN_ITEM_STATE_CLOSED); + } + + r = pItem->Make(fontSize,itemHeight); + + if (IsFailed(r)) + { + delete pItem; + return null; + } + + return pItem; + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO) + { + RadioCustomItem* pItem = new (std::nothrow) RadioCustomItem(); + int parentIndex = 0; + + for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--) + { + if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN) + break; + } + + if (settingInfo[parentIndex].isOpen == false) + { + r = pItem->Construct(itemWidth, 0); + __pList->SetItemEnabled(groupIndex, itemIndex,false); + AppLogDebug("construct with height 0 %s", GetErrorMessage(r)); + return pItem; + } + else + { + pItem->Construct(itemWidth, itemHeight); + __pList->SetItemEnabled(groupIndex, itemIndex, true); + } + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_RADIO_ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED); + + pItem->SetText(settingInfo[effectiveIndex].titleText); + AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected); + + __pList->SetItemChecked(groupIndex,itemIndex,settingInfo[effectiveIndex].isSelected); + pItem->Make(fontSize); + + return pItem; + } + else + { + return null; + } +} + +bool +SettingMainForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth) +{ + delete pItem; + return true; +} + +bool +SettingMainForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth) +{ + delete pItem; + return true; +} + +int +SettingMainForm::GetGroupCount(void) +{ + int groupCount = 1; + + return groupCount; +} + +int +SettingMainForm::GetItemCount(int groupIndex) +{ + AppLog(" SettingMainForm::GetItemCount --> groupIndex : %d,", groupIndex); + return pGroupItemCount[groupIndex]; +} + +void +SettingMainForm::InitializeSettingValues(void) +{ + pGroupItemCount = new (std::nothrow) int[1]; + pGroupItemCount[0] = 12; + int interval = 0; + int transitionValue = 0; + int repeatValue = 0; + int shuffletValue = 0; + String selectedInterval; + String selectedTransition; + + for (int iter = (int) SETTING_INVALID + 1; iter < (int) SETTING_MAX; ++iter) + { + settingInfo[iter].isSelected = false; + } + + result r =__pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, + interval); + + if (r == E_SUCCESS) + { + switch (interval) + { + case 2: + { + selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_OPT_2_SECONDS"); + settingInfo[SETTING_INTERVAL_2].isSelected = true; + } + break; + + case 3: + { + selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_OPT_3_SECONDS"); + settingInfo[SETTING_INTERVAL_3].isSelected = true; + } + break; + + case 5: + { + selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_BODY_5_SECONDS"); + settingInfo[SETTING_INTERVAL_5].isSelected = true; + } + break; + + case 10: + { + selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_BODY_10_SECONDS"); + settingInfo[SETTING_INTERVAL_10].isSelected = true; + } + break; + + case 20: + { + selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_BODY_20_SECONDS"); + settingInfo[SETTING_INTERVAL_20].isSelected = true; + } + break; + + default: + break; + } + } + + r = __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, transitionValue); + + if (r == E_SUCCESS) + { + switch (transitionValue) + { + case 0: + { + selectedTransition = ResourceManager::GetString(L"IDS_EBOOK_BODY_PAGE"); + settingInfo[SETTING_TRANSITION_PAGE].isSelected = true; + } + break; + + case 1: + { + selectedTransition = ResourceManager::GetString(L"IDS_MEDIABR_BODY_DISSOLVE"); + settingInfo[SETTING_TRANSITION_DISSOLVE].isSelected = true; + } + break; + + case 2: + { + selectedTransition = ResourceManager::GetString(L"IDS_IV_OPT_ZOOM"); + settingInfo[SETTING_TRANSITION_ZOOM].isSelected = true; + } + break; + + default: + break; + } + } + + settingInfo[SETTING_SLIDESHOW_INTERVAL_TITLE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_SLIDESHOW_INTERVAL"); + settingInfo[SETTING_SLIDESHOW_INTERVAL_TITLE].subText = selectedInterval; + settingInfo[SETTING_SLIDESHOW_INTERVAL_TITLE].itemType = ITEM_TYPE_DROPDOWN; + + settingInfo[SETTING_INTERVAL_2].titleText = ResourceManager::GetString(L"IDS_MEDIABR_OPT_2_SECONDS"); + settingInfo[SETTING_INTERVAL_2].subText = L""; + settingInfo[SETTING_INTERVAL_2].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_INTERVAL_3].titleText = ResourceManager::GetString(L"IDS_MEDIABR_OPT_3_SECONDS"); + settingInfo[SETTING_INTERVAL_3].subText = L""; + settingInfo[SETTING_INTERVAL_3].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_INTERVAL_5].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_5_SECONDS"); + settingInfo[SETTING_INTERVAL_5].subText = L""; + settingInfo[SETTING_INTERVAL_5].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_INTERVAL_10].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_10_SECONDS"); + settingInfo[SETTING_INTERVAL_10].subText = L""; + settingInfo[SETTING_INTERVAL_10].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_INTERVAL_20].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_20_SECONDS"); + settingInfo[SETTING_INTERVAL_20].subText = L""; + settingInfo[SETTING_INTERVAL_20].itemType = ITEM_TYPE_RADIO; + + r = __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue); + + settingInfo[SETTING_REPEAT].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_REPEAT"); + settingInfo[SETTING_REPEAT].itemType = ITEM_TYPE_TOGGLE; + + if (repeatValue == 0) + { + settingInfo[SETTING_REPEAT].isSelected = false; + } + else + { + settingInfo[SETTING_REPEAT].isSelected = true; + } + + r = __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, + ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, shuffletValue); + + settingInfo[SETTING_SHUFFLE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_SHUFFLE"); + settingInfo[SETTING_SHUFFLE].itemType = ITEM_TYPE_TOGGLE; + + if (shuffletValue == 0) + { + settingInfo[SETTING_SHUFFLE].isSelected = false; + } + else + { + settingInfo[SETTING_SHUFFLE].isSelected = true; + } + + settingInfo[SETTING_TRANSITION_EFFECT_TITLE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_TRANSITION_EFFECT"); + settingInfo[SETTING_TRANSITION_EFFECT_TITLE].subText = selectedTransition; + settingInfo[SETTING_TRANSITION_EFFECT_TITLE].itemType = ITEM_TYPE_DROPDOWN; + + settingInfo[SETTING_TRANSITION_PAGE].titleText = ResourceManager::GetString(L"IDS_EBOOK_BODY_PAGE"); + settingInfo[SETTING_TRANSITION_PAGE].subText = L""; + settingInfo[SETTING_TRANSITION_PAGE].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_TRANSITION_DISSOLVE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_DISSOLVE"); + settingInfo[SETTING_TRANSITION_DISSOLVE].subText = L""; + settingInfo[SETTING_TRANSITION_DISSOLVE].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_TRANSITION_ZOOM].titleText = ResourceManager::GetString(L"IDS_IV_OPT_ZOOM"); + settingInfo[SETTING_TRANSITION_ZOOM].subText = L""; + settingInfo[SETTING_TRANSITION_ZOOM].itemType = ITEM_TYPE_RADIO; +} + +SettingMainForm::SettingItemInfo::SettingItemInfo(void) + : childCount(0) + , isOpen(false) + , isSelected(false) +{ +} + + +void +SettingMainForm::OnSettingChanged(String& key) +{ + AppLogDebug("ENTER"); + if (key == L"http://tizen.org/setting/font.size") + { + __pList->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlSettingPresentationModel.cpp b/src/GlSettingPresentationModel.cpp new file mode 100644 index 0000000..efd01c8 --- /dev/null +++ b/src/GlSettingPresentationModel.cpp @@ -0,0 +1,245 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlSettingPresentationModel.cpp + * @brief This is the implementation file for SettingPresentationModel class. + */ + +#include +#include "GlSettingPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Io; + +static const int DEFAULT_VALUE_EFFECT_SLIDE = 0; +static const int DEFAULT_VALUE_INTERVAL = 3; +static const int DEFAULT_VALUE_REPEAT = 0; +static const int DEFAULT_VALUE_SHUFFLE = 0; + +const wchar_t* GALLERY_APP_ID = L"ijudt7w61q.Gallery"; + +const wchar_t* PATH_DATA_DIRECTORY = L"data/"; +const wchar_t* PATH_GALLERY_DEFAULT_SETTINGS = L"GalleryDefaultSettings.ini"; + +const wchar_t* SECTION_GALLERY = L"GALLRY_SETTING"; +const wchar_t* SECTION_IMAGE_VIEWER = L"IMAGE_VIEWER_SETTING"; +const wchar_t* SECTION_VIDEO_PLAYER = L"VIDEO_PLAYER_SETTING"; + +const wchar_t* SLIDESHOW_INTERVAL_VALUE = L"SLIDESHOW_INTERVAL_VALUE"; +const wchar_t* TRANSITION_EFFECT_VALUE = L"TRANSITION_EFFECT_VALUE"; +const wchar_t* REPEAT_VALUE = L"REPEAT_VALUE"; +const wchar_t* SHUFFLE_VALUE = L"SHUFFLE_VALUE"; + +SettingPresentationModel* SettingPresentationModel::__pPresentationModelInstance = null; + +SettingPresentationModel::SettingPresentationModel(void) + : __pDefaultGalleryRegistry(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +SettingPresentationModel::~SettingPresentationModel(void) +{ + AppLogDebug("ENTER"); + delete __pDefaultGalleryRegistry; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +SettingPresentationModel* +SettingPresentationModel::GetInstance(void) +{ + AppLogDebug("ENTER"); + if (__pPresentationModelInstance == null) + { + CreateInstance(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pPresentationModelInstance; +} + +result +SettingPresentationModel::Construct(void) +{ + AppLogDebug("ENTER"); + return E_SUCCESS; +} + +void +SettingPresentationModel::CreateInstance(void) +{ + AppLogDebug("ENTER"); + __pPresentationModelInstance = new (std::nothrow) SettingPresentationModel; + result r = __pPresentationModelInstance->Construct(); + + if (IsFailed(r) == true) + { + delete __pPresentationModelInstance; + __pPresentationModelInstance = null; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + std::atexit(DestroyInstance); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +SettingPresentationModel::DestroyInstance(void) +{ + AppLogDebug("ENTER"); + delete __pPresentationModelInstance; + __pPresentationModelInstance = null; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +SettingPresentationModel::GetValue(const String& strSectionName, const String& entryName, int& value) const +{ + AppLogDebug("ENTER"); + result r = __pDefaultGalleryRegistry->GetValue(strSectionName, entryName, value); + TryCatch(r == E_SUCCESS,, "Registry::GetValue() failed[%s]", GetErrorMessage(r)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; + +CATCH: + AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +SettingPresentationModel::GetValue(const String& strSectionName, const String& entryName, String& value) const +{ + AppLogDebug("ENTER"); + result r = __pDefaultGalleryRegistry->GetValue(strSectionName, entryName, value); + TryCatch(r == E_SUCCESS,, "Registry::GetValue() failed[%s]", GetErrorMessage(r)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; + +CATCH: + AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +SettingPresentationModel::SetValue(const String& strSectionName, const String& entryName, const int value) +{ + AppLogDebug("ENTER"); + result r= __pDefaultGalleryRegistry->SetValue(strSectionName, entryName, value); + TryCatch(r == E_SUCCESS,, "Registry::SetValue() failed[%s]", GetErrorMessage(r)); + r = __pDefaultGalleryRegistry->Flush(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; + +CATCH: + AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +SettingPresentationModel::SetValue(const String& strSectionName, const String& entryName, const String& value) +{ + AppLogDebug("ENTER"); + result r = __pDefaultGalleryRegistry->SetValue(strSectionName, entryName, value); + TryCatch(r == E_SUCCESS,, "Registry::SetValue() failed[%s]", GetErrorMessage(r)); + r = __pDefaultGalleryRegistry->Flush(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; + +CATCH: + AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +SettingPresentationModel::CreateDefaultRegistry(void) +{ + AppLogDebug("ENTER"); + result r = E_SUCCESS; + AppManager* pAppManager = AppManager::GetInstance(); + TryReturn(pAppManager != null, E_FAILURE, "Failed to get AppManager"); + String pathGalleryDefaultSetting = + pAppManager->GetAppSharedPath(GALLERY_APP_ID) + PATH_DATA_DIRECTORY + PATH_GALLERY_DEFAULT_SETTINGS; + AppLogDebug("pathGalleryDefaultSetting(%ls)", pathGalleryDefaultSetting.GetPointer()); + + __pDefaultGalleryRegistry = new (std::nothrow) Registry(); + if (File::IsFileExist(pathGalleryDefaultSetting)) + { + AppLogDebug("Already exist default settings file"); + + __pDefaultGalleryRegistry->Construct(pathGalleryDefaultSetting, "r+"); + } + else + { + AppLogDebug("Creating default settings file"); + + __pDefaultGalleryRegistry->Construct(pathGalleryDefaultSetting, "w+"); + r = __pDefaultGalleryRegistry->AddSection(SECTION_IMAGE_VIEWER); + TryCatch(r == E_SUCCESS,, "Registry::AddSection() failed[%s]", GetErrorMessage(r)); + + r = __pDefaultGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, SLIDESHOW_INTERVAL_VALUE, + DEFAULT_VALUE_INTERVAL); + TryCatch(r == E_SUCCESS,, "Registry::AddValue() failed[%s]", GetErrorMessage(r)); + + r = __pDefaultGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, TRANSITION_EFFECT_VALUE, + DEFAULT_VALUE_EFFECT_SLIDE); + TryCatch(r == E_SUCCESS,, "Registry::AddValue() failed[%s]", GetErrorMessage(r)); + + r = __pDefaultGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, REPEAT_VALUE, + DEFAULT_VALUE_REPEAT); + TryCatch(r == E_SUCCESS,, "Registry::AddValue() failed[%s]", GetErrorMessage(r)); + + r = __pDefaultGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, SHUFFLE_VALUE, + DEFAULT_VALUE_SHUFFLE); + TryCatch(r == E_SUCCESS,, "Registry::AddValue() failed[%s]", GetErrorMessage(r)); + + r = __pDefaultGalleryRegistry->Flush(); + TryCatch(r == E_SUCCESS,, "Registry::Flush() failed[%s]", GetErrorMessage(r)); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; + +CATCH: + delete __pDefaultGalleryRegistry; + __pDefaultGalleryRegistry = null; + AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +void +SettingPresentationModel::DeleteRegistry(void) +{ + if (__pDefaultGalleryRegistry != null ) + { + delete __pDefaultGalleryRegistry; + __pDefaultGalleryRegistry = null; + } +} diff --git a/src/GlSettingToggleCustomItem.cpp b/src/GlSettingToggleCustomItem.cpp new file mode 100644 index 0000000..d631b17 --- /dev/null +++ b/src/GlSettingToggleCustomItem.cpp @@ -0,0 +1,81 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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. +// + +//!Internet SettingToggleCustomItem class +/*@file: SettingToggleCustomItem.cpp + *@brief: The SettingToggleCustomItem + * + */ + +#include + +#include "GlSettingToggleCustomItem.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + +static const int IDA_FORMAT_STRING = 101; + +SettingToggleCustomItem::SettingToggleCustomItem(void) + : __width(0) + , __height(0) +{ +} + +SettingToggleCustomItem::~SettingToggleCustomItem(void) +{ +} + +result +SettingToggleCustomItem::Construct(int width, int height) +{ + result r = E_FAILURE; + + __width = width; + __height = height; + const Dimension dim(width, height); + r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_ONOFF_SLIDING); + + return r; +} + +void +SettingToggleCustomItem::SetText(const Tizen::Base::String& text) +{ + __text = text; +} + +String +SettingToggleCustomItem::GetText(void) const +{ + return __text; +} + +result +SettingToggleCustomItem::Make(int fontSize) +{ + const Color textColor = CUSTOM_COLOR_TRANSPARENT; + const Color pressedTextColor = CUSTOM_COLOR_TRANSPARENT; + const int X_Margin = 26; + const int Y_Margin = 26; + + AddElement(Rectangle(X_Margin, Y_Margin, __width - 200, __height - 2* Y_Margin), IDA_FORMAT_STRING, __text, fontSize, textColor, pressedTextColor, pressedTextColor, true); + + return E_SUCCESS; +} diff --git a/src/GlSlideShowPopUp.cpp b/src/GlSlideShowPopUp.cpp new file mode 100644 index 0000000..2a5a10e --- /dev/null +++ b/src/GlSlideShowPopUp.cpp @@ -0,0 +1,181 @@ +// +// Tizen Native SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 SlideShowPopUp.cpp + * @brief This file contains the definitions of the SlideShowPopUp class. + */ + +#include + +#include "GlResourceManager.h" +#include "GlSlideSettingListener.h" +#include "GlSlideShowPopUp.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const int ID_FORMAT_START = 501; +static const int ID_FORMAT_SETTING = 502; +static const int ID_CANCEL_BUTTON = 503; + +SlideShowPopUp::SlideShowPopUp(void) + : __pList(null) + , __pListener(null) +{ +} + +SlideShowPopUp::~SlideShowPopUp(void) +{ +} + +bool +SlideShowPopUp::Initialize(void) +{ + Button* pCancelButton = null; + Popup::Construct(L"IDL_SLIDESHOW_SETTING_POPUP"); + Popup::SetPropagatedKeyEventListener(this); + + __pList = static_cast(GetControl(L"IDC_POPUP_LIST")); + + if (__pList == null) + { + return false; + } + + __pList->SetItemProvider(*this); + __pList->AddListViewItemEventListener(*this); + + pCancelButton = static_cast(GetControl(L"IDC_BUTTON", true)); + + if (pCancelButton != null) + { + pCancelButton->AddActionEventListener(*this); + pCancelButton->SetActionId(ID_CANCEL_BUTTON); + } + + return true; +} + +result +SlideShowPopUp::OnTerminating(void) +{ + return E_SUCCESS; +} + +void +SlideShowPopUp::OnActionPerformed(const Control& source, int actionId) +{ + switch (actionId) + { + case ID_CANCEL_BUTTON: + { + Popup::SetShowState(false); + Popup::Show(); + } + break; + + default: + break; + } + return; +} + +void +SlideShowPopUp::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status) +{ + if (__pListener != null) + { + __pListener->OnSlideSettingPopUpItemSelected(index); + } +} + +bool +SlideShowPopUp::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo) +{ + AppLogDebug("ENTER"); + + if(keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC) + { + Popup::SetShowState(false); + Popup::Show(); + } + return false; +} + +ListItemBase* +SlideShowPopUp::CreateItem(int index, int itemWidth) +{ + ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; + int listItemHeight = 112; + + CustomItem* pItem = new (std::nothrow) CustomItem(); + result r = pItem->Construct(Dimension(GetClientAreaBounds().width, listItemHeight), style); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE)); + + if (IsFailed(r)) + { + AppLogDebug("Create Item Failed with error %s", GetErrorMessage(r)); + return null; + } + + switch (index) + { + case 0: + { + pItem->AddElement(Rectangle(25, 0, GetClientAreaBounds().width -50, listItemHeight), ID_FORMAT_START, + ResourceManager::GetString(L"IDS_MEDIABR_OPT_START_SLIDESHOW"), true); + } + break; + + case 1: + { + pItem->AddElement(Rectangle(25, 0, GetClientAreaBounds().width -50, listItemHeight), ID_FORMAT_SETTING, + ResourceManager::GetString(L"IDS_MEDIABR_BODY_SLIDESHOW_SETTINGS"), true); + } + break; + + break; + default: + break; + } + + return pItem; +} + +bool +SlideShowPopUp::DeleteItem(int index, ListItemBase* pItem, int itemWidth) +{ + return true; +} + +int +SlideShowPopUp::GetItemCount(void) +{ + return 2; +} + +void +SlideShowPopUp::SetEventListner(ISlideSettingListener* listner) +{ + __pListener = listner; +} diff --git a/src/GlThumbnailEvent.cpp b/src/GlThumbnailEvent.cpp new file mode 100644 index 0000000..afed0c2 --- /dev/null +++ b/src/GlThumbnailEvent.cpp @@ -0,0 +1,40 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailEvent.cpp + * @brief This is the implementation file for ThumbnailEvent class. + */ + +#include +#include "GlThumbnailEvent.h" +#include "GlThumbnailEventListener.h" + +using namespace Tizen::Base::Runtime; + +ThumbnailEvent::~ThumbnailEvent(void) +{ +} + +void +ThumbnailEvent::FireImpl(IEventListener& listener, const IEventArg& eventArg) +{ + IThumbnailEventListener* plistener = static_cast (&listener); + if (plistener != null) + { + plistener->OnThumbnailReceivedN(*(const_cast(&eventArg))); + } +} diff --git a/src/GlThumbnailEventArg.cpp b/src/GlThumbnailEventArg.cpp new file mode 100644 index 0000000..7e1f347 --- /dev/null +++ b/src/GlThumbnailEventArg.cpp @@ -0,0 +1,58 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailEventArg.cpp + * @brief This is the implementation file for ThumbnailEventArg class. + */ + +#include +#include "GlThumbnailEventArg.h" +#include "GlThumbnailInfo.h" + +using namespace std; +using namespace Tizen::Graphics; + +ThumbnailEventArg::ThumbnailEventArg(ThumbnailInfo* pThumbnailInfo) + : _pThumbnailInfo(pThumbnailInfo) +{ +} + +ThumbnailEventArg::~ThumbnailEventArg(void) +{ + if (_pThumbnailInfo != null) + { + delete _pThumbnailInfo; + } +} + +ThumbnailInfo* +ThumbnailEventArg::GetThumbnailInfoN(void) +{ + if (_pThumbnailInfo == null) + { + return null; + } + + Bitmap* pBitmap = _pThumbnailInfo->GetBitmapN(); + ThumbnailInfo* pThumbnailInfo = new (std::nothrow) ThumbnailInfo(); + pThumbnailInfo->Construct(_pThumbnailInfo->GetContentId(), _pThumbnailInfo->GetFilePath(), + *pBitmap, _pThumbnailInfo->GetContentType(), _pThumbnailInfo->GetDuration()); + + delete pBitmap; + + return pThumbnailInfo; +} diff --git a/src/GlThumbnailInfo.cpp b/src/GlThumbnailInfo.cpp new file mode 100755 index 0000000..87c3cd9 --- /dev/null +++ b/src/GlThumbnailInfo.cpp @@ -0,0 +1,140 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailInfo.cpp + * @brief This is the implementation file for ThumbnailInfo class. + */ + +#include +#include "GlThumbnailInfo.h" +#include "GlTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Content; +using namespace Tizen::Graphics; + +ThumbnailInfo::ThumbnailInfo(void) + : __pBitmap(null) + , __contentType(CONTENT_TYPE_IMAGE) + , __duration(0) +{ +} + +ThumbnailInfo::~ThumbnailInfo(void) +{ + delete __pBitmap; +} + +void +ThumbnailInfo::Construct(const ContentId& contentId, const String& filePath, + const Bitmap& bitmap, const ContentType contentType, const long duration) +{ + __contentId = contentId; + __filePath = filePath; + __pBitmap = CloneBitmapN(bitmap); + __contentType = contentType; + __duration = duration; +} + +ContentId +ThumbnailInfo::GetContentId(void) const +{ + return __contentId; +} + +String +ThumbnailInfo::GetFilePath(void) const +{ + return __filePath; +} + +void +ThumbnailInfo::SetFilePath(const String& filePath) +{ + if (&filePath == null) + { + __filePath = EMPTY_SPACE; + } + else + { + __filePath = filePath; + } +} + +Bitmap* +ThumbnailInfo::GetBitmapN(void) const +{ + return CloneBitmapN(*__pBitmap); +} + +void +ThumbnailInfo::SetBitmap(const Bitmap& bitmap) +{ + if (__pBitmap) + { + delete __pBitmap; + } + __pBitmap = CloneBitmapN(bitmap); +} + +ContentType +ThumbnailInfo::GetContentType(void) const +{ + return __contentType; +} + +void +ThumbnailInfo::SetContentType(ContentType contentType) +{ + __contentType = contentType; +} + +long +ThumbnailInfo::GetDuration(void) const +{ + return __duration; +} + +void +ThumbnailInfo::SetDuration(long duration) +{ + __duration = duration; +} + +Bitmap* +ThumbnailInfo::CloneBitmapN(const Bitmap& bitmap) const +{ + Bitmap* pResultBitmap = null; + if (&bitmap != null) + { + Rectangle mainRect(0, 0, bitmap.GetWidth(), bitmap.GetHeight()); + Canvas mainCanvas; + mainCanvas.Construct(mainRect); + mainCanvas.DrawBitmap(mainRect, bitmap); + pResultBitmap = new (std::nothrow) Bitmap(); + result r = pResultBitmap->Construct(mainCanvas, mainRect); + TryCatch(r == E_SUCCESS,, "pResultBitmap->Construct Failed:%s", GetErrorMessage(r)); + } + return pResultBitmap; + +CATCH: + delete pResultBitmap; + pResultBitmap = null; + + return null; + +} diff --git a/src/GlThumbnailJob.cpp b/src/GlThumbnailJob.cpp new file mode 100644 index 0000000..96dbccd --- /dev/null +++ b/src/GlThumbnailJob.cpp @@ -0,0 +1,70 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailJob.cpp + * @brief This is the implementation file for ThumbnailJob class. + */ + +#include +#include "GlThumbnailEvent.h" +#include "GlThumbnailJob.h" + +using namespace Tizen::Base::Runtime; +using namespace Tizen::Content; + +ThumbnailJob::ThumbnailJob(void) + : __requestId(0) + , __pRequestEvent(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT"); +} + +ThumbnailJob::~ThumbnailJob(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT"); +} + +void +ThumbnailJob::Construct(const ContentId& contentId, const unsigned long requestId, + const ThumbnailEvent* pRequestEvent) +{ + AppLogDebug("ENTER"); + __contentId = contentId; + __requestId = requestId; + __pRequestEvent = pRequestEvent; + AppLogDebug("EXIT"); +} + +ContentId +ThumbnailJob::GetContentId(void) const +{ + return __contentId; +} + +unsigned long +ThumbnailJob::GetRequestId(void) const +{ + return __requestId; +} + +const ThumbnailEvent* +ThumbnailJob::GetEvent(void) const +{ + return __pRequestEvent; +} diff --git a/src/GlThumbnailProvider.cpp b/src/GlThumbnailProvider.cpp new file mode 100644 index 0000000..3d24a20 --- /dev/null +++ b/src/GlThumbnailProvider.cpp @@ -0,0 +1,448 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlThumbnailProvider.cpp + * @brief This is the implementation file for ThumbnailProvider class. + */ + +#include +#include +#include +#include "GlResourceManager.h" +#include "GlThumbnailEvent.h" +#include "GlThumbnailEventArg.h" +#include "GlThumbnailJob.h" +#include "GlThumbnailProvider.h" +#include "GlTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; + +ThumbnailProvider* ThumbnailProvider::__pThumbnailProviderInstance = null; +ArrayList* ThumbnailProvider::__pThumbnailEventListener = null; + +ThumbnailProvider::ThumbnailProvider(void) + : __pMutexCmd(null) + , __pCmdQueue(null) + , __requestId(0) + , __isAppTerminating(false) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ThumbnailProvider::~ThumbnailProvider(void) +{ + AppLogDebug("ENTER"); + if (__pThumbnailProviderInstance != null) + { + __pThumbnailProviderInstance->Stop(); + __pThumbnailProviderInstance->Join(); + } + + if (__pThumbnailEventListener != null) + { + delete __pThumbnailEventListener; + } + + if (__pMutexCmd != null) + { + delete __pMutexCmd; + } + + if (__pCmdQueue != null) + { + delete __pCmdQueue; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ThumbnailProvider* +ThumbnailProvider::GetInstance(void) +{ + AppLogDebug("ENTER"); + if (__pThumbnailProviderInstance == null) + { + CreateInstance(); + __pThumbnailProviderInstance->Start(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __pThumbnailProviderInstance; +} + +result +ThumbnailProvider::Construct(void) +{ + AppLogDebug("ENTER"); + + __pThumbnailEventListener = new (std::nothrow) ArrayList(SingleObjectDeleter); + result r = __pThumbnailEventListener->Construct(); + TryCatch(r == E_SUCCESS,, "[%s] Unable to set event listener", GetErrorMessage(r)); + + __pMutexCmd = new (std::nothrow) Mutex(); + r = __pMutexCmd->Create(); + TryCatch(r == E_SUCCESS,, "[%s] Unable to create mutex", GetErrorMessage(r)); + + if (__pCmdQueue != null) + { + delete __pCmdQueue; + } + __pCmdQueue = new (std::nothrow) ArrayList(SingleObjectDeleter); + r = __pCmdQueue->Construct(); + TryCatch(r == E_SUCCESS,, "[%s] Unable to construct queue", GetErrorMessage(r)); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return EventDrivenThread::Construct(); + +CATCH: + if (__pThumbnailEventListener != null) + { + delete __pThumbnailEventListener; + __pThumbnailEventListener = null; + } + + if (__pMutexCmd != null) + { + delete __pMutexCmd; + __pMutexCmd = null; + } + + if (__pCmdQueue != null) + { + delete __pCmdQueue; + __pCmdQueue = null; + } + AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult())); + + return E_FAILURE; +} + +void +ThumbnailProvider::CreateInstance(void) +{ + AppLogDebug("ENTER"); + __pThumbnailProviderInstance = new (std::nothrow) ThumbnailProvider(); + result r = __pThumbnailProviderInstance->Construct(); + + if (IsFailed(r) == true) + { + delete __pThumbnailProviderInstance; + __pThumbnailProviderInstance = null; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + std::atexit(DestroyInstance); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ThumbnailProvider::DestroyInstance(void) +{ + AppLogDebug("ENTER"); + delete __pThumbnailProviderInstance; + __pThumbnailProviderInstance = null; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ThumbnailProvider::Release(void) +{ + AppLogDebug("ENTER"); + if (__pThumbnailProviderInstance != null) + { + delete __pThumbnailProviderInstance; + __pThumbnailProviderInstance = null; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ThumbnailProvider::RequestThumbnail(const ContentId& contentId, const ThumbnailEvent* event) +{ + AppLogDebug("ENTER"); + AppLogDebug("[THREAD] Request Job - (MainThread)"); + + if (contentId.ToString().IsEmpty() == true || event == null + || __pMutexCmd == null || __pCmdQueue == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + + __pMutexCmd->Acquire(); + + AppLogDebug("__pMutexCmd: %x", __pMutexCmd); + + ThumbnailJob* pThumbnailJob = new (std::nothrow) ThumbnailJob(); + AppLogDebug("pThumbnailJob: %x", pThumbnailJob); + pThumbnailJob->Construct(contentId, ++__requestId, event); + __pCmdQueue->Add(pThumbnailJob); + + __pMutexCmd->Release(); + + SendUserEvent(null, null); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ThumbnailProvider::ClearThumbnailRequests(const bool appTerminating) +{ + AppLogDebug("ENTER"); + if (__pMutexCmd != null) + { + __pMutexCmd->Acquire(); + if (__pCmdQueue != null && __pCmdQueue->GetCount() > 0) + { + __pCmdQueue->RemoveAll(true); + } + + if (appTerminating == true) + { + __isAppTerminating = true; + } + __pMutexCmd->Release(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +bool +ThumbnailProvider::OnStart(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +ThumbnailProvider::OnStop(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +ThumbnailProvider::OnUserEventReceivedN(RequestId requestId, IList* pArgs) +{ + AppLogDebug("ENTER"); + AppLogDebug("[THREAD] Receive Job Message - (SubThread)"); + ThumbnailJob* pThumbnailJob = null; + ThumbnailInfo* pThumbnailInfo = null; + ContentId contentId; + + if (__pMutexCmd == null || __pCmdQueue == null) + { + delete pArgs; + AppLogDebug("EXIT1(%s)", GetErrorMessage(GetLastResult())); + return; + } + + __pMutexCmd->Acquire(); + if (__pCmdQueue->GetCount() > 0) + { + pThumbnailJob = static_cast(__pCmdQueue->GetAt(0)); + if (pThumbnailJob == null) + { + __pCmdQueue->RemoveAt(0); + __pMutexCmd->Release(); + return; + } + + unsigned long requestId = pThumbnailJob->GetRequestId(); + ContentId contentId = pThumbnailJob->GetContentId(); + __pMutexCmd->Release(); + + pThumbnailInfo = GetThumbnailInfoN(contentId); + + __pMutexCmd->Acquire(); + pThumbnailJob = static_cast(__pCmdQueue->GetAt(0)); + + if (pThumbnailJob != null && pThumbnailInfo != null && requestId == pThumbnailJob->GetRequestId()) + { + ContentType contentType = pThumbnailInfo->GetContentType(); + if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO) + { + ThumbnailEvent* pThumbnailEvent = const_cast(pThumbnailJob->GetEvent()); + if (pThumbnailEvent != null) + { + if (__isAppTerminating != true) + { + ThumbnailEventArg* pSendingArg = new (std::nothrow)ThumbnailEventArg(pThumbnailInfo); + pThumbnailEvent->Fire(*pSendingArg); + } + } + } + else + { + delete pThumbnailInfo; + } + __pCmdQueue->RemoveAt(0, true); + } + else + { + delete pThumbnailInfo; + } + } + __pMutexCmd->Release(); + + delete pArgs; + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +ThumbnailInfo* +ThumbnailProvider::GetThumbnailInfoN(const ContentId& contentId) const +{ + AppLogDebug("ENTER"); + ThumbnailInfo* pNewThumbnailInfo = null; + + ContentManager contentManager; + result r = contentManager.Construct(); + if (r == E_SUCCESS) + { + Bitmap* pBitmap = null; + long duration = 0; + + ContentInfo* pContentInfo = contentManager.GetContentInfoN(contentId); + + if (pContentInfo != null) + { + String path = pContentInfo->GetContentPath(); + if (path.EndsWith(L"tif") != true + && path.EndsWith(L"tiff") != true + && path.EndsWith(L"wbmp") != true + && path.EndsWith(L"TIF") != true + && path.EndsWith(L"TIFF") != true + && path.EndsWith(L"WBMP") != true) + { + pBitmap = pContentInfo->GetThumbnailN(); + } + + if (pBitmap == null) + { + pBitmap = GetThumbnailByDecodeN(pContentInfo->GetContentPath(), pContentInfo->GetContentType()); + if (pBitmap == null) + { + pBitmap = ResourceManager::GetBitmapN(IDB_NO_CONTENTS_BROKEN); + } + } + pBitmap->Scale(DIMENSION_DEFAULT_THUMBNAIL); + + ContentType contentType = pContentInfo->GetContentType(); + + if (contentType == CONTENT_TYPE_VIDEO) + { + VideoContentInfo* pVideoContentInfo = static_cast(pContentInfo); + duration = pVideoContentInfo->GetDuration(); + } + + pNewThumbnailInfo = new (std::nothrow) ThumbnailInfo(); + pNewThumbnailInfo->Construct(contentId, pContentInfo->GetContentPath(), *pBitmap, contentType, duration); + delete pBitmap; + delete pContentInfo; + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pNewThumbnailInfo; +} + +Bitmap* +ThumbnailProvider::GetThumbnailByDecodeN(const String& filePath, const ContentType contentType) const +{ + AppLogDebug("ENTER"); + Bitmap* pBitmap = null; + if (&filePath == null || filePath.GetLength() <= 0) + { + pBitmap = new (std::nothrow) Bitmap(); + pBitmap->Construct(DIMENSION_DEFAULT_THUMBNAIL, BITMAP_PIXEL_FORMAT_RGB565); + } + else + { + if (contentType == CONTENT_TYPE_IMAGE) + { + ImageBuffer pImageBuffer; + result r = pImageBuffer.Construct(filePath); + if (r == E_SUCCESS) + { + pBitmap = pImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_AUTO); + } + } + else if (contentType == CONTENT_TYPE_VIDEO) + { + VideoFrameExtractor extractor; + result r = extractor.Construct(filePath, MEDIA_PIXEL_FORMAT_RGB565LE); + if (r == E_SUCCESS) + { + ImageBuffer* pImageBuffer = extractor.GetFrameN(0); + if (pImageBuffer != null) + { + pBitmap = pImageBuffer->GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO); + delete pImageBuffer; + } + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pBitmap; +} + +String +ThumbnailProvider::GetFileNameFromFullPath(const String& fullPath, bool withExt) const +{ + AppLogDebug("ENTER"); + if (fullPath.CompareTo(EMPTY_SPACE) == 0) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return EMPTY_SPACE; + } + + String delim(DIRECTORY_SEPARATOR); + StringTokenizer st(fullPath,delim); + String token; + while (st.HasMoreTokens()) + { + st.GetNextToken(token); + } + + if (withExt == true) + { + AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + + return token; + } + else + { + String subDelim(FILE_EXT_SEPARATOR); + StringTokenizer subSt(token, subDelim); + String subToken; + subSt.GetNextToken(subToken); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return subToken; + } +} diff --git a/src/GlTimerBase.cpp b/src/GlTimerBase.cpp new file mode 100644 index 0000000..26db9e1 --- /dev/null +++ b/src/GlTimerBase.cpp @@ -0,0 +1,364 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlTimerBase.cpp + * @brief This is the source file for GlTimerBase class. + */ + +#include +#include + +#include "GlAlbumListPresentationModel.h" +#include "GlContentUpdateEventListener.h" +#include "GlFileListPresentationModel.h" +#include "GlProgressBar.h" +#include "GlTimerBase.h" +#include "GlTypes.h" + +using namespace Tizen::Ui; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Ui::Controls; + +GlTimerBase::GlTimerBase(IFileOpInvalidateListener* invalidateListener, enum FileActionMode actionId) + : _actionId(actionId) + , __pContentIdList(null) + , __moveToCount(0) + , __pMoveProBar(null) + , __pInvalidate(invalidateListener) + , __isStarted(false) + , __timerRes(CANCEL_BY_USER) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +GlTimerBase::~GlTimerBase(void) +{ + AppLogDebug("ENTER"); + __pInvalidate = null; + AlbumListPresentationModel::GetInstance()->RemoveTimerScanListener(); + FileListPresentationModel::GetInstance()->StopAnimation(); + AlbumListPresentationModel::GetInstance()->StopAnimation(); + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + pContentListener->ReSetTimerActive(); + + if (__pContentIdList != null && __pContentIdList->GetCount() > 0 && __isStarted) + { + __moveTimer.Cancel(); + __isStarted = false; + } + delete __pContentIdList; + if (__pMoveProBar) + { + __pMoveProBar->HideFileProgressingPopup(); + delete __pMoveProBar; + } + AppLogDebug("EXIT"); +} + +bool +GlTimerBase::StartTimer(void) +{ + AppLogDebug("ENTER"); + __pContentIdList = TimerStart(); + if (__pContentIdList != null && __pContentIdList->GetCount() > 0) + { + AppLogDebug("Starting timer"); + __pMoveProBar = new (std::nothrow) GlProgressBar(static_cast(this), + static_cast(this)); + __pMoveProBar->ShowFileProgressingPopup(__pContentIdList->GetCount(), _actionId); + __moveToCount = 0; + __moveTimer.Construct(*this); + __moveTimer.Start(60); + __isStarted = true; + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + pContentListener->SetTimerActive(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + return E_SUCCESS; + } + AppLogDebug("EXIT1(%s)", GetErrorMessage(GetLastResult())); + return E_FAILURE; +} + +void +GlTimerBase::CancelTimer(void) +{ + AppLogDebug("ENTER"); + __moveTimer.Cancel(); + __pMoveProBar->HideFileProgressingPopup(); + int scanCount = GetDirScanCount(); + if (scanCount > 0) + { + AlbumListPresentationModel::GetInstance()->AddTimerScanListener(this, scanCount); + ScanDirectories(); + __pInvalidate->OnScanDirStart(); + FileListPresentationModel::GetInstance()->ShowAnimation(); + AlbumListPresentationModel::GetInstance()->ShowAnimation(); + } + else + { + OnOpCancelled(CANCEL_USER); + } + __isStarted = false; + __moveToCount = 0; + __timerRes = CANCEL_BY_USER; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GlTimerBase::OnTimerScanDirComplete() +{ + AppLogDebug("OnTimerScanDirComplete ENTER"); + + AlbumListPresentationModel::GetInstance()->RemoveTimerScanListener(); + FileListPresentationModel::GetInstance()->StopAnimation(); + AlbumListPresentationModel::GetInstance()->StopAnimation(); + __pInvalidate->OnScanDirComplete(); + switch(__timerRes) + { + case CANCEL_SYS: + AppLogDebug("CANCEL_SYS"); + OnOpCancelled(CANCEL_SYS_ERROR); + break; + case CANCEL_BY_USER: + AppLogDebug("CANCEL_BY_USER"); + OnOpCancelled(CANCEL_USER); + break; + case TIMER_COMPLETE: + AppLogDebug("TIMER_COMPLETE"); + OnOpComplete(COMPLETE_SUCCESS); + break; + default: + break; + } + AppLogDebug("ENTER"); +} + +void +GlTimerBase::OnTimerExpired(Timer& timer) +{ + AppLogDebug("ENTER"); + if (&timer == &__moveTimer) + { + AppLogDebug("__pContentIdList count is %d", __pContentIdList->GetCount()); + if (__moveToCount < __pContentIdList->GetCount()) + { + AppLogDebug("__pContentIdList count is %d", __pContentIdList->GetCount()); + if (__pContentIdList->GetAt(__moveToCount) != null) + { + result r = TimerExpired(__pContentIdList->GetAt(__moveToCount)); + if (IsFailed(r)) + { + if (r == E_STORAGE_FULL || r == E_IO) + { + __moveTimer.Cancel(); + __isStarted = false; + __timerRes = CANCEL_SYS; + __pMoveProBar->HideFileProgressingPopup(); + int scanCount = GetDirScanCount(); + if ( scanCount > 0) + { + AlbumListPresentationModel::GetInstance()->AddTimerScanListener(this, scanCount); + ScanDirectories(); + __pInvalidate->OnScanDirStart(); + FileListPresentationModel::GetInstance()->ShowAnimation(); + AlbumListPresentationModel::GetInstance()->ShowAnimation(); + } + else + { + MessageBox messageBox; + messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), + MSGBOX_STYLE_NONE, 3000); + int modalResult; + messageBox.ShowAndWait(modalResult); + OnOpCancelled(CANCEL_SYS_ERROR); + } + AppLogDebug("OnTimerExpired EXIT(%s)", GetErrorMessage(r)); + return; + } + //If the errors are file not found etc, skip this file and move to next. + } + } + ++__moveToCount; + __pMoveProBar->IncProgress(__moveToCount); + if (__pInvalidate) + { + __pInvalidate->OnFileOpInvalidate(_actionId); + } + __moveTimer.Start(1); + __isStarted = true; + } + else + { + __moveTimer.Cancel(); + __pMoveProBar->HideFileProgressingPopup(); + int scanCount = GetDirScanCount(); + if (scanCount == 0) + { + __moveToCount = 0; + __isStarted = false; + __timerRes = TIMER_COMPLETE; + OnOpComplete(COMPLETE_SUCCESS); + return; + } + AlbumListPresentationModel::GetInstance()->AddTimerScanListener(this, scanCount); + ScanDirectories(); + __pInvalidate->OnScanDirStart(); + FileListPresentationModel::GetInstance()->ShowAnimation(); + AlbumListPresentationModel::GetInstance()->ShowAnimation(); + __isStarted = false; + __timerRes = TIMER_COMPLETE; + __moveToCount = 0; + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +GlTimerBase::OnActionPerformed(const Control& source, int actionId) +{ + AppLogDebug("ENTER"); + switch (actionId) + { + case IDA_PROGRESSBAR_CANCEL: + { + CancelTimer(); + } + break; + + default: + break; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +GlTimerBase::GetMovedCount() const +{ + return __moveToCount; +} + +void +GlTimerBase::OnOpCancelled(enum FileActionCancelRes res) +{ + AppLogDebug("ENTER"); + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + pContentListener->ReSetTimerActive(); + if (__pInvalidate) + { + __pInvalidate->OnFileOpInvalidate(_actionId); + } + if (__moveToCount > 0) + { + if (__pInvalidate) + { + if (res != CANCEL_USER) + { + __pInvalidate->OnFileOpComplete(_actionId, COMPLETE_SYS_PARTIAL); + } + else + { + __pInvalidate->OnFileOpComplete(_actionId, COMPLETE_SUCCESS); + } + } + } + else + { + if (__pInvalidate) + { + if (res != CANCEL_USER) + { + __pInvalidate->OnFileOpComplete(_actionId, COMPLETE_SYS_FAILURE); + } + else + { + __pInvalidate->OnFileOpComplete(_actionId, COMPLETE_SUCCESS); + } + } + } + TimerCancel(__moveToCount, res); + AppLogDebug("EXIT"); +} + +void +GlTimerBase::OnOpComplete(enum FileActionCompleteRes res) +{ + AppLogDebug("ENTER"); + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + pContentListener->ReSetTimerActive(); + if (__pInvalidate) + { + __pInvalidate->OnFileOpInvalidate(_actionId); + __pInvalidate->OnFileOpComplete(_actionId, res); + } + TimerComplete(__moveToCount, res); + AppLogDebug("EXIT"); +} + +void +GlTimerBase::SetActionMode(const enum FileActionMode actionId) +{ + AppLogDebug("ENTER"); + _actionId = actionId; + AppLogDebug("EXIT"); +} + +bool +GlTimerBase::IsStarted(void) +{ + AppLogDebug("ENTER"); + return __isStarted; +} + +void +GlTimerBase::Cancel(void) +{ + AppLogDebug("ENTER"); + if (__isStarted) + { + __pMoveProBar->HideFileProgressingPopup(); + __moveTimer.Cancel(); + __isStarted = false; + + int scanCount = GetDirScanCount(); + if (scanCount > 0) + { + AlbumListPresentationModel::GetInstance()->AddTimerScanListener(this, scanCount); + ScanDirectories(); + __pInvalidate->OnScanDirStart(); + FileListPresentationModel::GetInstance()->ShowAnimation(); + AlbumListPresentationModel::GetInstance()->ShowAnimation(); + } + else + { + OnOpCancelled(CANCEL_SYS_ERROR); + } + } + AppLogDebug("EXIT"); +} + +bool +GlTimerBase::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo) +{ + AppLogDebug("ENTER"); + + if(keyEventInfo.GetKeyCode() == KEY_BACK) + { + CancelTimer(); + } + return true; +} diff --git a/src/GlTypes.cpp b/src/GlTypes.cpp new file mode 100644 index 0000000..3f4e631 --- /dev/null +++ b/src/GlTypes.cpp @@ -0,0 +1,218 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlTypes.cpp + * @brief This is the implementation file for Types definition + */ + +#include +#include "GlTypes.h" + +using namespace Tizen::Graphics; + +const wchar_t* IDL_FORM_ALBUM_LIST = L"IDL_FORM_ALBUM_LIST"; +const wchar_t* IDL_FORM_ALBUM_LIST_EDITOR = L"IDL_FORM_ALBUM_LIST_EDITOR"; +const wchar_t* IDL_FORM_FILE_LIST = L"IDL_FORM_FILE_LIST"; +const wchar_t* IDL_FORM_SETTING_MAIN = L"IDL_FORM_SETTING_MAIN"; +const wchar_t* IDL_FORM_SETTING_INTERVAL = L"IDL_FORM_SETTING_INTERVAL"; +const wchar_t* IDL_FORM_SETTING_TRANSITION = L"IDL_FORM_SETTING_TRANSITION"; +const wchar_t* IDL_FORM_IMAGE_CROP = L"IDL_FORM_IMAGE_CROP"; + +const wchar_t* IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED = L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"; + +const wchar_t* IDC_FORM_ALBUM_LIST = L"AlbumListForm"; +const wchar_t* IDC_FORM_ALBUM_LIST_EDITOR = L"AlbumListEditorForm"; +const wchar_t* IDC_FORM_ALBUM_NAME_EDITOR = L"AlbumNameEditorForm"; +const wchar_t* IDC_FORM_FILE_LIST = L"FileListForm"; +const wchar_t* IDC_FORM_FILE_LIST_EDITOR = L"FileListEditorForm"; +const wchar_t* IDC_FORM_SETTING_MAIN = L"SettingMainForm"; +const wchar_t* IDC_FORM_SETTING_INTERVAL = L"SettingIntervalForm"; +const wchar_t* IDC_FORM_SETTING_TRANSITION = L"SettingTransitionForm"; +const wchar_t* IDC_FORM_IMAGE_CROP = L"ImageCropForm"; + +const wchar_t* IDC_PANEL_BLANK = L""; +const wchar_t* IDC_PANEL_ALL_LIST = L"AllListPanel"; +const wchar_t* IDC_PANEL_IMAGE_LIST = L"ImageListPanel"; +const wchar_t* IDC_PANEL_VIDEO_LIST = L"VideoListPanel"; +const wchar_t* IDC_PANEL_ALL_LIST_EDITOR = L"AllListEditorPanel"; +const wchar_t* IDC_PANEL_IMAGE_LIST_EDITOR = L"ImageListEditorPanel"; +const wchar_t* IDC_PANEL_VIDEO_LIST_EDITOR = L"VideoListEditorPanel"; +const wchar_t* IDC_PANEL_ALL_LIST_SELECTION = L"AllListSelectionPanel"; + +const wchar_t* IDSCN_ALBUM_LIST = L"SceneAlbumList"; +const wchar_t* IDSCN_ALBUM_LIST_EDITOR = L"SceneAlbumListEditor"; +const wchar_t* IDSCN_ALBUM_NAME_EDITOR = L"SceneAlbumNameEditor"; +const wchar_t* IDSCN_ALL_LIST = L"SceneFileAllList"; +const wchar_t* IDSCN_IMAGE_LIST = L"SceneFileImageList"; +const wchar_t* IDSCN_VIDEO_LIST = L"SceneFileVideoList"; +const wchar_t* IDSCN_ALL_LIST_EDITOR = L"SceneFileAllListEditor"; +const wchar_t* IDSCN_IMAGE_LIST_EDITOR = L"SceneFileImageListEditor"; +const wchar_t* IDSCN_VIDEO_LIST_EDITOR = L"SceneFileVideoListEditor"; +const wchar_t* IDSCN_ALL_LIST_SELECTION = L"SceneFileAllListSelection"; +const wchar_t* IDSCN_SETTING_MAIN = L"SceneMainSetting"; +const wchar_t* IDSCN_SETTING_INTERVAL = L"SceneInvervalSetting"; +const wchar_t* IDSCN_SETTING_TRANSITION = L"SceneTransitionSetting"; +const wchar_t* IDSCN_IMAGE_CROP = L"SceneImageCrop"; + +const wchar_t* APPCONTROL_PROVIDER_ID_CAMERA = L"tizen.camera"; +const wchar_t* APPCONTROL_PROVIDER_ID_MESSAGE = L"tizen.messages"; +const wchar_t* APPCONTROL_PROVIDER_ID_EMAIL = L"tizen.email"; +const wchar_t* APPCONTROL_PROVIDER_ID_IMAGE = L"tizen.imageviewer"; + +const wchar_t* APPCONTROL_OPERATION_ID_PICK = L"http://tizen.org/appcontrol/operation/pick"; +const wchar_t* APPCONTROL_OPERATION_ID_VIEW = L"http://tizen.org/appcontrol/operation/view"; +const wchar_t* APPCONTROL_OPERATION_ID_CREATE_CONTENT = L"http://tizen.org/appcontrol/operation/create_content"; +const wchar_t* APPCONTROL_OPERATION_ID_COMPOSE = L"http://tizen.org/appcontrol/operation/compose"; +const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE = L"http://tizen.org/appcontrol/operation/configure"; +const wchar_t* APPCONTROL_OPERATION_ID_MAIN = L"http://tizen.org/appcontrol/operation/main"; + +const wchar_t* APPCONTROL_KEY_TYPE = L"http://tizen.org/appcontrol/data/type"; +const wchar_t* APPCONTROL_KEY_PATH = L"http://tizen.org/appcontrol/data/path"; +const wchar_t* APPCONTROL_KEY_INDEX = L"http://tizen.org/appcontrol/data/index"; +const wchar_t* APPCONTROL_KEY_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode"; +const wchar_t* APPCONTROL_KEY_DATA_SELECTED = L"http://tizen.org/appcontrol/data/selected"; +const wchar_t* APPCONTROL_KEY_MESSAGE_TYPE = L"http://tizen.org/appcontrol/data/message/type"; +const wchar_t* APPCONTROL_KEY_CAMERA_ALLOW_SWITCH = L"http://tizen.org/appcontrol/data/camera/allow_switch"; +const wchar_t* APPCONTROL_KEY_IMAGEVIEWER_MODE = L"http://tizen.org/appcontrol/data/image/crop_mode"; + +const wchar_t* APPCONTROL_URI_MMS_TO = L"mmsto"; +const wchar_t* APPCONTROL_URI_MAIL_TO = L"mailto"; + +const wchar_t* APPCONTROL_MIME_IMAGE_JPG = L"image/jpg"; +const wchar_t* APPCONTROL_MIME_IMAGE_ALL = L"image/*"; + +const wchar_t* APPCONTROL_DATA_IMAGE = L"image"; +const wchar_t* APPCONTROL_DATA_VIDEO = L"video"; +const wchar_t* APPCONTROL_DATA_SINGLE = L"single"; +const wchar_t* APPCONTROL_DATA_MULTIPLE = L"multiple"; +const wchar_t* APPCONTROL_DATA_SLIDE_SHOW = L"slideshow"; +const wchar_t* APPCONTROL_DATA_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection/mode"; +const wchar_t* APPCONTROL_DATA_TRUE = L"true"; +const wchar_t* APPCONTROL_DATA_MMS = L"mms"; +const wchar_t* APPCONTROL_DATA_CROP_TYPE_AUTO = L"auto"; +const wchar_t* APPCONTROL_DATA_CROP_TYPE_FIT_TO_SCREEN = L"fit_to_screen"; + +const wchar_t* APPCONTROL_RESULT_KEY_LEGACY_RESULT = L"http://tizen.org/appcontrol/data/legacyresult"; + +const wchar_t* SETTING_KEY_LANGUAGE = L"http://tizen.org/setting/locale.language"; +const wchar_t* SETTING_KEY_FONT_SIZE = L"http://tizen.org/setting/font.size"; + +const Dimension DIMENSION_DEFAULT_THUMBNAIL = Dimension(171,127); +const int FOLDER_BITMAP_MAX = 7; + +const wchar_t* EMPTY_SPACE = L""; +const wchar_t* SINGLE_SPACE = L" "; + +const wchar_t* DIRECTORY_SEPARATOR = L"/"; +const wchar_t* FILE_EXT_SEPARATOR = L"."; +const wchar_t* MULTI_ITEM_SEPARATOR = L";"; + +const wchar_t* CONTENT_EXT_PNG = L".png"; +const wchar_t* CONTENT_EXT_BMP = L".bmp"; +const wchar_t* CONTENT_EXT_JPG = L".jpg"; +const wchar_t* CONTENT_EXT_GIF = L".gif"; +const wchar_t* CONTENT_EXT_TIF = L".tif"; +const wchar_t* CONTENT_EXT_MP4 = L".mp4"; +const wchar_t* CONTENT_EXT_3GP = L".3gp"; +const wchar_t* CONTENT_EXT_AVI = L".avi"; +const wchar_t* CONTENT_EXT_RM = L".rm"; +const wchar_t* CONTENT_EXT_WMV = L".wmv"; +const wchar_t* CONTENT_EXT_ASF = L".asf"; + +const wchar_t* SECTION_NAME_GALLERY = L"GALLRY_SETTING"; +const wchar_t* SECTION_NAME_IMAGE_VIEWER = L"IMAGE_VIEWER_SETTING"; +const wchar_t* SECTION_NAME_VIDEO_PLAYER = L"VIDEO_PLAYER_SETTING"; +const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL = L"SLIDESHOW_INTERVAL_VALUE"; +const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT = L"TRANSITION_EFFECT_VALUE"; +const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_MUSIC = L"MUSIC_VALUE"; +const wchar_t* ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE = L"REPEAT_VALUE"; +const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE = L"SHUFFLE_VALUE"; + +const wchar_t* ALL_ALBUMS_REAL_NAME = L"asdqwezxc%%^^@@$$**"; + +const wchar_t* FONT_SIZE_SETTING_INFO_KEY = L"http://tizen.org/setting/font.size"; + +const wchar_t* IDB_BUTTON_CIRCLE_BACKGROUND = L"T01_button_circle_bg_normal.png"; +const wchar_t* IDB_BUTTON_RENAME = L"T01_button_rename.png"; +const wchar_t* IDB_CONTROLBAR_CAMERA = L"T01_controlbar_icon_camera.png"; +const wchar_t* IDB_CONTROLBAR_DELETE = L"T01_controlbar_icon_delete.png"; +const wchar_t* IDB_CONTROLBAR_DELETE_DIM = L"T01_toolbar_icon_delete_dim_web.png"; +const wchar_t* IDB_CONTROLBAR_MORE = L"T01_controlbar_icon_more.png"; +const wchar_t* IDB_CONTROLBAR_MORE_DISABLED = L"00_icon_more_dim.png"; +const wchar_t* IDB_CONTROLBAR_MORE_PRESSED = L"00_icon_more_press.png"; +const wchar_t* IDB_CONTROLBAR_SHARE = L"T01_controlbar_icon_share02.png"; +const wchar_t* IDB_CONTROLBAR_SHARE_DIM = L"T01_toolbar_icon_share_dim_web.png"; +const wchar_t* IDB_LISTVIEW_EMPTY = L"T01_Nocontents_picture.png"; +const wchar_t* IDB_MAIN_FOLDER_BACKGROUND = L"T01_main_folder_bg.png"; +const wchar_t* IDB_VIDEOTHUMBNAIL_BG = L"T01_places_thumbnail_bg.png"; +const wchar_t* IDB_VIDEOTHUMBNAIL_BOOKMARK = L"T01_icon_thumbnail_bookmark.png"; +const wchar_t* IDB_VIDEOTHUMBNAIL_FAVORITE = L"T01_icon_thumbnail_favorite.png"; +const wchar_t* IDB_VIDEOTHUMBNAIL_PLAY = L"T01_btn_play.png"; +const wchar_t* IDB_BUTTON_MOVE_SELECTION = L"T01_button_reveal.png"; +const wchar_t* IDB_NO_CONTENTS_BROKEN = L"T01_Nocontents_broken.png"; +const wchar_t* IDB_LIST_EXPAND_CLOSED = L"00_list_expand_closed.png"; +const wchar_t* IDB_LIST_EXPAND_CLOSED_PRESS = L"00_list_expand_closed_press.png"; +const wchar_t* IDB_LIST_EXPAND_OPENED = L"00_list_expand_opened.png"; +const wchar_t* IDB_LIST_EXPAND_OPENED_PRESS = L"00_list_expand_opened_press.png"; +const wchar_t* IDB_ICON_SELECT_ALL = L"00_icon_select_all_web.png"; +const wchar_t* IDB_ICON_SELECT_ALL_PRESS = L"00_icon_select_all_press_web.png"; + +const wchar_t* DEVICE_STORAGE_CARD_MOUNTED = L"Mounted"; +const wchar_t* DEVICE_STORAGE_CARD_UNMOUNTED = L"Unmounted"; +const wchar_t* IDB_ALBUM_EDIT_RENAME_BG = L"T01_album_edit_rename_bg.png"; +const wchar_t* IDB_ALBUM_EDIT_RENAME = L"T01_album_edit_rename.png"; +const wchar_t* IDB_ALBUM_ICON_FOLDER = L"T01_album_icon_folder.png"; +const wchar_t* IDB_ALBUM_ICON_DOWNLOAD = L"T01_album_icon_download.png"; +const wchar_t* IDB_ALBUM_ICON_CAMERA = L"T01_album_icon_camera.png"; + +const wchar_t* IDB_ALBUM_RENAME_PROGRESS1 = L"00_list_process_01.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS2 = L"00_list_process_02.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS3 = L"00_list_process_03.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS4 = L"00_list_process_04.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS5 = L"00_list_process_05.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS6 = L"00_list_process_06.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS7 = L"00_list_process_07.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS8 = L"00_list_process_08.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS9 = L"00_list_process_09.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS10 = L"00_list_process_10.png"; + +const wchar_t* IDB_ALBUM_RENAME_PROGRESS11 = L"00_list_process_11.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS12 = L"00_list_process_12.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS13 = L"00_list_process_13.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS14 = L"00_list_process_14.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS15 = L"00_list_process_15.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS16 = L"00_list_process_16.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS17 = L"00_list_process_17.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS18 = L"00_list_process_18.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS19 = L"00_list_process_19.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS20 = L"00_list_process_20.png"; + +const wchar_t* IDB_ALBUM_RENAME_PROGRESS21 = L"00_list_process_21.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS22 = L"00_list_process_22.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS23 = L"00_list_process_23.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS24 = L"00_list_process_24.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS25 = L"00_list_process_25.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS26 = L"00_list_process_26.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS27 = L"00_list_process_27.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS28 = L"00_list_process_28.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS29 = L"00_list_process_29.png"; +const wchar_t* IDB_ALBUM_RENAME_PROGRESS30 = L"00_list_process_30.png"; + +const wchar_t* IDB_IMAGE_CONTEXT_EMAIL_ICON = L"T01_1_face_tag_icon_email.png"; +const wchar_t* IDB_IMAGE_CONTEXT_MESSAGE_ICON = L"T01_1_face_tag_icon_message.png"; + +const wchar_t* IDB_IMAGE_CROP_RECTANGLE = L"T01-1_crop_rectangle.png"; diff --git a/src/GlVideoListEditorPanel.cpp b/src/GlVideoListEditorPanel.cpp new file mode 100644 index 0000000..3b08f4c --- /dev/null +++ b/src/GlVideoListEditorPanel.cpp @@ -0,0 +1,787 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlVideoListEditorPanel.cpp + * @brief This is the implementation file for VideoListEditorPanel class. + */ + +#include +#include +#include "GlAlbumInfo.h" +#include "GlCommonUtil.h" +#include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" +#include "GlResourceManager.h" +#include "GlTypes.h" +#include "GlVideoListEditorPanel.h" +#include "GlFileListEditorForm.h" +#include "GlFileUpdateTimer.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value; +static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value; +static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK)); +static const Rectangle RECT_VIDEO_THUMBNAIL(16, 16, 172, 128); +static const Rectangle RECT_INITIAL(0, 0, 10, 10); + +static const int H_SELECTALL_REGION = 112; +static const int ALPHA_THUMBNAIL_DIM = 70; +static const int H_COUNT_LABEL = 48; +static const int COUNT_LABEL_FONT_SIZE = 33; +static const int LENGTH_COUNT_LABEL = 256; +static const int W_CLIENT_REGION = 720; +static const int H_VIDEO_ITEM = 160; +static const int GAP_W_VIDEO_TITLE = 16+172+16; +static const int GAP_H_VIDEO_TITLE = 22; +static const int W_VIDEO_TITLE = (16+172+16)+(16+64+16); +static const int H_VIDEO_TITLE = 64; +static const int FONT_SIZE_TITLE = 36; +static const int GAP_W_VIDEO_DURATION = 16+172+16; +static const int GAP_H_VIDEO_DURATION = 22+64; +static const int W_VIDEO_DURATION = (16+172+16)+(16+64+16); +static const int H_VIDEO_DURATION = 48; +static const int FONT_SIZE_DURATION = 32; + +VideoListEditorPanel::VideoListEditorPanel(void) + : __pContentIconListView(null) + , __pCheckButton(null) + , __pLabelSelectCnt(null) + , __itemCount(0) + , __pPresentationModel(null) + , __pFileDelete(null) + , __pFileListEditorForm(null) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +VideoListEditorPanel::~VideoListEditorPanel(void) +{ + AppLogDebug("ENTER"); + delete __pFileDelete; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +VideoListEditorPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(RECT_INITIAL); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +VideoListEditorPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + __itemCount = 0; + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + clientAreaBounds.x = clientAreaBounds.y = 0; + SetBounds(clientAreaBounds); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + __pContentIconListView = new (std::nothrow) ListView(); + + if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE) + { + __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height), true, false); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->AddListViewItemEventListener(*this); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __pLabelSelectCnt = new (std::nothrow) Label(); + __pLabelSelectCnt->Construct(Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL, + clientAreaBounds.width, H_COUNT_LABEL), ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED")); + __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL); + __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT)); + __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD); + AddControl(__pLabelSelectCnt); + } + else + { + __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, + clientAreaBounds.height), true, false); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->AddListViewItemEventListener(*this); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + } + } + else + { + __pContentIconListView = new (std::nothrow) ListView(); + __pContentIconListView->Construct( + Rectangle(0, H_SELECTALL_REGION, W_CLIENT_REGION, clientAreaBounds.height - H_SELECTALL_REGION), + true, false); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentIconListView->SetItemProvider(*this); + __pContentIconListView->AddListViewItemEventListener(*this); + AddControl(__pContentIconListView); + __pContentIconListView->SetShowState(true); + + __pLabelSelectCnt = new (std::nothrow) Label(); + __pLabelSelectCnt->Construct( + Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), + ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED")); + __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL); + __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT)); + __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD); + AddControl(__pLabelSelectCnt); + + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +VideoListEditorPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemovePresentationModelListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +int +VideoListEditorPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +ListItemBase* +VideoListEditorPanel::CreateItem(int index, int itemWidth) +{ + AppLogDebug("ENTER : index(%d)", index); + CustomItem* pItem = new (std::nothrow) CustomItem(); + + Bitmap* pBitmap = null; + String* pItemText = null; + String* pTitle = null; + String* pDuration = null; + + result r = __pPresentationModel->GetThumbnailVideoInSyncCacheN(index, pItemText, pBitmap, pDuration); + if (pBitmap == null || r == E_FAILURE) + { + __pPresentationModel->RequestThumbnail(index); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + if (pItemText == null) + { + pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + pTitle = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + + if (pDuration == null) + { + pDuration = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE")); + } + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE) + { + pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_MARK); + + if (__pContentIconListView->IsItemChecked(index) == true) + { + if (pBitmap != null) + { + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + + Color dimColor(COLOR_THUMBNAIL_DIM); + dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM); + + Canvas canvas; + canvas.Construct(bufferInfo); + canvas.FillRectangle(dimColor, canvas.GetBounds()); + + Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap(); + pSelectedBitmap->Construct(canvas, canvas.GetBounds()); + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap, pSelectedBitmap); + delete pSelectedBitmap; + } + else + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete pTitle; + delete pItemText; + delete pDuration; + return null; + } + } + else + { + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap); + } + + if (pTitle == null) + { + pTitle = new (std::nothrow) String(SINGLE_SPACE); + } + else if (pTitle->IsEmpty() == true) + { + delete pTitle; + pTitle = new (std::nothrow) String(SINGLE_SPACE); + } + + Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE); + pItem->AddElement(titleRect, IDA_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE, + Color::GetColor(COLOR_ID_BLACK),null,null,false); + + Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION, + H_VIDEO_DURATION); + pItem->AddElement(durationRect, IDA_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION, + Color::GetColor(COLOR_ID_GREY),null,null,false); + } + else + { + pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_NORMAL); + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap); + + if (pTitle == null) + { + pTitle = new (std::nothrow) String(SINGLE_SPACE); + } + else if (pTitle->IsEmpty() == true) + { + delete pTitle; + pTitle = new (std::nothrow) String(SINGLE_SPACE); + } + + Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE); + pItem->AddElement(titleRect, IDA_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE, + Color::GetColor(COLOR_ID_BLACK), null, null, false); + + Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION, + H_VIDEO_DURATION); + pItem->AddElement(durationRect, IDA_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION, + Color::GetColor(COLOR_ID_GREY), null, null, false); + } + } + else + { + pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_MARK); + if (__pContentIconListView->IsItemChecked(index) == true) + { + if (pBitmap != null) + { + BufferInfo bufferInfo; + pBitmap->Lock(bufferInfo, INFINITE); + pBitmap->Unlock(); + Color dimColor(COLOR_THUMBNAIL_DIM); + dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM); + + Canvas canvas; + canvas.Construct(bufferInfo); + canvas.FillRectangle(dimColor, canvas.GetBounds()); + + Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap(); + pSelectedBitmap->Construct(canvas, canvas.GetBounds()); + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap, pSelectedBitmap); + delete pSelectedBitmap; + } + else + { + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap); + } + } + else + { + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap); + } + + if (pTitle == null) + { + pTitle = new (std::nothrow) String(SINGLE_SPACE); + } + else if (pTitle->IsEmpty() == true) + { + delete pTitle; + pTitle = new (std::nothrow) String(SINGLE_SPACE); + } + + Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE); + pItem->AddElement(titleRect, IDA_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE, + Color::GetColor(COLOR_ID_BLACK), null, null, false); + + Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth - W_VIDEO_DURATION, + H_VIDEO_DURATION); + pItem->AddElement(durationRect, IDA_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION, + Color::GetColor(COLOR_ID_GREY), null, null, false); + } + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + if (pTitle != null) + { + delete pTitle; + } + if (pDuration != null) + { + delete pDuration; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pItem; +} + +bool +VideoListEditorPanel::DeleteItem(int index, ListItemBase* pItem, int itemWidth) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +VideoListEditorPanel::OnListViewItemStateChanged(ListView& listView, int index, int elementId, + ListItemStatus status) +{ + AppLogDebug("ENTER"); + + if (status == LIST_ITEM_STATUS_CHECKED || status == LIST_ITEM_STATUS_UNCHECKED) + { + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE) + { + int checkedCount = GetItemCheckedCount(); + String strTmp; + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + else + { + int checkedCount = GetItemCheckedCount(); + String strTmp; + if (checkedCount == 0) + { + strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + else if (checkedCount == 1) + { + strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED"); + } + else + { + strTmp.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount); + } + + __pLabelSelectCnt->SetText(strTmp); + __pLabelSelectCnt->RequestRedraw(true); + if (__pCheckButton->IsSelected()) + { + __pCheckButton->SetSelected(false); + } + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + + if ( __pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK + && __pPresentationModel->GetAppControlSelectionMode() != APPCONTROL_SELECTION_MODE_MULTIPLE) + { + if (status == LIST_ITEM_STATUS_SELECTED) + { + HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter); + result r = pMap->Construct(); + if (r == E_SUCCESS) + { + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + pArrayList->Construct(); + + if (r == E_SUCCESS) + { + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index))); + pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList); + + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap); + pApp->Terminate(); + } + else + { + delete pMap; + } + } + } + else + { + delete pMap; + } + } + } + SetButtonState(); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListEditorPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if (contentType == CONTENT_TYPE_VIDEO) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_VIDEO); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListEditorPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + if (index >= 0) + { + __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + __pFileListEditorForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) + { + if (currentSceneId == IDSCN_VIDEO_LIST_EDITOR) + { + if (previousSceneId == IDSCN_ALBUM_LIST) + { + AlbumInfo* pAlbumInfo = static_cast(pArgs->GetAt(0)); + if (pAlbumInfo == null) + { + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + + return; + } + + IList* pDirectoryList = pAlbumInfo->GetDirectoryListN(); + __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList); + + if (pDirectoryList != null) + { + delete pDirectoryList; + } + delete pArgs; + + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->UpdateList(); + } + } + } + else + { + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentIconListView->RequestRedraw(true); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId, + const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +int +VideoListEditorPanel::GetItemCheckedCount(void) const +{ + AppLogDebug("ENTER"); + int count = 0; + if (__pContentIconListView != null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + ++count; + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return count; +} + +IList* +VideoListEditorPanel::GetItemCheckedIndexListN(void) const +{ + AppLogDebug("ENTER"); + IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); + Integer* pIndex = null; + + if (__pContentIconListView != null) + { + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + for (int i = 0; i < loopCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i)) + { + pIndex = new (std::nothrow) Integer(i); + pList->Add(pIndex); + } + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pList; +} + +void +VideoListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + FileListEditorForm* pFileListEditorForm = + dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.", + GetErrorMessage(GetLastResult())); + pFileListEditorForm->Invalidate(true); +} + +void +VideoListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void) +{ + AppLogDebug("ENTER"); + IList* pIndexList = GetItemCheckedIndexListN(); + + if (pIndexList->GetCount() <= 0) + { + delete pIndexList; + AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + return; + } + + HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter); + result r = pMap->Construct(); + + if (r == E_SUCCESS) + { + ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); + r = pArrayList->Construct(); + + if (r == E_SUCCESS) + { + Integer* pTemp = null; + int loopCount = pIndexList->GetCount(); + + for (int i = 0; i < loopCount; ++i) + { + pTemp = static_cast(pIndexList->GetAt(i)); + pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(pTemp->ToInt()))); + } + + pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList); + + GalleryApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (pApp != null) + { + pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap); + pApp->Terminate(); + } + else + { + delete pMap; + } + } + else + { + delete pMap; + delete pArrayList; + } + } + else + { + delete pMap; + } + + delete pIndexList; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListEditorPanel::OnSelectAllPressed(void) +{ + bool needToSelectAll = true; + int checkedCount = GetItemCheckedCount(); + int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + if (checkedCount == totalFileCount) + { + needToSelectAll = false; + } + + if (needToSelectAll == true) + { + for (int i = 0; i < totalFileCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == false) + { + __pContentIconListView->SetItemChecked(i, true); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + __pFileListEditorForm->SetFooterButtonsState(true); + } + } + else + { + for (int i = 0; i < totalFileCount; ++i) + { + if (__pContentIconListView->IsItemChecked(i) == true) + { + __pContentIconListView->SetItemChecked(i, false); + __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + __pFileListEditorForm->SetFooterButtonsState(false); + } + } + + String tempString; + if (needToSelectAll == true) + { + tempString.Format(LENGTH_COUNT_LABEL, + ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount); + } + else + { + tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"); + } + + __pLabelSelectCnt->SetText(tempString); + __pLabelSelectCnt->RequestRedraw(true); +} + +void +VideoListEditorPanel::SetButtonState(void) +{ + AppLogDebug("ENTER"); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult())); + + if (GetItemCheckedCount() > 0) + { + __pFileListEditorForm->SetFooterButtonsState(true); + } + else + { + __pFileListEditorForm->SetFooterButtonsState(false); + } + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListEditorPanel::ChangeOrientation(void) +{ + AppLogDebug("ENTER"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + const Form* pForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height); + __pContentIconListView->SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height); +} diff --git a/src/GlVideoListPanel.cpp b/src/GlVideoListPanel.cpp new file mode 100644 index 0000000..cb29cab --- /dev/null +++ b/src/GlVideoListPanel.cpp @@ -0,0 +1,271 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (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 GlVideoListPanel.cpp + * @brief This is the implementation file for VideoListPanel class. + */ + +#include +#include +#include "GlAlbumInfo.h" +#include "GlCommonUtil.h" +#include "GlFileListForm.h" +#include "GlFileListPresentationModel.h" +#include "GlTypes.h" +#include "GlVideoListPanel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const int H_VIDEO_ITEM = 160; +static const int GAP_W_VIDEO_TITLE = 16+172+16; +static const int GAP_H_VIDEO_TITLE = 22; +static const int W_VIDEO_TITLE = (16+172+16)+(16+64+16); +static const int H_VIDEO_TITLE = 64; +static const int FONT_SIZE_TITLE = 36; +static const int GAP_W_VIDEO_DURATION = 16+172+16; +static const int GAP_H_VIDEO_DURATION = 22+64; +static const int W_VIDEO_DURATION = (16+172+16)+(16+64+16); +static const int H_VIDEO_DURATION = 48; +static const int FONT_SIZE_DURATION = 32; +static const int W_CLIENT_REGION = 720; +static const Rectangle RECT_INITIAL (0, 0, 10, 10); +static const Rectangle RECT_VIDEO_THUMBNAIL (16, 16, 172, 128); + +VideoListPanel::VideoListPanel(void) + : __itemCount(0) + , __pContentListView(null) + , __pPresentationModel(0) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +VideoListPanel::~VideoListPanel(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +result +VideoListPanel::Initialize(void) +{ + AppLogDebug("ENTER"); + result r = Construct(RECT_INITIAL); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return r; +} + +result +VideoListPanel::OnInitializing(void) +{ + AppLogDebug("ENTER"); + const Form* pForm = dynamic_cast(GetParent()); + TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult())); + + __pPresentationModel = FileListPresentationModel::GetInstance(); + __pPresentationModel->ClearThumbnailRequests(); + __pPresentationModel->AddPresentationModelListener(this); + + Rectangle clientAreaBounds = pForm->GetClientAreaBounds(); + clientAreaBounds.x = clientAreaBounds.y = 0; + SetBounds(clientAreaBounds); + __pContentListView = new (std::nothrow) ListView(); + __pContentListView->Construct(Rectangle(0, 0, W_CLIENT_REGION, clientAreaBounds.height), true, false); + Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY); + if (pBitmapEmpty != null) + { + __pContentListView->SetBitmapOfEmptyList(pBitmapEmpty); + delete pBitmapEmpty; + } + __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS")); + __pContentListView->SetItemProvider(*this); + __pContentListView->AddListViewItemEventListener(*this); + AddControl(__pContentListView); + __pContentListView->SetShowState(true); + __itemCount = 0; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +result +VideoListPanel::OnTerminating(void) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemovePresentationModelListener(*this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return E_SUCCESS; +} + +int +VideoListPanel::GetItemCount(void) +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return __itemCount; +} + +ListItemBase* +VideoListPanel::CreateItem(int index, int itemWidth) +{ + AppLogDebug("ENTER : index(%d)", index); + CustomItem* pItem = new (std::nothrow) CustomItem(); + pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_NORMAL); + + Bitmap* pBitmap = null; + String* pItemText = null; + String* pTitle = null; + String* pDuration = null; + + result r = __pPresentationModel->GetThumbnailVideoInSyncCacheN(index, pItemText, pBitmap, pDuration); + if (pBitmap == null || r == E_FAILURE) + { + __pPresentationModel->RequestThumbnail(index); + pBitmap = CommonUtil::GetEmptyThumbnailN(); + } + + pItem->AddElement(RECT_VIDEO_THUMBNAIL, IDA_FORMAT_THUMBNAIL, *pBitmap); + pTitle = new (std::nothrow) String(SINGLE_SPACE); + Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE); + pItem->AddElement(titleRect, IDA_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE, + Color::GetColor(COLOR_ID_BLACK), null, null, false); + + Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION, + H_VIDEO_DURATION); + pItem->AddElement(durationRect, IDA_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION, + Color::GetColor(COLOR_ID_GREY), null, null, false); + + if (pBitmap != null) + { + delete pBitmap; + } + if (pItemText != null) + { + delete pItemText; + } + if (pTitle != null) + { + delete pTitle; + } + if (pDuration != null) + { + delete pDuration; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return pItem; +} + +bool +VideoListPanel::DeleteItem(int index, ListItemBase* pItem, int itemWidth) +{ + AppLogDebug("ENTER"); + delete pItem; + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return true; +} + +void +VideoListPanel::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status) +{ + AppLogDebug("ENTER"); + if (status == LIST_ITEM_STATUS_SELECTED) + { + IList* pList = new (std::nothrow) ArrayList(); + int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + + for (int i = 0; i < loopCount; ++i) + { + pList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i))); + } + String listIndex; + listIndex.Format(10, L"%d", index); + + const String mimeType = APPCONTROL_MIME_IMAGE_ALL; + HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); + pDataList->Construct(); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_IMAGE)); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pList); + pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_INDEX), new (std::nothrow) String(listIndex)); + + __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, + &mimeType, pDataList, null); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListPanel::OnFileInfoChanged(const ContentType contentType) +{ + AppLogDebug("ENTER"); + if (contentType == CONTENT_TYPE_VIDEO) + { + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentListView->UpdateList(); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListPanel::OnThumbnailDecoded(const int index) +{ + AppLogDebug("ENTER : index(%d)", index); + if (index >= 0) + { + __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +VideoListPanel::OnSceneActivatedN(const SceneId& previousSceneId, + const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + __pPresentationModel = FileListPresentationModel::GetInstance(); + + if (currentSceneId == IDSCN_VIDEO_LIST) + { + __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_VIDEO); + __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); + __pContentListView->UpdateList(); + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST) + { + FileListForm* pFileListForm = dynamic_cast(pSceneManager->GetCurrentScene()->GetForm()); + if (pFileListForm != null) + { + pFileListForm->SetTitleText(__pPresentationModel->GetCurrentAlbumName()); + } + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +}