protected:
virtual void t_HandleItemSelect(SCatItemInfo *itinfo);
virtual bool t_GetMediaList(Eina_List **list);
- virtual EContextType t_ContextType(void) { return CONTEXT_TYPE_PLAYLIST; }
+ virtual EContextType t_ContextType(void) { return CONTEXT_TYPE_ARTIST; }
virtual ECategoryType t_CategoryType(void) { return CAT_TYPE_ARTIST; }
public:
};
struct SContentInfo {
- enum EContextType type;
- enum EPlayStatus status;
+ EContextType type;
+ EPlayStatus status;
void (*update)(void *data, enum EActionType type, int id);
void (*close)(void *data);
if (!m->ctxtinfo || !m->ctxtinfo->context)
return;
- if (type == ACTION_TYPE_ADDNEXT)
+ m->mhandle->MediaGetList(LIST_TYPE_ALBUM_SONG,
+ m->ctxtinfo->context, &list);
+
+ switch (type) {
+ case ACTION_TYPE_PLAY:
+ mode = ADD_TYPE_FRESH;
+ break;
+
+ case ACTION_TYPE_ADDNEXT:
mode = ADD_TYPE_NEXT;
- else
+ break;
+
+ case ACTION_TYPE_ADDLAST:
mode = ADD_TYPE_END;
+ break;
- m->mhandle->MediaGetList(LIST_TYPE_ALBUM_SONG,
- m->ctxtinfo->context, &list);
- if (type == ACTION_TYPE_ADDTO) {
- if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
- _ERR(" Adding songs to playlist failed ");
- else
+ case ACTION_TYPE_ADDTO:
+ if (m->mhandle->MediaAddsongsPlaylist(lid, list))
CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
-
+ else
+ _ERR(" Adding songs to playlist failed ");
return;
+
+ default:
+ _ERR("Invalid Action Type");
+ ASSERT(0);
+ break;
}
m->mhandle->UpdatePlaylist(list, mode);
m->mhandle->SetCurrentSong(sinfo->Id());
}
- CCommonUI::UpdatePlaybackView((EAddType)type, Layout(), m->focusedItem);
+ CCommonUI::UpdatePlaybackView(mode, Layout(), m->focusedItem);
}
if (!m->ctxtinfo || !m->ctxtinfo->context)
return;
- if (type == ACTION_TYPE_ADDNEXT)
+ list = eina_list_append(list, m->ctxtinfo->context);
+
+ switch (type) {
+ case ACTION_TYPE_PLAY:
+ mode = ADD_TYPE_FRESH;
+ break;
+
+ case ACTION_TYPE_ADDNEXT:
mode = ADD_TYPE_NEXT;
- else
+ break;
+
+ case ACTION_TYPE_ADDLAST:
mode = ADD_TYPE_END;
+ break;
- list = eina_list_append(list, m->ctxtinfo->context);
- if (type == ACTION_TYPE_ADDTO) {
- if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
- _ERR(" Adding songs to playlist failed ");
- else
+ case ACTION_TYPE_ADDTO:
+ if (m->mhandle->MediaAddsongsPlaylist(lid, list))
CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
-
+ else
+ _ERR(" Adding songs to playlist failed ");
return;
+
+ default:
+ _ERR("Invalid Action Type");
+ ASSERT(0);
+ break;
}
m->mhandle->UpdatePlaylist(list, mode);
m->mhandle->SetCurrentSong(((CSongInfo *)m->ctxtinfo->context)->Id());
}
- CCommonUI::UpdatePlaybackView((EAddType)type, Layout(), m->focused_item);
+ CCommonUI::UpdatePlaybackView(mode, Layout(), m->focused_item);
}
void CAlbumSongsLayout::sm_CbCtxtClose(void *dt)
if (!t.ctxtinfo || !t.ctxtinfo->context)
return;
- if (type == ACTION_TYPE_ADDNEXT)
- mode = ADD_TYPE_NEXT;
- else
- mode = ADD_TYPE_END;
-
- if (t.depth == E_DEPTH_SONG) {
- sinfo = (CSongInfo *)t.ctxtinfo->context;
- list = eina_list_append(list, sinfo);
- }
- else if (t.depth == E_DEPTH_ALBUM) {
+ if (t.depth == E_DEPTH_ALBUM) {
m->pMusicController->MediaGetList(LIST_TYPE_ALBUM_SONG,
t.ctxtinfo->context, &list);
sinfo = (CSongInfo *)eina_list_data_get(list);
sinfo = (CSongInfo *)eina_list_data_get(list);
}
- if (type == ACTION_TYPE_ADDTO) {
- if (!m->pMusicController->MediaAddsongsPlaylist(lid, list))
- _ERR(" Adding songs to playlist failed ");
- else
- CCommonUI::CreateMsgBox(t.base, MUSIC_TEXT_ADDTO_MSG);
+ switch (type) {
+ case ACTION_TYPE_PLAY:
+ mode = ADD_TYPE_FRESH;
+ break;
- if (t.depth == E_DEPTH_CATEGORY) {
- EINA_LIST_FREE(list, obj) {
- sinfo = (CSongInfo *)obj;
- sinfo->Destroy();
- delete sinfo;
+ case ACTION_TYPE_ADDNEXT:
+ mode = ADD_TYPE_NEXT;
+ break;
+
+ case ACTION_TYPE_ADDLAST:
+ mode = ADD_TYPE_END;
+ break;
+
+ case ACTION_TYPE_ADDTO:
+ {
+ if (m->pMusicController->MediaAddsongsPlaylist(lid, list))
+ CCommonUI::CreateMsgBox(t.base, MUSIC_TEXT_ADDTO_MSG);
+ else
+ _ERR(" Adding songs to playlist failed ");
+
+ if (t.depth == E_DEPTH_CATEGORY) {
+ EINA_LIST_FREE(list, obj) {
+ sinfo = (CSongInfo *)obj;
+ sinfo->Destroy();
+ delete sinfo;
+ }
}
}
-
return;
+
+ default:
+ _ERR("Invalid Action Type");
+ ASSERT(0);
+ break;
}
m->pMusicController->UpdatePlaylist(list, mode);
delete sinfo;
}
}
- else {
+ else
eina_list_free(list);
- }
- CCommonUI::UpdatePlaybackView((EAddType)type, Layout(), t.focused_item);
+ CCommonUI::UpdatePlaybackView(mode, Layout(), t.focused_item);
}
ctxtinfo->cbdata = this;
ctxtinfo->update = sm_CbCtxtUpdate;
ctxtinfo->close = sm_CbCtxtClose;
- if (t.depth == E_DEPTH_SONG) {
- ctxtinfo->type = CONTEXT_TYPE_SONG;
- ctxtinfo->context = itinfo->sinfo;
- }
- else if (t.depth == E_DEPTH_ALBUM) {
+ if (t.depth == E_DEPTH_ALBUM) {
ctxtinfo->type = CONTEXT_TYPE_ALBUM;
ctxtinfo->context = itinfo->alinfo;
}
if (!m->ctxtinfo || !m->ctxtinfo->context)
return;
- if (type == ACTION_TYPE_ADDNEXT)
+ list = eina_list_append(list, m->ctxtinfo->context);
+
+ switch (type) {
+ case ACTION_TYPE_PLAY:
+ mode = ADD_TYPE_FRESH;
+ break;
+
+ case ACTION_TYPE_ADDNEXT:
mode = ADD_TYPE_NEXT;
- else
+ break;
+
+ case ACTION_TYPE_ADDLAST:
mode = ADD_TYPE_END;
+ break;
- list = eina_list_append(list, m->ctxtinfo->context);
- if (type == ACTION_TYPE_ADDTO) {
- if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
- _ERR(" Adding songs to playlist failed ");
- else
+ case ACTION_TYPE_ADDTO:
+ if (m->mhandle->MediaAddsongsPlaylist(lid, list))
CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
-
+ else
+ _ERR(" Adding songs to playlist failed ");
return;
+
+ default:
+ _ERR("Invalid Action Type");
+ ASSERT(0);
+ break;
}
m->mhandle->UpdatePlaylist(list, mode);
m->mhandle->SetCurrentSong(((CSongInfo *)m->ctxtinfo->context)->Id());
}
- CCommonUI::UpdatePlaybackView((EAddType)type, Layout(), m->focused_item);
+ CCommonUI::UpdatePlaybackView(mode, Layout(), m->focused_item);
}
*/
#include <Eina.h>
+#include <AppCommon.h>
#include "i18n.h"
#include "define.h"
#include "dbg.h"
void CCommonUI::UpdatePlaybackView(EAddType type,
Evas_Object *layout, Elm_Object_Item *focused_item)
{
- Evas_Object *obj;
+ ASSERT(layout);
+ Evas_Object *obj = NULL;
CViewMgr* vmgr = CViewMgr::GetInstance();
- if (!vmgr || !layout)
- return;
+ ASSERT(vmgr);
- obj = NULL;
if (!focused_item)
obj = elm_object_focused_object_get(layout);
- SParcel parcel;
- memset(&parcel, 0, sizeof(SParcel));
- parcel.updateType = E_PLAYLIST_UPDATE;
-
- if (!vmgr->UpdateView((const char *)MUSIC_PLAYBACK_VIEW, &parcel)) {
- if (!vmgr->PushView(MUSIC_PLAYBACK_VIEW, NULL))
- _ERR(" viewmgr push view failed ");
+ const char *msgStr = NULL;
+ switch (type) {
+ case ADD_TYPE_FRESH:
+ {
+ SParcel parcel;
+ memset(&parcel, 0, sizeof(SParcel));
+ parcel.updateType = E_PLAYLIST_UPDATE;
+ if (!vmgr->PushView((const char *)MUSIC_PLAYBACK_VIEW, &parcel))
+ _ERR("PushView of PlaybackView Failed");
+ }
return;
- }
- if (type == ADD_TYPE_FRESH) {
- if (!vmgr->PushView(MUSIC_PLAYBACK_VIEW, NULL))
- _ERR(" viewmgr show failed ");
+ case ADD_TYPE_NEXT:
+ msgStr = MUSIC_TEXT_NEXT_MSG;
+ break;
- return;
+ case ADD_TYPE_END:
+ msgStr = MUSIC_TEXT_LAST_MSG;
+ break;
+
+ default:
+ _ERR("Invalid Add Type!!");
+ ASSERT(0);
+ break;
}
if (focused_item) {
- if (!vmgr->PushView(MUSIC_BASE_VIEW, NULL)) {
- _ERR(" viewmgr show failed ");
+ // Pop ContextView to show BaseView
+ if (!vmgr->PopView()) {
+ _ERR("PopView to show BaseView Failed");
return;
}
elm_object_item_focus_set(focused_item, EINA_TRUE);
- } else {
- if (obj)
- elm_object_focus_set(obj, EINA_TRUE);
}
+ else if (obj)
+ elm_object_focus_set(obj, EINA_TRUE);
- if (type == ADD_TYPE_NEXT)
- CreateMsgBox(layout, MUSIC_TEXT_NEXT_MSG);
- else
- CreateMsgBox(layout, MUSIC_TEXT_LAST_MSG);
+ CreateMsgBox(layout, msgStr);
}
if (!m->ctxtinfo || !m->ctxtinfo->context)
return;
- if (type == ACTION_TYPE_ADDNEXT)
- mode = ADD_TYPE_NEXT;
- else
- mode = ADD_TYPE_END;
-
if (m->depth == E_DEPTH_SONG) {
sinfo = (CSongInfo *)m->ctxtinfo->context;
list = eina_list_append(list, sinfo);
sinfo = (CSongInfo *)eina_list_data_get(list);
}
- if (type == ACTION_TYPE_ADDTO) {
- if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
- _ERR(" Adding songs to playlist failed ");
- else
- CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
+ switch (type) {
+ case ACTION_TYPE_PLAY:
+ mode = ADD_TYPE_FRESH;
+ break;
+
+ case ACTION_TYPE_ADDNEXT:
+ mode = ADD_TYPE_NEXT;
+ break;
+ case ACTION_TYPE_ADDLAST:
+ mode = ADD_TYPE_END;
+ break;
+
+ case ACTION_TYPE_ADDTO:
+ if (m->mhandle->MediaAddsongsPlaylist(lid, list))
+ CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
+ else
+ _ERR(" Adding songs to playlist failed ");
return;
+
+ default:
+ _ERR("Invalid Action Type");
+ ASSERT(0);
+ break;
}
m->mhandle->UpdatePlaylist(list, mode);
return;
}
- if (!m->mgr->PushView(MUSIC_PLAYBACK_VIEW, NULL)) {
- _ERR("CViewMgr::PushView failed");
- return;
- }
-
elm_object_item_focus_set(m->focused_item, EINA_TRUE);
}
return;
}
- if (!m->mgr->PushView(MUSIC_PLAYBACK_VIEW, NULL)) {
- _ERR("CViewMgr::PushView failed");
- return;
- }
-
elm_object_item_focus_set(m->focused_item, EINA_TRUE);
}
}
t_OnHide();
- m->mgr->PushView(MUSIC_BASE_VIEW, NULL);
+ m->mgr->PopView();
}
t.c_catinfo->Duplicate(catinfo);
- if (type == ACTION_TYPE_DELETE) {
- id = catinfo->CategoryId();
- if (!CMusicController::GetInstance()->MediaDeletePlaylist(id))
- _ERR(" Delete playlist failed ");
-
- t_UpdateLayout(false);
- elm_object_focus_set(t.grid, EINA_TRUE);
-
- }
- else if (type == ACTION_TYPE_RENAME) {
- text = catinfo->Name();
- if (t.epopup->FlagCreate())
- t.epopup->Destroy();
+ switch (type) {
+ case ACTION_TYPE_DELETE:
+ {
+ id = catinfo->CategoryId();
+ if (!CMusicController::GetInstance()->MediaDeletePlaylist(id))
+ _ERR(" Delete playlist failed ");
+
+ t_UpdateLayout(false);
+ elm_object_focus_set(t.grid, EINA_TRUE);
+ }
+ break;
- t.epopup->Create(t.base, text, sm_CbEntryRename, this);
+ case ACTION_TYPE_RENAME:
+ {
+ text = catinfo->Name();
+ if (t.epopup->FlagCreate())
+ t.epopup->Destroy();
- }
- else if (type == ACTION_TYPE_ADDSONG) {
- t.depth = E_DEPTH_SELECT_LIST;
- t.sel_type = SELECT_ADD;
- t_UpdateLayoutWithFocus();
+ t.epopup->Create(t.base, text, sm_CbEntryRename, this);
+ }
+ break;
- }
- else if (type == ACTION_TYPE_REMOVESONG) {
- if (catinfo->SongCount() == 0) {
- elm_object_item_focus_set(t.focused_item, EINA_TRUE);
- CCommonUI::CreateMsgBox(Layout(), MUSIC_TEXT_NO_SONGS);
- return;
+ case ACTION_TYPE_ADDSONG:
+ {
+ t.depth = E_DEPTH_SELECT_LIST;
+ t.sel_type = SELECT_ADD;
+ t_UpdateLayoutWithFocus();
}
- t.depth = E_DEPTH_SELECT_LIST;
- t.sel_type = SELECT_REMOVE;
- t_UpdateLayoutWithFocus();
+ break;
+
+ case ACTION_TYPE_REMOVESONG:
+ {
+ if (catinfo->SongCount() == 0) {
+ elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+ CCommonUI::CreateMsgBox(Layout(), MUSIC_TEXT_NO_SONGS);
+ return;
+ }
+ t.depth = E_DEPTH_SELECT_LIST;
+ t.sel_type = SELECT_REMOVE;
+ t_UpdateLayoutWithFocus();
+ }
+ break;
- }
- else {
+ default:
elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+ break;
}
}
if (!m->ctxtinfo || !m->ctxtinfo->context)
return;
- if (type == ACTION_TYPE_ADDNEXT)
+ list = eina_list_append(list, m->ctxtinfo->context);
+
+ switch (type) {
+ case ACTION_TYPE_PLAY:
+ mode = ADD_TYPE_FRESH;
+ break;
+
+ case ACTION_TYPE_ADDNEXT:
mode = ADD_TYPE_NEXT;
- else
+ break;
+
+ case ACTION_TYPE_ADDLAST:
mode = ADD_TYPE_END;
+ break;
- list = eina_list_append(list, m->ctxtinfo->context);
- if (type == ACTION_TYPE_ADDTO) {
- if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
- _ERR(" Adding songs to playlist failed ");
- else
+ case ACTION_TYPE_ADDTO:
+ if (m->mhandle->MediaAddsongsPlaylist(lid, list))
CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
-
+ else
+ _ERR(" Adding songs to playlist failed ");
return;
+
+ default:
+ _ERR("Invalid Action Type");
+ ASSERT(0);
+ break;
}
m->mhandle->UpdatePlaylist(list, mode);
m->mhandle->SetCurrentSong(((CSongInfo *)m->ctxtinfo->context)->Id());
}
- CCommonUI::UpdatePlaybackView((EAddType)type, Layout(), m->focused_item);
+ CCommonUI::UpdatePlaybackView(mode, Layout(), m->focused_item);
}