Applied latest source code
[apps/native/preloaded/MusicPlayer.git] / src / MpAlbumPickerPanel.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                MpAlbumPickerPanel.cpp
19  * @brief               This is the implementation file for AlbumPickerPanel class.
20  */
21
22 #include "MpAlbumPickerPanel.h"
23 #include "MpNowPlayContentPanel.h"
24
25 using namespace Tizen::Base;
26 using namespace Tizen::Base::Collection;
27 using namespace Tizen::Content;
28 using namespace Tizen::Graphics;
29 using namespace Tizen::Social;
30 using namespace Tizen::Ui;
31 using namespace Tizen::Ui::Controls;
32 using namespace Tizen::Ui::Scenes;
33
34 AlbumPickerPanel::AlbumPickerPanel(void)
35 {
36         AppLogDebug("ENTER");
37         AppLogDebug("EXIT");
38 }
39
40 AlbumPickerPanel::~AlbumPickerPanel(void)
41 {
42         AppLogDebug("ENTER");
43         AppLogDebug("EXIT");
44 }
45
46 void
47 AlbumPickerPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
48                                                 const Tizen::Ui::Scenes::SceneId& currentSceneId,
49                                                 Tizen::Base::Collection::IList* pArgs)
50 {
51         AppLogDebug("ENTER");
52         Form* pForm = dynamic_cast<Form*>(GetParent());
53         AppAssert(pForm);
54
55         SceneManager* pSceneManager = SceneManager::GetInstance();
56         AppAssert(pSceneManager);
57
58         CommonUtil::CreateCancelFooter(*pForm);
59         pForm->SetFormBackEventListener(this);
60         __pPresentationModel->UpdateAlbumList();
61
62         if (pArgs != null)
63         {
64                 pArgs->RemoveAll(true);
65                 delete pArgs;
66         }
67         AppLogDebug("EXIT");
68 }
69
70 void
71 AlbumPickerPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
72                                                 const Tizen::Ui::Scenes::SceneId& nextSceneId)
73 {
74         AppLogDebug("ENTER");
75         Form* pForm = dynamic_cast<Form*>(GetParent());
76         AppAssert(pForm);
77
78         Footer* pFooter = pForm->GetFooter();
79         if (pFooter != null)
80         {
81                 pFooter->RemoveAllButtons();
82                 pFooter->RemoveAllItems();
83         }
84         AppLogDebug("EXIT");
85 }
86
87 void
88 AlbumPickerPanel::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView,
89                                                         int itemIndex,
90                                                         Tizen::Ui::Controls::TableViewItem* pItem,
91                                                         Tizen::Ui::Controls::TableViewItemStatus status)
92 {
93         AppLogDebug("ENTER");
94         SceneManager* pSceneManager = SceneManager::GetInstance();
95         AppAssert(pSceneManager);
96
97         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
98         {
99                 __pPresentationModel->InitializeContentList(itemIndex);
100                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_CONTENT_PICKER));
101         }
102         AppLogDebug("EXIT");
103 }