From efe37d84885bf82ace25ed952e49be304a3f7b25 Mon Sep 17 00:00:00 2001 From: Kim Tae Soo Date: Tue, 14 Apr 2015 22:38:45 +0900 Subject: [PATCH] Clean the source code Change-Id: I4972e6b7c9ce8d974dc869f37ea14fac64731d2d Signed-off-by: Kim Tae Soo --- res/edc/views/message-layout.edc | 1 + src/playback/MusicControllerImpl.cpp | 8 +- src/views/PlayListCtxPopup.cpp | 3 - src/views/category-layout.cpp | 16 +--- src/views/playback-view.cpp | 177 ++++++++++++++++------------------- 5 files changed, 88 insertions(+), 117 deletions(-) diff --git a/res/edc/views/message-layout.edc b/res/edc/views/message-layout.edc index b6e4603..1fb91ad 100644 --- a/res/edc/views/message-layout.edc +++ b/res/edc/views/message-layout.edc @@ -13,6 +13,7 @@ group { rel2.relative: 0.0 0.0; min: 960 1080-127; align: 0 0; + fixed: 1 1; visible: 0; } } diff --git a/src/playback/MusicControllerImpl.cpp b/src/playback/MusicControllerImpl.cpp index b09863d..e1f4e51 100644 --- a/src/playback/MusicControllerImpl.cpp +++ b/src/playback/MusicControllerImpl.cpp @@ -242,14 +242,12 @@ bool CMusicControllerImpl::Start(void) _CHECK(pPlayback->SetUri(songpath)) _CHECK(pPlayback->Prepare()) _CHECK(pPlayback->Start()) - _COMMAND{ m->statePlay = PLAY_STATUS_PLAY; } - _CHECK(m->pPlaylist->GetSonginfoFromIndex(index, &sinfo)) - _CHECK(media_id = sinfo->Id()) - _CHECK(m->pMediadata->SetPlayedTime(media_id)) + _CHECK(media_id = sinfo->Id()) + _CHECK(m->pMediadata->SetPlayedTime(media_id)) - _WHEN_SUCCESS{ + _WHEN_SUCCESS{ bus_send_signal(); } diff --git a/src/views/PlayListCtxPopup.cpp b/src/views/PlayListCtxPopup.cpp index 07f9b5a..e292200 100644 --- a/src/views/PlayListCtxPopup.cpp +++ b/src/views/PlayListCtxPopup.cpp @@ -120,9 +120,6 @@ void CPlayListCtxPopup::m_DeleteBtnString(void) bool CPlayListCtxPopup::Create(Evas_Object* base, const SCallback* callback, Eina_List *playList) { - //Eina_List *l = NULL; - //SCtxtPlaylistItem *item = NULL; - _CREATE_BEGIN{ _CHECK(m = new SPlayListCtxPopup) _CHECK(m->listSize = eina_list_count(playList)) diff --git a/src/views/category-layout.cpp b/src/views/category-layout.cpp index b70ee58..1c7f311 100644 --- a/src/views/category-layout.cpp +++ b/src/views/category-layout.cpp @@ -181,34 +181,26 @@ void CCategoryLayout::sm_CbEntrynameSet(void *dt, const char *name) void CCategoryLayout::m_OnEntrynameSet(const char *name) { Eina_List *idlist = NULL; - char *str = NULL; - - if (!name) - return; + ASSERT(name); idlist = m_GetSelectedList(m->layoutCatSongs->CategorySongItemInfoList(), (int)ID_TYPE_MEDIA); - str = strdup(name); t.epopup->Destroy(); - if (!strcmp(str, MUSIC_STR_EMPTY)) { + if (!strcmp(name, MUSIC_STR_EMPTY)) { CCommonUI::CreateMsgBox(Layout(), MUSIC_TEXT_EMPTY_NAME); - free(str); return; } - if (m->pController->MediaExistPlaylist(str)) { + if (m->pController->MediaExistPlaylist(name)) { CCommonUI::CreateMsgBox(Layout(), MUSIC_TEXT_INUSE_MSG); - free(str); return; } - if (!m->pController->MediaInsertPlaylist(str, idlist)) { + if (!m->pController->MediaInsertPlaylist(name, idlist)) { _ERR("Playlist creation failed "); - free(str); return; } - free(str); t.depth = E_DEPTH_CATEGORY; t_UpdateLayoutWithFocus(); diff --git a/src/views/playback-view.cpp b/src/views/playback-view.cpp index 444ba46..5946798 100644 --- a/src/views/playback-view.cpp +++ b/src/views/playback-view.cpp @@ -39,21 +39,17 @@ #include "Info.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_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 +#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 */ + + +// SSliderWidget struct SSliderWidget { Evas_Object *eoSlider; Evas_Object *eoBase; @@ -312,10 +308,9 @@ void CSliderWidget::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mo if (!elm_object_focus_get(obj)) elm_object_focus_set(obj, EINA_TRUE); } -// -//////////////////////////////////////////////////////////////////////////////// +// STimer struct STimer { int count; int s, e; @@ -394,15 +389,10 @@ bool CTimer::SetTimer(int id, int ms) void CTimer::KillTimer(int id) { ASSERT(m); - - } - - - - +// CPlaybackView enum EEvasObject { EO_BASE, @@ -423,14 +413,31 @@ enum EEvasObject { }; -struct SItemInfo { - Elm_Object_Item *item; - CSongInfo *sinfo; - bool edit_mode; - bool check_status; - bool select_status; +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_WAIT, + TIMER_LONGPRESS, + TIMER_VOLUME +}; enum EPressTypes { PRESS_SHORT, @@ -439,6 +446,13 @@ enum EPressTypes { PRESS_LONG_PAUSE, }; +struct SItemInfo { + Elm_Object_Item *item; + CSongInfo *sinfo; + bool edit_mode; + bool check_status; + bool select_status; +}; struct SPlaybackView { Evas_Object *eoWin; @@ -472,8 +486,6 @@ struct SPlaybackView { SPlaybackView() { memset(this, 0, sizeof(SPlaybackView)); } - ~SPlaybackView() { - } }; struct SBtnInfo { @@ -483,34 +495,6 @@ struct SBtnInfo { }; -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_WAIT, - TIMER_LONGPRESS, - TIMER_VOLUME -}; - - - Eina_Bool CPlaybackView::sm_CbLongpressTimer(void *dt) { CPlaybackView *root = (CPlaybackView *)dt; @@ -2101,52 +2085,51 @@ void CPlaybackView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_ Elm_Object_Item *it = NULL; SContentInfo *ctxtinfo = NULL; SItemInfo *itinfo = NULL; + SParcel parcel; - if (strcmp(ev->keyname, KEY_MENU) && - strcmp(ev->keyname, KEY_MENU_REMOTE)) - 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->pController->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 = this; - 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; - memset(&parcel, 0, sizeof(SParcel)); - parcel.ctxtInfo = ctxtinfo; - if (!m->mgr->PushView(MUSIC_CONTEXT_VIEW, &parcel)) - _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed"); + memset(&parcel, 0, sizeof(SParcel)); + parcel.ctxtInfo = ctxtinfo; + if (!m->mgr->PushView(MUSIC_CONTEXT_VIEW, &parcel)) + _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed"); + } } default: -- 2.7.4