--- /dev/null
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT("music-player" CXX)
+
+
+IF(NOT DEFINED PACKAGE_NAME)
+ SET(PACKAGE_NAME "org.tizen.music-player-tv-ref")
+ENDIF(NOT DEFINED PACKAGE_NAME)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+IF(NOT DEFINED BINDIR)
+ SET(BINDIR"${PREFIX}/bin")
+ENDIF(NOT DEFINED BINDIR)
+IF(NOT DEFINED RESDIR)
+ SET(RESDIR "${PREFIX}/res")
+ENDIF(NOT DEFINED RESDIR)
+IF(NOT DEFINED EDJEDIR)
+ SET(EDJEDIR "${PREFIX}/res/edje")
+ENDIF(NOT DEFINED EDJEDIR)
+IF(NOT DEFINED LOCALEDIR)
+ SET(LOCALEDIR "${PREFIX}/res/locale")
+ENDIF(NOT DEFINED LOCALEDIR)
+IF(NOT DEFINED IMAGEDIR)
+ SET(IMAGEDIR "${PREFIX}/res/images")
+ENDIF(NOT DEFINED IMAGEDIR)
+IF(NOT DEFINED MANIFESTDIR)
+ SET(MANIFESTDIR "/usr/share/packages")
+ENDIF(NOT DEFINED MANIFESTDIR)
+IF(NOT DEFINED MEDIA_AUDIO_DIR)
+ SET(MEDIA_AUDIO_DIR "/opt/usr/media/Sounds")
+ENDIF(NOT DEFINED MEDIA_AUDIO_DIR)
+IF(NOT DEFINED DESKTOP_ICONDIR)
+ SET(DESKTOP_ICONDIR "/usr/share/icons/default/small")
+ENDIF(NOT DEFINED DESKTOP_ICONDIR)
+IF(NOT DEFINED DESKTOP_ICON)
+ SET(DESKTOP_ICON ${PACKAGE_NAME}.png)
+ENDIF(NOT DEFINED DESKTOP_ICON)
+IF(NOT DEFINED LANDSCAPE_ICON)
+ SET(LANDSCAPE_ICON ${PACKAGE_NAME}_4x2.png)
+ENDIF(NOT DEFINED LANDSCAPE_ICON)
+
+SET(SRCS src/main.cpp
+ src/views/song-layout.cpp
+ src/views/album-layout.cpp
+ src/views/category-layout.cpp
+ src/views/folder-layout.cpp
+ src/views/album-songs-layout.cpp
+ src/views/entry-popup.cpp
+ src/views/base-view.cpp
+ src/views/playback-view.cpp
+ src/views/context-view.cpp
+ src/views/artist-layout.cpp
+ src/views/genre-layout.cpp
+ src/views/playlist-layout.cpp
+ src/views/HandleVolume.cpp
+ src/views/common-ui.cpp
+ src/views/ExtBaseLayout.cpp
+ src/playback/playlist-mgr.cpp
+ src/playback/music-controller.cpp
+ src/playback/playback-mgr.cpp
+ src/playback/volume-control.cpp
+ src/data/mediadata.cpp
+ src/data/song_info.cpp
+ src/data/album_info.cpp
+ src/data/category_info.cpp
+ src/data/folder_info.cpp
+ src/data/bus.cpp
+)
+
+SET(TARGET_EDJ "${PROJECT_NAME}.edj")
+SET(THEME_EDJ "${PROJECT_NAME}-theme.edj")
+
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
+ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DTHEMEFILE=\"${EDJEDIR}/${THEME_EDJ}\"")
+ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(PKGS REQUIRED
+ capi-appfw-application
+ application-common
+ dlog
+ elementary
+ edje
+ capi-media-player
+ capi-media-sound-manager
+ capi-content-media-content
+ #capi-system-usbdevice
+ mm-player
+ edje
+ utilX
+ x11
+ gio-2.0
+)
+
+FOREACH(flag ${PKGS_CFLAGS})
+ SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}")
+ENDFOREACH(flag)
+
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLGAS} -fvisibility=hidden -Wall -Werror")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLGAS} -fvisibility=hidden -Wall")
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
+CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR})
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/images DESTINATION ${RESDIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/icons/${DESKTOP_ICON} DESTINATION ${DESKTOP_ICONDIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/icons/${LANDSCAPE_ICON} DESTINATION ${DESKTOP_ICONDIR})
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/demosongs DESTINATION ${MEDIA_AUDIO_DIR})
+
+#i18n
+ADD_SUBDIRECTORY(po)
+ADD_SUBDIRECTORY(res/edc)
+
--- /dev/null
+Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __EXT_BASE_LAYOUT_H__
+#define __EXT_BASE_LAYOUT_H
+
+#include "BaseLayout.h"
+
+class CExtBaseLayout : public CBaseLayout {
+private:
+ bool m_bEmptyStatus;
+
+public:
+ CExtBaseLayout(const char *szLayoutId);
+ virtual ~CExtBaseLayout();
+
+ void SetEmptyStatus(bool flag);
+ bool EmptyStatus(void);
+
+ virtual void Update(bool flag) {}
+};
+
+
+#endif /* __EXT_BASE_LAYOUT_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __ALBUM_LAYOUT_H__
+#define __ALBUM_LAYOUT_H__
+
+
+struct SAlbumItemInfo;
+
+class CAlbumLayout : public CExtBaseLayout, public CListenerMgr,
+ public IKeyDownListener, public IMouseMoveListener,
+ public IRealizedListener, public IUnrealizedListener {
+private:
+ struct SAlbumLayout *m;
+
+private:
+ static char *sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part);
+ static Evas_Object *sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part);
+ static void sm_CbRemoveGridItem(void *data, Evas_Object *obj);
+
+ static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid);
+ void m_OnCtxtUpdate(EActionType type, int lid);
+
+ static void sm_CbCtxtClose(void *dt);
+ void m_OnCtxtClose(void);
+
+ static void sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source);
+ void m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source);
+
+private:
+ SAlbumItemInfo *m_FindItemInfo(Eina_List *list, Elm_Object_Item *item);
+ SAlbumItemInfo *m_FindItemInfoById(Eina_List *list, int alid);
+ void m_ShowAlbumSongs(void);
+ void m_RemoveAlbumList(Eina_List *list);
+ void m_CreateAlbumGrid(void);
+ void m_EmptyAlbumGrid(bool sort_flag);
+ void m_SortAlbumGrid(void);
+ void m_UpdateAlbumGrid(bool sort_flag);
+
+protected:
+ virtual void t_OnShow(void);
+
+public:
+ CAlbumLayout(const char *pLayoutId) :
+ CExtBaseLayout(pLayoutId),
+ IKeyDownListener(this),
+ IMouseMoveListener(this),
+ IRealizedListener(this),
+ IUnrealizedListener(this),
+ m(0) {}
+ virtual ~CAlbumLayout() {}
+
+ bool Create(CLayoutMgr *mgr, const char *albumId);
+ virtual void Destroy(void);
+
+ virtual void Update(bool focusFlag);
+ void SetEmptyStatusHandleCallback(void(*handleEmptyStatusCb)(void *cookie, bool emptyStatus), void *cookie);
+
+public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
+ virtual void OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item);
+ virtual void OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item);
+};
+
+
+#endif /*__ALBUM_LAYOUT_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __ALBUM_SONGS_LAYOUT_H__
+#define __ALBUM_SONGS_LAYOUT_H__
+
+
+class CAlbumSongsLayout : public CExtBaseLayout, public CListenerMgr, public IKeyDownListener {
+private:
+ struct SAlbumSongsLayout *m;
+
+private:
+ static char *sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part);
+ static void sm_CbRemoveListItem(void *data, Evas_Object *obj);
+ static void sm_CbGoToPlaybackView(void *cookie, int mode, char *mediaId);
+
+private:
+ inline int m_ConvertToMin(int milsec);
+ void m_GotoPlayback(int mode, char *id);
+ Evas_Object *m_AddAlbumCover(void);
+ void m_CreateTopSection(void);
+ void m_CreateSongList(void);
+
+protected:
+ virtual void t_OnShow(void);
+
+public:
+ CAlbumSongsLayout(const char *pLayoutId) : CExtBaseLayout(pLayoutId), IKeyDownListener(this), m(0) {}
+ virtual ~CAlbumSongsLayout() {}
+
+ bool Create(CLayoutMgr *mgr);
+ virtual void Destroy(void);
+
+public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+};
+
+
+#endif /*__ALBUM_SONGS_LAYOUT_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ALBUM_INFO_H__
+#define __ALBUM_INFO_H__
+
+struct album_info {
+ int album_id;
+ char *name;
+ char *artist;
+ char *genre;
+ char *thumbnail_path;
+ int song_count;
+};
+
+struct album_info *album_info_create();
+void album_info_destroy(struct album_info *alinfo);
+
+int album_info_get_album_id(struct album_info *calinfo);
+char *album_info_get_name(struct album_info *calinfo);
+char *album_info_get_artist(struct album_info *calinfo);
+char *album_info_get_genre(struct album_info *calinfo);
+char *album_info_get_thumb(struct album_info *calinfo);
+struct album_info *album_info_duplicate(struct album_info *s_alinfo);
+int sortalbums_za(const void *d1, const void *d2);
+int sortalbums_az(const void *d1, const void *d2);
+
+#endif /*__ALBUM_INFO_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ARTIST_LAYOUT_H__
+#define __ARTIST_LAYOUT_H__
+
+
+class CArtistLayout : public CCategoryLayout {
+private:
+ struct SArtistLayout* m;
+
+protected:
+ virtual void t_HandleItemSelect(SCatItemInfo *itinfo);
+ virtual bool t_GetMediaList(Eina_List **list);
+ virtual EContextType t_ContextType(void) { return CONTEXT_TYPE_PLAYLIST; }
+ virtual ECategoryType t_CategoryType(void) { return CAT_TYPE_ARTIST; }
+
+public:
+ CArtistLayout(const char *pLayoutId) : CCategoryLayout(pLayoutId), m(0) {}
+ virtual ~CArtistLayout(){}
+};
+
+
+#endif /* __ARTIST_LAYOUT_H__ */
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __MUSIC_BASE_VIEW_H__
+#define __MUSIC_BASE_VIEW_H__
+
+
+struct _arg_list {
+ char *album_id;
+ char *uri;
+ char *source;
+};
+
+
+class CMusicBaseView : public CBaseView, public CListenerMgr, public IKeyDownListener, public IKeyUpListener,
+ IMusicControllerListener
+{
+private:
+ struct SMusicBaseView* m;
+
+private:
+ static void sm_CbHandleEmptyStatus(void *cookie, bool emptyStatus);
+ void m_OnHandleEmptyStatus(bool emptyStatus);
+
+private:
+ void m_UpdateFocusSequence(void);
+ void m_UpdateEmptyFocusSequence(void);
+
+ static void sm_CbClickedGroupBtn(void *cookie, Evas_Object *obj);
+ void m_OnClickedGroupBtn(Evas_Object *obj);
+
+ static void sm_CbClickedCtxBtn(void *cookie, Evas_Object *obj);
+ void m_OnClickedCtxBtn(Evas_Object *obj);
+
+ void m_ShowCurrentLayout(void);
+
+
+ void m_DestroyPopup(void);
+ void m_DestroyCtxPopup(void);
+ Evas_Object *m_CreateLoadingPopup(void);
+ void m_UpdatePlaysongLabel(void);
+ void m_AddPlaysongLabel(void);
+ void m_CreateTopSection(void);
+ void m_CreateLeftSection(void);
+ void m_CreateFullView(void);
+
+ void m_SetSourceType(void);
+ void m_UpdateCurrentLayout(bool focusFlag);
+
+protected:
+ virtual void t_OnShow(void);
+ virtual void t_OnHide(void);
+ virtual void t_OnUpdate(void* data);
+
+public:
+ CMusicBaseView(const char *pViewId) : CBaseView(pViewId), IKeyDownListener(this), IKeyUpListener(this), m(0) {}
+ virtual ~CMusicBaseView() {}
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+
+ virtual Evas_Object* Base(void);
+
+public:
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+ virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev);
+
+protected:
+
+ virtual void t_OnComplete(void);
+ virtual void t_OnError(void);
+ virtual void t_OnUsbConnected(void);
+ virtual void t_OnUpdateContent(void);
+};
+
+
+#endif /*__MUSIC_BASE_VIEW_H__*/
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __BUS_H__
+#define __BUS_H__
+
+void bus_send_signal();
+
+#endif /*__BUS_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __CATEGORY_LAYOUT_H__
+#define __CATEGORY_LAYOUT_H__
+
+
+class CCategoryLayout : public CExtBaseLayout, public CListenerMgr, public IKeyDownListener {
+private:
+ struct SCategoryLayout *m;
+
+public:
+ enum EDepthType {
+ E_DEPTH_CATEGORY,
+ E_DEPTH_ALBUM,
+ E_DEPTH_SONG,
+ E_DEPTH_SELECT_LIST,
+ E_DEPTH_SHOW_LIST
+ };
+
+ enum ESelectType {
+ SELECT_CREATE,
+ SELECT_ADD,
+ SELECT_REMOVE
+ };
+
+ struct SCatItemInfo {
+ category_info *catinfo;
+ ECategoryType type;
+ album_info *alinfo;
+ SSongInfo *sinfo;
+ Elm_Object_Item *item;
+ bool check_status;
+ };
+
+protected:
+ struct SCategoryLayoutProtected {
+ int depth;
+ category_info *c_catinfo;
+ album_info *c_alinfo;
+ SContentInfo *ctxtinfo;
+ ESelectType sel_type;
+ Evas_Object *grid;
+ Evas_Object *epopup;
+ Evas_Object *base;
+ Elm_Object_Item *focused_item;
+ } t;
+
+private:
+ static Eina_Bool sm_CbFocusIdler(void *dt);
+ Eina_Bool m_OnFocusIdler(void);
+
+ static void sm_CbEntrynameSet(void *dt, const char *name);
+ void m_OnEntrynameSet(const char *name);
+
+ static void sm_CbSelectAllClicked(void *dt, Evas_Object *obj, void *ev);
+ void m_OnSelectAllClicked(Evas_Object *obj, void *ev);
+
+ static void sm_CbDoneBtnClicked(void *dt, Evas_Object *obj, void *ev);
+ void m_OnDoneBtnClicked(Evas_Object *obj, void *ev);
+
+ static void sm_CbCancelBtnClicked(void *dt, Evas_Object *obj, void *ev);
+ void m_OnCancelBtnClicked(Evas_Object *obj, void *ev);
+
+ static void sm_CbPlayBtnClicked(void *dt, Evas_Object *obj, void *ev);
+ void m_OnPlayBtnClicked(Evas_Object *obj, void *ev);
+
+ static void sm_CbNextBtnClicked(void *dt, Evas_Object *obj, void *ev);
+ void m_OnNextBtnClicked(Evas_Object *obj, void *ev);
+
+ static void sm_CbLastBtnClicked(void *dt, Evas_Object *obj, void *ev);
+ void m_OnLastBtnClicked(Evas_Object *obj, void *ev);
+
+ static char *sm_CbGetSelectlistItemText(void *data, Evas_Object *obj, const char *part);
+ static char *sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part);
+ static void sm_CbRemoveListItem(void *data, Evas_Object *obj);
+
+ static void sm_CbSongItemSelect(void *data, Evas_Object *obj, void *event_info);
+ void m_OnSongItemSelect(Evas_Object *obj, Elm_Object_Item *event_info);
+
+ static void sm_CbSelectlistItemSelect(void *data, Evas_Object *obj, void *event_info);
+ void m_OnSelectlistItemSelect(Evas_Object *obj, void *event_info);
+
+ static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid);
+protected:
+ virtual void t_OnCtxtUpdate(enum EActionType type, int lid);
+
+private:
+ static void sm_CbCtxtClose(void *dt);
+ void m_OnCtxtClose(void);
+
+ static char *sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part);
+ static char *sm_CbGetGridAlbumItemText(void *data, Evas_Object *obj, const char *part);
+ static Evas_Object *sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part);
+ static Evas_Object *sm_CbGetGridAlbumitemContent(void *data, Evas_Object *obj, const char *part);
+ static void sm_CbRemoveGridItem(void *data, Evas_Object *obj);
+
+ static void sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source);
+ void m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source);
+
+ static void sm_CbGengridRealized(void *data, Evas_Object *obj, void *event_info);
+ static void sm_CbGengridUnrealized(void *data, Evas_Object *obj, void *event_info);
+
+ static void sm_CbKeyDown(void *dt, Evas *e, Evas_Object *obj, void *ei);
+ void m_OnKeyDown(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+
+ static void sm_CbKeyPressed(void *dt, Evas *e, Evas_Object *obj, void *ei);
+ void m_OnKeyPressed(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+
+private:
+ inline int m_ConvertToMin(int milsec);
+ void m_RemoveFocusIdler(void);
+ Elm_Object_Item *m_FindItemByInfo(Eina_List *list, void *info);
+ SCatItemInfo *m_FindItemInfo(Eina_List *list, Elm_Object_Item *item);
+ void m_GotoPlayback(int mode, char *id);
+ Eina_List *m_GetSelectedList(Eina_List *infolist, int type);
+ void m_AddSelectedSongs(void);
+ void m_RemoveSelectedSongs(void);
+ void m_AddAlbumsToPlayback(int mode);
+ void m_AddSongsToPlayback(int mode);
+ Evas_Object *m_AddAlbumCover(void);
+ Evas_Object *m_AddGrid(void);
+ void m_AddCategoryItem(Elm_Gengrid_Item_Class *grid_item, ECategoryType type, void *info);
+ void m_AddButtons(void);
+ void m_AddSelectlistButtons(void);
+
+ void m_CreateSongsTopSection(void);
+ void m_CreateSongList(void);
+ void m_CreateAlbumgrid(void);
+ void m_CreateCatgrid(bool sort_flag);
+ void m_SortCatgrid(void);
+ void m_EmptyLayout(bool sort_flag);
+
+protected:
+ bool t_SetEdje(const char *layout);
+ void t_UpdateLayout(bool sort_flag);
+ void t_UpdateLayoutWithFocus(void);
+
+protected:
+ virtual void t_OnShow(void);
+
+protected:
+ virtual void t_HandleItemSelect(SCatItemInfo *itinfo) = 0;
+ virtual EContextType t_ContextType(void) = 0;
+ virtual bool t_GetMediaList(Eina_List **list) = 0;
+ virtual ECategoryType t_CategoryType(void) = 0;
+
+public:
+ CCategoryLayout(const char *pLayoutId) : CExtBaseLayout(pLayoutId), IKeyDownListener(this), m(0) {
+ memset(&t, 0, sizeof(t));
+ }
+ virtual ~CCategoryLayout() {}
+
+ bool Create(CLayoutMgr *mgr);
+ virtual void Destroy(void);
+
+ virtual void Update(bool focusFlag);
+
+public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+};
+
+
+#endif /*__CATEGORY_LAYOUT_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CATEGORY_INFO_H__
+#define __CATEGORY_INFO_H__
+#include <Eina.h>
+
+struct list_member {
+ char *media_id;
+ int member_id;
+};
+
+struct category_info {
+ int id;
+ const char *name;
+ char *thumb;
+ int album_count;
+ int song_count;
+ Eina_List *albumlist;
+ Eina_List *memberlist;
+};
+
+struct category_info *category_info_create();
+void category_info_destroy(struct category_info *catinfo);
+
+int category_info_get_category_id(struct category_info *catinfo);
+const char *category_info_get_name(struct category_info *catinfo);
+char *category_info_get_thumb(struct category_info *catinfo);
+int category_info_get_albumcount(struct category_info *catinfo);
+int category_info_get_songcount(struct category_info *catinfo);
+Eina_List *category_info_get_albumlist(struct category_info *catinfo);
+Eina_List *category_info_get_memberlist(struct category_info *catinfo);
+struct category_info *category_info_duplicate(struct category_info *catinfo);
+int sortcategorys_za(const void *d1, const void *d2);
+int sortcategorys_az(const void *d1, const void *d2);
+struct category_info *find_category(Eina_List *list, const char *category);
+
+#endif /*__CATEGORY_INFO_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __COMMON_UI_H__
+#define __COMMON_UI_H__
+
+#include <Elementary.h>
+
+enum EAddType;
+struct view_mgr;
+
+char *_get_timestr_from_milseconds(int mseconds);
+void _set_object_text(Evas_Object *lbl, char *text, int size,
+ const char *style);
+Evas_Object *_add_box(Evas_Object *base);
+Evas_Object *_add_base(Evas_Object *win, const char *layout);
+void _object_mouse_moved(void *dt, Evas *e, Evas_Object *obj, void *ei);
+void _genlist_mouse_moved(void *dt, Evas *e, Evas_Object *obj, void *ei);
+void _gengrid_mouse_moved(void *dt, Evas *e,
+ Evas_Object *obj, void *event_info);
+void _update_playback_view(enum EAddType type,
+ Evas_Object *layout, Elm_Object_Item *focused_item);
+void _create_message_box(Evas_Object *base, const char *msg);
+Evas_Object *_create_remove_popup(Evas_Object *base, const char *msg,
+ Evas_Object_Event_Cb _close_cb, Evas_Smart_Cb _remove_cb,
+ Evas_Smart_Cb _cancel_cb, void *dt);
+#endif /*__COMMON_UI_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+
+struct SCbInfo {
+ void (*cb)(void *dt);
+ void *data;
+ int type;
+};
+
+struct SCtxtPlaylistItem {
+ char *name;
+ int id;
+};
+
+enum {
+ GRP_SONG,
+ GRP_ALBUM,
+ GRP_ARTIST,
+ GRP_GENRE,
+ GRP_FOLDER,
+ GRP_PLAYLISTS
+};
+
+enum ESourceType {
+ SOURCE_TYPE_NONE = -1,
+ SOURCE_TYPE_ALL,
+ SOURCE_TYPE_TV,
+ SOURCE_TYPE_USB
+};
+
+enum sorttype {
+ E_SORT_TITLE_A_Z,
+ E_SORT_TITLE_Z_A,
+ E_SORT_ARTIST_A_Z,
+ E_SORT_ARTIST_Z_A,
+ E_SORT_ALBUM_A_Z,
+ E_SORT_ALBUM_Z_A
+};
+
+enum EAddType {
+ ADD_TYPE_FRESH,
+ ADD_TYPE_NEXT,
+ ADD_TYPE_END
+};
+
+
+enum ETopBtnType {
+ TOP_BTN_TYPE_PLAYBACK,
+ TOP_BTN_TYPE_SOURCE,
+ TOP_BTN_TYPE_SORT,
+};
+
+enum EPlayStatus {
+ PLAY_STATUS_INITIAL = -1,
+ PLAY_STATUS_STOP,
+ PLAY_STATUS_PLAY,
+ PLAY_STATUS_PAUSE
+};
+
+enum EShuffleStatus {
+ SHUFFLE_STATUS_OFF = 0,
+ SHUFFLE_STATUS_ON
+};
+
+enum ERepeatStatus {
+ REPEAT_STATUS_NONE = 0,
+ REPEAT_STATUS_ALL,
+ REPEAT_STATUS_ONE
+};
+
+enum update_type {
+ E_KEY_PRESS,
+ E_KEY_RELEASE,
+ E_PLAYLIST_UPDATE,
+ E_FOCUS_UPDATE,
+ E_LAYOUT_UPDATE,
+ E_DEPTH_UPDATE,
+ E_SONG_UPDATE
+};
+
+enum EListType {
+ LIST_TYPE_SONG,
+ LIST_TYPE_ALBUM,
+ LIST_TYPE_ALBUM_SONG,
+ LIST_TYPE_FOLDER,
+ LIST_TYPE_FOLDER_SONG,
+ LIST_TYPE_ARTIST,
+ LIST_TYPE_GENRE,
+ LIST_TYPE_PLAYLISTS,
+ LIST_TYPE_PLAYLISTS_SONG
+};
+
+enum cb_type {
+ E_SONG_COMPLETE,
+ E_CONTENT_UPDATE,
+ E_USB_CONNECT,
+ E_PLAYBACK_ERROR,
+ E_CALLBACK_MAX
+};
+
+enum EContextType {
+ CONTEXT_TYPE_SONG,
+ CONTEXT_TYPE_ALBUM,
+ CONTEXT_TYPE_ARTIST,
+ CONTEXT_TYPE_GENRE,
+ CONTEXT_TYPE_FOLDER,
+ CONTEXT_TYPE_PLAYLIST,
+ CONTEXT_TYPE_PLAYSONG
+};
+
+enum EActionType {
+ ACTION_TYPE_PLAY,
+ ACTION_TYPE_ADDNEXT,
+ ACTION_TYPE_ADDLAST,
+ ACTION_TYPE_DELETE,
+ ACTION_TYPE_ADDTO,
+ ACTION_TYPE_RENAME,
+ ACTION_TYPE_ADDSONG,
+ ACTION_TYPE_REMOVESONG,
+};
+
+struct SContentInfo {
+ enum EContextType type;
+ enum EPlayStatus status;
+
+ void (*update)(void *data, enum EActionType type, int id);
+ void (*close)(void *data);
+
+ void *cbdata;
+ void *context;
+};
+
+enum ECategoryType {
+ CAT_TYPE_ARTIST,
+ CAT_TYPE_GENRE,
+ CAT_TYPE_PLAYLISTS,
+ CAT_TYPE_PLAYLIST_NEW
+};
+
+struct SParcel {
+ SContentInfo *ctxtInfo;
+ int updateType;
+ const char *layoutId;
+ const char *keyEvent;
+};
+
+// this values should be defined
+#define KEY_PLAY "Play"
+#define KEY_ENTER "Enter"
+#define KEY_NEXT "Next"
+#define KEY_PREVIOUS "Previous"
+#define KEY_EXIT "Exit"
+
+
+#endif /* __COMMON_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __CONTEXT_VIEW_H__
+#define __CONTEXT_VIEW_H__
+
+
+struct SContentInfo;
+struct SRltvCtnt;
+
+class CContextView : public CBaseView, public CListenerMgr, public IKeyDownListener {
+private:
+ struct SContextView* m;
+
+private:
+ static void sm_CbRltdCtntSelected(void *data, Evas_Object *obj, const char *emission, const char *source);
+ static void sm_CbAddScroller(void *cookie, Evas_Object *base, Evas_Object **scroller);
+ void m_OnAddScroller(Evas_Object *base, Evas_Object **scroller);
+
+private:
+ Evas_Object *m_AddScroller(Evas_Object *base);
+ void m_SetBtnDownFocus(Evas_Object *btn);
+ void m_SetLayoutFocusOrder(Evas_Object *btn);
+ void m_SetBtnsFocusOrder(Evas_Object *btn, Evas_Object *prv,
+ int btnTypeIndex, int btnTypeFirst, int btnTypeLast);
+ bool m_AddBtnLabel(Evas_Object *btn, const char *txt);
+ bool m_AddBtnIcon(Evas_Object *btn, const char *icon);
+ bool m_AddBtnInfo(Evas_Object *btn, const char *icon, const char *txt);
+ Evas_Object *m_AddButton(Evas_Object *base);
+ Evas_Object *m_AddBtnBox(Evas_Object *base);
+ bool m_CreateBtnsPart(void);
+ Eina_List *m_OtherSongsOfArtist(char *artist, char *title);
+ Eina_List *m_OtherAlbumsOfArtist(char *artist, char *album);
+ Eina_List *m_OtherSimilarArtist(char *artist);
+ Eina_List *m_OtherSongsOfGenre(char *genre);
+ SRltvCtnt *m_InfoOfAlbum(char *album);
+ SRltvCtnt *m_InfoOfArtist(char *artist);
+ SRltvCtnt *m_InfoOfGenre(char *genre);
+ bool m_GetContextDetails(SContentInfo *cinfo, char **path,
+ char **title, char **subtitle, char **subtitle2,
+ char **rltvtitle, SRltvCtnt **ctntinfo,
+ Eina_List **rltvlist);
+ Evas_Object *m_AddRltvCtnt(Evas_Object *obj, char *name, char *icon);
+ bool m_AddTableContents(Eina_List *list);
+ Evas_Object *m_AddTable(Evas_Object *base);
+ bool m_CreateRltvContent(Eina_List *list);
+ bool m_CreateMoreinfoLayout(SRltvCtnt *rctnt, Evas_Object *img);
+ bool m_CreateInfoPart(void);
+ bool m_CreateFullView(void);
+
+protected:
+ virtual void t_OnShow(void);
+ virtual void t_OnHide(void);
+ virtual void t_OnUpdate(void* data);
+
+public:
+ CContextView(const char *pViewId) : CBaseView(pViewId), IKeyDownListener(this), m(0) {}
+ virtual ~CContextView() {}
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+
+ virtual Evas_Object* Base(void);
+
+public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+};
+
+
+#endif /*__CONTEXT_VIEW_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DBG_H__
+#define __DBG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "org.tizen.music-player-tv-ref"
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+/* enums */
+enum music_error_status {
+ MUSIC_ERROR = -1,
+ MUSIC_ERROR_NONE
+};
+
+#endif /* __DBG_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DEFINE_H__
+#define __DEFINE_H__
+
+/* TEXT */
+#define NO_MUSIC_MESSAGE N_("No Music")
+#define NO_MUSIC_MESSAGE_SUB \
+ "There is no music in selected source"
+#define NO_PLAYLIST_MESSAGE N_("No Music")
+#define NO_PLAYLIST_MESSAGE_SUB N_("No music in playback")
+#define MUSIC_TEXT_LOADING N_("Updating...")
+#define MUSIC_TEXT_PLAYBACK_ERROR \
+ N_("Could not read from source. Please check source.")
+
+#define MUSIC_STR_EMPTY ""
+#define MUSIC_STR_PLAY N_("Play")
+#define MUSIC_STR_ADDNEXT N_("Add Next")
+#define MUSIC_STR_ADDLAST N_("Add Last")
+#define MUSIC_TEXT_SONG N_("SONG")
+#define MUSIC_TEXT_ARTIST N_("ARTIST")
+#define MUSIC_TEXT_ALBUM N_("ALBUM")
+#define MUSIC_TEXT_GENRE N_("GENRE")
+#define MUSIC_TEXT_FOLDER N_("FOLDER")
+#define MUSIC_TEXT_PLAYLIST N_("PLAYLIST")
+#define MUSIC_TEXT_CREATE_PLAYLIST N_("Create Playlist")
+#define MUSIC_TEXT_MIN N_("min")
+#define MUSIC_TEXT_OK N_("OK")
+#define MUSIC_TEXT_EDIT_PLAYLIST N_("Edit playback")
+#define MUSIC_TEXT_CLEAR_PLAYLIST N_("Clear playback")
+#define MUSIC_TEXT_CANCEL N_("Cancel")
+#define MUSIC_TEXT_DESELECT N_("Deselect all")
+#define MUSIC_TEXT_DELETE N_("Delete")
+#define MUSIC_TEXT_SONGS N_("Songs")
+#define MUSIC_TEXT_PLAY_THIS N_("PLAY THIS")
+#define MUSIC_TEXT_ADD_NEXT N_("ADD NEXT")
+#define MUSIC_TEXT_ADD_LAST N_("ADD LAST")
+#define MUSIC_TEXT_DEL N_("DELETE")
+#define MUSIC_TEXT_PLAY N_("PLAY")
+#define MUSIC_TEXT_PAUSE N_("PAUSE")
+#define MUSIC_TEXT_ADD_TO_PLAYLIST N_("ADD TO PLAYLIST")
+#define MUSIC_TEXT_MOREINFO N_("More information")
+#define MUSIC_TEXT_SONG_RLTV N_("Other songs of artist")
+#define MUSIC_TEXT_ALBUM_RLTV N_("Other albums of artist")
+#define MUSIC_TEXT_ARTIST_RLTV N_("Other similar artists")
+#define MUSIC_TEXT_GENRE_RLTV N_("Other songs of genre")
+#define MUSIC_TEXT_SELECT_ALL N_("Select All")
+#define MUSIC_TEXT_DESELECT_ALL N_("Deselect All")
+#define MUSIC_TEXT_LIST_DONE N_("Done")
+#define MUSIC_TEXT_LIST_CANCEL N_("Cancel")
+#define MUSIC_TEXT_NEXT_MSG N_("Songs are added next to current playing.")
+#define MUSIC_TEXT_LAST_MSG N_("Songs are added to end of playback list.")
+#define MUSIC_TEXT_ADDTO_MSG N_("Songs are added to selected playlist.")
+#define MUSIC_TEXT_INUSE_MSG N_("List with same name exists. Give new name.")
+#define MUSIC_TEXT_RENAME N_("RENAME")
+#define MUSIC_TEXT_ADDSONG N_("ADD SONGS")
+#define MUSIC_TEXT_REMOVESONG N_("REMOVE SONGS")
+#define MUSIC_TEXT_LIST_CREATE_MSG N_("Select songs to create playlist.")
+#define MUSIC_TEXT_LIST_ADD_MSG N_("Select songs to add to playlist.")
+#define MUSIC_TEXT_LIST_REMOVE_MSG \
+ N_("Select songs to remove from playlist.")
+#define MUSIC_TEXT_NO_SONGS N_("There are no songs in the playlist")
+#define MUSIC_TEXT_REMOVE N_("Remove")
+#define MUSIC_TEXT_REMOVE_PLMSG \
+ N_("Are you sure to delete this playlist?")
+#define MUSIC_TEXT_REMOVE_SMSG \
+ N_("Are you sure to remove this song from playback?")
+#define MUSIC_TEXT_NOLIST_MSG \
+ N_("There are no playlists. Create one using \"PLAYLIST\".")
+#define MUSIC_TEXT_EMPTY_NAME \
+ N_("Playlist name can not be empty. Please give some name.")
+
+/* FONTS */
+#define FONT_STYLE_REGULAR "TizenSans"
+#define FONT_STYLE_BOLD "TizenSans:style=Bold"
+#define FONT_STYLE_MEDIUM "TizenSans:style=Medium"
+
+/* GENERAL */
+#define MAX_LENGTH 1024
+#define MUSIC_MESSAGE_LAYOUT "MUSIC_MESSAGE_LAYOUT"
+#define MUSIC_PART_MESSAGE "MUSIC_PART_MESSAGE"
+#define RGB_MUSIC 229 72 113
+#define RGBA_BLACK_BG 0 0 0 (255*0.9)
+#define RGBA_COLOR_BG RGB_MUSIC (255*0.25)
+
+/* BASE VIEW MACROS */
+#define BASE_VIEW_DATA "BASE_VIEW_DATA"
+#define MUSIC_BASE_VIEW "MUSIC_BASE_VIEW"
+
+#define MUSIC_TEXT_TITLE "MUSIC"
+#define MUSIC_TEXT_PLAYBACK_BTN "Playback"
+#define MUSIC_PART_TITLE "MUSIC_PART_TITLE"
+#define MUSIC_PART_MUSIC_ICON "MUSIC_PART_MUSIC_ICON"
+#define MUSIC_PART_PLAY_ICON "MUSIC_PART_PLAY_ICON"
+#define MUSIC_PART_PLAYBACK_ICON "MUSIC_PART_PLAY_ICON"
+#define MUSIC_PART_GROUPBTN_BOX "MUSIC_PART_GROUPBTN_BOX"
+#define MUSIC_PART_SOURCE_HOVERSEL "MUSIC_PART_SOURCE_HOVERSEL"
+#define MUSIC_PART_SORT_HOVERSEL "MUSIC_PART_SORT_HOVERSEL"
+#define MUSIC_PART_SORT_POPUP "MUSIC_PART_SORT_POPUP"
+#define MUSIC_PART_SOURCE_POPUP "MUSIC_PART_SOURCE_POPUP"
+#define MUSIC_PART_CONTENT "MUSIC_PART_CONTENT"
+#define MUSIC_PART_PLAYBACK_BTN "MUSIC_PART_PLAYBACK_BTN"
+#define MUSIC_PART_PLAYSONG_LBL "MUSIC_PART_PLAYSONG_LBL"
+#define MUSIC_PART_NO_CONTENT "MUSIC_PART_NO_CONTENT"
+#define MUSIC_PART_NO_CONTENT_SUB "MUSIC_PART_NO_CONTENT_SUB"
+
+ /* styles */
+#define MUSIC_STYLE_SORT_BTN "music_sortbtn"
+#define MUSIC_STYLE_SOURCE_BTN "music_sourcebtn"
+#define MUSIC_STYLE_HOVER_ENTRY "music_hover_entry"
+#define MUSIC_STYLE_HOVER_CTXPOPUP "music-common-popup"
+#define MUSIC_STYLE_GROUPBTN "menubtn"
+#define MUSIC_STYLE_PLAYSONG_LBL "slide_long"
+#define MUSIC_STYLE_PLAYBACK_BTN "playbackbtn"
+#define MUSIC_STYLE_WIN_FOCUS "invisible"
+#define MUSIC_STYLE_LOADING_POPUP "loading"
+#define MUSIC_STYLE_ERROR_POPUP "message"
+#define MUSIC_STYLE_LOADING_LABEL "popup/loading"
+#define MUSIC_STYLE_ERROR_LABEL "popup/message"
+
+/* PLAYBACK VIEW MACROS */
+#define PLAYBACK_VIEW_DATA "PLAYBACK_VIEW_DATA"
+
+#define MUSIC_PLAYBACK_VIEW "MUSIC_PLAYBACK_VIEW"
+#define MUSIC_SETTINGS_LAYOUT "MUSIC_SETTINGS_LAYOUT"
+#define MUSIC_VOLUME_LAYOUT "MUSIC_VOLUME_LAYOUT"
+
+#define MUSIC_PART_ALBUMCOVER "MUSIC_PART_ALBUMCOVER"
+#define MUSIC_PART_PROGRESSTIME "MUSIC_PART_PROGRESSTIME"
+#define MUSIC_PART_PROGRESSBAR "MUSIC_PART_PROGRESSBAR"
+#define MUSIC_PART_FULLTIME "MUSIC_PART_FULLTIME"
+#define MUSIC_PART_SONGINFO "MUSIC_PART_SONGINFO"
+#define MUSIC_PART_CONTROLBTNS "MUSIC_PART_CONTROLBTNS"
+#define MUSIC_PART_EDITBTNS "MUSIC_PART_EDITBTNS"
+#define MUSIC_PART_SONG_TITLE "MUSIC_PART_SONG_TITLE"
+#define MUSIC_PART_ARTIST_ALBUM "MUSIC_PART_ARTIST_ALBUM"
+#define MUSIC_PART_PLAYLIST "MUSIC_PART_PLAYLIST"
+#define MUSIC_PART_SETTINGS_BTNBOX "MUSIC_PART_SETTINGS_BTNBOX"
+#define MUSIC_PART_SETTINGS_POPUP "MUSIC_PART_SETTINGS_POPUP"
+#define MUSIC_PART_PLAYBACK_SHADOW "MUSIC_PART_PLAYBACK_SHADOW"
+#define MUSIC_PART_VOLUME_BAR "MUSIC_PART_VOLUME_BAR"
+#define MUSIC_PART_VOLUME_LAYOUT "MUSIC_PART_VOLUME_LAYOUT"
+#define MUSIC_PART_VOLUME_VALUE "MUSIC_PART_VOLUME_VALUE"
+
+#define MUSIC_CONTROL_BTNS_PADDING 26
+#define MUSIC_EDIT_BTNS_PADDING 10
+
+ /* styles */
+#define MUSIC_STYLE_BTN_SETTINGS "music_btn_settings"
+#define MUSIC_STYLE_BTN_SHUFFLE "music_btn_shuffle"
+#define MUSIC_STYLE_BTN_REPEAT "music_btn_repeat"
+#define MUSIC_STYLE_BTN_PLAY "music_btn_play"
+#define MUSIC_STYLE_BTN_REWIND "music_btn_rewind"
+#define MUSIC_STYLE_BTN_FORWARD "music_btn_forward"
+#define MUSIC_STYLE_EDIT_BTN "music_btn_edit"
+#define MUSIC_STYLE_SETTING_BTN_T "music_btn_settings_option_t"
+#define MUSIC_STYLE_SETTING_BTN_B "music_btn_settings_option_b"
+#define MUSIC_STYLE_SLIDER "music_progress_slider"
+#define MUSIC_STYLE_SETTING_POPUP "music-common-popup"
+#define MUSIC_STYLE_PLAYLIST_ODD "music_playlist_odd"
+#define MUSIC_STYLE_PLAYLIST_EVEN "music_playlist_even"
+#define MUSIC_STYLE_PLAYLIST "music_playlist"
+#define MUSIC_STYLE_VOLUME_BAR "music_volume_bar"
+
+/* CONTEXT VIEW MACROS */
+#define CONTEXT_VIEW_DATA "CONTEXT_VIEW_DATA"
+#define MUSIC_CONTEXT_VIEW "MUSIC_CONTEXT_VIEW"
+#define MUSIC_CONTEXT_BTN "MUSIC_CONTEXT_BTN"
+#define MUSIC_CONTEXT_INFO "MUSIC_CONTEXT_INFO"
+#define MUSIC_CONTEXT_REL_CONTENT "MUSIC_CONTEXT_REL_CONTENT"
+#define MUSIC_PART_CTXT_ICON "MUSIC_PART_CTXT_ICON"
+#define MUSIC_PART_CTXT_TITLE "MUSIC_PART_CTXT_TITLE"
+#define MUSIC_PART_CTXT_SUBTITLE "MUSIC_PART_CTXT_SUBTITLE"
+#define MUSIC_PART_CTXT_SUBTITLE2 "MUSIC_PART_CTXT_SUBTITLE2"
+#define MUSIC_PART_CTXT_BTNAREA "MUSIC_PART_CTXT_BTNAREA"
+#define MUSIC_PART_CTXT_BTNBG "MUSIC_PART_CTXT_BTNBG"
+#define MUSIC_PART_CTXT_BTNICON "MUSIC_PART_CTXT_BTNICON"
+#define MUSIC_PART_CTXT_BTNTEXT "MUSIC_PART_CTXT_BTNTEXT"
+#define MUSIC_PART_CTXT_RELCTNTTEXT "MUSIC_PART_CTXT_RELCTNTTEXT"
+#define MUSIC_PART_CTXT_RELCTNTAREA "MUSIC_PART_CTXT_RELCTNTAREA"
+#define MUSIC_PART_CTXT_BTNBG_NOR "function_button_nor.png"
+#define MUSIC_PART_CTXT_BTNBG_FOC "function_button_foc.png"
+#define MUSIC_PART_CTXT_RELCTNT_ICON "MUSIC_PART_CTXT_RELCTNT_ICON"
+#define MUSIC_PART_CTXT_RELCTNT_NAME "MUSIC_PART_CTXT_RELCTNT_NAME"
+#define MUSIC_PART_CTXT_INFO "MUSIC_PART_CTXT_INFO"
+#define MUSIC_PART_CTXT_INFOICON "MUSIC_PART_CTXT_INFOICON"
+#define MUSIC_PART_CTXT_INFOTEXT "MUSIC_PART_CTXT_INFOTEXT"
+#define MUSIC_PART_LIST_POPUP "MUSIC_PART_LIST_POPUP"
+#define MUSIC_PART_PLIST_POPUP "MUSIC_PART_PLIST_POPUP"
+#define MUSIC_PART_RPOPUP_TITLE "title,text"
+#define MUSIC_PART_RPOPUP_BTN1 "button1"
+#define MUSIC_PART_RPOPUP_BTN2 "button2"
+#define MUSIC_STYLE_TOPTEXT_BTN "music_toptext_btn"
+#define MUSIC_STYLE_BOTTOMTEXT_BTN "music_bottomtext_btn"
+#define MUSIC_STYLE_MIDDLETEXT_BTN "music_middletext_btn"
+#define MUSIC_STYLE_LIST_POPUP "music_listpopup"
+#define MUSIC_STYLE_REMOVE_POPUP "title.3line.2button"
+#define MUSIC_STYLE_REMOVE_LABEL "popup/title.3line.2button"
+
+/* SONG LAYOUT MACROS */
+#define SONG_LAYOUT_DATA "SONG_LAYOUT_DATA"
+#define MUSIC_SONG_LAYOUT "MUSIC_SONG_LAYOUT"
+#define MUSIC_PART_SONGLIST "MUSIC_PART_SONGLIST"
+#define MUSIC_STYLE_SONGLIST "music_songlist"
+
+/* ALBUM LAYOUT MACROS */
+#define ALBUM_LAYOUT_DATA "ALBUM_LAYOUT_DATA"
+#define MUSIC_ALBUM_LAYOUT "MUSIC_ALBUM_LAYOUT"
+#define MUSIC_PART_ALBUM_GRID "MUSIC_PART_ALBUM_GRID"
+#define MUSIC_STYLE_ALBUM_GRID "music_albumgrid"
+
+/* FOLDER LAYOUT MACROS */
+#define FOLDER_LAYOUT_DATA "FOLDER_LAYOUT_DATA"
+#define MUSIC_FOLDER_LAYOUT "MUSIC_FOLDER_LAYOUT"
+#define MUSIC_PART_FOLDER_GRID "MUSIC_PART_FOLDER_GRID"
+#define MUSIC_STYLE_FOLDER_GRID "music_albumgrid"
+#define MUSIC_PART_FOLDER_NAME "MUSIC_PART_FOLDER_NAME"
+#define MUSIC_PART_FOLDER_SONGCOUNT "MUSIC_PART_FOLDER_SONGCOUNT"
+#define MUSIC_PART_FOLDER_TIME "MUSIC_PART_FOLDER_TIME"
+#define MUSIC_PART_FOLDER_PLAYBTN "MUSIC_PART_FOLDER_PLAYBTN"
+#define MUSIC_PART_FOLDER_NEXTBTN "MUSIC_PART_FOLDER_NEXTBTN"
+#define MUSIC_PART_FOLDER_LASTBTN "MUSIC_PART_FOLDER_LASTBTN"
+
+/* CATEGORY LAYOUT MACROS */
+#define CATEGORY_LAYOUT_DATA "CATEGORY_LAYOUT_DATA"
+#define MUSIC_CATEGORY_LAYOUT "MUSIC_CATEGORY_LAYOUT"
+#define MUSIC_CATEGORY_ARTIST_LAYOUT "MUSIC_CATEGORY_ARTIST_LAYOUT"
+#define MUSIC_CATEGORY_GENRE_LAYOUT "MUSIC_CATEGORY_GENRE_LAYOUT"
+#define MUSIC_CATEGORY_PLAYLISTS_LAYOUT "MUSIC_CATEGORY_PLAYLISTS_LAYOUT"
+#define MUSIC_CATEGORY_ALBUM_LAYOUT "MUSIC_CATEGORY_ALBUM_LAYOUT"
+#define MUSIC_CATEGORY_SONGS_LAYOUT "MUSIC_CATEGORY_SONGS_LAYOUT"
+#define MUSIC_CATEGORY_SELECTLIST_LAYOUT "MUSIC_CATEGORY_SELECTLIST_LAYOUT"
+#define MUSIC_PART_CATEGORY_GRID "MUSIC_PART_CATEGORY_GRID"
+#define MUSIC_PART_CATEGORY_ALBUM_GRID "MUSIC_PART_CATEGORY_ALBUM_GRID"
+#define MUSIC_PART_CATEGORY_NAME "MUSIC_PART_CATEGORY_NAME"
+#define MUSIC_PART_SONG_IMAGE "MUSIC_PART_SONG_IMAGE"
+#define MUSIC_PART_CATEGORY_SONGCOUNT "MUSIC_PART_CATEGORY_SONGCOUNT"
+#define MUSIC_PART_ALBUM_IMAGE "MUSIC_PART_ALBUM_IMAGE"
+#define MUSIC_PART_CATEGORY_ALBUMCOUNT "MUSIC_PART_CATEGORY_ALBUMCOUNT"
+#define MUSIC_PART_CATEGORY_PLAYBTN "MUSIC_PART_CATEGORY_PLAYBTN"
+#define MUSIC_PART_CATEGORY_NEXTBTN "MUSIC_PART_CATEGORY_NEXTBTN"
+#define MUSIC_PART_CATEGORY_LASTBTN "MUSIC_PART_CATEGORY_LASTBTN"
+#define MUSIC_PART_LIST_SELECT_ALL "MUSIC_PART_LIST_SELECT_ALL"
+#define MUSIC_PART_LIST_DONE_BTN "MUSIC_PART_LIST_DONE_BTN"
+#define MUSIC_PART_LIST_CANCEL_BTN "MUSIC_PART_LIST_CANCEL_BTN"
+#define MUSIC_PART_LIST_MSG "MUSIC_PART_LIST_MSG"
+#define MUSIC_STYLE_CATEGORY_GRID "music_albumgrid"
+#define MUSIC_STYLE_LIST_BTN "music_listbtn"
+#define MUSIC_STYLE_SELECT_LIST "music_selectlist"
+
+/* GENRE LAYOUT MACROS */
+#define GENRE_LAYOUT_DATA "GENRE_LAYOUT_DATA"
+#define MUSIC_GENRE_LAYOUT "MUSIC_GENRE_LAYOUT"
+
+/* ALBUM SONGS LAYOUT MACROS */
+#define ALBUM_SONGS_LAYOUT_DATA "ALBUM_SONGS_LAYOUT_DATA"
+#define MUSIC_ALBUM_SONGS_LAYOUT "MUSIC_ALBUM_SONGS_LAYOUT"
+#define MUSIC_STYLE_ALBUM_SONGLIST "music_album_songlist"
+#define MUSIC_PART_ALBUM_THUMB "MUSIC_PART_ALBUM_THUMB"
+#define MUSIC_PART_ALBUM_NAME "MUSIC_PART_ALBUM_NAME"
+#define MUSIC_PART_ALBUM_ARTIST "MUSIC_PART_ALBUM_ARTIST"
+#define MUSIC_PART_COUNT_IMAGE "MUSIC_PART_COUNT_IMAGE"
+#define MUSIC_PART_ALBUM_SONGCOUNT "MUSIC_PART_ALBUM_SONGCOUNT"
+#define MUSIC_PART_TIME_IMAGE "MUSIC_PART_TIME_IMAGE"
+#define MUSIC_PART_ALBUM_TIME "MUSIC_PART_ALBUM_TIME"
+#define MUSIC_PART_ALBUM_PLAYBTN "MUSIC_PART_ALBUM_PLAYBTN"
+#define MUSIC_PART_ALBUM_NEXTBTN "MUSIC_PART_ALBUM_NEXTBTN"
+#define MUSIC_PART_ALBUM_LASTBTN "MUSIC_PART_ALBUM_LASTBTN"
+ /* styles */
+#define MUSIC_STYLE_ADD_PLAY_BTN "add_play_btn"
+#define MUSIC_STYLE_ADD_NEXT_BTN "add_next_btn"
+#define MUSIC_STYLE_ADD_LAST_BTN "add_last_btn"
+
+/* ENTRY POPUP LAYOUT MACROS */
+#define MUSIC_ENTRY_POPUP_LAYOUT "MUSIC_ENTRY_POPUP_LAYOUT"
+#define MUSIC_ENTRY_POPUP_DATA "MUSIC_ENTRY_POPUP_DATA"
+#define MUSIC_PART_ENTRY "MUSIC_PART_ENTRY"
+#define MUSIC_STYLE_ENTRY "focus"
+
+/* SIGNAL MACROS */
+#define MUSIC_SIGNAL_CLICKED "clicked"
+#define MUSIC_SIGNAL_FOCUSED "focused"
+#define MUSIC_SIGNAL_UNFOCUSED "unfocused"
+#define MUSIC_SIGNAL_SELECTED "selected"
+#define MUSIC_SIGNAL_REPEATED "repeated"
+#define MUSIC_SIGNAL_PRESSED "pressed"
+#define MUSIC_SIGNAL_UNPRESSED "unpressed"
+#define MUSIC_SIGNAL_CHANGED "changed"
+#define MUSIC_SIGNAL_ACTIVATED "activated"
+#define MUSIC_SIGNAL_REALIZED "realized"
+#define MUSIC_SIGNAL_UNREALIZED "unrealized"
+#define MUSIC_SIGNAL_SHOW "show"
+#define MUSIC_SIGNAL_HIDE "hide"
+#define MUSIC_SIGNAL_HIDELINE "MUSIC_SIGNAL_HIDELINE"
+#define MUSIC_SIGNAL_BTN_CLICKED "MUSIC_SIGNAL_BTN_CLICKED"
+#define MUSIC_SIGNAL_GROUP_SELECTED "MUSIC_SIGNAL_GROUP_SELECTED"
+#define MUSIC_SIGNAL_GROUP_UNSELECTED "MUSIC_SIGNAL_GROUP_UNSELECTED"
+#define MUSIC_SIGNAL_CONTROL_SELECTED "MUSIC_SIGNAL_CONTROL_SELECTED"
+#define MUSIC_SIGNAL_EDIT_MODE "MUSIC_SIGNAL_EDIT_MODE"
+#define MUSIC_SIGNAL_PLAYBACK_MODE "MUSIC_SIGNAL_PLAYBACK_MODE"
+#define MUSIC_SIGNAL_SHUFFLE_OFF "MUSIC_SIGNAL_SHUFFLE_OFF"
+#define MUSIC_SIGNAL_SHUFFLE_ON "MUSIC_SIGNAL_SHUFFLE_ON"
+#define MUSIC_SIGNAL_REPEAT_OFF "MUSIC_SIGNAL_REPEAT_OFF"
+#define MUSIC_SIGNAL_REPEAT_ALL "MUSIC_SIGNAL_REPEAT_ALL"
+#define MUSIC_SIGNAL_REPEAT_ONE "MUSIC_SIGNAL_REPEAT_ONE"
+#define MUSIC_SIGNAL_PLAY "MUSIC_SIGNAL_PLAY"
+#define MUSIC_SIGNAL_PAUSE "MUSIC_SIGNAL_PAUSE"
+#define MUSIC_SIGNAL_SELECT_ITEM "MUSIC_SIGNAL_SELECT_ITEM"
+#define MUSIC_SIGNAL_UNSELECT_ITEM "MUSIC_SIGNAL_UNSELECT_ITEM"
+#define MUSIC_SIGNAL_EDITMODE_ON "MUSIC_SIGNAL_EDITMODE_ON"
+#define MUSIC_SIGNAL_EDITMODE_OFF "MUSIC_SIGNAL_EDITMODE_OFF"
+#define MUSIC_SIGNAL_CHECK_ON "MUSIC_SIGNAL_CHECK_ON"
+#define MUSIC_SIGNAL_CHECK_OFF "MUSIC_SIGNAL_CHECK_OFF"
+#define MUSIC_SIGNAL_CHECK_CLICKED "MUSIC_SIGNAL_CHECK_CLICKED"
+#define MUSIC_SIGNAL_ODD_ROW "MUSIC_SIGNAL_ODD_ROW"
+#define MUSIC_SIGNAL_EVEN_ROW "MUSIC_SIGNAL_EVEN_ROW"
+#define MUSIC_SIGNAL_VOLUME_MUTE "MUSIC_SIGNAL_VOLUME_MUTE"
+#define MUSIC_SIGNAL_VOLUME_UNMUTE "MUSIC_SIGNAL_VOLUME_UNMUTE"
+#define MUSIC_SIGNAL_CONTENT_CLICKED "MUSIC_SIGNAL_CONTENT_CLICKED"
+#define MUSIC_SIGNAL_SHOW_PLAYLIST "MUSIC_SIGNAL_SHOW_PLAYLIST"
+
+/* IMAGE FILES */
+#define MUSIC_IMAGE_GRPBTN_SONG "ico_music_song.png"
+#define MUSIC_IMAGE_GRPBTN_ALBUM "ico_music_album.png"
+#define MUSIC_IMAGE_GRPBTN_ARTIST "ico_music_artist.png"
+#define MUSIC_IMAGE_GRPBTN_GENRE "ico_music_genre.png"
+#define MUSIC_IMAGE_GRPBTN_FOLDER "ico_music_folder.png"
+#define MUSIC_IMAGE_GRPBTN_PLAYLISTS "ico_music_playlist.png"
+#define MUSIC_IMAGE_CREATE_PLAYLIST "ico_newlist_music_126.png"
+#define MUSIC_IMAGE_ICON "ico_music.png"
+#define MUSIC_IMAGE_PLAY_ICON "music_ico_play.png"
+#define MUSIC_IMAGE_PLAYBACK_ICON "music_ico_playback.png"
+#define MUSIC_IMAGE_PLAYBACK_ROUND_ICON "round_rectangle_4X4.png"
+#define MUSIC_IMAGE_PLAYBACK_ROUNDT_ICON "round_rectangle_4X4_top.png"
+#define MUSIC_IMAGE_PLAYBACK_ROUNDB_ICON "round_rectangle_4X4_bottom.png"
+#define MUSIC_GROUPBTN_BG "allbrowser_menu_bg.png"
+#define MUSIC_IMAGE_BTN_NORMAL_BG "btn_bg_round_stroke.png"
+#define MUSIC_IMAGE_BTN_FOCUS_BG "btn_bg_round_72x72.png"
+#define MUSIC_IMAGE_BTN_SETTINGS "ico_setting.png"
+#define MUSIC_IMAGE_BTN_REWIND "ico_rew.png"
+#define MUSIC_IMAGE_BTN_FORWARD "ico_ff.png"
+#define MUSIC_IMAGE_BTN_SHUFFLE_OFF "ico_shuffle_off.png"
+#define MUSIC_IMAGE_BTN_SHUFFLE_ON "ico_shuffle_on.png"
+#define MUSIC_IMAGE_BTN_REPEAT_OFF "ico_repeat_off.png"
+#define MUSIC_IMAGE_BTN_REPEAT_ON "ico_repeat_on.png"
+#define MUSIC_IMAGE_BTN_REPEAT_ONLY "ico_repeat_only.png"
+#define MUSIC_IMAGE_BTN_PLAY "ico_play.png"
+#define MUSIC_IMAGE_BTN_PAUSE "ico_pause.png"
+#define MUSIC_IMAGE_SLIDER_NOB_NORMAL "music_progressbar_handle_nor.png"
+#define MUSIC_IMAGE_SLIDER_NOB_FOCUS "music_progressbar_handle_foc.png"
+#define MUSIC_IMAGE_SLIDER_NOB_DIM "music_progressbar_handle_dim.png"
+#define MUSIC_IMAGE_PLAYBACK_SHADOW "music_playback_shadow.png"
+#define MUSIC_IMAGE_UNCHECK_NORMAL "checkbox_uncheck_nor.png"
+#define MUSIC_IMAGE_UNCHECK_FOCUS "checkbox_uncheck_foc.png"
+#define MUSIC_IMAGE_UNCHECK_DIM "checkbox_uncheck_dim.png"
+#define MUSIC_IMAGE_CHECK_NORMAL "checkbox_check_nor.png"
+#define MUSIC_IMAGE_CHECK_FOCUS "checkbox_check_foc.png"
+#define MUSIC_IMAGE_CHECK_DIM "checkbox_check_dim.png"
+#define MUSIC_IMAGE_TICK "ico_check_foc.png"
+#define MUSIC_IMAGE_POPUP_DOWN_ARROW "popover_arrow_down.png"
+#define MUSIC_IMAGE_PULLDOWN_ARROW "ico_pulldown_nor.png"
+#define MUSIC_IMAGE_DEFAULT_THUMB "ico_default_music_79.png"
+#define MUSIC_IMAGE_DEFAULT_THUMB_450 "ico_default_music_450.png"
+#define MUSIC_IMAGE_DEFAULT_THUMB_126 "ico_default_music_126.png"
+#define MUSIC_IMAGE_DEFAULT_THUMB_180 "ico_default_music_180.png"
+#define MUSIC_IMAGE_ADDBTN_BG_NORMAL "music_bg_button_nor.png"
+#define MUSIC_IMAGE_ADDBTN_BG_FOCUS "music_bg_button_foc.png"
+#define MUSIC_IMAGE_SONG_COUNT "music_ico_song.png"
+#define MUSIC_IMAGE_ALBUM_TIME "music_ico_time.png"
+#define MUSIC_IMAGE_ADD_PLAY "music_ico_add_play.png"
+#define MUSIC_IMAGE_ADD_NEXT "music_ico_add_next.png"
+#define MUSIC_IMAGE_ADD_LAST "music_ico_add_last.png"
+#define MUSIC_IMAGE_FOLDER "ico_folder.png"
+#define MUSIC_IMAGE_BACK "music_ico_back.png"
+#define MUSIC_IMAGE_ALBUM_COUNT "music_ico_album.png"
+#define MUSIC_IMAGE_LOADING "loading_48_01.png"
+#define MUSIC_IMAGE_CTXT_BG "contextual_menu_bg.png"
+#define MUSIC_IMAGE_CTXT_ITEM_BG "focused_app_bg.png"
+#define MUSIC_IMAGE_CTXT_BTNBG_NOR "function_button_nor.png"
+#define MUSIC_IMAGE_CTXT_BTNBG_FOC "function_button_foc.png"
+#define MUSIC_IMAGE_CTXT_BTNPLAY "ico_play_nor.png"
+#define MUSIC_IMAGE_CTXT_BTNPAUSE "ico_pause_nor.png"
+#define MUSIC_IMAGE_CTXT_BTNNEXT "ico_addnext_nor.png"
+#define MUSIC_IMAGE_CTXT_BTNLAST "ico_addlast_nor.png"
+#define MUSIC_IMAGE_CTXT_ADDTO "ico_addto_nor.png"
+#define MUSIC_IMAGE_CTXT_BTNDEL "ico_del_nor.png"
+#define MUSIC_IMAGE_CTXT_ARROW "ico_arrow_20.png"
+#define MUSIC_IMAGE_CTXT_RENAME "ico_rename_nor.png"
+#define MUSIC_IMAGE_CTXT_ADDSONG "ico_add_nor.png"
+#define MUSIC_IMAGE_CTXT_REMOVESONG "ico_remove_nor.png"
+#define MUSIC_IMAGE_POPUP_UP_ARROW "popover_arrow_up.png"
+
+/* SWALLOW ICONS */
+#define MUSIC_PART_ELM_SWALLOWICON "MUSIC_PART_ELM_SWALLOWICON"
+#define MUSIC_SWALLOW_ICON "elm.swallow.icon"
+#define MUSIC_PART_POPUP_BUTTON "button1"
+
+#endif /* __DEFINE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ENTRY_POPUP_H__
+#define __ENTRY_POPUP_H__
+
+Evas_Object *create_entry_popup(Evas_Object *base, const char *text,
+ void (*)(void *, const char *), void *data);
+void destroy_entry_popup(Evas_Object *layout);
+
+#endif /* __ENTRY_POPUP_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __FOLDER_LAYOUT_H__
+#define __FOLDER_LAYOUT_H__
+
+
+struct SFolderItemInfo;
+struct folder_info;
+
+class CFolderLayout : public CExtBaseLayout, public CListenerMgr, public IKeyDownListener {
+private:
+ struct SFolderLayout *m;
+
+private:
+ static Eina_Bool sm_CbFocusIdler(void *dt);
+ static void sm_CbGoToContextView(void *cookie, SContentInfo *contextInfo);
+ static void sm_CbUpdateGrid(void *cookie);
+ static void sm_CbGoToPlaybackView(void *cookie, int mode, char *mediaId);
+
+ static char *sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part);
+ static char *sm_CbGetGridSongItemText(void *data, Evas_Object *obj, const char *part);
+ static Evas_Object *sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part);
+ static Evas_Object *sm_CbGetGridSongItemContent(void *data, Evas_Object *obj, const char *part);
+ static void sm_CbRemoveGridItem(void *data, Evas_Object *obj);
+
+private:
+ void m_OnFocusIdler(void);
+ void m_OnGotoPlaybackView(char *mediaId);
+ void m_OnGotoContextView(SContentInfo *contextInfo);
+ void m_OnCbUpdateGrid(void);
+
+private:
+ inline int m_ConvertToMin(int milsec);
+ void m_RemoveFocusIdler(void);
+ void m_GotoPlayback(int mode, char *id);
+ SFolderItemInfo *m_FindItemInfo(Eina_List *list, Elm_Object_Item *item);
+ Elm_Object_Item *m_FindItemByInfo(Eina_List *list, folder_info *finfo);
+ void m_SortFolderGrid(void);
+ void m_CreateFolderGrid(void);
+ void m_EmptyFolderGrid(bool sort_flag);
+ void m_UpdateFolderGrid(bool sort_flag);
+ void m_CreateTopsection(void);
+
+protected:
+ virtual void t_OnShow(void);
+
+public:
+ CFolderLayout(const char *pLayoutId) : CExtBaseLayout(pLayoutId), IKeyDownListener(this), m(0) {}
+ virtual ~CFolderLayout() {}
+
+ bool Create(CLayoutMgr *mgr);
+ virtual void Destroy(void);
+
+ virtual void Update(bool focusFlag);
+
+public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+};
+
+
+#endif /*__FOLDER_LAYOUT_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FOLDER_INFO_H__
+#define __FOLDER_INFO_H__
+
+struct folder_info {
+ char *folder_id;
+ char *name;
+ int count;
+ int duration;
+};
+
+struct folder_info *folder_info_create();
+void folder_info_destroy(struct folder_info *finfo);
+
+int folder_info_get_count(struct folder_info *cfinfo);
+int folder_info_get_duration(struct folder_info *cfinfo);
+char *folder_info_get_name(struct folder_info *cfinfo);
+char *folder_info_get_folder_id(struct folder_info *cfinfo);
+struct folder_info *folder_info_duplicate(struct folder_info *s_finfo);
+int sortfolders_za(const void *d1, const void *d2);
+int sortfolders_az(const void *d1, const void *d2);
+
+#endif /*__FOLDER_INFO_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __GENRE_LAYOUT_H__
+#define __GENRE_LAYOUT_H__
+
+
+class CGenreLayout : public CCategoryLayout {
+private:
+ struct SArtistLayout* m;
+
+protected:
+ virtual void t_HandleItemSelect(SCatItemInfo *itinfo);
+ virtual bool t_GetMediaList(Eina_List **list);
+ virtual EContextType t_ContextType(void){ return CONTEXT_TYPE_GENRE; }
+ virtual ECategoryType t_CategoryType(void) { return CAT_TYPE_GENRE; }
+
+public:
+ CGenreLayout(const char *pLayoutId) : CCategoryLayout(pLayoutId), m(0) {}
+ virtual ~CGenreLayout(){}
+};
+
+
+#endif /* __GENRE_LAYOUT_H__ */
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __I18N_H__
+#define __I18N_H__
+
+#include <libintl.h>
+
+#define i18n_init() bindtextdomain(PACKAGE, LOCALEDIR)
+
+#ifdef _
+#undef _
+#endif
+#define _(s) dgettext(PACKAGE, s)
+#define dgettext_noop(s) (s)
+
+#ifdef N_
+#undef N_
+#endif
+#define N_(s) dgettext_noop(s)
+
+#endif /* __I18N_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __MEDIA_DATA_H__
+#define __MEDIA_DATA_H__
+
+struct mediadata;
+struct album_info;
+struct category_info;
+struct folder_info;
+
+#include <media_content.h>
+#include "common.h"
+
+class CMediadata {
+private:
+ struct SMediadata* m;
+
+private:
+ static void sm_CbContentUpdate(media_content_error_e err, int pid,
+ media_content_db_update_item_type_e update_item,
+ media_content_db_update_type_e update_type,
+ media_content_type_e media_type,
+ char *uuid, char *path, char *mime_type,
+ void *dt);
+ static bool sm_CbTotalDuration(media_info_h md_h, void *dt);
+ static bool sm_CbEachMediaData(media_info_h md_h, void *dt);
+ static bool sm_CbEachFolderData(media_folder_h folder_h, void *dt);
+ static bool sm_CbEachAlbumData(media_album_h album_h, void *dt);
+ static bool sm_CbEachPlaylist(media_playlist_h ph, void *dt);
+ static bool sm_CbPlaylistMember(int memb_id, media_info_h mdh, void *dt);
+ static bool sm_CbPlaylist(media_playlist_h ph, void *dt);
+
+private:
+ void m_HandleContentUpdate(media_content_error_e err, int pid,
+ media_content_db_update_item_type_e update_item,
+ media_content_db_update_type_e update_type,
+ media_content_type_e media_type,
+ char *uuid, char *path, char *mime_type);
+ bool m_HandleEachMediaData(media_info_h md_h);
+ bool m_HandleEachFolderData(media_folder_h folder_h);
+ bool m_HandleEachAlbumData(media_album_h album_h);
+ bool m_HandleEachPlaylist(media_playlist_h ph);
+ void m_DeleteSongList(void);
+ void m_DeleteFolderSongList(void);
+ void m_DeleteAlbumSongList(void);
+ void m_DeletePlaylistSongList(void);
+ void m_DeleteFolderList(void);
+ void m_DeleteAlbumList(void);
+ void m_DeleteCategoryList(ECategoryType type);
+ bool m_CreateFilter(void);
+ bool m_DestroyFilter(void);
+ int m_GetPlaylistList(void);
+ void m_GetCategoryList(ECategoryType type);
+ int m_GetPlaylistSongList(category_info *catinfo);
+ int m_GetFolderSongList(folder_info *finfo);
+ int m_GetFolderList(void);
+ int m_GetAlbumSongList(album_info *alinfo);
+ int m_GetAlbumList(void);
+ int m_GetSongList(void);
+ void m_UpdateLists(void);
+
+public:
+ CMediadata() : m(0) {}
+ virtual ~CMediadata() {}
+ bool FlagCreate(void) { return !!m; }
+
+ bool Create(void);
+ virtual void Destroy(void);
+
+ struct SSongInfo *SongByUri(char *uri);
+ Eina_List *Medialist(int source_type, int EListType, void *info);
+ struct SCbInfo *AddCallback(int type, void(*cb)(void *dt), void *data);
+ bool RemoveCallback(struct SCbInfo *cbinfo);
+ bool SetPlayedTime(char *media_id);
+ bool InsertPlaylist(const char *name, Eina_List *idlist);
+ bool ExistPlaylist(const char *name);
+ bool DeletePlaylist(int id);
+ bool RenamePlaylist(int id, const char *name);
+ bool AddmediaPlaylist(int lid, Eina_List *idlist);
+ bool RemovemediaPlaylist(int lid, Eina_List *idlist);
+
+ static Eina_List *PlaylistsForCtxt(void);
+};
+
+#endif /*__MEDIA_DATA_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MUSIC_CONTROLLER_H__
+#define __MUSIC_CONTROLLER_H__
+
+
+#include <Eina.h>
+//#include <usb-device.h>
+
+struct SSongInfo;
+struct album_info;
+
+
+class IMusicControllerListener {
+private:
+ static void sm_CbComplete(void *cookie);
+ static void sm_CbError(void *cookie);
+ static void sm_CbUsbConnected(void *cookie);
+ static void sm_CbUpdateContent(void *cookie);
+
+protected:
+ virtual void t_OnComplete(void) = 0;
+ virtual void t_OnError(void) = 0;
+ virtual void t_OnUsbConnected(void) = 0;
+ virtual void t_OnUpdateContent(void) = 0;
+};
+
+
+class CMusicController {
+private:
+ static CMusicController *instance;
+ static int refCnt;
+ struct SMusicController *m;
+
+private:
+
+ enum EDirectionType {
+ DIR_PREVIOUS,
+ DIR_NEXT
+ };
+
+ enum ENextType {
+ E_ON_COMPLETE,
+ E_BUTTON_CLICK
+ };
+private:
+ CMusicController() {}
+ virtual ~CMusicController() {}
+
+private:
+ static void sm_CbPlaybackCompletion(void *data);
+ void m_OnPlaybackCompletion(void);
+
+ //static void sm_CbConnected(usb_device_h usb_device, char *action, void *dt);
+ //void m_OnConnected(usb_device_h usb_device, char *action);
+
+protected:
+ bool t_PlayNext(int direction, int playnext_type);
+ SMusicController* t_Create(void);
+ void t_Destroy(void);
+
+public:
+ static bool Initialize(void);
+ static void Finalize(void);
+
+ static CMusicController* GetInstance(void);
+
+ bool Start(void);
+ bool Stop(void);
+ bool Resume(void);
+ bool Pause(void);
+
+ bool AddListener(IMusicControllerListener *listener);
+ bool RemoveListener(IMusicControllerListener *listener);
+
+ bool GetCurrentSongIndex(int *ind);
+ bool SetCurrentSongIndex(int ind);
+ bool GetTotalSongs(int *ts);
+ bool GetSonginfoFromIndex(int index, struct SSongInfo **const csinfo);
+
+ int PlayState(void);
+ bool SetPlayState(int state);
+
+ int ShuffleState(void);
+ bool SetShuffleState(int state);
+
+ int RepeatState(void);
+ bool SetRepeatState(int state);
+
+ int SourceType(void);
+ int SortType(void);
+
+ bool SetSourceType(int type);
+ bool SetSortType(int type);
+ bool SetPosition(int milsec);
+ bool GetPosition(int *const milseconds);
+
+ bool SetCurrentSong(char *mediaid);
+
+ bool GetCurrentSong(struct SSongInfo **const sinfo);
+ bool SetCurrentAlbum(struct album_info *alinfo);
+
+ struct album_info *CurrentAlbum(void);
+
+ bool UpdatePlaylist(Eina_List *slist, int addmode);
+ bool EmptyPlaylist(void);
+ bool PlaylistUpdateShuffle(void);
+ bool PlayPreviousSong(void);
+ bool PlayNextSong(void);
+ bool PlayIndexSong(int index);
+ bool RemoveSong(struct SSongInfo *sinfo, int index);
+ bool CheckUsb(void);
+
+ bool MediaGetList(int EListType, void *info, Eina_List **list);
+ bool MediaInsertPlaylist(const char *name, Eina_List *idlist);
+ bool MediaExistPlaylist(const char *name);
+ bool MediaDeletePlaylist(int id);
+ bool MediaRenamePlaylist(int id, const char *name);
+ bool MediaAddmediaPlaylist(int id, Eina_List *idlist);
+ bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
+ bool MediaAddsongsPlaylist(int lid, Eina_List *list);
+ struct SSongInfo *MediaSongByUri(char *uri);
+};
+
+
+
+#endif /*__MUSIC_CONTROLLER_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PLAYBACK_MGR_H__
+#define __PLAYBACK_MGR_H__
+
+
+#include <player.h>
+
+
+class CPlayback {
+private:
+ struct SPlayback* m;
+
+public:
+
+ CPlayback() : m(0) {}
+ virtual ~CPlayback() {}
+ bool FlagCreate(void) { return !!m; }
+
+ bool Create(void);
+ virtual void Destroy(void);
+
+ bool SetCallback(player_completed_cb cbPlaybackCompletion, void *data);
+ bool UnsetCallback(void);
+
+ bool SetMute(bool flag);
+ bool SetLooping(bool flag);
+
+ bool Start(void);
+ bool Stop(void);
+
+ bool Resume(void);
+ bool Pause(void);
+
+ bool SetNextUri(const char *path);
+ bool SetUri(const char *path);
+ bool Prepare(void);
+ bool Unprepare(void);
+
+ bool SetPosition(int milsec);
+ bool GetPosition(int *const milsec);
+};
+/*
+struct playback;
+
+struct playback *playback_create();
+void playback_destroy(struct playback *plback);
+int playback_start(struct playback *plback);
+int playback_stop(struct playback *plback);
+
+int playback_add_completed_cb(struct playback *plback,
+ player_completed_cb on_playback_completion, void *data);
+int playback_remove_completed_cb(struct playback *plback);
+
+int playback_set_mute(struct playback *plback, bool flag);
+int playback_set_looping(struct playback *plback, bool flag);
+
+int playback_resume(struct playback *plback);
+int playback_pause(struct playback *plback);
+int playback_set_next_uri(struct playback *plback, const char *path);
+int playback_set_uri(struct playback *plback, const char *path);
+int playback_prepare(struct playback *plback);
+int playback_unprepare(struct playback *plback);
+int playback_set_position(struct playback *plback, int milsec);
+int playback_get_position(struct playback *plback, int *const milsec);
+*/
+#endif /*__PLAYBACK_MGR_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __PLAYBACK_VIEW_H__
+#define __PLAYBACK_VIEW_H__
+
+
+#include "common.h"
+
+
+struct SItemInfo;
+
+
+class CPlaybackView : public CBaseView, CListenerMgr,
+ IKeyDownListener, IKeyUpListener, IMouseClickedListener, IMouseMoveListener,
+ IPressedListener, IUnpressedListener, IChangedListener, IRealizedListener, IUnrealizedListener,
+ IActivatedListener,
+ IMusicControllerListener {
+private:
+ struct SPlaybackView* m;
+
+private:
+ static Eina_Bool sm_CbUpdateSlider(void *dt);
+ static Eina_Bool sm_CbLongpressTimer(void *dt);
+ static Eina_Bool sm_CbWaitTimer(void *dt);
+ static Eina_Bool sm_CbVolumeTimer(void *dt);
+
+ static void sm_CbItemSelect(void *data, Evas_Object *obj, void *event_info);
+
+ static void sm_CbGenlistItemCheckClicked(void *data, Elm_Object_Item *it, const char *emission, const char *source);
+ void m_OnGenlistItemCheckClicked(Elm_Object_Item *it, const char *emission, const char *source);
+
+ static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid);
+ static void sm_CbCtxtClose(void *dt);
+
+private:
+ void m_HandleKeyPress(char *keyname);
+ void m_HandleKeyUnpress(char *keyname);
+
+ void m_KeyBackPress(void);
+ void m_KeyExitPress(void);
+ void m_KeyPlayPress(void);
+ void m_KeyPausePress(void);
+ void m_KeyNextPress(void);
+ void m_KeyPreviousPress(void);
+
+ void m_KeyNextUnpress(void);
+ void m_KeyPreviousUnpress(void);
+
+
+
+ void m_RemoveTimer(int timer_code);
+ void m_PlaybackPause(void);
+ void m_PlaybackResume(void);
+ void m_ChangeEditmodeAll(Eina_List *list, bool flag);
+ void m_DisableCheckAll(Eina_List *list);
+ void m_SelectItem(SItemInfo *it_info);
+ void m_UnselectItem(SItemInfo *it_info);
+ void m_UpdateControlBtns(void);
+ void m_UpdateCurrentSongProgressbar(void);
+ void m_UpdateCurrentSongThumbnail(void);
+ void m_UpdateCurrentSongLabels(void);
+ void m_UpdateEmptySongInfo(void);
+ void m_UpdateCtxtView(int playStatus);
+ void m_UpdateCurrentSongItem(int index);
+ void m_UpdateEditmodeFocusSequence(void);
+ void m_UpdatePlaymodeFocusSequence(void);
+ void m_UpdateCurrentSongInfo(void);
+ void m_DisableEditButtons(bool flag);
+ void m_CreateErrorPopup(void);
+ void m_DestroyErrorPopup(void);
+ void m_CreateSettingsPopup(void);
+ void m_DestroySettingsPopup(void);
+ void m_FromEditToPlaybackMode(void);
+ void m_FromPlaybackToEditMode(void);
+ void m_HandleOnRepeated(void);
+ void m_DeleteSelectedItems(void);
+
+
+ void m_AddSlider(void);
+ void m_AddAlbumCover(void);
+ void m_AddCurrentSonginfo(void);
+ void m_AddEditPlaylistButtons(void);
+ void m_AddControlButtons(void);
+ struct SItemInfo *m_FindItemInfoFromSong(Eina_List *list, SSongInfo *sinfo);
+ struct SItemInfo *m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item);
+ void m_UpdateItemCheck(SItemInfo *itinfo);
+ Elm_Genlist_Item_Class *m_GetItemClass();
+ void m_AddGenlist(void);
+ void m_AddPlaylist(void);
+ void m_RemovePlaylist(void);
+ void m_HandleRewindBtnClicked(Evas_Object *obj);
+ void m_HandleForwardBtnClicked(Evas_Object *obj);
+ void m_HandleOnPressed(Evas_Object *obj);
+ void m_HandleOnUnpressed(Evas_Object *obj);
+ void m_HandleGenlistItemActivated(Evas_Object *obj, Elm_Object_Item *genListItem);
+
+protected:
+ // When button is clicked.
+ void t_OnClickedSettings(Evas_Object *obj);
+ void t_OnClickedShuffle(Evas_Object *obj);
+ void t_OnClickedRepeat(Evas_Object *obj);
+ void t_OnClickedPlay(Evas_Object *obj);
+
+protected:
+ virtual void t_OnShow(void);
+ virtual void t_OnHide(void);
+ virtual void t_OnUpdate(void* data);
+
+public:
+ CPlaybackView(const char *pViewId) : CBaseView(pViewId),
+ IKeyDownListener(this), IKeyUpListener(this), IMouseClickedListener(this), IMouseMoveListener(this),
+ IPressedListener(this), IUnpressedListener(this), IChangedListener(this),
+ IRealizedListener(this), IUnrealizedListener(this), IActivatedListener(this),
+ m(0) {}
+ virtual ~CPlaybackView() {}
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+
+ virtual Evas_Object* Base(void);
+
+ // Listener virtual function
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+ virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev);
+ virtual void OnMouseClicked(int id, Evas_Object *obj);
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
+ virtual void OnPressed(int id, Evas_Object *obj);
+ virtual void OnUnpressed(int id, Evas_Object *obj);
+ virtual void OnChanged(int id, Evas_Object *obj);
+ virtual void OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item);
+ virtual void OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item);
+ virtual void OnActivated(int id, Evas_Object *obj, Elm_Object_Item *item);
+
+protected:
+ virtual void t_OnComplete(void);
+ virtual void t_OnError(void);
+ virtual void t_OnUsbConnected(void);
+ virtual void t_OnUpdateContent(void);
+};
+
+
+#endif /*__PLAYBACK_VIEW_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PLAYLIST_LAYOUT_H__
+#define __PLAYLIST_LAYOUT_H__
+
+
+class CPlaylistLayout : public CCategoryLayout {
+private:
+ struct SArtistLayout* m;
+
+private:
+ static void sm_CbEntryRename(void *dt, const char *name);
+ void m_OnEntryRename(const char *name);
+
+ void m_PlaylistCtxtAction(EActionType type);
+
+protected:
+ virtual void t_HandleItemSelect(SCatItemInfo *itinfo);
+ virtual EContextType t_ContextType(void) { return CONTEXT_TYPE_PLAYLIST; }
+ virtual ECategoryType t_CategoryType(void) { return CAT_TYPE_PLAYLISTS; }
+ virtual bool t_GetMediaList(Eina_List **list);
+ virtual void t_OnCtxtUpdate(enum EActionType type, int lid);
+
+public:
+ CPlaylistLayout(const char *pLayoutId) : CCategoryLayout(pLayoutId), m(0) {}
+ virtual ~CPlaylistLayout(){}
+};
+
+
+#endif /* __PLAYLIST_LAYOUT_H__ */
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PLAYLIST_MGR_H__
+#define __PLAYLIST_MGR_H__
+
+
+#include <Eina.h>
+
+
+struct SSongInfo;
+
+
+class CPlaylist {
+private:
+ struct SPlaylist* m;
+
+public:
+ CPlaylist() : m(0) {}
+ virtual ~CPlaylist() {}
+ bool FlagCreate(void) { return !!m; }
+
+ bool Create(Eina_List *songlist);
+ virtual void Destroy(void);
+
+ bool Update(Eina_List *songlist, int addmode);
+
+ const char *SongpathFromIndex(int index);
+ bool GetSonginfoFromIndex(int index, struct SSongInfo **const csinfo);
+ bool GetTotalSongs(int *total_songs);
+ bool GetCurSongIndex(int *index);
+ bool SetCurSongIndex(int index);
+ bool LoadNextSong(int shufstate);
+ bool LoadPreviousSong(int shufstate);
+ bool RemoveSong(struct SSongInfo *sinfo, int index, int shufstate);
+ bool UpdateShuffle(void);
+ bool SetCurrentSong(char *mediaid);
+};
+
+/*
+struct playlist *playlist_create(Eina_List *songlist);
+struct playlist *playlist_update(struct playlist *plist, Eina_List *songlist,
+ int addmode);
+void playlist_destroy(struct playlist *plist);
+
+const char *playlist_get_songpath_from_index(struct playlist *plist, int index);
+int playlist_get_songinfo_from_index(struct playlist *plist, int index,
+ struct SSongInfo **const csinfo);
+int playlist_get_total_songs(struct playlist *plist, int *total_songs);
+int playlist_get_cur_song_index(struct playlist *plist, int *index);
+int playlist_set_cur_song_index(struct playlist *plist, int index);
+int playlist_load_next_song(struct playlist *plist, int shufstate);
+int playlist_load_previous_song(struct playlist *plist, int shufstate);
+int playlist_remove_song(struct playlist *plist, struct SSongInfo *sinfo,
+ int index, int shufstate);
+void playlist_update_shuffle(struct playlist *plist);
+int playlist_set_current_song(struct playlist *plist, char *mediaid);
+*/
+
+#endif /*__PLAYLIST_MGR_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SONG_LAYOUT_H__
+#define __SONG_LAYOUT_H__
+
+
+class CSongLayout : public CExtBaseLayout, public CListenerMgr, public IKeyDownListener {
+private:
+ struct SSongLayout *m;
+
+private:
+ static char *sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part);
+ static Evas_Object *sm_CbGetListItemContent(void *data, Evas_Object *obj, const char *part);
+ static void sm_CbRemoveListItem(void *data, Evas_Object *obj);
+ static void sm_CbGenlistKeyDown(void *dt, Evas *e, Evas_Object *obj, void *ei);
+
+ static void sm_CbSelectItem(void *cookie);
+ void m_OnSelectItem(void);
+
+private:
+ void m_GotoPlayback(void);
+ void m_GotoPlaybackUri(void);
+ void m_CreateSongList(void);
+
+protected:
+ virtual void t_OnShow(void);
+
+public:
+ CSongLayout(const char *pLayoutId) : CExtBaseLayout(pLayoutId), IKeyDownListener(this), m(0) {}
+ virtual ~CSongLayout() {}
+
+ bool Create(CLayoutMgr *mgr, const char *uri);
+ virtual void Destroy(void);
+
+ virtual void Update(bool focusFlag);
+
+public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+};
+
+
+#endif /*__SONG_LAYOUT_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SONG_INFO_H__
+#define __SONG_INFO_H__
+
+struct SSongInfo {
+ char *media_id;
+ char *title;
+ char *artist;
+ char *album;
+ char *album_artist;
+ char *genre;
+ char *composer;
+ char *thumbnail_path;
+ char *filepath;
+ int type;
+ int duration;
+ int member_id; /* if it is member of any playlist */
+};
+
+struct SSongInfo *song_info_create();
+void song_info_destroy(struct SSongInfo *sinfo);
+
+char *song_info_get_media_id(struct SSongInfo *csinfo);
+int song_info_get_member_id(struct SSongInfo *csinfo);
+char *song_info_get_title(struct SSongInfo *csinfo);
+char *song_info_get_artist(struct SSongInfo *csinfo);
+char *song_info_get_genre(struct SSongInfo *csinfo);
+char *song_info_get_album(struct SSongInfo *csinfo);
+char *song_info_get_filepath(struct SSongInfo *csinfo);
+char *song_info_get_thumb(struct SSongInfo *csinfo);
+bool song_info_get_duration(struct SSongInfo *csinfo, int *dur);
+struct SSongInfo *song_info_duplicate(struct SSongInfo *s_sinfo);
+
+int sortsongs_title_az(const void *d1, const void *d2);
+int sortsongs_title_za(const void *d1, const void *d2);
+int sortsongs_artist_az(const void *d1, const void *d2);
+int sortsongs_artist_za(const void *d1, const void *d2);
+int sortsongs_album_az(const void *d1, const void *d2);
+int sortsongs_album_za(const void *d1, const void *d2);
+
+#endif /*__SONG_INFO_H__*/
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOLUME_CONTROL_H__
+#define __VOLUME_CONTROL_H__
+
+
+class CVolumeController {
+public:
+ static bool Mute(void);
+ static bool Unmute(void);
+ static bool IsMute(void);
+ static bool Get(int *volume);
+ static bool Up(void);
+ static bool Down(void);
+};
+
+
+#endif /*__VOLUME_CONTROL_H__*/
\ No newline at end of file
--- /dev/null
+<manifest>
+ <define>
+ <domain name="dtv-org.tizen.music-player-tv-ref"/>
+ <request>
+ <smack request="device::audio" type="rwx"/>
+ <smack request="system::media" type="rwx"/>
+ <smack request="system::vconf" type="rwx"/>
+ <smack request="system::homedir" type="rwx"/>
+ <smack request="sound_server" type="rwx"/>
+ <smack request="media-server" type="rwx"/>
+ <smack request="media-data::db" type="rwx"/>
+ <smack request="ail::db" type="rwx"/>
+ <smack request="isf" type="rwx"/>
+ <smack request="xorg" type="rwx"/>
+ <smack request="_" type="rwx"/>
+ <smack request="device::hwcodec" type="rwx"/>
+ <smack request="dtv-libomxil-e4x12-v4l2" type="rwx"/>
+ <smack request="system::use_internet" type="rwx"/>
+ <smack request="device::app_logging" type="rwx"/>
+ <smack request="dtv-trustzone-nwd" type="rwx"/>
+ </request>
+ </define>
+ <request>
+ <domain name="dtv-org.tizen.music-player-tv-ref"/>
+ </request>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" version="@VERSION@" install-location="internal-only">
+ <label>music-player</label>
+ <author email="g.praveenya@samsung.com" href="www.samsung.com">PRAVEENYA</author>
+ <description>Music-player</description>
+ <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="false" multiple="false" type="capp" taskmanage="true" landscape-effectimage="@DESKTOP_ICONDIR@/@PACKAGE_NAME@_4x2.png">
+ <label>Music</label>
+ <icon>@DESKTOP_ICON@</icon>
+ </ui-application>
+</manifest>
--- /dev/null
+Name: org.tizen.music-player-tv-ref
+Summary: Open UX music player application
+Version: 0.2
+Release: 1
+Group: Applications/Core Applications
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(edje)
+BuildRequires: gstreamer
+BuildRequires: gst-plugins-base
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-media-player)
+BuildRequires: pkgconfig(capi-media-sound-manager)
+BuildRequires: pkgconfig(capi-content-media-content)
+#BuildRequires: pkgconfig(capi-system-usbdevice)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(mm-player)
+BuildRequires: pkgconfig(edje)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(application-common)
+BuildRequires: edje-bin
+BuildRequires: gettext-devel
+
+%define _pkgdir /usr/apps/%{name}
+%define _bindir %{_pkgdir}/bin
+%define _resdir %{_pkgdir}/res
+%define _localedir %{_resdir}/locale
+%define _manifestdir /usr/share/packages
+%define _media_audiodir /opt/usr/media/Sounds
+%define _desktop_icondir /usr/share/icons/default/small
+
+%description
+PUT DESCRIPTION HERE
+
+%prep
+%setup -q
+
+%build
+cmake \
+ -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \
+ -DPACKAGE_NAME=%{name} \
+ -DBINDIR=%{_bindir} \
+ -DLOCALEDIR=%{_localedir} \
+ -DMANIFESTDIR=%{_manifestdir} \
+ -DMEDIA_AUDIO_DIR=%{_media_audiodir} \
+ -DDESKTOP_ICONDIR=%{_desktop_icondir} \
+ -DVERSION=%{version}
+
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+%files
+
+%defattr(-,root,root,-)
+%manifest %{name}.manifest
+%{_bindir}/*
+%{_resdir}/*
+%{_manifestdir}/%{name}.xml
+%{_media_audiodir}/*
+%{_desktop_icondir}/%{name}.png
+%{_desktop_icondir}/%{name}_4x2.png
--- /dev/null
+# for i18n
+
+SET(POFILES de_DE.po
+ el_GR.po
+ en.po
+ es_ES.po
+ fr_FR.po
+ it_IT.po
+ ja_JP.po
+ ko_KR.po
+ nl_NL.po
+ pt_PT.po
+ ru_RU.po
+ tr_TR.po
+ zh_CN.po
+ zh_HK.po
+ zh_TW.po)
+SET(MSGFMT "/usr/bin/msgfmt")
+
+FOREACH(pofile ${POFILES})
+ SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
+ MESSAGE("PO: ${pofile}")
+ GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
+ SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${moFile}
+ COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
+ DEPENDS ${absPofile}
+ )
+ INSTALL(FILES ${moFile}
+ DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
--- /dev/null
+# List of source files containing translatable strings.
+src/main.c
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+#!/bin/sh
+
+APPNAME=music-player
+SRCROOT=..
+POTFILES=POTFILES.in
+
+ALL_LINGUAS="de_DE el_GR en es_ES fr_FR it_IT ja_JP ko_KR nl_NL pt_PT ru_RU tr_TR zh_CN zh_HK zh_TW"
+
+XGETTEXT=/usr/bin/xgettext
+MSGMERGE=/usr/bin/msgmerge
+
+echo -n "Make ${APPNAME}.pot "
+if [ ! -e $POTFILES ] ; then
+ echo "$POTFILES not found"
+ exit 1
+fi
+
+$XGETTEXT --default-domain=${APPNAME} --directory=${SRCROOT} \
+ --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES
+if [ $? -ne 0 ]; then
+ echo "xgettext error"
+ exit 1
+fi
+
+if [ ! -f ${APPNAME}.po ]; then
+ echo "No such file: ${APPNAME}.po"
+ exit 1
+fi
+
+rm -f ${APPNAME}.pot && mv ${APPNAME}.po ${APPNAME}.pot
+echo "done"
+
+for LANG in $ALL_LINGUAS; do
+ echo "$LANG : "
+
+ if [ ! -e $LANG.po ] ; then
+ sed 's/CHARSET/UTF-8/g' ${APPNAME}.pot > ${LANG}.po
+ echo "${LANG}.po created"
+ else
+ if $MSGMERGE ${LANG}.po ${APPNAME}.pot -o ${LANG}.new.po ; then
+ if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
+ rm -f ${LANG}.new.po
+ else
+ if mv -f ${LANG}.new.po ${LANG}.po; then
+ echo ""
+ else
+ echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
+ rm -f ${LANG}.new.po
+ exit 1
+ fi
+ fi
+ else
+ echo "msgmerge for $LANG failed!"
+ rm -f ${LANG}.new.po
+ fi
+ fi
+ echo ""
+done
+
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-20 17:28+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/main.c:50
+msgid "Hello! Tizen"
+msgstr ""
--- /dev/null
+ADD_CUSTOM_TARGET(${TARGET_EDJ}
+ COMMAND edje_cc -id images
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc
+ ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR})
+
+ADD_CUSTOM_TARGET(${THEME_EDJ}
+ COMMAND edje_cc -id images
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+ ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${THEME_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ} DESTINATION ${EDJEDIR})
--- /dev/null
+#include "../../include/define.h"
+
+collections {
+ #include "widgets/button.edc"
+ #include "widgets/ctxpopup.edc"
+ #include "widgets/genlist.edc"
+ #include "widgets/slider.edc"
+ #include "widgets/gengrid.edc"
+ #include "widgets/progressbar.edc"
+}
--- /dev/null
+#include "../../include/define.h"
+collections {
+ #include "views/common.edc"
+ #include "views/playback-view.edc"
+ #include "views/base-view.edc"
+ #include "views/context-view.edc"
+ #include "views/settings-layout.edc"
+ #include "views/song-layout.edc"
+ #include "views/album-layout.edc"
+ #include "views/album-songs-layout.edc"
+ #include "views/category-layout.edc"
+ #include "views/cat-albums-layout.edc"
+ #include "views/cat-songs-layout.edc"
+ #include "views/cat-selectlist-layout.edc"
+ #include "views/folder-layout.edc"
+ #include "views/volume-layout.edc"
+ #include "views/message-layout.edc"
+ #include "views/entrypopup-layout.edc"
+}
--- /dev/null
+group {
+ name: MUSIC_ALBUM_LAYOUT;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+ PART_RECT_PADDING(padding_albumgrid, 0 0, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_ALBUM_GRID, 1395+20 848,
+ padding_albumgrid, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_ALBUM_SONGS_LAYOUT;
+ images {
+ image: MUSIC_IMAGE_SONG_COUNT COMP;
+ image: MUSIC_IMAGE_ALBUM_TIME COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+ PART_RECT_PADDING(padding_thumb, 0 52, bg)
+ PART_RECT_COLOR(thumb_bg, 174 174,
+ padding_thumb, 0 0, 0 0 0 76)
+ part {
+ name: MUSIC_PART_ALBUM_THUMB;
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "thumb_bg";
+ rel2.to: "thumb_bg";
+ align: 0.5 0.5;
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_name, 174+31 52, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_NAME, 1190 56, padding_name, 0 0, FONT_STYLE_BOLD, 50, 0 0.5)
+
+ PART_RECT_PADDING(padding_artist, 174+31 52+56, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_ARTIST, 1190 36, padding_artist, 0 0, FONT_STYLE_REGULAR, 30, 0 0.5)
+
+ PART_RECT_PADDING(padding_countimage, 174+38 108+36+50, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_COUNT_IMAGE, 32 32, padding_countimage, 0 0, MUSIC_IMAGE_SONG_COUNT)
+
+ PART_RECT_PADDING(padding_songcount, 212+32+14 194, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_SONGCOUNT, 50 32, padding_songcount, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_timeimage, 258+50+14 194, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_TIME_IMAGE, 32 32, padding_timeimage, 0 0, MUSIC_IMAGE_ALBUM_TIME)
+
+ PART_RECT_PADDING(padding_time, 322+32+14 194, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_TIME, 100 32, padding_time, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_playbtn, 1395-214*3-14*2 144+22, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_ALBUM_PLAYBTN, 214 62,
+ padding_playbtn, 0 0)
+
+ PART_RECT_PADDING(padding_nextbtn, 1395-214*2-14 144+22, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_ALBUM_NEXTBTN, 214 62,
+ padding_nextbtn, 0 0)
+
+ PART_RECT_PADDING(padding_lastbtn, 1395-214 144+22, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_ALBUM_LASTBTN, 214 62,
+ padding_lastbtn, 0 0)
+
+ PART_RECT_PADDING(padding_songlist, 0 87*3, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SONGLIST, 1395 848-87*3,
+ padding_songlist, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_BASE_VIEW;
+ images {
+ image: MUSIC_IMAGE_ICON COMP;
+ image: MUSIC_IMAGE_PLAY_ICON COMP;
+ }
+ parts {
+ part {
+ name: "black_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_BLACK_BG;
+ }
+ }
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: RGBA_COLOR_BG;
+ }
+ }
+
+ PART_RECT_PADDING(padding_icon, 63 78, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_MUSIC_ICON, 84 84, padding_icon,
+ 0 0, MUSIC_IMAGE_ICON)
+
+ PART_RECT_PADDING(padding_titletxt, 63+84+22 78, bg)
+ PART_TEXT_FONT(MUSIC_PART_TITLE, 261 84, padding_titletxt, 0 0,
+ FONT_STYLE_BOLD, 70, 0 0.5)
+
+ PART_RECT_PADDING(padding_playicon, 169+261+12+36 82+28, bg)
+ PART_IMAGE_COLOR(MUSIC_PART_PLAY_ICON, 26 26, padding_playicon,
+ 0 0, MUSIC_IMAGE_PLAY_ICON, 255 255 255 128)
+
+ PART_RECT_PADDING(padding_playsonglbl, 478+26+12 82+20, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_PLAYSONG_LBL, 571 42,
+ padding_playsonglbl, 0 0)
+
+ PART_RECT_PADDING(padding_playbackbtn, 516+571+20 82, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_PLAYBACK_BTN, 72 72,
+ padding_playbackbtn, 0 0)
+
+ PART_RECT_PADDING(padding_sortlist, 1107+72+20 82, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SORT_HOVERSEL, 290 72,
+ padding_sortlist, 0 0)
+
+ PART_RECT_PADDING(padding_sourcelist, 1199+290+20 82, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SOURCE_HOVERSEL, 290 72,
+ padding_sourcelist, 0 0)
+
+ PART_RECT_PADDING(padding_grpbtn, 0 232, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_GROUPBTN_BOX, 406 87*1,
+ padding_grpbtn, 0 0)
+
+ PART_RECT_PADDING(padding_nocontent, 1000 450, bg)
+ PART_TEXT_FONT(MUSIC_PART_NO_CONTENT, 800 50, padding_nocontent, 0.5 0.5,
+ FONT_STYLE_BOLD, 35, 0.5 0.5)
+
+ PART_RECT_PADDING(padding_nocontent_sub, 1000 450+40, bg)
+ PART_TEXT_FONT_COLOR(MUSIC_PART_NO_CONTENT_SUB, 800 30, padding_nocontent_sub, 0.5 0.5,
+ FONT_STYLE_BOLD, 24, 0.5 0.5, 255 255 255 102)
+
+ PART_RECT_PADDING(padding_content, 406 232, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CONTENT, 1395+20 848,
+ padding_content, 0 0)
+
+ PART_RECT_PADDING(padding_sortpopup, 1199 155, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SORT_POPUP, 290 720,
+ padding_sortpopup, 0 0)
+
+ PART_RECT_PADDING(padding_sourcepopup, 1509 155, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SOURCE_POPUP, 290 720,
+ padding_sourcepopup, 0 0)
+
+ part {
+ name: MUSIC_PART_VOLUME_LAYOUT;
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ }
+}
--- /dev/null
+group {
+ name: MUSIC_CATEGORY_ALBUM_LAYOUT;
+ images {
+ image: MUSIC_IMAGE_BACK COMP;
+ image: MUSIC_IMAGE_SONG_COUNT COMP;
+ image: MUSIC_IMAGE_ALBUM_COUNT COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_back, 0 14, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_BACK_IMAGE, 14 14, padding_back, 0 0, MUSIC_IMAGE_BACK)
+
+ PART_RECT_PADDING(padding_artname, 14+8 2, bg)
+ PART_TEXT_FONT(MUSIC_PART_CATEGORY_NAME, 700 36, padding_artname, 0 0, FONT_STYLE_MEDIUM, 30, 0 0.5)
+
+ PART_RECT_PADDING(padding_albimage, 0 48, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_ALBUM_IMAGE, 32 32, padding_albimage, 0 0, MUSIC_IMAGE_ALBUM_COUNT)
+
+ PART_RECT_PADDING(padding_albcount, 32+14 48, bg)
+ PART_TEXT_FONT(MUSIC_PART_CATEGORY_ALBUMCOUNT, 50 32, padding_albcount, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_songimage, 46+50+14 48, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_SONG_IMAGE, 32 32, padding_songimage, 0 0, MUSIC_IMAGE_SONG_COUNT)
+
+ PART_RECT_PADDING(padding_songcount, 110+32+14 48, bg)
+ PART_TEXT_FONT(MUSIC_PART_CATEGORY_SONGCOUNT, 100 32, padding_songcount, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_playbtn, 1395-214*3-14*2 19, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_PLAYBTN, 214 62,
+ padding_playbtn, 0 0)
+
+ PART_RECT_PADDING(padding_nextbtn, 1395-214*2-14 19, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_NEXTBTN, 214 62,
+ padding_nextbtn, 0 0)
+
+ PART_RECT_PADDING(padding_lastbtn, 1395-214 19, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_LASTBTN, 214 62,
+ padding_lastbtn, 0 0)
+
+ PART_RECT_PADDING(padding_artalbgrid, 0 116, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_ALBUM_GRID, 1395+20 732,
+ padding_artalbgrid, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_CATEGORY_SELECTLIST_LAYOUT;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_msg, 10 33, bg)
+ PART_TEXT_FONT_COLOR(MUSIC_PART_LIST_MSG, 700 62, padding_msg, 0 0, FONT_STYLE_REGULAR, 30, 0 1, 255 255 255 153)
+
+ PART_RECT_PADDING(padding_selectall, 1395-214*3-14*2 33, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_LIST_SELECT_ALL, 214 62,
+ padding_selectall, 0 0)
+
+ PART_RECT_PADDING(padding_addbtn, 1395-214*2-14 33, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_LIST_DONE_BTN, 214 62,
+ padding_addbtn, 0 0)
+
+ PART_RECT_PADDING(padding_cancelbtn, 1395-214 33, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_LIST_CANCEL_BTN, 214 62,
+ padding_cancelbtn, 0 0)
+
+ PART_RECT_PADDING(padding_songlist, 0 66+62, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SONGLIST, 1395 848-128,
+ padding_songlist, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_CATEGORY_SONGS_LAYOUT;
+ images {
+ image: MUSIC_IMAGE_SONG_COUNT COMP;
+ image: MUSIC_IMAGE_ALBUM_TIME COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_back, 0 14, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_BACK_IMAGE, 14 14, padding_back, 0 0, MUSIC_IMAGE_BACK)
+
+ PART_RECT_PADDING(padding_artname, 14+8 2, bg)
+ PART_TEXT_FONT(MUSIC_PART_CATEGORY_NAME, 700 36, padding_artname, 0 0, FONT_STYLE_MEDIUM, 30, 0 0.5)
+
+ PART_RECT_PADDING(padding_thumb, 0 52, bg)
+ PART_RECT_COLOR(thumb_bg, 174 174,
+ padding_thumb, 0 0, 0 0 0 76)
+ part {
+ name: MUSIC_PART_ALBUM_THUMB;
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "thumb_bg";
+ rel2.to: "thumb_bg";
+ align: 0.5 0.5;
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_name, 174+31 52, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_NAME, 1190 56, padding_name, 0 0, FONT_STYLE_BOLD, 50, 0 0.5)
+
+ PART_RECT_PADDING(padding_artist, 174+31 52+56, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_CATEGORY, 1190 36, padding_artist, 0 0, FONT_STYLE_REGULAR, 30, 0 0.5)
+
+ PART_RECT_PADDING(padding_countimage, 174+38 108+36+50, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_COUNT_IMAGE, 32 32, padding_countimage, 0 0, MUSIC_IMAGE_SONG_COUNT)
+
+ PART_RECT_PADDING(padding_songcount, 212+32+14 194, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_SONGCOUNT, 50 32, padding_songcount, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_timeimage, 258+50+14 194, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_TIME_IMAGE, 32 32, padding_timeimage, 0 0, MUSIC_IMAGE_ALBUM_TIME)
+
+ PART_RECT_PADDING(padding_time, 322+32+14 194, bg)
+ PART_TEXT_FONT(MUSIC_PART_ALBUM_TIME, 100 32, padding_time, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_playbtn, 1395-214*3-14*2 144+22, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_PLAYBTN, 214 62,
+ padding_playbtn, 0 0)
+
+ PART_RECT_PADDING(padding_nextbtn, 1395-214*2-14 144+22, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_NEXTBTN, 214 62,
+ padding_nextbtn, 0 0)
+
+ PART_RECT_PADDING(padding_lastbtn, 1395-214 144+22, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_LASTBTN, 214 62,
+ padding_lastbtn, 0 0)
+
+ PART_RECT_PADDING(padding_songlist, 0 87*3, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SONGLIST, 1395 848-87*3,
+ padding_songlist, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_CATEGORY_LAYOUT;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_artgrid, 0 0, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_CATEGORY_GRID, 1395+20 848,
+ padding_artgrid, 0 0)
+ }
+}
+
+
--- /dev/null
+#define PART_RECT_COLOR(part_name, min_size, relative_name, align_info, clr) \
+ part { \
+ name: part_name; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: relative_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: relative_name; \
+ } \
+ fixed: 1 1; \
+ align: align_info; \
+ color: clr; \
+ } \
+ }
+
+#define PART_RECT_PADDING(part_name, min_size, rltv_name) \
+ part { \
+ name: part_name; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: rltv_name; \
+ } \
+ rel2 { \
+ to: rltv_name; \
+ relative: 0.0 0.0; \
+ } \
+ fixed: 1 1; \
+ visible: 0; \
+ align: 0.0 0.0; \
+ } \
+ }
+
+#define PART_RECT_RELATIVE_PADDING(part_name, min_size, rltv_name, rltv_x, rltv_y) \
+ part { \
+ name: part_name; \
+ type: RECT; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: rltv_name; \
+ relative: rltv_x rltv_y; \
+ } \
+ rel2 { \
+ to: rltv_name; \
+ relative: rltv_x rltv_y; \
+ } \
+ fixed: 1 1; \
+ visible: 0; \
+ align: 0.0 0.0; \
+ } \
+ }
+
+#define PART_SWALLOW_BASIC(part_name, min_size, relative_name, align_info) \
+ part { \
+ name: part_name; \
+ type: SWALLOW; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: relative_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: relative_name; \
+ } \
+ fixed: 1 1; \
+ align: align_info; \
+ } \
+ }
+
+#define PART_SWALLOW_SHOWHIDE(part_name, min_size, relative_name, align_info) \
+ part { \
+ name: part_name; \
+ type: SWALLOW; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: relative_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: relative_name; \
+ } \
+ fixed: 1 1; \
+ align: align_info; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ visible: "0"; \
+ }\
+ }
+
+#define PART_IMAGE_BASIC(part_name, min_size, rltv_name, align_info, img_path) \
+ part { \
+ name: part_name; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: rltv_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: rltv_name; \
+ } \
+ image { \
+ normal: img_path; \
+ } \
+ fixed: 1 1; \
+ align: align_info; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ visible: "0"; \
+ }\
+ }
+
+#define PART_IMAGE_COLOR(part_name, min_size, rltv_name, align_info, img_path, color_code) \
+ part { \
+ name: part_name; \
+ scale: 1; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ rel1 { \
+ to: rltv_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: rltv_name; \
+ } \
+ image { \
+ normal: img_path; \
+ } \
+ fixed: 1 1; \
+ align: align_info; \
+ color: color_code; \
+ } \
+ }
+
+#define PART_TEXT_FONT(pname, min_size, rltv_name, palign, fstyle, \
+ fsize, falign) \
+ part { \
+ name: pname; \
+ type: TEXT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ max: min_size; \
+ color: 255 255 255 255; \
+ text { \
+ font: fstyle; \
+ size: fsize; \
+ align: falign; \
+ } \
+ rel1 { \
+ to: rltv_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: rltv_name; \
+ } \
+ fixed: 1 1; \
+ align: palign; \
+ } \
+ description { \
+ state: "hide" 0.0; \
+ inherit: "default" 0.0; \
+ visible: "0"; \
+ }\
+ }
+#define PART_TEXT_FONT_COLOR(pname, min_size, rltv_name, palign, fstyle, \
+ fsize, falign, clr) \
+ part { \
+ name: pname; \
+ type: TEXT; \
+ scale: 1; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: min_size; \
+ color: clr; \
+ text { \
+ font: fstyle; \
+ size: fsize; \
+ align: falign; \
+ } \
+ rel1 { \
+ to: rltv_name; \
+ relative: 1.0 1.0; \
+ } \
+ rel2 { \
+ to: rltv_name; \
+ } \
+ fixed: 1 1; \
+ align: palign; \
+ } \
+ }
--- /dev/null
+group {
+ name: MUSIC_CONTEXT_VIEW;
+ images {
+ image: MUSIC_IMAGE_CTXT_BG COMP;
+ image: MUSIC_IMAGE_CTXT_ITEM_BG COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 204;
+ }
+ }
+ part {
+ name: "bg_img";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: MUSIC_IMAGE_CTXT_BG;
+ }
+ }
+
+ PART_RECT_PADDING("pad_icon", 432 305, "bg")
+ PART_IMAGE_COLOR("icon_bg_img", 470 470, "pad_icon", 0 0, MUSIC_IMAGE_CTXT_ITEM_BG, 229 72 133 255)
+ PART_RECT_COLOR("icon_bg", 470 470, "pad_icon", 0 0, 28 36 49 204)
+ part {
+ name: MUSIC_PART_CTXT_ICON;
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "icon_bg";
+ rel2.to: "icon_bg";
+ align: 0.5 0.5;
+ }
+ }
+
+ PART_RECT_PADDING("pad_title", 432 305+470+20, "bg")
+ PART_TEXT_FONT(MUSIC_PART_CTXT_TITLE, 470 43, "pad_title", 0 0, FONT_STYLE_BOLD, 36, 0 0.5)
+
+ PART_RECT_PADDING("pad_subtitle", 432 305+470+20+43, "bg")
+ PART_TEXT_FONT(MUSIC_PART_CTXT_SUBTITLE, 470 31, "pad_subtitle", 0 0, FONT_STYLE_REGULAR, 24, 0 0.5)
+
+ PART_RECT_PADDING("pad_subtitle2", 432 305+470+20+43+31, "bg")
+ PART_TEXT_FONT(MUSIC_PART_CTXT_SUBTITLE2, 470 31, "pad_subtitle2", 0 0, FONT_STYLE_REGULAR, 24, 0 0.5)
+
+ PART_RECT_PADDING("pad_btnarea", 1334 75, "bg")
+ PART_SWALLOW_BASIC(MUSIC_PART_CTXT_BTNAREA, 0 115, "pad_btnarea", 0 0)
+
+ PART_RECT_RELATIVE_PADDING("pad_separator", 0 20, MUSIC_PART_CTXT_BTNAREA, 0, 1)
+ PART_RECT_COLOR("part_separator", 490 2, "pad_separator", 0 0, 255 255 255 51)
+
+ part {
+ name: "pad_info";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 37;
+ rel1 {
+ to: "part_separator";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "part_separator";
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ min: 0 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_INFO;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 490 106;
+ rel1 {
+ relative: 1.0 1.0;
+ to: "pad_info";
+ }
+ rel2 {
+ to: "pad_info";
+ }
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ min: 490 0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_RELATIVE_PADDING("pad_relctnttext", 16 30, MUSIC_PART_CTXT_INFO, 0, 1)
+ PART_TEXT_FONT(MUSIC_PART_CTXT_RELCTNTTEXT, 458 38, "pad_relctnttext", 0 0, FONT_STYLE_MEDIUM, 27, 0 0)
+
+ PART_RECT_RELATIVE_PADDING("pad_relctntarea", 0 8, MUSIC_PART_CTXT_RELCTNTTEXT, 0.5, 1)
+ PART_SWALLOW_BASIC(MUSIC_PART_CTXT_RELCTNTAREA, 490 785, "pad_relctntarea", 0.5 0)
+
+ PART_RECT_PADDING("pad_plpopup", 1465 210, "bg")
+ PART_SWALLOW_BASIC(MUSIC_PART_PLIST_POPUP, 360 810, "pad_plpopup", 0 0)
+ }
+ programs {
+ program {
+ name: "show_moreinfo";
+ signal: MUSIC_SIGNAL_SHOW;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: MUSIC_PART_CTXT_INFO;
+ target: "pad_info";
+ }
+ program {
+ name: "hide_moreinfo";
+ signal: MUSIC_SIGNAL_HIDE;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "hide" 0.0;
+ target: MUSIC_PART_CTXT_INFO;
+ target: "pad_info";
+ }
+ }
+}
+
+group {
+ name: MUSIC_CONTEXT_BTN;
+ images {
+ image: MUSIC_IMAGE_CTXT_BTNBG_NOR COMP;
+ image: MUSIC_IMAGE_CTXT_BTNBG_FOC COMP;
+ }
+ parts {
+ part {
+ name: "ctxt_menubtn_area";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 103 115;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_BTNBG;
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 64 64;
+ rel1.relative: 0.5 0.0;
+ rel2.relative: 0.5 0.0;
+ image.normal: MUSIC_IMAGE_CTXT_BTNBG_NOR;
+ color: 100 109 124 255;
+ align: 0.5 0.0;
+ fixed: 1 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_CTXT_BTNBG_FOC;
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_BTNICON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 64 64;
+ rel1.relative: 0.5 0.0;
+ rel2.relative: 0.5 0.0;
+ align: 0.5 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "padding_btn_txt";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 72;
+ rel2.relative: 0.0 0.0;
+ align: 0.5 0.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_BTNTEXT;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 103 43;
+ rel1 {
+ relative: 0.0 1.0;
+ to: "padding_btn_txt";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to: "padding_btn_txt";
+ }
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "focused";
+ signal: MUSIC_SIGNAL_FOCUSED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "focused" 0.0;
+ target: MUSIC_PART_CTXT_BTNBG;
+ }
+ program {
+ name: "unfocused";
+ signal: MUSIC_SIGNAL_UNFOCUSED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: MUSIC_PART_CTXT_BTNBG;
+ }
+ }
+}
+
+group {
+ name: MUSIC_CONTEXT_REL_CONTENT;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 238 291;
+ visible: 0;
+ }
+ }
+ part {
+ name: "map";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ perspective {
+ zplane: 0;
+ focal: 1000;
+ }
+ visible: 0;
+ }
+ description {
+ state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ perspective.zplane: -100;
+ }
+ }
+ part {
+ name: "icon_bg";
+ scale: 1;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 238 238;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ align: 0.0 0.0;
+ color: 28 36 49 255;
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_RELCTNT_ICON;
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "icon_bg";
+ rel2.to: "icon_bg";
+ align: 0.5 0.5;
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part { name: "left_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 8 238;
+ rel1.to:"icon_bg";
+ rel2.to:"icon_bg";
+ rel2.relative: 0.0 0.0;
+ color: 229 72 113 0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part { name: "right_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 8 238;
+ rel1.to:"icon_bg";
+ rel1.relative: 1.0 0.0;
+ rel2.to:"icon_bg";
+ rel2.relative: 1.0 0.0;
+ color: 229 72 113 0;
+ fixed: 1 1;
+ align: 1.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part { name: "top_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 238-16 8;
+ rel1.to: "left_over";
+ rel1.relative: 1.0 0.0;
+ rel2.to: "right_over";
+ rel2.relative: 0.0 0.0;
+ color: 229 72 113 0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part { name: "bottom_bg";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 238 53;
+ rel1.to:"icon_bg";
+ rel1.relative: 0.0 1.0;
+ rel2.to:"icon_bg";
+ rel2.relative: 0.0 1.0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 42 50 64 255;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part { name: "bottom_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 238 53;
+ rel1.to:"icon_bg";
+ rel1.relative: 0.0 1.0;
+ rel2.to:"icon_bg";
+ rel2.relative: 0.0 1.0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 229 72 113 0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 16 15;
+ rel1 {
+ to: "icon_bg";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "icon_bg";
+ relative: 0.0 1.0;
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_RELCTNT_NAME;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 206 23;
+ max: 206 23;
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 24;
+ }
+ rel1 {
+ to: "padding_text";
+ relative: 1 1;
+ }
+ rel2 {
+ to: "padding_text";
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 211 211 211 255;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ map.on: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: MUSIC_SIGNAL_FOCUSED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "selected" 0.0;
+ target: MUSIC_PART_CTXT_RELCTNT_ICON;
+ target: MUSIC_PART_CTXT_RELCTNT_NAME;
+ target: "bottom_over";
+ target: "left_over";
+ target: "top_over";
+ target: "right_over";
+ target: "icon_bg";
+ target: "bottom_bg";
+ transition: LINEAR 0.3;
+ }
+ program {
+ name: "go_passive";
+ signal: MUSIC_SIGNAL_UNFOCUSED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: MUSIC_PART_CTXT_RELCTNT_ICON;
+ target: MUSIC_PART_CTXT_RELCTNT_NAME;
+ target: "bottom_over";
+ target: "left_over";
+ target: "top_over";
+ target: "right_over";
+ target: "icon_bg";
+ target: "bottom_bg";
+ transition: LINEAR 0.3;
+ }
+ program {
+ name: "animaion_start";
+ signal: MUSIC_SIGNAL_CONTENT_CLICKED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "clicked" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ after: "animation_stop";
+ }
+ program {
+ name: "animation_stop";
+ action: STATE_SET "default" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ after: "item_clicked";
+ }
+ program {
+ name: "item_clicked";
+ action: SIGNAL_EMIT MUSIC_SIGNAL_BTN_CLICKED MUSIC_CONTEXT_VIEW;
+ }
+ }
+}
+
+group {
+ name: MUSIC_CONTEXT_INFO;
+ images {
+ image: MUSIC_IMAGE_CTXT_ARROW COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 490 106;
+ fixed: 1 1;
+ align: 0 0;
+ color: 42 50 64 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: "icon_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 106 106;
+ rel2.relative: 0.0 0.0;
+ align: 0 0;
+ fixed: 1 1;
+ color: 28 36 49 255;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_INFOICON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 106 106;
+ rel2.relative: 0.0 0.0;
+ align: 0 0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "pad_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 0;
+ fixed: 1 1;
+ align: 0 0;
+ visible: 0;
+ rel1.to: MUSIC_PART_CTXT_INFOICON;
+ rel1.relative: 1 0;
+ rel2.to: MUSIC_PART_CTXT_INFOICON;
+ rel2.relative: 1 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_CTXT_INFOTEXT;
+ type: TEXT;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: 309 106;
+ fixed: 1 1;
+ align: 0 0;
+ color: 211 211 211 255;
+ rel1 {
+ to: "pad_text";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "pad_text";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 27;
+ align: 0 0.5;
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "pad_arrow";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 45;
+ fixed: 1 1;
+ align: 0 0;
+ visible: 0;
+ rel1.to: MUSIC_PART_CTXT_INFOTEXT;
+ rel1.relative: 1 0;
+ rel2.to: MUSIC_PART_CTXT_INFOTEXT;
+ rel2.relative: 1 0;
+ }
+ }
+ part {
+ name: "arrow";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 20;
+ fixed: 1 1;
+ align: 0 0;
+ aspect: 1 1;
+ color: 211 211 211 255;
+ rel1 {
+ to: "pad_arrow";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "pad_arrow";
+ }
+ image.normal: MUSIC_IMAGE_CTXT_ARROW;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: MUSIC_SIGNAL_FOCUSED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "selected" 0.0;
+ target: "bg";
+ target: "arrow";
+ target: MUSIC_PART_CTXT_INFOTEXT;
+ }
+ program {
+ name: "go_passive";
+ signal: MUSIC_SIGNAL_UNFOCUSED;
+ source: MUSIC_CONTEXT_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "arrow";
+ target: MUSIC_PART_CTXT_INFOTEXT;
+ }
+ }
+}
--- /dev/null
+group {
+ name: MUSIC_ENTRY_POPUP_LAYOUT;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 204;
+ }
+ }
+ part {
+ name: "entrybg_pad";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 376;
+ fixed: 1 1;
+ align: 0 0;
+ visible: 0;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ rel2.relative: 0.0 0.0;
+ }
+ }
+ part {
+ name: "entrybg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 1920 1080-376;
+ fixed: 1 1;
+ align: 0 0;
+ rel1.to: "entrybg_pad";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "bg";
+ color: 42 50 64 255;
+ }
+ }
+ part {
+ name: "entry_pad";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 160 90;
+ fixed: 1 1;
+ align: 0 0;
+ visible: 0;
+ rel1.to: "entrybg";
+ rel2.to: "entrybg";
+ rel2.relative: 0.0 0.0;
+ }
+ }
+ part {
+ name: MUSIC_PART_ENTRY;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 1600 100;
+ fixed: 1 1;
+ align: 0 0;
+ rel1.to: "entry_pad";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "entry_pad";
+ }
+ }
+ }
+}
+
--- /dev/null
+group {
+ name: MUSIC_FOLDER_LAYOUT;
+ images {
+ image: MUSIC_IMAGE_BACK COMP;
+ image: MUSIC_IMAGE_SONG_COUNT COMP;
+ image: MUSIC_IMAGE_ALBUM_TIME COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_back, 0 14, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_BACK_IMAGE, 14 14, padding_back, 0 0, MUSIC_IMAGE_BACK)
+
+ PART_RECT_PADDING(padding_folder, 14+8 2, bg)
+ PART_TEXT_FONT(MUSIC_PART_FOLDER_NAME, 700 36, padding_folder, 0 0, FONT_STYLE_MEDIUM, 30, 0 0.5)
+
+ PART_RECT_PADDING(padding_countimage, 0 48, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_COUNT_IMAGE, 32 32, padding_countimage, 0 0, MUSIC_IMAGE_SONG_COUNT)
+
+ PART_RECT_PADDING(padding_songcount, 32+14 48, bg)
+ PART_TEXT_FONT(MUSIC_PART_FOLDER_SONGCOUNT, 50 32, padding_songcount, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_timeimage, 46+50+14 48, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_TIME_IMAGE, 32 32, padding_timeimage, 0 0, MUSIC_IMAGE_ALBUM_TIME)
+
+ PART_RECT_PADDING(padding_time, 110+32+14 48, bg)
+ PART_TEXT_FONT(MUSIC_PART_FOLDER_TIME, 100 32, padding_time, 0 0, FONT_STYLE_REGULAR, 28, 0 0.5)
+
+ PART_RECT_PADDING(padding_playbtn, 1395-214*3-14*2 19, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_FOLDER_PLAYBTN, 214 62,
+ padding_playbtn, 0 0)
+
+ PART_RECT_PADDING(padding_nextbtn, 1395-214*2-14 19, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_FOLDER_NEXTBTN, 214 62,
+ padding_nextbtn, 0 0)
+
+ PART_RECT_PADDING(padding_lastbtn, 1395-214 19, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_FOLDER_LASTBTN, 214 62,
+ padding_lastbtn, 0 0)
+
+ PART_RECT_PADDING(padding_foldergrid, 0 116, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_FOLDER_GRID, 1395+20 732,
+ padding_foldergrid, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_MESSAGE_LAYOUT;
+ images {
+ image: "round_rectangle_9X9.png" COMP;
+ }
+ parts {
+ part {
+ name: "pad_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel2.relative: 0.0 0.0;
+ min: 960 1080-127;
+ align: 0 0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "part_bg";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "pad_bg";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "pad_bg";
+ relative: 1.0 1.0;
+ }
+ min: 727 154;
+ align: 0.5 0.5;
+ fixed: 1 1;
+ image {
+ normal: "round_rectangle_9X9.png";
+ border: 9 9 9 9;
+ }
+ color: 18 5 8 255;
+ }
+ }
+ part {
+ name: "pad_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "part_bg";
+ rel2.to: "part_bg";
+ rel2.relative: 0.0 0.0;
+ min: 20 0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_MESSAGE;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 687 154;
+ max: 687 154 ;
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 24;
+ align: 0.5 0.5;
+ }
+ rel1 {
+ to: "pad_text";
+ relative: 1 1;
+ }
+ rel2 {
+ to: "pad_text";
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+}
+
--- /dev/null
+group {
+ name: MUSIC_PLAYBACK_VIEW;
+ images {
+ image: MUSIC_IMAGE_PLAYBACK_SHADOW COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: "bg1";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 229 72 113 38;
+ }
+ }
+ part {
+ name: "bg2";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 204;
+ }
+ }
+
+ PART_RECT_PADDING(padding_song_title, 91 82, bg)
+ PART_TEXT_FONT(MUSIC_PART_SONG_TITLE, 1710 56, padding_song_title, 0 0, FONT_STYLE_BOLD, 50, 0 0.5)
+
+ PART_RECT_PADDING(padding_artist_album, 91 144, bg)
+ PART_TEXT_FONT(MUSIC_PART_ARTIST_ALBUM, 1710 36, padding_artist_album, 0 0, FONT_STYLE_BOLD, 30, 0 0.5)
+
+ PART_RECT_PADDING(padding_albumcover, 86 214, bg)
+ PART_RECT_COLOR(album_bg, 630 630, padding_albumcover, 0 0, 0 0 0 115)
+ PART_SWALLOW_BASIC(MUSIC_PART_ALBUMCOVER, 630 630, padding_albumcover, 0 0)
+
+ PART_RECT_PADDING(padding_shadow, 86 744, bg)
+ PART_IMAGE_BASIC(MUSIC_PART_PLAYBACK_SHADOW, 630 100, padding_shadow, 0 0, MUSIC_IMAGE_PLAYBACK_SHADOW)
+
+ PART_RECT_PADDING(padding_progresstime, 86+20 214+630-45, bg)
+ PART_TEXT_FONT(MUSIC_PART_PROGRESSTIME, 100 30, padding_progresstime, 0 0, FONT_STYLE_REGULAR, 25, 0 0.5)
+
+ PART_RECT_PADDING(padding_fulltime, 86+630-120 214+630-45, bg)
+ PART_TEXT_FONT(MUSIC_PART_FULLTIME, 100 30, padding_fulltime, 0 0, FONT_STYLE_REGULAR, 25, 1 0.5)
+
+ PART_RECT_PADDING(padding_controlbg, 86 844+8, bg)
+ PART_RECT_COLOR(controls_part_bg, 630 142, padding_controlbg, 0 0, 32 9 21 217)
+
+ PART_RECT_PADDING(padding_editbtns, 86+20 844-4, bg)
+ PART_SWALLOW_SHOWHIDE(MUSIC_PART_EDITBTNS, 590 154, padding_editbtns, 0 0)
+
+ PART_RECT_PADDING(padding_controlbtns, 86+34 844+8, bg)
+ PART_SWALLOW_SHOWHIDE(MUSIC_PART_CONTROLBTNS, 562 142, padding_controlbtns, 0 0)
+
+ PART_RECT_PADDING(padding_playlist, 756 214, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_PLAYLIST, 1045 866, padding_playlist, 0 0)
+
+ PART_RECT_PADDING(padding_progressbar, 86 844+4, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_PROGRESSBAR, 630 40, padding_progressbar, 0 0.5)
+
+ PART_RECT_PADDING(padding_setpopup, 85 696, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SETTINGS_POPUP, 252 172, padding_setpopup, 0 0)
+
+ part {
+ name: MUSIC_PART_VOLUME_LAYOUT;
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ }
+
+ programs {
+ program {
+ name: "edit-mode";
+ signal: MUSIC_SIGNAL_EDIT_MODE;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_state(PART:MUSIC_PART_CONTROLBTNS, "hide", 0.0);
+ set_state(PART:MUSIC_PART_EDITBTNS, "default", 0.0);
+ }
+ transition: LINEAR 1.0;
+ }
+ program {
+ name: "playback-mode";
+ signal: MUSIC_SIGNAL_PLAYBACK_MODE;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_state(PART:MUSIC_PART_CONTROLBTNS, "default", 0.0);
+ set_state(PART:MUSIC_PART_EDITBTNS, "hide", 0.0);
+ }
+ transition: LINEAR 1.0;
+ }
+ }
+}
--- /dev/null
+group {
+ name: MUSIC_SETTINGS_LAYOUT;
+ parts {
+ part{
+ name: bg;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ PART_RECT_PADDING(padding_settings_btnbox, 150 780, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SETTINGS_BTNBOX, 300 250, padding_settings_btnbox, 0 0)
+ }
+}
+
--- /dev/null
+group {
+ name: MUSIC_SONG_LAYOUT;
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ }
+ PART_RECT_PADDING(padding_songlist, 0 0, bg)
+ PART_SWALLOW_BASIC(MUSIC_PART_SONGLIST, 1395 848,
+ padding_songlist, 0 0)
+ }
+}
+
+
--- /dev/null
+group {
+ name: MUSIC_VOLUME_LAYOUT;
+ images {
+ image: "ico_vol.png" COMP;
+ image: "ico_mute.png" COMP;
+ image: "round_rectangle_9X9.png" COMP;
+ }
+ styles {
+ style {
+ name: "volume_style";
+ base: "align=center font=TizenSans font_size=34 color=#E54871FF font_weight=Bold";
+ }
+ }
+ parts {
+ part {
+ name: "padding.banner";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 0.5 1.0;
+ rel2.relative: 0.5 1.0;
+ min: 0 127;
+ align: 1.0 1.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: "banner.volume";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding.banner";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "padding.banner";
+ relative: 0.0 0.0;
+ }
+ min: 527 154;
+ align: 0.5 0.5;
+ fixed: 1 1;
+ image {
+ normal: "round_rectangle_9X9.png";
+ border: 9 9 9 9;
+ }
+ color: 0 0 0 153;
+ }
+ }
+ part {
+ name: "padding.icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "banner.volume";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "banner.volume";
+ relative: 0.0 0.0;
+ }
+ min: 57 52;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+
+ }
+ }
+ part {
+ name: "part.icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding.icon";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "padding.icon";
+ relative: 1.0 1.0;
+ }
+ min: 50 50;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ image.normal: "ico_vol.png";
+ }
+ description {
+ state: "mute" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "ico_mute.png";
+ }
+ }
+ part {
+ name: "padding.progressbar";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "part.icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "part.icon";
+ relative: 1.0 0.0;
+ }
+ min: 18 10;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_VOLUME_BAR;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding.progressbar";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "padding.progressbar";
+ relative: 1.0 1.0;
+ }
+ min: 280 8;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "padding.volume";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "banner.volume";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "banner.volume";
+ relative: 1.0 0.0;
+ }
+ min: 51 0;
+ align: 1.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_VOLUME_VALUE;
+ type: TEXTBLOCK;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding.volume";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "padding.volume";
+ relative: 0.0 0.0;
+ }
+ min: 60 154;
+ align: 1.0 0.0;
+ fixed: 1 1;
+ text.style: "volume_style";
+ }
+ }
+ }
+ programs {
+ program {
+ name: "show.mute";
+ signal: MUSIC_SIGNAL_VOLUME_MUTE;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "mute" 0.0;
+ target: "part.icon";
+ }
+ program {
+ name: "hide.mute";
+ signal: MUSIC_SIGNAL_VOLUME_UNMUTE;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: "part.icon";
+ }
+ }
+}
--- /dev/null
+#define STATE_NORMAL 0
+#define STATE_HIGHLIGHT 1
+
+group {
+ name: "elm/button/base/music_hover_entry";
+ images {
+ image: MUSIC_IMAGE_TICK COMP;
+ }
+ script {
+ public cur_state;
+ public hide_line;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 290 72;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "division_line";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 290 2;
+ color: 89 89 89 51;
+ rel1 {
+ to: "bg";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "bg";
+ }
+ align: 1.0 1.0;
+ fixed: 1 1;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 40 0;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 1.0;
+ }
+ fixed: 1 0;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 170 80;
+ rel1 {
+ to: "padding_text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "padding_text";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0.0 0.5;
+ }
+ color: 89 89 89 255;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ /*text {
+ font: FONT_STYLE_MEDIUM;
+ }*/
+ color: 255 255 255 255;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ /*text {
+ font: FONT_STYLE_MEDIUM;
+ }*/
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: "padding_icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 30;
+ rel1 {
+ to: "elm.text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.text";
+ relative: 1.0 0.0;
+ }
+ fixed: 1 1;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "image_part";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 20;
+ rel1 {
+ to: "padding_icon";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "padding_icon";
+ }
+ image.normal: MUSIC_IMAGE_TICK;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "load";
+ signal: "load";
+ source: "";
+ script {
+ set_int(cur_state, STATE_NORMAL);
+ set_int(hide_line, 0);
+ }
+ }
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ script {
+ new state;
+ state = get_int(cur_state);
+
+ if (state == STATE_HIGHLIGHT)
+ set_state(PART:"image_part", "selected", 0.0);
+
+ set_state(PART:"bg", "selected", 0.0);
+ set_state(PART:"division_line", "selected", 0.0);
+ set_state(PART:"elm.text", "selected", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ new state;
+ new var;
+ new buf[100];
+ state = get_int(cur_state);
+
+ if (state == STATE_HIGHLIGHT)
+ snprintf(buf, sizeof(buf), "highlight");
+ else
+ snprintf(buf, sizeof(buf), "default");
+
+ var = get_int(hide_line);
+ set_state(PART:"bg", buf, 0.0);
+ if (!var)
+ set_state(PART:"division_line", buf, 0.0);
+ set_state(PART:"elm.text", buf, 0.0);
+ set_state(PART:"image_part", buf, 0.0);
+ }
+ }
+ program {
+ name: "highlight";
+ signal: "elm,action,highlight";
+ source: "elm";
+ script {
+ set_int(cur_state, STATE_HIGHLIGHT);
+ }
+ after: "highlight1";
+ }
+ program {
+ name: "highlight1";
+ action: STATE_SET "highlight" 0.0;
+ target: "bg";
+ target: "elm.text";
+ target: "image_part";
+ target: "division_line";
+ }
+ program {
+ name: "hide_line";
+ signal: "elm,action,hideline";
+ source: "elm";
+ script {
+ set_int(hide_line, 1);
+ set_state(PART:"division_line", "selected", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_sourcebtn";
+ images {
+ image: MUSIC_IMAGE_PULLDOWN_ARROW COMP;
+ image: MUSIC_IMAGE_PLAYBACK_ROUND_ICON COMP;
+ }
+ script {
+ public cur_state;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 290 72;
+ rel2.relative: 0.0 0.0;
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUND_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ color: 255 255 255 12;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "selected_0" 0.0;
+ inherit: "selected" 0.0;
+ color: 229 72 113 0;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "padding_txt";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 0;
+ rel2.relative: 0.0 0.0;
+ align: 0.0 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: 0 72;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "padding_txt";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "padding_txt";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0.0 0.5;
+ min: 1 0;
+ }
+ align: 0.0 0.0;
+ color: 175 175 175 255;
+ fixed: 1 1;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 175 175 175 25;
+ }
+ }
+ part {
+ name: "padding_updown";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 10 0;
+ rel1 {
+ to: "elm.text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.text";
+ }
+ align: 0.0 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_ELM_SWALLOWICON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 24 24;
+ max: 24 24;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "padding_updown";
+ }
+ rel2 {
+ to: "padding_updown";
+ }
+ align: 0.0 0.5;
+ fixed: 1 1;
+ color: 193 193 193 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "focused" 0.0;
+ }
+ description {
+ state: "mouse_over" 0.0;
+ inherit: "focused" 0.0;
+ }
+ }
+ part {
+ name: "padding_arrow";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 24 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ }
+ align: 1.0 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: "arrow_img";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 24 24;
+ max: 24 24;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "padding_arrow";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to: "padding_arrow";
+ }
+ image.normal: MUSIC_IMAGE_PULLDOWN_ARROW;
+ align: 1.0 0.5;
+ fixed: 1 1;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 175 175 175 25;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "load";
+ signal: "load";
+ source: "";
+ script {
+ set_int(cur_state, STATE_NORMAL);
+ }
+ }
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ script {
+ set_int(cur_state, STATE_NORMAL);
+ set_state(PART:"bg", "selected", 0.0);
+ set_state(PART:"elm.text", "selected", 0.0);
+ }
+ }
+ program {
+ name: "focus,anim";
+ action: STATE_SET "selected" 0.0;
+ target: "bg";
+ target: "elm.text";
+ target: MUSIC_PART_ELM_SWALLOWICON;
+ transition: LINEAR 0.17;
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ new state;
+ state = get_int(cur_state);
+ if (state == STATE_HIGHLIGHT) {
+ set_state(PART:"bg", "highlight_0", 0.0);
+ set_state(PART:"elm.text", "highlight", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "highlight", 0.0);
+ run_program(PROGRAM:"unfocus,high,anim");
+ } else {
+ set_state(PART:"bg","default", 0.0);
+ set_state(PART:"elm.text","default", 0.0);
+ }
+ }
+ }
+ program {
+ name: "unfocus,high,anim";
+ action: STATE_SET "highlight" 0.0;
+ target: "bg";
+ transition: LINEAR 0.17;
+ }
+ program {
+ name: "unfocus,default,anim";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text";
+ target: MUSIC_PART_ELM_SWALLOWICON;
+ transition: LINEAR 0.17;
+ }
+ program {
+ name: "unfocus";
+ signal: "unfocused";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text";
+ target: MUSIC_PART_ELM_SWALLOWICON;
+ }
+ program {
+ name: "highlight";
+ signal: "highlight";
+ source: "";
+ script {
+ set_int(cur_state, STATE_HIGHLIGHT);
+ set_state(PART:"bg", "highlight", 0.0);
+ set_state(PART:"elm.text", "highlight", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "highlight", 0.0);
+ }
+ }
+ program {
+ name: "unhighlight";
+ signal: "unhighlight";
+ source: "";
+ script {
+ set_int(cur_state, STATE_NORMAL);
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "default", 0.0);
+ }
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"arrow_img", "default", 0.0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script{
+ set_state(PART:"elm.text", "disabled", 0.0);
+ set_state(PART:"arrow_img", "disabled", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_sortbtn";
+ inherit: "elm/button/base/music_sourcebtn";
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 76;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/menubtn";
+ images {
+ image: MUSIC_GROUPBTN_BG COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 406 87;
+ image.normal: MUSIC_GROUPBTN_BG;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 51;
+ }
+ }
+ part {
+ name: "padding_icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 85 0;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 1.0;
+ }
+ fixed: 1 0;
+ visible: 0;
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: MUSIC_PART_ELM_SWALLOWICON;
+ type: SWALLOW;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 40 40;
+ rel1 {
+ to: "padding_icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "padding_icon";
+ }
+ fixed: 1 0;
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 37 0;
+ rel1 {
+ to: MUSIC_PART_ELM_SWALLOWICON;
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: MUSIC_PART_ELM_SWALLOWICON;
+ relative: 1.0 0.0;
+ }
+ fixed: 1 1;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 219 87;
+ rel1 {
+ to_x: "padding_text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to_x: "padding_text";
+ relative: 1.0 1.0;
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0.0 0.5;
+ }
+ color: 255 255 255 153;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_BOLD;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_MEDIUM;
+ }
+ color: 255 255 255 255;
+ }
+ }
+ }
+ script {
+ public select_status = 0;
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ script {
+ if (get_int(select_status) != 1) {
+ emit("elm,action,click", "");
+ }
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ if (get_int(select_status) == 1) {
+ set_state(PART:"bg", "highlight", 0.0);
+ set_state(PART:"elm.text", "highlight", 0.0);
+ } else {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ }
+ program {
+ name: "select";
+ signal: MUSIC_SIGNAL_GROUP_SELECTED;
+ source: MUSIC_BASE_VIEW;
+ script {
+ new st[31];
+ new Float: vl;
+ set_int(select_status, 1);
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "focused")) {
+ set_state(PART:"bg", "highlight", 0.0);
+ set_state(PART:"elm.text", "highlight", 0.0);
+ }
+ }
+ }
+ program {
+ name: "unselect";
+ signal: MUSIC_SIGNAL_GROUP_UNSELECTED;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(select_status, 0);
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/playbackbtn";
+ images {
+ image: MUSIC_IMAGE_PLAYBACK_ICON COMP;
+ image: MUSIC_IMAGE_PLAYBACK_ROUND_ICON COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUND_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ color: 116 86 99 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ rel1.to: bg;
+ rel2.to: bg;
+ rel2.relative: 0.0 0.0;
+ image.normal: MUSIC_IMAGE_PLAYBACK_ICON;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "image";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "image";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "image";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ action: STATE_SET "selected" 0.0;
+ target: "bg";
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_NORMAL_BG COMP;
+ image: MUSIC_IMAGE_BTN_FOCUS_BG COMP;
+ }
+ parts {
+ part {
+ name: "map";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ perspective {
+ zplane: 0;
+ focal: 1000;
+ }
+ visible: 0;
+ }
+ description {
+ state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ perspective.zplane: -100;
+ }
+ }
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_NORMAL_BG;
+ map {
+ on: 1;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_BTN_FOCUS_BG;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 175 175 175 25;
+ }
+ description {
+ state: "highlight" 0.0;
+ inherit: "focused" 0.0;
+ color: 229 72 113 102;
+ }
+ }
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ map {
+ on: 1;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 175 175 175 25;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "image";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"image", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,press", "");
+ }
+ }
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "image";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"image", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,unpress", "");
+ }
+ }
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "image";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"image", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,click", "");
+ }
+ }
+ }
+ program {
+ name: "button_clicked_custom";
+ signal: MUSIC_SIGNAL_BTN_CLICKED;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "clicked" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ after: "after_clicked";
+ }
+ program {
+ name: "after_clicked";
+ action: STATE_SET "default" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "bg";
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (!strcmp(st, "focused")) {
+ set_state(PART:"bg","default", 0.0);
+ }
+ }
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg","default", 0.0);
+ set_state(PART:"image","default", 0.0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg","disabled", 0.0);
+ set_state(PART:"image","disabled", 0.0);
+ }
+ }
+ program {
+ name: "highlight";
+ signal: MUSIC_SIGNAL_CONTROL_SELECTED;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "highlight" 0.0;
+ target: "bg";
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_settings";
+ inherit: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_SETTINGS COMP;
+ }
+ parts {
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_SETTINGS;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_rewind";
+ inherit: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_REWIND COMP;
+ }
+ parts {
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_REWIND;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_forward";
+ inherit: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_FORWARD COMP;
+ }
+ parts {
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_FORWARD;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_shuffle";
+ inherit: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_SHUFFLE_OFF COMP;
+ image: MUSIC_IMAGE_BTN_SHUFFLE_ON COMP;
+ }
+ parts {
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_SHUFFLE_OFF;
+ }
+ description {
+ state: "on" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_BTN_SHUFFLE_ON;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "shuffle_off";
+ signal: MUSIC_SIGNAL_SHUFFLE_OFF;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: "image";
+ }
+ program {
+ name: "shuffle_on";
+ signal: MUSIC_SIGNAL_SHUFFLE_ON;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "on" 0.0;
+ target: "image";
+ }
+ }
+
+}
+
+group {
+ name: "elm/button/base/music_btn_repeat";
+ inherit: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_REPEAT_OFF COMP;
+ image: MUSIC_IMAGE_BTN_REPEAT_ON COMP;
+ image: MUSIC_IMAGE_BTN_REPEAT_ONLY COMP;
+ }
+ parts {
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_REPEAT_OFF;
+ }
+ description {
+ state: "on" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_BTN_REPEAT_ON;
+ }
+ description {
+ state: "only" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_BTN_REPEAT_ONLY;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "repeat_off";
+ signal: MUSIC_SIGNAL_REPEAT_OFF;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: "image";
+ }
+ program {
+ name: "repeat_on";
+ signal: MUSIC_SIGNAL_REPEAT_ALL;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "on" 0.0;
+ target: "image";
+ }
+ program {
+ name: "repeat_only";
+ signal: MUSIC_SIGNAL_REPEAT_ONE;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "only" 0.0;
+ target: "image";
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_play";
+ inherit: "elm/button/base/music_btn_common";
+ images {
+ image: MUSIC_IMAGE_BTN_PLAY COMP;
+ image: MUSIC_IMAGE_BTN_PAUSE COMP;
+ }
+ parts {
+ part {
+ name: "image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 72 72;
+ image.normal: MUSIC_IMAGE_BTN_PAUSE;
+ }
+ description {
+ state: "play" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_BTN_PLAY;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "play";
+ signal: MUSIC_SIGNAL_PLAY;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "default" 0.0;
+ target: "image";
+ }
+ program {
+ name: "pause";
+ signal: MUSIC_SIGNAL_PAUSE;
+ source: MUSIC_PLAYBACK_VIEW;
+ action: STATE_SET "play" 0.0;
+ target: "image";
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_settings_option_t";
+ images {
+ image: MUSIC_IMAGE_PLAYBACK_ROUNDT_ICON COMP;
+ image: MUSIC_IMAGE_PLAYBACK_ROUNDB_ICON COMP;
+ }
+
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 252 84;
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUNDT_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "text_pad";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 0;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ fixed: 1 1;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 220 84;
+ rel1.to: "text_pad";
+ rel1.relative: 1 1;
+ rel2.to: "text_pad";
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 89 89 89 255;
+ fixed: 1 1;
+ align: 0 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_BOLD;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 89 89 89 51;
+ }
+ }
+ part{
+ name: "downarrow";
+ description {
+ state: "default" 0.0;
+ min: 17 10;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,press", "");
+ }
+ }
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,unpress", "");
+ }
+ }
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,click", "");
+ }
+ }
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ set_state(PART:"downarrow", "focused", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"downarrow", "default", 0.0);
+ }
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"downarrow", "default", 0.0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script{
+ set_state(PART:"bg", "disabled", 0.0);
+ set_state(PART:"elm.text", "disabled", 0.0);
+ set_state(PART:"downarrow", "disabled", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_settings_option_b";
+ inherit: "elm/button/base/music_btn_settings_option_t";
+ images {
+ image: MUSIC_IMAGE_POPUP_DOWN_ARROW COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ description {
+ state: "default" 0.0;
+ min: 252 84;
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUNDB_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "padding_arrow";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 70 84;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 1.0;
+ }
+ fixed: 1 0;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+
+ part {
+ name: "downarrow";
+ description {
+ state: "default" 0.0;
+ min: 17 10;
+ align: 0.5 0.0;
+ fixed: 1 1;
+ rel1.to: "padding_arrow";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding_arrow";
+ image.normal: MUSIC_IMAGE_POPUP_DOWN_ARROW;
+ color: 255 255 255 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_btn_edit";
+ images {
+ image: MUSIC_IMAGE_PLAYBACK_ROUND_ICON COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 190 70;
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUND_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ color: 204 204 204 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 204 204 204 127;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 190 70;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 28;
+ align: 0.5 0.5;
+ }
+ color: 89 89 89 255;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_BOLD;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 89 89 89 127;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,press", "");
+ }
+ }
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,unpress", "");
+ }
+ }
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ script {
+ new st[31];
+ new Float: vl;
+ get_state(PART:"bg", st, 30, vl);
+ if (strcmp(st, "disabled")) {
+ emit("elm,action,click", "");
+ }
+ }
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ script{
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script{
+ set_state(PART:"bg", "dedfault", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script{
+ set_state(PART:"bg", "dedfault", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script{
+ set_state(PART:"bg", "disabled", 0.0);
+ set_state(PART:"elm.text", "disabled", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/add_common_btn";
+ images {
+ image: MUSIC_IMAGE_ADDBTN_BG_NORMAL COMP;
+ image: MUSIC_IMAGE_ADDBTN_BG_FOCUS COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 214 62;
+ image {
+ normal: MUSIC_IMAGE_ADDBTN_BG_NORMAL;
+ border: 30 30 30 30;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_ADDBTN_BG_FOCUS;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 102;
+ }
+ }
+ part {
+ name: "var_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 62;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ fixed: 1 1;
+ align: 0 0;
+ }
+ }
+ part {
+ name: MUSIC_PART_ELM_SWALLOWICON;
+ type: SWALLOW;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 30 62;
+ rel1 {
+ to: "var_padding";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "var_padding";
+ relative: 1.0 0.0;
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ aspect: 1.0 1.0;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 102;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 5 62;
+ rel1 {
+ to: MUSIC_PART_ELM_SWALLOWICON;
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: MUSIC_PART_ELM_SWALLOWICON;
+ relative: 1.0 0.0;
+ }
+ fixed: 1 1;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 115 62;
+ rel1 {
+ to: "padding_text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "padding_text";
+ relative: 1.0 0.0;
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 26;
+ align: 0.0 0.5;
+ }
+ color: 255 255 255 255;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_BOLD;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_REGULAR;
+ }
+ color: 255 255 255 102;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ script {
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "focused", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "default", 0.0);
+ }
+ }
+ program {
+ name: "enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg","default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "default", 0.0);
+ }
+ }
+ program {
+ name: "disablebg";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg","disabled", 0.0);
+ set_state(PART:"elm.text", "disabled", 0.0);
+ set_state(PART:MUSIC_PART_ELM_SWALLOWICON, "disabled", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/add_play_btn";
+ inherit: "elm/button/base/add_common_btn";
+ parts {
+ part {
+ name: "var_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 61 62;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ fixed: 1 1;
+ align: 0 0;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/add_next_btn";
+ inherit: "elm/button/base/add_common_btn";
+ parts {
+ part {
+ name: "var_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 62;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ fixed: 1 1;
+ align: 0 0;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/add_last_btn";
+ inherit: "elm/button/base/add_common_btn";
+ parts {
+ part {
+ name: "var_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 35 62;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ fixed: 1 1;
+ align: 0 0;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_listbtn";
+ images {
+ image: MUSIC_IMAGE_ADDBTN_BG_NORMAL COMP;
+ image: MUSIC_IMAGE_ADDBTN_BG_FOCUS COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 214 62;
+ image {
+ normal: MUSIC_IMAGE_ADDBTN_BG_NORMAL;
+ border: 30 30 30 30;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_ADDBTN_BG_FOCUS;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 102;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 185 62;
+ rel1 {
+ to: "bg";
+ relative: 0.5 0.0;
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.5 0.0;
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 26;
+ align: 0.5 0.5;
+ }
+ color: 255 255 255 255;
+ fixed: 1 1;
+ align: 0.5 0.0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_BOLD;
+ }
+ color: 255 255 255 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_REGULAR;
+ }
+ color: 255 255 255 102;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ script {
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ program {
+ name: "enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg","default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ program {
+ name: "disablebg";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script {
+ set_state(PART:"bg","disabled", 0.0);
+ set_state(PART:"elm.text", "disabled", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/music_middletext_btn";
+ script {
+ public bottom;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 360 80;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: "division_line";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 360 2;
+ color: 222 222 222 255;
+ rel1 {
+ to: "bg";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "bg";
+ }
+ align: 1.0 1.0;
+ fixed: 1 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 40 0;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ relative: 0.0 1.0;
+ }
+ fixed: 1 0;
+ visible: 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 260 80;
+ rel1 {
+ to: "padding_text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "padding_text";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0.0 0.5;
+ }
+ color: 89 89 89 255;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ text {
+ font: FONT_STYLE_MEDIUM;
+ }
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "uparrow";
+ description {
+ state: "default" 0.0;
+ min: 17 10;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "button_down";
+ signal: "mouse,down,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name: "button_mouseup";
+ signal: "mouse,up,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name: "button_clicked";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "focused";
+ signal: "elm,action,focus";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "selected", 0.0);
+ set_state(PART:"division_line", "hide", 0.0);
+ set_state(PART:"elm.text", "selected", 0.0);
+ set_state(PART:"uparrow", "selected", 0.0);
+ }
+ }
+ program {
+ name: "unfocused";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"uparrow", "default", 0.0);
+ if (get_int(bottom) != 1)
+ set_state(PART:"division_line", "default", 0.0);
+ }
+ }
+ program {
+ name: "hide_line";
+ signal: MUSIC_SIGNAL_HIDELINE;
+ source: MUSIC_CONTEXT_VIEW;
+ script {
+ set_int(bottom, 1);
+ set_state(PART:"division_line", "hide", 0.0);
+ }
+ }
+ }
+}
+group {
+ name: "elm/button/base/music_toptext_btn";
+ inherit: "elm/button/base/music_middletext_btn";
+ images {
+ image: MUSIC_IMAGE_PLAYBACK_ROUNDT_ICON COMP;
+ image: MUSIC_IMAGE_POPUP_UP_ARROW COMP;
+ }
+ parts {
+ part {
+ name: "total_area";
+ scale: 1;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 360 90;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "padding_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 10;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ rel1.to: "total_area";
+ rel2 {
+ relative: 0.0 0.0;
+ to: "total_area";
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "bg";
+ scale: 1;
+ type: IMAGE;
+ description {
+ state: "default" 0.0;
+ min: 360 80;
+ align: 0 0;
+ fixed: 1 1;
+ color: 255 255 255 255;
+ rel1.to: "padding_bg";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding_bg";
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUNDT_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ part {
+ name: "padding.uparrow";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 300 0;
+ align: 0.0 1.0;
+ fixed: 1 1;
+ rel1.to: "bg";
+ rel2 {
+ relative: 0.0 0.0;
+ to: "bg";
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "uparrow";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 17 10;
+ align: 0.0 1.0;
+ fixed: 1 1;
+ image.normal: MUSIC_IMAGE_POPUP_UP_ARROW;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "padding.uparrow";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "padding.uparrow";
+ }
+ visible: 1;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ }
+}
+group {
+ name: "elm/button/base/music_bottomtext_btn";
+ inherit: "elm/button/base/music_middletext_btn";
+ images {
+ image: MUSIC_IMAGE_PLAYBACK_ROUNDB_ICON COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ scale: 1;
+ type: IMAGE;
+ description {
+ state: "default" 0.0;
+ min: 360 80;
+ color: 255 255 255 255;
+ image {
+ normal: MUSIC_IMAGE_PLAYBACK_ROUNDB_ICON;
+ border: 4 4 4 4;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+group { name: "elm/ctxpopup/base/music-common-popup";
+ parts {
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/ctxpopup/base/music_listpopup";
+ parts {
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 360 810;
+ max: 360 810;
+ align: 0 0;
+ }
+ }
+ }
+}
--- /dev/null
+group {
+ name: "elm/gengrid/item/music_albumgrid/default";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text elm.text1";
+ data.item: "contents" "elm.swallow.icon";
+ parts {
+ part {
+ name: "bg_with_border";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 263+20 359+20;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "map";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ perspective {
+ zplane: 0;
+ focal: 1000;
+ }
+ visible: 0;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ perspective.zplane: 50;
+ }
+ description {
+ state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ perspective.zplane: -100;
+ }
+ }
+ part {
+ name: "elm.bg";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 263 263;
+ rel1.to:"bg_with_border";
+ rel2.to:"bg_with_border";
+ rel2.relative: 0.0 0.0;
+ color: 0 0 0 76;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part {
+ name: "icon_bg";
+ scale: 1;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 263 263;
+ rel1 {
+ to: "elm.bg";
+ }
+ rel2 {
+ to: "elm.bg";
+ relative: 0.0 0.0;
+ }
+ align: 0.0 0.0;
+ color: 0 0 0 76;
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1.to: "icon_bg";
+ rel2.to: "icon_bg";
+ align: 0.5 0.5;
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part { name: "left_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 8 263;
+ rel1.to:"icon_bg";
+ rel2.to:"icon_bg";
+ rel2.relative: 0.0 0.0;
+ color: 229 72 113 0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part { name: "right_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 8 263;
+ rel1.to:"icon_bg";
+ rel1.relative: 1.0 0.0;
+ rel2.to:"icon_bg";
+ rel2.relative: 1.0 0.0;
+ color: 229 72 113 0;
+ fixed: 1 1;
+ align: 1.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part { name: "top_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 263-16 8;
+ rel1.to: "left_over";
+ rel1.relative: 1.0 0.0;
+ rel2.to: "right_over";
+ rel2.relative: 0.0 0.0;
+ color: 229 72 113 0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part { name: "bottom_bg";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 263 96;
+ rel1.to:"icon_bg";
+ rel1.relative: 0.0 1.0;
+ rel2.to:"icon_bg";
+ rel2.relative: 0.0 1.0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 0 0 0 76;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+ }
+ }
+ part { name: "bottom_over";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 263 96;
+ rel1.to:"icon_bg";
+ rel1.relative: 0.0 1.0;
+ rel2.to:"icon_bg";
+ rel2.relative: 0.0 1.0;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 229 72 113 0;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ map.on: 1;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 16;
+ rel1 {
+ to: "icon_bg";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "icon_bg";
+ relative: 0.0 1.0;
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 223 40;
+ max: 223 40;
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ }
+ rel1 {
+ to: "padding_text";
+ relative: 1 1;
+ }
+ rel2 {
+ to: "padding_text";
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 211 211 211 255;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ map.on: 1;
+ }
+ }
+ part {
+ name: "elm.padding.text";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 40;
+ rel1 {
+ to: "elm.text";
+ }
+ rel2 {
+ to: "elm.text";
+ relative: 0.0 0.0;
+ }
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 223 25;
+ max: 223 25;
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 22;
+ }
+ rel1 {
+ to: "elm.padding.text";
+ relative: 1 1;
+ }
+ rel2 {
+ to: "elm.padding.text";
+ }
+ fixed: 1 1;
+ align: 0.0 0.0;
+ color: 128 128 128 255;
+ map {
+ on: 0;
+ perspective_on: 1;
+ alpha: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ map.on: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,focused";
+ source: "elm";
+ action: STATE_SET "selected" 0.0;
+ target: "elm.swallow.icon";
+ target: "elm.text";
+ target: "elm.text1";
+ target: "bottom_over";
+ target: "left_over";
+ target: "top_over";
+ target: "right_over";
+ target: "elm.bg";
+ target: "icon_bg";
+ target: "bottom_bg";
+ //target: "map";
+ transition: LINEAR 0.3;
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unfocused";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.swallow.icon";
+ target: "elm.text";
+ target: "elm.text1";
+ target: "bottom_over";
+ target: "left_over";
+ target: "top_over";
+ target: "right_over";
+ target: "elm.bg";
+ target: "icon_bg";
+ target: "bottom_bg";
+ //target: "map";
+ transition: LINEAR 0.3;
+ }
+ program {
+ name: "button_activated";
+ signal: "elm,state,activated";
+ source: "elm";
+ action: STATE_SET "clicked" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ after: "after_clicked";
+ }
+ program {
+ name: "button_clicked";
+ signal: "elm,state,selected";
+ source: "elm";
+ action: STATE_SET "clicked" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ after: "after_clicked";
+ }
+ program {
+ name: "after_clicked";
+ action: STATE_SET "default" 0.0;
+ target: "map";
+ transition: DECELERATE 0.2;
+ after: "item_select";
+ }
+ program {
+ name: "item_select";
+ action: SIGNAL_EMIT MUSIC_SIGNAL_BTN_CLICKED MUSIC_BASE_VIEW;
+ }
+ }
+}
+
--- /dev/null
+group {
+ name: "elm/genlist/item/music_songlist/default";
+ data.item: "selectraise" "on";
+ data.item: "focusraise" "on";
+ data.item: "texts" "elm.text elm.text1 elm.text2 elm.text3";
+ data.item: "contents" "elm.swallow.icon";
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 1395 87;
+ color: 0 0 0 39;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "default_odd" 0.0;
+ min: 1395 87;
+ color: 0 0 0 77;
+ }
+ }
+ part {
+ name: "elm.swallow.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 4 4;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "icon_bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 79 79;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.swallow.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.swallow.pad";
+ }
+ color: 18 5 8 255;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 79 79;
+ align: 0.0 0.0;
+ aspect: 1.0 1.0;
+ rel1 {
+ to: "elm.swallow.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.swallow.pad";
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 201 66 102 204;
+ }
+ }
+ part {
+ name: "elm.text.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 108 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 557 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text1.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 700 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 275 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text1.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text1.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text2.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 1010 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text2";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 225 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text2.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text2.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text3.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 1270 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text3";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 90 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text3.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text3.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 1 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ script {
+ public evenodd_status = 0;
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,focused";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.swallow.icon", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ set_state(PART:"elm.text1", "focused", 0.0);
+ set_state(PART:"elm.text2", "focused", 0.0);
+ set_state(PART:"elm.text3", "focused", 0.0);
+ }
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unfocused";
+ source: "elm";
+ script {
+ if (get_int(evenodd_status) == 0) {
+ set_state(PART:"bg", "default", 0.0);
+ } else {
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ set_state(PART:"elm.swallow.icon", "default", 0.0);
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"elm.text1", "default", 0.0);
+ set_state(PART:"elm.text2", "default", 0.0);
+ set_state(PART:"elm.text3", "default", 0.0);
+ }
+ }
+ program {
+ name: "even_row";
+ signal: MUSIC_SIGNAL_EVEN_ROW;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(evenodd_status, 0);
+ set_state(PART:"bg", "default", 0.0);
+ }
+ }
+ program {
+ name: "odd_row";
+ signal: MUSIC_SIGNAL_ODD_ROW;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(evenodd_status, 1);
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/music_album_songlist/default";
+ data.item: "selectraise" "on";
+ data.item: "focusraise" "on";
+ data.item: "texts" "elm.text elm.text1 elm.text2 elm.text3";
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 1395 87;
+ color: 0 0 0 39;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "default_odd" 0.0;
+ min: 1395 87;
+ color: 0 0 0 77;
+ }
+ }
+ part {
+ name: "elm.text.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 25 0;
+ align: 0.0 0.0;
+ rel1.to: bg;
+ rel2 {
+ to: bg;
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 40 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text.pad";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 22;
+ align: 0.5 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text1.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 20 0;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.text";
+ relative: 1.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 840 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text1.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text1.pad";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0.0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text2.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 35 0;
+ rel1 {
+ to: "elm.text1";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.text1";
+ relative: 1.0 0.0;
+ }
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text2";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 275 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text2.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text2.pad";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0.0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text3.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 35 0;
+ rel1 {
+ to: "elm.text2";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.text2";
+ relative: 1.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text3";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 90 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text3.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text3.pad";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 1.0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ script {
+ public evenodd_status = 0;
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,focused";
+ source: "elm";
+ script {
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ set_state(PART:"elm.text1", "focused", 0.0);
+ set_state(PART:"elm.text2", "focused", 0.0);
+ set_state(PART:"elm.text3", "focused", 0.0);
+ }
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unfocused";
+ source: "elm";
+ script {
+ if (get_int(evenodd_status) == 0) {
+ set_state(PART:"bg", "default", 0.0);
+ } else {
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"elm.text1", "default", 0.0);
+ set_state(PART:"elm.text2", "default", 0.0);
+ set_state(PART:"elm.text3", "default", 0.0);
+ }
+ }
+ program {
+ name: "even_row";
+ signal: MUSIC_SIGNAL_EVEN_ROW;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(evenodd_status, 0);
+ set_state(PART:"bg", "default", 0.0);
+ }
+ }
+ program {
+ name: "odd_row";
+ signal: MUSIC_SIGNAL_ODD_ROW;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(evenodd_status, 1);
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/music_playlist/default";
+ data.item: "selectraise" "on";
+ data.item: "focusraise" "on";
+ data.item: "texts" "elm.text0 elm.text1 elm.text2 elm.text3 elm.text4";
+ data.item: "contents" "elm.swallow.icon";
+ images {
+ image: MUSIC_IMAGE_PLAY_ICON COMP;
+ image: MUSIC_IMAGE_UNCHECK_NORMAL COMP;
+ image: MUSIC_IMAGE_UNCHECK_FOCUS COMP;
+ image: MUSIC_IMAGE_UNCHECK_DIM COMP;
+ image: MUSIC_IMAGE_CHECK_NORMAL COMP;
+ image: MUSIC_IMAGE_CHECK_FOCUS COMP;
+ image: MUSIC_IMAGE_CHECK_DIM COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 1045 106;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "default_odd" 0.0;
+ min: 1045 106;
+ color: 0 0 0 39;
+ }
+ }
+ part {
+ name: "check.image.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 0 0;
+ align: 0.0 0.0;
+ rel1.to: bg;
+ rel2 {
+ to: bg;
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: 64 38;
+ }
+ }
+ part {
+ name: "check.image";
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 0 0;
+ align: 1.0 0.0;
+ aspect: 1.0 1.0;
+ rel1 {
+ to: "check.image.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "check.image.pad";
+ }
+ visible: 0;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: 30 30;
+ image.normal: MUSIC_IMAGE_UNCHECK_NORMAL;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "visible" 0.0;
+ image.normal: MUSIC_IMAGE_UNCHECK_FOCUS;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "visible" 0.0;
+ image.normal: MUSIC_IMAGE_UNCHECK_DIM;
+ }
+ description {
+ state: "visible" 0.1;
+ inherit: "visible" 0.0;
+ image.normal: MUSIC_IMAGE_CHECK_NORMAL;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "visible" 0.0;
+ image.normal: MUSIC_IMAGE_CHECK_FOCUS;
+ }
+ description {
+ state: "disabled" 0.1;
+ inherit: "visible" 0.0;
+ image.normal: MUSIC_IMAGE_CHECK_DIM;
+ }
+ }
+ part {
+ name: "elm.text0.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 18 0;
+ align: 0.0 0.0;
+ rel1 {
+ to: "check.image.pad";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "check.image.pad";
+ relative: 1.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text0";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 40 106;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text0.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text0.pad";
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 22;
+ align: 0.5 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ description {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.image.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 25 40;
+ align: 0.0 0.0;
+ rel1 {
+ to: "check.image.pad";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "check.image.pad";
+ relative: 1.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.image";
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 26 26;
+ align: 0.0 0.0;
+ aspect: 1.0 1.0;
+ rel1 {
+ to: "elm.image.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.image.pad";
+ }
+ image.normal: MUSIC_IMAGE_PLAY_ICON;
+ visible: 0;
+ }
+ description { state: "focused" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: "elm.swallow.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 18 9;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text0";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.text0";
+ relative: 1.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "icon_bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 88 88;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.swallow.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.swallow.pad";
+ }
+ color: 18 5 8 255;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 88 88;
+ align: 0.0 0.0;
+ aspect: 1.0 1.0;
+ rel1 {
+ to: "elm.swallow.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.swallow.pad";
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 201 66 102 204;
+ }
+ }
+ part {
+ name: "elm.text3.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 1045-34-93 0;
+ align: 0.0 0.0;
+ rel1.to: bg;
+ rel2 {
+ to: bg;
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text3";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 93 106;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text3.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text3.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "focused" 0.0;
+ }
+ }
+ part {
+ name: "elm.text1.leftpad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 26 16;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.swallow.icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.icon";
+ relative: 1.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text1.rightpad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 25 25+35;
+ align: 1.0 0.0;
+ rel1 {
+ to: "elm.text3";
+ }
+ rel2 {
+ to: "elm.text3";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ /*min: 639 34;
+ max: 703 34;*/
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text1.leftpad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text1.rightpad";
+ relative: 0.0 1.0;
+ }
+ text {
+ font: FONT_STYLE_REGULAR;
+ size: 30;
+ align: 0 0;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "focused" 0.0;
+ }
+ }
+ part {
+ name: "elm.text2";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ /*min: 639 26;
+ max: 703 26;*/
+ min: 0 25;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text1";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "elm.text1";
+ relative: 1.0 1.0;
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 22;
+ align: 0 0;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "focused" 0.0;
+ }
+ }
+ }
+ script {
+ public focus_status;
+ public select_status;
+ public edit_mode;
+ public check_status;
+ public evenodd_status;
+ }
+ programs {
+ program {
+ name: "go_focused";
+ signal: "elm,state,focused";
+ source: "elm";
+ script {
+ set_int(focus_status, 1);
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.swallow.icon", "focused", 0.0);
+ if (get_int(select_status) == 1) {
+ set_state(PART:"elm.image", "focused", 0.1);
+ set_state(PART:"elm.text0", "focused", 0.1);
+ set_state(PART:"elm.text1", "focused", 0.1);
+ set_state(PART:"elm.text2", "focused", 0.1);
+ set_state(PART:"elm.text3", "focused", 0.1);
+ } else {
+ set_state(PART:"elm.image", "focused", 0.0);
+ set_state(PART:"elm.text0", "focused", 0.0);
+ set_state(PART:"elm.text1", "focused", 0.0);
+ set_state(PART:"elm.text2", "focused", 0.0);
+ set_state(PART:"elm.text3", "focused", 0.0);
+ }
+ if (get_int(edit_mode) == 1) {
+ if (get_int(check_status) == 1) {
+ set_state(PART:"check.image", "focused", 0.1);
+ } else {
+ set_state(PART:"check.image", "focused", 0.0);
+ }
+ }
+ }
+ }
+ program {
+ name: "go_unfocused";
+ signal: "elm,state,unfocused";
+ source: "elm";
+ script {
+ set_int(focus_status, 0);
+ if (get_int(evenodd_status) == 0) {
+ set_state(PART:"bg", "default", 0.0);
+ } else {
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ set_state(PART:"elm.swallow.icon", "default", 0.0);
+ if (get_int(select_status) == 1) {
+ set_state(PART:"elm.image", "default", 0.1);
+ set_state(PART:"elm.text0", "default", 0.1);
+ set_state(PART:"elm.text1", "default", 0.1);
+ set_state(PART:"elm.text2", "default", 0.1);
+ set_state(PART:"elm.text3", "default", 0.1);
+ } else {
+ set_state(PART:"elm.image", "default", 0.0);
+ set_state(PART:"elm.text0", "default", 0.0);
+ set_state(PART:"elm.text1", "default", 0.0);
+ set_state(PART:"elm.text2", "default", 0.0);
+ set_state(PART:"elm.text3", "default", 0.0);
+ }
+ if (get_int(edit_mode) == 1) {
+ if (get_int(check_status) == 1) {
+ set_state(PART:"check.image", "visible", 0.1);
+ } else {
+ set_state(PART:"check.image", "visible", 0.0);
+ }
+ }
+ }
+ }
+ program {
+ name: "go_selected";
+ signal: MUSIC_SIGNAL_SELECT_ITEM;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(select_status, 1);
+ if (get_int(focus_status) == 1) {
+ set_state(PART:"elm.image", "focused", 0.1);
+ set_state(PART:"elm.text0", "focused", 0.1);
+ set_state(PART:"elm.text1", "focused", 0.1);
+ set_state(PART:"elm.text2", "focused", 0.1);
+ set_state(PART:"elm.text3", "focused", 0.1);
+ } else {
+ set_state(PART:"elm.image", "default", 0.1);
+ set_state(PART:"elm.text0", "default", 0.1);
+ set_state(PART:"elm.text1", "default", 0.1);
+ set_state(PART:"elm.text2", "default", 0.1);
+ set_state(PART:"elm.text3", "default", 0.1);
+ }
+ }
+ }
+ program {
+ name: "go_unselected";
+ signal: MUSIC_SIGNAL_UNSELECT_ITEM;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(select_status, 0);
+ if (get_int(focus_status) == 1) {
+ set_state(PART:"elm.image", "focused", 0.0);
+ set_state(PART:"elm.text0", "focused", 0.0);
+ set_state(PART:"elm.text1", "focused", 0.0);
+ set_state(PART:"elm.text2", "focused", 0.0);
+ set_state(PART:"elm.text3", "focused", 0.0);
+ } else {
+ set_state(PART:"elm.image", "default", 0.0);
+ set_state(PART:"elm.text0", "default", 0.0);
+ set_state(PART:"elm.text1", "default", 0.0);
+ set_state(PART:"elm.text2", "default", 0.0);
+ set_state(PART:"elm.text3", "default", 0.0);
+ }
+ }
+ }
+ program {
+ name: "show_check_boxes";
+ signal: MUSIC_SIGNAL_EDITMODE_ON;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(edit_mode, 1);
+ set_state(PART:"check.image.pad", "visible", 0.0);
+ set_state(PART:"check.image", "visible", 0.0);
+ }
+ }
+ program {
+ name: "hide_check_boxes";
+ signal: MUSIC_SIGNAL_EDITMODE_OFF;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(edit_mode, 0);
+ set_state(PART:"check.image.pad", "default", 0.0);
+ set_state(PART:"check.image", "default", 0.0);
+ }
+ }
+ program {
+ name: "check_enable";
+ signal: MUSIC_SIGNAL_CHECK_ON;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(check_status, 1);
+ if (get_int(focus_status) == 1) {
+ set_state(PART:"check.image", "focused", 0.1);
+ } else {
+ set_state(PART:"check.image", "visible", 0.1);
+ }
+ }
+ }
+ program {
+ name: "check_disable";
+ signal: MUSIC_SIGNAL_CHECK_OFF;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(check_status, 0);
+ if (get_int(focus_status) == 1) {
+ set_state(PART:"check.image", "focused", 0.0);
+ } else {
+ set_state(PART:"check.image", "visible", 0.0);
+ }
+ }
+ }
+ program {
+ name: "even_row";
+ signal: MUSIC_SIGNAL_EVEN_ROW;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(evenodd_status, 0);
+ set_state(PART:"bg", "default", 0.0);
+ }
+ }
+ program {
+ name: "odd_row";
+ signal: MUSIC_SIGNAL_ODD_ROW;
+ source: MUSIC_PLAYBACK_VIEW;
+ script {
+ set_int(evenodd_status, 1);
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ }
+ program {
+ name: "check_clicked";
+ signal: "mouse,clicked,1";
+ source: "check.image";
+ action: SIGNAL_EMIT MUSIC_SIGNAL_CHECK_CLICKED MUSIC_PLAYBACK_VIEW;
+ source: MUSIC_PLAYBACK_VIEW;
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/music_selectlist/default";
+ data.item: "selectraise" "on";
+ data.item: "focusraise" "on";
+ data.item: "texts" "elm.text elm.text1 elm.text2";
+ data.item: "contents" "elm.swallow.icon";
+ images {
+ image: MUSIC_IMAGE_UNCHECK_NORMAL COMP;
+ image: MUSIC_IMAGE_UNCHECK_FOCUS COMP;
+ image: MUSIC_IMAGE_CHECK_NORMAL COMP;
+ image: MUSIC_IMAGE_CHECK_FOCUS COMP;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 1395 87;
+ color: 0 0 0 39;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 72 113 255;
+ }
+ description {
+ state: "default_odd" 0.0;
+ min: 1395 87;
+ color: 0 0 0 77;
+ }
+ }
+ part {
+ name: "check.image.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 34 28;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "check.image";
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 30 30;
+ align: 0.0 0.0;
+ aspect: 1.0 1.0;
+ image.normal: MUSIC_IMAGE_UNCHECK_NORMAL;
+ rel1 {
+ to: "check.image.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "check.image.pad";
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_UNCHECK_FOCUS;
+ }
+ description {
+ state: "default" 0.1;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_CHECK_NORMAL;
+ }
+ description {
+ state: "focused" 0.1;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_CHECK_FOCUS;
+ }
+ }
+ part {
+ name: "elm.text.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 98 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 567 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text1.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 700 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 275 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text1.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text1.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text2.pad";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 1010 0;
+ align: 0.0 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 0.0 0.0;
+ }
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.text2";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 350 87;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text2.pad";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "elm.text2.pad";
+ }
+ text {
+ font: FONT_STYLE_MEDIUM;
+ size: 30;
+ align: 0 0.5;
+ }
+ color: 211 211 211 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ text.font: FONT_STYLE_BOLD;
+ color: 255 255 255 255;
+ }
+ }
+ }
+ script {
+ public evenodd_status = 0;
+ public focus_status = 0;
+ public check_status = 0;
+ }
+ programs {
+ program {
+ name: "go_active";
+ signal: "elm,state,focused";
+ source: "elm";
+ script {
+ set_int(focus_status, 1);
+ set_state(PART:"bg", "focused", 0.0);
+ set_state(PART:"elm.text", "focused", 0.0);
+ set_state(PART:"elm.text1", "focused", 0.0);
+ set_state(PART:"elm.text2", "focused", 0.0);
+ if (get_int(check_status) == 1) {
+ set_state(PART:"check.image", "focused", 0.1);
+ } else {
+ set_state(PART:"check.image", "focused", 0.0);
+ }
+ }
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,state,unfocused";
+ source: "elm";
+ script {
+ set_int(focus_status, 0);
+ if (get_int(evenodd_status) == 0) {
+ set_state(PART:"bg", "default", 0.0);
+ } else {
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"elm.text1", "default", 0.0);
+ set_state(PART:"elm.text2", "default", 0.0);
+ if (get_int(check_status) == 1) {
+ set_state(PART:"check.image", "default", 0.1);
+ } else {
+ set_state(PART:"check.image", "default", 0.0);
+ }
+ }
+ }
+ program {
+ name: "even_row";
+ signal: MUSIC_SIGNAL_EVEN_ROW;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(evenodd_status, 0);
+ set_state(PART:"bg", "default", 0.0);
+ }
+ }
+ program {
+ name: "odd_row";
+ signal: MUSIC_SIGNAL_ODD_ROW;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(evenodd_status, 1);
+ set_state(PART:"bg", "default_odd", 0.0);
+ }
+ }
+ program {
+ name: "check_enable";
+ signal: MUSIC_SIGNAL_CHECK_ON;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(check_status, 1);
+ if (get_int(focus_status) == 1) {
+ set_state(PART:"check.image", "focused", 0.1);
+ } else {
+ set_state(PART:"check.image", "default", 0.1);
+ }
+ }
+ }
+ program {
+ name: "check_disable";
+ signal: MUSIC_SIGNAL_CHECK_OFF;
+ source: MUSIC_BASE_VIEW;
+ script {
+ set_int(check_status, 0);
+ if (get_int(focus_status) == 1) {
+ set_state(PART:"check.image", "focused", 0.0);
+ } else {
+ set_state(PART:"check.image", "default", 0.0);
+ }
+ }
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+group {
+ name: "elm/progressbar/horizontal/music_volume_bar";
+ parts {
+ part {
+ name: "elm.background.progressbar";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "elm.swallow.bar";
+ type: SWALLOW;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 28;
+ max: 99999 28;
+ rel1 {
+ to_x: "elm.text";
+ to_y: "elm.background.progressbar";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.background.progressbar";
+ }
+ }
+ }
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ align: 0.0 0.5;
+ rel1 {
+ to_y: "elm.background.progressbar";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_y: "elm.background.progressbar";
+ }
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ aspect: 1.0 1.0;
+ aspect_preference: VERTICAL;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 1 1;
+ align: 0.0 0.5;
+ rel1.to_x: "elm.swallow.content";
+ rel1.relative: 1.0 0.0;
+ rel2.to_x: "elm.swallow.content";
+ rel2.relative: 1.0 1.0;
+ color: 0 0 0 255;
+ text {
+ font: "Sans,Edje-Vera";
+ size: 10;
+ min: 0 0;
+ align: 0.0 0.5;
+ }
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ text.min: 1 1;
+ }
+ }
+ part {
+ name: "background";
+ type: RECT;
+ mouse_events: 0;
+ clip_to: "elm.background.progressbar";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 14;
+ max: 9999 14;
+ rel1.to: "elm.swallow.bar";
+ rel2.to: "elm.swallow.bar";
+ color, 255 255 255 25;
+ }
+ }
+ part {
+ name: "elm.text.status";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ visible: 0;
+ rel1 {
+ to: "background";
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: "background";
+ relative: 0.5 0.5;
+ }
+ text {
+ font: "Sans:style=Bold,Edje-Vera-Bold";
+ size: 10;
+ min: 1 1;
+ align: 0.5 0.0;
+ }
+ color: 0 0 0 255;
+ }
+ description {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ text.min: 0 0;
+ }
+ }
+ part {
+ name: "elm.progress.progressbar";
+ type, RECT;
+ mouse_events: 0;
+ scale: 1;
+ clip_to: "elm.background.progressbar";
+ description {
+ state: "default" 0.0;
+ min: 0 14;
+ max: 9999 14;
+ fixed: 1 1;
+ rel1.to: "elm.swallow.bar";
+ rel2 {
+ to_y: "elm.swallow.bar";
+ to_x: "elm.cur.progressbar";
+ }
+ color, 229 72 113 255;
+ }
+ description {
+ state: "invert" 0.0;
+ inherit: "default" 0.0;
+ rel1 {
+ to_y: "elm.swallow.bar";
+ to_x: "elm.cur.progressbar";
+ }
+ rel2.to: "elm.swallow.bar";
+ }
+ description {
+ state: "state_begin" 0.0;
+ inherit: "default" 0.0;
+ rel1.to: "elm.swallow.bar";
+ rel2 {
+ to: "elm.swallow.bar";
+ relative: 0.1 1.0;
+ }
+ }
+ description {
+ state: "state_end" 0.0;
+ inherit: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.bar";
+ relative: 0.9 0.0;
+ }
+ rel2.to: "elm.swallow.bar";
+ }
+ }
+ part {
+ name: "text-bar";
+ type: TEXT;
+ mouse_events: 0;
+ clip_to: "progress-rect";
+ effect: SOFT_SHADOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 0;
+ rel1.to: "elm.text.status";
+ rel2.to: "elm.text.status";
+ text {
+ text_source: "elm.text.status";
+ font: "Sans:style=Bold,Edje-Vera-Bold";
+ size: 10;
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ color: 224 224 224 255;
+ color3: 0 0 0 64;
+ }
+ description {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ text.min: 0 0;
+ }
+ }
+ part {
+ name: "elm.cur.progressbar";
+ mouse_events: 0;
+ scale: 1;
+ dragable {
+ confine: "background";
+ x: 1 1 1;
+ y: 0 0 0;
+ }
+ description {
+ state: "default" 0.0;
+ min: 0 28;
+ fixed: 1 1;
+ visible: 0;
+ rel1 {
+ to: "background";
+ relative: 0 0;
+ }
+ rel2.to: "background";
+ }
+ }
+ part {
+ name: "progress-rect";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.progress.progressbar";
+ rel2.to: "elm.progress.progressbar";
+ }
+ }
+ }
+ programs {
+ program {
+ name: "label_show";
+ signal: "elm,state,text,visible";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "elm.text";
+ }
+ program {
+ name: "label_hide";
+ signal: "elm,state,text,hidden";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ }
+ program {
+ name: "icon_show";
+ signal: "elm,state,icon,visible";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "elm.swallow.content";
+ }
+ program {
+ name: "icon_hide";
+ signal: "elm,state,icon,hidden";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.swallow.content";
+ }
+ program {
+ name: "units_show";
+ signal: "elm,state,units,visible";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "text-bar";
+ target: "elm.text.status";
+ }
+ program {
+ name: "units_hide";
+ signal: "elm,state,units,hidden";
+ source: "elm";
+ action: STATE_SET "hidden" 0.0;
+ target: "text-bar";
+ target: "elm.text.status";
+ }
+ program {
+ name: "slide_to_end";
+ action: STATE_SET "state_end" 0.0;
+ transition: LINEAR 0.5;
+ target: "elm.progress.progressbar";
+ after: "slide_to_begin";
+ }
+ program {
+ name: "slide_to_begin";
+ signal: "elm,state,slide,begin";
+ action: STATE_SET "state_begin" 0.0;
+ target: "elm.progress.progressbar";
+ transition: LINEAR 0.5;
+ after: "slide_to_end";
+ }
+ program {
+ name: "start_pulse";
+ signal: "elm,state,pulse,start";
+ source: "elm";
+ after: "slide_to_end";
+ }
+ program {
+ name: "stop_pulse";
+ signal: "elm,state,pulse,stop";
+ source: "elm";
+ action: ACTION_STOP;
+ target: "slide_to_begin";
+ target: "slide_to_end";
+ target: "start_pulse";
+ after: "state_pulse";
+ }
+ program {
+ name: "state_pulse";
+ signal: "elm,state,pulse"; source: "elm";
+ action: STATE_SET "state_begin" 0.0;
+ target: "elm.progress.progressbar";
+ after: "units_hide";
+ }
+ program {
+ name: "state_fraction";
+ signal: "elm,state,fraction";
+ source: "elm";
+ action: ACTION_STOP;
+ target: "slide_to_begin";
+ target: "slide_to_end";
+ target: "start_pulse";
+ action: STATE_SET "default" 0.0;
+ target: "elm.progress.progressbar";
+ }
+ program {
+ name: "set_invert_on";
+ signal: "elm,state,inverted,on";
+ source: "elm";
+ action: STATE_SET "invert" 0.0;
+ target: "elm.progress.progressbar";
+ }
+ program {
+ name: "set_invert_off";
+ signal: "elm,state,inverted,off";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.progress.progressbar";
+ }
+ }
+}
+
--- /dev/null
+#define SLIDER_FONT_SIZE 36
+
+group {
+ name: "elm/slider/horizontal/music_progress_slider";
+ parts {
+ part {
+ name: "background"; type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ max: 630 8;
+ color: 32 9 21 64;
+ }
+ }
+ part {
+ name: "bg"; type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "pad.left";
+ relative: 1 0.5;
+ }
+ rel2{
+ to: "pad.right";
+ relative: 0 0.5;
+ }
+ }
+ }
+ part {
+ name: "pad.left"; type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ align: 0 0.5;
+ }
+ }
+ part {
+ name: "pad.right"; type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ align: 1 0.5;
+ }
+ }
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "background";
+ rel2.to: "background";
+ min: 0 8;
+ max: 99999 8;
+ fixed: 0 1;
+ color: 32 9 21 64;
+ }
+ }
+ part {
+ name: "glow"; mouse_events: 0;
+ scale: 1;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1.to: "base";
+ rel2 {
+ relative: 0.5 1.0;
+ to_x: "button";
+ to_y: "base";
+ }
+ min: 0 8;
+ max: 99999 8;
+ fixed: 0 1;
+ align: 0.0 0.5;
+ color: 255 255 255 255;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 229 42 113 255;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 32 9 21 64;
+ }
+ }
+ part {
+ name: "pad.align"; type: SPACER; mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1.to: "elm.dragable.slider";
+ rel2.to: "elm.dragable.slider";
+ align: 0.0 1.0;
+ min: 10 1;
+ max: 10 1;
+ }
+ }
+ part {
+ name: "clip"; type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 0;
+ min: 76 40;
+ max: 76 40;
+ fixed: 1 1;
+ rel1 {
+ to: "elm.dragable.slider";
+ to_y: "bg";
+ }
+ rel2{
+ to: "elm.dragable.slider";
+ to_y: "bg";
+ }
+ }
+ }
+ part {
+ name: "button"; type: GROUP; mouse_events: 1;
+ source: "elm/slider/horizontal/music_indicator/default";
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 {
+ to: "elm.dragable.slider";
+ to_y: "bg";
+ }
+ rel2{
+ to: "elm.dragable.slider";
+ to_y: "bg";
+ }
+ align: 0.0 0.50;
+ }
+ description {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.swallow.bar"; type: SWALLOW;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to_y: "bg";
+ rel2.to_y: "bg";
+ fixed: 1 1;
+ min: 30 30;
+ }
+ }
+ part {
+ name: "elm.dragable.slider"; type: RECT; mouse_events: 0;
+ scale: 1;
+ dragable.x: 1 1 0;
+ dragable.y: 0 0 0;
+ dragable.confine: "bg";
+ description {
+ state: "default" 0.0;
+ min: 21 0;
+ max: 21 0;
+ rel1 {
+ to_x: "bg";
+ relative: 0 0.5;
+ }
+ rel2 {
+ to_x: "bg";
+ relative: 1 0.5;
+ }
+ color: 0 0 0 0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "elm.track.slider"; type: SWALLOW; mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ max: 21 0;
+ rel1.to: "elm.dragable.slider";
+ rel2.to: "elm.dragable.slider";
+ }
+ }
+ part {
+ name: "event"; type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "startup";
+ signal: "load";
+ source: "";
+ script {
+ emit("highlight,hide", "elm");
+ }
+ }
+ program {
+ name: "focuse_in";
+ signal: "elm,action,focus";
+ source: "elm";
+ script {
+ set_state(PART:"glow", "focused", 0.0);
+ emit("highlight,show", "elm");
+ }
+ }
+ program {
+ name: "focuse_out";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ script {
+ set_state(PART:"glow", "default", 0.0);
+ emit("highlight,hide", "elm");
+ }
+ }
+ program {
+ name: "text_visible";
+ signal: "elm,state,text,visible";
+ source: "elm";
+ action: STATE_SET "active" 0.0;
+ target: "bg";
+ }
+ program {
+ name: "text_hidden";
+ signal: "elm,state,text,hidden";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "event";
+ target: "glow";
+ target: "base";
+ after: "disable_ind";
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "event";
+ target: "glow";
+ target: "base";
+ after: "enable_ind";
+ }
+ program {
+ name: "enable_ind";
+ action: SIGNAL_EMIT "highlight,hide" "elm";
+ }
+ program {
+ name: "disable_ind";
+ action: SIGNAL_EMIT "highlight,disabled" "elm";
+ }
+ }
+}
+group {
+ name: "elm/slider/horizontal/music_indicator/default";
+ alias: "elm/slider/horizontal/popup/default";
+ images {
+ image: MUSIC_IMAGE_SLIDER_NOB_NORMAL COMP;
+ image: MUSIC_IMAGE_SLIDER_NOB_FOCUS COMP;
+ image: MUSIC_IMAGE_SLIDER_NOB_DIM COMP;
+ }
+ parts {
+ part {
+ name: "knob";
+ repeat_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: MUSIC_IMAGE_SLIDER_NOB_NORMAL;
+ min: 33 35;
+ max: 33 35;
+ align:0.5 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ description {
+ state: "unfocused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ min: 37 38;
+ max: 37 38;
+ image.normal: MUSIC_IMAGE_SLIDER_NOB_FOCUS;
+ visible: 1;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: MUSIC_IMAGE_SLIDER_NOB_DIM;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "highlight_show";
+ signal: "highlight,show";
+ source: "elm";
+ script {
+ set_state(PART:"knob", "focused", 0.0);
+ }
+ }
+ program {
+ name: "highlight_hide";
+ signal: "highlight,hide";
+ source: "elm";
+ script {
+ set_state(PART:"knob", "unfocused", 0.0);
+ }
+ }
+ program {
+ name: "enable";
+ signal: "highlight,enabled";
+ source: "elm";
+ script {
+ set_state(PART:"knob", "default", 0.0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "highlight,disabled";
+ source: "elm";
+ script {
+ set_state(PART:"knob", "disabled", 0.0);
+ }
+ }
+ /* These events are coming from elementary if alias is popup, otherwise
+ default nob is popping up
+ program {
+ name: "popup_show";
+ signal: "popup,show";
+ source: "elm";
+ }
+ program {
+ name: "popup_hide";
+ signal: "popup,hide";
+ source: "elm";
+ }*/
+ }
+}
+
+#undef SLIDER_FONT_SIZE
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "album_info.h"
+
+struct album_info *album_info_create()
+{
+ struct album_info *alinfo;
+
+ alinfo = (album_info *)calloc(1, sizeof(*alinfo));
+ if (!alinfo)
+ return NULL;
+
+ return alinfo;
+}
+
+void album_info_destroy(struct album_info *alinfo)
+{
+ if (!alinfo)
+ return;
+
+ free(alinfo->name);
+ free(alinfo->artist);
+ free(alinfo->genre);
+ free(alinfo->thumbnail_path);
+ free(alinfo);
+}
+
+int album_info_get_album_id(struct album_info *calinfo)
+{
+ return calinfo->album_id;
+}
+
+char *album_info_get_name(struct album_info *calinfo)
+{
+ if (!calinfo)
+ return NULL;
+
+ return calinfo->name;
+}
+
+char *album_info_get_artist(struct album_info *calinfo)
+{
+ if (!calinfo)
+ return NULL;
+
+ return calinfo->artist;
+}
+
+char *album_info_get_genre(struct album_info *calinfo)
+{
+ if (!calinfo)
+ return NULL;
+
+ return calinfo->genre;
+}
+
+char *album_info_get_thumb(struct album_info *calinfo)
+{
+ if (!calinfo)
+ return NULL;
+
+ return calinfo->thumbnail_path;
+}
+
+struct album_info *album_info_duplicate(struct album_info *s_alinfo)
+{
+ struct album_info *d_alinfo;
+
+ if (!s_alinfo)
+ return NULL;
+
+ d_alinfo = (album_info *)calloc(1, sizeof(*d_alinfo));
+ if (!d_alinfo)
+ return NULL;
+
+ d_alinfo->album_id = s_alinfo->album_id;
+
+ if (s_alinfo->name)
+ d_alinfo->name = strdup(s_alinfo->name);
+
+ if (s_alinfo->artist)
+ d_alinfo->artist = strdup(s_alinfo->artist);
+
+ if (s_alinfo->thumbnail_path)
+ d_alinfo->thumbnail_path = strdup(s_alinfo->thumbnail_path);
+
+ return d_alinfo;
+}
+
+int sortalbums_za(const void *d1, const void *d2)
+{
+ struct album_info *alinfo1 = (struct album_info *)d1;
+ struct album_info *alinfo2 = (struct album_info *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = album_info_get_name(alinfo1);
+ txt2 = album_info_get_name(alinfo2);
+
+ if (!txt2)
+ return 1;
+ if (!txt1)
+ return -1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+int sortalbums_az(const void *d1, const void *d2)
+{
+ struct album_info *alinfo1 = (struct album_info *)d1;
+ struct album_info *alinfo2 = (struct album_info *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = album_info_get_name(alinfo1);
+ txt2 = album_info_get_name(alinfo2);
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <dbg.h>
+
+#define BUS_NAME "org.tizen.tv.homescreen.music"
+#define BUS_OBJECT_PATH "/org/tizen/tv/music"
+#define BUS_INTERFACE "org.tizen.tv.homescreen.dynamicbox"
+#define BUS_SIGNAL_UPDATE "Update"
+#define BUS_TYPE G_BUS_TYPE_SYSTEM
+
+static void _proxy_cb(GObject *obj, GAsyncResult *res, gpointer data)
+{
+ GError *err;
+ GDBusProxy *proxy;
+ GDBusConnection *conn;
+ gboolean r;
+
+ if (!obj) {
+ _ERR("Invalid data, returning");
+ return;
+ }
+
+ err = NULL;
+ proxy = g_dbus_proxy_new_for_bus_finish(res, &err);
+ if (!proxy) {
+ _ERR("bus proxy new failed: %s\n",
+ err ? err->message : "");
+ g_error_free(err);
+ return;
+ }
+ conn = g_dbus_proxy_get_connection(proxy);
+ if (!conn) {
+ _ERR("proxy get conn failed ");
+ return;
+ }
+
+ err = NULL;
+ r = g_dbus_connection_emit_signal(conn, BUS_NAME,
+ BUS_OBJECT_PATH, BUS_INTERFACE, BUS_SIGNAL_UPDATE,
+ NULL, &err);
+ if (r == FALSE) {
+ _ERR("emit %s signal failed: %s\n",
+ BUS_SIGNAL_UPDATE,
+ err ? err->message : NULL);
+ g_error_free(err);
+ return;
+ }
+
+ g_object_unref(proxy);
+}
+
+void bus_send_signal()
+{
+ g_dbus_proxy_new_for_bus(BUS_TYPE, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, BUS_NAME, BUS_OBJECT_PATH,
+ BUS_INTERFACE, NULL, _proxy_cb, NULL);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <Eina.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "category_info.h"
+
+struct category_info *category_info_create()
+{
+ struct category_info *catinfo;
+
+ catinfo = (category_info *)calloc(1, sizeof(*catinfo));
+ if (!catinfo)
+ return NULL;
+
+ return catinfo;
+}
+
+void category_info_destroy(struct category_info *catinfo)
+{
+ struct list_member *item;
+ void *obj;
+
+ if (!catinfo)
+ return;
+
+ free((void *)catinfo->name);
+ free(catinfo->thumb);
+ eina_list_free(catinfo->albumlist);
+ if (catinfo->memberlist) {
+ EINA_LIST_FREE(catinfo->memberlist, obj) {
+ item = (list_member*)obj;
+ free(item->media_id);
+ free(item);
+ }
+ }
+ free(catinfo);
+}
+
+int category_info_get_category_id(struct category_info *ccatinfo)
+{
+ return ccatinfo->id;
+}
+
+const char *category_info_get_name(struct category_info *ccatinfo)
+{
+ if (!ccatinfo)
+ return NULL;
+
+ return ccatinfo->name;
+}
+
+char *category_info_get_thumb(struct category_info *ccatinfo)
+{
+ if (!ccatinfo)
+ return NULL;
+
+ return ccatinfo->thumb;
+}
+
+int category_info_get_songcount(struct category_info *ccatinfo)
+{
+ return ccatinfo->song_count;
+}
+
+int category_info_get_albumcount(struct category_info *ccatinfo)
+{
+ return ccatinfo->album_count;
+}
+
+Eina_List *category_info_get_albumlist(struct category_info *ccatinfo)
+{
+ if (!ccatinfo)
+ return NULL;
+
+ return ccatinfo->albumlist;
+}
+
+Eina_List *category_info_get_memberlist(struct category_info *ccatinfo)
+{
+ if (!ccatinfo)
+ return NULL;
+
+ return ccatinfo->memberlist;
+}
+
+struct category_info *find_category(Eina_List *list, const char *name)
+{
+ Eina_List *l;
+ struct category_info *catinfo;
+ void *obj;
+
+ if (!list || !name)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ catinfo = (category_info*)obj;
+ if (!strcmp(catinfo->name, name))
+ return catinfo;
+ }
+
+ return NULL;
+}
+
+static struct list_member *member_duplicate(struct list_member *sitem)
+{
+ struct list_member *item;
+
+ if (!sitem)
+ return NULL;
+
+ item = (list_member *)calloc(1, sizeof(*item));
+ if (!item)
+ return NULL;
+
+ item->member_id = sitem->member_id;
+ if (sitem->media_id)
+ item->media_id = strdup(sitem->media_id);
+
+ return item;
+}
+
+struct category_info *category_info_duplicate(struct category_info *s_catinfo)
+{
+ struct category_info *d_catinfo;
+ struct list_member *item, *it;
+ void *obj;
+ Eina_List *l;
+
+ if (!s_catinfo)
+ return NULL;
+
+ d_catinfo = (category_info *)calloc(1, sizeof(*d_catinfo));
+ if (!d_catinfo)
+ return NULL;
+
+ d_catinfo->id = s_catinfo->id;
+ d_catinfo->song_count = s_catinfo->song_count;
+ d_catinfo->album_count = s_catinfo->album_count;
+ d_catinfo->albumlist = eina_list_clone(s_catinfo->albumlist);
+
+ EINA_LIST_FOREACH(s_catinfo->memberlist, l, obj) {
+ item = (list_member *)obj;
+ it = member_duplicate(item);
+ if (!it) {
+ category_info_destroy(d_catinfo);
+ return NULL;
+ }
+ d_catinfo->memberlist = eina_list_append(d_catinfo->memberlist,
+ it);
+ }
+
+ if (s_catinfo->name)
+ d_catinfo->name = strdup(s_catinfo->name);
+ if (s_catinfo->thumb)
+ d_catinfo->thumb = strdup(s_catinfo->thumb);
+
+ return d_catinfo;
+}
+
+int sortcategorys_za(const void *d1, const void *d2)
+{
+ struct category_info *catinfo1 = (struct category_info *)d1;
+ struct category_info *catinfo2 = (struct category_info *)d2;
+ const char *txt1;
+ const char *txt2;
+
+ txt1 = category_info_get_name(catinfo1);
+ txt2 = category_info_get_name(catinfo2);
+
+ if (!txt2)
+ return 1;
+ if (!txt1)
+ return -1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+int sortcategorys_az(const void *d1, const void *d2)
+{
+ struct category_info *catinfo1 = (struct category_info *)d1;
+ struct category_info *catinfo2 = (struct category_info *)d2;
+ const char *txt1;
+ const char *txt2;
+
+ txt1 = category_info_get_name(catinfo1);
+ txt2 = category_info_get_name(catinfo2);
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "folder_info.h"
+
+struct folder_info *folder_info_create()
+{
+ struct folder_info *finfo;
+
+ finfo = (folder_info *)calloc(1, sizeof(*finfo));
+ if (!finfo)
+ return NULL;
+
+ return finfo;
+}
+
+void folder_info_destroy(struct folder_info *finfo)
+{
+ if (!finfo)
+ return;
+
+ free(finfo->name);
+ free(finfo->folder_id);
+ free(finfo);
+}
+
+char *folder_info_get_folder_id(struct folder_info *cfinfo)
+{
+ if (!cfinfo)
+ return NULL;
+
+ return cfinfo->folder_id;
+}
+
+char *folder_info_get_name(struct folder_info *cfinfo)
+{
+ if (!cfinfo)
+ return NULL;
+
+ return cfinfo->name;
+}
+
+int folder_info_get_count(struct folder_info *cfinfo)
+{
+ return cfinfo->count;
+}
+
+int folder_info_get_duration(struct folder_info *cfinfo)
+{
+ return cfinfo->duration;
+}
+
+struct folder_info *folder_info_duplicate(struct folder_info *s_finfo)
+{
+ struct folder_info *d_finfo;
+
+ if (!s_finfo)
+ return NULL;
+
+ d_finfo = (folder_info *)calloc(1, sizeof(*d_finfo));
+ if (!d_finfo)
+ return NULL;
+
+ d_finfo->count = s_finfo->count;
+ d_finfo->duration = s_finfo->duration;
+
+ if (s_finfo->name)
+ d_finfo->name = strdup(s_finfo->name);
+
+ if (s_finfo->folder_id)
+ d_finfo->folder_id = strdup(s_finfo->folder_id);
+
+ return d_finfo;
+}
+
+int sortfolders_za(const void *d1, const void *d2)
+{
+ struct folder_info *finfo1 = (struct folder_info *)d1;
+ struct folder_info *finfo2 = (struct folder_info *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = folder_info_get_name(finfo1);
+ txt2 = folder_info_get_name(finfo2);
+
+ if (!txt2)
+ return 1;
+ if (!txt1)
+ return -1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+int sortfolders_az(const void *d1, const void *d2)
+{
+ struct folder_info *finfo1 = (struct folder_info *)d1;
+ struct folder_info *finfo2 = (struct folder_info *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = folder_info_get_name(finfo1);
+ txt2 = folder_info_get_name(finfo2);
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Eina.h>
+#include <media_content.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <string.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+#include "song_info.h"
+#include "album_info.h"
+#include "category_info.h"
+#include "folder_info.h"
+#include "mediadata.h"
+#include "common.h"
+
+#define MEDIA_CONDITION_MUSIC "(MEDIA_TYPE=3)"
+#define MEDIA_CONDITION_INTERNAL "(MEDIA_STORAGE_TYPE=0)"
+#define MEDIA_CONDITION_EXTERNAL "(MEDIA_STORAGE_TYPE=1)"
+
+#define MUSIC_STR_UNKNOWN N_("Unknown")
+
+enum songlist_type {
+ E_ALL_SONGS,
+ E_ALBUM_SONGS,
+ E_FOLDER_SONGS,
+ E_PLAYLIST_SONGS,
+ E_SINGLE_SONG
+};
+
+struct SMediadata {
+ Eina_List *songlist;
+ Eina_List *folderlist;
+ Eina_List *folder_songlist;
+ Eina_List *albumlist;
+ Eina_List *album_songlist;
+ Eina_List *playlistslist;
+ Eina_List *playlist_songlist;
+ Eina_List *artistlist;
+ Eina_List *genrelist;
+ Eina_List *cblist;
+ struct SSongInfo *sinfo;
+ filter_h filter;
+ int source_type;
+ int slist_type;
+ int member_id;
+ SMediadata() {
+ memset(this, 0, sizeof(SMediadata));
+ }
+};
+
+void CMediadata::sm_CbContentUpdate(media_content_error_e err, int pid,
+ media_content_db_update_item_type_e update_item,
+ media_content_db_update_type_e update_type,
+ media_content_type_e media_type,
+ char *uuid, char *path, char *mime_type,
+ void *dt)
+{
+ CMediadata *root = (CMediadata *)dt;
+
+ if (!root)
+ return;
+
+ root->m_HandleContentUpdate(err, pid, update_item, update_type, media_type, uuid, path, mime_type);
+}
+
+
+bool CMediadata::sm_CbTotalDuration(media_info_h md_h, void *dt)
+{
+ audio_meta_h audio_h;
+ int dur;
+ int *tdur = (int *)dt;
+
+ if (!tdur)
+ return false;
+
+ if (media_info_get_audio(md_h, &audio_h) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media info get audio error");
+ return false;
+ }
+
+ dur = 0;
+ if (audio_meta_get_duration(audio_h, &dur) != MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio duration get error");
+
+ audio_meta_destroy(audio_h);
+
+ *tdur = *tdur + dur;
+
+ return true;
+}
+
+
+bool CMediadata::sm_CbEachMediaData(media_info_h md_h, void *dt)
+{
+ CMediadata *root = (CMediadata *)dt;
+
+ if (!root)
+ return false;
+
+ root->m_HandleEachMediaData(md_h);
+
+ return true;
+}
+
+
+bool CMediadata::sm_CbEachFolderData(media_folder_h folder_h, void *dt)
+{
+ CMediadata *root = (CMediadata *)dt;
+
+ if (!root)
+ return false;
+
+ root->m_HandleEachFolderData(folder_h);
+
+ return true;
+}
+
+
+bool CMediadata::sm_CbEachAlbumData(media_album_h album_h, void *dt)
+{
+ CMediadata *root = (CMediadata *)dt;
+
+ if (!root)
+ return false;
+
+ root->m_HandleEachAlbumData(album_h);
+
+ return true;
+}
+
+
+bool CMediadata::sm_CbEachPlaylist(media_playlist_h ph, void *dt)
+{
+ CMediadata *root = (CMediadata *)dt;
+
+ if (!root)
+ return false;
+
+ root->m_HandleEachPlaylist(ph);
+
+ return true;
+}
+
+
+bool CMediadata::sm_CbPlaylistMember(int memb_id, media_info_h mdh, void *dt)
+{
+ category_info *catinfo = (category_info *)dt;
+ list_member *member = NULL;
+ char *id = NULL;
+
+ if (!mdh || !catinfo)
+ return false;
+
+ if (media_info_get_media_id(mdh, &id) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to get media id ");
+ return false;
+ }
+
+ if (!catinfo->thumb &&
+ media_info_get_thumbnail_path(mdh, &(catinfo->thumb)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("Media thumbnail path Fetch error");
+
+ member = (list_member *)calloc(1, sizeof(*member));
+ if (!member) {
+ free(id);
+ return false;
+ }
+
+ member->member_id = memb_id;
+ member->media_id = id;
+
+ catinfo->memberlist = eina_list_append(catinfo->memberlist, member);
+
+ return true;
+}
+
+
+bool CMediadata::sm_CbPlaylist(media_playlist_h ph, void* dt)
+{
+ Eina_List **list = (Eina_List **)dt;
+ SCtxtPlaylistItem *item;
+
+ if (!ph || !list)
+ return false;
+
+ item = (SCtxtPlaylistItem *)calloc(1, sizeof(*item));
+ if (!item)
+ return false;
+
+ if (media_playlist_get_name(ph, (char **)&(item->name)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to read playlist name ");
+ free(item);
+ return false;
+ }
+
+ if (media_playlist_get_playlist_id(ph, &(item->id)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to read playlist name ");
+ free(item->name);
+ free(item);
+ return false;
+ }
+
+ *list = eina_list_append(*list, item);
+
+ return true;
+}
+
+
+void CMediadata::m_HandleContentUpdate(media_content_error_e err, int pid,
+ media_content_db_update_item_type_e update_item,
+ media_content_db_update_type_e update_type,
+ media_content_type_e media_type,
+ char *uuid, char *path, char *mime_type)
+{
+ Eina_List *l = NULL;
+ SCbInfo *cbinfo = NULL;
+ void *obj = NULL;
+
+ if (err != MEDIA_CONTENT_ERROR_NONE || !m)
+ return;
+
+ m->source_type = SOURCE_TYPE_NONE;
+ EINA_LIST_FOREACH(m->cblist, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == E_CONTENT_UPDATE && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}
+
+
+bool CMediadata::m_HandleEachMediaData(media_info_h md_h)
+{
+ SSongInfo *sinfo = NULL;
+ audio_meta_h audio_h = NULL;
+
+ sinfo = song_info_create();
+ if (!sinfo)
+ return false;
+
+ if (media_info_get_file_path(md_h, &(sinfo->filepath))
+ != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media file path Fetch error");
+ song_info_destroy(sinfo);
+ return false;
+ }
+
+ if (media_info_get_thumbnail_path(md_h, &(sinfo->thumbnail_path)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("Media thumbnail path Fetch error");
+
+ if (media_info_get_media_type(md_h,
+ (media_content_type_e *)&(sinfo->type)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("Media type Fetch error");
+
+ if (media_info_get_audio(md_h, &audio_h) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media info get audio error");
+ song_info_destroy(sinfo);
+ return false;
+ }
+
+ if (audio_meta_get_media_id(audio_h, &(sinfo->media_id)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media ID Fetch error");
+ audio_meta_destroy(audio_h);
+ song_info_destroy(sinfo);
+ return false;
+ }
+
+ if (audio_meta_get_title(audio_h, &(sinfo->title)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio title get error");
+
+ if (audio_meta_get_artist(audio_h, &(sinfo->artist)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio artist get error");
+
+ if (audio_meta_get_album(audio_h, &(sinfo->album)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio album get error");
+
+ if (audio_meta_get_genre(audio_h, &(sinfo->genre)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio genre get error");
+
+ if (audio_meta_get_composer(audio_h, &(sinfo->composer)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio composer get error");
+
+ if (audio_meta_get_duration(audio_h, &(sinfo->duration)) !=
+ MEDIA_CONTENT_ERROR_NONE)
+ _ERR("audio duration get error");
+
+ audio_meta_destroy(audio_h);
+
+ switch (m->slist_type) {
+ case E_FOLDER_SONGS:
+ m->folder_songlist = eina_list_append(
+ m->folder_songlist, sinfo);
+ break;
+
+ case E_ALBUM_SONGS:
+ m->album_songlist = eina_list_append(
+ m->album_songlist, sinfo);
+ break;
+
+ case E_PLAYLIST_SONGS:
+ sinfo->member_id = m->member_id;
+ m->playlist_songlist = eina_list_append(
+ m->playlist_songlist, sinfo);
+ break;
+
+ case E_SINGLE_SONG:
+ m->sinfo = sinfo;
+ break;
+
+ case E_ALL_SONGS:
+ default:
+ m->songlist = eina_list_append(m->songlist, sinfo);
+ break;
+ }
+ return true;
+}
+
+
+bool CMediadata::m_HandleEachFolderData(media_folder_h folder_h)
+{
+ folder_info *finfo = NULL;
+
+ finfo = folder_info_create();
+ if (!finfo)
+ return false;
+
+ if (media_folder_get_folder_id(folder_h, &(finfo->folder_id)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Folder ID Fetch error");
+ folder_info_destroy(finfo);
+ return false;
+ }
+
+ if (media_folder_get_media_count_from_db(finfo->folder_id,
+ m->filter, &(finfo->count)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Folder media count Fetch error");
+ folder_info_destroy(finfo);
+ return false;
+ }
+
+ finfo->duration = 0;
+ if (media_folder_foreach_media_from_db(finfo->folder_id, m->filter,
+ sm_CbTotalDuration, &(finfo->duration)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Folder media count Fetch error");
+ folder_info_destroy(finfo);
+ return false;
+ }
+
+ if (media_folder_get_name(folder_h, &(finfo->name)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("folder name Fetch error");
+ folder_info_destroy(finfo);
+ return false;
+ }
+
+ m->folderlist = eina_list_append(m->folderlist, finfo);
+ return true;
+}
+
+
+bool CMediadata::m_HandleEachAlbumData(media_album_h album_h)
+{
+ album_info *alinfo = NULL;
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+ char *genre = NULL;
+ char *tpath = NULL;
+ Eina_List *l = NULL;
+
+ alinfo = album_info_create();
+ if (!alinfo)
+ return false;
+
+ if (media_album_get_album_id(album_h, &(alinfo->album_id)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Album ID Fetch error");
+ album_info_destroy(alinfo);
+ return false;
+ }
+
+ if (media_album_get_name(album_h, &(alinfo->name)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Album name Fetch error");
+ album_info_destroy(alinfo);
+ return false;
+ }
+
+ if (media_album_get_artist(album_h, &(alinfo->artist)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Album artist Fetch error");
+ album_info_destroy(alinfo);
+ return false;
+ }
+
+ alinfo->song_count = 0;
+ if (media_album_get_media_count_from_db(alinfo->album_id, m->filter, &(alinfo->song_count)))
+ _ERR("Album artist Fetch error");
+
+ if (m->album_songlist)
+ m_DeleteAlbumSongList();
+
+ m_GetAlbumSongList(alinfo);
+
+ EINA_LIST_FOREACH(m->album_songlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ genre = song_info_get_genre(sinfo);
+ if (genre) {
+ alinfo->genre = strdup(genre);
+ break;
+ }
+ }
+
+ EINA_LIST_FOREACH(m->album_songlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ tpath = song_info_get_thumb(sinfo);
+ if (tpath) {
+ alinfo->thumbnail_path = strdup(tpath);
+ break;
+ }
+ }
+
+ m->albumlist = eina_list_append(m->albumlist, alinfo);
+ return true;
+}
+
+
+bool CMediadata::m_HandleEachPlaylist(media_playlist_h ph)
+{
+ category_info *catinfo = NULL;
+
+ if (!ph)
+ return false;
+
+ catinfo = (category_info *)calloc(1, sizeof(*catinfo));
+ if (!catinfo)
+ return false;
+
+ if (media_playlist_get_name(ph, (char **)&(catinfo->name)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to read playlist name ");
+ category_info_destroy(catinfo);
+ return false;
+ }
+
+ if (media_playlist_get_playlist_id(ph, &(catinfo->id)) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to read playlist name ");
+ category_info_destroy(catinfo);
+ return false;
+ }
+
+ if (media_playlist_get_media_count_from_db(catinfo->id, NULL,
+ &(catinfo->song_count)) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to read playlist name ");
+ category_info_destroy(catinfo);
+ return false;
+ }
+
+ if (media_playlist_foreach_media_from_db(catinfo->id, NULL,
+ sm_CbPlaylistMember, (void *)catinfo) !=
+ MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to read playlist members ");
+ category_info_destroy(catinfo);
+ return false;
+ }
+
+ m->playlistslist = eina_list_append(m->playlistslist, catinfo);
+
+ return true;
+}
+
+
+void CMediadata::m_DeleteSongList(void)
+{
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FREE(m->songlist, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+
+ m->songlist = NULL;
+}
+
+
+void CMediadata::m_DeleteFolderSongList(void)
+{
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FREE(m->folder_songlist, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+
+ m->folder_songlist = NULL;
+}
+
+
+void CMediadata::m_DeleteAlbumSongList(void)
+{
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FREE(m->album_songlist, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+
+ m->album_songlist = NULL;
+}
+
+
+void CMediadata::m_DeletePlaylistSongList(void)
+{
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FREE(m->playlist_songlist, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+
+ m->playlist_songlist = NULL;
+}
+
+
+void CMediadata::m_DeleteFolderList(void)
+{
+ folder_info *finfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FREE(m->folderlist, obj) {
+ finfo = (folder_info *)obj;
+ folder_info_destroy(finfo);
+ }
+
+ m->folderlist = NULL;
+}
+
+
+void CMediadata::m_DeleteAlbumList(void)
+{
+ album_info *alinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FREE(m->albumlist, obj) {
+ alinfo = (album_info *)obj;
+ album_info_destroy(alinfo);
+ }
+
+ m->albumlist = NULL;
+}
+
+
+void CMediadata::m_DeleteCategoryList(ECategoryType type)
+{
+ category_info *catinfo = NULL;
+ void *obj = NULL;
+
+ if (type == CAT_TYPE_ARTIST) {
+ EINA_LIST_FREE(m->artistlist, obj) {
+ catinfo = (category_info *)obj;
+ category_info_destroy(catinfo);
+ }
+
+ m->artistlist = NULL;
+ }
+ else if (type == CAT_TYPE_GENRE) {
+ EINA_LIST_FREE(m->genrelist, obj) {
+ catinfo = (category_info *)obj;
+ category_info_destroy(catinfo);
+ }
+
+ m->genrelist = NULL;
+ }
+ else if (type == CAT_TYPE_PLAYLISTS) {
+ EINA_LIST_FREE(m->playlistslist, obj) {
+ catinfo = (category_info *)obj;
+ category_info_destroy(catinfo);
+ }
+
+ m->playlistslist = NULL;
+ }
+}
+
+
+bool CMediadata::m_CreateFilter(void)
+{
+ char buf[MAX_LENGTH];
+ int ret;
+
+ ret = media_filter_create(&(m->filter));
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media Filter Creation Failed");
+ return false;
+ }
+
+ switch (m->source_type) {
+ case SOURCE_TYPE_TV:
+ snprintf(buf, sizeof(buf), "%s AND %s", MEDIA_CONDITION_MUSIC,
+ MEDIA_CONDITION_INTERNAL);
+ break;
+
+ case SOURCE_TYPE_USB:
+ snprintf(buf, sizeof(buf), "%s AND %s", MEDIA_CONDITION_MUSIC,
+ MEDIA_CONDITION_EXTERNAL);
+ break;
+
+ case SOURCE_TYPE_ALL:
+ default:
+ snprintf(buf, sizeof(buf), "%s", MEDIA_CONDITION_MUSIC);
+ break;
+ }
+
+ media_filter_set_condition(m->filter, buf,
+ MEDIA_CONTENT_COLLATE_DEFAULT);
+
+ return true;
+}
+
+
+bool CMediadata::m_DestroyFilter(void)
+{
+ if (media_filter_destroy(m->filter) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Filter destroy failed");
+ m->filter = NULL;
+ return false;
+ }
+ m->filter = NULL;
+
+ return true;
+}
+
+
+int CMediadata::m_GetPlaylistList(void)
+{
+ if (media_playlist_foreach_playlist_from_db(NULL, sm_CbEachPlaylist, this)) {
+ _ERR(" Get each playlist failed ");
+ return false;
+ }
+
+ return true;
+}
+
+
+void CMediadata::m_GetCategoryList(ECategoryType type)
+{
+ album_info *alinfo = NULL;
+ category_info *catinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+ int count;
+
+ if (!m->albumlist)
+ return;
+
+ count = 0;
+ EINA_LIST_FOREACH(m->albumlist, l, obj) {
+ alinfo = (album_info *)obj;
+ if (type == CAT_TYPE_ARTIST)
+ catinfo = find_category(m->artistlist,
+ alinfo->artist);
+ else
+ catinfo = find_category(m->genrelist,
+ alinfo->genre);
+
+ if (!catinfo) {
+ catinfo = category_info_create();
+ if (!catinfo)
+ continue;
+
+ catinfo->id = ++count;
+ catinfo->album_count = 1;
+ catinfo->song_count = alinfo->song_count;
+ if (type == CAT_TYPE_ARTIST) {
+ if (alinfo->artist)
+ catinfo->name = strdup(alinfo->artist);
+ else
+ catinfo->name = strdup(
+ _(MUSIC_STR_UNKNOWN));
+
+ m->artistlist = eina_list_append(
+ m->artistlist, catinfo);
+ }
+ else {
+ if (alinfo->artist)
+ catinfo->name = strdup(alinfo->genre);
+ else
+ catinfo->name = strdup(
+ _(MUSIC_STR_UNKNOWN));
+
+ m->genrelist = eina_list_append(
+ m->genrelist, catinfo);
+ }
+ }
+ else {
+ catinfo->album_count += 1;
+ catinfo->song_count += alinfo->song_count;
+ }
+ catinfo->albumlist = eina_list_append(catinfo->albumlist,
+ alinfo);
+ }
+}
+
+
+int CMediadata::m_GetPlaylistSongList(category_info *catinfo)
+{
+ media_info_h mdh;
+ Eina_List *l = NULL;
+ list_member *member = NULL;
+ void *obj = NULL;
+ int r;
+
+ if (!catinfo || !catinfo->memberlist) {
+ _ERR(" Invalid argument ");
+ return false;
+ }
+
+ m->slist_type = E_PLAYLIST_SONGS;
+
+ EINA_LIST_FOREACH(catinfo->memberlist, l, obj) {
+ member = (list_member *)obj;
+ if (!member->media_id)
+ continue;
+
+ r = media_info_get_media_from_db(member->media_id, &mdh);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("unable to get handle from id");
+ continue;
+ }
+
+ m->member_id = member->member_id;
+ if (!m_HandleEachMediaData(mdh))
+ _ERR("unable to get media data");
+ }
+
+ return true;
+}
+
+
+int CMediadata::m_GetFolderSongList(folder_info *finfo)
+{
+ char *id = NULL;
+ int r;
+
+ id = folder_info_get_folder_id(finfo);
+
+ m->slist_type = E_FOLDER_SONGS;
+ r = media_folder_foreach_media_from_db(id, m->filter,
+ sm_CbEachMediaData, (void *)this);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media folder foreach folder from db failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+int CMediadata::m_GetFolderList(void)
+{
+ int r;
+
+ r = media_folder_foreach_folder_from_db(m->filter,
+ sm_CbEachFolderData, (void *)this);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media album foreach album from db failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+int CMediadata::m_GetAlbumSongList(album_info *alinfo)
+{
+ int id;
+ int r;
+
+ id = album_info_get_album_id(alinfo);
+
+ m->slist_type = E_ALBUM_SONGS;
+ r = media_album_foreach_media_from_db(id, m->filter,
+ sm_CbEachMediaData, (void *)this);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media folder foreach folder from db failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+int CMediadata::m_GetAlbumList(void)
+{
+ int r;
+
+ r = media_album_foreach_album_from_db(m->filter,
+ sm_CbEachAlbumData, (void *)this);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media album foreach album from db failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+int CMediadata::m_GetSongList(void)
+{
+ int r;
+
+ m->slist_type = E_ALL_SONGS;
+ r = media_info_foreach_media_from_db(m->filter,
+ sm_CbEachMediaData, (void *)this);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media folder foreach folder from db failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+void CMediadata::m_UpdateLists(void)
+{
+ bool r;
+
+ r = m_CreateFilter();
+ if (r == false) {
+ _ERR("Media Filter Creation Failed");
+ return;
+ }
+
+ if (m->songlist)
+ m_DeleteSongList();
+ m_GetSongList();
+
+ if (m->albumlist)
+ m_DeleteAlbumList();
+ m_GetAlbumList();
+
+ if (m->artistlist)
+ m_DeleteCategoryList(CAT_TYPE_ARTIST);
+ m_GetCategoryList(CAT_TYPE_ARTIST);
+
+ if (m->genrelist)
+ m_DeleteCategoryList(CAT_TYPE_GENRE);
+ m_GetCategoryList(CAT_TYPE_GENRE);
+
+ if (m->folderlist)
+ m_DeleteFolderList();
+ m_GetFolderList();
+
+ r = m_DestroyFilter();
+ if (r == false)
+ _ERR("Media Filter Creation Failed");
+}
+
+
+bool CMediadata::Create(void)
+{
+ if (m)
+ return false;
+
+ m = new SMediadata;
+ if (!m) {
+ _ERR("m calloc failed");
+ return false;
+ }
+
+ int r;
+ r = media_content_connect();
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media Content Connect Failed");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ media_content_set_db_updated_cb(sm_CbContentUpdate, (void *)this);
+
+ m->source_type = SOURCE_TYPE_NONE;
+
+ return true;
+}
+
+
+void CMediadata::Destroy(void)
+{
+ if (!m)
+ return;
+
+ int r;
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ m_DeleteSongList();
+ m_DeleteAlbumList();
+ m_DeleteAlbumSongList();
+ m_DeleteFolderList();
+ m_DeleteFolderSongList();
+ m_DeleteCategoryList(CAT_TYPE_ARTIST);
+ m_DeleteCategoryList(CAT_TYPE_GENRE);
+ m_DeleteCategoryList(CAT_TYPE_PLAYLISTS);
+ m_DeletePlaylistSongList();
+ song_info_destroy(m->sinfo);
+
+ EINA_LIST_FREE(m->cblist, obj) {
+ cbinfo = (SCbInfo *)obj;
+ free(cbinfo);
+ }
+
+ free(m);
+
+ media_content_unset_db_updated_cb();
+
+ r = media_content_disconnect();
+ if (r != MEDIA_CONTENT_ERROR_NONE)
+ _ERR("Media Content Connect Failed");
+
+}
+
+
+struct SCbInfo *CMediadata::AddCallback(int type,
+ void (*cb)(void *), void *data)
+{
+ struct SCbInfo *cbinfo;
+
+ if (!m || !cb)
+ return NULL;
+
+ cbinfo = (SCbInfo *)calloc(1, sizeof(*cbinfo));
+ if (!cbinfo)
+ return NULL;
+
+ cbinfo->cb = cb;
+ cbinfo->data = data;
+ cbinfo->type = type;
+
+ m->cblist = eina_list_append(m->cblist, cbinfo);
+
+ return cbinfo;
+}
+
+
+bool CMediadata::RemoveCallback(struct SCbInfo *cbinfo)
+{
+ if (!m)
+ return false;
+
+ if (!cbinfo)
+ return false;
+
+ m->cblist = eina_list_remove(m->cblist,
+ cbinfo);
+ free(cbinfo);
+
+ return true;
+}
+
+
+
+Eina_List *CMediadata::Medialist(int source_type, int EListType, void *info)
+{
+ if (!m)
+ return NULL;
+
+ if (source_type != m->source_type) {
+ m->source_type = source_type;
+ m_UpdateLists();
+ }
+
+ switch (EListType) {
+ case LIST_TYPE_SONG:
+ return m->songlist;
+
+ case LIST_TYPE_ALBUM:
+ return m->albumlist;
+
+ case LIST_TYPE_ALBUM_SONG:
+ if (m->album_songlist)
+ m_DeleteAlbumSongList();
+ m_GetAlbumSongList((album_info *)info);
+ return m->album_songlist;
+
+ case LIST_TYPE_FOLDER:
+ return m->folderlist;
+
+ case LIST_TYPE_FOLDER_SONG:
+ if (m->folder_songlist)
+ m_DeleteFolderSongList();
+ m_GetFolderSongList((folder_info *)info);
+ return m->folder_songlist;
+
+ case LIST_TYPE_ARTIST:
+ return m->artistlist;
+
+ case LIST_TYPE_GENRE:
+ return m->genrelist;
+
+ case LIST_TYPE_PLAYLISTS:
+ if (m->playlistslist)
+ m_DeleteCategoryList(CAT_TYPE_PLAYLISTS);
+ m_GetPlaylistList();
+ return m->playlistslist;
+
+ case LIST_TYPE_PLAYLISTS_SONG:
+ if (m->playlist_songlist)
+ m_DeletePlaylistSongList();
+ m_GetPlaylistSongList((category_info *)info);
+ return m->playlist_songlist;
+
+ default:
+ _ERR(" Wrong list type ");
+ break;
+ }
+
+ return NULL;
+}
+
+struct SSongInfo *CMediadata::SongByUri(char *uri)
+{
+ if (!m)
+ return NULL;
+
+ filter_h filter;
+ char buf[MAX_LENGTH];
+ int r;
+
+ if (!uri)
+ return NULL;
+
+ if (m->sinfo)
+ song_info_destroy(m->sinfo);
+
+ m->sinfo = NULL;
+ r = media_filter_create(&filter);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Media Filter Creation Failed");
+ return NULL;
+ }
+
+ snprintf(buf, sizeof(buf), "%s AND (MEDIA_PATH LIKE '%s%%')",
+ MEDIA_CONDITION_MUSIC,
+ uri);
+
+ media_filter_set_condition(filter, buf,
+ MEDIA_CONTENT_COLLATE_DEFAULT);
+
+ m->slist_type = E_SINGLE_SONG;
+ r = media_info_foreach_media_from_db(filter, sm_CbEachMediaData,
+ (void *)this);
+ if (r != MEDIA_CONTENT_ERROR_NONE)
+ _ERR("Failed to fetch media info");
+
+ if (media_filter_destroy(filter) != MEDIA_CONTENT_ERROR_NONE)
+ _ERR("Filter destroy failed");
+
+ return m->sinfo;
+}
+
+
+bool CMediadata::SetPlayedTime(char *media_id)
+{
+ if (!m)
+ return false;
+
+ media_info_h mdh;
+ audio_meta_h adh;
+ time_t ptime;
+ int r;
+
+ if (!media_id) {
+ _ERR("Invalid parameter");
+ return false;
+ }
+
+ r = media_info_get_media_from_db(media_id, &mdh);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Failed to get media from id");
+ return false;
+ }
+
+ r = media_info_get_audio(mdh, &adh);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Failed to get audio from media");
+ media_info_destroy(mdh);
+ return false;
+ }
+
+ ptime = time(NULL);
+
+ r = audio_meta_set_played_time(adh, ptime);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Failed to set played time");
+ audio_meta_destroy(adh);
+ media_info_destroy(mdh);
+ return false;
+ }
+
+ r = audio_meta_update_to_db(adh);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("Failed to update to db");
+ audio_meta_destroy(adh);
+ media_info_destroy(mdh);
+ return false;
+ }
+
+ audio_meta_destroy(adh);
+ media_info_destroy(mdh);
+
+ return true;
+}
+
+
+bool CMediadata::InsertPlaylist(const char *name, Eina_List *idlist)
+{
+ if (!m)
+ return false;
+
+ media_playlist_h ph;
+ int r;
+ Eina_List *l;
+ char *id = NULL;
+ void *obj;
+
+ if (!name)
+ return false;
+
+ r = media_playlist_insert_to_db(name, &ph);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to insert ");
+ return false;
+ }
+
+ EINA_LIST_FOREACH(idlist, l, obj)
+ id = (char *)obj;
+ media_playlist_add_media(ph, id);
+
+ media_playlist_update_to_db(ph);
+
+ return true;
+}
+
+
+bool CMediadata::ExistPlaylist(const char *name)
+{
+ if (!m)
+ return false;
+
+ Eina_List *l;
+ struct category_info *catinfo;
+ void *obj;
+
+ if (!name)
+ return false;
+
+ if (!m->playlistslist)
+ return false;
+
+ EINA_LIST_FOREACH(m->playlistslist, l, obj) {
+ catinfo = (category_info *)obj;
+ if (catinfo->name && !strcmp(catinfo->name, name))
+ return true;
+ }
+
+ return false;
+}
+
+
+bool CMediadata::DeletePlaylist(int id)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ r = media_playlist_delete_from_db(id);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to delete playlist");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CMediadata::RenamePlaylist(int id, const char *name)
+{
+ if (!m)
+ return false;
+
+ int r;
+ media_playlist_h ph;
+
+ r = media_playlist_get_playlist_from_db(id, &ph);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to get playlist");
+ return false;
+ }
+
+ r = media_playlist_set_name(ph, name);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to set playlist name");
+ return false;
+ }
+
+ media_playlist_update_to_db(ph);
+
+ return true;
+}
+
+
+bool CMediadata::AddmediaPlaylist(int lid, Eina_List *idlist)
+{
+ if (!m)
+ return false;
+
+ media_playlist_h ph;
+ int r;
+ Eina_List *l;
+ char *id;
+ void *obj;
+
+ if (!idlist)
+ return false;
+
+ r = media_playlist_get_playlist_from_db(lid, &ph);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to get playlist");
+ return false;
+ }
+
+ EINA_LIST_FOREACH(idlist, l, obj) {
+ id = (char *)obj;
+ media_playlist_add_media(ph, id);
+ }
+
+ media_playlist_update_to_db(ph);
+
+ return true;
+}
+
+
+bool CMediadata::RemovemediaPlaylist(int lid, Eina_List *idlist)
+{
+ if (!m)
+ return false;
+
+ media_playlist_h ph;
+ int r;
+ Eina_List *l;
+ struct SSongInfo *sinfo;
+ void *obj;
+ int id;
+
+ if (!idlist) {
+ _ERR(" Invalid argument ");
+ return false;
+ }
+
+ r = media_playlist_get_playlist_from_db(lid, &ph);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR(" Failed to get playlist");
+ return false;
+ }
+
+ EINA_LIST_FOREACH(idlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ id = song_info_get_member_id(sinfo);
+ if (id)
+ media_playlist_remove_media(ph, id);
+ }
+
+ media_playlist_update_to_db(ph);
+
+ return true;
+}
+
+
+Eina_List *CMediadata::PlaylistsForCtxt(void)
+{
+ Eina_List *list;
+
+ list = NULL;
+ if (media_playlist_foreach_playlist_from_db(NULL, sm_CbPlaylist, &list))
+ _ERR(" Get playlist failed ");
+
+ return list;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "song_info.h"
+
+struct SSongInfo *song_info_create()
+{
+ struct SSongInfo *sinfo;
+
+ sinfo = (SSongInfo *)calloc(1, sizeof(*sinfo));
+ if (!sinfo)
+ return NULL;
+
+ return sinfo;
+}
+
+void song_info_destroy(struct SSongInfo *sinfo)
+{
+ if (!sinfo)
+ return;
+
+ free(sinfo->media_id);
+ free(sinfo->title);
+ free(sinfo->artist);
+ free(sinfo->album);
+ free(sinfo->album_artist);
+ free(sinfo->genre);
+ free(sinfo->composer);
+ free(sinfo->thumbnail_path);
+ free(sinfo->filepath);
+ free(sinfo);
+}
+
+char *song_info_get_media_id(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->media_id;
+}
+
+int song_info_get_member_id(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return 0;
+
+ return csinfo->member_id;
+}
+
+char *song_info_get_title(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->title;
+}
+
+char *song_info_get_artist(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->artist;
+}
+
+char *song_info_get_genre(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->genre;
+}
+
+char *song_info_get_album(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->album;
+}
+
+char *song_info_get_filepath(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->filepath;
+}
+
+char *song_info_get_thumb(struct SSongInfo *csinfo)
+{
+ if (!csinfo)
+ return NULL;
+
+ return csinfo->thumbnail_path;
+}
+
+bool song_info_get_duration(struct SSongInfo *csinfo, int *dur)
+{
+ if (!csinfo)
+ return false;
+
+ *dur = csinfo->duration;
+
+ return true;
+}
+
+struct SSongInfo *song_info_duplicate(struct SSongInfo *s_sinfo)
+{
+ struct SSongInfo *d_sinfo;
+
+ if (!s_sinfo)
+ return NULL;
+
+ d_sinfo = (SSongInfo *)calloc(1, sizeof(*d_sinfo));
+ if (!d_sinfo)
+ return NULL;
+
+ if (s_sinfo->media_id)
+ d_sinfo->media_id = strdup(s_sinfo->media_id);
+
+ if (s_sinfo->title)
+ d_sinfo->title = strdup(s_sinfo->title);
+
+ if (s_sinfo->artist)
+ d_sinfo->artist = strdup(s_sinfo->artist);
+
+ if (s_sinfo->album)
+ d_sinfo->album = strdup(s_sinfo->album);
+
+ if (s_sinfo->album_artist)
+ d_sinfo->album_artist = strdup(s_sinfo->album_artist);
+
+ if (s_sinfo->composer)
+ d_sinfo->composer = strdup(s_sinfo->composer);
+
+ if (s_sinfo->genre)
+ d_sinfo->genre = strdup(s_sinfo->genre);
+
+ if (s_sinfo->filepath)
+ d_sinfo->filepath = strdup(s_sinfo->filepath);
+
+ if (s_sinfo->thumbnail_path)
+ d_sinfo->thumbnail_path = strdup(s_sinfo->thumbnail_path);
+
+ d_sinfo->duration = s_sinfo->duration;
+ d_sinfo->type = s_sinfo->type;
+ d_sinfo->member_id = s_sinfo->member_id;
+
+ return d_sinfo;
+}
+
+int sortsongs_title_az(const void *d1, const void *d2)
+{
+ struct SSongInfo *sinfo1 = (struct SSongInfo *)d1;
+ struct SSongInfo *sinfo2 = (struct SSongInfo *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = song_info_get_title(sinfo1);
+ txt2 = song_info_get_title(sinfo2);
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
+
+int sortsongs_title_za(const void *d1, const void *d2)
+{
+ struct SSongInfo *sinfo1 = (struct SSongInfo *)d1;
+ struct SSongInfo *sinfo2 = (struct SSongInfo *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = song_info_get_title(sinfo1);
+ txt2 = song_info_get_title(sinfo2);
+
+ if (!txt2)
+ return 1;
+ if (!txt1)
+ return -1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+int sortsongs_artist_az(const void *d1, const void *d2)
+{
+ struct SSongInfo *sinfo1 = (struct SSongInfo *)d1;
+ struct SSongInfo *sinfo2 = (struct SSongInfo *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = song_info_get_artist(sinfo1);
+ txt2 = song_info_get_artist(sinfo2);
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
+
+int sortsongs_artist_za(const void *d1, const void *d2)
+{
+ struct SSongInfo *sinfo1 = (struct SSongInfo *)d1;
+ struct SSongInfo *sinfo2 = (struct SSongInfo *)d2;
+ char *txt1;
+ char *txt2;
+ txt1 = song_info_get_artist(sinfo1);
+ txt2 = song_info_get_artist(sinfo2);
+
+ if (!txt2)
+ return 1;
+ if (!txt1)
+ return -1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+int sortsongs_album_az(const void *d1, const void *d2)
+{
+ struct SSongInfo *sinfo1 = (struct SSongInfo *)d1;
+ struct SSongInfo *sinfo2 = (struct SSongInfo *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = song_info_get_album(sinfo1);
+ txt2 = song_info_get_album(sinfo2);
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
+
+int sortsongs_album_za(const void *d1, const void *d2)
+{
+ struct SSongInfo *sinfo1 = (struct SSongInfo *)d1;
+ struct SSongInfo *sinfo2 = (struct SSongInfo *)d2;
+ char *txt1;
+ char *txt2;
+
+ txt1 = song_info_get_album(sinfo1);
+ txt2 = song_info_get_album(sinfo2);
+
+ if (!txt2)
+ return 1;
+ if (!txt1)
+ return -1;
+
+ return strcasecmp(txt2, txt1);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app.h>
+#include <Elementary.h>
+#include "dbg.h"
+#include <InputHandler.h>
+#include "music-controller.h"
+#include "define.h"
+#include "BaseApp.h"
+#include "BaseView.h"
+#include "BaseLayout.h"
+#include "ViewMgr.h"
+#include "base-view.h"
+#include "playback-view.h"
+#include "context-view.h"
+
+#define PARAM_ALBUM "album_id"
+#define PARAM_URI "uri"
+#define PARAM_SOURCE "source"
+#define MUSIC_WIN_TITLE "Music Player"
+
+
+class CApp : public CBaseApp {
+private:
+
+ struct _appdata {
+ Evas_Object *win;
+ struct _arg_list *arglist;
+ } ad;
+
+ CMusicBaseView *m_cBaseView;
+ CPlaybackView *m_cPlaybackView;
+ CContextView *m_cContextView;
+
+private:
+
+ static void sm_CbPushView(void* cookie, CBaseView *pHideView, CBaseView *pShowView)
+ {
+ const char *viewId = pShowView->ViewId();
+
+ if (strcmp(viewId, MUSIC_CONTEXT_VIEW) && pHideView) {
+ if (pHideView->FlagCreate())
+ pHideView->Hide();
+ }
+ }
+
+ static void sm_CbPopView(void* cookie, const char *szDestroyViewId, CBaseView *pShowView)
+ {
+ }
+
+protected:
+ void t_RemoveArglist(void)
+ {
+ if (ad.arglist) {
+ free(ad.arglist->album_id);
+ free(ad.arglist->uri);
+ free(ad.arglist->source);
+ free(ad.arglist);
+ ad.arglist = NULL;
+ }
+ }
+
+ Evas_Object *t_AddWin(const char *name)
+ {
+ Evas_Object *win;
+
+ win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (!win)
+ return NULL;
+
+ elm_win_title_set(win, MUSIC_WIN_TITLE);
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+ elm_win_focus_highlight_style_set(win, MUSIC_STYLE_WIN_FOCUS);
+ elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
+ evas_object_show(win);
+
+ return win;
+ }
+
+public:
+
+ virtual bool OnCreate(void)
+ {
+ elm_theme_overlay_add(NULL, THEMEFILE);
+
+ ad.win = t_AddWin(PACKAGE);
+ if (!ad.win)
+ return false;
+
+ return true;
+ }
+ virtual void OnTerminate(void)
+ {
+ CViewMgr::Finalize();
+ CMusicController::Finalize();
+
+ delete m_cBaseView;
+ delete m_cPlaybackView;
+ delete m_cContextView;
+
+ t_RemoveArglist();
+
+ if (ad.win)
+ evas_object_del(ad.win);
+ }
+ virtual void OnPause(void)
+ {
+ elm_exit();
+ }
+
+ virtual void OnService(service_h service)
+ {
+ _DBG("");
+ CViewMgr* viewmgr = NULL;
+ int r;
+ char *album_id;
+ char *uri;
+ char *source;
+
+ _DBG("");
+ r = service_get_extra_data(service, PARAM_ALBUM, &album_id);
+ if (r != SERVICE_ERROR_NONE)
+ album_id = NULL;
+
+ r = service_get_extra_data(service, PARAM_URI, &uri);
+ if (r != SERVICE_ERROR_NONE)
+ uri = NULL;
+
+ r = service_get_extra_data(service, PARAM_SOURCE, &source);
+ if (r != SERVICE_ERROR_NONE)
+ source = NULL;
+ _DBG("");
+
+ elm_win_activate(ad.win);
+ t_RemoveArglist();
+ ad.arglist = (_arg_list *)calloc(1, sizeof(struct _arg_list));
+ if (!ad.arglist)
+ goto error;
+ _DBG("");
+
+ ad.arglist->album_id = album_id;
+ ad.arglist->uri = uri;
+ ad.arglist->source = source;
+ CViewMgr::Finalize();
+ CMusicController::Finalize();
+ _DBG("");
+
+ if (!CMusicController::Initialize()) {
+ _ERR(" music init failed ");
+ goto error;
+ }
+ _DBG("");
+
+ CViewMgr::Initialize(ad.win, (void*)"path");
+ viewmgr = CViewMgr::GetInstance();
+ if (!viewmgr) {
+ _ERR(" viewmgr init failed ");
+ CMusicController::Finalize();
+ goto error;
+ }
+ _DBG("");
+
+ m_cBaseView = new CMusicBaseView(MUSIC_BASE_VIEW);
+ m_cPlaybackView = new CPlaybackView(MUSIC_PLAYBACK_VIEW);
+ m_cContextView = new CContextView(MUSIC_CONTEXT_VIEW);
+ _DBG("");
+
+ viewmgr->AddView(m_cBaseView);
+ viewmgr->AddView(m_cPlaybackView);
+ viewmgr->AddView(m_cContextView);
+ _DBG("");
+
+
+ CViewMgr::SCallback cb;
+ memset(&cb, 0, sizeof(cb));
+ cb.cookie = this;
+ cb.cbPushView = sm_CbPushView;
+ cb.cbPopView = sm_CbPopView;
+ viewmgr->AddCallback(&cb);
+ _DBG("");
+
+ if (!viewmgr->PushView(MUSIC_BASE_VIEW, ad.arglist)) {
+ _ERR(" view push failed ");
+ CViewMgr::Finalize();
+ CMusicController::Finalize();
+ goto error;
+ }
+ _DBG("");
+
+ return;
+
+ error:
+ elm_exit();
+ }
+
+public:
+
+ virtual int Run(int argc, char **argv) {
+ memset(&ad, 0x00, sizeof(_appdata));
+ //ad.name = PACKAGE;
+
+ return CBaseApp::Run(argc, argv);
+ }
+};
+
+
+int main(int argc, char **argv)
+{
+ CApp app;
+ app.Run(argc, argv);
+
+ return 0;
+}
+#if 0
+static int depth = 0;
+const char* szDepth[] = {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+};
+
+void __cyg_profile_func_enter(void *this_fn, void *call_site) __attribute__((no_instrument_function));
+void __cyg_profile_func_enter(void *this_fn, void *call_site)
+{
+ if (depth <= 10) {
+ printf("%s", szDepth[depth]);
+ _DBG("%s>%p/%p", szDepth[depth], call_site, this_fn);
+ }
+ printf(">%p/%p\n", call_site, this_fn);
+ depth++;
+}
+/* __cyg_profile_func_enter */
+void __cyg_profile_func_exit(void *this_fn, void *call_site) __attribute__((no_instrument_function));
+void __cyg_profile_func_exit(void *this_fn, void *call_site)
+{
+ depth--;
+ if (depth <= 10) {
+ printf("%s", szDepth[depth]);
+ _DBG("%s<%p/%p", szDepth[depth], call_site, this_fn);
+ }
+ printf("<%p/%p\n", call_site, this_fn);
+} /* __cyg_profile_func_enter */
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <app.h>
+#include <string.h>
+//#include <usb-device.h>
+#include <AppCommon.h>
+#include <stdlib.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "music-controller.h"
+#include "playlist-mgr.h"
+#include "playback-mgr.h"
+#include "mediadata.h"
+#include "song_info.h"
+#include "album_info.h"
+#include "common.h"
+#include "bus.h"
+
+
+struct SMusicController {
+ CPlayback* pPlayback;
+ CPlaylist* pPlaylist;
+ CMediadata* pMediadata;
+ album_info *alinfo;
+ Eina_List *elListener;
+ int initial_index;
+ int playstate;
+ int shufflestate;
+ int repeatstate;
+ int source_type;
+ int sort_type;
+ struct SCbInfo *cbinfo;
+
+ SMusicController() {
+ memset(this, 0, sizeof(SMusicController));
+ pPlayback = new CPlayback;
+ pPlaylist = new CPlaylist;
+ pMediadata = new CMediadata;
+ }
+ ~SMusicController() {
+ delete pMediadata;
+ delete pPlaylist;
+ delete pPlayback;
+ }
+};
+
+
+void IMusicControllerListener::sm_CbComplete(void *cookie)
+{
+ IMusicControllerListener *root = (IMusicControllerListener *)cookie;
+ if (root)
+ root->t_OnComplete();
+}
+
+
+void IMusicControllerListener::sm_CbError(void *cookie)
+{
+ IMusicControllerListener *root = (IMusicControllerListener *)cookie;
+ if (root)
+ root->t_OnError();
+}
+
+
+void IMusicControllerListener::sm_CbUsbConnected(void *cookie)
+{
+ IMusicControllerListener *root = (IMusicControllerListener *)cookie;
+ if (root)
+ root->t_OnUsbConnected();
+}
+
+
+void IMusicControllerListener::sm_CbUpdateContent(void *cookie)
+{
+ IMusicControllerListener *root = (IMusicControllerListener *)cookie;
+ if (root)
+ root->t_OnUpdateContent();
+}
+
+
+CMusicController *CMusicController::instance = NULL;
+int CMusicController::refCnt = 0;
+
+
+static void _run_callback(SMusicController *mhandle, int type)
+{
+ Eina_List *l;
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ if (!mhandle)
+ return;
+
+ EINA_LIST_FOREACH(mhandle->elListener, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == type && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}
+
+
+bool CMusicController::t_PlayNext(int direction, int playnext_type)
+{
+ bool r;
+ int index;
+
+ if (!m->pPlaylist->FlagCreate())
+ return false;
+
+ Stop();
+
+ if (playnext_type == E_ON_COMPLETE &&
+ m->repeatstate == REPEAT_STATUS_ONE)
+ goto finish;
+
+ if (direction == DIR_NEXT) {
+ r = m->pPlaylist->LoadNextSong(m->shufflestate);
+ } else {
+ r = m->pPlaylist->LoadPreviousSong(m->shufflestate);
+ }
+
+ if (r == false) {
+ _ERR(" playlist load next/previous failed ");
+ return false;
+ }
+
+ if (playnext_type == E_ON_COMPLETE &&
+ m->repeatstate == REPEAT_STATUS_NONE) {
+ r = m->pPlaylist->GetCurSongIndex(&index);
+ if (r == false) {
+ _ERR(" get cur song index failed ");
+ return false;
+ }
+
+ if (index == m->initial_index)
+ return true;
+ }
+
+finish:
+ Start();
+
+ return true;
+}
+
+void CMusicController::sm_CbPlaybackCompletion(void *dt)
+{
+ CMusicController* root = (CMusicController*)dt;
+ if (root)
+ root->m_OnPlaybackCompletion();
+}
+
+
+void CMusicController::m_OnPlaybackCompletion(void)
+{
+ bool r;
+ Eina_List *l;
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ r = t_PlayNext(DIR_NEXT, E_ON_COMPLETE);
+ if (r == false)
+ _ERR(" music play next song failed ");
+
+ EINA_LIST_FOREACH(m->elListener, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == E_SONG_COMPLETE && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}
+
+bool CMusicController::CheckUsb(void)
+{
+ /*if (!m)
+ return false;
+
+ if (usb_get_connected_device_number(USB_MASS_STORAGE) <= 0)
+ return false;
+
+ return true;*/
+ return false;
+}
+
+/*void CMusicController::sm_CbConnected(usb_device_h usb_device, char *action, void *dt)
+{
+ CMusicController *root = (CMusicController*)dt;
+ if (root)
+ root->m_OnConnected(usb_device, action);
+}
+
+
+void CMusicController::m_OnConnected(usb_device_h usb_device, char *action)
+{
+ Eina_List *l;
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ if (SourceType() == SOURCE_TYPE_USB) {
+ if (!CheckUsb())
+ SetSourceType(SOURCE_TYPE_ALL);
+ }
+
+ EINA_LIST_FOREACH(m->elListener, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == E_USB_CONNECT && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}*/
+
+static void _content_update_cb(void *dt)
+{
+ SMusicController *mhandle;
+ Eina_List *l;
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ if (!dt)
+ return;
+
+ mhandle = (SMusicController *)dt;
+
+ EINA_LIST_FOREACH(mhandle->elListener, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == E_CONTENT_UPDATE && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}
+
+SMusicController *CMusicController::t_Create(void)
+{
+ SMusicController *mhandle;
+
+ mhandle = new SMusicController;
+ if (!mhandle) {
+ _ERR(" music init failed ");
+ return NULL;
+ }
+
+ mhandle->playstate = PLAY_STATUS_INITIAL;
+ mhandle->shufflestate = SHUFFLE_STATUS_OFF;
+ mhandle->repeatstate = REPEAT_STATUS_ALL;
+ mhandle->initial_index = 0;
+ mhandle->sort_type = E_SORT_TITLE_A_Z;
+ mhandle->source_type = SOURCE_TYPE_ALL;
+ mhandle->alinfo = NULL;
+
+ if (!mhandle->pMediadata->Create()) {
+ _ERR(" mediadata create failed ");
+ delete mhandle;
+ return NULL;
+ }
+
+ if (!mhandle->pPlayback->Create())
+ _ERR(" playback create failed ");
+
+ if (!mhandle->pPlayback->SetCallback(sm_CbPlaybackCompletion, this))
+ _ERR(" playback add completion callback failed");
+
+ mhandle->cbinfo = mhandle->pMediadata->AddCallback(E_CONTENT_UPDATE, _content_update_cb, mhandle);
+
+ //usb_device_init();
+ //usb_set_connected_cb(sm_CbConnected, this);
+
+ return mhandle;
+}
+
+
+bool CMusicController::Initialize(void)
+{
+ if (refCnt == 0) {
+ instance = new CMusicController;
+ instance->m = instance->t_Create();
+ if (!instance->m) {
+ _ERR("music_init failed");
+ delete instance;
+ instance = NULL;
+ return false;
+ }
+ }
+
+ refCnt++;
+
+ return true;
+}
+
+
+void CMusicController::t_Destroy(void)
+{
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ if (m->pPlayback->FlagCreate()) {
+ if (!m->pPlayback->UnsetCallback())
+ _ERR(" playback remove completion callback failed");
+
+ m->pPlayback->Destroy();
+ }
+
+ if (m->pPlaylist->FlagCreate()) {
+ m->pPlaylist->Destroy();
+ }
+
+ m->pMediadata->RemoveCallback(m->cbinfo);
+ m->pMediadata->Destroy();
+
+ if (m->alinfo) {
+ album_info_destroy(m->alinfo);
+ m->alinfo = NULL;
+ }
+
+ EINA_LIST_FREE(m->elListener, obj) {
+ cbinfo = (SCbInfo *)obj;
+ free(cbinfo);
+ }
+
+ //usb_unset_connected_cb();
+ //usb_device_fini();
+
+ delete m;
+}
+
+
+void CMusicController::Finalize(void)
+{
+ if (refCnt > 0) {
+ refCnt--;
+ }
+ if (refCnt == 0) {
+ if (instance) {
+ instance->t_Destroy();
+ delete instance;
+ instance = NULL;
+ }
+ }
+}
+
+CMusicController* CMusicController::GetInstance(void)
+{
+ return instance;
+}
+
+
+bool CMusicController::UpdatePlaylist(Eina_List *slist, int addmode)
+{
+ if (!m)
+ return false;
+
+ if (!slist)
+ return false;
+
+ if (m->pPlaylist->FlagCreate())
+ m->pPlaylist->Update(slist, addmode);
+ else {
+ if (!m->pPlaylist->Create(slist))
+ _ERR(" playlist create failed ");
+ }
+ return true;
+}
+
+
+bool CMusicController::AddListener(IMusicControllerListener *listener)
+{
+ ASSERT(listener);
+
+ if (!m)
+ return false;
+
+ m->elListener = eina_list_append(m->elListener, listener);
+
+ return true;
+}
+
+
+bool CMusicController::RemoveListener(IMusicControllerListener *listener)
+{
+ ASSERT(listener);
+
+ if (!m)
+ return false;
+
+ m->elListener = eina_list_remove(m->elListener, listener);
+
+ return true;
+}
+
+
+bool CMusicController::Start(void)
+{
+ if (!m)
+ return false;
+
+ const char *songpath;
+ int index;
+ CPlaylist *pPlaylist;
+ CPlayback *pPlayback;
+ struct SSongInfo *sinfo;
+ char *media_id;
+
+ pPlaylist = m->pPlaylist;
+ pPlayback = m->pPlayback;
+
+ if (!pPlaylist || !pPlayback)
+ goto error;
+
+ if (!pPlaylist->GetCurSongIndex(&index)) {
+ _ERR(" playlist get current song index failed");
+ goto error;
+ }
+
+ songpath = pPlaylist->SongpathFromIndex(index);
+ if (!songpath) {
+ _ERR(" palylist get song path from index failed");
+ goto error;
+ }
+
+ if (!pPlayback->SetUri(songpath)) {
+ _ERR(" playback set uri failed");
+ goto playback_error;
+ }
+
+ if (!pPlayback->Prepare()) {
+ _ERR(" playback prepare failed");
+ goto playback_error;
+ }
+
+ if (!pPlayback->Start()) {
+ _ERR(" playback start failed");
+ goto playback_error;
+ }
+
+ m->playstate = PLAY_STATUS_PLAY;
+
+ if (m->pPlaylist->GetSonginfoFromIndex(index, &sinfo)) {
+ media_id = song_info_get_media_id(sinfo);
+ if (media_id) {
+ if (m->pMediadata->SetPlayedTime(media_id))
+ bus_send_signal();
+ } else
+ _ERR("song info get media id failed");
+ } else
+ _ERR("playback get songinfo failed");
+
+ return true;
+
+playback_error:
+ _run_callback(m, E_PLAYBACK_ERROR);
+error:
+ Stop();
+
+ return false;
+}
+
+
+bool CMusicController::Stop(void)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlayback->FlagCreate())
+ return false;
+
+ if (!m->pPlayback->Stop())
+ _ERR(" playback stop failed ");
+
+ m->playstate = PLAY_STATUS_STOP;
+
+ if (!m->pPlayback->Unprepare())
+ _ERR(" playback unprepare failed");
+
+ return true;
+}
+
+
+bool CMusicController::GetCurrentSongIndex(int *ind)
+{
+ if (!m)
+ return false;
+
+ int index;
+
+ if (!m || !m->pPlaylist->FlagCreate()) {
+ _ERR("NULL received");
+ return false;
+ }
+
+ if (!m->pPlaylist->GetCurSongIndex(&index)) {
+ _ERR(" playlist get current song index failed");
+ return false;
+ }
+
+ *ind = index;
+
+ return true;
+}
+
+
+bool CMusicController::SetCurrentSongIndex(int index)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlaylist->FlagCreate()) {
+ _ERR("NULL received");
+ return false;
+ }
+
+ if (!m->pPlaylist->SetCurSongIndex(index)) {
+ _ERR(" playlist get current song index failed");
+ return false;
+ }
+
+ m->initial_index = index;
+
+ return true;
+}
+
+
+bool CMusicController::GetTotalSongs(int *ts)
+{
+ if (!m)
+ return false;
+
+ int count;
+
+ if (!m->pPlaylist->FlagCreate()) {
+ _ERR("NULL received");
+ return false;
+ }
+
+ if (!m->pPlaylist->GetTotalSongs(&count)) {
+ _ERR(" playlist get current song index failed");
+ return false;
+ }
+
+ *ts = count;
+
+ return true;
+}
+
+
+bool CMusicController::GetSonginfoFromIndex(int index, struct SSongInfo **const csinfo)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlaylist->FlagCreate() || !csinfo) {
+ _ERR("NULL received");
+ return false;
+ }
+
+ if (!m->pPlaylist->GetSonginfoFromIndex(index, csinfo)) {
+ _ERR(" playlist get current song info failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CMusicController::PlayNextSong(void)
+{
+ return t_PlayNext(DIR_NEXT, E_BUTTON_CLICK);
+}
+
+
+bool CMusicController::PlayPreviousSong(void)
+{
+ return t_PlayNext(DIR_PREVIOUS, E_BUTTON_CLICK);
+}
+
+
+bool CMusicController::PlayIndexSong(int index)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlaylist->FlagCreate())
+ return false;
+
+ Stop();
+
+ if (!m->pPlaylist->SetCurSongIndex(index))
+ return false;
+
+ Start();
+
+ return true;
+}
+
+
+bool CMusicController::Resume(void)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlayback->FlagCreate())
+ return false;
+
+ if (!m->pPlayback->Resume())
+ return false;
+
+ m->playstate = PLAY_STATUS_PLAY;
+
+ return true;
+}
+
+
+bool CMusicController::Pause(void)
+{
+ if (!m)
+ return false;
+
+ if (!m || !m->pPlayback->FlagCreate())
+ return false;
+
+ if (!m->pPlayback->Pause())
+ return false;
+
+ m->playstate = PLAY_STATUS_PAUSE;
+
+ return true;
+}
+
+
+bool CMusicController::SetPosition(int milseconds)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlayback->FlagCreate())
+ return false;
+
+ if (!m->pPlayback->SetPosition(milseconds))
+ return false;
+
+ return true;
+}
+
+
+bool CMusicController::GetPosition(int *const milseconds)
+{
+ if (!m)
+ return false;
+
+ if (!m || !m->pPlayback->FlagCreate())
+ return false;
+
+ if (!m->pPlayback->GetPosition(milseconds))
+ return false;
+
+ return true;
+}
+
+
+bool CMusicController::RemoveSong(struct SSongInfo *sinfo, int index)
+{
+ if (!m)
+ return false;
+
+ int ind;
+
+ if (!m->pPlaylist->FlagCreate())
+ return false;
+
+ if (!GetCurrentSongIndex(&ind)) {
+ _ERR("unable to find current song index");
+ return false;
+ }
+
+ if (!m->pPlaylist->RemoveSong(sinfo, index, m->shufflestate)) {
+ _ERR("Song can not be deleted");
+ return false;
+ }
+
+ if (ind != 0 && ind == index)
+ Stop();
+
+ return true;
+}
+
+
+bool CMusicController::EmptyPlaylist(void)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlaylist->FlagCreate())
+ return false;
+
+ m->pPlaylist->Destroy();
+
+ return true;
+}
+
+
+bool CMusicController::GetCurrentSong(struct SSongInfo **const sinfo)
+{
+ if (!m)
+ return false;
+
+ int index;
+
+ if (!m->pPlaylist->FlagCreate())
+ return false;
+
+ if (!m->pPlaylist->GetCurSongIndex(&index)) {
+ _ERR(" playlist get current song index failed");
+ return false;
+ }
+
+ if (!m->pPlaylist->GetSonginfoFromIndex(index, sinfo)) {
+ _ERR(" playlist get current song info failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+struct SSongInfo *CMusicController::MediaSongByUri(char *uri)
+{
+ if (!m)
+ return false;
+
+ struct SSongInfo *sinfo;
+
+ sinfo = m->pMediadata->SongByUri(uri);
+ if (!sinfo)
+ return NULL;
+
+ return sinfo;
+}
+
+
+bool CMusicController::MediaGetList(int EListType, void *info, Eina_List **list)
+{
+ if (!m)
+ return false;
+
+ Eina_List *mlist;
+
+ mlist = m->pMediadata->Medialist(m->source_type, EListType, info);
+ if (!mlist)
+ return false;
+
+ *list = eina_list_clone(mlist);
+
+ return true;
+}
+
+
+bool CMusicController::MediaInsertPlaylist(const char *name, Eina_List *idlist)
+{
+ if (!m)
+ return false;
+
+ return m->pMediadata->InsertPlaylist(name, idlist);
+}
+
+
+bool CMusicController::MediaExistPlaylist(const char *name)
+{
+ if (!m)
+ return false;
+
+ if (!name)
+ return false;
+
+ return m->pMediadata->ExistPlaylist(name);
+}
+
+
+bool CMusicController::MediaDeletePlaylist(int id)
+{
+ if (!m)
+ return false;
+
+ return m->pMediadata->DeletePlaylist(id);
+}
+
+
+bool CMusicController::MediaRenamePlaylist(int id, const char *name)
+{
+ if (!m)
+ return false;
+
+ if (!name)
+ return false;
+
+ return m->pMediadata->RenamePlaylist(id, name);
+}
+
+
+bool CMusicController::MediaAddmediaPlaylist(int id, Eina_List *idlist)
+{
+ if (!m)
+ return false;
+
+ if (!idlist)
+ return false;
+
+ return m->pMediadata->AddmediaPlaylist(id, idlist);
+}
+
+
+bool CMusicController::MediaRemovemediaPlaylist(int id, Eina_List *idlist)
+{
+ if (!m)
+ return false;
+
+ if (!idlist)
+ return false;
+
+ return m->pMediadata->RemovemediaPlaylist(id, idlist);
+}
+
+
+bool CMusicController::MediaAddsongsPlaylist(int lid, Eina_List *list)
+{
+ if (!m)
+ return false;
+
+ Eina_List *idlist, *l;
+ struct SSongInfo *sinfo;
+ void *obj;
+ char *id;
+
+ if (!list)
+ return false;
+
+ idlist = NULL;
+ EINA_LIST_FOREACH(list, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ id = song_info_get_media_id(sinfo);
+ if (id)
+ idlist = eina_list_append(idlist, id);
+ }
+
+ if (!MediaAddmediaPlaylist(lid, idlist)) {
+ _ERR(" Failed to add songs to playlist ");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CMusicController::SetCurrentSong(char *mediaid)
+{
+ if (!m)
+ return false;
+
+ if (!m->pPlaylist->FlagCreate() || !mediaid)
+ return false;
+
+ m->pPlaylist->SetCurrentSong(mediaid);
+
+ return true;
+}
+
+
+struct album_info *CMusicController::CurrentAlbum(void)
+{
+ if (!m)
+ return NULL;
+
+ return m->alinfo;
+}
+
+
+bool CMusicController::SetCurrentAlbum(struct album_info *alinfo)
+{
+ if (!m)
+ return false;
+
+ if (m->alinfo)
+ album_info_destroy(m->alinfo);
+
+ m->alinfo = NULL;
+ if (alinfo)
+ m->alinfo = album_info_duplicate(alinfo);
+
+ return true;
+}
+
+
+int CMusicController::PlayState(void)
+{
+ if (!m)
+ return -1;
+
+ return m->playstate;
+}
+
+
+int CMusicController::ShuffleState(void)
+{
+ if (!m)
+ return -1;
+
+ return m->shufflestate;
+}
+
+
+int CMusicController::RepeatState(void)
+{
+ if (!m)
+ return -1;
+
+ return m->repeatstate;
+}
+
+
+bool CMusicController::SetPlayState(int state)
+{
+ if (!m)
+ return false;
+
+ m->playstate = state;
+
+ return true;
+}
+
+
+bool CMusicController::SetShuffleState(int state)
+{
+ if (!m)
+ return false;
+
+ m->shufflestate = state;
+ if (state && m->pPlaylist->FlagCreate())
+ m->pPlaylist->UpdateShuffle();
+
+ return true;
+}
+
+
+bool CMusicController::SetRepeatState(int state)
+{
+ if (!m)
+ return false;
+
+ m->repeatstate = state;
+
+ return true;
+}
+
+
+int CMusicController::SourceType(void)
+{
+ if (!m)
+ return -1;
+
+ return m->source_type;
+}
+
+
+int CMusicController::SortType(void)
+{
+ if (!m)
+ return -1;
+
+ return m->sort_type;
+}
+
+
+bool CMusicController::SetSourceType(int type)
+{
+ if (!m)
+ return false;
+
+ m->source_type = type;
+
+ return true;
+}
+
+
+bool CMusicController::SetSortType(int type)
+{
+ if (!m)
+ return false;
+
+ m->sort_type = type;
+
+ return true;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "i18n.h"
+#include "dbg.h"
+#include "playback-mgr.h"
+
+
+struct SPlayback {
+ player_h player;
+};
+
+
+void _on_seek_completion(void *dt)
+{
+}
+
+
+bool CPlayback::Create(void)
+{
+ int r;
+
+ if (m)
+ return false;
+
+ m = new SPlayback;
+ if (!m)
+ return false;
+
+ r = player_create(&m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player creation failed");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ return true;
+}
+
+
+void CPlayback::Destroy(void)
+{
+ if (!m)
+ return;
+
+ int r;
+ player_state_e state;
+
+ if (m->player) {
+ r = player_get_state(m->player, &state);
+ if (r == PLAYER_ERROR_NONE) {
+ if (state == PLAYER_STATE_PLAYING ||
+ state == PLAYER_STATE_PAUSED)
+ player_stop(m->player);
+ if (state == PLAYER_STATE_READY)
+ player_unprepare(m->player);
+ }
+
+ r = player_destroy(m->player);
+ if (r != PLAYER_ERROR_NONE)
+ _ERR("Player destroy failed");
+ }
+
+ delete m;
+ m = NULL;
+}
+
+
+bool CPlayback::Start(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_start(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player start failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::Stop(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_stop(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player stop failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::SetCallback(player_completed_cb on_playback_completion, void *data)
+{
+ if (!m)
+ return false;
+
+ int r;
+ if (!m->player)
+ return false;
+
+ r = player_set_completed_cb(m->player, on_playback_completion, data);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set completed callaback failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::UnsetCallback(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_unset_completed_cb(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player unset completed cb failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::SetMute(bool flag)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_set_mute(m->player, flag);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set mute failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::SetLooping(bool flag)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_set_looping(m->player, flag);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set looping failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::Resume(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_start(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player start in playback resume failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::Pause(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_pause(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player pause failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::SetNextUri(const char *path)
+{
+ // Not used
+ /*if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_set_next_uri(m->player, path);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set next uri failed");
+ return false;
+ }*/
+
+ return true;
+}
+
+
+bool CPlayback::SetUri(const char *path)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_set_uri(m->player, path);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set uri failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::Prepare(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_prepare(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player prepare failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::Unprepare(void)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_unprepare(m->player);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player unprepare failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::SetPosition(int milsec)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_set_position(m->player, milsec, _on_seek_completion, m);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set position failed");
+ return false;
+ }
+
+ return true;
+}
+
+
+bool CPlayback::GetPosition(int *const milsec)
+{
+ if (!m)
+ return false;
+
+ int r;
+
+ if (!m->player)
+ return false;
+
+ r = player_get_position(m->player, milsec);
+ if (r != PLAYER_ERROR_NONE) {
+ _ERR("Player set position failed");
+ return false;
+ }
+
+ return true;
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app.h>
+#include <stdlib.h>
+#include <string.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "song_info.h"
+#include "playlist-mgr.h"
+#include "time.h"
+#include "common.h"
+
+
+struct SPlaylist {
+ Eina_List *songlist;
+ int total_songs;
+ int cur_song_index;
+ int count;
+ int *shuffle_list;
+ SPlaylist() {
+ songlist = NULL;
+ total_songs = 0;
+ cur_song_index = 0;
+ count = 0;
+ shuffle_list = NULL;
+ }
+};
+
+
+static void _swap(int *a, int *b)
+{
+ int temp = *a;
+ *a = *b;
+ *b = temp;
+}
+
+static void _delete_element_shuffle(int *list, int size, int elmt)
+{
+ int i, j = 0;
+
+ if (!list || size <= 0)
+ return;
+
+ for (i = 0; i < size; i++) {
+ if (list[i] < elmt) {
+ list[j] = list[i];
+ j++;
+ } else if (list[i] > elmt) {
+ list[j] = list[i] - 1;
+ j++;
+ }
+ }
+ list[j] = -1;
+}
+
+static void _shuffle(int *list, int size)
+{
+ int i, j;
+
+ if (!list || size <= 0)
+ return;
+
+ srand(time(NULL));
+ for (i = size - 1; i > 0; i--) {
+ j = rand() % (i+1);
+ _swap(&list[i], &list[j]);
+ }
+}
+
+static int _get_previous(int *list, int size, int index)
+{
+ int i;
+ int sindex;
+
+ for (i = 0; i < size; i++) {
+ if (list[i] == index)
+ break;
+ }
+
+ if (i == 0)
+ sindex = list[size - 1];
+ else
+ sindex = list[i - 1];
+
+ if (sindex == -1)
+ return index;
+
+ return sindex;
+}
+
+static int _get_next(int *list, int size, int index)
+{
+ int i;
+ int sindex;
+
+ for (i = 0; i < size; i++) {
+ if (list[i] == index)
+ break;
+ }
+
+ if (i == (size - 1))
+ sindex = list[0];
+ else
+ sindex = list[i + 1];
+
+ if (sindex == -1)
+ return index;
+
+ return sindex;
+}
+
+
+bool CPlaylist::Create(Eina_List *songlist)
+{
+ if (m)
+ return false;
+
+ struct SSongInfo *sinfo;
+ struct SSongInfo *d_sinfo;
+ void *obj;
+ Eina_List *l;
+
+ if (!songlist || eina_list_count(songlist) == 0) {
+ _ERR(" No songlist ");
+ return false;
+ }
+
+ m = new SPlaylist;
+ if (!m) {
+ _ERR(" Unable to allocate memory for playlist ");
+ return NULL;
+ }
+ m->cur_song_index = 0;
+
+ EINA_LIST_FOREACH(songlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ d_sinfo = song_info_duplicate(sinfo);
+ if (d_sinfo) {
+ m->songlist = eina_list_append(m->songlist,
+ d_sinfo);
+ }
+ }
+
+ m->total_songs = eina_list_count(m->songlist);
+
+ UpdateShuffle();
+
+ return true;
+}
+
+
+void CPlaylist::Destroy(void)
+{
+ if (!m)
+ return;
+
+ struct SSongInfo *sinfo;
+ void *obj;
+
+ m->total_songs = 0;
+ if (m->songlist) {
+ EINA_LIST_FREE(m->songlist, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+ }
+ if (m->shuffle_list)
+ free(m->shuffle_list);
+
+ delete m;
+ m = NULL;
+}
+
+
+bool CPlaylist::Update(Eina_List *songlist, int addmode)
+{
+ if (!m)
+ return false;
+
+ struct SSongInfo *sinfo;
+ struct SSongInfo *d_sinfo;
+ struct SSongInfo *relative;
+ void *obj;
+ Eina_List *l;
+ int rindex;
+
+ if (!songlist) {
+ _ERR(" No m or songlist ");
+ return NULL;
+ }
+
+ if (addmode == ADD_TYPE_FRESH || (m->total_songs == 0)) {
+ Destroy();
+ return Create(songlist);
+ }
+
+ if (!songlist)
+ return true;
+
+ if (addmode == ADD_TYPE_END)
+ rindex = m->total_songs - 1;
+ else
+ rindex = m->cur_song_index;
+
+ EINA_LIST_FOREACH(songlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ d_sinfo = song_info_duplicate(sinfo);
+ if (d_sinfo) {
+ relative = (SSongInfo *)eina_list_nth(m->songlist, rindex);
+ m->songlist = eina_list_append_relative(
+ m->songlist, d_sinfo, relative);
+ rindex++;
+ }
+ }
+
+ m->total_songs = eina_list_count(m->songlist);
+
+ UpdateShuffle();
+
+ return true;
+}
+
+
+bool CPlaylist::SetCurrentSong(char *mediaid)
+{
+ if (!m)
+ return false;
+
+ Eina_List *l;
+ struct SSongInfo *sinfo;
+ void *obj;
+ int i;
+ char *id;
+
+ if (!m->songlist)
+ return false;
+
+ i = eina_list_count(m->songlist) - 1;
+ EINA_LIST_REVERSE_FOREACH(m->songlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ id = song_info_get_media_id(sinfo);
+ if (!strcmp(id, mediaid)) {
+ m->cur_song_index = i;
+ break;
+ }
+ i--;
+ }
+ return true;
+}
+
+
+bool CPlaylist::SetCurSongIndex(int index)
+{
+ if (!m)
+ return false;
+
+ if (index < 0 || index >= m->total_songs) {
+ _ERR(" set index is out of range ");
+ return false;
+ }
+
+ m->cur_song_index = index;
+
+ return true;
+}
+
+
+bool CPlaylist::GetCurSongIndex(int *index)
+{
+ if (!m) {
+ _ERR(" No play list");
+ return false;
+ }
+
+ *index = m->cur_song_index;
+
+ return true;
+}
+
+
+bool CPlaylist::GetTotalSongs(int *ts)
+{
+ if (!m) {
+ _ERR(" No play list");
+ return false;
+ }
+
+ *ts = m->total_songs;
+
+ return true;
+}
+
+
+bool CPlaylist::LoadNextSong(int shufstate)
+{
+ int index, total_songs;
+
+ if (!m) {
+ _ERR(" No play list");
+ return false;
+ }
+
+ total_songs = m->total_songs;
+
+ index = m->cur_song_index;
+ if (index < 0 || index >= total_songs) {
+ _ERR(" index out of range ");
+ return false;
+ }
+
+ if (shufstate && m->shuffle_list)
+ index = _get_next(m->shuffle_list, total_songs, index);
+ else {
+ index++;
+ if (index == total_songs)
+ index = 0;
+ }
+
+ m->cur_song_index = index;
+
+ return true;
+}
+
+
+bool CPlaylist::LoadPreviousSong(int shufstate)
+{
+ int index, total_songs;
+
+ if (!m) {
+ _ERR(" No play list");
+ return false;
+ }
+
+ total_songs = m->total_songs;
+
+ index = m->cur_song_index;
+ if (index < 0 || index >= total_songs) {
+ _ERR(" index out of range ");
+ return false;
+ }
+
+ if (shufstate && m->shuffle_list)
+ index = _get_previous(m->shuffle_list, total_songs, index);
+ else {
+ if (index == 0)
+ index = total_songs - 1;
+ else
+ index--;
+ }
+
+ m->cur_song_index = index;
+
+ return true;
+}
+
+
+const char *CPlaylist::SongpathFromIndex(int index)
+{
+ if (!m)
+ return NULL;
+
+ const char *path;
+ struct SSongInfo *sinfo;
+
+ if (!m->songlist) {
+ _ERR(" No play list");
+ return NULL;
+ }
+
+ if (index < 0 || index >= m->total_songs) {
+ _ERR(" index out of range ");
+ return NULL;
+ }
+
+ sinfo = (SSongInfo *)eina_list_nth(m->songlist, index);
+ if (!sinfo) {
+ _ERR(" Eina list nth failed ");
+ return NULL;
+ }
+
+ path = song_info_get_filepath(sinfo);
+ if (!path) {
+ _ERR(" Get song path failed");
+ return NULL;
+ }
+
+ return path;
+}
+
+
+bool CPlaylist::GetSonginfoFromIndex(int index, struct SSongInfo **const csinfo)
+{
+ if (!m)
+ return false;
+
+ struct SSongInfo *sinfo;
+
+ if (!m->songlist) {
+ _ERR(" No play list");
+ return false;
+ }
+
+ if (index < 0 || index >= m->total_songs) {
+ _ERR(" index out of range ");
+ return false;
+ }
+
+ sinfo = (SSongInfo *)eina_list_nth(m->songlist, index);
+ if (!sinfo) {
+ _ERR(" Eina list nth failed ");
+ return false;
+ }
+
+ *csinfo = sinfo;
+
+ return true;
+}
+
+
+bool CPlaylist::RemoveSong(struct SSongInfo *sinfo, int index, int shufstate)
+{
+ if (!m)
+ return false;
+
+ if (!m->songlist) {
+ _ERR(" No play list");
+ return false;
+ }
+
+ m->songlist = eina_list_remove(m->songlist, sinfo);
+ song_info_destroy(sinfo);
+
+ if (shufstate) {
+ _delete_element_shuffle(m->shuffle_list, m->total_songs,
+ index);
+ }
+ m->total_songs = m->total_songs - 1;
+
+ if (index <= m->cur_song_index && m->cur_song_index != 0)
+ m->cur_song_index = m->cur_song_index - 1;
+
+ return true;
+}
+
+
+bool CPlaylist::UpdateShuffle(void)
+{
+ if (!m)
+ return false;
+
+ int i;
+ int *list;
+
+ if (m->total_songs <= 0)
+ return false;
+
+ if (m->shuffle_list)
+ free(m->shuffle_list);
+
+ list = (int *)calloc(1, m->total_songs * sizeof(int));
+ for (i = 0; i < m->total_songs; i++)
+ list[i] = i;
+
+ _shuffle(list, m->total_songs);
+
+ m->shuffle_list = list;
+
+ return true;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <app.h>
+#include <media/sound_manager.h>
+#include <volume-control.h>
+#include "dbg.h"
+
+
+#define VOLUME_MUTE 1
+#define VOLUME_UNMUTE 0
+
+static int currentVolume = 0;
+static bool muteFlag = false;
+
+bool CVolumeController::Mute(void)
+{
+ int r;
+
+ r = sound_manager_get_volume(SOUND_TYPE_MEDIA, ¤tVolume);
+ if (r != 0) {
+ _ERR("failed to get volume");
+ return false;
+ }
+
+ r = sound_manager_set_volume(SOUND_TYPE_MEDIA, 0);
+ if (r != 0) {
+ _ERR("failed to set volume");
+ return false;
+ }
+
+ muteFlag = true;
+
+ return true;
+}
+
+bool CVolumeController::Unmute(void)
+{
+ int r;
+
+ r = sound_manager_set_volume(SOUND_TYPE_MEDIA, currentVolume);
+ if (r != 0) {
+ _ERR("failed to set volume");
+ return false;
+ }
+
+ muteFlag = false;
+
+ return true;
+}
+
+bool CVolumeController::Up(void)
+{
+ int r, vol;
+
+ if (!CVolumeController::Unmute()) {
+ _ERR("failed to set volume unmute");
+ return false;
+ }
+
+ r = sound_manager_get_volume(SOUND_TYPE_MEDIA, &vol);
+ if (r != 0) {
+ _ERR("failed to get volume");
+ return false;
+ }
+
+ vol++;
+
+ r = sound_manager_set_volume(SOUND_TYPE_MEDIA, vol);
+ if (r != 0) {
+ _ERR("failed to set volume");
+ return false;
+ }
+
+ return true;
+}
+
+bool CVolumeController::Down(void)
+{
+ int r, vol;
+
+ if (!CVolumeController::Unmute()) {
+ _ERR("failed to set volume unmute");
+ return false;
+ }
+
+ r = sound_manager_get_volume(SOUND_TYPE_MEDIA, &vol);
+ if (r != 0) {
+ _ERR("failed to get volume");
+ return false;
+ }
+ vol--;
+
+ r = sound_manager_set_volume(SOUND_TYPE_MEDIA, vol);
+ if (r != 0) {
+ _ERR("failed to set volume");
+ return false;
+ }
+
+ return true;
+}
+
+bool CVolumeController::IsMute(void)
+{
+ /*int r;
+ bool mute;
+
+ r = sound_manager_get_master_mute(&mute);
+ if (r != 0) {
+ _ERR("failed to get mute");
+ return false;
+ }
+
+ if (mute)
+ return true;
+
+ return false;*/
+ return muteFlag;
+}
+
+bool CVolumeController::Get(int *vol)
+{
+ int r;
+
+ r = sound_manager_get_volume(SOUND_TYPE_MEDIA, vol);
+ if (r != 0) {
+ _ERR("failed to get volume");
+ return false;
+ }
+
+ return true;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include "LayoutMgr.h"
+#include "BaseView.h"
+#include "BaseLayout.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+
+
+CExtBaseLayout::CExtBaseLayout(const char *pLayoutId) : CBaseLayout(pLayoutId)
+{
+ m_bEmptyStatus = false;
+}
+
+
+CExtBaseLayout::~CExtBaseLayout()
+{
+}
+
+
+void CExtBaseLayout::SetEmptyStatus(bool flag)
+{
+ m_bEmptyStatus = flag;
+}
+
+
+bool CExtBaseLayout::EmptyStatus(void)
+{
+ return m_bEmptyStatus;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include "dbg.h"
+#include "define.h"
+#include <AppCommon.h>
+#include "common.h"
+#include "common-ui.h"
+#include "HandleVolume.h"
+#include "volume-control.h"
+
+
+#define VOLUME_TIMER_INTERVAL 5 /* seconds */
+
+
+struct SHandleVolume {
+ Evas_Object *eoVolBar;
+ Evas_Object *eoVolLayout;
+ Evas_Object *eoBase;
+ Ecore_Timer *etVol;
+ bool flagVolumeMode;
+};
+
+
+enum volume_key_type {
+ SOUND_UP,
+ SOUND_DOWN,
+ SOUND_MUTE
+};
+
+
+Eina_Bool CHandleVolume::sm_CbVolumeTimer(void *dt)
+{
+ SHandleVolume *m = (SHandleVolume *)dt;
+
+ if (!m)
+ return ECORE_CALLBACK_CANCEL;
+
+ m->etVol = NULL;
+ elm_object_part_content_unset(m->eoBase, MUSIC_PART_VOLUME_LAYOUT);
+ evas_object_hide(m->eoVolLayout);
+ m->flagVolumeMode = false;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+void CHandleVolume::m_HandleVolumeKey(int mode)
+{
+ if (!m->flagVolumeMode) {
+ RemoveTimer();
+ m->etVol = ecore_timer_add(VOLUME_TIMER_INTERVAL,
+ sm_CbVolumeTimer, m);
+ m->flagVolumeMode = true;
+ evas_object_show(m->eoVolLayout);
+ elm_object_part_content_set(m->eoBase, MUSIC_PART_VOLUME_LAYOUT,
+ m->eoVolLayout);
+ evas_object_show(m->eoVolLayout);
+ }
+ else
+ ecore_timer_reset(m->etVol);
+
+ m_HandleVolume(mode);
+ m_UpdateVolumeBar();
+}
+
+
+void CHandleVolume::m_UpdateVolumeBar(void)
+{
+ double value;
+ int vol;
+ char buf[MAX_LENGTH];
+
+ if (!m->eoVolBar) {
+ _ERR("failed to get priv");
+ return;
+ }
+
+ if (!CVolumeController::Get(&vol)) {
+ _ERR(" music volume get failed ");
+ return;
+ }
+
+ value = vol * 0.01;
+ elm_progressbar_value_set(m->eoVolBar, value);
+ snprintf(buf, sizeof(buf), "%d", vol);
+ elm_object_part_text_set(m->eoVolLayout, MUSIC_PART_VOLUME_VALUE, buf);
+ if (vol == 0 || CVolumeController::IsMute()) {
+ elm_object_signal_emit(m->eoVolLayout,
+ MUSIC_SIGNAL_VOLUME_MUTE,
+ MUSIC_PLAYBACK_VIEW);
+ }
+ else {
+ elm_object_signal_emit(m->eoVolLayout,
+ MUSIC_SIGNAL_VOLUME_UNMUTE,
+ MUSIC_PLAYBACK_VIEW);
+ }
+}
+
+
+void CHandleVolume::m_HandleVolume(int mode)
+{
+ volume_key_type keyType = (volume_key_type)mode;
+
+ switch (keyType) {
+ case SOUND_UP:
+ CVolumeController::Up();
+ break;
+ case SOUND_DOWN:
+ CVolumeController::Down();
+ break;
+ case SOUND_MUTE:
+ if (CVolumeController::IsMute())
+ CVolumeController::Unmute();
+ else
+ CVolumeController::Mute();
+ break;
+ }
+}
+
+
+bool CHandleVolume::Create(Evas_Object *eoBase)
+{
+ ASSERT(!m);
+
+ _CREATE_BEGIN{
+ _CHECK(m = new SHandleVolume)
+ _CHECK(m->eoVolLayout = _add_base(eoBase, MUSIC_VOLUME_LAYOUT))
+ _COMMAND{ evas_object_hide(m->eoVolLayout); }
+ _CHECK(m->eoVolBar = elm_progressbar_add(m->eoVolLayout))
+
+ _WHEN_SUCCESS{}
+
+ _CHECK_FAIL{ evas_object_del(m->eoVolBar); }
+ _CHECK_FAIL{ evas_object_del(m->eoVolLayout); }
+ _CHECK_FAIL{ delete m; m = NULL; }
+ } _CREATE_END_AND_CATCH{ return false; }
+
+
+ evas_object_size_hint_weight_set(m->eoVolBar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_horizontal_set(m->eoVolBar, EINA_TRUE);
+ elm_object_part_content_set(m->eoVolLayout, MUSIC_PART_VOLUME_BAR, m->eoVolBar);
+ elm_object_style_set(m->eoVolBar, MUSIC_STYLE_VOLUME_BAR);
+ evas_object_show(m->eoVolBar);
+
+ m->eoBase = eoBase;
+ m->flagVolumeMode = false;
+
+ return true;
+}
+
+
+void CHandleVolume::Destroy(void)
+{
+ ASSERT(m);
+ RemoveTimer();
+
+ evas_object_del(m->eoVolLayout);
+
+ delete m;
+ m = NULL;
+}
+
+
+void CHandleVolume::Up(void)
+{
+ ASSERT(m);
+
+ m_HandleVolumeKey(SOUND_UP);
+}
+
+
+void CHandleVolume::Down(void)
+{
+ ASSERT(m);
+
+ m_HandleVolumeKey(SOUND_DOWN);
+}
+
+
+void CHandleVolume::Mute(void)
+{
+ ASSERT(m);
+
+ m_HandleVolumeKey(SOUND_MUTE);
+}
+
+
+void CHandleVolume::RemoveTimer(void)
+{
+ ASSERT(m);
+
+ if (m->etVol) {
+ ecore_timer_del(m->etVol);
+ m->etVol = NULL;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __HANDLE_VOLUME_H__
+#define __HANDLE_VOLUME_H__
+
+
+class CHandleVolume {
+private:
+ struct SHandleVolume *m;
+
+private:
+ static Eina_Bool sm_CbVolumeTimer(void *dt);
+ void m_HandleVolumeKey(int mode);
+ void m_HandleVolume(int mode);
+ void m_UpdateVolumeBar(void);
+
+public:
+ CHandleVolume() : m(0) {}
+ virtual ~CHandleVolume() {}
+
+ bool Create(Evas_Object *eoBase);
+ virtual void Destroy(void);
+
+ void Up(void);
+ void Down(void);
+ void Mute(void);
+
+ void RemoveTimer(void);
+};
+
+
+#endif /* __HANDLE_VOLUME_H__ */
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "InputHandler.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+#include "album_info.h"
+#include "song_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "BaseLayout.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "album-layout.h"
+#include "album-songs-layout.h"
+#include "base-view.h"
+
+#define GENGRID_ITEM_SIZE_W (263+20)
+#define GENGRID_ITEM_SIZE_H (359+20)
+
+
+enum EObjectType {
+ ALBUM_LAYOUT,
+ ALBUM_GENGRID,
+};
+
+struct SAlbumItemInfo {
+ album_info *alinfo;
+ Elm_Object_Item *item;
+};
+
+struct SCallback {
+ void(*cbHandleEmptyStatus)(void *cookie, bool emptyStatus);
+ void *cookie;
+};
+
+struct SAlbumLayout {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *grid;
+ Elm_Object_Item *focused_item;
+ Eina_List *alblist;
+ Eina_List *it_infolist;
+ Elm_Gengrid_Item_Class *item_class;
+ CMusicController *mhandle;
+ CLayoutMgr *lmgr;
+ CViewMgr *vmgr;
+ SContentInfo *ctxtinfo;
+ char *album_id;
+ CAlbumSongsLayout *layoutAlbumSongs;
+ SCallback callback;
+ CAlbumLayout* parent;
+
+ SAlbumLayout() {
+ memset(this, 0, sizeof(SAlbumLayout));
+ }
+
+ ~SAlbumLayout() {
+ }
+};
+
+
+char *CAlbumLayout::sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SAlbumItemInfo *itinfo = (SAlbumItemInfo *)data;
+ album_info *alinfo = NULL;
+ char *txt = NULL;
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ alinfo = itinfo->alinfo;
+ txt = NULL;
+
+ if (!strcmp(part, "elm.text"))
+ txt = album_info_get_name(alinfo);
+ else if (!strcmp(part, "elm.text1"))
+ txt = album_info_get_artist(alinfo);
+
+ if (txt)
+ return strdup(txt);
+
+ return NULL;
+}
+
+
+Evas_Object *CAlbumLayout::sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part)
+{
+ SAlbumItemInfo *itinfo = (SAlbumItemInfo *)data;
+ album_info *alinfo = NULL;
+ char *path = NULL;
+ Evas_Object *img = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ alinfo = itinfo->alinfo;
+
+ if (!strcmp(part, "elm.swallow.icon")) {
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ path = album_info_get_thumb(alinfo);
+ if (!path) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(img, buf, "NULL");
+ elm_image_no_scale_set(img, EINA_TRUE);
+ }
+ else {
+ elm_image_file_set(img, path, "NULL");
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+ }
+ return img;
+ }
+
+ return NULL;
+}
+
+
+void CAlbumLayout::sm_CbRemoveGridItem(void *data, Evas_Object *obj)
+{
+ free(data);
+}
+
+
+void CAlbumLayout::sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+{
+ CAlbumLayout *root = (CAlbumLayout*)dt;
+
+ if (root)
+ root->m_OnCtxtUpdate(type, lid);
+}
+
+
+void CAlbumLayout::m_OnCtxtUpdate(EActionType type, int lid)
+{
+ Eina_List *list = NULL;
+ SSongInfo *sinfo = NULL;
+ EAddType mode;
+
+ if (!m->ctxtinfo || !m->ctxtinfo->context)
+ return;
+
+ if (type == ACTION_TYPE_ADDNEXT)
+ mode = ADD_TYPE_NEXT;
+ else
+ mode = ADD_TYPE_END;
+
+ 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
+ _create_message_box(m->base, MUSIC_TEXT_ADDTO_MSG);
+
+ return;
+ }
+
+ m->mhandle->UpdatePlaylist(list, mode);
+ sinfo = (SSongInfo *)eina_list_data_get(list);
+ eina_list_free(list);
+
+ if (type == ACTION_TYPE_PLAY) {
+ m->mhandle->Stop();
+ m->mhandle->SetCurrentSong(sinfo->media_id);
+ }
+
+ _update_playback_view((EAddType)type, m->parent->Layout(), m->focused_item);
+}
+
+
+void CAlbumLayout::sm_CbCtxtClose(void *dt)
+{
+ CAlbumLayout *root = (CAlbumLayout*)dt;
+
+ if (root)
+ root->m_OnCtxtClose();
+}
+
+
+void CAlbumLayout::m_OnCtxtClose(void)
+{
+ m->vmgr->PopView();
+ m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
+ elm_object_item_focus_set(m->focused_item, EINA_TRUE);
+}
+
+
+void CAlbumLayout::sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source) {
+ CAlbumLayout *root = (CAlbumLayout*)data;
+
+ if (root)
+ root->m_OnItemSelect(it, emission, source);
+}
+
+
+void CAlbumLayout::m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source) {
+ SAlbumItemInfo *itinfo;
+
+ itinfo = m_FindItemInfo(m->it_infolist, it);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ m->mhandle->SetCurrentAlbum(itinfo->alinfo);
+
+ m_ShowAlbumSongs();
+}
+
+
+SAlbumItemInfo *CAlbumLayout::m_FindItemInfo(Eina_List *list, Elm_Object_Item *item)
+{
+ Eina_List *l = NULL;
+ SAlbumItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ if (!list || !item)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SAlbumItemInfo *)obj;
+ if (itinfo->item == item)
+ return itinfo;
+ }
+
+ return NULL;
+}
+
+
+SAlbumItemInfo *CAlbumLayout::m_FindItemInfoById(Eina_List *list, int alid)
+{
+ Eina_List *l = NULL;
+ SAlbumItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ int id;
+
+ if (!list)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SAlbumItemInfo *)obj;
+ if (!itinfo->alinfo)
+ continue;
+ id = album_info_get_album_id(itinfo->alinfo);
+ if (alid == id) {
+ return itinfo;
+ }
+ }
+
+ return NULL;
+}
+
+
+void CAlbumLayout::m_ShowAlbumSongs(void)
+{
+ elm_object_part_content_unset(m->base, MUSIC_PART_CONTENT);
+
+ bool emptyStatus = m->layoutAlbumSongs->EmptyStatus();
+
+ if (emptyStatus == false) {
+ elm_object_part_content_set(m->base, MUSIC_PART_CONTENT, m->layoutAlbumSongs->Layout());
+ m->lmgr->Show(MUSIC_ALBUM_SONGS_LAYOUT);
+ }
+
+ if (m->callback.cbHandleEmptyStatus != NULL) {
+ m->callback.cbHandleEmptyStatus(m->callback.cookie, emptyStatus);
+ }
+}
+
+
+void CAlbumLayout::m_RemoveAlbumList(Eina_List *list)
+{
+ eina_list_free(list);
+}
+
+
+void CAlbumLayout::m_CreateAlbumGrid(void)
+{
+ Evas_Object *grid;
+ Elm_Gengrid_Item_Class *grid_item;
+
+ grid = elm_gengrid_add(Layout());
+ if (!grid)
+ return;
+
+ evas_object_size_hint_weight_set(grid,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_gengrid_align_set(grid, 0, 0);
+ elm_object_part_content_set(Layout(), MUSIC_PART_ALBUM_GRID, grid);
+ Connect(grid, ALBUM_GENGRID, TYPE_MOUSE_MOVE | TYPE_KEY_DOWN | TYPE_REALIZED | TYPE_UNREALIZED);
+ elm_gengrid_item_size_set(grid,
+ elm_config_scale_get() * GENGRID_ITEM_SIZE_W,
+ elm_config_scale_get() * GENGRID_ITEM_SIZE_H);
+
+ m->grid = grid;
+
+ grid_item = elm_gengrid_item_class_new();
+ if (!grid_item) {
+ evas_object_del(grid);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+
+ grid_item->item_style = MUSIC_STYLE_ALBUM_GRID;
+ grid_item->func.text_get = sm_CbGetGridItemText;
+ grid_item->func.content_get = sm_CbGetGridItemContent;
+ grid_item->func.state_get = NULL;
+ grid_item->func.del = sm_CbRemoveGridItem;
+ m->item_class = grid_item;
+
+ m_UpdateAlbumGrid(false);
+}
+
+
+void CAlbumLayout::m_EmptyAlbumGrid(bool sort_flag)
+{
+ if (m->grid)
+ elm_gengrid_clear(m->grid);
+
+ if (!sort_flag) {
+ m_RemoveAlbumList(m->alblist);
+ m->alblist = NULL;
+ }
+
+ eina_list_free(m->it_infolist);
+ m->it_infolist = NULL;
+}
+
+
+void CAlbumLayout::m_SortAlbumGrid(void)
+{
+ int(*_sort_fn[])(const void *d1, const void *d2) = {
+ sortalbums_az,
+ sortalbums_za
+ };
+ int sort_type;
+
+ sort_type = m->mhandle->SortType();
+
+ m->alblist = eina_list_sort(m->alblist, 0, _sort_fn[sort_type]);
+}
+
+
+void CAlbumLayout::m_UpdateAlbumGrid(bool sort_flag)
+{
+ bool r;
+ album_info *alinfo;
+ void *obj;
+ Eina_List *l;
+ SAlbumItemInfo *itinfo;
+ Elm_Object_Item *item;
+
+ /* Remove existing albumgrid and prepare afresh */
+ m_EmptyAlbumGrid(sort_flag);
+
+ if (!sort_flag) {
+ r = m->mhandle->MediaGetList(LIST_TYPE_ALBUM, NULL, &(m->alblist));
+ if (r == false ||
+ eina_list_count(m->alblist) == 0) {
+ _ERR(" Fetching album list from media failed ");
+ m->parent->SetEmptyStatus(true);
+ return;
+ }
+ }
+
+ m_SortAlbumGrid();
+
+ EINA_LIST_FOREACH(m->alblist, l, obj) {
+ alinfo = (album_info *)obj;
+ itinfo = (SAlbumItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+
+ itinfo->alinfo = alinfo;
+ item = elm_gengrid_item_append(m->grid, m->item_class, itinfo, NULL, NULL);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist, itinfo);
+ }
+}
+
+
+bool CAlbumLayout::Create(CLayoutMgr *mgr, const char *albumId)
+{
+ ASSERT(!m);
+
+ Evas_Object *base = NULL;
+ Evas_Object *win = NULL;
+ Evas_Object *layout = NULL;
+ CMusicController *mhandle = NULL;
+ CViewMgr *vmgr = NULL;
+
+ m = new SAlbumLayout;
+ if (!m) {
+ _ERR(" albumlayout data allocation failed ");
+ return false;
+ }
+
+ vmgr = CViewMgr::GetInstance();
+ if (!vmgr) {
+ _ERR(" get viewmgr failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ base = mgr->Base();
+ if (!base) {
+ _ERR(" get base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ win = vmgr->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ mhandle = CMusicController::GetInstance();
+ if (!mhandle) {
+ _ERR(" music controller get music instance failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ layout = _add_base(base, MUSIC_ALBUM_LAYOUT);
+ if (!layout) {
+ _ERR(" get layout failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ bool r = CExtBaseLayout::Create(layout);
+ if (!r) {
+ _ERR(" CBaseLayout creation failed ");
+ evas_object_del(layout);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ if (albumId) {
+ m->album_id = new char[strlen(albumId) + 1];
+ strcpy(m->album_id, albumId);
+ }
+ else {
+ m->album_id = NULL;
+ }
+
+ m->win = win;
+ m->base = base;
+ m->vmgr = vmgr;
+ m->mhandle = mhandle;
+ m->lmgr = mgr;
+ m->callback.cbHandleEmptyStatus = NULL;
+ m->callback.cookie = NULL;
+ m->parent = this;
+
+ m->layoutAlbumSongs = new CAlbumSongsLayout(MUSIC_ALBUM_SONGS_LAYOUT);
+ m->layoutAlbumSongs->Create(m->lmgr);
+ m->lmgr->AddLayout(m->layoutAlbumSongs);
+
+ m_CreateAlbumGrid();
+
+ Connect(layout, ALBUM_LAYOUT, TYPE_KEY_DOWN);
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_ALBUM_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+
+ return true;
+}
+
+void CAlbumLayout::Destroy(void)
+{
+ ASSERT(m);
+
+ m->lmgr->RemoveLayout(m->layoutAlbumSongs);
+ m->layoutAlbumSongs->Destroy();
+ delete m->layoutAlbumSongs;
+
+ m_EmptyAlbumGrid(false);
+ CExtBaseLayout::Destroy();
+ evas_object_del(Layout());
+
+ free(m->ctxtinfo);
+ delete[] m->album_id;
+ delete m;
+ m = NULL;
+}
+
+
+void CAlbumLayout::t_OnShow(void)
+{
+ ASSERT(m);
+
+ SAlbumItemInfo *itinfo = NULL;
+
+ m_UpdateAlbumGrid(false);
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_ALBUM_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+
+ evas_object_show(Layout());
+
+ if (m->album_id) {
+ itinfo = m_FindItemInfoById(m->it_infolist,
+ atoi(m->album_id));
+ if (itinfo) {
+ m->mhandle->SetCurrentAlbum(itinfo->alinfo);
+ m_ShowAlbumSongs();
+ return;
+ }
+ delete[] m->album_id;
+ m->album_id = NULL;
+ }
+}
+
+
+void CAlbumLayout::Update(bool focusFlag)
+{
+ ASSERT(m);
+
+ album_info *alinfo = NULL;
+ SAlbumItemInfo *itinfo = NULL;
+ int id;
+
+ if (!focusFlag) {
+ m_UpdateAlbumGrid(true);
+ return;
+ }
+
+ alinfo = m->mhandle->CurrentAlbum();
+ if (alinfo) {
+ id = album_info_get_album_id(alinfo);
+ itinfo = m_FindItemInfoById(m->it_infolist, id);
+ if (itinfo) {
+ m->mhandle->SetCurrentAlbum(NULL);
+ elm_gengrid_item_show(itinfo->item,
+ ELM_GENGRID_ITEM_SCROLLTO_IN);
+ elm_object_item_focus_set(itinfo->item, EINA_TRUE);
+ return;
+ }
+ }
+
+ elm_object_focus_set(m->grid, EINA_TRUE);
+}
+
+
+void CAlbumLayout::SetEmptyStatusHandleCallback(void(*handleEmptyStatusCb)(void *cookie, bool emptyStatus), void *cookie)
+{
+ ASSERT(m);
+
+ m->callback.cbHandleEmptyStatus = handleEmptyStatusCb;
+ m->callback.cookie = cookie;
+}
+
+
+void CAlbumLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ switch (id) {
+ case ALBUM_LAYOUT:
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_FOCUS_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+ break;
+
+ case ALBUM_GENGRID:
+ {
+ Elm_Object_Item *it = NULL;
+ SContentInfo *ctxtinfo = NULL;
+ SAlbumItemInfo *itinfo = NULL;
+
+ 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 (m->ctxtinfo) {
+ free(m->ctxtinfo);
+ m->ctxtinfo = NULL;
+ }
+
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!ctxtinfo)
+ return;
+
+ itinfo = m_FindItemInfo(m->it_infolist, it);
+ if (!itinfo) {
+ free(ctxtinfo);
+ return;
+ }
+
+ ctxtinfo->type = CONTEXT_TYPE_ALBUM;
+ ctxtinfo->context = itinfo->alinfo;
+ ctxtinfo->cbdata = this;
+ ctxtinfo->update = sm_CbCtxtUpdate;
+ ctxtinfo->close = sm_CbCtxtClose;
+
+ m->ctxtinfo = ctxtinfo;
+
+ SParcel parcel;
+ parcel.ctxtInfo = ctxtinfo;
+ if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+ _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
+ }
+ break;
+
+ default:
+ _ERR("Invalid Object");
+ ASSERT(0);
+ break;
+ }
+}
+
+
+void CAlbumLayout::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+{
+ Elm_Object_Item *item;
+
+ item = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
+ if (!item)
+ return;
+
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+}
+
+
+void CAlbumLayout::OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ elm_object_item_signal_callback_add(item,
+ MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+ sm_CbItemSelect, this);
+}
+
+
+void CAlbumLayout::OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ elm_object_item_signal_callback_del(item,
+ MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+ sm_CbItemSelect);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+#include "song_info.h"
+#include "album_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "InputHandler.h"
+#include "album-songs-layout.h"
+#include "base-view.h"
+
+#define TOTAL_ADD_BTNS 3
+
+
+enum EBtnType {
+ ABTN_PLAY,
+ ABTN_NEXT,
+ ABTN_LAST
+};
+
+struct SAlbumSongsItemInfo {
+ SSongInfo *sinfo;
+ Elm_Object_Item *item;
+};
+
+struct SAlbumSongsLayout {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *songlist;
+ Elm_Object_Item *focused_item;
+
+ CMusicController* mhandle;
+ CLayoutMgr *mgr;
+ CViewMgr *vmgr;
+ SContentInfo *ctxtinfo;
+ Eina_List *slist;
+ Eina_List *it_infolist;
+ Elm_Genlist_Item_Class *item_class;
+ int total_duration;
+ CAlbumSongsLayout *parent;
+
+ class CHandlerButton : public CListenerMgr, public IMouseMoveListener, public IMouseClickedListener {
+ public:
+ struct SCallback {
+ void(*gotoPlayBackView)(void* cookie, int mode, char *mediaId);
+ void* cookie;
+ };
+
+ private:
+ SAlbumSongsLayout *m;
+
+ protected:
+ SCallback m_callback;
+
+ public:
+ CHandlerButton(SAlbumSongsLayout *ins) :
+ IMouseMoveListener(this),
+ IMouseClickedListener(this) {
+ m = ins;
+ }
+
+ void SetCallback(const SCallback* cb) {
+ m_callback = *cb;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+ {
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+ }
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj) {
+ EBtnType type = (EBtnType)id;
+
+ switch (type)
+ {
+ case ABTN_PLAY:
+ if (m_callback.gotoPlayBackView)
+ m_callback.gotoPlayBackView(m_callback.cookie, ADD_TYPE_FRESH, NULL);
+ break;
+
+ case ABTN_NEXT:
+ if (m_callback.gotoPlayBackView)
+ m_callback.gotoPlayBackView(m_callback.cookie, ADD_TYPE_NEXT, NULL);
+ break;
+
+ case ABTN_LAST:
+ if (m_callback.gotoPlayBackView)
+ m_callback.gotoPlayBackView(m_callback.cookie, ADD_TYPE_END, NULL);
+ break;
+
+ default:
+ _ERR("Invalid Button Type");
+ ASSERT(0);
+ break;
+ }
+ }
+ } *pHandlerButton;
+
+ class CHandlerGenlist : public CListenerMgr, public IMouseMoveListener, public IKeyDownListener {
+ public:
+ struct SCallback {
+ void(*gotoPlaybackView)(void* cookie, int mode, char *mediaId);
+ void* cookie;
+ };
+
+ private:
+ SAlbumSongsLayout *m;
+ SCallback m_callback;
+
+ private:
+ SAlbumSongsItemInfo *m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item)
+ {
+ Eina_List *l = NULL;
+ SAlbumSongsItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SAlbumSongsItemInfo *)obj;
+ if (itinfo->item == item)
+ return itinfo;
+ }
+
+ return NULL;
+ }
+
+ static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+ {
+ CHandlerGenlist *root = (CHandlerGenlist*)dt;
+
+ if (root)
+ root->m_OnCtxtUpdate(type, lid);
+ }
+
+ void m_OnCtxtUpdate(EActionType type, int lid)
+ {
+ Eina_List *list = NULL;
+ EAddType mode;
+
+ if (!m->ctxtinfo || !m->ctxtinfo->context)
+ return;
+
+ if (type == ACTION_TYPE_ADDNEXT)
+ mode = ADD_TYPE_NEXT;
+ else
+ mode = ADD_TYPE_END;
+
+ 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
+ _create_message_box(m->base, MUSIC_TEXT_ADDTO_MSG);
+
+ return;
+ }
+
+ m->mhandle->UpdatePlaylist(list, mode);
+ eina_list_free(list);
+
+ if (type == ACTION_TYPE_PLAY) {
+ m->mhandle->Stop();
+ m->mhandle->SetCurrentSong(song_info_get_media_id((SSongInfo *)m->ctxtinfo->context));
+ }
+
+ _update_playback_view((EAddType)type, m->parent->Layout(), m->focused_item);
+ }
+
+ static void sm_CbCtxtClose(void *dt)
+ {
+ CHandlerGenlist *root = (CHandlerGenlist*)dt;
+
+ if (root)
+ root->m_OnCtxtClose();
+ }
+
+ void m_OnCtxtClose(void)
+ {
+ m->vmgr->PopView();
+ m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
+ elm_object_item_focus_set(m->focused_item, EINA_TRUE);
+ }
+
+ static void sm_CbItemSelect(void *data, Evas_Object *obj, void *event_info)
+ {
+ CHandlerGenlist *root = (CHandlerGenlist*)data;
+
+ if (root)
+ root->m_OnItemSelect(obj, event_info);
+ }
+
+ void m_OnItemSelect(Evas_Object *obj, void *event_info)
+ {
+ SAlbumSongsItemInfo *itinfo = NULL;
+ char *mediaId = NULL;
+
+ itinfo = m_FindItemInfoFromItem(m->it_infolist, (Elm_Object_Item *)event_info);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ mediaId = song_info_get_media_id(itinfo->sinfo);
+
+ if (m_callback.gotoPlaybackView) {
+ m_callback.gotoPlaybackView(m_callback.cookie, ADD_TYPE_FRESH, mediaId);
+ }
+ }
+
+ public:
+ CHandlerGenlist(SAlbumSongsLayout *ins) :
+ IMouseMoveListener(this),
+ IKeyDownListener(this) {
+ m = ins;
+ }
+
+ virtual ~CHandlerGenlist() {
+ EmptySongList();
+ }
+
+ void SetCallback(const SCallback* cb) {
+ m_callback = *cb;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) {
+ Elm_Object_Item *item;
+
+ item = elm_genlist_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL);
+
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+ }
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) {
+ Elm_Object_Item *it = NULL;
+ SContentInfo *ctxtinfo = NULL;
+ SAlbumSongsItemInfo *itinfo = NULL;
+
+ 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 (m->ctxtinfo) {
+ free(m->ctxtinfo);
+ m->ctxtinfo = NULL;
+ }
+
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!ctxtinfo)
+ return;
+
+ itinfo = m_FindItemInfoFromItem(m->it_infolist, it);
+ if (!itinfo) {
+ free(ctxtinfo);
+ return;
+ }
+
+ ctxtinfo->type = CONTEXT_TYPE_SONG;
+ ctxtinfo->context = itinfo->sinfo;
+ ctxtinfo->cbdata = this;
+ ctxtinfo->update = sm_CbCtxtUpdate;
+ ctxtinfo->close = sm_CbCtxtClose;
+
+ m->ctxtinfo = ctxtinfo;
+
+ SParcel parcel;
+ parcel.ctxtInfo = ctxtinfo;
+ if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+ _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
+ }
+
+ void UpdateSongList(void)
+ {
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+ SAlbumSongsItemInfo *itinfo = NULL;
+ Elm_Object_Item *item = NULL;
+ int dur = 0;
+ album_info *alinfo = NULL;
+
+ if (!m->songlist || !m->item_class)
+ return;
+
+ /* Remove existing songlist and prepare afresh */
+ EmptySongList();
+
+ alinfo = m->mhandle->CurrentAlbum();
+ if (!m->mhandle->MediaGetList(LIST_TYPE_ALBUM_SONG, alinfo, &(m->slist))) {
+ _ERR(" Fetching song list from media failed ");
+ return;
+ }
+
+ EINA_LIST_FOREACH(m->slist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ itinfo = (SAlbumSongsItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+
+ itinfo->sinfo = sinfo;
+ item = elm_genlist_item_append(m->songlist, m->item_class,
+ itinfo, NULL, ELM_GENLIST_ITEM_NONE, sm_CbItemSelect, this);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist, itinfo);
+ song_info_get_duration(sinfo, &dur);
+ m->total_duration = m->total_duration + dur;
+ }
+ }
+
+ void EmptySongList(void)
+ {
+ if (m->songlist)
+ elm_genlist_clear(m->songlist);
+
+ if (m->slist) {
+ eina_list_free(m->slist);
+ m->slist = NULL;
+ }
+
+ if (m->it_infolist) {
+ eina_list_free(m->it_infolist);
+ m->it_infolist = NULL;
+ }
+
+ m->total_duration = 0;
+ }
+ } *pHandlerGenlist;
+
+ SAlbumSongsLayout() {
+ memset(this, 0, sizeof(SAlbumSongsLayout));
+ pHandlerGenlist = new CHandlerGenlist(this);
+ pHandlerButton = new CHandlerButton(this);
+ }
+
+ ~SAlbumSongsLayout() {
+ delete pHandlerGenlist;
+ delete pHandlerButton;
+ }
+};
+
+
+struct SBtnInfo {
+ const char *name;
+ const char *part;
+ const char *style;
+ const char *icon;
+};
+
+
+char *CAlbumSongsLayout::sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SAlbumSongsItemInfo *itinfo = (SAlbumSongsItemInfo *)data;
+ SSongInfo *sinfo = NULL;
+ char buf[MAX_LENGTH];
+ char *timestr = NULL;
+ int duration;
+ int index;
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ sinfo = itinfo->sinfo;
+
+ snprintf(buf, sizeof(buf), "%s", MUSIC_STR_EMPTY);
+
+ if (!strcmp(part, "elm.text")) {
+ index = elm_genlist_item_index_get(itinfo->item);
+ if ((index & 1) == 1) {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_EVEN_ROW, MUSIC_BASE_VIEW);
+ }
+ else {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_ODD_ROW, MUSIC_BASE_VIEW);
+ }
+ snprintf(buf, sizeof(buf), "%d", index + 1);
+ }
+ else if (!strcmp(part, "elm.text1"))
+ snprintf(buf, sizeof(buf), "%s", song_info_get_title(sinfo));
+ else if (!strcmp(part, "elm.text2"))
+ snprintf(buf, sizeof(buf), "%s", song_info_get_artist(sinfo));
+ 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);
+ }
+ }
+ }
+
+ if (strcmp(buf, MUSIC_STR_EMPTY))
+ return strdup(buf);
+
+ return NULL;
+}
+
+
+void CAlbumSongsLayout::sm_CbRemoveListItem(void *data, Evas_Object *obj)
+{
+ free(data);
+}
+
+
+void CAlbumSongsLayout::sm_CbGoToPlaybackView(void *cookie, int mode, char *mediaId)
+{
+ CAlbumSongsLayout *root = (CAlbumSongsLayout *)cookie;
+ if (root)
+ root->m_GotoPlayback(mode, mediaId);
+}
+
+
+int CAlbumSongsLayout::m_ConvertToMin(int milsec)
+{
+ int min;
+ min = milsec / 60000; /*milli seconds per minute*/
+
+ return min;
+}
+
+
+void CAlbumSongsLayout::m_GotoPlayback(int mode, char *id)
+{
+ Eina_List *list = NULL;
+ Eina_List *l = NULL;
+ SAlbumSongsItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ if (!m->it_infolist || eina_list_count(m->it_infolist) == 0) {
+ _ERR(" No songs for playback ");
+ return;
+ }
+
+ EINA_LIST_FOREACH(m->it_infolist, l, obj) {
+ itinfo = (SAlbumSongsItemInfo *)obj;
+ list = eina_list_append(list, itinfo->sinfo);
+ }
+
+ m->mhandle->UpdatePlaylist(list, mode);
+ eina_list_free(list);
+
+ if (mode == ADD_TYPE_FRESH) {
+ m->mhandle->Stop();
+ if (id) /* If want to play selected song */
+ m->mhandle->SetCurrentSong(id);
+ }
+
+ _update_playback_view((EAddType)mode, Layout(), NULL);
+}
+
+
+Evas_Object *CAlbumSongsLayout::m_AddAlbumCover(void)
+{
+ Evas_Object *album_cover = NULL;
+
+ album_cover = elm_image_add(Layout());
+ if (!album_cover)
+ return NULL;
+
+ evas_object_size_hint_weight_set(album_cover, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ return album_cover;
+}
+
+
+void CAlbumSongsLayout::m_CreateTopSection(void)
+{
+ Evas_Object *thumb = NULL;
+ int i;
+ Evas_Object *btn[TOTAL_ADD_BTNS];
+ Evas_Object *img = NULL;
+ char *path = NULL;
+ char buf[MAX_LENGTH];
+ album_info *alinfo = NULL;
+ SBtnInfo btninfo[TOTAL_ADD_BTNS];
+ Evas_Object *layout = Layout();
+
+ btninfo[ABTN_PLAY].name = MUSIC_STR_PLAY;
+ btninfo[ABTN_PLAY].part = MUSIC_PART_ALBUM_PLAYBTN;
+ btninfo[ABTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
+ btninfo[ABTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
+
+ btninfo[ABTN_NEXT].name = MUSIC_STR_ADDNEXT;
+ btninfo[ABTN_NEXT].part = MUSIC_PART_ALBUM_NEXTBTN;
+ btninfo[ABTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
+ btninfo[ABTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
+
+ btninfo[ABTN_LAST].name = MUSIC_STR_ADDLAST;
+ btninfo[ABTN_LAST].part = MUSIC_PART_ALBUM_LASTBTN;
+ btninfo[ABTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
+ btninfo[ABTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
+
+ thumb = m_AddAlbumCover();
+ if (!thumb)
+ return;
+
+ for (i = 0; i < TOTAL_ADD_BTNS; i++) {
+ btn[i] = elm_button_add(layout);
+ if (!btn[i])
+ continue;
+
+ evas_object_size_hint_weight_set(btn[i],
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(btn[i], _(btninfo[i].name));
+ elm_object_style_set(btn[i], btninfo[i].style);
+
+ m->pHandlerButton->Connect(btn[i], i);
+
+ img = elm_image_add(btn[i]);
+ if (img) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ btninfo[i].icon);
+ elm_image_file_set(img, buf, NULL);
+ elm_object_part_content_set(btn[i],
+ MUSIC_PART_ELM_SWALLOWICON, img);
+ }
+
+ elm_object_part_content_set(layout, btninfo[i].part,
+ btn[i]);
+ }
+
+ elm_object_focus_set(btn[0], EINA_TRUE);
+ alinfo = m->mhandle->CurrentAlbum();
+ if (!alinfo)
+ return;
+
+ path = album_info_get_thumb(alinfo);
+ if (path) {
+ elm_image_file_set(thumb, path, NULL);
+ elm_image_aspect_fixed_set(thumb, EINA_FALSE);
+ }
+ else {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(thumb, buf, NULL);
+ elm_image_no_scale_set(thumb, EINA_TRUE);
+ }
+
+ elm_object_part_content_set(layout, MUSIC_PART_ALBUM_THUMB,
+ thumb);
+ elm_object_part_text_set(layout, MUSIC_PART_ALBUM_NAME,
+ album_info_get_name(alinfo));
+ elm_object_part_text_set(layout, MUSIC_PART_ALBUM_ARTIST,
+ album_info_get_artist(alinfo));
+
+ snprintf(buf, sizeof(buf), "%d", eina_list_count(m->slist));
+ elm_object_part_text_set(layout, MUSIC_PART_ALBUM_SONGCOUNT, buf);
+ snprintf(buf, sizeof(buf), "%d %s", m_ConvertToMin(m->total_duration), _(MUSIC_TEXT_MIN));
+
+ elm_object_part_text_set(layout, MUSIC_PART_ALBUM_TIME, buf);
+}
+
+
+void CAlbumSongsLayout::m_CreateSongList(void)
+{
+ Evas_Object *genlist = NULL;
+ Elm_Genlist_Item_Class *list_item = NULL;
+ Evas_Object *layout = Layout();
+
+ genlist = elm_genlist_add(layout);
+ if (!genlist)
+ return;
+
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+ evas_object_size_hint_weight_set(genlist,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(layout, MUSIC_PART_SONGLIST, genlist);
+ m->pHandlerGenlist->Connect(genlist);
+ m->songlist = genlist;
+
+ list_item = elm_genlist_item_class_new();
+ if (!list_item) {
+ evas_object_del(genlist);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ list_item->item_style = MUSIC_STYLE_ALBUM_SONGLIST;
+ list_item->func.text_get = sm_CbGetListItemText;
+ list_item->func.content_get = NULL;
+ list_item->func.state_get = NULL;
+ list_item->func.del = sm_CbRemoveListItem;
+ m->item_class = list_item;
+
+ m->pHandlerGenlist->UpdateSongList();
+}
+
+
+bool CAlbumSongsLayout::Create(CLayoutMgr *mgr)
+{
+ ASSERT(!m);
+
+ Evas_Object *base = NULL;
+ Evas_Object *win = NULL;
+ Evas_Object *layout = NULL;
+ CMusicController *mhandle;
+ CViewMgr *vmgr;
+
+ if (!mgr)
+ return false;
+
+ m = new SAlbumSongsLayout;
+ if (!m) {
+ _ERR(" calloc failed ");
+ return false;
+ }
+
+ vmgr = CViewMgr::GetInstance();
+ if (!vmgr) {
+ _ERR(" get view mgr failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ base = mgr->Base();
+ if (!base) {
+ _ERR(" get base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ win = vmgr->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ mhandle = CMusicController::GetInstance();
+ if (!mhandle) {
+ _ERR(" music controller get music instance failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ layout = _add_base(base, MUSIC_ALBUM_SONGS_LAYOUT);
+ if (!layout) {
+ _ERR(" get layout failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ bool r = CExtBaseLayout::Create(layout);
+ if (!r) {
+ _ERR(" CBaseLayout creation failed ");
+ evas_object_del(layout);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ m->win = win;
+ m->base = base;
+ m->vmgr = vmgr;
+ m->mhandle = mhandle;
+ m->mgr = mgr;
+ m->parent = this;
+
+ Connect(layout);
+
+ SAlbumSongsLayout::CHandlerGenlist::SCallback listCb;
+ listCb.gotoPlaybackView = &sm_CbGoToPlaybackView;
+ listCb.cookie = this;
+ m->pHandlerGenlist->SetCallback(&listCb);
+
+ SAlbumSongsLayout::CHandlerButton::SCallback btnCb;
+ btnCb.gotoPlayBackView = &sm_CbGoToPlaybackView;
+ btnCb.cookie = this;
+ m->pHandlerButton->SetCallback(&btnCb);
+
+ return true;
+}
+
+void CAlbumSongsLayout::Destroy(void)
+{
+ ASSERT(m);
+
+ m->pHandlerGenlist->EmptySongList();
+ CExtBaseLayout::Destroy();
+ evas_object_del(Layout());
+
+ free(m->ctxtinfo);
+ delete m;
+ m = NULL;
+}
+
+
+void CAlbumSongsLayout::t_OnShow(void)
+{
+ ASSERT(m);
+
+ m->pHandlerGenlist->EmptySongList();
+
+ m_CreateSongList();
+ m_CreateTopSection();
+
+ CBaseLayout::t_OnShow();
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_ALBUM_SONGS_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+}
+
+
+void CAlbumSongsLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_DEPTH_UPDATE;
+ parcel.layoutId = MUSIC_ALBUM_SONGS_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+
+#include <InputHandler.h>
+#include "category_info.h"
+#include "album_info.h"
+#include "song_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "entry-popup.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "category-layout.h"
+#include "base-view.h"
+#include "artist-layout.h"
+
+
+struct SArtistLayout {
+};
+
+
+void CArtistLayout::t_HandleItemSelect(SCatItemInfo *itinfo)
+{
+ int count;
+ album_info *alinfo = NULL;
+ Eina_List *alist = NULL;
+
+ if (!itinfo)
+ return;
+
+ t.c_catinfo = category_info_duplicate(itinfo->catinfo);
+ count = 0;
+
+ alist = category_info_get_albumlist(t.c_catinfo);
+ if (alist)
+ count = eina_list_count(alist);
+
+ if (count <= 0)
+ return;
+
+ t.depth = E_DEPTH_ALBUM;
+ if (count == 1) {
+ t.depth = E_DEPTH_SONG;
+ if (t.c_alinfo) {
+ album_info_destroy(t.c_alinfo);
+ t.c_alinfo = NULL;
+ }
+ alinfo = (album_info *)eina_list_nth(t.c_catinfo->albumlist, 0);
+ t.c_alinfo = album_info_duplicate(alinfo);
+ }
+}
+
+
+bool CArtistLayout::t_GetMediaList(Eina_List **list)
+{
+ return CMusicController::GetInstance()->MediaGetList(LIST_TYPE_ARTIST, NULL, list);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "i18n.h"
+#include "define.h"
+#include "dbg.h"
+
+#include "AppCommon.h"
+#include "song_info.h"
+#include "category_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "common.h"
+#include "InputHandler.h"
+#include "BaseView.h"
+#include "BaseLayout.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "base-view.h"
+#include "common-ui.h"
+#include "volume-control.h"
+#include "song-layout.h"
+#include "album-layout.h"
+#include "category-layout.h"
+#include "folder-layout.h"
+#include "album-songs-layout.h"
+#include "playback-view.h"
+#include "artist-layout.h"
+#include "genre-layout.h"
+#include "playlist-layout.h"
+#include "HandleVolume.h"
+
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
+#define PLAYSONG_FONT_SIZE 30
+#define TOTAL_GROUP_BTNS 6
+#define TOTAL_TOP_BTNS 3
+#define VOLUME_TIMER_INTERVAL 5 /* seconds */
+#define MAX_SHOW_TIME 10
+#define MUSIC_SLIDE_DURATION 15
+#define MUSIC_WRAP_WIDTH 400
+
+
+const char *g_sourceText[] = {
+ N_("All Source"), // SOURCE_TYPE_ALL
+ N_("TV"), // SOURCE_TYPE_TV
+ N_("USB") // SOURCE_TYPE_USB
+};
+
+const char *g_sortText[] = {
+ N_("Title A-Z"), // E_SORT_TITLE_A_Z
+ N_("Title Z-A"), // E_SORT_TITLE_Z_A
+ N_("Artist A-Z"), // E_SORT_ARTIST_A_Z
+ N_("Artist Z-A"), // E_SORT_ARTIST_Z_A
+ N_("Album A-Z"), // E_SORT_ALBUM_A_Z
+ N_("Album Z-A") // E_SORT_ALBUM_Z_A
+};
+
+const char *g_sortTextAlbum[] = {
+ N_("Album A-Z"),
+ N_("Album Z-A")
+};
+
+const char *g_sortTextArtist[] = {
+ N_("Artist A-Z"),
+ N_("Artist Z-A")
+};
+
+const char *g_sortTextGenre[] = {
+ N_("Genre A-Z"),
+ N_("Genre Z-A")
+};
+
+const char *g_sortTextFolder[] = {
+ N_("Title A-Z"),
+ N_("Title Z-A")
+};
+
+const char *g_sortTextPlaylists[] = {
+ N_("Playlist A-Z"),
+ N_("Playlist Z-A")
+};
+
+const char *g_sourceArg[] = {
+ "all", // SOURCE_TYPE_ALL
+ "tv", // SOURCE_TYPE_TV
+ "usb" // SOURCE_TYPE_USB
+};
+
+
+Evas_Object *s_AddButton(Evas_Object *box)
+{
+ Evas_Object *button;
+
+ if (!box)
+ return NULL;
+
+ button = elm_button_add(box);
+ if (!button)
+ return NULL;
+
+ evas_object_size_hint_weight_set(button,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(button);
+
+ return button;
+}
+
+
+struct SMusicBaseView {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *content;
+ Evas_Object *plbackbtn;
+ Evas_Object *plsonglbl;
+ Evas_Object *group_btn[TOTAL_GROUP_BTNS];
+ Evas_Object *srcbtn;
+ Evas_Object *sortbtn;
+ Evas_Object *ctxpopup;
+ Evas_Object *popup;
+ Elm_Transit *transit;
+ Evas_Object *c_grpbtn;
+ CMusicController *mhandle;
+ CLayoutMgr *lmgr;
+ struct _arg_list *arglist;
+ int btntype;
+ bool fresh_view;
+
+ CSongLayout *layoutSong;
+ CAlbumLayout *layoutAlbum;
+
+ CArtistLayout *layoutArtist;
+ CGenreLayout *layoutGenre;
+ CPlaylistLayout *layoutPlaylists;
+
+ CFolderLayout *layoutFolder;
+
+ CMusicBaseView *parent;
+ CHandleVolume *pHandleVolume;
+
+ class CHandlerBtn : public CListenerMgr, public IKeyDownListener, public IMouseMoveListener, public IMouseClickedListener {
+ public:
+ SMusicBaseView *m;
+ void(*m_cbClicked)(void* cookie, Evas_Object *obj);
+ void *m_cookie;
+
+ public:
+ CHandlerBtn(SMusicBaseView *ins) : IKeyDownListener(this), IMouseMoveListener(this), IMouseClickedListener(this) { m = ins; }
+
+ void SetCallback(void(*clicked)(void* cookie, Evas_Object *obj), void* cookie) {
+ m_cbClicked = clicked;
+ m_cookie = cookie;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) {
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+ }
+ };
+
+ class CHandlerBtnGroup : public CHandlerBtn {
+ public:
+ CHandlerBtnGroup(SMusicBaseView *ins) : CHandlerBtn(ins) {}
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) {
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ m->mhandle->Stop();
+ elm_exit();
+ }
+ }
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj) {
+ if (m->c_grpbtn == obj)
+ return;
+
+ elm_object_signal_emit(m->c_grpbtn,
+ MUSIC_SIGNAL_GROUP_UNSELECTED, MUSIC_BASE_VIEW);
+ m->c_grpbtn = obj;
+ elm_object_signal_emit(m->c_grpbtn,
+ MUSIC_SIGNAL_GROUP_SELECTED, MUSIC_BASE_VIEW);
+
+ if (obj == m->group_btn[GRP_FOLDER])
+ elm_object_text_set(m->sortbtn, _(g_sortTextFolder[0]));
+ else if (obj == m->group_btn[GRP_PLAYLISTS])
+ elm_object_text_set(m->sortbtn, _(g_sortTextPlaylists[0]));
+ else if (obj == m->group_btn[GRP_ALBUM])
+ elm_object_text_set(m->sortbtn, _(g_sortTextAlbum[0]));
+ else if (obj == m->group_btn[GRP_ARTIST])
+ elm_object_text_set(m->sortbtn, _(g_sortTextArtist[0]));
+ else if (obj == m->group_btn[GRP_GENRE])
+ elm_object_text_set(m->sortbtn, _(g_sortTextGenre[0]));
+ else
+ elm_object_text_set(m->sortbtn, _(g_sortText[0]));
+
+ m->mhandle->SetSortType(0);
+
+ if (m_cbClicked)
+ m_cbClicked(m_cookie, obj);
+ }
+ } *pHandlerBtnGroup[TOTAL_GROUP_BTNS];
+
+ class CHandlerBtnPlayback : public CHandlerBtn {
+ private:
+ void m_GotoPlayback(void)
+ {
+ if (!CViewMgr::GetInstance()->PushView(MUSIC_PLAYBACK_VIEW, NULL))
+ _ERR(" viewmgr push view MUSIC_PLAYBACK_VIEW failed ");
+ }
+
+ public:
+ CHandlerBtnPlayback(SMusicBaseView *ins) : CHandlerBtn(ins) {}
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) {
+ if (!strcmp(ev->keyname, KEY_BACK))
+ elm_object_focus_set(m->c_grpbtn, EINA_TRUE);
+ }
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj) {
+ Eina_List *list = NULL;
+ bool r;
+ int state;
+
+ state = m->mhandle->PlayState();
+
+ if (state != PLAY_STATUS_INITIAL) {
+ if (!CViewMgr::GetInstance()->PushView(MUSIC_PLAYBACK_VIEW, NULL))
+ _ERR(" viewmgr push view failed ");
+
+ return;
+ }
+
+ r = m->mhandle->MediaGetList(LIST_TYPE_SONG, NULL, &list);
+ if (r == false || eina_list_count(list) == 0) {
+ _ERR(" No songs ");
+ return;
+ }
+
+ m->mhandle->Stop();
+ m->mhandle->UpdatePlaylist(list, ADD_TYPE_FRESH);
+ eina_list_free(list);
+
+ m_GotoPlayback();
+ }
+ } *pHandlerBtnPlayback;
+
+ class CHandlerBtnCtxpopup : public CHandlerBtn {
+ private:
+ ETopBtnType m_type;
+
+ public:
+ CHandlerBtnCtxpopup(SMusicBaseView *ins, ETopBtnType type) : CHandlerBtn(ins) { m_type = type; }
+
+ private:
+ static void sm_CbCtxPopupBtnClicked(void *dt, Evas_Object *obj, void *ev)
+ {
+ CHandlerBtnCtxpopup *root = (CHandlerBtnCtxpopup*)dt;
+ if (root)
+ root->m_CbCtxPopupBtnClicked(obj, ev);
+ }
+
+ void m_CbCtxPopupBtnClicked(Evas_Object *obj, void *ev)
+ {
+ const char *text = NULL;
+ const char *layout_id = NULL;
+ int size = 0;
+ int type = 0;
+
+ text = elm_object_text_get(obj);
+
+ if (m->btntype == TOP_BTN_TYPE_SOURCE) {
+ size = ARRAY_SIZE(g_sourceText);
+ st_FindIndex(g_sourceText, size, text, &type);
+ DestroyCtxPopup();
+ if (type == m->mhandle->SourceType())
+ return;
+
+ m->mhandle->SetSourceType(type);
+ elm_object_text_set(m->srcbtn, _(text));
+ }
+ else {
+ layout_id = m->lmgr->Layout()->LayoutId();
+ if (!strcmp(layout_id, MUSIC_FOLDER_LAYOUT)) {
+ size = ARRAY_SIZE(g_sortTextFolder);
+ st_FindIndex(g_sortTextFolder, size, text, &type);
+ }
+ else if (!strcmp(layout_id, MUSIC_ALBUM_LAYOUT)) {
+ size = ARRAY_SIZE(g_sortTextAlbum);
+ st_FindIndex(g_sortTextAlbum, size, text, &type);
+ }
+ else if (!strcmp(layout_id, MUSIC_CATEGORY_PLAYLISTS_LAYOUT)) {
+ size = ARRAY_SIZE(g_sortTextPlaylists);
+ st_FindIndex(g_sortTextPlaylists, size, text, &type);
+ }
+ else if (!strcmp(layout_id, MUSIC_CATEGORY_ARTIST_LAYOUT)) {
+ size = ARRAY_SIZE(g_sortTextArtist);
+ st_FindIndex(g_sortTextArtist, size, text, &type);
+ }
+ else if (!strcmp(layout_id, MUSIC_CATEGORY_GENRE_LAYOUT)) {
+ size = ARRAY_SIZE(g_sortTextGenre);
+ st_FindIndex(g_sortTextGenre, size, text, &type);
+ }
+ else {
+ size = ARRAY_SIZE(g_sortText);
+ st_FindIndex(g_sortText, size, text, &type);
+ }
+ DestroyCtxPopup();
+ if (type == m->mhandle->SortType())
+ return;
+
+ m->mhandle->SetSortType(type);
+ elm_object_text_set(m->sortbtn, _(text));
+ }
+
+ if (m_cbClicked)
+ m_cbClicked(m_cookie, obj);
+ }
+
+ static void sm_CbCtxPopupBtnKeyPressed(void *dt, Evas *e, Evas_Object *obj, void *ei)
+ {
+ CHandlerBtnCtxpopup *root = (CHandlerBtnCtxpopup*)dt;
+ if (root)
+ root->m_OnCtxPopupBtnKeyPressed(e, obj, (Evas_Event_Key_Down*)ei);
+ }
+
+ void m_OnCtxPopupBtnKeyPressed(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+ {
+ if (strcmp(ev->keyname, KEY_BACK) == 0)
+ DestroyCtxPopup();
+ }
+
+ protected:
+ static bool st_FindIndex(const char **arr, int arrsize, const char *text, int *index)
+ {
+ int i;
+
+ if (!arr || !arrsize || !text)
+ return false;
+
+ for (i = 0; i < arrsize; i++) {
+ if (arr[i] && !strcmp(arr[i], text)) {
+ *index = i;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void t_CreateCtxPopup(int btnType)
+ {
+ Evas_Object *ctxpopup = NULL, *box = NULL, *btn = NULL;
+ Evas_Object *firstbtn = NULL;
+ int i, size, selected_index;
+ const char **arr;
+ const char *layout_id = NULL;
+ const char *part = NULL;
+
+ if (!m->base)
+ return;
+
+ ctxpopup = elm_ctxpopup_add(m->base);
+ if (!ctxpopup)
+ return;
+
+ box = elm_box_add(ctxpopup);
+ if (!box) {
+ evas_object_del(ctxpopup);
+ return;
+ }
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0);
+
+ if (btnType == TOP_BTN_TYPE_SOURCE) {
+ arr = g_sourceText;
+ size = ARRAY_SIZE(g_sourceText);
+ selected_index = m->mhandle->SourceType();
+ m->btntype = btnType;
+ part = MUSIC_PART_SOURCE_POPUP;
+ }
+ else if (btnType == TOP_BTN_TYPE_SORT) {
+ arr = g_sortText;
+ size = ARRAY_SIZE(g_sortText);
+ layout_id = m->lmgr->Layout()->LayoutId();
+ if (layout_id) {
+ if (!strcmp(layout_id, MUSIC_ALBUM_LAYOUT)) {
+ arr = g_sortTextAlbum;
+ size = ARRAY_SIZE(g_sortTextAlbum);
+ }
+ else if (!strcmp(layout_id, MUSIC_FOLDER_LAYOUT)) {
+ arr = g_sortTextFolder;
+ size = ARRAY_SIZE(g_sortTextFolder);
+ }
+ else if (!strcmp(layout_id, MUSIC_CATEGORY_PLAYLISTS_LAYOUT)) {
+ arr = g_sortTextPlaylists;
+ size = ARRAY_SIZE(g_sortTextPlaylists);
+ }
+ else if (!strcmp(layout_id, MUSIC_CATEGORY_ARTIST_LAYOUT)) {
+ arr = g_sortTextArtist;
+ size = ARRAY_SIZE(g_sortTextArtist);
+ }
+ else if (!strcmp(layout_id, MUSIC_CATEGORY_GENRE_LAYOUT)) {
+ arr = g_sortTextGenre;
+ size = ARRAY_SIZE(g_sortTextGenre);
+ }
+ }
+ part = MUSIC_PART_SORT_POPUP;
+ selected_index = m->mhandle->SortType();
+ m->btntype = btnType;
+ }
+ else {
+ evas_object_del(ctxpopup);
+ return;
+ }
+
+ for (i = 0; i < size; i++) {
+ if (btnType == TOP_BTN_TYPE_SOURCE && i == SOURCE_TYPE_USB &&
+ !m->mhandle->CheckUsb())
+ continue;
+
+ btn = s_AddButton(box);
+ if (!btn) {
+ evas_object_del(ctxpopup);
+ return;
+ }
+ elm_object_style_set(btn, MUSIC_STYLE_HOVER_ENTRY);
+ elm_object_text_set(btn, _(arr[i]));
+ elm_box_pack_end(box, btn);
+
+ if (i == 0)
+ firstbtn = btn; /* to set focus later */
+
+ if (i == selected_index)
+ elm_object_signal_emit(btn,
+ "elm,action,highlight", "elm");
+
+ if (i == size - 1) {
+ elm_object_signal_emit(btn,
+ "elm,action,hideline", "elm");
+ _ERR("hiding last line");
+ }
+
+ evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED, sm_CbCtxPopupBtnClicked, this);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN, sm_CbCtxPopupBtnKeyPressed, this);
+ }
+
+ elm_object_content_set(ctxpopup, box);
+ elm_object_style_set(ctxpopup, MUSIC_STYLE_HOVER_CTXPOPUP);
+ elm_ctxpopup_direction_priority_set(ctxpopup,
+ ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_DOWN);
+ elm_object_part_content_set(m->base, part, ctxpopup);
+
+ m->ctxpopup = ctxpopup;
+
+ if (firstbtn && btn) {
+ elm_object_focus_set(firstbtn, EINA_TRUE);
+ elm_object_focus_next_object_set(firstbtn,
+ btn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(btn,
+ firstbtn, ELM_FOCUS_DOWN);
+ }
+ }
+ public:
+ void DestroyCtxPopup(void)
+ {
+ if (!m->ctxpopup)
+ return;
+
+ evas_object_hide(m->ctxpopup);
+ evas_object_del(m->ctxpopup);
+ m->ctxpopup = NULL;
+ }
+
+ public:
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) {
+ if (!strcmp(ev->keyname, KEY_BACK))
+ elm_object_focus_set(m->c_grpbtn, EINA_TRUE);
+ }
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj) {
+ t_CreateCtxPopup(m_type);
+ }
+ } *pHandlerBtnSource, *pHandlerBtnSort;
+
+
+ SMusicBaseView() {
+ memset(this, 0, sizeof(SMusicBaseView));
+ for (int a = 0; a < TOTAL_GROUP_BTNS; a++)
+ pHandlerBtnGroup[a] = new CHandlerBtnGroup(this);
+
+ pHandlerBtnPlayback = new CHandlerBtnPlayback(this);
+ pHandlerBtnSource = new CHandlerBtnCtxpopup(this, TOP_BTN_TYPE_SOURCE);
+ pHandlerBtnSort = new CHandlerBtnCtxpopup(this, TOP_BTN_TYPE_SORT);
+ pHandleVolume = new CHandleVolume;
+ }
+ ~SMusicBaseView() {
+ delete pHandleVolume;
+ delete pHandlerBtnSort;
+ delete pHandlerBtnSource;
+ delete pHandlerBtnPlayback;
+
+ for (int a = 0; a < TOTAL_GROUP_BTNS; a++)
+ delete pHandlerBtnGroup[a];
+ }
+};
+
+struct SBtnInfo {
+ const char *txt;
+ const char *part;
+ const char *style;
+ const char *icon_path;
+
+ SMusicBaseView::CHandlerBtn *handler;
+ //Evas_Smart_Cb cb;
+};
+
+
+void CMusicBaseView::sm_CbHandleEmptyStatus(void *cookie, bool emptyStatus)
+{
+ CMusicBaseView *root = (CMusicBaseView*)cookie;
+ if (root)
+ root->m_OnHandleEmptyStatus(emptyStatus);
+}
+
+
+void CMusicBaseView::m_OnHandleEmptyStatus(bool emptyStatus)
+{
+ if (emptyStatus)
+ m_UpdateEmptyFocusSequence();
+ else
+ m_UpdateFocusSequence();
+}
+
+
+void CMusicBaseView::m_UpdateFocusSequence(void)
+{
+ int i;
+
+ for (i = 0; i < TOTAL_GROUP_BTNS; i++)
+ elm_object_focus_next_object_set(m->group_btn[i],
+ m->content, ELM_FOCUS_RIGHT);
+
+ elm_object_focus_next_object_set(m->group_btn[GRP_SONG], m->plbackbtn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GRP_SONG], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->plbackbtn, m->content, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(m->srcbtn, m->content, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(m->sortbtn, m->content, ELM_FOCUS_DOWN);
+
+ elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT, MUSIC_STR_EMPTY);
+ elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT_SUB, MUSIC_STR_EMPTY);
+}
+
+
+void CMusicBaseView::m_UpdateEmptyFocusSequence(void)
+{
+ int i;
+
+ for (i = 0; i < TOTAL_GROUP_BTNS; i++)
+ elm_object_focus_next_object_set(m->group_btn[i],
+ m->plbackbtn, ELM_FOCUS_RIGHT);
+
+ elm_object_focus_next_object_set(m->group_btn[GRP_SONG], m->plbackbtn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GRP_SONG], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GRP_SONG], ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(m->srcbtn, m->group_btn[GRP_SONG], ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(m->sortbtn, m->group_btn[GRP_SONG], ELM_FOCUS_DOWN);
+
+ elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT, _(NO_MUSIC_MESSAGE));
+ elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT_SUB, _(NO_MUSIC_MESSAGE_SUB));
+}
+
+
+void CMusicBaseView::sm_CbClickedGroupBtn(void *cookie, Evas_Object *obj)
+{
+ CMusicBaseView *root = (CMusicBaseView*)cookie;
+ if (root)
+ root->m_OnClickedGroupBtn(obj);
+}
+
+
+void CMusicBaseView::m_OnClickedGroupBtn(Evas_Object *obj)
+{
+ m_ShowCurrentLayout();
+}
+
+
+void CMusicBaseView::sm_CbClickedCtxBtn(void *cookie, Evas_Object *obj)
+{
+ CMusicBaseView *root = (CMusicBaseView*)cookie;
+ if (root)
+ root->m_OnClickedCtxBtn(obj);
+}
+
+
+void CMusicBaseView::m_OnClickedCtxBtn(Evas_Object *obj)
+{
+ if (m->btntype == TOP_BTN_TYPE_SOURCE) {
+ if (m->c_grpbtn != m->group_btn[GRP_PLAYLISTS])
+ m_ShowCurrentLayout();
+ }
+ else
+ m_UpdateCurrentLayout(false);
+}
+
+
+void CMusicBaseView::m_ShowCurrentLayout(void)
+{
+ const char *layoutId = NULL;
+ Evas_Object *evasLayout = NULL;
+
+ elm_object_part_content_unset(m->base, MUSIC_PART_CONTENT);
+
+ if (m->c_grpbtn == m->group_btn[GRP_SONG]) {
+ layoutId = MUSIC_SONG_LAYOUT;
+ evasLayout = m->layoutSong->Layout();
+ }
+ else if (m->c_grpbtn == m->group_btn[GRP_ALBUM]) {
+ layoutId = MUSIC_ALBUM_LAYOUT;
+ evasLayout = m->layoutAlbum->Layout();
+ }
+ else if (m->c_grpbtn == m->group_btn[GRP_ARTIST]) {
+ layoutId = MUSIC_CATEGORY_ARTIST_LAYOUT;
+ evasLayout = m->layoutArtist->Layout();
+ }
+ else if (m->c_grpbtn == m->group_btn[GRP_GENRE]) {
+ layoutId = MUSIC_CATEGORY_GENRE_LAYOUT;
+ evasLayout = m->layoutGenre->Layout();
+ }
+ else if (m->c_grpbtn == m->group_btn[GRP_PLAYLISTS]) {
+ layoutId = MUSIC_CATEGORY_PLAYLISTS_LAYOUT;
+ evasLayout = m->layoutPlaylists->Layout();
+ }
+ else if (m->c_grpbtn == m->group_btn[GRP_FOLDER]) {
+ layoutId = MUSIC_FOLDER_LAYOUT;
+ evasLayout = m->layoutFolder->Layout();
+ }
+
+ CExtBaseLayout *layout = (CExtBaseLayout*)m->lmgr->Layout();
+ if (layout && layout->EmptyStatus() == true) {
+ m_UpdateEmptyFocusSequence();
+ }
+ else {
+ elm_object_part_content_set(m->base, MUSIC_PART_CONTENT, evasLayout);
+ m->lmgr->Show(layoutId);
+ m_UpdateFocusSequence();
+ }
+}
+
+
+void CMusicBaseView::m_DestroyPopup(void)
+{
+ if (!m->popup)
+ return;
+
+ if (m->transit) {
+ elm_transit_del(m->transit);
+ m->transit = NULL;
+ }
+ evas_object_del(m->popup);
+ m->popup = NULL;
+}
+
+
+void CMusicBaseView::m_DestroyCtxPopup(void)
+{
+ m->pHandlerBtnSource->DestroyCtxPopup();
+ m->pHandlerBtnSort->DestroyCtxPopup();
+}
+
+
+Evas_Object *CMusicBaseView::m_CreateLoadingPopup(void)
+{
+ Evas_Object *popup = NULL, *label = NULL, *icon = NULL;
+ double scale;
+ char buf[MAX_LENGTH];
+
+ popup = elm_popup_add(m->base);
+ if (!popup)
+ return NULL;
+
+ elm_object_style_set(popup, MUSIC_STYLE_LOADING_POPUP);
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP_RIGHT);
+ elm_popup_timeout_set(popup, MAX_SHOW_TIME);
+ evas_object_show(popup);
+
+ label = elm_label_add(popup);
+ if (!label) {
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_object_style_set(label, MUSIC_STYLE_LOADING_LABEL);
+ elm_object_text_set(label, _(MUSIC_TEXT_LOADING));
+ elm_object_content_set(popup, label);
+ scale = elm_config_scale_get();
+
+ icon = elm_icon_add(popup);
+ if (!icon) {
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, MUSIC_IMAGE_LOADING);
+ elm_image_file_set(icon, buf, NULL);
+ elm_image_animated_set(icon, EINA_TRUE);
+ elm_image_animated_play_set(icon, EINA_TRUE);
+ evas_object_size_hint_min_set(icon, 48 * scale, 48 * scale);
+ elm_object_part_content_set(popup, MUSIC_SWALLOW_ICON, icon);
+
+ m->transit = elm_transit_add();
+ if (!m->transit) {
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_transit_object_add(m->transit, icon);
+ elm_transit_effect_rotation_add(m->transit, 0, 360);
+ elm_transit_duration_set(m->transit, 1);
+ elm_transit_repeat_times_set(m->transit, 5);
+ elm_transit_objects_final_state_keep_set(m->transit, EINA_TRUE);
+ elm_transit_go(m->transit);
+
+ return popup;
+}
+
+
+void CMusicBaseView::m_UpdatePlaysongLabel(void)
+{
+ SSongInfo *sinfo = NULL;
+ char buf[MAX_LENGTH];
+ int state;
+
+ state = m->mhandle->PlayState();
+
+ if (state != PLAY_STATUS_INITIAL && state != PLAY_STATUS_STOP) {
+
+ if (!m->mhandle->GetCurrentSong(&sinfo)) {
+ _ERR(" failed to find song info ");
+ return;
+ }
+
+ snprintf(buf, sizeof(buf), "%s - %s",
+ song_info_get_title(sinfo),
+ song_info_get_artist(sinfo));
+
+ _set_object_text(m->plsonglbl, buf, PLAYSONG_FONT_SIZE,
+ FONT_STYLE_REGULAR);
+ elm_label_slide_go(m->plsonglbl);
+ }
+ else {
+ _set_object_text(m->plsonglbl, (char *)MUSIC_STR_EMPTY,
+ PLAYSONG_FONT_SIZE, (const char *)FONT_STYLE_REGULAR);
+ }
+}
+
+
+void CMusicBaseView::m_AddPlaysongLabel(void)
+{
+ double scale = elm_config_scale_get();
+
+ m->plsonglbl = elm_label_add(m->base);
+ if (!m->plsonglbl)
+ return;
+
+ elm_object_style_set(m->plsonglbl, MUSIC_STYLE_PLAYSONG_LBL);
+ elm_label_wrap_width_set(m->plsonglbl, MUSIC_WRAP_WIDTH * scale);
+ elm_label_slide_duration_set(m->plsonglbl, MUSIC_SLIDE_DURATION);
+ elm_label_slide_mode_set(m->plsonglbl, ELM_LABEL_SLIDE_MODE_AUTO);
+ elm_label_slide_go(m->plsonglbl);
+ evas_object_size_hint_weight_set(m->plsonglbl, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m->base, MUSIC_PART_PLAYSONG_LBL,
+ m->plsonglbl);
+ evas_object_show(m->plsonglbl);
+}
+
+
+void CMusicBaseView::m_CreateTopSection(void)
+{
+ int type;
+ int i;
+ Evas_Object *btn = NULL;
+ static struct SBtnInfo btninfo[TOTAL_TOP_BTNS];
+
+ btninfo[TOP_BTN_TYPE_PLAYBACK].part = MUSIC_PART_PLAYBACK_BTN;
+ btninfo[TOP_BTN_TYPE_PLAYBACK].style = MUSIC_STYLE_PLAYBACK_BTN;
+ btninfo[TOP_BTN_TYPE_PLAYBACK].handler = m->pHandlerBtnPlayback;// cb = sm_CbPlaybackBtnClicked;
+
+ btninfo[TOP_BTN_TYPE_SOURCE].part = MUSIC_PART_SOURCE_HOVERSEL;
+ btninfo[TOP_BTN_TYPE_SOURCE].style = MUSIC_STYLE_SOURCE_BTN;
+ btninfo[TOP_BTN_TYPE_SOURCE].handler = m->pHandlerBtnSource;// cb = sm_CbSourceBtnClicked;
+
+ btninfo[TOP_BTN_TYPE_SORT].part = MUSIC_PART_SORT_HOVERSEL;
+ btninfo[TOP_BTN_TYPE_SORT].style = MUSIC_STYLE_SORT_BTN;
+ btninfo[TOP_BTN_TYPE_SORT].handler = m->pHandlerBtnSort;// cb = sm_CbSortBtnClicked;
+
+ elm_object_part_text_set(m->base, MUSIC_PART_TITLE,
+ _(MUSIC_TEXT_TITLE));
+
+ m_AddPlaysongLabel();
+
+ for (i = 0; i < TOTAL_TOP_BTNS; i++) {
+ btn = s_AddButton(m->base);
+ if (!btn) {
+ _ERR(" Adding btn failed ");
+ return;
+ }
+
+ elm_object_style_set(btn, btninfo[i].style);
+ elm_object_part_content_set(m->base, btninfo[i].part, btn);
+
+ btninfo[i].handler->Connect(btn);
+ //evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
+ ////evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN, sm_CbTopBtnKeyPressed, m);
+ //evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
+
+ if (i == TOP_BTN_TYPE_PLAYBACK)
+ m->plbackbtn = btn;
+ else if (i == TOP_BTN_TYPE_SOURCE)
+ m->srcbtn = btn;
+ else if (i == TOP_BTN_TYPE_SORT)
+ m->sortbtn = btn;
+ }
+
+ type = m->mhandle->SourceType();
+ elm_object_text_set(m->srcbtn, _(g_sourceText[type]));
+
+ type = m->mhandle->SortType();
+ elm_object_text_set(m->sortbtn, _(g_sortText[type]));
+}
+
+
+void CMusicBaseView::m_CreateLeftSection(void)
+{
+ Evas_Object *box = NULL, *ic = NULL;
+ int i;
+ char buf[MAX_LENGTH];
+ static struct SBtnInfo btninfo[TOTAL_GROUP_BTNS];
+
+ btninfo[GRP_SONG].txt = MUSIC_TEXT_SONG;
+ btninfo[GRP_SONG].icon_path = MUSIC_IMAGE_GRPBTN_SONG;
+
+ btninfo[GRP_ALBUM].txt = MUSIC_TEXT_ALBUM;
+ btninfo[GRP_ALBUM].icon_path = MUSIC_IMAGE_GRPBTN_ALBUM;
+
+ btninfo[GRP_ARTIST].txt = MUSIC_TEXT_ARTIST;
+ btninfo[GRP_ARTIST].icon_path = MUSIC_IMAGE_GRPBTN_ARTIST;
+
+ btninfo[GRP_GENRE].txt = MUSIC_TEXT_GENRE;
+ btninfo[GRP_GENRE].icon_path = MUSIC_IMAGE_GRPBTN_GENRE;
+
+ btninfo[GRP_FOLDER].txt = MUSIC_TEXT_FOLDER;
+ btninfo[GRP_FOLDER].icon_path = MUSIC_IMAGE_GRPBTN_FOLDER;
+
+ btninfo[GRP_PLAYLISTS].txt = MUSIC_TEXT_PLAYLIST;
+ btninfo[GRP_PLAYLISTS].icon_path = MUSIC_IMAGE_GRPBTN_PLAYLISTS;
+
+ box = _add_box(m->base);
+ if (!box)
+ return;
+
+ for (i = 0; i < TOTAL_GROUP_BTNS; i++) {
+ m->group_btn[i] = s_AddButton(box);
+ if (!m->group_btn[i]) {
+ _ERR(" failed to add button to box ");
+ continue;
+ }
+
+ elm_box_pack_end(box, m->group_btn[i]);
+ elm_object_style_set(m->group_btn[i], MUSIC_STYLE_GROUPBTN);
+ elm_object_text_set(m->group_btn[i], _(btninfo[i].txt));
+
+ m->pHandlerBtnGroup[i]->Connect(m->group_btn[i]);
+ m->pHandlerBtnGroup[i]->SetCallback(sm_CbClickedGroupBtn, this);
+
+ ic = elm_image_add(m->group_btn[i]);
+ if (ic) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ btninfo[i].icon_path);
+ elm_image_file_set(ic, buf, NULL);
+ elm_object_part_content_set(m->group_btn[i],
+ MUSIC_PART_ELM_SWALLOWICON, ic);
+ }
+ }
+
+ elm_object_part_content_set(m->base, MUSIC_PART_GROUPBTN_BOX, box);
+}
+
+
+void CMusicBaseView::m_CreateFullView(void)
+{
+ m_CreateTopSection();
+ m_CreateLeftSection();
+}
+
+
+void CMusicBaseView::m_SetSourceType(void)
+{
+ if (!m->arglist || !m->arglist->source || !m->mhandle)
+ return;
+
+ if (!strcmp(g_sourceArg[SOURCE_TYPE_USB], m->arglist->source))
+ m->mhandle->SetSourceType(SOURCE_TYPE_USB);
+ else if (!strcmp(g_sourceArg[SOURCE_TYPE_TV], m->arglist->source))
+ m->mhandle->SetSourceType(SOURCE_TYPE_TV);
+ else
+ m->mhandle->SetSourceType(SOURCE_TYPE_ALL);
+}
+
+
+void CMusicBaseView::m_UpdateCurrentLayout(bool focusFlag)
+{
+ ((CExtBaseLayout*)m->lmgr->Layout())->Update(focusFlag);
+}
+
+
+bool CMusicBaseView::Create(void *data)
+{
+ ASSERT(!m);
+
+ Evas_Object *win = NULL;
+ CMusicController *mhandle = NULL;
+ CLayoutMgr *lmgr = NULL;
+ char *arg = NULL;
+
+ m = new SMusicBaseView;
+ if (!m) {
+ _ERR(" new for SMusicBaseView failed ");
+ m = NULL;
+ return false;
+ }
+
+ win = CViewMgr::GetInstance()->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ mhandle = CMusicController::GetInstance();
+ if (!mhandle) {
+ _ERR(" music controller get music instance failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ m->base = _add_base(win, MUSIC_BASE_VIEW);
+ if (!m->base) {
+ _ERR(" add base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ lmgr = new CLayoutMgr;
+ if (!lmgr) {
+ evas_object_del(m->base);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ if (!lmgr->Create(m->base, NULL)) {
+ _ERR(" init layout mgr failed ");
+ evas_object_del(m->base);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ bool r = CBaseView::Create(data);
+ if (!r) {
+ _ERR(" CBaseView Creation failed ");
+ lmgr->Destroy();
+ evas_object_del(m->base);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ m->win = win;
+ m->mhandle = mhandle;
+ m->lmgr = lmgr;
+ m->fresh_view = true;
+ m->arglist = (_arg_list *)data;
+ m->parent = this;
+
+ m->layoutSong = new CSongLayout(MUSIC_SONG_LAYOUT);
+ arg = NULL;
+ if (m->arglist && m->arglist->album_id)
+ arg = m->arglist->album_id;
+ m->layoutSong->Create(m->lmgr, arg);
+ lmgr->AddLayout(m->layoutSong);
+
+ m->layoutAlbum = new CAlbumLayout(MUSIC_ALBUM_LAYOUT);
+ arg = NULL;
+ if (m->arglist && m->arglist->uri)
+ arg = m->arglist->uri;
+ m->layoutAlbum->Create(m->lmgr, arg);
+ m->layoutAlbum->SetEmptyStatusHandleCallback(sm_CbHandleEmptyStatus, this);
+ lmgr->AddLayout(m->layoutAlbum);
+
+ m->layoutArtist = new CArtistLayout(MUSIC_CATEGORY_ARTIST_LAYOUT);
+ m->layoutArtist->Create(m->lmgr);
+ lmgr->AddLayout(m->layoutArtist);
+
+ m->layoutGenre = new CGenreLayout(MUSIC_CATEGORY_GENRE_LAYOUT);
+ m->layoutGenre->Create(m->lmgr);
+ lmgr->AddLayout(m->layoutGenre);
+
+ m->layoutPlaylists = new CPlaylistLayout(MUSIC_CATEGORY_PLAYLISTS_LAYOUT);
+ m->layoutPlaylists->Create(m->lmgr);
+ lmgr->AddLayout(m->layoutPlaylists);
+
+ m->layoutFolder = new CFolderLayout(MUSIC_FOLDER_LAYOUT);
+ m->layoutFolder->Create(m->lmgr);
+ lmgr->AddLayout(m->layoutFolder);
+
+ elm_object_part_content_unset(m->base, MUSIC_PART_CONTENT);
+
+ m_SetSourceType();
+
+ evas_object_data_set(m->base, BASE_VIEW_DATA, m);
+
+ m_CreateFullView();
+ m->pHandleVolume->Create(m->base);
+ m_UpdateFocusSequence();
+
+ Connect(m->base);
+
+ for (int i = 0; i < TOTAL_GROUP_BTNS; i++) {
+ m->pHandlerBtnGroup[i]->SetCallback(sm_CbClickedGroupBtn, this);
+ }
+ m->pHandlerBtnSort->SetCallback(sm_CbClickedCtxBtn, this);
+ m->pHandlerBtnSource->SetCallback(sm_CbClickedCtxBtn, this);
+
+ mhandle->AddListener(this);
+ //m->cbinfo[E_SONG_COMPLETE] = mhandle->AddCallback(E_SONG_COMPLETE, sm_CbUpdatePlaysongLabel, this);
+ //m->cbinfo[E_CONTENT_UPDATE] = mhandle->AddCallback(E_CONTENT_UPDATE, sm_CbContentUpdate, this);
+ //m->cbinfo[E_USB_CONNECT] = mhandle->AddCallback(E_USB_CONNECT, sm_CbUsbConnect, this);
+
+ return true;
+}
+
+
+void CMusicBaseView::Destroy(void)
+{
+ ASSERT(m);
+
+ m->mhandle->RemoveListener(this);
+ //m->mhandle->RemoveCallback(m->cbinfo[E_SONG_COMPLETE]);
+ //m->mhandle->RemoveCallback(m->cbinfo[E_CONTENT_UPDATE]);
+ //m->mhandle->RemoveCallback(m->cbinfo[E_USB_CONNECT]);
+
+ m->pHandleVolume->Destroy();
+
+ m->lmgr->RemoveLayout(m->layoutFolder);
+ m->layoutFolder->Destroy();
+ delete m->layoutFolder;
+
+ m->lmgr->RemoveLayout(m->layoutArtist);
+ m->layoutArtist->Destroy();
+ delete m->layoutArtist;
+
+ m->lmgr->RemoveLayout(m->layoutGenre);
+ m->layoutGenre->Destroy();
+ delete m->layoutGenre;
+
+ m->lmgr->RemoveLayout(m->layoutPlaylists);
+ m->layoutPlaylists->Destroy();
+ delete m->layoutPlaylists;
+
+ m->lmgr->RemoveLayout(m->layoutAlbum);
+ m->layoutAlbum->Destroy();
+ delete m->layoutAlbum;
+
+ m->lmgr->RemoveLayout(m->layoutSong);
+ m->layoutSong->Destroy();
+ delete m->layoutSong;
+
+ CBaseView::Destroy();
+ m->lmgr->Destroy();
+ delete m->lmgr;
+ evas_object_del(m->base);
+
+ delete m;
+ m = NULL;
+}
+
+
+Evas_Object* CMusicBaseView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+
+void CMusicBaseView::t_OnShow(void)
+{
+ ASSERT(m);
+
+ evas_object_show(m->base);
+
+ if (!m->fresh_view) {
+ elm_object_focus_set(m->plbackbtn, EINA_TRUE);
+ m_UpdatePlaysongLabel();
+ return;
+ }
+
+ if (m->arglist && m->arglist->album_id)
+ m->c_grpbtn = m->group_btn[GRP_ALBUM];
+ else
+ m->c_grpbtn = m->group_btn[GRP_SONG];
+
+ elm_object_signal_emit(m->c_grpbtn,
+ MUSIC_SIGNAL_GROUP_SELECTED, MUSIC_BASE_VIEW);
+ elm_object_focus_set(m->c_grpbtn, EINA_TRUE);
+ m_UpdatePlaysongLabel();
+
+ m_ShowCurrentLayout();
+
+ m->arglist = NULL;
+ m->fresh_view = false;
+}
+
+
+void CMusicBaseView::t_OnUpdate(void *data)
+{
+ ASSERT(m);
+
+ if (!data) {
+ m_ShowCurrentLayout();
+ return;
+ }
+
+ SParcel *parcel = (SParcel *)data;
+ int update_type = parcel->updateType;
+ const char *layout_id = parcel->layoutId;
+
+ if (update_type == E_FOCUS_UPDATE)
+ elm_object_focus_set(m->c_grpbtn, EINA_TRUE);
+ else if (update_type == E_LAYOUT_UPDATE) {
+ if (!layout_id)
+ return;
+
+ elm_object_disabled_set(m->sortbtn, EINA_FALSE);
+ if (!strcmp(layout_id, MUSIC_ALBUM_SONGS_LAYOUT) ||
+ !strcmp(layout_id, MUSIC_CATEGORY_SONGS_LAYOUT) ||
+ !strcmp(layout_id, MUSIC_CATEGORY_ALBUM_LAYOUT) ||
+ !strcmp(layout_id, MUSIC_CATEGORY_SELECTLIST_LAYOUT))
+ elm_object_disabled_set(m->sortbtn, EINA_TRUE);
+ }
+ else if (update_type == E_DEPTH_UPDATE) {
+ if (!layout_id)
+ return;
+
+ if (!strcmp(layout_id, MUSIC_ALBUM_SONGS_LAYOUT)) {
+ m_ShowCurrentLayout();
+ m_UpdateCurrentLayout(true);
+ }
+ }
+}
+
+
+void CMusicBaseView::t_OnHide(void)
+{
+ ASSERT(m);
+
+ evas_object_hide(m->base);
+}
+
+
+void CMusicBaseView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_EXIT)) {
+ m->mhandle->Stop();
+ elm_exit();
+ }
+ else if (!strcmp(ev->keyname, KEY_ENTER)) {
+ if (elm_object_focus_get(m->c_grpbtn)) {
+ m_UpdateCurrentLayout(true);
+ }
+ }
+ else if (!strcmp(ev->keyname, KEY_VOLUMEUP))
+ m->pHandleVolume->Up(); //m_HandleVolumeKey(SOUND_UP);
+ else if (!strcmp(ev->keyname, KEY_VOLUMEDOWN))
+ m->pHandleVolume->Down();// m_HandleVolumeKey(SOUND_DOWN);
+ else if (!strcmp(ev->keyname, KEY_MUTE))
+ m->pHandleVolume->Mute();// m_HandleVolumeKey(SOUND_MUTE);
+ else if (!strcmp(ev->keyname, KEY_NEXT) ||
+ !strcmp(ev->keyname, KEY_PREVIOUS) ||
+ !strcmp(ev->keyname, KEY_PLAY) ||
+ !strcmp(ev->keyname, KEY_PAUSE)) {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_KEY_PRESS;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = ev->keyname;
+ CViewMgr::GetInstance()->UpdateView((const char *)MUSIC_PLAYBACK_VIEW, &parcel);
+ }
+}
+
+
+void CMusicBaseView::OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev)
+{
+ if (!strcmp(ev->keyname, KEY_NEXT) ||
+ !strcmp(ev->keyname, KEY_PREVIOUS)) {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_KEY_RELEASE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = ev->keyname;
+ CViewMgr::GetInstance()->UpdateView((const char *)MUSIC_PLAYBACK_VIEW, &parcel);
+ m_UpdatePlaysongLabel();
+ }
+}
+
+
+void CMusicBaseView::t_OnComplete(void)
+{
+ m_UpdatePlaysongLabel();
+}
+
+
+void CMusicBaseView::t_OnError(void)
+{
+}
+
+
+void CMusicBaseView::t_OnUsbConnected(void)
+{
+ m->popup = m_CreateLoadingPopup();
+}
+
+
+void CMusicBaseView::t_OnUpdateContent(void)
+{
+ int source;
+
+ m_DestroyPopup();
+ m_DestroyCtxPopup();
+ source = m->mhandle->SourceType();
+ elm_object_text_set(m->srcbtn, _(g_sourceText[source]));
+
+ if (source != SOURCE_TYPE_TV)
+ m_ShowCurrentLayout();
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+
+#include <InputHandler.h>
+#include "category_info.h"
+#include "album_info.h"
+#include "song_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "entry-popup.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "category-layout.h"
+#include "base-view.h"
+
+#define TOTAL_ADD_BTNS 3
+#define TOTAL_SELECT_BTNS 3
+#define GENGRID_ITEM_SIZE_W (263+20)
+#define GENGRID_ITEM_SIZE_H (359+20)
+
+
+enum EAddBtns {
+ ABTN_PLAY,
+ ABTN_NEXT,
+ ABTN_LAST
+};
+
+enum ESelectBtns {
+ SBTN_SELECT_ALL,
+ SBTN_DONE,
+ SBTN_CANCEL
+};
+
+enum EIdType {
+ ID_TYPE_MEDIA,
+ ID_TYPE_MEMBER
+};
+
+struct SBtnInfo {
+ const char *name;
+ const char *part;
+ const char *style;
+ const char *icon;
+ Evas_Smart_Cb cb;
+};
+
+struct SCategoryLayout {
+ Evas_Object *win;
+ Evas_Object *layout;
+ Evas_Object *glist;
+ Evas_Object *add_btn[TOTAL_ADD_BTNS];
+ Evas_Object *select_btn[TOTAL_SELECT_BTNS];
+ Evas_Object *albumCover;
+ Evas_Object *def_foc_btn;
+ Eina_List *catlist;
+ Eina_List *alblist;
+ Eina_List *songlist;
+ Eina_List *it_infolist;
+ Ecore_Idler *focus_idler;
+ CMusicController *pMusicController;
+ CLayoutMgr *lmgr;
+ CViewMgr *vmgr;
+ SSongInfo *c_sinfo;
+ int total_duration;
+ int count;
+
+ SCategoryLayout() {
+ memset(this, 0, sizeof(SCategoryLayout));
+ }
+
+ ~SCategoryLayout() {
+ }
+};
+
+
+Eina_Bool CCategoryLayout::sm_CbFocusIdler(void *dt)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+
+ Eina_Bool ret = EINA_FALSE;
+ if (root)
+ ret = root->m_OnFocusIdler();
+
+ return ret;
+}
+
+
+Eina_Bool CCategoryLayout::m_OnFocusIdler(void)
+{
+ Elm_Object_Item *it = NULL;
+ SCatItemInfo *itinfo = NULL;
+
+ m->focus_idler = NULL;
+ elm_object_tree_focus_allow_set(t.base, EINA_TRUE);
+
+ if (t.depth == E_DEPTH_CATEGORY) {
+ it = m_FindItemByInfo(m->it_infolist, t.c_catinfo);
+ if (!it) {
+ itinfo = (SCatItemInfo *)eina_list_nth(m->it_infolist, 0);
+ it = itinfo->item;
+ }
+ elm_gengrid_item_show(it, ELM_GENGRID_ITEM_SCROLLTO_IN);
+ elm_object_item_focus_set(it, EINA_TRUE);
+ }
+ else
+ elm_object_focus_set(m->def_foc_btn, EINA_TRUE);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+void CCategoryLayout::sm_CbEntrynameSet(void *dt, const char *name)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnEntrynameSet(name);
+}
+
+
+void CCategoryLayout::m_OnEntrynameSet(const char *name)
+{
+ Eina_List *idlist = NULL;
+ char *str = NULL;
+
+ if (!name)
+ return;
+
+ idlist = m_GetSelectedList(m->it_infolist, (int)ID_TYPE_MEDIA);
+ str = strdup(name);
+ destroy_entry_popup(t.epopup);
+ t.epopup = NULL;
+
+ if (!strcmp(str, MUSIC_STR_EMPTY)) {
+ _create_message_box(Layout(), MUSIC_TEXT_EMPTY_NAME);
+ free(str);
+ return;
+ }
+
+ if (m->pMusicController->MediaExistPlaylist(str)) {
+ _create_message_box(Layout(), MUSIC_TEXT_INUSE_MSG);
+ free(str);
+ return;
+ }
+
+ if (!m->pMusicController->MediaInsertPlaylist(str, idlist)) {
+ _ERR("Playlist creation failed ");
+ free(str);
+ return;
+ }
+
+ t.depth = E_DEPTH_CATEGORY;
+ t_UpdateLayoutWithFocus();
+}
+
+
+void CCategoryLayout::sm_CbSelectAllClicked(void *dt, Evas_Object *obj, void *ev)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnSelectAllClicked(obj, ev);
+}
+
+
+void CCategoryLayout::m_OnSelectAllClicked(Evas_Object *obj, void *ev)
+{
+ Eina_List *l = NULL;
+ SCatItemInfo *itinfo = NULL;
+ void *list_obj = NULL;
+ int tc;
+
+ tc = eina_list_count(m->it_infolist);
+
+ if (m->count == tc) {
+ elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
+ _(MUSIC_TEXT_SELECT_ALL));
+ m->count = 0;
+ EINA_LIST_FOREACH(m->it_infolist, l, list_obj) {
+ itinfo = (SCatItemInfo *)list_obj;
+ itinfo->check_status = false;
+ }
+ elm_genlist_realized_items_update(m->glist);
+
+ return;
+ }
+
+ elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
+ _(MUSIC_TEXT_DESELECT_ALL));
+ m->count = tc;
+ EINA_LIST_FOREACH(m->it_infolist, l, list_obj) {
+ itinfo = (SCatItemInfo *)list_obj;
+ itinfo->check_status = true;
+ }
+ elm_genlist_realized_items_update(m->glist);
+}
+
+
+void CCategoryLayout::sm_CbDoneBtnClicked(void *dt, Evas_Object *obj, void *ev)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnDoneBtnClicked(obj, ev);
+}
+
+
+void CCategoryLayout::m_OnDoneBtnClicked(Evas_Object *obj, void *ev)
+{
+ if (t.sel_type == SELECT_ADD) {
+ m_AddSelectedSongs();
+ return;
+ }
+ else if (t.sel_type == SELECT_REMOVE) {
+ m_RemoveSelectedSongs();
+ return;
+ }
+
+ if (t.epopup)
+ destroy_entry_popup(t.epopup);
+
+ t.epopup = create_entry_popup(t.base, MUSIC_STR_EMPTY,
+ sm_CbEntrynameSet, this);
+}
+
+
+void CCategoryLayout::sm_CbCancelBtnClicked(void *dt, Evas_Object *obj, void *ev)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnCancelBtnClicked(obj, ev);
+}
+
+
+void CCategoryLayout::m_OnCancelBtnClicked(Evas_Object *obj, void *ev)
+{
+ t.depth = E_DEPTH_CATEGORY;
+ t_UpdateLayoutWithFocus();
+}
+
+
+void CCategoryLayout::sm_CbPlayBtnClicked(void *dt, Evas_Object *obj, void *ev)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnPlayBtnClicked(obj, ev);
+}
+
+
+void CCategoryLayout::m_OnPlayBtnClicked(Evas_Object *obj, void *ev)
+{
+ m_GotoPlayback(ADD_TYPE_FRESH, NULL);
+}
+
+
+void CCategoryLayout::sm_CbNextBtnClicked(void *dt, Evas_Object *obj, void *ev)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnNextBtnClicked(obj, ev);
+}
+
+
+void CCategoryLayout::m_OnNextBtnClicked(Evas_Object *obj, void *ev)
+{
+ m_GotoPlayback(ADD_TYPE_NEXT, NULL);
+}
+
+
+void CCategoryLayout::sm_CbLastBtnClicked(void *dt, Evas_Object *obj, void *ev)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnLastBtnClicked(obj, ev);
+}
+
+
+void CCategoryLayout::m_OnLastBtnClicked(Evas_Object *obj, void *ev)
+{
+ m_GotoPlayback(ADD_TYPE_END, NULL);
+}
+
+
+char *CCategoryLayout::sm_CbGetSelectlistItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SCatItemInfo *itinfo = (SCatItemInfo *)data;
+ char *str = NULL;
+ int index;
+
+ if (!itinfo || !obj || !part)
+ return NULL;
+
+ if (!strcmp(part, "elm.text")) {
+ str = song_info_get_title(itinfo->sinfo);
+
+ index = elm_genlist_item_index_get(itinfo->item);
+ if ((index & 1) == 1)
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_EVEN_ROW, MUSIC_BASE_VIEW);
+ else
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_ODD_ROW, MUSIC_BASE_VIEW);
+
+ if (itinfo->check_status)
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_CHECK_ON, MUSIC_BASE_VIEW);
+ else
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_CHECK_OFF, MUSIC_BASE_VIEW);
+ }
+ else if (!strcmp(part, "elm.text1")) {
+ str = song_info_get_artist(itinfo->sinfo);
+ }
+ else if (!strcmp(part, "elm.text2")) {
+ str = song_info_get_album(itinfo->sinfo);
+ }
+
+ if (str)
+ return strdup(str);
+
+ return NULL;
+}
+
+
+char *CCategoryLayout::sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SCatItemInfo *itinfo = (SCatItemInfo *)data;
+ SSongInfo *sinfo = NULL;
+ char buf[MAX_LENGTH];
+ char *timestr = NULL;
+ int duration;
+ int index;
+
+ if (!itinfo || !obj || !part)
+ return NULL;
+
+ sinfo = itinfo->sinfo;
+
+ snprintf(buf, sizeof(buf), "%s", MUSIC_STR_EMPTY);
+
+ if (!strcmp(part, "elm.text")) {
+ index = elm_genlist_item_index_get(itinfo->item);
+ if ((index & 1) == 1) {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_EVEN_ROW, MUSIC_BASE_VIEW);
+ }
+ else {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_ODD_ROW, MUSIC_BASE_VIEW);
+ }
+ snprintf(buf, sizeof(buf), "%d", index + 1);
+ }
+ else if (!strcmp(part, "elm.text1")) {
+ snprintf(buf, sizeof(buf), "%s", song_info_get_title(sinfo));
+ }
+ else if (!strcmp(part, "elm.text2")) {
+ snprintf(buf, sizeof(buf), "%s", song_info_get_artist(sinfo));
+ }
+ 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);
+ }
+ }
+ }
+
+ if (strcmp(buf, MUSIC_STR_EMPTY))
+ return strdup(buf);
+
+ return NULL;
+}
+
+
+void CCategoryLayout::sm_CbRemoveListItem(void *data, Evas_Object *obj)
+{
+ free(data);
+}
+
+
+void CCategoryLayout::sm_CbSongItemSelect(void *data, Evas_Object *obj, void *event_info)
+{
+ CCategoryLayout *root = (CCategoryLayout *)data;
+ if (root)
+ root->m_OnSongItemSelect(obj, (Elm_Object_Item *)event_info);
+}
+
+
+void CCategoryLayout::m_OnSongItemSelect(Evas_Object *obj, Elm_Object_Item *event_info)
+{
+ SCatItemInfo *itinfo = NULL;
+ char *id = NULL;
+
+ if (!m || !obj)
+ return;
+
+ itinfo = m_FindItemInfo(m->it_infolist, (Elm_Object_Item *)event_info);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ if (m->c_sinfo) {
+ song_info_destroy(m->c_sinfo);
+ m->c_sinfo = NULL;
+ }
+ m->c_sinfo = song_info_duplicate(itinfo->sinfo);
+ if (!m->c_sinfo)
+ return;
+
+ id = song_info_get_media_id(m->c_sinfo);
+ if (!id) {
+ song_info_destroy(m->c_sinfo);
+ m->c_sinfo = NULL;
+ return;
+ }
+
+ m_GotoPlayback(ADD_TYPE_FRESH, id);
+}
+
+
+void CCategoryLayout::sm_CbSelectlistItemSelect(void *data, Evas_Object *obj, void *event_info)
+{
+ CCategoryLayout *root = (CCategoryLayout *)data;
+ if (root)
+ root->m_OnSelectlistItemSelect(obj, (Elm_Object_Item *)event_info);
+}
+
+
+void CCategoryLayout::m_OnSelectlistItemSelect(Evas_Object *obj, void *event_info)
+{
+ SCatItemInfo *itinfo = NULL;
+ int tc;
+
+ if (!obj)
+ return;
+
+ itinfo = m_FindItemInfo(m->it_infolist, (Elm_Object_Item *)event_info);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ tc = eina_list_count(m->it_infolist);
+ if (itinfo->check_status) {
+ if (tc == m->count)
+ elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
+ _(MUSIC_TEXT_SELECT_ALL));
+ m->count = m->count - 1;
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_CHECK_OFF, MUSIC_BASE_VIEW);
+ itinfo->check_status = false;
+ }
+ else {
+ m->count = m->count + 1;
+ if (tc == m->count)
+ elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
+ _(MUSIC_TEXT_DESELECT_ALL));
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_CHECK_ON, MUSIC_BASE_VIEW);
+ itinfo->check_status = true;
+ }
+}
+
+
+void CCategoryLayout::sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+
+ if (root)
+ root->t_OnCtxtUpdate(type, lid);
+}
+
+
+void CCategoryLayout::t_OnCtxtUpdate(enum EActionType type, int lid)
+{
+ Eina_List *list = NULL;
+ Eina_List *alist = NULL, *slist = NULL, *l = NULL, *sl = NULL;
+ SSongInfo *sinfo = NULL;
+ album_info *alinfo = NULL;
+ void *obj = NULL;
+ EAddType mode;
+
+ 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 = (SSongInfo *)t.ctxtinfo->context;
+ list = eina_list_append(list, sinfo);
+ }
+ else if (t.depth == E_DEPTH_ALBUM) {
+ m->pMusicController->MediaGetList(LIST_TYPE_ALBUM_SONG,
+ t.ctxtinfo->context, &list);
+ sinfo = (SSongInfo *)eina_list_data_get(list);
+ }
+ else {
+ alist = category_info_get_albumlist((category_info *)t.ctxtinfo->context);
+ EINA_LIST_FOREACH(alist, l, obj) {
+ alinfo = (album_info *)obj;
+ slist = NULL;
+ if (!m->pMusicController->MediaGetList(LIST_TYPE_ALBUM_SONG, (void *)alinfo, &slist)) {
+ _ERR(" Failed to get album songlist ");
+ continue;
+ }
+ EINA_LIST_FOREACH(slist, sl, obj) {
+ sinfo = (SSongInfo *)obj;
+ list = eina_list_append(list,
+ song_info_duplicate((SSongInfo *)sinfo));
+ }
+ eina_list_free(slist);
+ }
+ sinfo = (SSongInfo *)eina_list_data_get(list);
+ }
+
+ if (type == ACTION_TYPE_ADDTO) {
+ if (!m->pMusicController->MediaAddsongsPlaylist(lid, list))
+ _ERR(" Adding songs to playlist failed ");
+ else
+ _create_message_box(t.base, MUSIC_TEXT_ADDTO_MSG);
+
+ if (t.depth == E_DEPTH_CATEGORY) {
+ EINA_LIST_FREE(list, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+ }
+
+ return;
+ }
+
+ m->pMusicController->UpdatePlaylist(list, mode);
+ if (type == ACTION_TYPE_PLAY) {
+ m->pMusicController->Stop();
+ m->pMusicController->SetCurrentSong(song_info_get_media_id((SSongInfo *)sinfo));
+ }
+
+ if (t.depth == E_DEPTH_CATEGORY) {
+ EINA_LIST_FREE(list, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+ }
+ else {
+ eina_list_free(list);
+ }
+
+ _update_playback_view((EAddType)type, Layout(), t.focused_item);
+}
+
+
+void CCategoryLayout::sm_CbCtxtClose(void *dt)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+ if (root)
+ root->m_OnCtxtClose();
+}
+
+
+void CCategoryLayout::m_OnCtxtClose(void)
+{
+ m->vmgr->PopView();
+ m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
+ elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+}
+
+
+char *CCategoryLayout::sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SCatItemInfo *itinfo = (SCatItemInfo *)data;
+ int scount, acount;
+ const char *txt = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!itinfo || !obj || !part)
+ return NULL;
+
+ if (!strcmp(part, "elm.text")) {
+ if (itinfo->type == CAT_TYPE_PLAYLIST_NEW)
+ return strdup(_(MUSIC_TEXT_CREATE_PLAYLIST));
+
+ txt = category_info_get_name(itinfo->catinfo);
+ if (txt)
+ return strdup(txt);
+ }
+ else if (!strcmp(part, "elm.text1")) {
+ if (itinfo->type == CAT_TYPE_PLAYLIST_NEW) {
+ return NULL;
+ }
+ else if (itinfo->type == CAT_TYPE_PLAYLISTS) {
+ scount = category_info_get_songcount(itinfo->catinfo);
+ snprintf(buf, sizeof(buf), "%d %s", scount, _("Songs"));
+ }
+ else {
+ acount = category_info_get_albumcount(itinfo->catinfo);
+ scount = category_info_get_songcount(itinfo->catinfo);
+ snprintf(buf, sizeof(buf), "%d %s, %d %s", acount,
+ _("Albums"), scount, _("Songs"));
+ }
+ return strdup(buf);
+ }
+
+ return NULL;
+}
+
+
+char *CCategoryLayout::sm_CbGetGridAlbumItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SCatItemInfo *itinfo = (SCatItemInfo *)data;
+ album_info *alinfo = NULL;
+ char *txt = NULL;
+
+ if (!itinfo || !obj || !part)
+ return NULL;
+
+ alinfo = itinfo->alinfo;
+
+ if (!strcmp(part, "elm.text")) {
+ txt = album_info_get_name(alinfo);
+ if (txt)
+ return strdup(txt);
+ }
+ else if (!strcmp(part, "elm.text1")) {
+ if (itinfo->type == CAT_TYPE_ARTIST)
+ txt = album_info_get_artist(alinfo);
+ else
+ txt = album_info_get_genre(alinfo);
+ if (txt)
+ return strdup(txt);
+ }
+
+ return NULL;
+}
+
+
+Evas_Object *CCategoryLayout::sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part)
+{
+ SCatItemInfo *itinfo = (SCatItemInfo *)data;
+ album_info *alinfo = NULL;
+ void *list_obj = NULL;
+ Eina_List *l = NULL, *alist = NULL;
+ Evas_Object *img = NULL;
+ char *path = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!itinfo || !obj || !part)
+ return NULL;
+
+ if (!itinfo->catinfo && itinfo->type != CAT_TYPE_PLAYLIST_NEW)
+ return NULL;
+
+ if (strcmp(part, "elm.swallow.icon"))
+ return NULL;
+
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ path = NULL;
+
+ if (itinfo->type == CAT_TYPE_ARTIST || itinfo->type == CAT_TYPE_GENRE) {
+ alist = category_info_get_albumlist(itinfo->catinfo);
+ if (alist) {
+ EINA_LIST_FOREACH(alist, l, list_obj) {
+ alinfo = (album_info *)list_obj;
+ path = album_info_get_thumb(alinfo);
+ if (path)
+ break;
+ }
+ }
+ }
+ else if (itinfo->type == CAT_TYPE_PLAYLISTS) {
+ path = category_info_get_thumb(itinfo->catinfo);
+ }
+
+ if (!path) {
+ if (itinfo->type == CAT_TYPE_PLAYLIST_NEW)
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_CREATE_PLAYLIST);
+ else
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(img, buf, NULL);
+ elm_image_no_scale_set(img, EINA_TRUE);
+ }
+ else {
+ elm_image_file_set(img, path, NULL);
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+ }
+
+ return img;
+}
+
+
+Evas_Object *CCategoryLayout::sm_CbGetGridAlbumitemContent(void *data, Evas_Object *obj, const char *part)
+{
+ SCatItemInfo *itinfo = (SCatItemInfo *)data;
+ album_info *alinfo = NULL;
+ char *path = NULL;
+ Evas_Object *img = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!itinfo || !obj || !part)
+ return NULL;
+
+ alinfo = itinfo->alinfo;
+
+ if (strcmp(part, "elm.swallow.icon"))
+ return NULL;
+
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ path = album_info_get_thumb(alinfo);
+ if (!path) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(img, buf, NULL);
+ elm_image_no_scale_set(img, EINA_TRUE);
+ }
+ else {
+ elm_image_file_set(img, path, NULL);
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+ }
+
+ return img;
+}
+
+
+void CCategoryLayout::sm_CbRemoveGridItem(void *data, Evas_Object *obj)
+{
+ free(data);
+}
+
+
+void CCategoryLayout::sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source)
+{
+ CCategoryLayout *root = (CCategoryLayout *)data;
+ if (root)
+ root->m_OnItemSelect(it, emission, source);
+}
+
+
+void CCategoryLayout::m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source)
+{
+ SCatItemInfo *itinfo = NULL;
+
+ itinfo = m_FindItemInfo(m->it_infolist, it);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ if (t.depth == E_DEPTH_ALBUM) {
+ if (t.c_alinfo) {
+ album_info_destroy(t.c_alinfo);
+ t.c_alinfo = NULL;
+ }
+ t.c_alinfo = album_info_duplicate(itinfo->alinfo);
+ t.depth = E_DEPTH_SONG;
+ }
+ else {
+ if (t.c_catinfo) {
+ category_info_destroy(t.c_catinfo);
+ t.c_catinfo = NULL;
+ }
+
+ t_HandleItemSelect(itinfo);
+ }
+
+ t_UpdateLayoutWithFocus();
+}
+
+
+void CCategoryLayout::sm_CbGengridRealized(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!data || !obj || !event_info)
+ return;
+
+ elm_object_item_signal_callback_add((Elm_Object_Item *)event_info,
+ MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+ sm_CbItemSelect, data);
+}
+
+
+void CCategoryLayout::sm_CbGengridUnrealized(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!data || !obj || !event_info)
+ return;
+
+ elm_object_item_signal_callback_del((Elm_Object_Item *)event_info,
+ MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+ sm_CbItemSelect);
+}
+
+
+void CCategoryLayout::sm_CbKeyDown(void *dt, Evas *e, Evas_Object *obj, void *ei)
+{
+ CCategoryLayout *root = (CCategoryLayout *)dt;
+
+ if (root)
+ root->m_OnKeyDown(e, obj, (Evas_Event_Key_Down*)ei);
+}
+
+
+void CCategoryLayout::m_OnKeyDown(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ Elm_Object_Item *it = NULL;
+ SContentInfo *ctxtinfo = NULL;
+ SCatItemInfo *itinfo = NULL;
+
+ if (!obj)
+ return;
+
+ if (strcmp(ev->keyname, KEY_MENU) || t.depth ==
+ E_DEPTH_SELECT_LIST || t.depth ==
+ E_DEPTH_SHOW_LIST)
+ return;
+
+ it = elm_object_focused_item_get(obj);
+ if (!it) {
+ _ERR(" unable to get focused item ");
+ return;
+ }
+ t.focused_item = it;
+
+ if (t.ctxtinfo) {
+ free(t.ctxtinfo);
+ t.ctxtinfo = NULL;
+ }
+
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!ctxtinfo)
+ return;
+
+ itinfo = m_FindItemInfo(m->it_infolist, it);
+ if (!itinfo || itinfo->type == CAT_TYPE_PLAYLIST_NEW) {
+ free(ctxtinfo);
+ return;
+ }
+
+ 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) {
+ ctxtinfo->type = CONTEXT_TYPE_ALBUM;
+ ctxtinfo->context = itinfo->alinfo;
+ }
+ else {
+ ctxtinfo->type = t_ContextType();
+ ctxtinfo->context = itinfo->catinfo;
+ }
+
+ t.ctxtinfo = ctxtinfo;
+
+ SParcel parcel;
+ parcel.ctxtInfo = ctxtinfo;
+ if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+ _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
+}
+
+
+int CCategoryLayout::m_ConvertToMin(int milsec)
+{
+ int min;
+
+ min = milsec / 60000; /*milli seconds per minute*/
+
+ return min;
+}
+
+
+void CCategoryLayout::m_RemoveFocusIdler(void)
+{
+ if (!m->focus_idler)
+ return;
+
+ ecore_idler_del(m->focus_idler);
+ m->focus_idler = NULL;
+}
+
+
+Elm_Object_Item *CCategoryLayout::m_FindItemByInfo(Eina_List *list, void *info)
+{
+ Eina_List *l = NULL;
+ SCatItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ int id;
+
+ if (!list || !info)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SCatItemInfo *)obj;
+ if (!itinfo->catinfo)
+ continue;
+
+ id = category_info_get_category_id(itinfo->catinfo);
+ if (id == category_info_get_category_id((category_info *)info))
+ return itinfo->item;
+ }
+
+ return NULL;
+}
+
+
+CCategoryLayout::SCatItemInfo *CCategoryLayout::m_FindItemInfo(Eina_List *list, Elm_Object_Item *item)
+{
+ Eina_List *l = NULL;
+ SCatItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ if (!list || !item)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SCatItemInfo *)obj;
+ if (itinfo->item == item)
+ return itinfo;
+ }
+
+ return NULL;
+}
+
+
+void CCategoryLayout::m_GotoPlayback(int mode, char *id)
+{
+ if (!m->it_infolist || eina_list_count(m->it_infolist) == 0) {
+ _create_message_box(Layout(), MUSIC_TEXT_NO_SONGS);
+ _ERR(" No songs for playback ");
+ return;
+ }
+
+ if (t.depth == E_DEPTH_ALBUM)
+ m_AddAlbumsToPlayback(mode);
+ else if (t.depth == E_DEPTH_SONG ||
+ t.depth == E_DEPTH_SHOW_LIST)
+ m_AddSongsToPlayback(mode);
+ else
+ return;
+
+ if (mode == ADD_TYPE_FRESH) {
+ m->pMusicController->Stop();
+ if (id) /* If want to play selected song */
+ m->pMusicController->SetCurrentSong(id);
+ }
+
+ _update_playback_view((EAddType)mode, Layout(), NULL);
+}
+
+
+Eina_List *CCategoryLayout::m_GetSelectedList(Eina_List *infolist, int type)
+{
+ Eina_List *idlist = NULL, *l = NULL;
+ SCatItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ char *id = NULL;
+ EIdType eType = (EIdType)type;
+
+ if (!infolist)
+ return NULL;
+
+ idlist = NULL;
+ EINA_LIST_FOREACH(infolist, l, obj) {
+ itinfo = (SCatItemInfo *)obj;
+ if (!itinfo->check_status)
+ continue;
+
+ if (eType == ID_TYPE_MEDIA) {
+ id = song_info_get_media_id(itinfo->sinfo);
+ if (id)
+ idlist = eina_list_append(idlist, id);
+ }
+ else {
+ idlist = eina_list_append(idlist,
+ itinfo->sinfo);
+ }
+ }
+
+ return idlist;
+}
+
+
+void CCategoryLayout::m_AddSelectedSongs(void)
+{
+ Eina_List *idlist = NULL;
+ int lid;
+
+ if (!t.c_catinfo)
+ return;
+
+ lid = category_info_get_category_id(t.c_catinfo);
+ idlist = m_GetSelectedList(m->it_infolist, (int)ID_TYPE_MEDIA);
+
+ if (!lid || !idlist)
+ return;
+
+ if (!m->pMusicController->MediaAddmediaPlaylist(lid, idlist)) {
+ _ERR(" Failed to add songs to playlist ");
+ return;
+ }
+
+ t.depth = E_DEPTH_CATEGORY;
+ t_UpdateLayoutWithFocus();
+}
+
+
+void CCategoryLayout::m_RemoveSelectedSongs(void)
+{
+ Eina_List *idlist = NULL;
+ int lid;
+
+ if (!t.c_catinfo)
+ return;
+
+ lid = category_info_get_category_id(t.c_catinfo);
+ idlist = m_GetSelectedList(m->it_infolist, (int)ID_TYPE_MEMBER);
+
+ if (!lid || !idlist)
+ return;
+
+ if (!m->pMusicController->MediaRemovemediaPlaylist(lid, idlist)) {
+ _ERR(" Failed to remove songs from playlist ");
+ return;
+ }
+
+ t.depth = E_DEPTH_CATEGORY;
+ t_UpdateLayoutWithFocus();
+}
+
+
+void CCategoryLayout::m_AddAlbumsToPlayback(int mode)
+{
+ Eina_List *l = NULL, *sl = NULL;
+ Eina_List *slist = NULL;
+ Eina_List *list = NULL;
+ SSongInfo *sinfo = NULL;
+ SCatItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ Eina_List *infolist = m->it_infolist;
+ CMusicController *pMusicController = m->pMusicController;
+
+ list = NULL;
+ EINA_LIST_FOREACH(infolist, l, obj) {
+ itinfo = (SCatItemInfo *)obj;
+ slist = NULL;
+ if (!pMusicController->MediaGetList(LIST_TYPE_ALBUM_SONG, itinfo->alinfo, &slist)) {
+ _ERR(" Failed to get album songlist ");
+ continue;
+ }
+
+ EINA_LIST_FOREACH(slist, sl, obj) {
+ sinfo = (SSongInfo *)obj;
+ list = eina_list_append(list,
+ song_info_duplicate(sinfo));
+ }
+
+ eina_list_free(slist);
+ }
+
+ pMusicController->UpdatePlaylist(list, mode);
+ EINA_LIST_FREE(list, obj) {
+ sinfo = (SSongInfo *)obj;
+ song_info_destroy(sinfo);
+ }
+}
+
+
+void CCategoryLayout::m_AddSongsToPlayback(int mode)
+{
+ Eina_List *l = NULL;
+ Eina_List *list = NULL;
+ struct SCatItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ Eina_List *infolist = m->it_infolist;
+ CMusicController *pMusicController = m->pMusicController;
+
+ list = NULL;
+ EINA_LIST_FOREACH(infolist, l, obj) {
+ itinfo = (SCatItemInfo *)obj;
+ list = eina_list_append(list, itinfo->sinfo);
+ }
+
+ pMusicController->UpdatePlaylist(list, mode);
+ eina_list_free(list);
+}
+
+
+Evas_Object *CCategoryLayout::m_AddAlbumCover(void)
+{
+ Evas_Object *album_cover = NULL;
+
+ album_cover = elm_image_add(Layout());
+ if (!album_cover)
+ return NULL;
+
+ evas_object_size_hint_weight_set(album_cover, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ return album_cover;
+}
+
+
+Evas_Object *CCategoryLayout::m_AddGrid(void)
+{
+ Evas_Object *grid = NULL;
+
+ grid = elm_gengrid_add(Layout());
+ if (!grid)
+ return NULL;
+
+ evas_object_size_hint_weight_set(grid,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_gengrid_align_set(grid, 0, 0);
+ evas_object_event_callback_add(grid, EVAS_CALLBACK_MOUSE_MOVE, _gengrid_mouse_moved, this);
+ evas_object_smart_callback_add(grid, MUSIC_SIGNAL_REALIZED, sm_CbGengridRealized, this);
+ evas_object_smart_callback_add(grid, MUSIC_SIGNAL_UNREALIZED, sm_CbGengridUnrealized, this);
+ evas_object_event_callback_add(grid, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyDown, this);
+ elm_gengrid_item_size_set(grid,
+ elm_config_scale_get() * GENGRID_ITEM_SIZE_W,
+ elm_config_scale_get() * GENGRID_ITEM_SIZE_H);
+
+ return grid;
+}
+
+
+void CCategoryLayout::m_AddCategoryItem(Elm_Gengrid_Item_Class *grid_item, ECategoryType type, void *info)
+{
+ SCatItemInfo *itinfo = NULL;
+ Elm_Object_Item *item = NULL;
+
+ if (!grid_item)
+ return;
+
+ itinfo = (SCatItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+
+ itinfo->catinfo = (category_info *)info;
+ itinfo->type = type;
+ item = elm_gengrid_item_append(t.grid,
+ grid_item, itinfo, NULL, m);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist,
+ itinfo);
+}
+
+
+void CCategoryLayout::m_AddButtons(void)
+{
+ int i;
+ Evas_Object *img = NULL;
+ char buf[MAX_LENGTH];
+ SBtnInfo btninfo[TOTAL_ADD_BTNS];
+
+ btninfo[ABTN_PLAY].name = MUSIC_STR_PLAY;
+ btninfo[ABTN_PLAY].part = MUSIC_PART_CATEGORY_PLAYBTN;
+ btninfo[ABTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
+ btninfo[ABTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
+ btninfo[ABTN_PLAY].cb = sm_CbPlayBtnClicked;
+
+ btninfo[ABTN_NEXT].name = MUSIC_STR_ADDNEXT;
+ btninfo[ABTN_NEXT].part = MUSIC_PART_CATEGORY_NEXTBTN;
+ btninfo[ABTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
+ btninfo[ABTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
+ btninfo[ABTN_NEXT].cb = sm_CbNextBtnClicked;
+
+ btninfo[ABTN_LAST].name = MUSIC_STR_ADDLAST;
+ btninfo[ABTN_LAST].part = MUSIC_PART_CATEGORY_LASTBTN;
+ btninfo[ABTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
+ btninfo[ABTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
+ btninfo[ABTN_LAST].cb = sm_CbLastBtnClicked;
+
+ if (t.depth == E_DEPTH_SHOW_LIST) {
+ btninfo[ABTN_PLAY].part = MUSIC_PART_ALBUM_PLAYBTN;
+ btninfo[ABTN_NEXT].part = MUSIC_PART_ALBUM_NEXTBTN;
+ btninfo[ABTN_LAST].part = MUSIC_PART_ALBUM_LASTBTN;
+ }
+
+ for (i = 0; i < TOTAL_ADD_BTNS; i++) {
+ m->add_btn[i] = elm_button_add(Layout());
+ if (!m->add_btn[i])
+ continue;
+
+ evas_object_size_hint_weight_set(m->add_btn[i],
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(m->add_btn[i], _(btninfo[i].name));
+ elm_object_style_set(m->add_btn[i], btninfo[i].style);
+ evas_object_smart_callback_add(m->add_btn[i],
+ MUSIC_SIGNAL_CLICKED, btninfo[i].cb, this);
+ evas_object_event_callback_add(m->add_btn[i],
+ EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, this);
+
+ img = elm_image_add(m->add_btn[i]);
+ if (img) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ btninfo[i].icon);
+ elm_image_file_set(img, buf, NULL);
+ elm_object_part_content_set(m->add_btn[i],
+ MUSIC_PART_ELM_SWALLOWICON, img);
+ }
+
+ elm_object_part_content_set(Layout(), btninfo[i].part, m->add_btn[i]);
+ }
+
+ elm_object_focus_set(m->add_btn[ABTN_PLAY], EINA_TRUE);
+ m->def_foc_btn = m->add_btn[ABTN_PLAY];
+}
+
+
+void CCategoryLayout::m_AddSelectlistButtons(void)
+{
+ int i;
+ Evas_Object *btn = NULL;
+ SBtnInfo btninfo[TOTAL_SELECT_BTNS];
+
+ btninfo[SBTN_SELECT_ALL].name = MUSIC_TEXT_SELECT_ALL;
+ btninfo[SBTN_SELECT_ALL].part = MUSIC_PART_LIST_SELECT_ALL;
+ btninfo[SBTN_SELECT_ALL].style = MUSIC_STYLE_LIST_BTN;
+ btninfo[SBTN_SELECT_ALL].cb = sm_CbSelectAllClicked;
+
+ btninfo[SBTN_DONE].name = MUSIC_TEXT_LIST_DONE;
+ btninfo[SBTN_DONE].part = MUSIC_PART_LIST_DONE_BTN;
+ btninfo[SBTN_DONE].style = MUSIC_STYLE_LIST_BTN;
+ btninfo[SBTN_DONE].cb = sm_CbDoneBtnClicked;
+
+ btninfo[SBTN_CANCEL].name = MUSIC_TEXT_LIST_CANCEL;
+ btninfo[SBTN_CANCEL].part = MUSIC_PART_LIST_CANCEL_BTN;
+ btninfo[SBTN_CANCEL].style = MUSIC_STYLE_LIST_BTN;
+ btninfo[SBTN_CANCEL].cb = sm_CbCancelBtnClicked;
+
+ if (t.sel_type == SELECT_CREATE) {
+ elm_object_part_text_set(Layout(), MUSIC_PART_LIST_MSG,
+ _(MUSIC_TEXT_LIST_CREATE_MSG));
+ }
+ else if (t.sel_type == SELECT_ADD) {
+ elm_object_part_text_set(Layout(), MUSIC_PART_LIST_MSG,
+ _(MUSIC_TEXT_LIST_ADD_MSG));
+ }
+ else if (t.sel_type == SELECT_REMOVE) {
+ elm_object_part_text_set(Layout(), MUSIC_PART_LIST_MSG,
+ _(MUSIC_TEXT_LIST_REMOVE_MSG));
+ }
+
+ for (i = 0; i < TOTAL_SELECT_BTNS; i++) {
+ btn = elm_button_add(Layout());
+ if (!btn)
+ continue;
+
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_object_text_set(btn, _(btninfo[i].name));
+ elm_object_style_set(btn, btninfo[i].style);
+ evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED,
+ btninfo[i].cb, this);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
+ _object_mouse_moved, this);
+
+ elm_object_part_content_set(Layout(), btninfo[i].part, btn);
+ m->select_btn[i] = btn;
+ }
+
+ elm_object_focus_set(btn, EINA_TRUE);
+ m->def_foc_btn = btn;
+}
+
+
+void CCategoryLayout::m_CreateSongsTopSection(void)
+{
+ char *path = NULL;
+ char buf[MAX_LENGTH];
+
+ m_AddButtons();
+
+ m->albumCover = m_AddAlbumCover();
+ if (!m->albumCover)
+ return;
+
+ if (t.depth == E_DEPTH_SHOW_LIST)
+ path = category_info_get_thumb(t.c_catinfo);
+ else
+ path = album_info_get_thumb(t.c_alinfo);
+
+ if (path) {
+ elm_image_file_set(m->albumCover, path, NULL);
+ elm_image_aspect_fixed_set(m->albumCover, EINA_FALSE);
+ }
+ else {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(m->albumCover, buf, NULL);
+ elm_image_no_scale_set(m->albumCover, EINA_TRUE);
+ }
+ elm_object_part_content_set(Layout(), MUSIC_PART_ALBUM_THUMB, m->albumCover);
+
+ if (t.depth == E_DEPTH_SHOW_LIST) {
+ elm_object_part_text_set(Layout(), MUSIC_PART_ALBUM_NAME,
+ category_info_get_name(t.c_catinfo));
+ }
+ else {
+ elm_object_part_text_set(Layout(),
+ MUSIC_PART_CATEGORY_NAME,
+ category_info_get_name(t.c_catinfo));
+ elm_object_part_text_set(Layout(), MUSIC_PART_ALBUM_NAME,
+ album_info_get_name(t.c_alinfo));
+ elm_object_part_text_set(Layout(), MUSIC_PART_ALBUM_ARTIST,
+ album_info_get_artist(t.c_alinfo));
+ }
+
+ snprintf(buf, sizeof(buf), "%d %s",
+ m_ConvertToMin(m->total_duration), _("min"));
+ elm_object_part_text_set(Layout(), MUSIC_PART_ALBUM_TIME, buf);
+ snprintf(buf, sizeof(buf), "%d", eina_list_count(m->songlist));
+ elm_object_part_text_set(Layout(), MUSIC_PART_ALBUM_SONGCOUNT, buf);
+}
+
+
+void CCategoryLayout::m_CreateSongList(void)
+{
+ Evas_Object *genlist = NULL;
+ Elm_Genlist_Item_Class *list_item = NULL;
+ bool r;
+ struct SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+ struct SCatItemInfo *itinfo = NULL;
+ Elm_Object_Item *item = NULL;
+ int dur;
+ void (*item_select_fn)(void *, Evas_Object *, void *) = NULL;
+
+ genlist = elm_genlist_add(Layout());
+ if (!genlist)
+ return;
+
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+
+ evas_object_size_hint_weight_set(genlist,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(Layout(), MUSIC_PART_SONGLIST, genlist);
+ evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_MOVE, _genlist_mouse_moved, this);
+ evas_object_event_callback_add(genlist, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyDown, this);
+ m->glist = genlist;
+
+ list_item = elm_genlist_item_class_new();
+ if (!list_item) {
+ evas_object_del(genlist);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ list_item->func.content_get = NULL;
+ list_item->func.state_get = NULL;
+ list_item->func.del = sm_CbRemoveListItem;
+ m->count = 0;
+
+ if (t.depth == E_DEPTH_SELECT_LIST) {
+ list_item->func.text_get = sm_CbGetSelectlistItemText;
+ list_item->item_style = MUSIC_STYLE_SELECT_LIST;
+ item_select_fn = sm_CbSelectlistItemSelect;
+ if (t.sel_type == SELECT_REMOVE) {
+ r = m->pMusicController->MediaGetList(LIST_TYPE_PLAYLISTS_SONG, t.c_catinfo, &(m->songlist));
+ }
+ else {
+ r = m->pMusicController->MediaGetList(LIST_TYPE_SONG, NULL, &(m->songlist));
+ }
+ }
+ else {
+ list_item->func.text_get = sm_CbGetListItemText;
+ list_item->item_style = MUSIC_STYLE_ALBUM_SONGLIST;
+ item_select_fn = sm_CbSongItemSelect;
+ if (t.depth == E_DEPTH_SHOW_LIST)
+ r = m->pMusicController->MediaGetList(LIST_TYPE_PLAYLISTS_SONG, t.c_catinfo, &(m->songlist));
+ else
+ r = m->pMusicController->MediaGetList(LIST_TYPE_ALBUM_SONG, t.c_alinfo, &(m->songlist));
+ }
+
+ if (r == false) {
+ _ERR(" Fetching song list from media failed ");
+ evas_object_del(genlist);
+ elm_genlist_item_class_free(list_item);
+ return;
+ }
+
+ EINA_LIST_FOREACH(m->songlist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ itinfo = (SCatItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+
+ itinfo->sinfo = sinfo;
+ item = elm_genlist_item_append(genlist, list_item,
+ itinfo, NULL, ELM_GENLIST_ITEM_NONE,
+ item_select_fn, this);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist, itinfo);
+ dur = 0;
+ song_info_get_duration(sinfo, &dur);
+ m->total_duration = m->total_duration + dur;
+ }
+ elm_genlist_item_class_free(list_item);
+}
+
+
+void CCategoryLayout::m_CreateAlbumgrid(void)
+{
+ album_info *alinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+ SCatItemInfo *itinfo = NULL;
+ Elm_Object_Item *item = NULL;
+ char buf[MAX_LENGTH];
+ Elm_Gengrid_Item_Class *grid_item = NULL;
+
+ t.grid = m_AddGrid();
+ if (!t.grid)
+ return;
+
+ grid_item = elm_gengrid_item_class_new();
+ if (!grid_item) {
+ evas_object_del(t.grid);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ grid_item->item_style = MUSIC_STYLE_CATEGORY_GRID;
+ grid_item->func.text_get = sm_CbGetGridAlbumItemText;
+ grid_item->func.content_get = sm_CbGetGridAlbumitemContent;
+ grid_item->func.state_get = NULL;
+ grid_item->func.del = sm_CbRemoveGridItem;
+
+ m->alblist = category_info_get_albumlist(t.c_catinfo);
+ if (!m->alblist || eina_list_count(m->alblist) == 0) {
+ _ERR(" Fetching album list failed ");
+ evas_object_del(t.grid);
+ elm_gengrid_item_class_free(grid_item);
+ return;
+ }
+
+ EINA_LIST_FOREACH(m->alblist, l, obj) {
+ alinfo = (album_info *)obj;
+ itinfo = (SCatItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+ itinfo->alinfo = alinfo;
+ item = elm_gengrid_item_append(t.grid,
+ grid_item, itinfo, NULL, m);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist,
+ itinfo);
+ }
+ elm_gengrid_item_class_free(grid_item);
+
+ elm_object_part_text_set(Layout(),
+ MUSIC_PART_CATEGORY_NAME,
+ category_info_get_name(t.c_catinfo));
+ snprintf(buf, sizeof(buf), "%d",
+ category_info_get_albumcount(t.c_catinfo));
+ elm_object_part_text_set(Layout(),
+ MUSIC_PART_CATEGORY_ALBUMCOUNT, buf);
+ snprintf(buf, sizeof(buf), "%d",
+ category_info_get_songcount(t.c_catinfo));
+ elm_object_part_text_set(Layout(),
+ MUSIC_PART_CATEGORY_SONGCOUNT, buf);
+ elm_object_part_content_set(Layout(),
+ MUSIC_PART_CATEGORY_ALBUM_GRID, t.grid);
+}
+
+
+void CCategoryLayout::m_CreateCatgrid(bool sort_flag)
+{
+ void *info = NULL;
+ Eina_List *l = NULL;
+ Elm_Gengrid_Item_Class *grid_item = NULL;
+
+ t.grid = m_AddGrid();
+ if (!t.grid)
+ return;
+
+ grid_item = elm_gengrid_item_class_new();
+ if (!grid_item) {
+ evas_object_del(t.grid);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ grid_item->item_style = MUSIC_STYLE_CATEGORY_GRID;
+ grid_item->func.text_get = sm_CbGetGridItemText;
+ grid_item->func.content_get = sm_CbGetGridItemContent;
+ grid_item->func.state_get = NULL;
+ grid_item->func.del = sm_CbRemoveGridItem;
+
+ if (!sort_flag) {
+ if (!t_GetMediaList(&m->catlist)) {
+ if (t_CategoryType() != CAT_TYPE_PLAYLISTS) {
+ _ERR(" Fetching list failed ");
+ SetEmptyStatus(true);
+ elm_gengrid_item_class_free(grid_item);
+ return;
+ }
+ }
+ }
+ m_SortCatgrid();
+
+ if (t_CategoryType() == CAT_TYPE_PLAYLISTS)
+ m_AddCategoryItem(grid_item, CAT_TYPE_PLAYLIST_NEW, NULL);
+
+ EINA_LIST_FOREACH(m->catlist, l, info)
+ m_AddCategoryItem(grid_item, t_CategoryType(), info);
+
+ elm_gengrid_item_class_free(grid_item);
+
+ elm_object_part_content_set(Layout(),
+ MUSIC_PART_CATEGORY_GRID, t.grid);
+}
+
+
+void CCategoryLayout::m_SortCatgrid(void)
+{
+ int(*_sort[])(const void *d1, const void *d2) = {
+ sortcategorys_az,
+ sortcategorys_za
+ };
+ int sort_type;
+
+ if (!m->catlist)
+ return;
+
+ sort_type = m->pMusicController->SortType();
+ m->catlist = eina_list_sort(m->catlist, 0,
+ _sort[sort_type]);
+}
+
+
+void CCategoryLayout::m_EmptyLayout(bool sort_flag)
+{
+ if (t.grid)
+ elm_gengrid_clear(t.grid);
+
+ if (m->glist)
+ elm_genlist_clear(m->glist);
+
+ if (!sort_flag) {
+ if (m->catlist) {
+ eina_list_free(m->catlist);
+ m->catlist = NULL;
+ }
+ }
+
+ if (m->alblist) {
+ eina_list_free(m->alblist);
+ m->alblist = NULL;
+ }
+
+ if (m->songlist) {
+ eina_list_free(m->songlist);
+ m->songlist = NULL;
+ }
+
+ if (m->it_infolist) {
+ eina_list_free(m->it_infolist);
+ m->it_infolist = NULL;
+ }
+
+ m->total_duration = 0;
+
+ int i;
+
+ for (i = 0; i < TOTAL_ADD_BTNS; i++) {
+ if (m->add_btn[i])
+ evas_object_del(m->add_btn[i]);
+ m->add_btn[i] = NULL;
+ }
+
+ for (i = 0; i < TOTAL_SELECT_BTNS; i++) {
+ if (m->select_btn[i])
+ evas_object_del(m->select_btn[i]);
+ m->select_btn[i] = NULL;
+ }
+
+ if (m->albumCover)
+ evas_object_del(m->albumCover);
+ m->albumCover = NULL;
+
+ evas_object_hide(Layout());
+ elm_object_part_content_unset(t.base, MUSIC_PART_CONTENT);
+}
+
+
+
+bool CCategoryLayout::t_SetEdje(const char *szLayout)
+{
+ ASSERT(szLayout);
+ if (!elm_layout_file_set(Layout(), EDJEFILE, szLayout)) {
+ _ERR(" elm szLayout file set failed ");
+ return false;
+ }
+ return true;
+}
+
+
+void CCategoryLayout::t_UpdateLayout(bool sort_flag)
+{
+ /* Remove existing grid and prepare afresh */
+ m_EmptyLayout(sort_flag);
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+
+ if (t.depth == E_DEPTH_SONG) {
+ if (!t_SetEdje(MUSIC_CATEGORY_SONGS_LAYOUT)) {
+ _ERR(" get layout failed ");
+ return;
+ }
+ m_CreateSongList();
+ m_CreateSongsTopSection();
+
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_CATEGORY_SONGS_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+ else if (t.depth == E_DEPTH_SHOW_LIST) {
+ if (!t_SetEdje(MUSIC_ALBUM_SONGS_LAYOUT)) {
+ _ERR(" get layout failed ");
+ return;
+ }
+ m_CreateSongList();
+ m_CreateSongsTopSection();
+
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_CATEGORY_SONGS_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+ else if (t.depth == E_DEPTH_ALBUM) {
+ if (!t_SetEdje(MUSIC_CATEGORY_ALBUM_LAYOUT)) {
+ _ERR(" get layout failed ");
+ return;
+ }
+ m_AddButtons();
+ m_CreateAlbumgrid();
+
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_CATEGORY_ALBUM_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+ else if (t.depth == E_DEPTH_SELECT_LIST) {
+ if (!t_SetEdje(MUSIC_CATEGORY_SELECTLIST_LAYOUT)) {
+ _ERR(" get layout failed ");
+ return;
+ }
+ m_CreateSongList();
+ m_AddSelectlistButtons();
+
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_CATEGORY_SELECTLIST_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ elm_object_focus_next_object_set(m->glist,
+ m->select_btn[SBTN_DONE], ELM_FOCUS_RIGHT);
+ }
+ else {
+ if (!t_SetEdje(MUSIC_CATEGORY_LAYOUT)) {
+ _ERR(" get layout failed ");
+ return;
+ }
+ m_CreateCatgrid(sort_flag);
+
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = MUSIC_CATEGORY_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+}
+
+
+void CCategoryLayout::t_UpdateLayoutWithFocus(void)
+{
+ elm_object_tree_focus_allow_set(t.base, EINA_FALSE);
+ t_UpdateLayout(false);
+ elm_object_part_content_set(t.base, MUSIC_PART_CONTENT, Layout());
+ evas_object_show(Layout());
+ m_RemoveFocusIdler();
+ m->focus_idler = ecore_idler_add(sm_CbFocusIdler, this);
+}
+
+
+bool CCategoryLayout::Create(CLayoutMgr *mgr)
+{
+ ASSERT(!m);
+
+ Evas_Object *base = NULL;
+ Evas_Object *win = NULL;
+ Evas_Object *layout = NULL;
+ CMusicController *pMusicController = NULL;
+ CViewMgr *vmgr = NULL;
+
+ if (!mgr)
+ return false;
+
+ m = new SCategoryLayout;
+ if (!m) {
+ _ERR(" calloc failed ");
+ return false;
+ }
+
+ vmgr = CViewMgr::GetInstance();
+ if (!vmgr) {
+ _ERR(" get view mgr failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ base = mgr->Base();
+ if (!base) {
+ _ERR(" get base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ win = vmgr->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ pMusicController = CMusicController::GetInstance();
+ if (!pMusicController) {
+ _ERR(" music controller get music instance failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ layout = elm_layout_add(base);
+ if (!layout) {
+ _ERR(" layout creation failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ bool r = CExtBaseLayout::Create(layout);
+ if (!r) {
+ _ERR(" CBaseLayout creation failed ");
+ evas_object_del(layout);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ m->win = win;
+ t.base = base;
+ m->vmgr = vmgr;
+ m->pMusicController = pMusicController;
+ m->lmgr = mgr;
+ t.depth = E_DEPTH_CATEGORY;
+
+ t_UpdateLayout(false);
+ Connect(Layout());
+
+ return true;
+}
+
+
+void CCategoryLayout::Destroy(void)
+{
+ ASSERT(m);
+
+ Disconnect(Layout());
+ if (t.epopup)
+ destroy_entry_popup(t.epopup);
+
+ m_RemoveFocusIdler();
+ m_EmptyLayout(false);
+ category_info_destroy(t.c_catinfo);
+ album_info_destroy(t.c_alinfo);
+ song_info_destroy(m->c_sinfo);
+ CExtBaseLayout::Destroy();
+ evas_object_del(Layout());
+
+ delete m;
+ m = NULL;
+}
+
+
+void CCategoryLayout::t_OnShow(void)
+{;
+ ASSERT(m);
+
+ t.depth = E_DEPTH_CATEGORY;
+ t_UpdateLayout(false);
+ elm_object_part_content_set(t.base, MUSIC_PART_CONTENT, Layout());
+ evas_object_show(Layout());
+}
+
+
+void CCategoryLayout::Update(bool focusFlag)
+{
+ ASSERT(m);
+
+ if (!focusFlag) {
+ if (t.depth != E_DEPTH_CATEGORY)
+ return;
+ t_UpdateLayout(true);
+ return;
+ }
+
+ elm_object_focus_set(t.grid, EINA_TRUE);
+}
+
+
+void CCategoryLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ int count;
+ Eina_List *alist = NULL;
+
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ if (t.depth == E_DEPTH_CATEGORY) {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_FOCUS_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ return;
+ }
+ else if (t.depth == E_DEPTH_ALBUM) {
+ t.depth = E_DEPTH_CATEGORY;
+ }
+ else if (t.depth == E_DEPTH_SELECT_LIST) {
+ t.depth = E_DEPTH_CATEGORY;
+ }
+ else if (t.depth == E_DEPTH_SHOW_LIST) {
+ t.depth = E_DEPTH_CATEGORY;
+ }
+ else if (t.depth == E_DEPTH_SONG) {
+ count = 0;
+ alist = category_info_get_albumlist(t.c_catinfo);
+ if (alist)
+ count = eina_list_count(alist);
+ if (count == 1)
+ t.depth = E_DEPTH_CATEGORY;
+ else
+ t.depth = E_DEPTH_ALBUM;
+ }
+
+ t_UpdateLayoutWithFocus();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Eina.h>
+#include <utilX.h>
+#include "i18n.h"
+#include "define.h"
+#include "dbg.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "song_info.h"
+//#include "playback-view.h"
+
+#define MESSAGE_SHOW_TIME 2
+
+struct msg_box {
+ Evas_Object *ly;
+ Ecore_Timer *timer;
+};
+
+char *_get_timestr_from_milseconds(int mseconds)
+{
+ int sec;
+ char buf[MAX_LENGTH];
+
+ sec = mseconds / 1000;
+ snprintf(buf, sizeof(buf), "%02d:%02d", sec / 60, sec % 60);
+
+ return strdup(buf);
+}
+
+void _set_object_text(Evas_Object *lbl, char *text, int size, const char *style)
+{
+ char buf[MAX_LENGTH];
+
+ if (!lbl || !text)
+ return;
+
+ snprintf(buf, sizeof(buf),
+ "<center><color=#FFFFFFFF><font=%s>"
+ "<font_size=%d>%s</font_size>"
+ "</font></color></center>",
+ style, size, text);
+
+ elm_object_text_set(lbl, buf);
+}
+
+Evas_Object *_add_box(Evas_Object *base)
+{
+ Evas_Object *box;
+ if (!base)
+ return NULL;
+
+ box = elm_box_add(base);
+ if (!box)
+ return NULL;
+
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+
+ return box;
+}
+
+Evas_Object *_add_base(Evas_Object *win, const char *layout)
+{
+ Evas_Object *base;
+ if (!win)
+ return NULL;
+
+ base = elm_layout_add(win);
+ if (!base)
+ return NULL;
+
+ if (layout) {
+ if (!elm_layout_file_set(base, EDJEFILE, layout)) {
+ evas_object_del(base);
+ _ERR(" elm layout file set failed ");
+ return NULL;
+ }
+ }
+
+ return base;
+}
+
+void _object_mouse_moved(void *dt, Evas *e, Evas_Object *obj, void *ei)
+{
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+void _genlist_mouse_moved(void *dt, Evas *e, Evas_Object *obj, void *ei)
+{
+ Elm_Object_Item *item;
+ Evas_Event_Mouse_Move *ev;
+
+ if (!obj || !ei)
+ return;
+
+ ev = (Evas_Event_Mouse_Move *)ei;
+
+ item = elm_genlist_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL);
+
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+}
+
+void _gengrid_mouse_moved(void *dt, Evas *e,
+ Evas_Object *obj, void *ei)
+{
+ Elm_Object_Item *item;
+ Evas_Event_Mouse_Move *ev;
+
+ if (!obj || !ei)
+ return;
+
+ ev = (Evas_Event_Mouse_Move *)ei;
+
+ item = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
+ if (!item)
+ return;
+
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+}
+
+static Eina_Bool _timer_cb(void *dt)
+{
+ struct msg_box *mbox;
+
+ if (!dt)
+ return ECORE_CALLBACK_CANCEL;
+
+ mbox = (msg_box *)dt;
+
+ mbox->timer = NULL;
+ evas_object_del(mbox->ly);
+ free(mbox);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void _create_message_box(Evas_Object *base, const char *msg)
+{
+ Evas_Object *ly;
+ struct msg_box *mbox;
+
+ if (!base || !msg)
+ return;
+
+ mbox = (msg_box *)calloc(1, sizeof(*mbox));
+ if (!mbox)
+ return;
+
+ ly = _add_base(base, MUSIC_MESSAGE_LAYOUT);
+ if (!ly) {
+ _ERR(" Failed to add layout ");
+ free(mbox);
+ return;
+ }
+
+ elm_object_part_text_set(ly, MUSIC_PART_MESSAGE, msg);
+
+ evas_object_show(ly);
+ mbox->ly = ly;
+ mbox->timer = ecore_timer_add(MESSAGE_SHOW_TIME, _timer_cb, mbox);
+}
+
+Evas_Object *_create_remove_popup(Evas_Object *base, const char *msg,
+ Evas_Object_Event_Cb _close_cb, Evas_Smart_Cb _remove_cb,
+ Evas_Smart_Cb _cancel_cb, void *dt)
+{
+ Evas_Object *popup, *yesbtn, *nobtn, *lbl;
+
+ if (!base || !_remove_cb || !_cancel_cb || !dt) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ popup = elm_popup_add(base);
+ if (!popup) {
+ _ERR("elm_popup_add failed.");
+ return NULL;
+ }
+
+ elm_object_style_set(popup, MUSIC_STYLE_REMOVE_POPUP);
+ elm_object_part_text_set(popup, MUSIC_PART_RPOPUP_TITLE,
+ _(MUSIC_TEXT_REMOVE));
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
+ evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN,
+ _close_cb, dt);
+ evas_object_show(popup);
+
+ lbl = elm_label_add(popup);
+ if (!lbl)
+ goto err;
+
+ elm_object_style_set(lbl, MUSIC_STYLE_REMOVE_LABEL);
+ elm_object_text_set(lbl, _(msg));
+ elm_object_content_set(popup, lbl);
+
+ yesbtn = elm_button_add(popup);
+ if (!yesbtn)
+ goto err;
+
+ elm_object_text_set(yesbtn, _(MUSIC_TEXT_REMOVE));
+ elm_object_part_content_set(popup, MUSIC_PART_RPOPUP_BTN1, yesbtn);
+ evas_object_smart_callback_add(yesbtn, MUSIC_SIGNAL_CLICKED,
+ _remove_cb, dt);
+
+ nobtn = elm_button_add(popup);
+ if (!nobtn)
+ goto err;
+
+ elm_object_text_set(nobtn, _(MUSIC_TEXT_CANCEL));
+ elm_object_part_content_set(popup, MUSIC_PART_RPOPUP_BTN2, nobtn);
+ evas_object_smart_callback_add(nobtn, MUSIC_SIGNAL_CLICKED,
+ _cancel_cb, dt);
+ elm_object_focus_set(nobtn, EINA_TRUE);
+
+ return popup;
+
+err:
+ _ERR("Add Evas_Object failed.");
+ evas_object_del(popup);
+
+ return NULL;
+}
+
+void _update_playback_view(enum EAddType type,
+ Evas_Object *layout, Elm_Object_Item *focused_item)
+{
+ Evas_Object *obj;
+
+ CViewMgr* vmgr = CViewMgr::GetInstance();
+ if (!vmgr || !layout)
+ return;
+
+ obj = NULL;
+ if (!focused_item)
+ obj = elm_object_focused_object_get(layout);
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_PLAYLIST_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+
+ if (!vmgr->UpdateView((const char *)MUSIC_PLAYBACK_VIEW, &parcel)) {
+ if (!vmgr->PushView(MUSIC_PLAYBACK_VIEW, NULL))
+ _ERR(" viewmgr push view failed ");
+ return;
+ }
+
+ if (type == ADD_TYPE_FRESH) {
+ if (!vmgr->PushView(MUSIC_PLAYBACK_VIEW, NULL))
+ _ERR(" viewmgr show failed ");
+
+ return;
+ }
+
+ if (focused_item) {
+ if (!vmgr->PushView(MUSIC_BASE_VIEW, NULL)) {
+ _ERR(" viewmgr show failed ");
+ return;
+ }
+ elm_object_item_focus_set(focused_item, EINA_TRUE);
+ } else {
+ if (obj)
+ elm_object_focus_set(obj, EINA_TRUE);
+ }
+
+ if (type == ADD_TYPE_NEXT)
+ _create_message_box(layout, MUSIC_TEXT_NEXT_MSG);
+ else
+ _create_message_box(layout, MUSIC_TEXT_LAST_MSG);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include <InputHandler.h>
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+#include "song_info.h"
+#include "album_info.h"
+#include "category_info.h"
+#include "folder_info.h"
+#include "common.h"
+#include "common-ui.h"
+#include "music-controller.h"
+#include "mediadata.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "context-view.h"
+
+#define _GET_PRIV(o) evas_object_data_get(o, "CTMDATA");
+#define _SET_PRIV(o, data) evas_object_data_set(o, "CTMDATA", data);
+
+#define TOTAL_REL_CONTENTS 10
+#define TOTAL_CONTEXT_BTNS 10
+#define TABLE_MAX_COL 2
+#define MIN_LABEL_WIDTH 103
+#define MUSIC_CTXT_BTN_WPAD 26
+#define MUSIC_CTXT_TABLE_WPAD 14
+#define MUSIC_CTXT_TABLE_HPAD 14
+
+
+enum EBtnType {
+ CTXBTN_INVALID = -1,
+ CTXBTN_PLAY = 0,
+ CTXBTN_NEXT,
+ CTXBTN_LAST,
+ CTXBTN_ADDTO,
+ CTXBTN_PLAYSONG,
+ CTXBTN_DEL,
+ CTXBTN_RENAME,
+ CTXBTN_ADDSONG,
+ CTXBTN_REMOVESONG,
+ CTXBTN_DELETE,
+ CTXBTN_MAX
+};
+
+struct SBtnInfo {
+ const char *txt;
+ const char *icon;
+};
+
+struct SRltvCtnt {
+ char* title;
+ char* imgpath;
+ char* link;
+};
+
+struct SContextView {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *table;
+ Evas_Object *moreinfo;
+ Evas_Object *playbtn;
+ Evas_Object *first_line[TABLE_MAX_COL];
+ Evas_Object *last_line[TABLE_MAX_COL];
+ Evas_Object *popup;
+ Ecore_Idler *idler;
+ CMusicController *mhandle;
+ CViewMgr *vmgr;
+ SContentInfo *ctxtinfo;
+ EContextType type;
+ int lid;
+ CContextView *parent;
+
+ class CHandlerButton : public CListenerMgr,
+ public IMouseMoveListener, public IMouseUpListener, public IKeyUpListener,
+ public IFocusedListener, public IUnfocusedListener {
+ public:
+ struct SCallback {
+ void(*addScroller)(void* cookie, Evas_Object *base, Evas_Object **scroller);
+ void* cookie;
+ };
+
+ private:
+ SContextView *m;
+ SCallback m_callback;
+
+ private:
+ static void sm_CbPopupKeyPressed(void *data, Evas *e, Evas_Object *obj, void *ei)
+ {
+ CHandlerButton *root = (CHandlerButton *)data;
+ if (root)
+ root->m_OnPopUpKeyPressed(e, obj, (Evas_Event_Key_Down *)ei);
+ }
+
+ void m_OnPopUpKeyPressed(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+ {
+ if (!ev->keyname)
+ return;
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ m_DestroyPopup();
+ }
+
+ static void sm_CbRemove(void *data, Evas_Object *obj, void *ei)
+ {
+ CHandlerButton *root = (CHandlerButton *)data;
+ if (root)
+ root->m_OnRemove(obj);
+ }
+
+ void m_OnRemove(Evas_Object *obj)
+ {
+ SContentInfo *cinfo = NULL;
+
+ if (!obj) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ m_DestroyPopup();
+
+ if (!m->ctxtinfo || !m->ctxtinfo->update)
+ return;
+
+ cinfo = m->ctxtinfo;
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_DELETE, 0);
+ }
+
+ static void sm_CbCancel(void *data, Evas_Object *obj, void *ei)
+ {
+ CHandlerButton *root = (CHandlerButton *)data;
+ if (root)
+ root->m_OnCancel(obj);
+ }
+
+ void m_OnCancel(Evas_Object *obj)
+ {
+ if (!obj) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ m_DestroyPopup();
+ }
+
+ static int sm_CbSortPlaylist(const void *d1, const void *d2)
+ {
+ SCtxtPlaylistItem *info1 = (SCtxtPlaylistItem *)d1;
+ SCtxtPlaylistItem *info2 = (SCtxtPlaylistItem *)d2;
+ char *txt1 = NULL;
+ char *txt2 = NULL;
+
+ txt1 = info1->name;
+ txt2 = info2->name;
+
+ if (!txt1)
+ return 1;
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+ }
+
+ static void sm_CbPopupDeleted(void *data, Evas *e, Evas_Object *obj, void *ei)
+ {
+ Eina_List *list = (Eina_List *)data;
+ SCtxtPlaylistItem *item = NULL;
+ void *listObj = NULL;
+
+ if (!list)
+ return;
+
+ EINA_LIST_FREE(list, listObj) {
+ item = (SCtxtPlaylistItem *)listObj;
+ free(item->name);
+ free(item);
+ }
+ }
+
+ static void sm_CbPopupBtnClicked(void *data, Evas_Object *obj, void *ei)
+ {
+ CHandlerButton *root = (CHandlerButton *)data;
+ if (root)
+ root->m_OnPopupBtnClicked(obj);
+ }
+
+ void m_OnPopupBtnClicked(Evas_Object *obj)
+ {
+ SCtxtPlaylistItem *item = (SCtxtPlaylistItem *)_GET_PRIV(obj);
+
+ if (!item) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ m->lid = item->id;
+ m->idler = ecore_idler_add(sm_CbSelectIdler, this);
+ }
+
+ static Eina_Bool sm_CbSelectIdler(void *dt)
+ {
+ CHandlerButton *root = (CHandlerButton *)dt;
+ Eina_Bool r;
+
+ if (root)
+ r = root->m_OnSelectIdler();
+
+ return r;
+ }
+
+ Eina_Bool m_OnSelectIdler(void)
+ {
+ SContentInfo *cinfo = NULL;
+
+ m->idler = NULL;
+ m_DestroyPopup();
+
+ if (!m->ctxtinfo || !m->ctxtinfo->update)
+ return ECORE_CALLBACK_CANCEL;
+
+ cinfo = m->ctxtinfo;
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_ADDTO, m->lid);
+ cinfo->close(cinfo->cbdata);
+
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ private:
+ void m_HandleBtnSelected(int btnType)
+ {
+ SContentInfo *cinfo = NULL;
+
+ if (!m->ctxtinfo || !m->ctxtinfo->update)
+ return;
+
+ EBtnType type = (EBtnType)btnType;
+
+ cinfo = m->ctxtinfo;
+
+ switch (type) {
+ case CTXBTN_PLAY:
+ case CTXBTN_PLAYSONG:
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_PLAY, 0);
+ break;
+
+ case CTXBTN_NEXT:
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_ADDNEXT, 0);
+ break;
+
+ case CTXBTN_LAST:
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_ADDLAST, 0);
+ break;
+
+ case CTXBTN_ADDTO:
+ m->popup = m_CreatePlaylistPopup();
+ if (!m->popup)
+ _create_message_box(m->base, MUSIC_TEXT_NOLIST_MSG);
+ break;
+
+ case CTXBTN_DEL:
+ m->popup = m_CreateRemovePopup(m->base,
+ MUSIC_TEXT_REMOVE_SMSG, sm_CbPopupKeyPressed,
+ sm_CbRemove, sm_CbCancel, this);
+ break;
+
+ case CTXBTN_RENAME:
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_RENAME, 0);
+ break;
+
+ case CTXBTN_ADDSONG:
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_ADDSONG, 0);
+ break;
+
+ case CTXBTN_REMOVESONG:
+ cinfo->update(cinfo->cbdata, ACTION_TYPE_REMOVESONG, 0);
+ break;
+
+ case CTXBTN_DELETE:
+ m->popup = m_CreateRemovePopup(m->base,
+ MUSIC_TEXT_REMOVE_PLMSG, sm_CbPopupKeyPressed,
+ sm_CbRemove, sm_CbCancel, this);
+ break;
+
+ default:
+ _ERR("Wrong btn type");
+ }
+ }
+
+ Evas_Object *m_CreatePlaylistPopup(void)
+ {
+ Evas_Object *popup = NULL, *box = NULL, *btn = NULL, *scr = NULL, *firstbtn = NULL;
+ Eina_List *l = NULL, *list = NULL;
+ struct SCtxtPlaylistItem *item = NULL;
+ void *obj = NULL;
+ int i, tc;
+
+ popup = elm_ctxpopup_add(m->base);
+ if (!popup) {
+ _ERR("elm_ctxpopup_add failed.");
+ return NULL;
+ }
+
+ box = elm_box_add(popup);
+ if (!box) {
+ _ERR("elm_box_add failed.");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0);
+
+ list = CMediadata::PlaylistsForCtxt();
+ if (!list || eina_list_count(list) == 0) {
+ _ERR("Fetching list of playlists failed");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ list = eina_list_sort(list, 0, sm_CbSortPlaylist);
+ elm_object_style_set(popup, MUSIC_STYLE_LIST_POPUP);
+ evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL,
+ sm_CbPopupDeleted, list);
+
+ btn = NULL;
+ firstbtn = NULL;
+ i = 0;
+ tc = eina_list_count(list);
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ item = (SCtxtPlaylistItem *)obj;
+ btn = elm_button_add(box);
+ if (!btn) {
+ _ERR("elm_button_add failed.");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ if (i == 0) {
+ elm_object_style_set(btn, MUSIC_STYLE_TOPTEXT_BTN);
+ firstbtn = btn;
+ }
+ else if (i == tc - 1) {
+ _INFO();
+ elm_object_style_set(btn, MUSIC_STYLE_BOTTOMTEXT_BTN);
+ elm_object_signal_emit(btn, MUSIC_SIGNAL_HIDELINE,
+ MUSIC_CONTEXT_VIEW);
+ }
+ else {
+ elm_object_style_set(btn, MUSIC_STYLE_MIDDLETEXT_BTN);
+ }
+
+ i++;
+ elm_object_text_set(btn, item->name);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+ _SET_PRIV(btn, item);
+
+ evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED,
+ sm_CbPopupBtnClicked, this);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
+ _object_mouse_moved, NULL);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN,
+ sm_CbPopupKeyPressed, m);
+ }
+
+ m_callback.addScroller(m_callback.cookie, popup, &scr);
+ if (!scr) {
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_object_content_set(scr, box);
+ elm_object_content_set(popup, scr);
+ elm_object_part_content_set(m->base, MUSIC_PART_PLIST_POPUP, popup);
+
+ elm_ctxpopup_direction_priority_set(popup, (Elm_Ctxpopup_Direction)0, (Elm_Ctxpopup_Direction)0, (Elm_Ctxpopup_Direction)0, (Elm_Ctxpopup_Direction)0);
+
+ if (firstbtn && btn) {
+ elm_object_focus_set(firstbtn, EINA_TRUE);
+ elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
+ }
+
+ return popup;
+ }
+
+ Evas_Object *m_CreateRemovePopup(Evas_Object *base, const char *msg,
+ Evas_Object_Event_Cb _close_cb, Evas_Smart_Cb _remove_cb,
+ Evas_Smart_Cb _cancel_cb, void *dt)
+ {
+ Evas_Object *popup, *yesbtn, *nobtn, *lbl;
+
+ if (!base || !_remove_cb || !_cancel_cb || !dt) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ popup = elm_popup_add(base);
+ if (!popup) {
+ _ERR("elm_popup_add failed.");
+ return NULL;
+ }
+
+ elm_object_style_set(popup, MUSIC_STYLE_REMOVE_POPUP);
+ elm_object_part_text_set(popup, MUSIC_PART_RPOPUP_TITLE,
+ _(MUSIC_TEXT_REMOVE));
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
+ evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN,
+ _close_cb, dt);
+ evas_object_show(popup);
+
+ lbl = elm_label_add(popup);
+ if (!lbl) {
+ _ERR("Add Evas_Object failed.");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_object_style_set(lbl, MUSIC_STYLE_REMOVE_LABEL);
+ elm_object_text_set(lbl, _(msg));
+ elm_object_content_set(popup, lbl);
+
+ yesbtn = elm_button_add(popup);
+ if (!yesbtn) {
+ _ERR("Add Evas_Object failed.");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_object_text_set(yesbtn, _(MUSIC_TEXT_REMOVE));
+ elm_object_part_content_set(popup, MUSIC_PART_RPOPUP_BTN1, yesbtn);
+ evas_object_smart_callback_add(yesbtn, MUSIC_SIGNAL_CLICKED,
+ _remove_cb, dt);
+
+ nobtn = elm_button_add(popup);
+ if (!nobtn) {
+ _ERR("Add Evas_Object failed.");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_object_text_set(nobtn, _(MUSIC_TEXT_CANCEL));
+ elm_object_part_content_set(popup, MUSIC_PART_RPOPUP_BTN2, nobtn);
+ evas_object_smart_callback_add(nobtn, MUSIC_SIGNAL_CLICKED,
+ _cancel_cb, dt);
+ elm_object_focus_set(nobtn, EINA_TRUE);
+
+ return popup;
+ }
+
+ void m_DestroyPopup(void)
+ {
+ if (!m->popup)
+ return;
+
+ evas_object_del(m->popup);
+ m->popup = NULL;
+ }
+
+ public:
+ CHandlerButton(SContextView *ins) :
+ IMouseMoveListener(this),
+ IMouseUpListener(this),
+ IKeyUpListener(this),
+ IFocusedListener(this),
+ IUnfocusedListener(this) {
+ m = ins;
+ }
+
+ ~CHandlerButton() {
+ m_DestroyPopup();
+ }
+
+ void SetCallback(const SCallback* cb) {
+ m_callback = *cb;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+ {
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+ }
+
+ virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev)
+ {
+ m_HandleBtnSelected(id);
+ }
+
+ virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev)
+ {
+ if (strcmp(ev->keyname, KEY_ENTER))
+ return;
+
+ m_HandleBtnSelected(id);
+ }
+
+ virtual void OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item)
+ {
+ if (!obj)
+ return;
+
+ elm_object_signal_emit(obj, MUSIC_SIGNAL_FOCUSED, MUSIC_CONTEXT_VIEW);
+ }
+
+ virtual void OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item)
+ {
+ if (!obj)
+ return;
+
+ elm_object_signal_emit(obj, MUSIC_SIGNAL_UNFOCUSED, MUSIC_CONTEXT_VIEW);
+ }
+ } *pHandlerButton;
+
+ class CHandlerLayout : public CListenerMgr,
+ public IMouseMoveListener, public IMouseUpListener, public IKeyUpListener,
+ public IFocusedListener, public IUnfocusedListener {
+ protected:
+ SContextView *m;
+
+ public:
+ CHandlerLayout(SContextView *ins) :
+ IMouseMoveListener(this),
+ IMouseUpListener(this),
+ IKeyUpListener(this),
+ IFocusedListener(this),
+ IUnfocusedListener(this) {
+ m = ins;
+ };
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+ {
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+ }
+
+ virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev) = 0;
+ virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev) = 0;
+
+ virtual void OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item)
+ {
+ if (!obj)
+ return;
+
+ elm_object_signal_emit(obj, MUSIC_SIGNAL_FOCUSED, MUSIC_CONTEXT_VIEW);
+ }
+
+ virtual void OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item)
+ {
+ if (!obj)
+ return;
+
+ elm_object_signal_emit(obj, MUSIC_SIGNAL_UNFOCUSED, MUSIC_CONTEXT_VIEW);
+ }
+ };
+
+ class CHandlerRelativeContentLayout : public CHandlerLayout {
+ public:
+ CHandlerRelativeContentLayout(SContextView *ins) : CHandlerLayout(ins) {}
+
+ virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev)
+ {
+ if (!obj)
+ return;
+
+ elm_object_signal_emit(obj, MUSIC_SIGNAL_CONTENT_CLICKED,
+ MUSIC_CONTEXT_VIEW);
+ }
+
+ virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev)
+ {
+ if (!obj || !ev)
+ return;
+
+ if (strcmp(ev->keyname, KEY_ENTER))
+ return;
+
+ elm_object_signal_emit(obj, MUSIC_SIGNAL_CONTENT_CLICKED,
+ MUSIC_CONTEXT_VIEW);
+ }
+ };
+
+ Eina_List *listRltvCtntLayout;
+
+ class CHandlerMoreInfoLayout : public CHandlerLayout {
+ private:
+ void m_HandleMoreinfoSelected(Evas_Object *obj)
+ {
+ SRltvCtnt *rctnt = NULL;
+
+ if (!obj)
+ return;
+
+ rctnt = (SRltvCtnt *)_GET_PRIV(obj);
+ if (!rctnt)
+ return;
+
+ /* Using prints till actual APIs come from wiki and youtube */
+ switch (m->type) {
+ case CONTEXT_TYPE_ALBUM:
+ _INFO("Album more info clicked %s", rctnt->link);
+ break;
+
+ case CONTEXT_TYPE_ARTIST:
+ _INFO("Artist more info clicked %s", rctnt->link);
+ break;
+
+ case CONTEXT_TYPE_GENRE:
+ _INFO("Genre more info clicked %s", rctnt->link);
+ break;
+
+ default:
+ _ERR("Wrong content type for more info");
+ }
+ }
+
+ public:
+ CHandlerMoreInfoLayout(SContextView *ins) : CHandlerLayout(ins) {}
+
+ virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev)
+ {
+ if (!obj)
+ return;
+
+ m_HandleMoreinfoSelected(obj);
+ }
+
+ virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev)
+ {
+ if (!obj || !ev)
+ return;
+
+ if (strcmp(ev->keyname, KEY_ENTER))
+ return;
+
+ m_HandleMoreinfoSelected(obj);
+ }
+ } *pHandlerMoreInfoLayout;
+
+ SContextView() {
+ memset(this, 0, sizeof(SContextView));
+ pHandlerButton = new CHandlerButton(this);
+ pHandlerMoreInfoLayout = new CHandlerMoreInfoLayout(this);
+ }
+
+ ~SContextView() {
+ delete pHandlerButton;
+ delete pHandlerMoreInfoLayout;
+ }
+};
+
+/* Dummy content for testing. Actuals should come from youtube and wiki */
+char g_DummyRelContent1Title[] = "Rel Content 1";
+char g_DummyRelContent1Imgpath[] = "";
+char g_DummyRelContent1Link[] = "CONTENT1";
+char g_DummyRelContent2Title[] = "Rel Content 2";
+char g_DummyRelContent2Imgpath[] = "";
+char g_DummyRelContent2Link[] = "CONTENT2";
+char g_DummyRelContent3Title[] = "Rel Content 3";
+char g_DummyRelContent3Imgpath[] = "";
+char g_DummyRelContent3Link[] = "CONTENT3";
+char g_DummyRelContent4Title[] = "Rel Content 4";
+char g_DummyRelContent4Imgpath[] = "";
+char g_DummyRelContent4Link[] = "CONTENT4";
+char g_DummyRelContent5Title[] = "Rel Content 5";
+char g_DummyRelContent5Imgpath[] = "";
+char g_DummyRelContent5Link[] = "CONTENT5";
+char g_DummyRelContent6Title[] = "Rel Content 6";
+char g_DummyRelContent6Imgpath[] = "";
+char g_DummyRelContent6Link[] = "CONTENT6";
+char g_DummyRelContent7Title[] = "Rel Content 7";
+char g_DummyRelContent7Imgpath[] = "";
+char g_DummyRelContent7Link[] = "CONTENT7";
+char g_DummyRelContent8Title[] = "Rel Content 8";
+char g_DummyRelContent8Imgpath[] = "";
+char g_DummyRelContent8Link[] = "CONTENT8";
+char g_DummyRelContent9Title[] = "Rel Content 9";
+char g_DummyRelContent9Imgpath[] = "";
+char g_DummyRelContent9Link[] = "CONTENT9";
+char g_DummyRelContent10Title[] = "Rel Content 10";
+char g_DummyRelContent10Imgpath[] = "";
+char g_DummyRelContent10Link[] = "CONTENT10";
+char g_DummyRelSampleContentLink[] = "SAMPLE MOREINFO";
+SRltvCtnt SRltvCtnt_list[TOTAL_REL_CONTENTS];
+SRltvCtnt samplectnt;
+
+
+void CContextView::sm_CbRltdCtntSelected(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ SRltvCtnt *rctnt = NULL;
+
+ if (!obj || !data)
+ return;
+
+ rctnt = (SRltvCtnt *)_GET_PRIV(obj);
+ if (!rctnt)
+ return;
+
+ /* Using prints till actual APIs come from wiki and youtube */
+ _INFO("Content Selected is:%s", rctnt->link);
+}
+
+
+void CContextView::sm_CbAddScroller(void *cookie, Evas_Object *base, Evas_Object **scroller)
+{
+ CContextView *root = (CContextView *)cookie;
+ if (root)
+ root->m_OnAddScroller(base, scroller);
+}
+
+
+void CContextView::m_OnAddScroller(Evas_Object *base, Evas_Object **scroller)
+{
+ Evas_Object *scr = m_AddScroller(base);
+ *scroller = scr;
+}
+
+
+Evas_Object *CContextView::m_AddScroller(Evas_Object *base)
+{
+ Evas_Object *scroller = NULL;
+
+ if (!base) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ scroller = elm_scroller_add(base);
+ if (!scroller) {
+ _ERR("elm_scroller_add failed.");
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, 0.0);
+
+ return scroller;
+}
+
+
+void CContextView::m_SetBtnDownFocus(Evas_Object *btn)
+{
+ if (!btn)
+ return;
+
+ if (!m->moreinfo && !m->first_line[0]) {
+ elm_object_focus_next_object_set(btn, btn,
+ ELM_FOCUS_DOWN);
+ return;
+ }
+
+ if (m->moreinfo)
+ elm_object_focus_next_object_set(btn, m->moreinfo,
+ ELM_FOCUS_DOWN);
+ else
+ elm_object_focus_next_object_set(btn, m->first_line[0],
+ ELM_FOCUS_DOWN);
+}
+
+
+void CContextView::m_SetLayoutFocusOrder(Evas_Object *btn)
+{
+ int i;
+ Evas_Object *obj = NULL;
+
+ if (!btn)
+ return;
+
+ if (m->moreinfo) {
+ elm_object_focus_next_object_set(m->moreinfo, btn,
+ ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(m->moreinfo,
+ m->first_line[0], ELM_FOCUS_DOWN);
+ }
+
+ for (i = 0; i < TABLE_MAX_COL; i++) {
+ if (!m->first_line[i])
+ continue;
+
+ obj = m->first_line[i];
+ if (m->moreinfo)
+ elm_object_focus_next_object_set(obj, m->moreinfo,
+ ELM_FOCUS_UP);
+ else
+ elm_object_focus_next_object_set(obj, btn,
+ ELM_FOCUS_UP);
+ }
+}
+
+
+void CContextView::m_SetBtnsFocusOrder(Evas_Object *btn, Evas_Object *prv,
+ int btnTypeIndex, int btnTypeFirst, int btnTypeLast)
+{
+ if (!btn)
+ return;
+
+ EBtnType idx = (EBtnType)btnTypeIndex;
+ EBtnType first = (EBtnType)btnTypeFirst;
+
+ if (idx == first)
+ elm_object_focus_set(btn, EINA_TRUE);
+
+ if (prv) {
+ elm_object_focus_next_object_set(prv, btn,
+ ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(btn, prv,
+ ELM_FOCUS_LEFT);
+ }
+}
+
+
+bool CContextView::m_AddBtnLabel(Evas_Object *btn, const char *txt)
+{
+ Evas_Object *lbl = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!btn || !txt)
+ return false;
+
+ lbl = elm_label_add(btn);
+ if (!lbl) {
+ _ERR("elm_label_add failed.");
+ return false;
+ }
+
+ snprintf(buf, sizeof(buf),
+ "<align=center><color=#FFFFFFFF>"
+ "<font=%s>"
+ "<font_size=21>%s</font_size>"
+ "</font></color></align>", FONT_STYLE_MEDIUM, _(txt));
+ elm_object_text_set(lbl, buf);
+ elm_label_line_wrap_set(lbl, ELM_WRAP_WORD);
+ evas_object_size_hint_min_set(lbl, MIN_LABEL_WIDTH, 0);
+ elm_object_part_content_set(btn, MUSIC_PART_CTXT_BTNTEXT, lbl);
+
+ return true;
+}
+
+
+bool CContextView::m_AddBtnIcon(Evas_Object *btn, const char *icon)
+{
+ Evas_Object *img = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!btn || !icon)
+ return false;
+
+ img = elm_image_add(btn);
+ if (!img) {
+ _ERR("elm_image_add failed.");
+ return false;
+ }
+
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, icon);
+ elm_image_file_set(img, buf, NULL);
+ elm_object_part_content_set(btn, MUSIC_PART_CTXT_BTNICON, img);
+
+ return true;
+}
+
+
+bool CContextView::m_AddBtnInfo(Evas_Object *btn, const char *icon, const char *txt)
+{
+ if (!btn || !icon || !txt)
+ return false;
+
+ if (!m_AddBtnIcon(btn, icon))
+ return false;
+
+ if (!m_AddBtnLabel(btn, txt))
+ return false;
+
+ return true;
+}
+
+
+Evas_Object *CContextView::m_AddButton(Evas_Object *base)
+{
+ Evas_Object *btn = NULL;
+
+ if (!base)
+ return NULL;
+
+ btn = elm_layout_add(base);
+ if (!btn) {
+ _ERR("elm_layout_add failed.");
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(btn,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, 0.0, 0.5);
+
+ elm_layout_file_set(btn, EDJEFILE, MUSIC_CONTEXT_BTN);
+ elm_object_focus_allow_set(btn, EINA_TRUE);
+ elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_UP);
+
+ evas_object_show(btn);
+
+ return btn;
+}
+
+
+Evas_Object *CContextView::m_AddBtnBox(Evas_Object *base)
+{
+ Evas_Object *box = NULL;
+
+ if (!base)
+ return NULL;
+
+ box = elm_box_add(base);
+ if (!box) {
+ _ERR(" elm_box_add failed ");
+ return NULL;
+ }
+
+ elm_box_horizontal_set(box, EINA_TRUE);
+ elm_box_padding_set(box, MUSIC_CTXT_BTN_WPAD, 0);
+ elm_box_align_set(box, 0, 0.5);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ return box;
+}
+
+
+bool CContextView::m_CreateBtnsPart(void)
+{
+ Evas_Object *btn = NULL, *box = NULL, *prv = NULL, *firstbtn = NULL;
+ int i;
+ EBtnType first, last;
+ SBtnInfo btninfo[TOTAL_CONTEXT_BTNS];
+
+ btninfo[CTXBTN_PLAY].txt = MUSIC_TEXT_PLAY_THIS;
+ btninfo[CTXBTN_PLAY].icon = MUSIC_IMAGE_CTXT_BTNPLAY;
+
+ btninfo[CTXBTN_NEXT].txt = MUSIC_TEXT_ADD_NEXT;
+ btninfo[CTXBTN_NEXT].icon = MUSIC_IMAGE_CTXT_BTNNEXT;
+
+ btninfo[CTXBTN_LAST].txt = MUSIC_TEXT_ADD_LAST;
+ btninfo[CTXBTN_LAST].icon = MUSIC_IMAGE_CTXT_BTNLAST;
+
+ btninfo[CTXBTN_ADDTO].txt = MUSIC_TEXT_ADD_TO_PLAYLIST;
+ btninfo[CTXBTN_ADDTO].icon = MUSIC_IMAGE_CTXT_ADDTO;
+
+ btninfo[CTXBTN_PLAYSONG].txt = MUSIC_TEXT_PLAY;
+ btninfo[CTXBTN_PLAYSONG].icon = MUSIC_IMAGE_CTXT_BTNPLAY;
+
+ btninfo[CTXBTN_DEL].txt = MUSIC_TEXT_DEL;
+ btninfo[CTXBTN_DEL].icon = MUSIC_IMAGE_CTXT_BTNDEL;
+
+ btninfo[CTXBTN_RENAME].txt = MUSIC_TEXT_RENAME;
+ btninfo[CTXBTN_RENAME].icon = MUSIC_IMAGE_CTXT_RENAME;
+
+ btninfo[CTXBTN_ADDSONG].txt = MUSIC_TEXT_ADDSONG;
+ btninfo[CTXBTN_ADDSONG].icon = MUSIC_IMAGE_CTXT_ADDSONG;
+
+ btninfo[CTXBTN_REMOVESONG].txt = MUSIC_TEXT_REMOVESONG;
+ btninfo[CTXBTN_REMOVESONG].icon = MUSIC_IMAGE_CTXT_REMOVESONG;
+
+ btninfo[CTXBTN_DELETE].txt = MUSIC_TEXT_DEL;
+ btninfo[CTXBTN_DELETE].icon = MUSIC_IMAGE_CTXT_BTNDEL;
+
+ box = m_AddBtnBox(m->base);
+ if (!box)
+ return false;
+
+ if (m->type == CONTEXT_TYPE_PLAYLIST) {
+ first = CTXBTN_RENAME;
+ last = CTXBTN_DELETE;
+ }
+ else if (m->type == CONTEXT_TYPE_PLAYSONG) {
+ first = CTXBTN_PLAYSONG;
+ last = CTXBTN_DEL;
+ if (m->ctxtinfo->status == PLAY_STATUS_PLAY) {
+ btninfo[CTXBTN_PLAYSONG].txt = MUSIC_TEXT_PAUSE;
+ btninfo[CTXBTN_PLAYSONG].icon = MUSIC_IMAGE_CTXT_BTNPAUSE;
+ }
+ }
+ else {
+ first = CTXBTN_PLAY;
+ last = CTXBTN_ADDTO;
+ }
+
+ prv = NULL;
+ firstbtn = NULL;
+ for (i = first; i <= last; i++) {
+ btn = m_AddButton(box);
+ if (!btn) {
+ evas_object_del(box);
+ return false;
+ }
+
+ m->pHandlerButton->Connect(btn, i);
+
+ if (!m_AddBtnInfo(btn, btninfo[i].icon, btninfo[i].txt)) {
+ evas_object_del(box);
+ return false;
+ }
+ if (!firstbtn)
+ firstbtn = btn;
+
+ m_SetBtnsFocusOrder(btn, prv, (EBtnType)i, first, last);
+ m_SetBtnDownFocus(btn);
+
+ prv = btn;
+ elm_box_pack_end(box, btn);
+
+ if (i == CTXBTN_PLAYSONG)
+ m->playbtn = btn;
+ }
+ m_SetLayoutFocusOrder(firstbtn);
+
+ elm_object_focus_next_object_set(firstbtn, btn,
+ ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(btn, firstbtn,
+ ELM_FOCUS_RIGHT);
+
+ elm_object_part_content_set(m->base, MUSIC_PART_CTXT_BTNAREA, box);
+
+ return true;
+}
+
+
+Eina_List *CContextView::m_OtherSongsOfArtist(char *artist, char *title)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ Eina_List *list = NULL;
+ int i;
+
+ SRltvCtnt_list[0].title = (char *)g_DummyRelContent1Title;
+ SRltvCtnt_list[0].imgpath = (char *)g_DummyRelContent1Imgpath;
+ SRltvCtnt_list[0].link = (char *)g_DummyRelContent1Link;
+ SRltvCtnt_list[1].title = (char *)g_DummyRelContent2Title;
+ SRltvCtnt_list[1].imgpath = (char *)g_DummyRelContent2Imgpath;
+ SRltvCtnt_list[1].link = (char *)g_DummyRelContent2Link;
+ SRltvCtnt_list[2].title = (char *)g_DummyRelContent3Title;
+ SRltvCtnt_list[2].imgpath = (char *)g_DummyRelContent3Imgpath;
+ SRltvCtnt_list[2].link = (char *)g_DummyRelContent3Link;
+ SRltvCtnt_list[3].title = (char *)g_DummyRelContent4Title;
+ SRltvCtnt_list[3].imgpath = (char *)g_DummyRelContent4Imgpath;
+ SRltvCtnt_list[3].link = (char *)g_DummyRelContent4Link;
+ SRltvCtnt_list[4].title = (char *)g_DummyRelContent5Title;
+ SRltvCtnt_list[4].imgpath = (char *)g_DummyRelContent5Imgpath;
+ SRltvCtnt_list[4].link = (char *)g_DummyRelContent5Link;
+ SRltvCtnt_list[5].title = (char *)g_DummyRelContent6Title;
+ SRltvCtnt_list[5].imgpath = (char *)g_DummyRelContent6Imgpath;
+ SRltvCtnt_list[5].link = (char *)g_DummyRelContent6Link;
+ SRltvCtnt_list[6].title = (char *)g_DummyRelContent7Title;
+ SRltvCtnt_list[6].imgpath = (char *)g_DummyRelContent7Imgpath;
+ SRltvCtnt_list[6].link = (char *)g_DummyRelContent7Link;
+ SRltvCtnt_list[7].title = (char *)g_DummyRelContent8Title;
+ SRltvCtnt_list[7].imgpath = (char *)g_DummyRelContent8Imgpath;
+ SRltvCtnt_list[7].link = (char *)g_DummyRelContent8Link;
+ SRltvCtnt_list[8].title = (char *)g_DummyRelContent9Title;
+ SRltvCtnt_list[8].imgpath = (char *)g_DummyRelContent9Imgpath;
+ SRltvCtnt_list[8].link = (char *)g_DummyRelContent9Link;
+ SRltvCtnt_list[9].title = (char *)g_DummyRelContent10Title;
+ SRltvCtnt_list[9].imgpath = (char *)g_DummyRelContent10Imgpath;
+ SRltvCtnt_list[9].link = (char *)g_DummyRelContent10Link;
+
+ for (i = 0; i < TOTAL_REL_CONTENTS; i++)
+ list = eina_list_append(list, &SRltvCtnt_list[i]);
+
+ return list;
+}
+
+
+Eina_List *CContextView::m_OtherAlbumsOfArtist(char *artist, char *album)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ return m_OtherSongsOfArtist(artist, (char *)"");
+}
+
+
+Eina_List *CContextView::m_OtherSimilarArtist(char *artist)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ return m_OtherSongsOfArtist(artist, (char *)"");
+}
+
+
+Eina_List *CContextView::m_OtherSongsOfGenre(char *genre)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ return m_OtherSongsOfArtist(genre, (char *)"");
+}
+
+
+SRltvCtnt *CContextView::m_InfoOfAlbum(char *album)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ samplectnt.title = NULL;
+ samplectnt.imgpath = NULL;
+ samplectnt.link = g_DummyRelSampleContentLink;
+ return &samplectnt;
+}
+
+
+SRltvCtnt *CContextView::m_InfoOfArtist(char *artist)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ samplectnt.title = NULL;
+ samplectnt.imgpath = NULL;
+ samplectnt.link = g_DummyRelSampleContentLink;
+ return &samplectnt;
+}
+
+
+SRltvCtnt *CContextView::m_InfoOfGenre(char *genre)
+{
+ /*Dummy function. Actual should come from wiki and youtube*/
+ samplectnt.title = NULL;
+ samplectnt.imgpath = NULL;
+ samplectnt.link = g_DummyRelSampleContentLink;
+ return &samplectnt;
+}
+
+
+bool CContextView::m_GetContextDetails(SContentInfo *cinfo, char **path,
+ char **title, char **subtitle, char **subtitle2,
+ char **rltvtitle, SRltvCtnt **ctntinfo,
+ Eina_List **rltvlist)
+{
+ char buf[MAX_LENGTH];
+ Eina_List *alist = NULL, *l = NULL;
+ album_info *alinfo = NULL;
+ void *obj = NULL;
+
+ if (!cinfo || !cinfo->context)
+ return false;
+
+ switch (cinfo->type) {
+ case CONTEXT_TYPE_PLAYSONG:
+ *subtitle2 = song_info_get_album((SSongInfo *)cinfo->context);
+ case CONTEXT_TYPE_SONG:
+ *path = song_info_get_thumb((SSongInfo *)cinfo->context);
+ *title = song_info_get_title((SSongInfo *)cinfo->context);
+ *subtitle = song_info_get_artist((SSongInfo *)cinfo->context);
+ *rltvtitle = (char *)MUSIC_TEXT_SONG_RLTV;
+ *rltvlist = m_OtherSongsOfArtist(*subtitle, *title);
+ break;
+
+ case CONTEXT_TYPE_ALBUM:
+ *path = album_info_get_thumb((album_info *)cinfo->context);
+ *title = album_info_get_name((album_info *)cinfo->context);
+ *subtitle = album_info_get_artist((album_info *)cinfo->context);
+ *rltvtitle = (char *)MUSIC_TEXT_ALBUM_RLTV;
+ *ctntinfo = m_InfoOfAlbum(*title);
+ *rltvlist = m_OtherAlbumsOfArtist(*subtitle, *title);
+ break;
+
+ case CONTEXT_TYPE_ARTIST:
+ alist = category_info_get_albumlist((category_info *)cinfo->context);
+ EINA_LIST_FOREACH(alist, l, obj) {
+ alinfo = (album_info *)obj;
+ *path = album_info_get_thumb(alinfo);
+ if (*path)
+ break;
+ }
+ *title = (char *)category_info_get_name((category_info *)cinfo->context);
+ snprintf(buf, sizeof(buf), "%d %s",
+ category_info_get_songcount((category_info *)cinfo->context),
+ _(MUSIC_TEXT_SONGS));
+ *subtitle = strdup(buf);
+ *rltvtitle = (char *)MUSIC_TEXT_ARTIST_RLTV;
+ *ctntinfo = m_InfoOfArtist(*title);
+ *rltvlist = m_OtherSimilarArtist(*title);
+ break;
+
+ case CONTEXT_TYPE_GENRE:
+ alist = category_info_get_albumlist((category_info *)cinfo->context);
+ EINA_LIST_FOREACH(alist, l, obj) {
+ alinfo = (album_info *)obj;
+ *path = album_info_get_thumb(alinfo);
+ if (*path)
+ break;
+ }
+ *title = (char *)category_info_get_name((category_info *)cinfo->context);
+ snprintf(buf, sizeof(buf), "%d %s",
+ category_info_get_songcount((category_info *)cinfo->context),
+ _(MUSIC_TEXT_SONGS));
+ *subtitle = strdup(buf);
+ *rltvtitle = (char *)MUSIC_TEXT_GENRE_RLTV;
+ *ctntinfo = m_InfoOfGenre(*title);
+ *rltvlist = m_OtherSongsOfGenre(*title);
+ break;
+
+ case CONTEXT_TYPE_FOLDER:
+ snprintf(buf, sizeof(buf), "%d %s",
+ folder_info_get_count((folder_info *)cinfo->context),
+ _(MUSIC_TEXT_SONGS));
+ *subtitle = strdup(buf);
+ *title = folder_info_get_name((folder_info *)cinfo->context);
+ break;
+
+ case CONTEXT_TYPE_PLAYLIST:
+ snprintf(buf, sizeof(buf), "%d %s",
+ category_info_get_songcount((category_info *)cinfo->context),
+ _(MUSIC_TEXT_SONGS));
+ *subtitle = strdup(buf);
+ *title = (char *)category_info_get_name((category_info *)cinfo->context);
+ *path = category_info_get_thumb((category_info *)cinfo->context);
+ break;
+
+ default:
+ _ERR(" wrong context type ");
+ return false;
+ }
+
+ return true;
+}
+
+
+Evas_Object *CContextView::m_AddRltvCtnt(Evas_Object *obj, char *name, char *icon)
+{
+ Evas_Object *ly = NULL, *img = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!obj) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ ly = elm_layout_add(obj);
+ if (!ly) {
+ _ERR("elm_layout_add failed.");
+ return NULL;
+ }
+
+ elm_layout_file_set(ly, EDJEFILE, MUSIC_CONTEXT_REL_CONTENT);
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ img = elm_image_add(ly);
+ if (!img) {
+ _ERR("elm_image_add failed.");
+ evas_object_del(ly);
+ return NULL;
+ }
+
+ if (!icon || !strcmp(icon, MUSIC_STR_EMPTY)) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(img, buf, NULL);
+ elm_image_no_scale_set(img, EINA_TRUE);
+ }
+ else {
+ elm_image_file_set(img, icon, NULL);
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+ }
+
+ elm_object_part_content_set(ly, MUSIC_PART_CTXT_RELCTNT_ICON, img);
+ elm_object_part_text_set(ly, MUSIC_PART_CTXT_RELCTNT_NAME, name);
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+
+ return ly;
+}
+
+
+bool CContextView::m_AddTableContents(Eina_List *list)
+{
+ int row, col;
+ Evas_Object *ly = NULL;
+ Eina_List *l = NULL;
+ SRltvCtnt *rctnt = NULL;
+ SContextView::CHandlerRelativeContentLayout *layoutHandler = NULL;
+ void *obj = NULL;
+
+ if (!list)
+ return false;
+
+ row = 0;
+ col = 0;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ rctnt = (SRltvCtnt *)obj;
+ ly = m_AddRltvCtnt(m->table, rctnt->title, rctnt->imgpath);
+ if (!ly)
+ continue;
+ _SET_PRIV(ly, rctnt);
+ elm_table_pack(m->table, ly, col, row, 1, 1);
+ evas_object_show(ly);
+
+ elm_object_signal_callback_add(ly, MUSIC_SIGNAL_BTN_CLICKED,
+ MUSIC_CONTEXT_VIEW, sm_CbRltdCtntSelected, m);
+
+ layoutHandler = new SContextView::CHandlerRelativeContentLayout(m);
+ layoutHandler->Connect(ly);
+ m->listRltvCtntLayout = eina_list_append(m->listRltvCtntLayout, layoutHandler);
+
+ if (row == 0)
+ m->first_line[col] = ly;
+
+ if (col == 0)
+ elm_object_focus_next_object_set(ly, ly,
+ ELM_FOCUS_LEFT);
+
+ if (col == TABLE_MAX_COL - 1)
+ elm_object_focus_next_object_set(ly, ly,
+ ELM_FOCUS_RIGHT);
+
+ if (col >= 0 && col < TABLE_MAX_COL)
+ m->last_line[col] = ly;
+
+ col++;
+ if (col >= TABLE_MAX_COL) {
+ row++;
+ col = 0;
+ }
+ }
+
+ return true;
+}
+
+
+Evas_Object *CContextView::m_AddTable(Evas_Object *base)
+{
+ Evas_Object *table = NULL;
+
+ if (!base) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ table = elm_table_add(base);
+ if (!table) {
+ _ERR("elm_table_add failed.");
+ return NULL;
+ }
+
+ elm_table_homogeneous_set(table, EINA_TRUE);
+ elm_table_padding_set(table,
+ MUSIC_CTXT_TABLE_WPAD * elm_config_scale_get(),
+ MUSIC_CTXT_TABLE_HPAD * elm_config_scale_get());
+ evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(table);
+
+ return table;
+}
+
+
+bool CContextView::m_CreateRltvContent(Eina_List *list)
+{
+ Evas_Object *scroller = NULL, *table = NULL;
+ int r;
+
+ if (!list) {
+ _ERR("Invalid argument.");
+ return false;
+ }
+
+ scroller = m_AddScroller(m->base);
+ if (!scroller) {
+ _ERR("m_AddScroller failed.");
+ return false;
+ }
+
+ table = m_AddTable(scroller);
+ if (!table) {
+ _ERR("m_AddTable failed.");
+ evas_object_del(scroller);
+ return false;
+ }
+
+ m->table = table;
+
+ r = m_AddTableContents(list);
+ if (!r) {
+ _ERR("m_AddTableContents failed.");
+ evas_object_del(scroller);
+ return false;
+ }
+
+ elm_object_content_set(scroller, table);
+ elm_object_part_content_set(m->base, MUSIC_PART_CTXT_RELCTNTAREA,
+ scroller);
+
+ return true;
+}
+
+
+bool CContextView::m_CreateMoreinfoLayout(SRltvCtnt *rctnt, Evas_Object *img)
+{
+ Evas_Object *ly = NULL;
+
+ if (!rctnt)
+ return false;
+
+ ly = elm_layout_add(m->base);
+ if (!ly)
+ return false;
+
+ evas_object_size_hint_weight_set(ly,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, 0.0, 0.5);
+ elm_layout_file_set(ly, EDJEFILE, MUSIC_CONTEXT_INFO);
+ elm_object_part_content_set(ly, MUSIC_PART_CTXT_INFOICON, img);
+ elm_object_part_text_set(ly, MUSIC_PART_CTXT_INFOTEXT,
+ _(MUSIC_TEXT_MOREINFO));
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+ _SET_PRIV(ly, rctnt);
+
+ m->pHandlerMoreInfoLayout->Connect(ly);
+
+ elm_object_focus_next_object_set(ly, ly, ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(ly, ly, ELM_FOCUS_RIGHT);
+
+ elm_object_part_content_set(m->base, MUSIC_PART_CTXT_INFO, ly);
+
+ m->moreinfo = ly;
+
+ return true;
+}
+
+
+bool CContextView::m_CreateInfoPart(void)
+{
+ SContentInfo *cinfo = NULL;
+ SRltvCtnt *ctntinfo = NULL;
+ Evas_Object *img = NULL, *icon = NULL;
+ char *title = NULL, *subtitle = NULL, *subtitle2 = NULL;
+ char *rltvtitle = NULL, *path = NULL;
+ char buf[MAX_LENGTH];
+ Eina_List *rltvlist = NULL;
+
+ cinfo = m->ctxtinfo;
+ path = NULL;
+ title = NULL;
+ subtitle = NULL;
+ subtitle2 = NULL;
+ rltvtitle = NULL;
+ rltvlist = NULL;
+ ctntinfo = NULL;
+
+ if (!m_GetContextDetails(cinfo, &path, &title, &subtitle, &subtitle2,
+ &rltvtitle, &ctntinfo, &rltvlist))
+ return false;
+
+ img = elm_image_add(m->base);
+ if (!img)
+ return false;
+
+ icon = elm_image_add(m->base);
+ if (!icon)
+ return false;
+
+ if (!path) {
+ if (cinfo->type == CONTEXT_TYPE_FOLDER)
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_FOLDER);
+ else
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_180);
+ elm_image_file_set(img, buf, NULL);
+ elm_image_no_scale_set(img, EINA_TRUE);
+ elm_image_file_set(icon, buf, NULL);
+ }
+ else {
+ elm_image_file_set(img, path, NULL);
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+ elm_image_file_set(icon, path, NULL);
+ elm_image_aspect_fixed_set(icon, EINA_FALSE);
+ }
+
+ elm_object_part_content_set(m->base, MUSIC_PART_CTXT_ICON, img);
+ elm_object_part_text_set(m->base, MUSIC_PART_CTXT_TITLE, title);
+ elm_object_part_text_set(m->base, MUSIC_PART_CTXT_SUBTITLE, subtitle);
+ elm_object_part_text_set(m->base, MUSIC_PART_CTXT_SUBTITLE2,
+ subtitle2);
+ elm_object_part_text_set(m->base, MUSIC_PART_CTXT_RELCTNTTEXT,
+ _(rltvtitle));
+
+ if (cinfo->type == CONTEXT_TYPE_ARTIST || cinfo->type == CONTEXT_TYPE_GENRE ||
+ cinfo->type == CONTEXT_TYPE_FOLDER ||
+ cinfo->type == CONTEXT_TYPE_PLAYLIST)
+ free(subtitle);
+
+ if (rltvlist)
+ m_CreateRltvContent(rltvlist);
+
+ if (ctntinfo)
+ m_CreateMoreinfoLayout(ctntinfo, icon);
+ else
+ elm_object_signal_emit(m->base, MUSIC_SIGNAL_HIDE,
+ MUSIC_CONTEXT_VIEW);
+
+ return true;
+}
+
+
+bool CContextView::m_CreateFullView(void)
+{
+ if (!m_CreateInfoPart())
+ return false;
+
+ if (!m_CreateBtnsPart())
+ return false;
+
+ return true;
+}
+
+
+bool CContextView::Create(void *data)
+{
+ ASSERT(!m);
+
+ Evas_Object *base;
+ Evas_Object *win;
+ CMusicController *mhandle;
+ SContentInfo *ctxtinfo;
+ CViewMgr *mgr = CViewMgr::GetInstance();
+
+ if (!mgr || !data)
+ return false;
+
+ win = mgr->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ return false;
+ }
+
+ mhandle = CMusicController::GetInstance();
+ if (!mhandle) {
+ _ERR(" music controller get music instance failed ");
+ return false;
+ }
+
+ SParcel *parcel = (SParcel *)data;
+ ctxtinfo = parcel->ctxtInfo;
+ if (ctxtinfo->type < CONTEXT_TYPE_SONG || ctxtinfo->type > CONTEXT_TYPE_PLAYSONG
+ || !ctxtinfo->context) {
+ _ERR("Wrong context info");
+ return false;
+ }
+
+ m = new SContextView;
+ if (!m) {
+ _ERR(" calloc failed ");
+ return false;
+ }
+
+ base = _add_base(win, MUSIC_CONTEXT_VIEW);
+ if (!base) {
+ _ERR(" add base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ bool r = CBaseView::Create(data);
+ if (!r) {
+ _ERR(" CBaseView Creation failed ");
+ evas_object_del(base);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ m->type = ctxtinfo->type;
+ m->vmgr = mgr;
+ m->win = win;
+ m->mhandle = mhandle;
+ m->base = base;
+ m->ctxtinfo = ctxtinfo;
+ m->parent = this;
+ m->listRltvCtntLayout = NULL;
+
+ if (!m_CreateFullView()) {
+ _ERR(" create full failed ");
+ delete m;
+ evas_object_del(base);
+ return false;
+ }
+
+ Connect(base);
+
+ SContextView::CHandlerButton::SCallback cb;
+ cb.addScroller = &sm_CbAddScroller;
+ cb.cookie = this;
+ m->pHandlerButton->SetCallback(&cb);
+
+ return true;
+}
+
+
+void CContextView::Destroy(void)
+{
+ ASSERT(m);
+
+ if (m->idler)
+ ecore_idler_del(m->idler);
+
+ if (m->listRltvCtntLayout) {
+ SContextView::CHandlerRelativeContentLayout *layoutHandler;
+ void *obj;
+ EINA_LIST_FREE(m->listRltvCtntLayout, obj) {
+ layoutHandler = (SContextView::CHandlerRelativeContentLayout *)obj;
+ delete layoutHandler;
+ }
+ }
+
+ CBaseView::Destroy();
+ evas_object_del(m->base);
+
+ delete m;
+ m = NULL;
+}
+
+
+Evas_Object* CContextView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+
+void CContextView::t_OnShow(void)
+{
+ ASSERT(m);
+
+ evas_object_show(m->base);
+}
+
+
+void CContextView::t_OnUpdate(void *data)
+{
+ ASSERT(m);
+
+ if (!data)
+ return;
+
+ SParcel *parcel = (SParcel *)data;
+ if (parcel->ctxtInfo != NULL) {
+ SContentInfo *ctxtinfo = parcel->ctxtInfo;
+
+ m->type = ctxtinfo->type;
+ m->ctxtinfo = ctxtinfo;
+
+ m_CreateFullView();
+ }
+ else {
+ int update_type = parcel->updateType;
+
+ if (update_type != E_SONG_UPDATE)
+ return;
+
+ if (m->ctxtinfo->status == PLAY_STATUS_PLAY) {
+ m_AddBtnLabel(m->playbtn, MUSIC_TEXT_PAUSE);
+ m_AddBtnIcon(m->playbtn, MUSIC_IMAGE_CTXT_BTNPAUSE);
+ }
+ else {
+ m_AddBtnLabel(m->playbtn, MUSIC_TEXT_PLAY);
+ m_AddBtnIcon(m->playbtn, MUSIC_IMAGE_CTXT_BTNPLAY);
+ }
+ }
+}
+
+
+void CContextView::t_OnHide(void)
+{
+ ASSERT(m);
+
+ evas_object_hide(m->base);
+}
+
+
+void CContextView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ if (m->ctxtinfo && m->ctxtinfo->close)
+ m->ctxtinfo->close(m->ctxtinfo->cbdata);
+ }
+ else if (!strcmp(ev->keyname, KEY_EXIT))
+ elm_exit();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <utilX.h>
+#include "i18n.h"
+#include "define.h"
+#include "common.h"
+#include "common-ui.h"
+#include "entry-popup.h"
+
+//#define KEY_SELECT "Select"
+#define KEY_POPUP_ENTER "Return"
+
+struct entrypopup_data {
+ Evas_Object *layout;
+ Evas_Object *entry;
+ void (*entryname_cb)(void *, const char *);
+ void *data;
+ Ecore_Idler *idler;
+};
+
+static void _entry_key_pressed(void *dt, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct entrypopup_data *epd;
+ Evas_Event_Key_Down *ev;
+ const char *str;
+
+ if (!obj || !e || !ei || !dt)
+ return;
+
+ epd = (entrypopup_data *)dt;
+ ev = (Evas_Event_Key_Down *)ei;
+
+ if (!ev->keyname)
+ return;
+
+ if (strcmp(ev->keyname, KEY_BACK) == 0)
+ destroy_entry_popup(epd->layout);
+ // Keyname should be checked!!!
+ else if (strcmp(ev->keyname, KEY_POPUP_ENTER/*KEY_SELECT*/) == 0) {
+ str = elm_entry_entry_get(obj);
+ if (epd->entryname_cb && str)
+ epd->entryname_cb(epd->data, str);
+ }
+}
+
+static Eina_Bool _focus_idler_cb(void *dt)
+{
+ struct entrypopup_data *epd;
+
+ if (!dt)
+ return ECORE_CALLBACK_CANCEL;
+
+ epd = (entrypopup_data *)dt;
+ epd->idler = NULL;
+ elm_object_focus_set(epd->entry, EINA_TRUE);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void destroy_entry_popup(Evas_Object *layout)
+{
+ struct entrypopup_data *epd;
+
+ if (!layout)
+ return;
+
+ epd = (entrypopup_data *)evas_object_data_get(layout, MUSIC_ENTRY_POPUP_DATA);
+ if (epd) {
+ if (epd->idler)
+ ecore_idler_del(epd->idler);
+ free(epd);
+ }
+
+ evas_object_del(layout);
+}
+
+Evas_Object *create_entry_popup(Evas_Object *base, const char *text,
+ void (*entryname_cb)(void *, const char *), void *data)
+{
+ Evas_Object *layout, *entry;
+ struct entrypopup_data *epd;
+
+ if (!base)
+ return NULL;
+
+ layout = elm_layout_add(base);
+ if (!layout)
+ return NULL;
+
+ elm_layout_file_set(layout, EDJEFILE, MUSIC_ENTRY_POPUP_LAYOUT);
+ evas_object_size_hint_weight_set(layout,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(layout,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(layout);
+
+ entry = elm_entry_add(layout);
+ if (!entry) {
+ evas_object_del(layout);
+ return NULL;
+ }
+
+ elm_object_style_set(entry, MUSIC_STYLE_ENTRY);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_input_panel_language_set(entry,
+ ELM_INPUT_PANEL_LANG_ALPHABET);
+ evas_object_size_hint_weight_set(entry,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ if (text)
+ elm_entry_entry_set(entry, text);
+ elm_entry_cursor_end_set(entry);
+ elm_object_part_content_set(layout, MUSIC_PART_ENTRY, entry);
+
+ epd = (entrypopup_data *)calloc(1, sizeof(*epd));
+ if (!epd) {
+ evas_object_del(layout);
+ return NULL;
+ }
+
+ epd->layout = layout;
+ epd->entry = entry;
+ epd->entryname_cb = entryname_cb;
+ epd->data = data;
+ epd->idler = ecore_idler_add(_focus_idler_cb, epd);
+
+ evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
+ _entry_key_pressed, epd);
+ evas_object_data_set(layout, MUSIC_ENTRY_POPUP_DATA, epd);
+
+ return layout;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+#include "folder_info.h"
+#include "song_info.h"
+
+#include <InputHandler.h>
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "folder-layout.h"
+#include "base-view.h"
+
+#define TOTAL_ADD_BTNS 3
+#define GENGRID_ITEM_SIZE_W (263+20)
+#define GENGRID_ITEM_SIZE_H (359+20)
+
+struct SFolderItemInfo {
+ folder_info *finfo;
+ SSongInfo *sinfo;
+ Elm_Object_Item *item;
+ int depth;
+};
+
+const char *g_sourceTexts[] = {
+ N_("All Source"), // SOURCE_TYPE_ALL
+ N_("TV"), // SOURCE_TYPE_TV
+ N_("USB") // SOURCE_TYPE_USB
+};
+
+enum EBtnType {
+ ABTN_PLAY,
+ ABTN_NEXT,
+ ABTN_LAST
+};
+
+enum EDepthType {
+ E_DEPTH_NONE,
+ E_DEPTH_FOLDER,
+ E_DEPTH_SONG
+};
+
+struct SBtnInfo {
+ const char *name;
+ const char *part;
+ const char *style;
+ const char *icon;
+};
+
+struct SFolderLayout {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *grid;
+ Elm_Object_Item *focused_item;
+ Eina_List *flist;
+ Eina_List *slist;
+ Eina_List *it_infolist;
+ Elm_Gengrid_Item_Class *item_class;
+ Elm_Gengrid_Item_Class *songitem_class;
+ Ecore_Idler *focus_idler;
+ CMusicController *mhandle;
+ CLayoutMgr *lmgr;
+ CViewMgr *vmgr;
+ folder_info *c_finfo;
+ SSongInfo *c_sinfo;
+ SContentInfo *ctxtinfo;
+ CFolderLayout *parent;
+ int depth;
+
+ class CHandlerButton : public CListenerMgr, public IMouseMoveListener, public IMouseClickedListener {
+ public:
+ struct SCallback {
+ void(*gotoPlayBackView)(void* cookie, int mode, char *mediaId);
+ void* cookie;
+ };
+
+ private:
+ SFolderLayout *m;
+
+ protected:
+ SCallback m_callback;
+
+ public:
+ CHandlerButton(SFolderLayout *ins) :
+ IMouseMoveListener(this),
+ IMouseClickedListener(this) {
+ m = ins;
+ }
+
+ void SetCallback(const SCallback* cb) {
+ m_callback = *cb;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+ {
+ if (!obj)
+ return;
+
+ if (!elm_object_focus_get(obj))
+ elm_object_focus_set(obj, EINA_TRUE);
+ }
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj)
+ {
+ EBtnType type = (EBtnType)id;
+
+ switch (type)
+ {
+ case ABTN_PLAY:
+ if (m_callback.gotoPlayBackView)
+ m_callback.gotoPlayBackView(m_callback.cookie, ADD_TYPE_FRESH, NULL);
+ break;
+
+ case ABTN_NEXT:
+ if (m_callback.gotoPlayBackView)
+ m_callback.gotoPlayBackView(m_callback.cookie, ADD_TYPE_NEXT, NULL);
+ break;
+
+ case ABTN_LAST:
+ if (m_callback.gotoPlayBackView)
+ m_callback.gotoPlayBackView(m_callback.cookie, ADD_TYPE_END, NULL);
+ break;
+
+ default:
+ _ERR("Invalid Button Type");
+ ASSERT(0);
+ break;
+ }
+ }
+ } *pHandlerButton;
+
+ class CHandlerGrid : public CListenerMgr, public IMouseMoveListener, public IKeyDownListener, public IRealizedListener, public IUnrealizedListener {
+ public:
+ struct SCallback {
+ void(*goToPlaybackView)(void *cookie, int mode, char *mediaId);
+ void(*goToContextView)(void *cookie, SContentInfo *contextInfo);
+ void(*updateGrid)(void *cookie);
+ void* cookie;
+ };
+
+ private:
+ SFolderLayout *m;
+ SCallback m_callback;
+
+ private:
+ SFolderItemInfo *m_FindItemInfo(Eina_List *list, Elm_Object_Item *item)
+ {
+ Eina_List *l = NULL;
+ SFolderItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ if (!list || !item)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SFolderItemInfo *)obj;
+ if (itinfo->item == item)
+ return itinfo;
+ }
+
+ return NULL;
+ }
+
+ static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+ {
+ CHandlerGrid *root = (CHandlerGrid *)dt;
+ if (root) {
+ root->m_OnCtxtUpdate(type, lid);
+ }
+ }
+
+ void m_OnCtxtUpdate(EActionType type, int lid)
+ {
+ Eina_List *list = NULL;
+ SSongInfo *sinfo = NULL;
+ EAddType mode;
+
+ 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 = (SSongInfo *)m->ctxtinfo->context;
+ list = eina_list_append(list, sinfo);
+ }
+ else {
+ m->mhandle->MediaGetList(LIST_TYPE_FOLDER_SONG,
+ m->ctxtinfo->context, &list);
+ sinfo = (SSongInfo *)eina_list_data_get(list);
+ }
+
+ if (type == ACTION_TYPE_ADDTO) {
+ if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
+ _ERR(" Adding songs to playlist failed ");
+ else
+ _create_message_box(m->base, MUSIC_TEXT_ADDTO_MSG);
+
+ return;
+ }
+
+ m->mhandle->UpdatePlaylist(list, mode);
+ eina_list_free(list);
+
+ if (type == ACTION_TYPE_PLAY) {
+ m->mhandle->Stop();
+ m->mhandle->SetCurrentSong(song_info_get_media_id(sinfo));
+ }
+
+ _update_playback_view((EAddType)type, m->parent->Layout(), m->focused_item);
+ }
+
+ static void sm_CbCtxtClose(void *dt)
+ {
+ CHandlerGrid *root = (CHandlerGrid *)dt;
+ if (root)
+ root->m_OnCtxtClose();
+ }
+
+ void m_OnCtxtClose(void)
+ {
+ m->vmgr->PopView();
+ m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
+ elm_object_item_focus_set(m->focused_item, EINA_TRUE);
+ }
+
+ static void sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source)
+ {
+ CHandlerGrid *root = (CHandlerGrid *)data;
+ if (root)
+ root->m_OnItemSelect(it, emission, source);
+ }
+
+ void m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source)
+ {
+ SFolderItemInfo *itinfo = NULL;
+ char *id = NULL;
+
+ if (!m)
+ return;
+
+ itinfo = m_FindItemInfo(m->it_infolist, it);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ if (m->depth == E_DEPTH_SONG) {
+ if (m->c_sinfo) {
+ song_info_destroy(m->c_sinfo);
+ m->c_sinfo = NULL;
+ }
+ m->c_sinfo = song_info_duplicate(itinfo->sinfo);
+ }
+ else {
+ if (m->c_finfo) {
+ folder_info_destroy(m->c_finfo);
+ m->c_finfo = NULL;
+ }
+ m->c_finfo = folder_info_duplicate(itinfo->finfo);
+ }
+
+ if (m->depth == E_DEPTH_SONG) {
+ id = song_info_get_media_id(m->c_sinfo);
+ elm_gengrid_item_selected_set(it, EINA_FALSE);
+ // Goto Playback View with id
+ if (m_callback.goToPlaybackView)
+ m_callback.goToPlaybackView(m_callback.cookie, ADD_TYPE_FRESH, id);
+ }
+ else {
+ m->depth = E_DEPTH_SONG;
+ // Update folder grid and add idler
+ if (m_callback.updateGrid)
+ m_callback.updateGrid(m_callback.cookie);
+ }
+ }
+
+ public:
+ CHandlerGrid(SFolderLayout *ins) :
+ IMouseMoveListener(this),
+ IKeyDownListener(this),
+ IRealizedListener(this),
+ IUnrealizedListener(this) {
+ m = ins;
+ }
+
+ void SetCallback(const SCallback* cb)
+ {
+ m_callback = *cb;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+ {
+ Elm_Object_Item *item;
+
+ item = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
+ if (!item)
+ return;
+
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+ }
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+ {
+ Elm_Object_Item *it = NULL;
+ SContentInfo *ctxtinfo = NULL;
+ SFolderItemInfo *itinfo = NULL;
+
+ if (!obj)
+ return;
+
+ 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 (m->ctxtinfo) {
+ free(m->ctxtinfo);
+ m->ctxtinfo = NULL;
+ }
+
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!ctxtinfo)
+ return;
+
+ itinfo = m_FindItemInfo(m->it_infolist, it);
+ if (!itinfo) {
+ free(ctxtinfo);
+ return;
+ }
+
+ ctxtinfo->cbdata = this;
+ ctxtinfo->update = sm_CbCtxtUpdate;
+ ctxtinfo->close = sm_CbCtxtClose;
+ if (m->depth == E_DEPTH_SONG) {
+ ctxtinfo->type = CONTEXT_TYPE_SONG;
+ ctxtinfo->context = itinfo->sinfo;
+ }
+ else {
+ ctxtinfo->type = CONTEXT_TYPE_FOLDER;
+ ctxtinfo->context = itinfo->finfo;
+ }
+
+ m->ctxtinfo = ctxtinfo;
+
+ // Go to the context view with ctxtinfo
+ if (m_callback.goToContextView)
+ m_callback.goToContextView(m_callback.cookie, ctxtinfo);
+ }
+
+ virtual void OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+ {
+ elm_object_item_signal_callback_add(item,
+ MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+ sm_CbItemSelect, this);
+ }
+
+ virtual void OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+ {
+ elm_object_item_signal_callback_del((Elm_Object_Item *)item,
+ MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+ sm_CbItemSelect);
+ }
+ } *pHandlerGrid;
+
+ SFolderLayout() {
+ memset(this, 0, sizeof(SFolderLayout));
+ pHandlerGrid = new CHandlerGrid(this);
+ pHandlerButton = new CHandlerButton(this);
+ }
+
+ ~SFolderLayout() {
+ delete pHandlerGrid;
+ delete pHandlerButton;
+ }
+};
+
+
+char *CFolderLayout::sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SFolderItemInfo *itinfo = (SFolderItemInfo *)data;
+ folder_info *finfo = NULL;
+ char *txt = NULL;
+ char buf[MAX_LENGTH];
+ int count;
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ finfo = itinfo->finfo;
+
+ if (!strcmp(part, "elm.text")) {
+ txt = folder_info_get_name(finfo);
+ if (txt)
+ return strdup(txt);
+ }
+ else if (!strcmp(part, "elm.text1")) {
+ count = folder_info_get_count(finfo);
+ snprintf(buf, sizeof(buf), "%d Songs", count);
+ return strdup(buf);
+ }
+
+ return NULL;
+}
+
+
+char *CFolderLayout::sm_CbGetGridSongItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SFolderItemInfo *itinfo = (SFolderItemInfo *)data;
+ SSongInfo *sinfo = NULL;
+ char *txt = NULL;
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ sinfo = itinfo->sinfo;
+
+ if (!strcmp(part, "elm.text"))
+ txt = song_info_get_title(sinfo);
+ else if (!strcmp(part, "elm.text1"))
+ txt = song_info_get_artist(sinfo);
+
+ if (txt)
+ return strdup(txt);
+
+ return NULL;
+}
+
+
+Evas_Object *CFolderLayout::sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *img = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!data || !obj)
+ return NULL;
+
+ if (!strcmp(part, "elm.swallow.icon")) {
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_FOLDER);
+ elm_image_file_set(img, buf, "NULL");
+ elm_image_no_scale_set(img, EINA_TRUE);
+ return img;
+ }
+
+ return NULL;
+}
+
+
+Evas_Object *CFolderLayout::sm_CbGetGridSongItemContent(void *data, Evas_Object *obj, const char *part)
+{
+ SSongInfo *sinfo = NULL;
+ SFolderItemInfo *itinfo = NULL;
+ char *path = NULL;
+ Evas_Object *img = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!data || !obj)
+ return NULL;
+
+ itinfo = (SFolderItemInfo *)data;
+ sinfo = itinfo->sinfo;
+
+ if (!strcmp(part, "elm.swallow.icon")) {
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ path = song_info_get_thumb(sinfo);
+ if (!path) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(img, buf, NULL);
+ elm_image_no_scale_set(img, EINA_TRUE);
+ }
+ else {
+ elm_image_file_set(img, path, NULL);
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+ }
+ return img;
+ }
+ return NULL;
+}
+
+
+void CFolderLayout::sm_CbRemoveGridItem(void *data, Evas_Object *obj)
+{
+ free(data);
+}
+
+
+Eina_Bool CFolderLayout::sm_CbFocusIdler(void *dt)
+{
+ CFolderLayout *root = (CFolderLayout *)dt;
+
+ if (root)
+ root->m_OnFocusIdler();
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+void CFolderLayout::m_OnFocusIdler(void)
+{
+ Elm_Object_Item *it = NULL;
+
+ m->focus_idler = NULL;
+
+ if (m->depth == E_DEPTH_SONG) {
+ it = elm_gengrid_first_item_get(m->grid);
+ elm_object_item_focus_set(it, EINA_TRUE);
+ }
+ else {
+ it = m_FindItemByInfo(m->it_infolist, m->c_finfo);
+ if (it) {
+ elm_gengrid_item_show(it, ELM_GENGRID_ITEM_SCROLLTO_IN);
+ elm_object_item_focus_set(it, EINA_TRUE);
+ }
+ }
+}
+
+
+void CFolderLayout::sm_CbGoToContextView(void *cookie, SContentInfo *contextInfo)
+{
+ CFolderLayout *root = (CFolderLayout *)cookie;
+ if (root)
+ root->m_OnGotoContextView(contextInfo);
+}
+
+
+void CFolderLayout::m_OnGotoContextView(SContentInfo *contextInfo)
+{
+ SParcel parcel;
+ parcel.ctxtInfo = contextInfo;
+ if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+ _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
+}
+
+
+void CFolderLayout::sm_CbUpdateGrid(void *cookie)
+{
+ CFolderLayout *root = (CFolderLayout *)cookie;
+ if (root)
+ root->m_OnCbUpdateGrid();
+}
+
+
+void CFolderLayout::m_OnCbUpdateGrid(void)
+{
+ m_UpdateFolderGrid(false);
+ m->focus_idler = ecore_idler_add(sm_CbFocusIdler, this);
+}
+
+
+void CFolderLayout::sm_CbGoToPlaybackView(void *cookie, int mode, char *mediaId)
+{
+ CFolderLayout *root = (CFolderLayout *)cookie;
+ if (root)
+ root->m_GotoPlayback(mode, mediaId);
+}
+
+
+int CFolderLayout::m_ConvertToMin(int milsec)
+{
+ int min;
+ min = milsec / 60000; /*milli seconds per minute*/
+
+ return min;
+}
+
+
+void CFolderLayout::m_RemoveFocusIdler(void)
+{
+ if (!m->focus_idler)
+ return;
+
+ ecore_idler_del(m->focus_idler);
+ m->focus_idler = NULL;
+}
+
+
+void CFolderLayout::m_GotoPlayback(int mode, char *id)
+{
+ Eina_List *list = NULL;
+ Eina_List *l = NULL;
+ SFolderItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ bool r;
+
+ if (!m->it_infolist || eina_list_count(m->it_infolist) == 0)
+ return;
+
+ if (m->depth == E_DEPTH_SONG) {
+ EINA_LIST_FOREACH(m->it_infolist, l, obj) {
+ itinfo = (SFolderItemInfo *)obj;
+ list = eina_list_append(list, itinfo->sinfo);
+ }
+ }
+ else {
+ r = m->mhandle->MediaGetList(LIST_TYPE_SONG, NULL, &list);
+ if (r == false || eina_list_count(list) == 0)
+ return;
+ }
+
+ m->mhandle->UpdatePlaylist(list, mode);
+ eina_list_free(list);
+
+ if (mode == ADD_TYPE_FRESH) {
+ m->mhandle->Stop();
+ if (id) /* If want to play selected song */
+ m->mhandle->SetCurrentSong(id);
+ }
+
+ _update_playback_view((EAddType)mode, CExtBaseLayout::Layout(), NULL);
+}
+
+
+Elm_Object_Item *CFolderLayout::m_FindItemByInfo(Eina_List *list, folder_info *finfo)
+{
+ Eina_List *l = NULL;
+ SFolderItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ char *id = NULL;
+
+ if (!list || !finfo)
+ return NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SFolderItemInfo *)obj;
+ id = folder_info_get_folder_id(itinfo->finfo);
+ if (!strcmp(id, folder_info_get_folder_id(finfo)))
+ return itinfo->item;
+ }
+
+ return NULL;
+}
+
+
+void CFolderLayout::m_SortFolderGrid(void)
+{
+ int sort_type;
+ int(*_sortfolders[])(const void *d1, const void *d2) = {
+ sortfolders_az,
+ sortfolders_za
+ };
+ int(*_sortsongs[])(const void *d1, const void *d2) = {
+ sortsongs_title_az,
+ sortsongs_title_za
+ };
+
+ if (!m->flist)
+ return;
+
+ sort_type = m->mhandle->SortType();
+
+ if (m->depth == E_DEPTH_SONG)
+ m->flist = eina_list_sort(m->flist, 0,
+ _sortsongs[sort_type]);
+ else
+ m->flist = eina_list_sort(m->flist, 0,
+ _sortfolders[sort_type]);
+}
+
+
+void CFolderLayout::m_CreateFolderGrid(void)
+{
+ Evas_Object *grid = NULL;
+ Elm_Gengrid_Item_Class *grid_item = NULL;
+
+ grid = elm_gengrid_add(Layout());
+ if (!grid)
+ return;
+ evas_object_size_hint_weight_set(grid,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_gengrid_align_set(grid, 0, 0);
+ elm_object_part_content_set(Layout(), MUSIC_PART_FOLDER_GRID, grid);
+ m->pHandlerGrid->Connect(grid);
+ elm_gengrid_item_size_set(grid,
+ elm_config_scale_get() * GENGRID_ITEM_SIZE_W,
+ elm_config_scale_get() * GENGRID_ITEM_SIZE_H);
+ m->grid = grid;
+
+ grid_item = elm_gengrid_item_class_new();
+ if (!grid_item) {
+ evas_object_del(grid);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ grid_item->item_style = MUSIC_STYLE_FOLDER_GRID;
+ grid_item->func.text_get = sm_CbGetGridItemText;
+ grid_item->func.content_get = sm_CbGetGridItemContent;
+ grid_item->func.state_get = NULL;
+ grid_item->func.del = sm_CbRemoveGridItem;
+ m->item_class = grid_item;
+
+ grid_item = elm_gengrid_item_class_new();
+ if (!grid_item) {
+ elm_gengrid_item_class_free(m->item_class);
+ m->item_class = NULL;
+ evas_object_del(grid);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ grid_item->item_style = MUSIC_STYLE_FOLDER_GRID;
+ grid_item->func.text_get = sm_CbGetGridSongItemText;
+ grid_item->func.content_get = sm_CbGetGridSongItemContent;
+ grid_item->func.state_get = NULL;
+ grid_item->func.del = sm_CbRemoveGridItem;
+ m->songitem_class = grid_item;
+
+ m_UpdateFolderGrid(false);
+}
+
+
+void CFolderLayout::m_EmptyFolderGrid(bool sort_flag)
+{
+ if (m->grid)
+ elm_gengrid_clear(m->grid);
+
+ if (!sort_flag) {
+ eina_list_free(m->flist);
+ m->flist = NULL;
+ }
+
+ eina_list_free(m->it_infolist);
+ m->it_infolist = NULL;
+}
+
+
+void CFolderLayout::m_UpdateFolderGrid(bool sort_flag)
+{
+ bool r;
+ int ts, td, dur;
+ folder_info *finfo = NULL;
+ SSongInfo *sinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+ struct SFolderItemInfo *itinfo = NULL;
+ Elm_Object_Item *item = NULL;
+ char buf[MAX_LENGTH];
+ int source_type;
+
+ if (!m->grid || !m->item_class)
+ return;
+
+ /* Remove existing foldergrid and prepare afresh */
+ m_EmptyFolderGrid(sort_flag);
+
+ if (!sort_flag) {
+ if (m->depth == E_DEPTH_SONG) {
+ r = m->mhandle->MediaGetList(LIST_TYPE_FOLDER_SONG, m->c_finfo, &(m->flist));
+ if (r == false ||
+ eina_list_count(m->flist) == 0) {
+ _ERR(" Fetching folder list failed ");
+ return;
+ }
+ }
+ else {
+ r = m->mhandle->MediaGetList(LIST_TYPE_FOLDER,
+ NULL, &(m->flist));
+ if (r == false ||
+ eina_list_count(m->flist) == 0) {
+ _ERR(" Fetching folder list failed ");
+ SetEmptyStatus(true);
+ return;
+ }
+ }
+ }
+
+ m_SortFolderGrid();
+
+ ts = 0;
+ td = 0;
+ if (m->depth == E_DEPTH_SONG) {
+ EINA_LIST_FOREACH(m->flist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ itinfo = (SFolderItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+ itinfo->sinfo = sinfo;
+ item = elm_gengrid_item_append(m->grid,
+ m->songitem_class, itinfo,
+ NULL, m);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist,
+ itinfo);
+ elm_object_part_text_set(Layout(),
+ MUSIC_PART_FOLDER_NAME,
+ folder_info_get_name(m->c_finfo));
+ ts = ts + 1;
+ song_info_get_duration(sinfo, &dur);
+ td = td + dur;
+ }
+ }
+ else {
+ EINA_LIST_FOREACH(m->flist, l, obj) {
+ finfo = (folder_info *)obj;
+ itinfo = (SFolderItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+ itinfo->finfo = finfo;
+ item = elm_gengrid_item_append(m->grid, m->item_class,
+ itinfo, NULL, NULL);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist,
+ itinfo);
+ source_type = m->mhandle->SourceType();
+ elm_object_part_text_set(Layout(),
+ MUSIC_PART_FOLDER_NAME,
+ _(g_sourceTexts[source_type]));
+ ts = ts + folder_info_get_count(finfo);
+ td = td + folder_info_get_duration(finfo);
+ }
+ }
+ snprintf(buf, sizeof(buf), "%d", ts);
+ elm_object_part_text_set(Layout(), MUSIC_PART_FOLDER_SONGCOUNT, buf);
+
+ snprintf(buf, sizeof(buf), "%d %s", m_ConvertToMin(td),
+ _(MUSIC_TEXT_MIN));
+ elm_object_part_text_set(Layout(), MUSIC_PART_FOLDER_TIME, buf);
+}
+
+
+void CFolderLayout::m_CreateTopsection(void)
+{
+ int i;
+ Evas_Object *btn;
+ char buf[MAX_LENGTH];
+ Evas_Object *img;
+ SBtnInfo btninfo[TOTAL_ADD_BTNS];
+
+ btninfo[ABTN_PLAY].name = MUSIC_STR_PLAY;
+ btninfo[ABTN_PLAY].part = MUSIC_PART_FOLDER_PLAYBTN;
+ btninfo[ABTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
+ btninfo[ABTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
+
+ btninfo[ABTN_NEXT].name = MUSIC_STR_ADDNEXT;
+ btninfo[ABTN_NEXT].part = MUSIC_PART_FOLDER_NEXTBTN;
+ btninfo[ABTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
+ btninfo[ABTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
+
+ btninfo[ABTN_LAST].name = MUSIC_STR_ADDLAST;
+ btninfo[ABTN_LAST].part = MUSIC_PART_FOLDER_LASTBTN;
+ btninfo[ABTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
+ btninfo[ABTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
+
+ for (i = 0; i < TOTAL_ADD_BTNS; i++) {
+ btn = elm_button_add(Layout());
+ if (!btn)
+ continue;
+
+ evas_object_size_hint_weight_set(btn,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(btn, _(btninfo[i].name));
+ elm_object_style_set(btn, btninfo[i].style);
+
+ m->pHandlerButton->Connect(btn, i);
+
+ img = elm_image_add(btn);
+ if (img) {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ btninfo[i].icon);
+ elm_image_file_set(img, buf, NULL);
+ elm_object_part_content_set(btn,
+ MUSIC_PART_ELM_SWALLOWICON, img);
+ }
+
+ elm_object_part_content_set(Layout(), btninfo[i].part,
+ btn);
+ }
+}
+
+
+bool CFolderLayout::Create(CLayoutMgr *mgr)
+{
+ ASSERT(!m);
+
+ Evas_Object *base = NULL;
+ Evas_Object *win = NULL;
+ Evas_Object *layout = NULL;
+ CMusicController *mhandle = NULL;
+ CViewMgr *vmgr = NULL;
+
+ if (!mgr)
+ return false;
+
+ m = new SFolderLayout;
+ if (!m) {
+ _ERR(" calloc failed ");
+ return false;
+ }
+
+ vmgr = CViewMgr::GetInstance();
+ if (!vmgr) {
+ _ERR(" get view mgr failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ base = mgr->Base();
+ if (!base) {
+ _ERR(" get base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ win = vmgr->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ delete m;
+ return false;
+ }
+
+ mhandle = CMusicController::GetInstance();
+ if (!mhandle) {
+ _ERR(" music controller get music instance failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ layout = _add_base(base, MUSIC_FOLDER_LAYOUT);
+ if (!layout) {
+ _ERR(" get layout failed ");
+ delete m;
+ return false;
+ }
+
+ bool r = CExtBaseLayout::Create(layout);
+ if (!r) {
+ _ERR(" CBaseLayout creation failed ");
+ evas_object_del(layout);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ m->win = win;
+ m->base = base;
+ m->vmgr = vmgr;
+ m->mhandle = mhandle;
+ m->lmgr = mgr;
+ m->depth = E_DEPTH_FOLDER;
+ m->parent = this;
+
+ m_CreateTopsection();
+ m_CreateFolderGrid();
+
+ Connect(layout);
+
+ SFolderLayout::CHandlerGrid::SCallback cb;
+ cb.goToPlaybackView = &sm_CbGoToPlaybackView;
+ cb.goToContextView = &sm_CbGoToContextView;
+ cb.updateGrid = &sm_CbUpdateGrid;
+ cb.cookie = this;
+ m->pHandlerGrid->SetCallback(&cb);
+
+ SFolderLayout::CHandlerButton::SCallback btnCb;
+ btnCb.gotoPlayBackView = &sm_CbGoToPlaybackView;
+ btnCb.cookie = this;
+ m->pHandlerButton->SetCallback(&btnCb);
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_LAYOUT_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+
+ return true;
+}
+
+
+void CFolderLayout::Destroy(void)
+{
+ ASSERT(m);
+
+ m_RemoveFocusIdler();
+ m_EmptyFolderGrid(false);
+ CExtBaseLayout::Destroy();
+ evas_object_del(Layout());
+
+ free(m->c_finfo);
+ free(m->c_sinfo);
+ free(m->ctxtinfo);
+ delete m;
+ m = NULL;
+}
+
+
+void CFolderLayout::t_OnShow(void)
+{
+ ASSERT(m);
+ m->depth = E_DEPTH_FOLDER;
+ m_UpdateFolderGrid(false);
+ evas_object_show(Layout());
+}
+
+
+void CFolderLayout::Update(bool focusFlag)
+{
+ ASSERT(m);
+
+ if (!focusFlag) {
+ m_UpdateFolderGrid(true);
+ return;
+ }
+
+ elm_object_focus_set(m->grid, EINA_TRUE);
+}
+
+
+void CFolderLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ if (m->depth == E_DEPTH_SONG) {
+ m->depth = E_DEPTH_FOLDER;
+ m_UpdateFolderGrid(false);
+ m_RemoveFocusIdler();
+ m->focus_idler = ecore_idler_add(sm_CbFocusIdler, this);
+ }
+ else {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_FOCUS_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+
+#include <InputHandler.h>
+#include "category_info.h"
+#include "album_info.h"
+#include "song_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "entry-popup.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "category-layout.h"
+#include "base-view.h"
+#include "genre-layout.h"
+
+
+struct SGenreLayout {
+
+};
+
+
+void CGenreLayout::t_HandleItemSelect(SCatItemInfo *itinfo)
+{
+ int count;
+ album_info *alinfo = NULL;
+ Eina_List *alist = NULL;
+
+ if (!itinfo)
+ return;
+
+ t.c_catinfo = category_info_duplicate(itinfo->catinfo);
+ count = 0;
+
+ alist = category_info_get_albumlist(t.c_catinfo);
+ if (alist)
+ count = eina_list_count(alist);
+
+ if (count <= 0)
+ return;
+
+ t.depth = E_DEPTH_ALBUM;
+ if (count == 1) {
+ t.depth = E_DEPTH_SONG;
+ if (t.c_alinfo) {
+ album_info_destroy(t.c_alinfo);
+ t.c_alinfo = NULL;
+ }
+ alinfo = (album_info *)eina_list_nth(t.c_catinfo->albumlist, 0);
+ t.c_alinfo = album_info_duplicate(alinfo);
+ }
+}
+
+
+bool CGenreLayout::t_GetMediaList(Eina_List **list)
+{
+ return CMusicController::GetInstance()->MediaGetList(LIST_TYPE_GENRE, NULL, list);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "define.h"
+#include <InputHandler.h>
+#include "song_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"
+
+
+#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 */
+
+
+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;
+ bool edit_mode;
+ bool check_status;
+ bool select_status;
+};
+
+struct SPlaybackView {
+ Evas_Object *eoWin;
+
+ Evas_Object *eoBase;
+ Evas_Object *eoCtxPopup; /*settings popup*/
+ Evas_Object *eoErrPopup;
+ Evas_Object *eoPlaylist;
+
+ Elm_Object_Item *focused_item;
+
+ 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;
+ 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)
+{
+ CPlaybackView *root = (CPlaybackView*)data;
+ 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);
+ }
+}
+
+
+void CPlaybackView::sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+{
+ SPlaybackView *m = (SPlaybackView *)dt;
+ SItemInfo *itinfo = NULL;
+
+ if (!m)
+ return;
+
+ if (!m->ctxtinfo || !m->ctxtinfo->context)
+ return;
+
+ itinfo = m->parent->m_FindItemInfoFromSong(m->elInfo,
+ (SSongInfo *)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();
+ }
+ else if (type == ACTION_TYPE_PLAY) {
+ if (m->ctxtinfo->status == PLAY_STATUS_PLAY)
+ m->parent->m_KeyPausePress();
+ else {
+ if (itinfo == m->cs_itinfo)
+ m->parent->m_KeyPlayPress();
+ else
+ m->parent->m_HandleGenlistItemActivated(m->eoPlaylist, itinfo->item);
+ }
+ }
+ else
+ _ERR(" Wrong ctxt add type in plaback view ");
+
+ if (!m->mgr->PushView(MUSIC_PLAYBACK_VIEW, NULL)) {
+ _ERR(" viewmgr show failed ");
+ return;
+ }
+ 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);
+}
+
+
+void CPlaybackView::m_RemoveTimer(int timer_code)
+{
+ 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;
+ }
+}
+
+
+void CPlaybackView::m_PlaybackPause(void)
+{
+ m->hMusicController->Pause();
+
+ if (m->etSlider)
+ ecore_timer_freeze(m->etSlider);
+}
+
+
+void CPlaybackView::m_PlaybackResume(void)
+{
+ m->hMusicController->Resume();
+
+ if (m->etSlider)
+ ecore_timer_thaw(m->etSlider);
+}
+
+
+void CPlaybackView::m_ChangeEditmodeAll(Eina_List *list, bool flag)
+{
+ SItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SItemInfo *)obj;
+ itinfo->edit_mode = flag;
+ }
+}
+
+
+void CPlaybackView::m_DisableCheckAll(Eina_List *list)
+{
+ SItemInfo *itinfo = NULL;
+ void *obj = NULL;
+ Eina_List *l = NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SItemInfo *)obj;
+ itinfo->check_status = false;
+ }
+}
+
+
+void CPlaybackView::m_SelectItem(SItemInfo *pItemInfo)
+{
+ if (!pItemInfo || !pItemInfo->item)
+ return;
+
+ elm_genlist_item_bring_in(pItemInfo->item, ELM_GENLIST_ITEM_SCROLLTO_IN);
+ elm_object_item_signal_emit(pItemInfo->item, MUSIC_SIGNAL_SELECT_ITEM, MUSIC_PLAYBACK_VIEW);
+
+ pItemInfo->select_status = true;
+}
+
+
+void CPlaybackView::m_UnselectItem(SItemInfo *pItemInfo)
+{
+ if (!pItemInfo || !pItemInfo->item)
+ return;
+
+ elm_object_item_signal_emit(pItemInfo->item, MUSIC_SIGNAL_UNSELECT_ITEM,
+ MUSIC_PLAYBACK_VIEW);
+
+ pItemInfo->select_status = false;
+}
+
+
+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;
+ char buf[MAX_LENGTH];
+
+ if (!m->cs_itinfo || !m->cs_itinfo->sinfo)
+ return;
+
+ path = song_info_get_thumb(m->cs_itinfo->sinfo);
+ if (path)
+ elm_image_file_set(m->eoAlbumCover, path, NULL);
+ else {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_450);
+ elm_image_file_set(m->eoAlbumCover, buf, NULL);
+ }
+}
+
+
+void CPlaybackView::m_UpdateCurrentSongLabels(void)
+{
+ char buf[MAX_LENGTH];
+
+ if (!m->csinfo)
+ return;
+
+ elm_object_part_text_set(m->eoBase, MUSIC_PART_SONG_TITLE,
+ song_info_get_title(m->csinfo));
+
+ snprintf(buf, sizeof(buf), "%s - %s", song_info_get_artist(m->csinfo),
+ song_info_get_album(m->csinfo));
+
+ elm_object_part_text_set(m->eoBase, MUSIC_PART_ARTIST_ALBUM, buf);
+}
+
+
+void CPlaybackView::m_UpdateEmptySongInfo(void)
+{
+ 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);
+ 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,
+ _(NO_PLAYLIST_MESSAGE_SUB));
+ 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);
+}
+
+
+void CPlaybackView::m_UpdateCtxtView(int playStatus)
+{
+ if (!m->cs_itinfo || !m->ctxtinfo)
+ return;
+
+ if (!m->mgr->CheckTop(MUSIC_CONTEXT_VIEW))
+ return;
+
+ if (m->cs_itinfo->sinfo == m->ctxtinfo->context) {
+ m->ctxtinfo->status = (EPlayStatus)playStatus;
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_SONG_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+ m->mgr->UpdateView((const char *)MUSIC_CONTEXT_VIEW, &parcel);
+ }
+}
+
+
+void CPlaybackView::m_UpdateCurrentSongItem(int index)
+{
+ SItemInfo *pItemInfo = NULL;
+
+ if (m->cs_itinfo) {
+ m_UnselectItem(m->cs_itinfo);
+ m_UpdateCtxtView(PLAY_STATUS_PAUSE);
+ }
+
+ pItemInfo = (SItemInfo *)eina_list_nth(m->elInfo, index);
+
+ if (pItemInfo) {
+ m->cs_itinfo = pItemInfo;
+ if (m->hMusicController->PlayState() == PLAY_STATUS_STOP) {
+ elm_genlist_item_bring_in(pItemInfo->item,
+ ELM_GENLIST_ITEM_SCROLLTO_IN);
+ }
+ else {
+ m_SelectItem(pItemInfo);
+ m_UpdateCtxtView(PLAY_STATUS_PLAY);
+ }
+ }
+}
+
+
+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);
+}
+
+
+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 {
+ 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->eoPlaylist, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->eoBtnControl[BTN_PLAY],
+ m->eoBtnControl[BTN_FORWARD], ELM_FOCUS_RIGHT);
+ }
+}
+
+
+void CPlaybackView::m_UpdateCurrentSongInfo(void)
+{
+ SSongInfo *sinfo = NULL;
+ int index;
+
+ if (eina_list_count(m->elInfo) == 0) {
+ m_UpdateEmptySongInfo();
+ return;
+ }
+
+ if (!m->hMusicController->GetCurrentSongIndex(&index)) {
+ _ERR(" music get current song index failed ");
+ return;
+ }
+
+ if (!m->hMusicController->GetSonginfoFromIndex(index, &sinfo)) {
+ _ERR(" music get songinfo failed ");
+ return;
+ }
+ m->csinfo = sinfo;
+
+ m_UpdateCurrentSongItem(index);
+ m_UpdateCurrentSongLabels();
+ m_UpdateCurrentSongThumbnail();
+ m_UpdateCurrentSongProgressbar();
+ m_UpdateControlBtns();
+ m_UpdatePlaymodeFocusSequence();
+}
+
+
+void CPlaybackView::m_DisableEditButtons(bool flag)
+{
+ /* flag - 1 means disable edit buttons and 0 means enable */
+ if (flag)
+ elm_object_focus_set(m->eoBtnEdit[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);
+ if (flag) {
+ m_UpdateEditmodeFocusSequence();
+ elm_object_focus_set(m->eoBtnEdit[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_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) {
+ elm_genlist_item_bring_in(m->cs_itinfo->item,
+ ELM_GENLIST_ITEM_SCROLLTO_IN);
+ }
+ else
+ m_SelectItem(m->cs_itinfo);
+
+ elm_object_signal_emit(m->eoBase, MUSIC_SIGNAL_PLAYBACK_MODE,
+ MUSIC_PLAYBACK_VIEW);
+ elm_object_focus_set(m->eoBtnControl[BTN_SETTINGS], EINA_TRUE);
+
+ m_ChangeEditmodeAll(m->elInfo, false);
+
+ elm_genlist_realized_items_update(m->eoPlaylist);
+
+ m_UpdatePlaymodeFocusSequence();
+}
+
+
+void CPlaybackView::m_FromPlaybackToEditMode(void)
+{
+ elm_object_signal_emit(m->eoBase, MUSIC_SIGNAL_EDIT_MODE,
+ MUSIC_PLAYBACK_VIEW);
+
+ m_DisableEditButtons(true);
+
+ elm_object_focus_set(m->eoBtnEdit[BTN_CANCEL], EINA_TRUE);
+
+ m_ChangeEditmodeAll(m->elInfo, true);
+
+ elm_genlist_realized_items_update(m->eoPlaylist);
+
+ m_UpdateEditmodeFocusSequence();
+}
+
+
+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;
+ 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;
+ m_UnselectItem(m->cs_itinfo);
+ m_RemoveTimer(TIMER_SLIDER);
+ m->cs_itinfo = NULL;
+ m->hMusicController->SetPlayState(PLAY_STATUS_STOP);
+ m->hMusicController->Stop();
+ }
+ index = elm_genlist_item_index_get(pItemInfo->item);
+ m->hMusicController->RemoveSong(pItemInfo->sinfo, index);
+
+ 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);
+ return;
+ }
+
+ if (flag)
+ m_UpdateCurrentSongInfo();
+
+ elm_genlist_realized_items_update(m->eoPlaylist);
+ elm_object_focus_set(m->eoBtnEdit[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);
+}
+
+
+void CPlaybackView::m_KeyExitPress(void)
+{
+ m_RemoveTimer(TIMER_SLIDER);
+ m->hMusicController->Stop();
+ elm_exit();
+}
+
+
+void CPlaybackView::m_KeyPlayPress(void)
+{
+ int state;
+
+ if (elm_object_disabled_get(m->eoBtnControl[BTN_PLAY]))
+ return;
+
+ state = m->hMusicController->PlayState();
+ if (state == PLAY_STATUS_PAUSE) {
+ m_PlaybackResume();
+ elm_object_signal_emit(m->eoBtnControl[BTN_PLAY],
+ MUSIC_SIGNAL_PLAY, MUSIC_PLAYBACK_VIEW);
+ }
+ else if (state != PLAY_STATUS_PLAY) {
+ if (m->hMusicController)
+ m->hMusicController->Start();
+
+ m_UpdateCurrentSongInfo();
+ }
+}
+
+
+void CPlaybackView::m_KeyPausePress(void)
+{
+ int state;
+
+ if (elm_object_disabled_get(m->eoBtnControl[BTN_PLAY]))
+ return;
+
+ state = m->hMusicController->PlayState();
+ if (state == PLAY_STATUS_PLAY) {
+ elm_object_signal_emit(m->eoBtnControl[BTN_PLAY],
+ MUSIC_SIGNAL_PAUSE, MUSIC_PLAYBACK_VIEW);
+ m_PlaybackPause();
+ }
+}
+
+
+void CPlaybackView::m_KeyNextPress(void)
+{
+ if (elm_object_disabled_get(m->eoBtnControl[BTN_FORWARD]))
+ return;
+
+ m_HandleOnPressed(m->eoBtnControl[BTN_FORWARD]);
+}
+
+
+void CPlaybackView::m_KeyPreviousPress(void)
+{
+ if (elm_object_disabled_get(m->eoBtnControl[BTN_REWIND]))
+ return;
+
+ m_HandleOnPressed(m->eoBtnControl[BTN_REWIND]);
+}
+
+
+void CPlaybackView::m_KeyNextUnpress(void)
+{
+ if (elm_object_disabled_get(m->eoBtnControl[BTN_FORWARD]))
+ return;
+
+ m_HandleOnUnpressed(m->eoBtnControl[BTN_FORWARD]);
+ //sm_CbOnUnpressed(m, m->eoBtnControl[BTN_FORWARD], NULL);
+}
+
+
+void CPlaybackView::m_KeyPreviousUnpress(void)
+{
+ if (elm_object_disabled_get(m->eoBtnControl[BTN_REWIND]))
+ return;
+
+ m_HandleOnUnpressed(m->eoBtnControl[BTN_REWIND]);
+ //sm_CbOnUnpressed(m, m->eoBtnControl[BTN_REWIND], NULL);
+}
+
+
+void CPlaybackView::m_HandleKeyPress(char *keyname)
+{
+ if (strcmp(keyname, (char*)KEY_EXIT) == 0)
+ m_KeyExitPress();
+ else if (strcmp(keyname, (char*)KEY_BACK) == 0)
+ m_KeyBackPress();
+ else if (strcmp(keyname, (char*)KEY_PLAY) == 0)
+ m_KeyPlayPress();
+ else if (strcmp(keyname, (char*)KEY_PAUSE) == 0)
+ m_KeyPausePress();
+ else if (strcmp(keyname, (char*)KEY_NEXT) == 0)
+ m_KeyNextPress();
+ else if (strcmp(keyname, (char*)KEY_PREVIOUS) == 0)
+ 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();
+}
+
+
+void CPlaybackView::m_HandleKeyUnpress(char *keyname)
+{
+ if (!strcmp(keyname, KEY_PREVIOUS))
+ m_KeyPreviousUnpress();
+ else if (!strcmp(keyname, KEY_NEXT))
+ m_KeyNextUnpress();
+}
+
+
+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;
+
+ eoAlbumCover = elm_image_add(m->eoBase);
+ if (!eoAlbumCover)
+ return;
+
+ evas_object_size_hint_weight_set(eoAlbumCover, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_image_aspect_fixed_set(eoAlbumCover, EINA_FALSE);
+
+ elm_object_part_content_set(m->eoBase, MUSIC_PART_ALBUMCOVER,
+ eoAlbumCover);
+ evas_object_show(eoAlbumCover);
+ m->eoAlbumCover = eoAlbumCover;
+
+}
+
+
+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);
+}
+
+
+SItemInfo *CPlaybackView::m_FindItemInfoFromSong(Eina_List *list, SSongInfo *sinfo)
+{
+ Eina_List *l = NULL;
+ SItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SItemInfo *)obj;
+ if (itinfo->sinfo == sinfo)
+ return itinfo;
+ }
+
+ return NULL;
+}
+
+
+SItemInfo *CPlaybackView::m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item)
+{
+ Eina_List *l = NULL;
+ SItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SItemInfo *)obj;
+ if (itinfo->item == item)
+ return itinfo;
+ }
+
+ return NULL;
+}
+
+
+void CPlaybackView::m_UpdateItemCheck(SItemInfo *itinfo)
+{
+ if (!itinfo) {
+ _ERR(" No item info to Update check ");
+ return;
+ }
+
+ if (itinfo->check_status) {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_CHECK_OFF, MUSIC_PLAYBACK_VIEW);
+ itinfo->check_status = false;
+ return;
+ }
+
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_CHECK_ON, MUSIC_PLAYBACK_VIEW);
+ itinfo->check_status = true;
+}
+
+
+class CElmGenlistItemClass {
+public:
+ static char *sm_CbTextGet(void *data, Evas_Object *obj, const char *part)
+ {
+ SSongInfo *sinfo = NULL;
+ SItemInfo *pItemInfo = (SItemInfo *)data;
+ char buf[MAX_LENGTH];
+ char *timestr = NULL;
+ int duration;
+ int index;
+
+ if (!pItemInfo || !obj)
+ return NULL;
+
+ sinfo = pItemInfo->sinfo;
+
+ snprintf(buf, sizeof(buf), "%s", MUSIC_STR_EMPTY);
+
+ 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);
+ }
+ }
+ else if (!strcmp(part, "elm.text1"))
+ snprintf(buf, sizeof(buf), "%s", song_info_get_title(sinfo));
+ else if (!strcmp(part, "elm.text2"))
+ snprintf(buf, sizeof(buf), "%s - %s",
+ song_info_get_artist(sinfo),
+ song_info_get_album(sinfo));
+ 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);
+ }
+ }
+ }
+
+ if (strcmp(buf, MUSIC_STR_EMPTY))
+ return strdup(buf);
+
+ return NULL;
+ }
+ static Evas_Object *sm_CbContentGet(void *data, Evas_Object *obj, const char *part)
+ {
+ SSongInfo *sinfo = NULL;
+ SItemInfo *pItemInfo = (SItemInfo *)data;
+ Evas_Object *img = NULL;
+ char *path = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!pItemInfo || !obj)
+ return NULL;
+
+ sinfo = pItemInfo->sinfo;
+
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+
+ if (!strcmp(part, "elm.swallow.icon")) {
+ path = song_info_get_thumb(sinfo);
+ if (path)
+ elm_image_file_set(img, path, "NULL");
+ else {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB_126);
+ elm_image_file_set(img, buf, "NULL");
+ }
+ }
+
+ 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;
+
+ }
+ static void sm_CbDel(void *data, Evas_Object *obj)
+ {
+ free(data);
+ }
+};
+
+
+Elm_Genlist_Item_Class *CPlaybackView::m_GetItemClass(void)
+{
+ Elm_Genlist_Item_Class *list_item = NULL;
+
+ list_item = elm_genlist_item_class_new();
+ if (!list_item) {
+ _ERR(" elm_genlist_item_class_new failed ");
+ return NULL;
+ }
+
+ list_item->item_style = MUSIC_STYLE_PLAYLIST;
+ list_item->func.text_get = CElmGenlistItemClass::sm_CbTextGet;
+ list_item->func.content_get = CElmGenlistItemClass::sm_CbContentGet;
+ list_item->func.state_get = NULL;
+ list_item->func.del = CElmGenlistItemClass::sm_CbDel;
+
+ return list_item;
+}
+
+
+void CPlaybackView::m_AddGenlist(void)
+{
+ Evas_Object *genlist = NULL;
+ Evas_Object *eoBase = NULL;
+
+ eoBase = m->eoBase;
+ genlist = elm_genlist_add(eoBase);
+ if (!genlist)
+ return;
+
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+ evas_object_size_hint_weight_set(genlist,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(eoBase, MUSIC_PART_PLAYLIST, genlist);
+ 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);
+ evas_object_show(genlist);
+ m->eoPlaylist = genlist;
+}
+
+
+void CPlaybackView::m_AddPlaylist(void)
+{
+ Elm_Genlist_Item_Class *list_item = NULL;
+ int ts = 0;
+ int i, index = -1;
+ struct SSongInfo *sinfo = NULL;
+ Elm_Object_Item *item = NULL;
+ SItemInfo *pItemInfo = NULL;
+
+ m_AddGenlist();
+ if (!m->eoPlaylist)
+ return;
+
+ list_item = m_GetItemClass();
+ if (!list_item) {
+ evas_object_del(m->eoPlaylist);
+ return;
+ }
+
+ if (!m->hMusicController->GetTotalSongs(&ts)) {
+ _ERR(" music get total songs failed ");
+ return;
+ }
+
+ if (!m->hMusicController->GetCurrentSongIndex(&index))
+ _ERR(" music get current song index failed ");
+
+ for (i = 0; i < ts; i++) {
+ if (!m->hMusicController->GetSonginfoFromIndex(i, &sinfo)) {
+ _ERR(" music get songinfo failed ");
+ continue;
+ }
+ pItemInfo = (SItemInfo *)calloc(1, sizeof(*pItemInfo));
+ if (!pItemInfo)
+ return;
+ pItemInfo->sinfo = sinfo;
+ pItemInfo->edit_mode = false;
+ pItemInfo->check_status = false;
+ pItemInfo->select_status = false;
+
+ item = elm_genlist_item_append(m->eoPlaylist, list_item,
+ pItemInfo, NULL, ELM_GENLIST_ITEM_NONE,
+ sm_CbItemSelect, m);
+ pItemInfo->item = item;
+
+ if (i == index) {
+ pItemInfo->select_status = true;
+ m->cs_itinfo = pItemInfo;
+ }
+ m->elInfo = eina_list_append(m->elInfo, pItemInfo);
+ }
+}
+
+
+void CPlaybackView::m_RemovePlaylist(void)
+{
+ if (m->eoPlaylist) {
+ elm_genlist_clear(m->eoPlaylist);
+ m->eoPlaylist = NULL;
+ }
+
+ if (m->elInfo) {
+ eina_list_free(m->elInfo);
+ m->elInfo = NULL;
+ }
+}
+
+
+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;
+ SItemInfo *itinfo = NULL;
+
+ if (!obj || !genListItem)
+ return;
+
+ itinfo = m_FindItemInfoFromItem(m->elInfo, genListItem);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ if (itinfo->edit_mode) {
+ m_UpdateItemCheck(itinfo);
+ m_DisableEditButtons(false);
+ return;
+ }
+
+ index = elm_genlist_item_index_get(genListItem);
+
+ m->hMusicController->PlayIndexSong(index);
+ m_UpdateCurrentSongInfo();
+}
+
+
+bool CPlaybackView::Create(void *data)
+{
+ ASSERT(!m);
+
+ _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(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; }
+
+ m->press_status = PRESS_SHORT;
+ m->parent = this;
+
+ evas_object_data_set(m->eoBase, PLAYBACK_VIEW_DATA, m);
+
+ m_AddControlButtons();
+ m_AddEditPlaylistButtons();
+ m_AddCurrentSonginfo();
+ m_AddPlaylist();
+
+ m->pHandleVolume->Create(m->eoBase);
+ m_UpdatePlaymodeFocusSequence();
+
+ 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->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);
+
+ return true;
+}
+
+
+void CPlaybackView::Destroy(void)
+{
+ ASSERT(m);
+
+ m->hMusicController->RemoveListener(this);
+ //m->hMusicController->RemoveCallback(m->cbInfo[E_SONG_COMPLETE]);
+ //m->hMusicController->RemoveCallback(m->cbInfo[E_PLAYBACK_ERROR]);
+
+ m_DestroyErrorPopup();
+
+ m_RemoveTimer(TIMER_SLIDER);
+ m_RemoveTimer(TIMER_WAIT);
+ m_RemoveTimer(TIMER_LONGPRESS);
+ m_DestroySettingsPopup();
+
+ m->pHandleVolume->Destroy();
+ CBaseView::Destroy();
+ evas_object_del(m->eoBase);
+
+ free(m->ctxtinfo);
+ delete m;
+ m = NULL;
+}
+
+
+Evas_Object* CPlaybackView::Base(void)
+{
+ ASSERT(m);
+
+ return 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);
+ }
+
+ state = m->hMusicController->PlayState();
+ if (state == PLAY_STATUS_INITIAL || state == PLAY_STATUS_STOP) {
+ m_RemovePlaylist();
+ m_AddPlaylist();
+ m->hMusicController->Start();
+ m_UpdateCurrentSongInfo();
+ }
+
+ evas_object_show(m->eoBase);
+}
+
+
+void CPlaybackView::t_OnUpdate(void *data)
+{
+ ASSERT(m);
+
+ if (!data)
+ return;
+
+ SParcel *parcel = (SParcel *)data;
+ int updateType = parcel->updateType;
+ char *key = (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);
+ m_FromEditToPlaybackMode();
+ break;
+
+ case E_KEY_PRESS:
+ m_HandleKeyPress(key);
+ break;
+
+ case E_KEY_RELEASE:
+ m_HandleKeyUnpress(key);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::t_OnHide(void)
+{
+ ASSERT(m);
+
+ evas_object_hide(m->eoBase);
+}
+
+
+void CPlaybackView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ switch (id) {
+ case EO_BASE:
+ 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;
+
+ 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 (m->ctxtinfo) {
+ free(m->ctxtinfo);
+ m->ctxtinfo = NULL;
+ }
+
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!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;
+
+ ctxtinfo->cbdata = m;
+ ctxtinfo->update = sm_CbCtxtUpdate;
+ ctxtinfo->close = sm_CbCtxtClose;
+ ctxtinfo->type = CONTEXT_TYPE_PLAYSONG;
+ ctxtinfo->context = itinfo->sinfo;
+
+ 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();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev)
+{
+ switch (id) {
+ case EO_BASE:
+ m_HandleKeyUnpress(ev->keyname);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnMouseClicked(int id, Evas_Object *obj)
+{
+ 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_BTN_REPEAT:
+ t_OnClickedRepeat(obj);
+ break;
+
+ case EO_BTN_PLAY:
+ t_OnClickedPlay(obj);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+{
+ 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);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnPressed(int id, Evas_Object *obj)
+{
+ switch (id) {
+ case EO_BTN_FORWARD:
+ case EO_BTN_REWIND:
+ m_HandleOnPressed(obj);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnUnpressed(int id, Evas_Object *obj)
+{
+ switch (id) {
+ case EO_BTN_FORWARD:
+ case EO_BTN_REWIND:
+ m_HandleOnUnpressed(obj);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnChanged(int id, Evas_Object *obj)
+{
+ 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);
+ }
+
+ if (m->hMusicController->PlayState() == PLAY_STATUS_PLAY) {
+ if (m->etSlider)
+ ecore_timer_thaw(m->etSlider);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ 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;
+ }
+}
+
+
+void CPlaybackView::OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ 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::OnActivated(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ switch (id) {
+ case EO_PLAYLIST:
+ m_HandleGenlistItemActivated(obj, item);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void CPlaybackView::t_OnComplete(void)
+{
+ m_UpdateCurrentSongInfo();
+}
+
+
+void CPlaybackView::t_OnError(void)
+{
+ m_CreateErrorPopup();
+}
+
+
+void CPlaybackView::t_OnUsbConnected(void)
+{
+}
+
+
+void CPlaybackView::t_OnUpdateContent(void)
+{
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+
+#include <InputHandler.h>
+#include "category_info.h"
+#include "album_info.h"
+#include "song_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "entry-popup.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "category-layout.h"
+#include "base-view.h"
+#include "playlist-layout.h"
+
+
+struct SPlaylistLayout {
+};
+
+
+void CPlaylistLayout::sm_CbEntryRename(void *dt, const char *name)
+{
+ CPlaylistLayout *root = (CPlaylistLayout*)dt;
+
+ if (root)
+ root->m_OnEntryRename(name);
+}
+
+
+void CPlaylistLayout::m_OnEntryRename(const char *name)
+{
+ int id;
+ char *str = NULL;
+
+ if (!name)
+ return;
+
+ id = category_info_get_category_id(t.c_catinfo);
+ str = strdup(name);
+
+ destroy_entry_popup(t.epopup);
+ t.epopup = NULL;
+
+ if (CMusicController::GetInstance()->MediaExistPlaylist(str)) {
+ _create_message_box(Layout(), MUSIC_TEXT_INUSE_MSG);
+ elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+ free(str);
+ return;
+ }
+
+ if (!CMusicController::GetInstance()->MediaRenamePlaylist(id, str))
+ _ERR(" Rename playlist failed ");
+
+ t.depth = E_DEPTH_CATEGORY;
+ t_UpdateLayoutWithFocus();
+}
+
+
+void CPlaylistLayout::m_PlaylistCtxtAction(EActionType type)
+{
+ category_info *catinfo = NULL;
+ int id;
+ const char *text = NULL;
+
+ if (!t.ctxtinfo || !t.ctxtinfo->context)
+ return;
+
+ catinfo = (category_info *)t.ctxtinfo->context;
+
+ if (!CViewMgr::GetInstance()->PushView(MUSIC_BASE_VIEW, NULL)) {
+ _ERR(" viewmgr show failed ");
+ return;
+ }
+
+ if (t.c_catinfo) {
+ category_info_destroy(t.c_catinfo);
+ t.c_catinfo = NULL;
+ }
+ t.c_catinfo = category_info_duplicate(catinfo);
+
+ if (type == ACTION_TYPE_DELETE) {
+ id = category_info_get_category_id(catinfo);
+ 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 = category_info_get_name(catinfo);
+ if (t.epopup)
+ destroy_entry_popup(t.epopup);
+
+ t.epopup = create_entry_popup(t.base, text, sm_CbEntryRename, this);
+
+ }
+ else if (type == ACTION_TYPE_ADDSONG) {
+ t.depth = E_DEPTH_SELECT_LIST;
+ t.sel_type = SELECT_ADD;
+ t_UpdateLayoutWithFocus();
+
+ }
+ else if (type == ACTION_TYPE_REMOVESONG) {
+ if (category_info_get_songcount(catinfo) == 0) {
+ elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+ _create_message_box(Layout(), MUSIC_TEXT_NO_SONGS);
+ return;
+ }
+ t.depth = E_DEPTH_SELECT_LIST;
+ t.sel_type = SELECT_REMOVE;
+ t_UpdateLayoutWithFocus();
+
+ }
+ else {
+ elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+ }
+}
+
+
+void CPlaylistLayout::t_HandleItemSelect(SCatItemInfo *itinfo)
+{
+ if (!itinfo)
+ return;
+
+ if (itinfo->type == CAT_TYPE_PLAYLIST_NEW) {
+ t.depth = E_DEPTH_SELECT_LIST;
+ t.sel_type = SELECT_CREATE;
+ }
+ else {
+ t.c_catinfo = category_info_duplicate(itinfo->catinfo);
+ t.depth = E_DEPTH_SHOW_LIST;
+ }
+}
+
+
+bool CPlaylistLayout::t_GetMediaList(Eina_List **list)
+{
+ return CMusicController::GetInstance()->MediaGetList(LIST_TYPE_PLAYLISTS, NULL, list);
+}
+
+
+void CPlaylistLayout::t_OnCtxtUpdate(enum EActionType type, int lid)
+{
+ m_PlaylistCtxtAction(type);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <Eina.h>
+#include <utilX.h>
+#include "AppCommon.h"
+#include "InputHandler.h"
+#include "dbg.h"
+#include "i18n.h"
+#include "define.h"
+#include "song_info.h"
+#include "music-controller.h"
+#include "LayoutMgr.h"
+#include "common.h"
+#include "common-ui.h"
+#include "BaseView.h"
+#include "ExtBaseLayout.h"
+#include "ViewMgr.h"
+#include "song-layout.h"
+#include "base-view.h"
+
+struct SSongItemInfo {
+ SSongInfo *sinfo;
+ Elm_Object_Item *item;
+};
+
+struct SSongLayout {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *songlist;
+ Elm_Object_Item *focused_item;
+ Eina_List *slist;
+ Eina_List *it_infolist;
+ Elm_Genlist_Item_Class *item_class;
+ CMusicController *mhandle;
+ CLayoutMgr* mgr;
+ CViewMgr* vmgr;
+ SContentInfo *ctxtinfo;
+ char *uri;
+ CSongLayout *parent;
+
+ class CHandlerGenlist : public CListenerMgr, public IMouseMoveListener, public IKeyDownListener {
+ public:
+ struct SCallback {
+ void(*cb)(void* cookie);
+ void* cookie;
+ };
+
+ private:
+ SSongLayout *m;
+ SCallback m_callback;
+
+ private:
+ SSongItemInfo *m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item)
+ {
+ Eina_List *l;
+ SSongItemInfo *itinfo = NULL;
+ void *obj = NULL;
+
+ EINA_LIST_FOREACH(list, l, obj) {
+ itinfo = (SSongItemInfo *)obj;
+ if (itinfo->item == item)
+ return itinfo;
+ }
+
+ return NULL;
+ }
+
+ static void sm_CbItemSelect(void *data, Evas_Object *obj, void *event_info)
+ {
+ CHandlerGenlist *root = (CHandlerGenlist*)data;
+
+ if (root)
+ root->m_OnItemSelect(obj, event_info);
+ }
+
+ void m_OnItemSelect(Evas_Object *obj, void *event_info)
+ {
+ SSongItemInfo *itinfo = NULL;
+ char *mediaId = NULL;
+
+ itinfo = m_FindItemInfoFromItem(m->it_infolist, (Elm_Object_Item *)event_info);
+ if (!itinfo) {
+ _ERR(" no item info found ");
+ return;
+ }
+
+ mediaId = song_info_get_media_id(itinfo->sinfo);
+
+ m->mhandle->Stop();
+ m->mhandle->UpdatePlaylist(m->slist, ADD_TYPE_FRESH);
+ m->mhandle->SetCurrentSong(mediaId);
+
+ if (m_callback.cb) {
+ m_callback.cb(m_callback.cookie);
+ }
+ }
+
+ static void sm_CbCtxtClose(void *dt)
+ {
+ CHandlerGenlist *root = (CHandlerGenlist*)dt;
+
+ if (root)
+ root->m_OnCtxtClose();
+ }
+
+ void m_OnCtxtClose(void)
+ {
+ m->vmgr->PopView();
+ m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
+ elm_object_item_focus_set(m->focused_item, EINA_TRUE);
+ }
+
+ static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
+ {
+ CHandlerGenlist *root = (CHandlerGenlist*)dt;
+
+ if (root)
+ root->m_OnCtxtUpdate(type, lid);
+ }
+
+ void m_OnCtxtUpdate(EActionType type, int lid)
+ {
+ Eina_List *list = NULL;
+ EAddType mode;
+
+ if (!m->ctxtinfo || !m->ctxtinfo->context)
+ return;
+
+ if (type == ACTION_TYPE_ADDNEXT)
+ mode = ADD_TYPE_NEXT;
+ else
+ mode = ADD_TYPE_END;
+
+ 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
+ _create_message_box(m->base, MUSIC_TEXT_ADDTO_MSG);
+
+ return;
+ }
+
+ m->mhandle->UpdatePlaylist(list, mode);
+ eina_list_free(list);
+
+ if (type == ACTION_TYPE_PLAY) {
+ m->mhandle->Stop();
+ m->mhandle->SetCurrentSong(song_info_get_media_id((SSongInfo *)m->ctxtinfo->context));
+ }
+
+ _update_playback_view((EAddType)type, m->parent->Layout(), m->focused_item);
+ }
+
+ void m_SortSongList(void)
+ {
+ int sort_type;
+
+ int(*_sort_fn[])(const void *d1, const void *d2) = {
+ sortsongs_title_az,
+ sortsongs_title_za,
+ sortsongs_artist_az,
+ sortsongs_artist_za,
+ sortsongs_album_az,
+ sortsongs_album_za
+ };
+
+ sort_type = m->mhandle->SortType();
+
+ m->slist = eina_list_sort(m->slist, 0, _sort_fn[sort_type]);
+ }
+
+ void m_EmptySongList(bool sort_flag)
+ {
+ if (m->songlist)
+ elm_genlist_clear(m->songlist);
+
+ if (!sort_flag) {
+ eina_list_free(m->slist);
+ m->slist = NULL;
+ }
+
+ eina_list_free(m->it_infolist);
+ m->it_infolist = NULL;
+ }
+
+ public:
+ CHandlerGenlist(SSongLayout *ins) :
+ IMouseMoveListener(this),
+ IKeyDownListener(this) {
+ m = ins;
+ }
+
+ virtual ~CHandlerGenlist() {
+ m_EmptySongList(false);
+ }
+
+ void SetCallback(const SCallback* cb) {
+ m_callback = *cb;
+ }
+
+ virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) {
+ Elm_Object_Item *item;
+
+ item = elm_genlist_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL);
+
+ if (!elm_object_item_focus_get(item))
+ elm_object_item_focus_set(item, EINA_TRUE);
+ }
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) {
+ Elm_Object_Item *it = NULL;
+ SContentInfo *ctxtinfo = NULL;
+ SSongItemInfo *itinfo = NULL;
+
+ 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 (m->ctxtinfo) {
+ free(m->ctxtinfo);
+ m->ctxtinfo = NULL;
+ }
+
+ ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+ if (!ctxtinfo)
+ return;
+
+ itinfo = m_FindItemInfoFromItem(m->it_infolist, it);
+ if (!itinfo) {
+ free(ctxtinfo);
+ return;
+ }
+
+ ctxtinfo->type = CONTEXT_TYPE_SONG;
+ ctxtinfo->context = itinfo->sinfo;
+ ctxtinfo->cbdata = this;
+ ctxtinfo->update = sm_CbCtxtUpdate;
+ ctxtinfo->close = sm_CbCtxtClose;
+
+ m->ctxtinfo = ctxtinfo;
+
+ SParcel parcel;
+ parcel.ctxtInfo = ctxtinfo;
+ if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+ _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
+ }
+
+ void UpdateSongList(bool sort_flag)
+ {
+ bool r;
+ struct SSongInfo *sinfo;
+ void *obj;
+ Eina_List *l;
+ struct SSongItemInfo *itinfo;
+ Elm_Object_Item *item;
+
+ /* Remove existing songlist and prepare afresh */
+ m_EmptySongList(sort_flag);
+
+ if (!sort_flag) {
+ r = m->mhandle->MediaGetList(LIST_TYPE_SONG, NULL, &(m->slist));
+ if (r == false || eina_list_count(m->slist) == 0) {
+ _ERR(" Fetching song list from media failed ");
+
+ m->parent->SetEmptyStatus(true);
+ return;
+ }
+ }
+
+ m_SortSongList();
+
+ EINA_LIST_FOREACH(m->slist, l, obj) {
+ sinfo = (SSongInfo *)obj;
+ itinfo = (SSongItemInfo *)calloc(1, sizeof(*itinfo));
+ if (!itinfo)
+ return;
+
+ itinfo->sinfo = sinfo;
+ item = elm_genlist_item_append(m->songlist, m->item_class,
+ itinfo, NULL, ELM_GENLIST_ITEM_NONE,
+ sm_CbItemSelect, this);
+ itinfo->item = item;
+ m->it_infolist = eina_list_append(m->it_infolist, itinfo);
+ }
+ }
+ } *pHandlerGenlist;
+
+ SSongLayout() {
+ memset(this, 0, sizeof(SSongLayout));
+ pHandlerGenlist = new CHandlerGenlist(this);
+ }
+
+ ~SSongLayout() {
+ delete pHandlerGenlist;
+ }
+};
+
+
+char *CSongLayout::sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part)
+{
+ SSongItemInfo *itinfo = (SSongItemInfo *)data;
+ SSongInfo *sinfo = NULL;
+ char buf[MAX_LENGTH];
+ char *timestr = NULL;
+ int duration;
+ int index;
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ sinfo = itinfo->sinfo;
+
+ snprintf(buf, sizeof(buf), "%s", MUSIC_STR_EMPTY);
+
+ if (!strcmp(part, "elm.text")) {
+ index = elm_genlist_item_index_get(itinfo->item);
+ if ((index & 1) == 1) {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_EVEN_ROW, MUSIC_BASE_VIEW);
+ }
+ else {
+ elm_object_item_signal_emit(itinfo->item,
+ MUSIC_SIGNAL_ODD_ROW, MUSIC_BASE_VIEW);
+ }
+ snprintf(buf, sizeof(buf), " %s", song_info_get_title(sinfo));
+ }
+ else if (!strcmp(part, "elm.text1"))
+ snprintf(buf, sizeof(buf), "%s", song_info_get_artist(sinfo));
+ else if (!strcmp(part, "elm.text2"))
+ snprintf(buf, sizeof(buf), "%s", song_info_get_album(sinfo));
+ 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);
+ }
+ }
+ }
+
+ if (strcmp(buf, MUSIC_STR_EMPTY))
+ return strdup(buf);
+
+ return NULL;
+}
+
+
+Evas_Object *CSongLayout::sm_CbGetListItemContent(void *data, Evas_Object *obj, const char *part)
+{
+ SSongItemInfo *itinfo = (SSongItemInfo *)data;
+ SSongInfo *sinfo = NULL;
+ Evas_Object *img = NULL;
+ char *path = NULL;
+ char buf[MAX_LENGTH];
+
+ if (!itinfo || !obj)
+ return NULL;
+
+ sinfo = itinfo->sinfo;
+
+ img = elm_image_add(obj);
+ if (!img)
+ return NULL;
+ elm_image_aspect_fixed_set(img, EINA_FALSE);
+
+ if (!strcmp(part, "elm.swallow.icon")) {
+ path = song_info_get_thumb(sinfo);
+ if (path)
+ elm_image_file_set(img, path, "NULL");
+ else {
+ snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
+ MUSIC_IMAGE_DEFAULT_THUMB);
+ elm_image_file_set(img, buf, "NULL");
+ }
+ }
+
+ return img;
+}
+
+
+void CSongLayout::sm_CbRemoveListItem(void *data, Evas_Object *obj)
+{
+ free(data);
+}
+
+
+void CSongLayout::sm_CbSelectItem(void *cookie)
+{
+ CSongLayout *root = (CSongLayout *)cookie;
+
+ if (root)
+ root->m_OnSelectItem();
+}
+
+
+void CSongLayout::m_OnSelectItem(void)
+{
+ m_GotoPlayback();
+}
+
+
+void CSongLayout::m_GotoPlayback(void)
+{
+ if (!m->vmgr->PushView(MUSIC_PLAYBACK_VIEW, NULL))
+ _ERR(" viewmgr push view MUSIC_PLAYBACK_VIEW failed ");
+}
+
+
+void CSongLayout::m_GotoPlaybackUri(void)
+{
+ Eina_List *list = NULL;
+ SSongInfo *sinfo = m->mhandle->MediaSongByUri(m->uri);
+ if (!sinfo) {
+ _ERR(" Fetching song list from uri failed ");
+ return;
+ }
+
+ list = eina_list_append(list, sinfo);
+ if (!list)
+ return;
+
+ m->mhandle->UpdatePlaylist(list, ADD_TYPE_FRESH);
+
+ eina_list_free(list);
+
+ m_GotoPlayback();
+}
+
+
+void CSongLayout::m_CreateSongList(void)
+{
+ Evas_Object *genlist = NULL;
+ Elm_Genlist_Item_Class *list_item = NULL;
+
+ genlist = elm_genlist_add(Layout());
+ if (!genlist)
+ return;
+
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+ evas_object_size_hint_weight_set(genlist,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(Layout(), MUSIC_PART_SONGLIST, genlist);
+ m->pHandlerGenlist->Connect(genlist);
+ m->songlist = genlist;
+
+ list_item = elm_genlist_item_class_new();
+ if (!list_item) {
+ evas_object_del(genlist);
+ _ERR(" elm_genlist_item_class_new failed ");
+ return;
+ }
+ list_item->item_style = MUSIC_STYLE_SONGLIST;
+ list_item->func.text_get = sm_CbGetListItemText;
+ list_item->func.content_get = sm_CbGetListItemContent;
+ list_item->func.state_get = NULL;
+ list_item->func.del = sm_CbRemoveListItem;
+ m->item_class = list_item;
+
+ m->pHandlerGenlist->UpdateSongList(false);
+}
+
+
+bool CSongLayout::Create(CLayoutMgr *mgr, const char *uri)
+{
+ ASSERT(!m);
+
+ Evas_Object *base = NULL;
+ Evas_Object *win = NULL;
+ Evas_Object *layout = NULL;
+ CMusicController *mhandle = NULL;
+ CViewMgr *vmgr = NULL;
+
+ if (!mgr)
+ return false;
+
+ m = new SSongLayout;
+ if (!m) {
+ _ERR(" calloc failed ");
+ return false;
+ }
+
+ vmgr = CViewMgr::GetInstance();
+ if (!vmgr) {
+ _ERR(" get view mgr failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ base = mgr->Base();
+ if (!base) {
+ _ERR(" get base failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ win = vmgr->Window();
+ if (!win) {
+ _ERR(" vimewmgr get win failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ mhandle = CMusicController::GetInstance();
+ if (!mhandle) {
+ _ERR(" music controller get music instance failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ layout = _add_base(base, MUSIC_SONG_LAYOUT);
+ if (!layout) {
+ _ERR(" get layout failed ");
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ bool r = CExtBaseLayout::Create(layout);
+ if (!r) {
+ _ERR(" CBaseLayout creation failed ");
+ evas_object_del(layout);
+ delete m;
+ m = NULL;
+ return false;
+ }
+
+ if (uri) {
+ m->uri = new char[strlen(uri) + 1];
+ strcpy(m->uri, uri);
+ }
+ else {
+ m->uri = NULL;
+ }
+
+ m->win = win;
+ m->base = base;
+ m->vmgr = vmgr;
+ m->mhandle = mhandle;
+ m->mgr = mgr;
+ m->parent = this;
+
+ m_CreateSongList();
+
+ Connect(layout);
+
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_FOCUS_UPDATE;
+ parcel.layoutId = MUSIC_SONG_LAYOUT;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+
+ SSongLayout::CHandlerGenlist::SCallback cb;
+ cb.cb = &sm_CbSelectItem;
+ cb.cookie = this;
+ m->pHandlerGenlist->SetCallback(&cb);
+
+ return true;
+}
+
+void CSongLayout::Destroy(void)
+{
+ ASSERT(m);
+
+ CExtBaseLayout::Destroy();
+ evas_object_del(Layout());
+
+ free(m->ctxtinfo);
+ delete[] m->uri;
+ delete m;
+ m = NULL;
+}
+
+
+void CSongLayout::t_OnShow(void)
+{
+ ASSERT(m);
+
+ evas_object_show(Layout());
+
+ if (!m->uri)
+ return;
+
+ m_GotoPlaybackUri();
+ delete[] m->uri;
+ m->uri = NULL;
+}
+
+
+void CSongLayout::Update(bool focusFlag)
+{
+ ASSERT(m);
+
+ if (!focusFlag) {
+ m->pHandlerGenlist->UpdateSongList(true);
+ return;
+ }
+
+ elm_object_focus_set(m->songlist, EINA_TRUE);
+}
+
+
+void CSongLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ SParcel parcel;
+ parcel.ctxtInfo = NULL;
+ parcel.updateType = E_FOCUS_UPDATE;
+ parcel.layoutId = NULL;
+ parcel.keyEvent = NULL;
+ m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+ }
+}
\ No newline at end of file