* limitations under the License.
*/
-#include <Elementary.h>
-#include <Eina.h>
-#include <utilX.h>
-#include "AppCommon.h"
-#include "dbg.h"
+#include <AppCommon.h>
+#include "i18n.h"
#include "define.h"
-#include <InputHandler.h>
+#include "common.h"
+#include "Timer.h"
#include "song_info.h"
+#include "album_info.h"
#include "music-controller.h"
#include "volume-control.h"
-#include "i18n.h"
-#include "common.h"
#include "common-ui.h"
-#include "BaseView.h"
-#include "ViewMgr.h"
#include "playback-view.h"
#include "context-view.h"
#include "HandleVolume.h"
+#include "PlaySettingCtxPopup.h"
+#include "Info.h"
+#include "SliderWidget.h"
+#include "PlaybackController.h"
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
-#define TITLE_FONT_SIZE 50
-#define ARTIST_FONT_SIZE 30
-#define TOTAL_CONTROL_BTNS 6
-#define TOTAL_SETTING_BTNS 2
-#define TOTAL_EDIT_BTNS 3
-#define S_INTERVAL 1 /* seconds */
-#define LP_INTERVAL 0.5 /* seconds */
-#define WAIT_INTERVAL 0.5 /* seconds */
-#define SLIDER_STEP 5000 /* milli seconds */
-#define LP_CHANGE 10000 /* milli seconds */
-#define S_INCREMENT 1000 /* milli seconds */
+#define TOTAL_CONTROL_BTNS 6
+#define TOTAL_EDIT_BTNS 3
enum EEvasObject {
EO_BASE,
-
- EO_ERROR_POPUP_BUTTON,
-
- EO_EDIT_PLAYLIST,
- EO_CLEAR_PLAYLIST, // TOTAL_SETTING_BTNS
-
- EO_CANCEL,
- EO_DESELECT,
- EO_DELETE, // TOTAL_EDIT_BTNS
-
- EO_BTN_SETTINGS,
- EO_BTN_SHUFFLE,
- EO_BTN_REPEAT,
- EO_BTN_REWIND,
- EO_BTN_PLAY,
- EO_BTN_FORWARD, // TOTAL_CONTROL_BTNS
-
- EO_SLIDER,
-
EO_PLAYLIST,
-
- EO_BOX,
};
-
struct SItemInfo {
Elm_Object_Item *item;
- SSongInfo *sinfo;
+ CSongInfo *sinfo;
bool edit_mode;
bool check_status;
bool select_status;
Evas_Object *eoWin;
Evas_Object *eoBase;
- Evas_Object *eoCtxPopup; /*settings popup*/
- Evas_Object *eoErrPopup;
Evas_Object *eoPlaylist;
Elm_Object_Item *focused_item;
+ CPlaybackController *pPlaybackController;
+ // These are reference values.
Evas_Object *eoBtnControl[TOTAL_CONTROL_BTNS];
- Evas_Object *eoBtnSetting[TOTAL_SETTING_BTNS];
Evas_Object *eoBtnEdit[TOTAL_EDIT_BTNS];
Evas_Object *eoAlbumCover;
- Evas_Object *eoSlider;
- Evas_Object *eoPressedObj;
-
- Eina_List *elInfo;
- Ecore_Timer *etSlider;
- Ecore_Timer *etLongPress;
- Ecore_Timer *etWait;
- CMusicController *hMusicController; //! NOT NULL
- SSongInfo *csinfo;
+ CSliderWidget *pSliderWidget;
+
+ Eina_List *elInfo;
+ CMusicController *pController; //! NOT NULL
+ CSongInfo *csinfo;
CViewMgr *mgr;
SItemInfo *cs_itinfo;
SContentInfo *ctxtinfo;
- int press_status;
- CPlaybackView *parent;
CHandleVolume *pHandleVolume;
SPlaybackView() {
memset(this, 0, sizeof(SPlaybackView));
- pHandleVolume = new CHandleVolume;
- }
- ~SPlaybackView() {
- delete pHandleVolume;
}
};
-struct SBtnInfo {
- const char *txt;
- const char *part;
- EEvasObject type;
- //Evas_Smart_Cb cb;
-};
-
-enum EPressTypes {
- PRESS_SHORT,
- PRESS_SHORT_PAUSE,
- PRESS_LONG,
- PRESS_LONG_PAUSE,
-};
-
-enum EControlBtns {
- BTN_SETTINGS,
- BTN_SHUFFLE,
- BTN_REPEAT,
- BTN_REWIND,
- BTN_PLAY,
- BTN_FORWARD
-};
-
-enum ESettingBtns {
- BTN_EDIT,
- BTN_CLEAR
-};
-
-enum EEditBtns {
- BTN_CANCEL,
- BTN_DESELECT,
- BTN_DELETE
-};
-
-enum ETimers {
- TIMER_SLIDER,
- TIMER_WAIT,
- TIMER_LONGPRESS,
- TIMER_VOLUME
-};
-
-Eina_Bool CPlaybackView::sm_CbUpdateSlider(void *dt)
-{
- SPlaybackView *m = (SPlaybackView *)dt;
- char *timestr = NULL;
- int value;
- int duration;
-
- if (!m)
- return ECORE_CALLBACK_CANCEL;
-
- if (!m->hMusicController->GetPosition(&value)) {
- m->etSlider = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
-
- if (!song_info_get_duration(m->csinfo, &duration)) {
- m->etSlider = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
-
- value = value + S_INCREMENT;
- if (value > duration) {
- m->etSlider = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
-
- elm_slider_value_set(m->eoSlider, value);
- timestr = _get_timestr_from_milseconds(value);
- if (timestr) {
- elm_object_part_text_set(m->eoBase, MUSIC_PART_PROGRESSTIME,
- timestr);
- free(timestr);
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-Eina_Bool CPlaybackView::sm_CbLongpressTimer(void *dt)
-{
- SPlaybackView *m = (SPlaybackView *)dt;
-
- m->parent->m_HandleOnRepeated();
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-Eina_Bool CPlaybackView::sm_CbWaitTimer(void *dt)
-{
- SPlaybackView *m = (SPlaybackView *)dt;
-
- m->press_status = PRESS_LONG;
- if (m->hMusicController->PlayState() == PLAY_STATUS_PLAY) {
- /* Handle long press */
- m->parent->m_PlaybackPause();
- m->etLongPress = ecore_timer_add(LP_INTERVAL, sm_CbLongpressTimer, m);
- }
- else {
- m->press_status = PRESS_LONG_PAUSE;
- }
-
- m->etWait = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-void CPlaybackView::sm_CbItemSelect(void *data, Evas_Object *obj, void *event_info)
-{
-}
-
-void CPlaybackView::sm_CbGenlistItemCheckClicked(void *data, Elm_Object_Item *it, const char *emission, const char *source)
+void CPlaybackView::sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
{
- CPlaybackView *root = (CPlaybackView*)data;
+ CPlaybackView *root = (CPlaybackView *)dt;
if (root)
- root->m_OnGenlistItemCheckClicked(it, emission, source);
-}
-
-
-void CPlaybackView::m_OnGenlistItemCheckClicked(Elm_Object_Item *it, const char *emission, const char *source)
-{
- SItemInfo *itinfo = NULL;
-
- if (!it || !emission)
- return;
-
- itinfo = m_FindItemInfoFromItem(m->elInfo, it);
- if (!itinfo) {
- _ERR(" no item info found ");
- return;
- }
-
- if (itinfo->edit_mode) {
- m_UpdateItemCheck(itinfo);
- m_DisableEditButtons(false);
- }
+ root->m_OnCtxtUpdate(type, lid);
}
-void CPlaybackView::sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+void CPlaybackView::m_OnCtxtUpdate(EActionType type, int lid)
{
- SPlaybackView *m = (SPlaybackView *)dt;
SItemInfo *itinfo = NULL;
-
- if (!m)
- return;
+ Elm_Object_Item *focusedItem = NULL;
if (!m->ctxtinfo || !m->ctxtinfo->context)
return;
- itinfo = m->parent->m_FindItemInfoFromSong(m->elInfo,
- (SSongInfo *)m->ctxtinfo->context);
+ itinfo = m_FindItemInfoFromSong(m->elInfo,
+ (CSongInfo *)m->ctxtinfo->context);
if (!itinfo) {
_ERR(" Unable to find song in the list ");
return;
if (type == ACTION_TYPE_DELETE) {
itinfo->check_status = true;
- m->parent->m_DeleteSelectedItems();
+ m_DeleteSelectedItems();
+
+ if (!m->mgr->PopView()) {
+ _ERR("CViewMgr::PopView failed");
+ return;
+ }
+
+ SParcel parcel;
+ memset(&parcel, 0, sizeof(SParcel));
+ parcel.updateType = E_PLAYLIST_UPDATE;
+ t_OnUpdate(&parcel);
+
+ focusedItem = m->cs_itinfo->item;
}
- else if (type == ACTION_TYPE_PLAY) {
+ else { // ACTION_TYPE_PLAY
if (m->ctxtinfo->status == PLAY_STATUS_PLAY)
- m->parent->m_KeyPausePress();
+ m_KeyPausePress();
else {
if (itinfo == m->cs_itinfo)
- m->parent->m_KeyPlayPress();
+ m_KeyPlayPress();
else
- m->parent->m_HandleGenlistItemActivated(m->eoPlaylist, itinfo->item);
+ m_HandleGenlistItemActivated(m->eoPlaylist, itinfo->item);
+ }
+
+ if (!m->mgr->PopView()) {
+ _ERR("CViewMgr::PopView failed");
+ return;
}
+
+ focusedItem = m->focused_item;
}
- else
- _ERR(" Wrong ctxt add type in plaback view ");
- if (!m->mgr->PushView(MUSIC_PLAYBACK_VIEW, NULL)) {
- _ERR(" viewmgr show failed ");
- return;
+ if (!CViewMgr::GetInstance()->HideView(MUSIC_BASE_VIEW))
+ _ERR("CViewMgr::HideView failed");
+
+ t_OnShow();
+
+ if (focusedItem) {
+ elm_genlist_item_show(focusedItem, ELM_GENLIST_ITEM_SCROLLTO_IN);
+ elm_object_item_focus_set(focusedItem, EINA_TRUE);
}
- elm_object_item_focus_set(m->focused_item, EINA_TRUE);
}
void CPlaybackView::sm_CbCtxtClose(void *dt)
{
- SPlaybackView *m = (SPlaybackView *)dt;
-
- if (!m)
- return;
-
- m->mgr->PopView();
- m->mgr->PushView(MUSIC_PLAYBACK_VIEW, NULL);
- elm_object_item_focus_set(m->focused_item, EINA_TRUE);
+ CPlaybackView *root = (CPlaybackView *)dt;
+ if (root)
+ root->m_OnCtxtClose();
}
-void CPlaybackView::m_RemoveTimer(int timer_code)
+void CPlaybackView::m_OnCtxtClose(void)
{
- ETimers timerCode = (ETimers)timer_code;
-
- switch (timerCode) {
- case TIMER_SLIDER:
- if (m->etSlider) {
- ecore_timer_del(m->etSlider);
- m->etSlider = NULL;
- }
- break;
-
- case TIMER_WAIT:
- if (m->etWait) {
- ecore_timer_del(m->etWait);
- m->etWait = NULL;
- }
- break;
-
- case TIMER_LONGPRESS:
- if (m->etLongPress) {
- ecore_timer_del(m->etLongPress);
- m->etLongPress = NULL;
- }
- break;
-
- case TIMER_VOLUME:
- m->pHandleVolume->RemoveTimer();
- break;
-
- default:
- _ERR(" invalid value ");
- break;
+ if (!m->mgr->PopView()) {
+ _ERR("CViewMgr::PopView failed");
+ return;
}
+
+ elm_object_item_focus_set(m->focused_item, EINA_TRUE);
}
-void CPlaybackView::m_PlaybackPause(void)
+int CPlaybackView::sm_CbCurrentSongCount(void *cookie)
{
- m->hMusicController->Pause();
+ CPlaybackView *root = (CPlaybackView *)cookie;
+ int ret = 0;
+ if (root)
+ ret = root->m_CbCurrentSongCount();
- if (m->etSlider)
- ecore_timer_freeze(m->etSlider);
+ return ret;
}
-void CPlaybackView::m_PlaybackResume(void)
+int CPlaybackView::m_CbCurrentSongCount(void)
{
- m->hMusicController->Resume();
-
- if (m->etSlider)
- ecore_timer_thaw(m->etSlider);
+ return eina_list_count(m->elInfo);
}
}
-void CPlaybackView::m_UpdateControlBtns(void)
-{
- int state;
-
- state = m->hMusicController->PlayState();
- if (state != PLAY_STATUS_STOP) {
- elm_object_disabled_set(m->eoBtnControl[BTN_FORWARD], EINA_FALSE);
- elm_object_disabled_set(m->eoBtnControl[BTN_REWIND], EINA_FALSE);
- }
- else {
- if (!m->eoErrPopup)
- elm_object_focus_set(m->eoBtnControl[BTN_PLAY], EINA_TRUE);
- elm_object_disabled_set(m->eoBtnControl[BTN_FORWARD], EINA_TRUE);
- elm_object_disabled_set(m->eoBtnControl[BTN_REWIND], EINA_TRUE);
- }
-
- if (state == PLAY_STATUS_PLAY) {
- elm_object_signal_emit(m->eoBtnControl[BTN_PLAY], MUSIC_SIGNAL_PLAY, MUSIC_PLAYBACK_VIEW);
- }
- else {
- elm_object_signal_emit(m->eoBtnControl[BTN_PLAY], MUSIC_SIGNAL_PAUSE, MUSIC_PLAYBACK_VIEW);
- }
-
- state = m->hMusicController->ShuffleState();
- if (state == SHUFFLE_STATUS_OFF) {
- elm_object_signal_emit(m->eoBtnControl[BTN_SHUFFLE], MUSIC_SIGNAL_SHUFFLE_OFF, MUSIC_PLAYBACK_VIEW);
- }
- else {
- elm_object_signal_emit(m->eoBtnControl[BTN_SHUFFLE], MUSIC_SIGNAL_SHUFFLE_ON, MUSIC_PLAYBACK_VIEW);
- }
-
- state = m->hMusicController->RepeatState();
- if (state == REPEAT_STATUS_NONE) {
- elm_object_signal_emit(m->eoBtnControl[BTN_REPEAT], MUSIC_SIGNAL_REPEAT_OFF, MUSIC_PLAYBACK_VIEW);
- }
- else if (state == REPEAT_STATUS_ALL) {
- elm_object_signal_emit(m->eoBtnControl[BTN_REPEAT], MUSIC_SIGNAL_REPEAT_ALL, MUSIC_PLAYBACK_VIEW);
- }
- else {
- elm_object_signal_emit(m->eoBtnControl[BTN_REPEAT], MUSIC_SIGNAL_REPEAT_ONE, MUSIC_PLAYBACK_VIEW);
- }
-}
-
-
-void CPlaybackView::m_UpdateCurrentSongProgressbar(void)
-{
- int duration;
- char *timestr = NULL;
- double step;
- int state;
-
- if (!m->csinfo)
- return;
-
- elm_slider_value_set(m->eoSlider, 0);
- elm_object_part_text_set(m->eoBase, MUSIC_PART_PROGRESSTIME, "00:00");
-
- state = m->hMusicController->PlayState();
-
- if (state == PLAY_STATUS_STOP) {
- elm_object_disabled_set(m->eoSlider, EINA_TRUE);
- m_RemoveTimer(TIMER_SLIDER);
- return;
- }
-
- elm_object_disabled_set(m->eoSlider, EINA_FALSE);
-
- if (song_info_get_duration(m->csinfo, &duration)) {
- m_RemoveTimer(TIMER_SLIDER);
- m->etSlider = ecore_timer_add(S_INTERVAL,
- sm_CbUpdateSlider, m);
-
- elm_slider_min_max_set(m->eoSlider, 0, duration);
- timestr = _get_timestr_from_milseconds(duration);
- if (timestr) {
- elm_object_part_text_set(m->eoBase,
- MUSIC_PART_FULLTIME, timestr);
- free(timestr);
- }
-
- step = (double)SLIDER_STEP / (double)duration;
- elm_slider_step_set(m->eoSlider, step);
- }
-}
-
-
void CPlaybackView::m_UpdateCurrentSongThumbnail(void)
{
char *path = NULL;
if (!m->cs_itinfo || !m->cs_itinfo->sinfo)
return;
- path = song_info_get_thumb(m->cs_itinfo->sinfo);
+ path = m->cs_itinfo->sinfo->ThumbnailPath();
if (path)
elm_image_file_set(m->eoAlbumCover, path, NULL);
else {
return;
elm_object_part_text_set(m->eoBase, MUSIC_PART_SONG_TITLE,
- song_info_get_title(m->csinfo));
+ m->csinfo->Name());
- snprintf(buf, sizeof(buf), "%s - %s", song_info_get_artist(m->csinfo),
- song_info_get_album(m->csinfo));
+ snprintf(buf, sizeof(buf), "%s - %s", m->csinfo->Artist(),
+ m->csinfo->Album());
elm_object_part_text_set(m->eoBase, MUSIC_PART_ARTIST_ALBUM, buf);
}
{
char buf[MAX_LENGTH];
- elm_object_signal_emit(m->eoBtnControl[BTN_PLAY],
- MUSIC_SIGNAL_PAUSE, MUSIC_PLAYBACK_VIEW);
- elm_object_focus_set(m->eoBtnControl[BTN_SETTINGS], EINA_TRUE);
- elm_object_focus_next_object_set(m->eoBtnControl[BTN_REPEAT],
- m->eoBtnControl[BTN_REPEAT], ELM_FOCUS_RIGHT);
- elm_object_disabled_set(m->eoBtnControl[BTN_FORWARD], EINA_TRUE);
- elm_object_disabled_set(m->eoBtnControl[BTN_REWIND], EINA_TRUE);
- elm_object_disabled_set(m->eoBtnControl[BTN_PLAY], EINA_TRUE);
- elm_object_disabled_set(m->eoSlider, EINA_TRUE);
- elm_object_part_text_set(m->eoBase, MUSIC_PART_FULLTIME, "00:00");
- elm_object_part_text_set(m->eoBase, MUSIC_PART_PROGRESSTIME, "00:00");
- elm_slider_value_set(m->eoSlider, 0);
+ m->pSliderWidget->Init();
+
elm_object_part_text_set(m->eoBase, MUSIC_PART_SONG_TITLE,
_(NO_PLAYLIST_MESSAGE));
elm_object_part_text_set(m->eoBase, MUSIC_PART_ARTIST_ALBUM,
snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
MUSIC_IMAGE_DEFAULT_THUMB_450);
elm_image_file_set(m->eoAlbumCover, buf, NULL);
- m->hMusicController->SetPlayState(PLAY_STATUS_INITIAL);
+ m->pController->SetPlayState(PLAY_STATUS_INITIAL);
}
m->ctxtinfo->status = (EPlayStatus)playStatus;
SParcel parcel;
- parcel.ctxtInfo = NULL;
+ memset(&parcel, 0, sizeof(SParcel));
parcel.updateType = E_SONG_UPDATE;
- parcel.layoutId = NULL;
- parcel.keyEvent = NULL;
m->mgr->UpdateView((const char *)MUSIC_CONTEXT_VIEW, &parcel);
}
}
if (pItemInfo) {
m->cs_itinfo = pItemInfo;
- if (m->hMusicController->PlayState() == PLAY_STATUS_STOP) {
+ if (m->pController->PlayState() == PLAY_STATUS_STOP) {
elm_genlist_item_bring_in(pItemInfo->item,
ELM_GENLIST_ITEM_SCROLLTO_IN);
}
void CPlaybackView::m_UpdateEditmodeFocusSequence(void)
{
- elm_object_focus_next_object_set(m->eoPlaylist,
- m->eoBtnEdit[BTN_CANCEL], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(m->eoBtnEdit[BTN_CANCEL],
- m->eoPlaylist, ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(m->eoSlider, m->eoBtnEdit[BTN_CANCEL],
- ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(m->eoPlaylist, m->eoBtnEdit[EDIT_BTN_CANCEL], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->eoBtnEdit[EDIT_BTN_CANCEL], m->eoPlaylist, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->pSliderWidget->Base(), m->eoBtnEdit[EDIT_BTN_CANCEL], ELM_FOCUS_DOWN);
}
void CPlaybackView::m_UpdatePlaymodeFocusSequence(void)
{
- elm_object_focus_next_object_set(m->eoSlider, m->eoPlaylist,
- ELM_FOCUS_UP);
- elm_object_focus_next_object_set(m->eoSlider, m->eoBtnControl[BTN_PLAY],
- ELM_FOCUS_DOWN);
- if (m->hMusicController->PlayState() == PLAY_STATUS_STOP) {
- elm_object_focus_next_object_set(m->eoPlaylist,
- m->eoBtnControl[BTN_PLAY], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(m->eoBtnControl[BTN_PLAY],
- m->eoPlaylist, ELM_FOCUS_RIGHT);
- }
- else {
+ switch (m->pController->PlayState()) {
+ case PLAY_STATUS_INITIAL:
+ // Do nothing
+ break;
+
+ case PLAY_STATUS_STOP:
+ elm_object_focus_next_object_set(m->eoPlaylist, m->eoBtnControl[CTRL_BTN_PLAY], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_PLAY], m->eoPlaylist, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_PLAY], m->eoBtnControl[CTRL_BTN_REPEAT], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_REPEAT], m->eoBtnControl[CTRL_BTN_PLAY], ELM_FOCUS_RIGHT);
+ elm_object_signal_emit(m->eoBtnControl[CTRL_BTN_PLAY], MUSIC_SIGNAL_PAUSE, MUSIC_PLAYBACK_VIEW);
+ break;
+
+ case PLAY_STATUS_PLAY:
+ case PLAY_STATUS_PAUSE:
elm_object_focus_next_object_set(m->eoPlaylist,
- m->eoBtnControl[BTN_FORWARD], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(m->eoBtnControl[BTN_FORWARD],
+ m->eoBtnControl[CTRL_BTN_FORWARD], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_FORWARD],
m->eoPlaylist, ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(m->eoBtnControl[BTN_PLAY],
- m->eoBtnControl[BTN_FORWARD], ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_PLAY],
+ m->eoBtnControl[CTRL_BTN_FORWARD], ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_PLAY],
+ m->eoBtnControl[CTRL_BTN_REWIND], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_REPEAT],
+ m->eoBtnControl[CTRL_BTN_REWIND], ELM_FOCUS_RIGHT);
+ break;
+
+ default:
+ ASSERT(!"Invalid State");
+ break;
}
}
void CPlaybackView::m_UpdateCurrentSongInfo(void)
{
- SSongInfo *sinfo = NULL;
+ CSongInfo *sinfo = NULL;
int index;
if (eina_list_count(m->elInfo) == 0) {
return;
}
- if (!m->hMusicController->GetCurrentSongIndex(&index)) {
+ if (!m->pController->GetCurrentSongIndex(&index)) {
_ERR(" music get current song index failed ");
return;
}
- if (!m->hMusicController->GetSonginfoFromIndex(index, &sinfo)) {
+ if (!m->pController->GetSonginfoFromIndex(index, &sinfo)) {
_ERR(" music get songinfo failed ");
return;
}
m_UpdateCurrentSongItem(index);
m_UpdateCurrentSongLabels();
m_UpdateCurrentSongThumbnail();
- m_UpdateCurrentSongProgressbar();
- m_UpdateControlBtns();
+ m->pController->UpdatePlayerUI();
m_UpdatePlaymodeFocusSequence();
}
{
/* flag - 1 means disable edit buttons and 0 means enable */
if (flag)
- elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
+ elm_object_focus_set(m->eoBtnEdit[EDIT_BTN_CANCEL], EINA_TRUE);
- elm_object_disabled_set(m->eoBtnEdit[BTN_DELETE], (Eina_Bool)flag);
- elm_object_disabled_set(m->eoBtnEdit[BTN_DESELECT], (Eina_Bool)flag);
+ elm_object_disabled_set(m->eoBtnEdit[EDIT_BTN_DELETE], (Eina_Bool)flag);
+ elm_object_disabled_set(m->eoBtnEdit[EDIT_BTN_DESELECT], (Eina_Bool)flag);
if (flag) {
m_UpdateEditmodeFocusSequence();
- elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
+ elm_object_focus_set(m->eoBtnEdit[EDIT_BTN_CANCEL], EINA_TRUE);
}
else {
- elm_object_focus_next_object_set(m->eoBtnEdit[BTN_CANCEL],
- m->eoBtnEdit[BTN_DESELECT], ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(m->eoBtnEdit[BTN_DELETE],
- m->eoPlaylist, ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(m->eoPlaylist,
- m->eoBtnEdit[BTN_DELETE], ELM_FOCUS_LEFT);
- }
-}
-
-
-void CPlaybackView::m_CreateErrorPopup(void)
-{
- Evas_Object *popup = NULL, *btn = NULL, *label = NULL;
-
- popup = elm_popup_add(m->eoBase);
- if (!popup)
- return;
-
- elm_object_style_set(popup, MUSIC_STYLE_ERROR_POPUP);
- evas_object_show(popup);
-
- label = elm_label_add(popup);
- if (!label) {
- evas_object_del(popup);
- return;
- }
-
- elm_object_style_set(label, MUSIC_STYLE_ERROR_LABEL);
- elm_object_text_set(label, MUSIC_TEXT_PLAYBACK_ERROR);
- elm_object_content_set(popup, label);
-
- btn = elm_button_add(popup);
- if (!btn) {
- evas_object_del(popup);
- return;
+ elm_object_focus_next_object_set(m->eoBtnEdit[EDIT_BTN_CANCEL], m->eoBtnEdit[EDIT_BTN_DESELECT], ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->eoBtnEdit[EDIT_BTN_DELETE], m->eoPlaylist, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->eoPlaylist, m->eoBtnEdit[EDIT_BTN_DELETE], ELM_FOCUS_LEFT);
}
-
- elm_object_style_set(btn, MUSIC_STYLE_EDIT_BTN);
- elm_object_text_set(btn, MUSIC_TEXT_OK);
- elm_object_part_content_set(popup, MUSIC_PART_POPUP_BUTTON, btn);
-
- m->eoErrPopup = popup;
-
- Connect(btn, EO_ERROR_POPUP_BUTTON, TYPE_CLICKED | TYPE_KEY_DOWN);
- //evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED, sm_CbPopupOkBtnClicked, m);
- //evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN, sm_CbPopupOkKeyPressed, m);
- elm_object_focus_set(btn, EINA_TRUE);
-
- return;
-}
-
-
-void CPlaybackView::m_DestroyErrorPopup(void)
-{
- if (!m->eoErrPopup)
- return;
-
- evas_object_del(m->eoErrPopup);
- m->eoErrPopup = NULL;
-}
-
-
-void CPlaybackView::m_CreateSettingsPopup(void)
-{
- Evas_Object *box = NULL;
- Evas_Object *eoCtxPopup = NULL;
- int i;
- double scale;
- SBtnInfo btninfo[TOTAL_SETTING_BTNS];
-
- btninfo[BTN_EDIT].txt = MUSIC_TEXT_EDIT_PLAYLIST;
- //btninfo[BTN_EDIT].cb = sm_CbEditBtnClicked;
- btninfo[BTN_EDIT].type = EO_EDIT_PLAYLIST;
-
- btninfo[BTN_CLEAR].txt = MUSIC_TEXT_CLEAR_PLAYLIST;
- //btninfo[BTN_CLEAR].cb = sm_CbClearBtnClicked;
- btninfo[BTN_CLEAR].type = EO_CLEAR_PLAYLIST;
-
- eoCtxPopup = elm_ctxpopup_add(m->eoWin);
- if (!eoCtxPopup)
- return;
-
- box = _add_box(eoCtxPopup);
- if (!box) {
- evas_object_del(eoCtxPopup);
- return;
- }
-
- for (i = 0; i < TOTAL_SETTING_BTNS; i++) {
- m->eoBtnSetting[i] = elm_button_add(box);
- if (!m->eoBtnSetting[i])
- continue;
- if (i == BTN_EDIT) {
- elm_object_style_set(m->eoBtnSetting[i],
- MUSIC_STYLE_SETTING_BTN_T);
- }
- else {
- elm_object_style_set(m->eoBtnSetting[i],
- MUSIC_STYLE_SETTING_BTN_B);
- }
- evas_object_size_hint_weight_set(m->eoBtnSetting[i],
- EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_box_pack_end(box, m->eoBtnSetting[i]);
- elm_object_text_set(m->eoBtnSetting[i], _(btninfo[i].txt));
-
- Connect(m->eoBtnSetting[i], btninfo[i].type, TYPE_CLICKED | TYPE_MOUSE_MOVE);
- //evas_object_smart_callback_add(m->eoBtnSetting[i], MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
- //evas_object_event_callback_add(m->eoBtnSetting[i], EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
-
- evas_object_show(m->eoBtnSetting[i]);
- }
-
- elm_object_style_set(eoCtxPopup, MUSIC_STYLE_SETTING_POPUP);
- elm_object_content_set(eoCtxPopup, box);
-
- scale = elm_config_scale_get();
- Connect(box, EO_BOX, TYPE_KEY_DOWN);
- //evas_object_event_callback_add(box, EVAS_CALLBACK_KEY_DOWN, sm_CbPopupKeyPressed, m);
- elm_object_part_content_set(m->eoBase, MUSIC_PART_SETTINGS_POPUP, eoCtxPopup);
-
- /* If list empty disable these options */
- if (eina_list_count(m->elInfo) == 0) {
- elm_object_disabled_set(m->eoBtnSetting[BTN_EDIT], EINA_TRUE);
- elm_object_disabled_set(m->eoBtnSetting[BTN_CLEAR], EINA_TRUE);
- }
-
- elm_object_focus_set(m->eoBtnSetting[BTN_EDIT], EINA_TRUE);
-
- m->eoCtxPopup = eoCtxPopup;
-}
-
-
-void CPlaybackView::m_DestroySettingsPopup(void)
-{
- if (!m->eoCtxPopup)
- return;
-
- evas_object_del(m->eoCtxPopup);
- m->eoCtxPopup = NULL;
}
void CPlaybackView::m_FromEditToPlaybackMode(void)
{
- if (m->hMusicController->PlayState() == PLAY_STATUS_STOP) {
+ if (m->pController->PlayState() == PLAY_STATUS_STOP) {
elm_genlist_item_bring_in(m->cs_itinfo->item,
ELM_GENLIST_ITEM_SCROLLTO_IN);
}
elm_object_signal_emit(m->eoBase, MUSIC_SIGNAL_PLAYBACK_MODE,
MUSIC_PLAYBACK_VIEW);
- elm_object_focus_set(m->eoBtnControl[BTN_SETTINGS], EINA_TRUE);
+ elm_object_focus_set(m->eoBtnControl[CTRL_BTN_SETTINGS], EINA_TRUE);
m_ChangeEditmodeAll(m->elInfo, false);
m_DisableEditButtons(true);
- elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
+ elm_object_focus_set(m->eoBtnEdit[EDIT_BTN_CANCEL], EINA_TRUE);
m_ChangeEditmodeAll(m->elInfo, true);
}
-void CPlaybackView::m_HandleOnRepeated(void)
-{
- Evas_Object *obj = NULL;
- int value;
- int duration;
- char *timestr = NULL;
-
- if (!m->eoPressedObj)
- return;
-
- obj = m->eoPressedObj;
-
- value = elm_slider_value_get(m->eoSlider);
- if (!song_info_get_duration(m->cs_itinfo->sinfo, &duration)) {
- _ERR("can not get duration ");
- return;
- }
-
- if (obj == m->eoBtnControl[BTN_REWIND]) {
- if (value == 0) {
- m_RemoveTimer(TIMER_LONGPRESS);
- return;
- }
- value = value - LP_CHANGE;
- if (value <= 0)
- value = 0;
- }
- else {
- if (value == duration) {
- if (m->hMusicController->PlayNextSong())
- m_UpdateCurrentSongInfo();
- else
- _ERR(" music play next song failed ");
-
- m->press_status = PRESS_LONG_PAUSE;
- elm_object_signal_emit(m->eoBtnControl[BTN_PLAY], MUSIC_SIGNAL_PAUSE,
- MUSIC_PLAYBACK_VIEW);
- m_PlaybackPause();
- m_RemoveTimer(TIMER_LONGPRESS);
-
- return;
- }
- value = value + LP_CHANGE;
- if (value >= duration)
- value = duration;
- }
-
- m->hMusicController->SetPosition(value);
- elm_slider_value_set(m->eoSlider, value);
- timestr = _get_timestr_from_milseconds(value);
- if (timestr) {
- elm_object_part_text_set(m->eoBase, MUSIC_PART_PROGRESSTIME,
- timestr);
- free(timestr);
- }
-
- return;
-}
-
-
void CPlaybackView::m_DeleteSelectedItems(void)
{
Eina_List *l = NULL, *l_next = NULL;
SItemInfo *pItemInfo = NULL;
void *obj = NULL;
+ bool updateFlag = false;
int index;
- bool flag = false;
m_DisableEditButtons(true);
EINA_LIST_FOREACH_SAFE(m->elInfo, l, l_next, obj) {
pItemInfo = (SItemInfo *)obj;
if (pItemInfo->check_status) {
if (m->cs_itinfo == pItemInfo) {
- flag = true;
+ updateFlag = true;
m_UnselectItem(m->cs_itinfo);
- m_RemoveTimer(TIMER_SLIDER);
m->cs_itinfo = NULL;
- m->hMusicController->SetPlayState(PLAY_STATUS_STOP);
- m->hMusicController->Stop();
+ m->pController->SetPlayState(PLAY_STATUS_STOP);
+ m->pController->Stop();
}
index = elm_genlist_item_index_get(pItemInfo->item);
- m->hMusicController->RemoveSong(pItemInfo->sinfo, index);
+ m->pController->RemoveSong(pItemInfo->sinfo, index);
- m->elInfo = eina_list_remove(m->elInfo,
- pItemInfo);
+ m->elInfo = eina_list_remove(m->elInfo, pItemInfo);
elm_object_item_del(pItemInfo->item);
}
}
if (eina_list_count(m->elInfo) == 0) {
m_UpdateEmptySongInfo();
elm_genlist_realized_items_update(m->eoPlaylist);
- elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
+ elm_object_focus_set(m->eoBtnEdit[EDIT_BTN_CANCEL], EINA_TRUE);
return;
}
- if (flag)
+ if (updateFlag)
m_UpdateCurrentSongInfo();
elm_genlist_realized_items_update(m->eoPlaylist);
- elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
+ elm_object_focus_set(m->eoBtnEdit[EDIT_BTN_CANCEL], EINA_TRUE);
}
void CPlaybackView::m_KeyBackPress(void)
{
- if (m->eoCtxPopup) {
- m_DestroySettingsPopup();
- elm_object_focus_set(m->eoBtnControl[BTN_SETTINGS], EINA_FALSE);
- elm_object_focus_set(m->eoBtnControl[BTN_SETTINGS], EINA_TRUE);
- return;
- }
-
t_OnHide();
- m->mgr->PushView(MUSIC_BASE_VIEW, NULL);
+
+ if (!CViewMgr::GetInstance()->ShowView(MUSIC_BASE_VIEW))
+ _ERR("CViewMgr::ShowView failed");
+
+ if (CViewMgr::GetInstance()->CheckTop(MUSIC_CONTEXT_VIEW)) {
+ if (!CViewMgr::GetInstance()->UpdateView(MUSIC_CONTEXT_VIEW, NULL))
+ _ERR("CViewMgr::UpdateView failed");
+
+ if (!CViewMgr::GetInstance()->ShowView(MUSIC_CONTEXT_VIEW))
+ _ERR("CViewMgr::ShowView failed");
+ }
}
void CPlaybackView::m_KeyExitPress(void)
{
- m_RemoveTimer(TIMER_SLIDER);
- m->hMusicController->Stop();
+ m->pController->Stop();
elm_exit();
}
{
int state;
- if (elm_object_disabled_get(m->eoBtnControl[BTN_PLAY]))
+ if (elm_object_disabled_get(m->eoBtnControl[CTRL_BTN_PLAY]))
return;
- state = m->hMusicController->PlayState();
+ state = m->pController->PlayState();
if (state == PLAY_STATUS_PAUSE) {
- m_PlaybackResume();
- elm_object_signal_emit(m->eoBtnControl[BTN_PLAY],
+ m->pController->Resume();
+ elm_object_signal_emit(m->eoBtnControl[CTRL_BTN_PLAY],
MUSIC_SIGNAL_PLAY, MUSIC_PLAYBACK_VIEW);
}
else if (state != PLAY_STATUS_PLAY) {
- if (m->hMusicController)
- m->hMusicController->Start();
-
- m_UpdateCurrentSongInfo();
+ m->pController->Start();
}
}
{
int state;
- if (elm_object_disabled_get(m->eoBtnControl[BTN_PLAY]))
+ if (elm_object_disabled_get(m->eoBtnControl[CTRL_BTN_PLAY]))
return;
- state = m->hMusicController->PlayState();
+ state = m->pController->PlayState();
if (state == PLAY_STATUS_PLAY) {
- elm_object_signal_emit(m->eoBtnControl[BTN_PLAY],
+ elm_object_signal_emit(m->eoBtnControl[CTRL_BTN_PLAY],
MUSIC_SIGNAL_PAUSE, MUSIC_PLAYBACK_VIEW);
- m_PlaybackPause();
+ m->pController->Pause();
}
}
void CPlaybackView::m_KeyNextPress(void)
{
- if (elm_object_disabled_get(m->eoBtnControl[BTN_FORWARD]))
+ if (elm_object_disabled_get(m->eoBtnControl[CTRL_BTN_FORWARD]))
return;
- m_HandleOnPressed(m->eoBtnControl[BTN_FORWARD]);
+ m->pController->HandleRemoteButtons(m->eoBtnControl[CTRL_BTN_FORWARD], EVENT_PRESSED);
}
void CPlaybackView::m_KeyPreviousPress(void)
{
- if (elm_object_disabled_get(m->eoBtnControl[BTN_REWIND]))
+ if (elm_object_disabled_get(m->eoBtnControl[CTRL_BTN_REWIND]))
return;
- m_HandleOnPressed(m->eoBtnControl[BTN_REWIND]);
+ m->pController->HandleRemoteButtons(m->eoBtnControl[CTRL_BTN_REWIND], EVENT_PRESSED);
}
void CPlaybackView::m_KeyNextUnpress(void)
{
- if (elm_object_disabled_get(m->eoBtnControl[BTN_FORWARD]))
+ if (elm_object_disabled_get(m->eoBtnControl[CTRL_BTN_FORWARD]))
return;
- m_HandleOnUnpressed(m->eoBtnControl[BTN_FORWARD]);
- //sm_CbOnUnpressed(m, m->eoBtnControl[BTN_FORWARD], NULL);
+ m->pController->HandleRemoteButtons(m->eoBtnControl[CTRL_BTN_FORWARD], EVENT_UNPRESSED);
}
void CPlaybackView::m_KeyPreviousUnpress(void)
{
- if (elm_object_disabled_get(m->eoBtnControl[BTN_REWIND]))
+ if (elm_object_disabled_get(m->eoBtnControl[CTRL_BTN_REWIND]))
return;
- m_HandleOnUnpressed(m->eoBtnControl[BTN_REWIND]);
- //sm_CbOnUnpressed(m, m->eoBtnControl[BTN_REWIND], NULL);
+ m->pController->HandleRemoteButtons(m->eoBtnControl[CTRL_BTN_REWIND], EVENT_UNPRESSED);
}
void CPlaybackView::m_HandleKeyPress(char *keyname)
{
- if (strcmp(keyname, (char*)KEY_EXIT) == 0)
+ if (!strcmp(keyname, (char *)KEY_EXIT))
m_KeyExitPress();
- else if (strcmp(keyname, (char*)KEY_BACK) == 0)
+ else if (!strcmp(keyname, (char *)KEY_BACK) ||
+ !strcmp(keyname, (char *)KEY_BACK_REMOTE))
m_KeyBackPress();
- else if (strcmp(keyname, (char*)KEY_PLAY) == 0)
+ else if (!strcmp(keyname, (char *)KEY_PLAY))
m_KeyPlayPress();
- else if (strcmp(keyname, (char*)KEY_PAUSE) == 0)
+ else if (!strcmp(keyname, (char *)KEY_PAUSE))
m_KeyPausePress();
- else if (strcmp(keyname, (char*)KEY_NEXT) == 0)
+ else if (!strcmp(keyname, (char *)KEY_NEXT))
m_KeyNextPress();
- else if (strcmp(keyname, (char*)KEY_PREVIOUS) == 0)
+ else if (!strcmp(keyname, (char *)KEY_PREVIOUS))
m_KeyPreviousPress();
- else if (strcmp(keyname, (char*)KEY_VOLUMEUP) == 0)
- m->pHandleVolume->Up(); //m_KeyVolumeupPress();
- else if (strcmp(keyname, (char*)KEY_VOLUMEDOWN) == 0)
- m->pHandleVolume->Down();// m_KeyVolumedownPress();
- else if (strcmp(keyname, (char*)KEY_MUTE) == 0)
- m->pHandleVolume->Mute(); // m_KeyMutePress();
+ else if (!strcmp(keyname, (char *)KEY_VOLUMEUP) ||
+ !strcmp(keyname, (char *)KEY_VOLUMEUP_REMOTE))
+ m->pHandleVolume->Up();
+ else if (!strcmp(keyname, (char *)KEY_VOLUMEDOWN) ||
+ !strcmp(keyname, (char *)KEY_VOLUMEDOWN_REMOTE))
+ m->pHandleVolume->Down();
+ else if (!strcmp(keyname, (char *)KEY_MUTE) ||
+ !strcmp(keyname, (char *)KEY_MUTE_REMOTE))
+ m->pHandleVolume->Mute();
}
}
-void CPlaybackView::m_AddSlider(void)
-{
- Evas_Object *eoSlider = NULL;
-
- eoSlider = elm_slider_add(m->eoBase);
- if (!eoSlider)
- return;
-
- elm_slider_indicator_show_set(eoSlider, EINA_FALSE);
- elm_slider_indicator_show_on_focus_set(eoSlider, EINA_FALSE);
- elm_object_style_set(eoSlider, MUSIC_STYLE_SLIDER);
- elm_slider_horizontal_set(eoSlider, EINA_TRUE);
- elm_object_part_content_set(m->eoBase, MUSIC_PART_PROGRESSBAR, eoSlider);
-
- Connect(eoSlider, EO_SLIDER, TYPE_CHANGED | TYPE_MOUSE_MOVE);
- //evas_object_smart_callback_add(eoSlider, MUSIC_SIGNAL_CHANGED, sm_CbSliderValueChanged, m);
- //evas_object_event_callback_add(eoSlider, EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
- evas_object_show(eoSlider);
- m->eoSlider = eoSlider;
-}
-
-
void CPlaybackView::m_AddAlbumCover(void)
{
Evas_Object *eoAlbumCover = NULL;
void CPlaybackView::m_AddCurrentSonginfo(void)
{
m_AddAlbumCover();
- m_AddSlider();
-}
-
-
-void CPlaybackView::m_AddEditPlaylistButtons(void)
-{
- Evas_Object *box = NULL;
- int i;
- SBtnInfo btninfo[TOTAL_EDIT_BTNS];
-
- btninfo[BTN_CANCEL].txt = MUSIC_TEXT_CANCEL;
- //btninfo[BTN_CANCEL].cb = sm_CbCancelBtnClicked;
- btninfo[BTN_CANCEL].type = EO_CANCEL;
-
- btninfo[BTN_DESELECT].txt = MUSIC_TEXT_DESELECT;
- //btninfo[BTN_DESELECT].cb = sm_CbDeselectBtnClicked;
- btninfo[BTN_DESELECT].type = EO_DESELECT;
-
- btninfo[BTN_DELETE].txt = MUSIC_TEXT_DELETE;
- //btninfo[BTN_DELETE].cb = sm_CbDeleteBtnClicked;
- btninfo[BTN_DELETE].type = EO_DELETE;
-
- box = _add_box(m->eoBase);
- if (!box)
- return;
-
- elm_box_horizontal_set(box, EINA_TRUE);
- elm_box_padding_set(box,
- MUSIC_EDIT_BTNS_PADDING * elm_config_scale_get(), 0);
-
- for (i = 0; i < TOTAL_EDIT_BTNS; i++) {
- m->eoBtnEdit[i] = elm_button_add(m->eoBase);
- if (!m->eoBtnEdit[i])
- continue;
-
- elm_object_style_set(m->eoBtnEdit[i],
- MUSIC_STYLE_EDIT_BTN);
- evas_object_size_hint_weight_set(m->eoBtnEdit[i],
- EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_box_pack_end(box, m->eoBtnEdit[i]);
- elm_object_text_set(m->eoBtnEdit[i], _(btninfo[i].txt));
-
- //evas_object_smart_callback_add(m->eoBtnEdit[i], MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
- //evas_object_event_callback_add(m->eoBtnEdit[i], EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
-
- evas_object_show(m->eoBtnEdit[i]);
- }
- elm_object_part_content_set(m->eoBase, MUSIC_PART_EDITBTNS, box);
- elm_object_signal_emit(m->eoBase, MUSIC_SIGNAL_PLAYBACK_MODE,
- MUSIC_PLAYBACK_VIEW);
-}
-
-
-void CPlaybackView::m_AddControlButtons(void)
-{
- Evas_Object *box = NULL;
- int i;
- SBtnInfo btninfo[TOTAL_CONTROL_BTNS];
-
- btninfo[BTN_SETTINGS].txt = MUSIC_STYLE_BTN_SETTINGS;
- //btninfo[BTN_SETTINGS].cb = sm_CbSettingsBtnClicked;
- btninfo[BTN_SETTINGS].type = EO_BTN_SETTINGS;
-
- btninfo[BTN_SHUFFLE].txt = MUSIC_STYLE_BTN_SHUFFLE;
- //btninfo[BTN_SHUFFLE].cb = sm_CbShuffleBtnClicked;
- btninfo[BTN_SHUFFLE].type = EO_BTN_SHUFFLE;
-
- btninfo[BTN_REPEAT].txt = MUSIC_STYLE_BTN_REPEAT;
- //btninfo[BTN_REPEAT].cb = sm_CbRepeatBtnClicked;
- btninfo[BTN_REPEAT].type = EO_BTN_REPEAT;
-
- btninfo[BTN_REWIND].txt = MUSIC_STYLE_BTN_REWIND;
- btninfo[BTN_REWIND].type = EO_BTN_REWIND;
-
- btninfo[BTN_PLAY].txt = MUSIC_STYLE_BTN_PLAY;
- //btninfo[BTN_PLAY].cb = sm_CbPlayBtnClicked;
- btninfo[BTN_PLAY].type = EO_BTN_PLAY;
-
- btninfo[BTN_FORWARD].txt = MUSIC_STYLE_BTN_FORWARD;
- btninfo[BTN_FORWARD].type = EO_BTN_FORWARD;
-
- box = elm_box_add(m->eoBase);
- if (!box)
- return;
-
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0);
- elm_box_horizontal_set(box, EINA_TRUE);
- elm_box_padding_set(box,
- MUSIC_CONTROL_BTNS_PADDING * elm_config_scale_get(), 0);
-
- for (i = 0; i < TOTAL_CONTROL_BTNS; i++) {
- m->eoBtnControl[i] = elm_button_add(m->eoBase);
- if (!m->eoBtnControl[i])
- continue;
-
- elm_object_style_set(m->eoBtnControl[i], btninfo[i].txt);
- evas_object_size_hint_weight_set(m->eoBtnControl[i],
- EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_box_pack_end(box, m->eoBtnControl[i]);
-
- if (i == BTN_REWIND || i == BTN_FORWARD) {
- Connect(m->eoBtnControl[i], btninfo[i].type, TYPE_PRESSED | TYPE_UNPRESSED | TYPE_MOUSE_MOVE);
- //evas_object_smart_callback_add(m->eoBtnControl[i], MUSIC_SIGNAL_PRESSED, sm_CbOnPressed, m);
- //evas_object_smart_callback_add(m->eoBtnControl[i], MUSIC_SIGNAL_UNPRESSED, sm_CbOnUnpressed, m);
- }
- else {
- Connect(m->eoBtnControl[i], btninfo[i].type, TYPE_CLICKED | TYPE_MOUSE_MOVE);
- //evas_object_smart_callback_add(m->eoBtnControl[i], MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
- }
- //evas_object_event_callback_add(m->eoBtnControl[i], EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
- evas_object_show(m->eoBtnControl[i]);
- }
-
- elm_object_part_content_set(m->eoBase, MUSIC_PART_CONTROLBTNS, box);
+
+ m->pSliderWidget = new CSliderWidget;
+ m->pSliderWidget->Create(m->eoBase);
}
-SItemInfo *CPlaybackView::m_FindItemInfoFromSong(Eina_List *list, SSongInfo *sinfo)
+SItemInfo *CPlaybackView::m_FindItemInfoFromSong(Eina_List *list, CSongInfo *sinfo)
{
Eina_List *l = NULL;
SItemInfo *itinfo = NULL;
class CElmGenlistItemClass {
public:
- static char *sm_CbTextGet(void *data, Evas_Object *obj, const char *part)
+ static char *sm_CbTextGet(void *data, Evas_Object *obj, const char *part)
{
- SSongInfo *sinfo = NULL;
+ CSongInfo *sinfo = NULL;
SItemInfo *pItemInfo = (SItemInfo *)data;
char buf[MAX_LENGTH];
char *timestr = NULL;
if (!strcmp(part, "elm.text0")) {
index = elm_genlist_item_index_get(pItemInfo->item);
- snprintf(buf, sizeof(buf), "%d", index + 1);
- if ((index & 1) == 1) {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_EVEN_ROW, MUSIC_PLAYBACK_VIEW);
- }
- else {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_ODD_ROW, MUSIC_PLAYBACK_VIEW);
- }
+ snprintf(buf, sizeof(buf), "%d", index);
}
else if (!strcmp(part, "elm.text1"))
- snprintf(buf, sizeof(buf), "%s", song_info_get_title(sinfo));
+ snprintf(buf, sizeof(buf), "%s", sinfo->Name());
else if (!strcmp(part, "elm.text2"))
snprintf(buf, sizeof(buf), "%s - %s",
- song_info_get_artist(sinfo),
- song_info_get_album(sinfo));
+ sinfo->Artist(),
+ sinfo->Album());
else if (!strcmp(part, "elm.text3")) {
- if (song_info_get_duration(sinfo, &duration)) {
- timestr = _get_timestr_from_milseconds(duration);
- if (timestr) {
- snprintf(buf, sizeof(buf), "%s", timestr);
- free(timestr);
- }
+ duration = sinfo->Duration();
+ timestr = CCommonUI::TimeStrFromMilSeconds(duration);
+ if (timestr) {
+ snprintf(buf, sizeof(buf), "%s", timestr);
+ free(timestr);
}
}
}
static Evas_Object *sm_CbContentGet(void *data, Evas_Object *obj, const char *part)
{
- SSongInfo *sinfo = NULL;
+ CSongInfo *sinfo = NULL;
SItemInfo *pItemInfo = (SItemInfo *)data;
Evas_Object *img = NULL;
char *path = NULL;
elm_image_aspect_fixed_set(img, EINA_FALSE);
if (!strcmp(part, "elm.swallow.icon")) {
- path = song_info_get_thumb(sinfo);
+ path = sinfo->ThumbnailPath();
if (path)
elm_image_file_set(img, path, "NULL");
else {
}
}
- if (pItemInfo->select_status) {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_SELECT_ITEM, MUSIC_PLAYBACK_VIEW);
- }
- else {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_UNSELECT_ITEM,
- MUSIC_PLAYBACK_VIEW);
- }
-
- if (pItemInfo->edit_mode) {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_EDITMODE_ON, MUSIC_PLAYBACK_VIEW);
- if (pItemInfo->check_status) {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_CHECK_ON,
- MUSIC_PLAYBACK_VIEW);
- }
- else {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_CHECK_OFF, MUSIC_PLAYBACK_VIEW);
- }
- }
- else {
- elm_object_item_signal_emit(pItemInfo->item,
- MUSIC_SIGNAL_EDITMODE_OFF, MUSIC_PLAYBACK_VIEW);
- }
-
return img;
}
elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_ALWAYS);
elm_genlist_multi_select_set(genlist, EINA_FALSE);
- Connect(genlist, EO_PLAYLIST, TYPE_REALIZED | TYPE_UNREALIZED | TYPE_MOUSE_MOVE | TYPE_KEY_DOWN | TYPE_ACTIVATED);
- //evas_object_smart_callback_add(genlist, MUSIC_SIGNAL_ACTIVATED, sm_CbGenlistItemActivated, m);
- //evas_object_smart_callback_add(genlist, MUSIC_SIGNAL_REALIZED, sm_CbGenlistRealized, m);
- //evas_object_smart_callback_add(genlist, MUSIC_SIGNAL_UNREALIZED, sm_CbGenlistUnrealized, m);
- //evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_MOVE, _genlist_mouse_moved, m);
- //evas_object_event_callback_add(genlist, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyDown, m);
+ Connect(genlist, EO_PLAYLIST, TYPE_REALIZED | TYPE_MOUSE_MOVE |
+ TYPE_KEY_DOWN | TYPE_ACTIVATED);
+
evas_object_show(genlist);
m->eoPlaylist = genlist;
}
Elm_Genlist_Item_Class *list_item = NULL;
int ts = 0;
int i, index = -1;
- struct SSongInfo *sinfo = NULL;
+ CSongInfo *sinfo = NULL;
Elm_Object_Item *item = NULL;
SItemInfo *pItemInfo = NULL;
return;
}
- if (!m->hMusicController->GetTotalSongs(&ts)) {
+ if (!m->pController->GetTotalSongs(&ts)) {
_ERR(" music get total songs failed ");
return;
}
- if (!m->hMusicController->GetCurrentSongIndex(&index))
+ if (!m->pController->GetCurrentSongIndex(&index))
_ERR(" music get current song index failed ");
for (i = 0; i < ts; i++) {
- if (!m->hMusicController->GetSonginfoFromIndex(i, &sinfo)) {
+ if (!m->pController->GetSonginfoFromIndex(i, &sinfo)) {
_ERR(" music get songinfo failed ");
continue;
}
pItemInfo->check_status = false;
pItemInfo->select_status = false;
+ // event handling will be done in OnActivated function
item = elm_genlist_item_append(m->eoPlaylist, list_item,
pItemInfo, NULL, ELM_GENLIST_ITEM_NONE,
- sm_CbItemSelect, m);
+ NULL, m);
pItemInfo->item = item;
if (i == index) {
}
-void CPlaybackView::m_HandleRewindBtnClicked(Evas_Object *obj)
-{
- elm_object_signal_emit(obj, MUSIC_SIGNAL_BTN_CLICKED,
- MUSIC_PLAYBACK_VIEW);
-
- if (m->hMusicController->PlayState() == PLAY_STATUS_STOP)
- return;
-
- if (!m->hMusicController->PlayPreviousSong()){
- _ERR(" music play previous song failed ");
- return;
- }
-
- m_UpdateCurrentSongInfo();
-}
-
-
-void CPlaybackView::m_HandleForwardBtnClicked(Evas_Object *obj)
-{
- elm_object_signal_emit(obj, MUSIC_SIGNAL_BTN_CLICKED,
- MUSIC_PLAYBACK_VIEW);
-
- if (m->hMusicController->PlayState() == PLAY_STATUS_STOP)
- return;
-
- if (!m->hMusicController->PlayNextSong()) {
- _ERR(" music play next song failed ");
- return;
- }
-
- m_UpdateCurrentSongInfo();
-}
-
-
-void CPlaybackView::m_HandleOnPressed(Evas_Object *obj)
-{
- m->press_status = PRESS_SHORT;
- m->eoPressedObj = obj;
-
- m->etWait = ecore_timer_add(WAIT_INTERVAL, sm_CbWaitTimer, m);
-}
-
-
-void CPlaybackView::m_HandleOnUnpressed(Evas_Object *obj)
-{
- m_RemoveTimer(TIMER_WAIT);
- m_RemoveTimer(TIMER_LONGPRESS);
-
- if (m->press_status == PRESS_SHORT) {
- /* Handle song change */
- if (m->hMusicController->PlayState() == PLAY_STATUS_PLAY)
- m_PlaybackPause();
-
- if (obj == m->eoBtnControl[BTN_FORWARD])
- m_HandleForwardBtnClicked(obj);
- else
- m_HandleRewindBtnClicked(obj);
-
- if (m->hMusicController->PlayState() != PLAY_STATUS_PLAY)
- m_PlaybackResume();
- }
- else if (m->press_status == PRESS_LONG) {
- if (m->hMusicController->PlayState() != PLAY_STATUS_PLAY)
- m_PlaybackResume();
- }
-
- m->press_status = PRESS_SHORT;
-}
-
-
void CPlaybackView::m_HandleGenlistItemActivated(Evas_Object *obj, Elm_Object_Item *genListItem)
{
int index;
index = elm_genlist_item_index_get(genListItem);
- m->hMusicController->PlayIndexSong(index);
- m_UpdateCurrentSongInfo();
+ m->pController->PlayIndexSong(--index);
}
{
ASSERT(!m);
+ CPlaybackController::SCallback cb;
+
_CREATE_BEGIN{
_CHECK(m = new SPlaybackView)
_CHECK(m->mgr = CViewMgr::GetInstance())
_CHECK(m->eoWin = m->mgr->Window())
- _CHECK(m->hMusicController = CMusicController::GetInstance())
- _CHECK(m->eoBase = _add_base(m->eoWin, MUSIC_PLAYBACK_VIEW))
+ _CHECK(m->pController = new CMusicController)
+ _CHECK(m->pController->Create())
+ _CHECK(m->eoBase = CCommonUI::AddBase(m->eoWin, MUSIC_PLAYBACK_VIEW))
_CHECK(CBaseView::Create(data))
- _WHEN_SUCCESS{}
- _CHECK_FAIL{ CBaseView::Destroy(); }
- _CHECK_FAIL{ evas_object_del(m->eoBase); }
- _CHECK_FAIL{ /* CMusicController::GetInstance())*/ }
- _CHECK_FAIL{ /* mgr->Window() */ }
- _CHECK_FAIL{ /* CViewerMgr::GetInstance() */}
- _CHECK_FAIL{ delete m; m = NULL; }
- }_CREATE_END_AND_CATCH{ return false; }
+ _CHECK(CTimer::Create());
+ _CHECK(m->pController->AddListener(this))
+ _CHECK(m->pPlaybackController = new CPlaybackController)
+ _COMMAND{ cb.cookie = this; cb.OnCurrentSongCount = sm_CbCurrentSongCount; }
+ _CHECK(m->pPlaybackController->Create(m->eoBase, &cb))
- m->press_status = PRESS_SHORT;
- m->parent = this;
+ _WHEN_SUCCESS{
+ evas_object_data_set(m->eoBase, PLAYBACK_VIEW_DATA, m);
- evas_object_data_set(m->eoBase, PLAYBACK_VIEW_DATA, m);
+ m_AddCurrentSonginfo();
+ m_AddPlaylist();
- m_AddControlButtons();
- m_AddEditPlaylistButtons();
- m_AddCurrentSonginfo();
- m_AddPlaylist();
+ int i;
+ for (i = 0; i < TOTAL_CONTROL_BTNS; i++)
+ m->eoBtnControl[i] = m->pPlaybackController->ControlBtnsObject((EPlayerControlBtns)i);
- m->pHandleVolume->Create(m->eoBase);
- m_UpdatePlaymodeFocusSequence();
+ for (i = 0; i < TOTAL_EDIT_BTNS; i++)
+ m->eoBtnEdit[i] = m->pPlaybackController->EditBtnsObject((EPlayerEditBtns)i);
- Connect(m->eoBase, EO_BASE, TYPE_KEY_DOWN | TYPE_KEY_UP);
- //evas_object_event_callback_add(eoBase, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyPressed, m);
- //evas_object_event_callback_add(eoBase, EVAS_CALLBACK_KEY_UP, sm_CbKeyReleased, m);
+ m->pHandleVolume = new CHandleVolume;
+ m->pHandleVolume->Create(m->eoBase);
+ m_UpdatePlaymodeFocusSequence();
- m->hMusicController->AddListener(this);
- //m->cbInfo[E_SONG_COMPLETE] = m->hMusicController->AddCallback(E_SONG_COMPLETE, sm_CbUpdateCurrentSongInfo, m);
- //m->cbInfo[E_PLAYBACK_ERROR] = m->hMusicController->AddCallback(E_PLAYBACK_ERROR, sm_CbPlaybackError, m);
+ Connect(m->eoBase, EO_BASE, TYPE_KEY_DOWN | TYPE_KEY_UP);
+ }
+
+ _CHECK_FAIL{ m->pPlaybackController->Destroy(); }
+ _CHECK_FAIL{ delete m->pPlaybackController; }
+ _CHECK_FAIL{ m->pController->RemoveListener(this); }
+ _CHECK_FAIL{ CTimer::Destroy(); }
+ _CHECK_FAIL{ CBaseView::Destroy(); }
+ _CHECK_FAIL{ evas_object_del(m->eoBase); }
+ _CHECK_FAIL{ m->pController->Destroy(); }
+ _CHECK_FAIL{ delete m->pController; }
+ _CHECK_FAIL{ /* mgr->Window() */ }
+ _CHECK_FAIL{ /* CViewerMgr::GetInstance() */}
+ _CHECK_FAIL{ delete m; m = NULL; }
+ }_CREATE_END_AND_CATCH{ return false; }
return true;
}
{
ASSERT(m);
- m->hMusicController->RemoveListener(this);
- //m->hMusicController->RemoveCallback(m->cbInfo[E_SONG_COMPLETE]);
- //m->hMusicController->RemoveCallback(m->cbInfo[E_PLAYBACK_ERROR]);
+ Disconnect(m->eoBase);
- m_DestroyErrorPopup();
+ m->pPlaybackController->Destroy();
+ delete m->pPlaybackController;
- m_RemoveTimer(TIMER_SLIDER);
- m_RemoveTimer(TIMER_WAIT);
- m_RemoveTimer(TIMER_LONGPRESS);
- m_DestroySettingsPopup();
+ m->pController->RemoveListener(this);
+
+ m->pSliderWidget->Destroy();
+ delete m->pSliderWidget;
m->pHandleVolume->Destroy();
+ delete m->pHandleVolume;
CBaseView::Destroy();
evas_object_del(m->eoBase);
}
-void CPlaybackView::t_OnClickedSettings(Evas_Object *obj)
-{
- elm_object_signal_emit(obj, MUSIC_SIGNAL_BTN_CLICKED, MUSIC_PLAYBACK_VIEW);
-
- if (eina_list_count(m->elInfo) == 0)
- return;
-
- elm_object_signal_emit(obj, MUSIC_SIGNAL_CONTROL_SELECTED, MUSIC_PLAYBACK_VIEW);
- m_DestroySettingsPopup();
- m_CreateSettingsPopup();
-}
-
-
-void CPlaybackView::t_OnClickedShuffle(Evas_Object *obj)
-{
- elm_object_signal_emit(obj, MUSIC_SIGNAL_BTN_CLICKED, MUSIC_PLAYBACK_VIEW);
-
- switch (m->hMusicController->ShuffleState()) {
- case SHUFFLE_STATUS_OFF:
- m->hMusicController->SetShuffleState(SHUFFLE_STATUS_ON);
- elm_object_signal_emit(obj, MUSIC_SIGNAL_SHUFFLE_ON, MUSIC_PLAYBACK_VIEW);
- break;
-
- default:
- m->hMusicController->SetShuffleState(SHUFFLE_STATUS_OFF);
- elm_object_signal_emit(obj, MUSIC_SIGNAL_SHUFFLE_OFF, MUSIC_PLAYBACK_VIEW);
- break;
- }
-}
-
-
-void CPlaybackView::t_OnClickedRepeat(Evas_Object *obj)
-{
- elm_object_signal_emit(obj, MUSIC_SIGNAL_BTN_CLICKED, MUSIC_PLAYBACK_VIEW);
-
- switch (m->hMusicController->RepeatState()) {
- case REPEAT_STATUS_NONE:
- m->hMusicController->SetRepeatState(REPEAT_STATUS_ALL);
- elm_object_signal_emit(obj, MUSIC_SIGNAL_REPEAT_ALL, MUSIC_PLAYBACK_VIEW);
- break;
-
- case REPEAT_STATUS_ALL:
- m->hMusicController->SetRepeatState(REPEAT_STATUS_ONE);
- elm_object_signal_emit(obj, MUSIC_SIGNAL_REPEAT_ONE, MUSIC_PLAYBACK_VIEW);
- break;
-
- default:
- m->hMusicController->SetRepeatState(REPEAT_STATUS_NONE);
- elm_object_signal_emit(obj, MUSIC_SIGNAL_REPEAT_OFF, MUSIC_PLAYBACK_VIEW);
- break;
- }
-}
-
-
-void CPlaybackView::t_OnClickedPlay(Evas_Object *obj)
-{
- elm_object_signal_emit(obj, MUSIC_SIGNAL_BTN_CLICKED, MUSIC_PLAYBACK_VIEW);
-
- switch (m->hMusicController->PlayState()) {
- case PLAY_STATUS_PAUSE:
- m_PlaybackResume();
- elm_object_signal_emit(obj, MUSIC_SIGNAL_PLAY, MUSIC_PLAYBACK_VIEW);
- break;
-
- case PLAY_STATUS_PLAY:
- elm_object_signal_emit(obj, MUSIC_SIGNAL_PAUSE, MUSIC_PLAYBACK_VIEW);
- m_PlaybackPause();
- break;
-
- default:
- if (m->hMusicController)
- m->hMusicController->Start();
- m_UpdateCurrentSongInfo();
- break;
- }
-}
-
-
void CPlaybackView::t_OnShow(void)
{
ASSERT(m);
int state;
- if (m->cs_itinfo) {
- elm_genlist_item_show(m->cs_itinfo->item,
- ELM_GENLIST_ITEM_SCROLLTO_IN);
- elm_object_item_focus_set(m->cs_itinfo->item, EINA_TRUE);
- }
+ m_UpdateCurrentSongInfo();
- state = m->hMusicController->PlayState();
+ state = m->pController->PlayState();
if (state == PLAY_STATUS_INITIAL || state == PLAY_STATUS_STOP) {
m_RemovePlaylist();
m_AddPlaylist();
- m->hMusicController->Start();
- m_UpdateCurrentSongInfo();
+ m->pController->Start();
+ }
+
+ if (m->cs_itinfo) {
+ elm_genlist_item_show(m->cs_itinfo->item, ELM_GENLIST_ITEM_SCROLLTO_IN);
+ elm_object_item_focus_set(m->cs_itinfo->item, EINA_TRUE);
}
evas_object_show(m->eoBase);
{
ASSERT(m);
- if (!data)
- return;
-
SParcel *parcel = (SParcel *)data;
- int updateType = parcel->updateType;
- char *key = (char *)parcel->keyEvent;
+ int updateType;
+ char *keyEvent = NULL;
+
+ if (!parcel)
+ updateType = E_PLAYLIST_UPDATE;
+ else {
+ updateType = parcel->updateType;
+ keyEvent = (char *)parcel->keyEvent;
+ }
switch (updateType) {
case E_PLAYLIST_UPDATE:
m_RemovePlaylist();
m_AddPlaylist();
- elm_object_disabled_set(m->eoBtnControl[BTN_FORWARD], EINA_FALSE);
- elm_object_disabled_set(m->eoBtnControl[BTN_REWIND], EINA_FALSE);
- elm_object_disabled_set(m->eoBtnControl[BTN_PLAY], EINA_FALSE);
- elm_object_focus_next_object_set(m->eoBtnControl[BTN_REPEAT],
- m->eoBtnControl[BTN_REWIND], ELM_FOCUS_RIGHT);
+ elm_object_disabled_set(m->eoBtnControl[CTRL_BTN_FORWARD], EINA_FALSE);
+ elm_object_disabled_set(m->eoBtnControl[CTRL_BTN_REWIND], EINA_FALSE);
+ elm_object_disabled_set(m->eoBtnControl[CTRL_BTN_PLAY], EINA_FALSE);
+ elm_object_focus_next_object_set(m->eoBtnControl[CTRL_BTN_REPEAT],
+ m->eoBtnControl[CTRL_BTN_REWIND], ELM_FOCUS_RIGHT);
m_FromEditToPlaybackMode();
break;
case E_KEY_PRESS:
- m_HandleKeyPress(key);
+ m_HandleKeyPress(keyEvent);
break;
case E_KEY_RELEASE:
- m_HandleKeyUnpress(key);
+ m_HandleKeyUnpress(keyEvent);
break;
default:
}
+void CPlaybackView::t_OnTimer(int id)
+{
+}
+
+
void CPlaybackView::t_OnHide(void)
{
ASSERT(m);
m_HandleKeyPress(ev->keyname);
break;
- case EO_ERROR_POPUP_BUTTON:
- if (!strcmp(ev->keyname, KEY_BACK)) {
- m_DestroyErrorPopup();
- elm_object_focus_set(m->eoBtnControl[BTN_PLAY], EINA_TRUE);
- }
- break;
-
case EO_PLAYLIST:
{
Elm_Object_Item *it = NULL;
SContentInfo *ctxtinfo = NULL;
SItemInfo *itinfo = NULL;
+ SParcel parcel;
- if (strcmp(ev->keyname, KEY_MENU))
- return;
-
- it = elm_object_focused_item_get(obj);
- if (!it) {
- _ERR(" unable to get focused item ");
- return;
- }
- m->focused_item = it;
+ if (!strcmp(ev->keyname, KEY_MENU) ||
+ !strcmp(ev->keyname, KEY_MENU_REMOTE)) {
+ it = elm_object_focused_item_get(obj);
+ if (!it) {
+ _ERR(" unable to get focused item ");
+ return;
+ }
+ m->focused_item = it;
- if (m->ctxtinfo) {
- free(m->ctxtinfo);
- m->ctxtinfo = NULL;
- }
+ if (m->ctxtinfo) {
+ free(m->ctxtinfo);
+ m->ctxtinfo = NULL;
+ }
- ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
- if (!ctxtinfo)
- return;
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!ctxtinfo)
+ return;
- itinfo = m_FindItemInfoFromItem(m->elInfo, it);
- if (!itinfo) {
- free(ctxtinfo);
- return;
- }
+ itinfo = m_FindItemInfoFromItem(m->elInfo, it);
+ if (!itinfo) {
+ free(ctxtinfo);
+ return;
+ }
- if (m->hMusicController->PlayState() == PLAY_STATUS_PLAY &&
- itinfo == m->cs_itinfo)
- ctxtinfo->status = PLAY_STATUS_PLAY;
- else
- ctxtinfo->status = PLAY_STATUS_PAUSE;
+ if (m->pController->PlayState() == PLAY_STATUS_PLAY &&
+ itinfo == m->cs_itinfo)
+ ctxtinfo->status = PLAY_STATUS_PLAY;
+ else
+ ctxtinfo->status = PLAY_STATUS_PAUSE;
- ctxtinfo->cbdata = m;
- ctxtinfo->update = sm_CbCtxtUpdate;
- ctxtinfo->close = sm_CbCtxtClose;
- ctxtinfo->type = CONTEXT_TYPE_PLAYSONG;
- ctxtinfo->context = itinfo->sinfo;
+ ctxtinfo->cbdata = this;
+ ctxtinfo->update = sm_CbCtxtUpdate;
+ ctxtinfo->close = sm_CbCtxtClose;
+ ctxtinfo->type = CONTEXT_TYPE_PLAYSONG;
+ ctxtinfo->context = itinfo->sinfo;
- m->ctxtinfo = ctxtinfo;
+ m->ctxtinfo = ctxtinfo;
- SParcel parcel;
- parcel.ctxtInfo = ctxtinfo;
- if (!m->mgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
- _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
- }
-
- case EO_BOX:
- if (!strcmp(ev->keyname, KEY_BACK)) {
- _ERR("eoCtxPopup BACK key pressed ");
- m_DestroySettingsPopup();
- elm_object_focus_set(m->eoBtnControl[BTN_SETTINGS], EINA_TRUE);
-
- }
- else if (!strcmp(ev->keyname, KEY_EXIT)) {
- _ERR("eoCtxPopup EXIT key pressed ");
- m_DestroySettingsPopup();
- m_RemoveTimer(TIMER_SLIDER);
- m->hMusicController->Stop();
- elm_exit();
+ memset(&parcel, 0, sizeof(SParcel));
+ parcel.ctxtInfo = ctxtinfo;
+ if (!m->mgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+ _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
+ }
}
- break;
default:
break;
}
-void CPlaybackView::OnMouseClicked(int id, Evas_Object *obj)
+void CPlaybackView::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
{
switch (id) {
- case EO_ERROR_POPUP_BUTTON:
- m_DestroyErrorPopup();
- elm_object_focus_set(m->eoBtnControl[BTN_PLAY], EINA_TRUE);
- break;
-
- case EO_EDIT_PLAYLIST:
- m_DestroySettingsPopup();
- m_FromPlaybackToEditMode();
- break;
-
- case EO_CLEAR_PLAYLIST:
- m->hMusicController->Stop();
- m->hMusicController->EmptyPlaylist();
-
- eina_list_free(m->elInfo);
- m->elInfo = NULL;
-
- elm_genlist_clear(m->eoPlaylist);
-
- m_DestroySettingsPopup();
- m_UpdateEmptySongInfo();
- break;
-
- case EO_CANCEL:
- m_DisableCheckAll(m->elInfo);
- m_DisableEditButtons(true);
- m_FromEditToPlaybackMode();
- break;
-
- case EO_DESELECT:
- m_DisableCheckAll(m->elInfo);
- m_DisableEditButtons(true);
- elm_genlist_realized_items_update(m->eoPlaylist);
- elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
- break;
-
- case EO_DELETE:
- m_DeleteSelectedItems();
- break;
-
- case EO_BTN_SETTINGS:
- t_OnClickedSettings(obj);
- break;
-
- case EO_BTN_SHUFFLE:
- t_OnClickedShuffle(obj);
- break;
+ case EO_PLAYLIST:
+ {
+ Elm_Object_Item *item;
- case EO_BTN_REPEAT:
- t_OnClickedRepeat(obj);
- break;
+ item = elm_genlist_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL);
+ if (!item)
+ return;
- case EO_BTN_PLAY:
- t_OnClickedPlay(obj);
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+ }
break;
default:
}
-void CPlaybackView::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+void CPlaybackView::OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
{
switch (id) {
- case EO_CANCEL:
- case EO_DESELECT:
- case EO_DELETE:
- case EO_SLIDER:
- case EO_BTN_FORWARD:
- case EO_BTN_PLAY:
- case EO_BTN_REPEAT:
- case EO_BTN_REWIND:
- case EO_BTN_SETTINGS:
- case EO_BTN_SHUFFLE:
- case EO_EDIT_PLAYLIST:
- case EO_CLEAR_PLAYLIST:
case EO_PLAYLIST:
- if (!elm_object_focus_get(obj))
- elm_object_focus_set(obj, EINA_TRUE);
+ {
+ int index = elm_genlist_item_index_get(item);
+ if ((index & 1) == 1)
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_EVEN_ROW, MUSIC_PLAYBACK_VIEW);
+ else
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_ODD_ROW, MUSIC_PLAYBACK_VIEW);
+
+ SItemInfo *itInfo = m_FindItemInfoFromItem(m->elInfo, item);
+ if (itInfo->select_status)
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_SELECT_ITEM, MUSIC_PLAYBACK_VIEW);
+ else
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_UNSELECT_ITEM, MUSIC_PLAYBACK_VIEW);
+
+ if (itInfo->edit_mode) {
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_EDITMODE_ON, MUSIC_PLAYBACK_VIEW);
+ if (itInfo->check_status) {
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_CHECK_ON, MUSIC_PLAYBACK_VIEW);
+ }
+ else
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_CHECK_OFF, MUSIC_PLAYBACK_VIEW);
+ }
+ else
+ elm_object_item_signal_emit(item,
+ MUSIC_SIGNAL_EDITMODE_OFF, MUSIC_PLAYBACK_VIEW);
+ }
break;
default:
}
-void CPlaybackView::OnPressed(int id, Evas_Object *obj)
+void CPlaybackView::OnActivated(int id, Evas_Object *obj, Elm_Object_Item *item)
{
switch (id) {
- case EO_BTN_FORWARD:
- case EO_BTN_REWIND:
- m_HandleOnPressed(obj);
+ case EO_PLAYLIST:
+ m_HandleGenlistItemActivated(obj, item);
break;
default:
}
-void CPlaybackView::OnUnpressed(int id, Evas_Object *obj)
+void CPlaybackView::OnComplete(void)
{
- switch (id) {
- case EO_BTN_FORWARD:
- case EO_BTN_REWIND:
- m_HandleOnUnpressed(obj);
- break;
-
- default:
- break;
- }
+ m_UpdateCurrentSongInfo();
}
-void CPlaybackView::OnChanged(int id, Evas_Object *obj)
+void CPlaybackView::OnError(void)
{
- switch (id) {
- case EO_SLIDER:
- {
- char *timestr = NULL;
- int value;
+}
- if (m->hMusicController->PlayState() == PLAY_STATUS_PLAY) {
- if (m->etSlider)
- ecore_timer_freeze(m->etSlider);
- }
- value = elm_slider_value_get(obj);
- m->hMusicController->SetPosition(value);
- timestr = _get_timestr_from_milseconds(value);
- if (timestr) {
- elm_object_part_text_set(m->eoBase, MUSIC_PART_PROGRESSTIME,
- timestr);
- free(timestr);
- }
+void CPlaybackView::OnUsbStatusChanged(SUsbStorageStatus status)
+{
+}
- if (m->hMusicController->PlayState() == PLAY_STATUS_PLAY) {
- if (m->etSlider)
- ecore_timer_thaw(m->etSlider);
- }
- }
- break;
- default:
- break;
- }
+void CPlaybackView::OnUpdateContent(void)
+{
}
-void CPlaybackView::OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+void CPlaybackView::OnStartPlayback(void)
{
- switch (id) {
- case EO_PLAYLIST:
- elm_object_item_signal_callback_add(item,
- MUSIC_SIGNAL_CHECK_CLICKED, MUSIC_PLAYBACK_VIEW,
- sm_CbGenlistItemCheckClicked, this);
- break;
-
- default:
- break;
- }
+ m_UpdateCurrentSongInfo();
}
-void CPlaybackView::OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+void CPlaybackView::OnStopPlayback(void)
{
- switch (id) {
- case EO_PLAYLIST:
- elm_object_item_signal_callback_del(item,
- MUSIC_SIGNAL_CHECK_CLICKED, MUSIC_PLAYBACK_VIEW,
- sm_CbGenlistItemCheckClicked);
- break;
+}
- default:
- break;
- }
+
+void CPlaybackView::OnEmptyPlaylist(void)
+{
+ eina_list_free(m->elInfo);
+ m->elInfo = NULL;
+ elm_genlist_clear(m->eoPlaylist);
+ m_UpdateEmptySongInfo();
}
-void CPlaybackView::OnActivated(int id, Evas_Object *obj, Elm_Object_Item *item)
+void CPlaybackView::OnPlayerModeChanged(EPlayerMode mode)
{
- switch (id) {
- case EO_PLAYLIST:
- m_HandleGenlistItemActivated(obj, item);
+ switch (mode) {
+ case MODE_PLAYLIST_EDIT:
+ m_FromPlaybackToEditMode();
+ break;
+
+ case MODE_PLAYBACK:
+ m_FromEditToPlaybackMode();
break;
default:
+ ASSERT(!"Invalid Player Mode");
break;
}
}
-void CPlaybackView::t_OnComplete(void)
-{
- m_UpdateCurrentSongInfo();
-}
-
-
-void CPlaybackView::t_OnError(void)
+void CPlaybackView::OnEditButtonsPressed(EPlayerEditBtns editBtns)
{
- m_CreateErrorPopup();
-}
-
+ switch (editBtns) {
+ case EDIT_BTN_CANCEL:
+ m_DisableCheckAll(m->elInfo);
+ m_DisableEditButtons(true);
+ break;
-void CPlaybackView::t_OnUsbConnected(void)
-{
-}
+ case EDIT_BTN_DESELECT:
+ m_DisableCheckAll(m->elInfo);
+ m_DisableEditButtons(true);
+ elm_genlist_realized_items_update(m->eoPlaylist);
+ break;
+ case EDIT_BTN_DELETE:
+ m_DeleteSelectedItems();
+ break;
-void CPlaybackView::t_OnUpdateContent(void)
-{
+ default:
+ ASSERT(!"Invalid Edit Button");
+ break;
+ }
}