From 8242e17da96db5bd4c222e21edb7602995d4ca37 Mon Sep 17 00:00:00 2001 From: chitta ranjan Date: Wed, 3 Apr 2013 17:20:25 +0900 Subject: [PATCH] SlideShow menu implementation Change-Id: I0f9715e5bfe126c9cf7796d25e2af3bf8b161d08 Signed-off-by: chitta ranjan --- inc/GlFileListEditorForm.h | 6 + inc/GlFileListForm.h | 7 + inc/GlSlideSettingListener.h | 37 +++++ inc/GlSlideShowPopUp.h | 93 +++++++++++ .../IDL_SLIDESHOW_SETTING_POPUP.xml | 22 +++ src/GlDropDownCustomItem.cpp | 4 - src/GlFileListEditorForm.cpp | 71 +++++++-- src/GlFileListForm.cpp | 64 ++++++-- src/GlRadioCustomItem.cpp | 3 - src/GlSettingMainForm.cpp | 7 +- src/GlSettingToggleCustomItem.cpp | 1 - src/GlSlideShowPopUp.cpp | 177 +++++++++++++++++++++ 12 files changed, 457 insertions(+), 35 deletions(-) create mode 100644 inc/GlSlideSettingListener.h create mode 100644 inc/GlSlideShowPopUp.h create mode 100644 res/screen-size-normal/IDL_SLIDESHOW_SETTING_POPUP.xml create mode 100644 src/GlSlideShowPopUp.cpp diff --git a/inc/GlFileListEditorForm.h b/inc/GlFileListEditorForm.h index 37eb7e9..2424e7f 100644 --- a/inc/GlFileListEditorForm.h +++ b/inc/GlFileListEditorForm.h @@ -28,9 +28,12 @@ #include #include "GlBaseForm.h" #include "GlFileMoveTimer.h" +#include "GlSlideShowPopUp.h" +#include "GlSlideSettingListener.h" class FileListPresentationModel; class FileMoveTimer; +class ISlideSettingListener; class FileListEditorForm : public BaseForm @@ -38,6 +41,7 @@ class FileListEditorForm , public Tizen::Ui::Controls::IFormBackEventListener , public IFileOpInvalidateListener , public IFormContentUpdateEventListener + , public ISlideSettingListener { public: FileListEditorForm(void); @@ -62,6 +66,7 @@ public: void OnFileOpInvalidate(enum FileActionMode __actionId); void OnFileOpComplete(enum FileActionMode __actionId, enum FileActionCompleteRes); + virtual void OnSlideSettingPopUpItemSelected(int index); private: result InitializeFooter(void); Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath)const; @@ -77,6 +82,7 @@ private: Tizen::Graphics::Point __morePosition; Tizen::Base::Collection::IList* __pContentDirectoryList; Tizen::Base::Collection::IList* __pContentDirectoryNameList; + SlideShowPopUp* __pPopUp; FileListPresentationModel* __pPresentationModel; FileMoveTimer* __pFileMove; }; diff --git a/inc/GlFileListForm.h b/inc/GlFileListForm.h index 6c16b8e..e6cd941 100644 --- a/inc/GlFileListForm.h +++ b/inc/GlFileListForm.h @@ -28,14 +28,18 @@ #include #include "GlBaseForm.h" #include "GlFormContentUpdateEventListener.h" +#include "GlSlideShowPopUp.h" +#include "GlSlideSettingListener.h" class FileListPresentationModel; +class ISlideSettingListener; class FileListForm : public BaseForm , public Tizen::Ui::IActionEventListener , public Tizen::Ui::Controls::IFormBackEventListener , public IFormContentUpdateEventListener + , public ISlideSettingListener { public: FileListForm(void); @@ -52,11 +56,14 @@ public: void SetTitleText(const Tizen::Base::String& titleText); + virtual void OnSlideSettingPopUpItemSelected(int index); + private: result InitializeFooter(void); private: Tizen::Ui::Controls::ContextMenu* __pContextMenuMore; + SlideShowPopUp* __pPopUp; FileListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlSlideSettingListener.h b/inc/GlSlideSettingListener.h new file mode 100644 index 0000000..b390ad9 --- /dev/null +++ b/inc/GlSlideSettingListener.h @@ -0,0 +1,37 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file ISlideSettingListener.h + * @brief This is the header file for ISlideSettingListener class. + */ + +#ifndef _GL_SLIDE_SETTING_LISTENER_H_ +#define _GL_SLIDE_SETTING_LISTENER_H_ + +#include + + +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..a05dc3c --- /dev/null +++ b/inc/GlSlideShowPopUp.h @@ -0,0 +1,93 @@ +// +// Tizen Native SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.tizenopensource.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 +#include +#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: + /** + * @brief The Default Constructor + */ + SlideShowPopUp(void); + + /** + * @brief The Default Destructor + */ + ~SlideShowPopUp(void); + + /** + * @brief Initializes this SettingForm Form. + * + * @return An error code + * @exception true The method is succeIOrientationEventListenerssful. + * @exception false An error Occured. + */ + bool Initialize(void); + + /** + * This function terminates all the controls + * + * @return result type + * @param No parameter + */ + virtual result OnTerminating(void); + + public: + + //IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + virtual int GetItemCount(void); + + //IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IListViewItemEventListener + 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){}; + + void SetEventListner(ISlideSettingListener* listner); + + private: + Tizen::Ui::Controls::ListView* __pList; + ISlideSettingListener* __pListener; + }; + + +#endif /* _GL_SLIDE_SHOW_POPUP_H_ */ 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..10b144b --- /dev/null +++ b/res/screen-size-normal/IDL_SLIDESHOW_SETTING_POPUP.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/src/GlDropDownCustomItem.cpp b/src/GlDropDownCustomItem.cpp index 0935023..d43e014 100644 --- a/src/GlDropDownCustomItem.cpp +++ b/src/GlDropDownCustomItem.cpp @@ -111,10 +111,6 @@ DropDownCustomItem::Make() delete pDropperBitmapPressed; } - SetElementSelectionEnabled(IDA_FORMAT_MAIN_STRING, true); - SetElementSelectionEnabled(IDA_FORMAT_SUB_STRING, true); - SetElementSelectionEnabled(IDA_FORMAT_DROPPER, true); - return E_SUCCESS; } diff --git a/src/GlFileListEditorForm.cpp b/src/GlFileListEditorForm.cpp index 73ccd0d..0a20719 100644 --- a/src/GlFileListEditorForm.cpp +++ b/src/GlFileListEditorForm.cpp @@ -26,6 +26,7 @@ #include "GlGalleryApp.h" #include "GlImageListEditorPanel.h" #include "GlResourceManager.h" +#include "GlSlideSettingListener.h" #include "GlTypes.h" #include "GlVideoListEditorPanel.h" #include "GlFileMoveTimer.h" @@ -101,6 +102,15 @@ FileListEditorForm::OnInitializing(void) Header* pHeader = GetHeader(); TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult())); + __pPopUp = new (std::nothrow) SlideShowPopUp(); + + if (__pPopUp != null) + { + __pPopUp->Initialize(); + __pPopUp->SetEventListner(this); + AddControl(*__pPopUp); + } + __pPresentationModel = FileListPresentationModel::GetInstance(); __pPresentationModel->ClearThumbnailRequests(); __pPresentationModel->AddContentEventListener(this); @@ -488,21 +498,10 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId) } case ACTION_ID_CONTEXT_MENU_MORE_SLIDE_SHOW: { - 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) + if (__pPopUp != null) { - AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); - if (pSelectionPanel != null) - { - pSelectionPanel->OnRequestSlideShow(); - } + __pPopUp->SetShowState(true); + __pPopUp->Show(); } break; @@ -1052,3 +1051,47 @@ FileListEditorForm::SelectAllPressed(void) } } } + +void +FileListEditorForm::OnSlideSettingPopUpItemSelected(int index) +{ + + if ( __pPopUp != NULL) + { + __pPopUp->SetShowState(false); + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (index == 0) // start slide show + { + 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) // go to settingsForm + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN)); + + } +} + diff --git a/src/GlFileListForm.cpp b/src/GlFileListForm.cpp index 327e6db..e2cbac3 100644 --- a/src/GlFileListForm.cpp +++ b/src/GlFileListForm.cpp @@ -24,6 +24,7 @@ #include "GlFileListForm.h" #include "GlFileListPresentationModel.h" #include "GlResourceManager.h" +#include "GlSlideSettingListener.h" #include "GlTypes.h" using namespace Tizen::App; @@ -70,6 +71,16 @@ FileListForm::OnInitializing(void) __pPresentationModel->ClearThumbnailRequests(); __pPresentationModel->AddContentEventListener(this); + + __pPopUp = new (std::nothrow) SlideShowPopUp(); + + if (__pPopUp != null) + { + __pPopUp->Initialize(); + __pPopUp->SetEventListner(this); + AddControl(*__pPopUp); + } + InitializeFooter(); SetFormBackEventListener(this); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); @@ -152,22 +163,13 @@ FileListForm::OnActionPerformed(const Control& source, int actionId) } case ACTION_ID_FOOTER_SLIDESHOW: { - ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter); - pArrayList->Construct(); - int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount(); - for (int i = 0; i < loopCount; ++i) + if (__pPopUp != null) { - pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i))); + __pPopUp->SetShowState(true); + __pPopUp->Show(); } - 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); - - __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null, - pDataList, null); break; } case ACTION_ID_FOOTER_CAMERA: @@ -268,3 +270,41 @@ FileListForm::SetTitleText(const String& titleText) pHeader->Show(); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } + +void +FileListForm::OnSlideSettingPopUpItemSelected(int index) +{ + + if ( __pPopUp != NULL) + { + __pPopUp->SetShowState(false); + } + + if (index == 0) // start slide show + { + 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))); + } + + 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); + + __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW,null, pDataList, null); + + } + else if (index == 1) // go to settingsForm + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult())); + + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN)); + + } +} diff --git a/src/GlRadioCustomItem.cpp b/src/GlRadioCustomItem.cpp index 096ec7e..99569c6 100644 --- a/src/GlRadioCustomItem.cpp +++ b/src/GlRadioCustomItem.cpp @@ -99,9 +99,6 @@ RadioCustomItem::Make(void) } TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r)); - r = SetElementSelectionEnabled(IDA_FORMAT_STRING, true); - TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r)); - CATCH: return r; } diff --git a/src/GlSettingMainForm.cpp b/src/GlSettingMainForm.cpp index b1410bd..647a026 100644 --- a/src/GlSettingMainForm.cpp +++ b/src/GlSettingMainForm.cpp @@ -135,8 +135,13 @@ SettingMainForm::OnFormBackRequested(Form& source) if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_CONFIGURE) { pApp->SendAppControlResult(APP_CTRL_RESULT_TERMINATED, null); + pApp->Terminate(); + } + else + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + pSceneManager->GoBackward(BackwardSceneTransition()); } - pApp->Terminate(); } AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); diff --git a/src/GlSettingToggleCustomItem.cpp b/src/GlSettingToggleCustomItem.cpp index 6cf93d0..79d7590 100644 --- a/src/GlSettingToggleCustomItem.cpp +++ b/src/GlSettingToggleCustomItem.cpp @@ -77,7 +77,6 @@ SettingToggleCustomItem::Make(void) const int textSize = 40; AddElement(Rectangle(X_Margin, Y_Margin, __width - 60, 60), IDA_FORMAT_STRING, __text, textSize, textColor, pressedTextColor, pressedTextColor, true); - SetElementSelectionEnabled(IDA_FORMAT_STRING, false); return E_SUCCESS; } diff --git a/src/GlSlideShowPopUp.cpp b/src/GlSlideShowPopUp.cpp new file mode 100644 index 0000000..e196778 --- /dev/null +++ b/src/GlSlideShowPopUp.cpp @@ -0,0 +1,177 @@ +// +// Tizen Native SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.tizenopensource.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 + +#include "GlResourceManager.h" +#include "GlSlideShowPopUp.h" +#include "GlSlideSettingListener.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) +{ + +} + +SlideShowPopUp::~SlideShowPopUp(void) +{ + +} + +bool +SlideShowPopUp::Initialize(void) +{ + Button* pCancelButton = null; + Popup::Construct(L"IDL_SLIDESHOW_SETTING_POPUP"); + + __pList = static_cast(GetControl(L"IDC_POPUP_LIST")); + + if (__pList == null) + { + return false; + } + + __pList->SetItemProvider(*this); + __pList->AddListViewItemEventListener(*this); + + pCancelButton = static_cast< Button* >(GetControl(L"IDC_BUTTON", true)); + + if (pCancelButton != null) + { + pCancelButton->AddActionEventListener(*this); + pCancelButton->SetActionId(ID_CANCEL_BUTTON); + } + + return true; + +} + +result +SlideShowPopUp::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +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); + } + +} + +ListItemBase* +SlideShowPopUp::CreateItem(int index, int itemWidth) +{ + result r = E_FAILURE; + ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; + int listItemHeight = 112; + + CustomItem* pItem = new (std::nothrow) CustomItem(); + 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(0, 0, GetClientAreaBounds().width, listItemHeight), ID_FORMAT_START, + ResourceManager::GetString(L"IDS_MEDIABR_OPT_START_SLIDESHOW"), true); + } + break; + + case 1: + { + pItem->AddElement(Rectangle(0, 0, GetClientAreaBounds().width, 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; +} + -- 2.7.4