Applied latest source code
[apps/native/preloaded/MusicPlayer.git] / src / MpFormFactory.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                MpFormFactory.cpp
19  * @brief               This is the implementation file for FormFactory class.
20  */
21
22 #include "MpFormFactory.h"
23
24 using namespace Tizen::Ui::Scenes;
25
26 const wchar_t* IDC_PLAYER_FORM = L"PlayForm";
27 const wchar_t* IDC_MUSIC_SETTING_FORM = L"SettingForm";
28 const wchar_t* IDC_SEARCH_FORM = L"Search";
29 const wchar_t* IDC_CONTENT_FORM = L"ContentForm";
30 const wchar_t* IDC_CONTENT_PICKER_FORM = L"ContentPickerForm";
31 const wchar_t* IDC_CONTENT_EDIT_FORM = L"ContentEditForm";
32 const wchar_t* IDC_ALBUM_CONTENT_LIST_FORM = L"AlbumContentListForm";
33 const wchar_t* IDC_ARTIST_CONTENT_LIST_FORM = L"ArtistContentListForm";
34 const wchar_t* IDC_GENRE_CONTENT_LIST_FORM = L"GenreContentListForm";
35 const wchar_t* IDC_COMPOSER_CONTENT_LIST_FORM = L"ComposerContentListForm";
36 const wchar_t* IDC_YEAR_CONTENT_LIST_FORM = L"YearContentListForm";
37 const wchar_t* IDC_FOLDER_CONTENT_LIST_FORM = L"FolderContentListForm";
38 const wchar_t* IDC_PLAYLIST_CONTENT_LIST_FORM = L"PlayListContentListForm";
39 const wchar_t* IDC_PLAYLIST_CREATOR_FORM = L"PlaylistCreatorForm";
40 const wchar_t* IDC_PLAYLIST_RENAME_FORM = L"PlaylistReNameForm";
41 const wchar_t* IDC_USER_PLAYLIST_CONTENT_LIST_FORM = L"UserPlaylistContentListForm";
42 const wchar_t* IDC_CONTENT_DETAIL_FORM = L"ContentDetailForm";
43 const wchar_t* IDC_ARTIST_ALBUM_LIST_FORM = L"ArtistAlbumListForm";
44 const wchar_t* IDC_ARTIST_ALBUM_LIST_SEARCH_FORM = L"ArtistAlbumListSearchForm";
45 const wchar_t* IDC_ARTIST_ALBUM_LIST_EDIT_FORM = L"ArtistAlbumListEditorForm";
46 const wchar_t* IDC_ARTIST_ALL_SONG_LIST_FORM = L"ArtistAllSongListForm";
47
48 FormFactory::FormFactory(void)
49 {
50         AppLogDebug("ENTER");
51         AppLogDebug("EXIT");
52 }
53
54 FormFactory::~FormFactory(void)
55 {
56         AppLogDebug("ENTER");
57         AppLogDebug("EXIT");
58 }
59
60 Tizen::Ui::Controls::Form*
61 FormFactory::CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId)
62 {
63         AppLogDebug("ENTER");
64         Tizen::Ui::Controls::Form* pNewForm = null;
65         SceneManager* pSceneManager = SceneManager::GetInstance();
66         AppAssert(pSceneManager);
67
68         if (formId == IDC_PLAYER_FORM)
69         {
70                 PlayerForm* pForm = new (std::nothrow) PlayerForm();
71                 if (pForm == null)
72                 {
73                         AppLogDebug("EXIT");
74                         return null;
75                 }
76                 pForm->Initialize();
77                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
78                 pNewForm = pForm;
79         }
80         else if (formId == IDC_MUSIC_SETTING_FORM)
81         {
82                 SettingForm* pForm = new (std::nothrow) SettingForm();
83                 if (pForm == null)
84                 {
85                         AppLogDebug("EXIT");
86                         return null;
87                 }
88                 pForm->Initialize();
89                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
90                 pNewForm = pForm;
91         }
92         else if (formId == IDC_CONTENT_FORM)
93         {
94                 ContentForm* pForm = new (std::nothrow) ContentForm();
95                 if (pForm == null)
96                 {
97                         AppLogDebug("EXIT");
98                         return null;
99                 }
100                 pForm->Initialize();
101                 pNewForm = pForm;
102         }
103         else if (formId == IDC_CONTENT_PICKER_FORM)
104         {
105                 ContentForm* pForm = new (std::nothrow) ContentForm();
106                 if (pForm == null)
107                 {
108                         AppLogDebug("EXIT");
109                         return null;
110                 }
111                 pForm->Initialize();
112                 pNewForm = pForm;
113         }
114         else if (formId == IDC_SEARCH_FORM)
115         {
116                 SearchForm* pForm = new (std::nothrow) SearchForm();
117                 if (pForm == null)
118                 {
119                         AppLogDebug("EXIT");
120                         return null;
121                 }
122                 pForm->Initialize();
123                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
124                 pNewForm = pForm;
125         }
126         else if (formId == IDC_ALBUM_CONTENT_LIST_FORM)
127         {
128                 AlbumContentListForm* pForm = new (std::nothrow) AlbumContentListForm();
129                 if (pForm == null)
130                 {
131                         AppLogDebug("EXIT");
132                         return null;
133                 }
134                 pForm->Initialize();
135                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
136                 pNewForm = pForm;
137         }
138         else if (formId == IDC_ARTIST_CONTENT_LIST_FORM)
139         {
140                 ArtistContentListForm* pForm = new (std::nothrow) ArtistContentListForm();
141                 if (pForm == null)
142                 {
143                         AppLogDebug("EXIT");
144                         return null;
145                 }
146                 pForm->Initialize();
147                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
148                 pNewForm = pForm;
149         }
150 //      else if (formId == IDC_GENRE_CONTENT_LIST_FORM)
151 //      {
152 //              GenreContentListForm* pForm = new (std::nothrow) GenreContentListForm();
153 //              if (pForm == null)
154 //              {
155 //                      AppLogDebug("EXIT");
156 //                      return null;
157 //              }
158 //              pForm->Initialize();
159 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
160 //              pNewForm = pForm;
161 //      }
162 //      else if (formId == IDC_COMPOSER_CONTENT_LIST_FORM)
163 //      {
164 //              ComposerContentListForm* pForm = new (std::nothrow) ComposerContentListForm();
165 //              if (pForm == null)
166 //              {
167 //                      AppLogDebug("EXIT");
168 //                      return null;
169 //              }
170 //              pForm->Initialize();
171 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
172 //              pNewForm = pForm;
173 //      }
174 //      else if (formId == IDC_YEAR_CONTENT_LIST_FORM)
175 //      {
176 //              YearContentListForm* pForm = new (std::nothrow) YearContentListForm();
177 //              if (pForm == null)
178 //              {
179 //                      AppLogDebug("EXIT");
180 //                      return null;
181 //              }
182 //              pForm->Initialize();
183 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
184 //              pNewForm = pForm;
185 //      }
186         else if (formId == IDC_FOLDER_CONTENT_LIST_FORM)
187         {
188                 FolderContentListForm* pForm = new (std::nothrow) FolderContentListForm();
189                 if (pForm == null)
190                 {
191                         AppLogDebug("EXIT");
192                         return null;
193                 }
194                 pForm->Initialize();
195                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
196                 pNewForm = pForm;
197         }
198         else if (formId == IDC_PLAYLIST_CONTENT_LIST_FORM)
199         {
200                 PlaylistContentListForm* pForm = new (std::nothrow) PlaylistContentListForm();
201                 if (pForm == null)
202                 {
203                         AppLogDebug("EXIT");
204                         return null;
205                 }
206                 pForm->Initialize();
207                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
208                 pNewForm = pForm;
209         }
210         else if (formId == IDC_PLAYLIST_CREATOR_FORM)
211         {
212                 PlaylistCreatorForm* pForm = new (std::nothrow) PlaylistCreatorForm();
213                 if (pForm == null)
214                 {
215                         AppLogDebug("EXIT");
216                         return null;
217                 }
218                 pForm->Initialize();
219                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
220                 pNewForm = pForm;
221         }
222         else if (formId == IDC_PLAYLIST_RENAME_FORM)
223         {
224                 PlaylistReNameForm* pForm = new (std::nothrow) PlaylistReNameForm();
225                 if (pForm == null)
226                 {
227                         AppLogDebug("EXIT");
228                         return null;
229                 }
230                 pForm->Initialize();
231                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
232                 pNewForm = pForm;
233         }
234         else if (formId == IDC_CONTENT_DETAIL_FORM)
235         {
236                 ContentDetailForm* pForm = new (std::nothrow) ContentDetailForm();
237                 if (pForm == null)
238                 {
239                         AppLogDebug("EXIT");
240                         return null;
241                 }
242                 pForm->Initialize();
243                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
244                 pNewForm = pForm;
245         }
246 //      else if (formId == IDC_ARTIST_ALBUM_LIST_FORM)
247 //      {
248 //              ArtistAlbumListForm* pForm = new (std::nothrow) ArtistAlbumListForm();
249 //              if (pForm == null)
250 //              {
251 //                      AppLogDebug("EXIT");
252 //                      return null;
253 //              }
254 //              pForm->Initialize();
255 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
256 //              pNewForm = pForm;
257 //      }
258 //      else if (formId == IDC_ARTIST_ALBUM_LIST_SEARCH_FORM)
259 //      {
260 //              ArtistAlbumListForm* pForm = new (std::nothrow) ArtistAlbumListForm();
261 //              if (pForm == null)
262 //              {
263 //                      AppLogDebug("EXIT");
264 //                      return null;
265 //              }
266 //              pForm->Initialize();
267 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
268 //              pNewForm = pForm;
269 //      }
270 //      else if (formId == IDC_ARTIST_ALBUM_LIST_EDIT_FORM)
271 //      {
272 //              ArtistAlbumListEditorForm* pForm = new (std::nothrow) ArtistAlbumListEditorForm();
273 //              if (pForm == null)
274 //              {
275 //                      AppLogDebug("EXIT");
276 //                      return null;
277 //              }
278 //              pForm->Initialize();
279 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
280 //              pNewForm = pForm;
281 //      }
282 //      else if (formId == IDC_ARTIST_ALL_SONG_LIST_FORM)
283 //      {
284 //              ArtistAllSongListForm* pForm = new (std::nothrow) ArtistAllSongListForm();
285 //              if (pForm == null)
286 //              {
287 //                      AppLogDebug("EXIT");
288 //                      return null;
289 //              }
290 //              pForm->Initialize();
291 //              pSceneManager->AddSceneEventListener(sceneId, *pForm);
292 //              pNewForm = pForm;
293 //      }
294         else if (formId == IDC_USER_PLAYLIST_CONTENT_LIST_FORM)
295         {
296                 UserPlaylistContentListForm* pForm = new (std::nothrow) UserPlaylistContentListForm();
297                 if (pForm == null)
298                 {
299                         AppLogDebug("EXIT");
300                         return null;
301                 }
302                 pForm->Initialize();
303                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
304                 pNewForm = pForm;
305         }
306         AppLogDebug("EXIT");
307         return pNewForm;
308 }