#define KEY_BACK "Escape"
#define KEY_MENU "Super_L"
+#define SORT_BY_ARTIST_AZ "SORT_BY_ARTIST_AZ"
+#define SORT_BY_ARTIST_ZA "SORT_BY_ARTIST_ZA"
+#define SORT_BY_ALBUM_AZ "SORT_BY_ALBUM_AZ"
+#define SORT_BY_ALBUM_ZA "SORT_BY_ALBUM_ZA"
+
#endif /* __COMMON_H__ */
static void sm_CbItemSelect(void *data, Evas_Object *obj, void *event_info);
void m_OnItemSelect(Evas_Object *obj, void *event_info);
+ static int sm_CbSortArtistAZ(const void *d1, const void *d2);
+ static int sm_CbSortArtistZA(const void *d1, const void *d2);
+ static int sm_CbSortAlbumAZ(const void *d1, const void *d2);
+ static int sm_CbSortAlbumZA(const void *d1, const void *d2);
+
private:
SSongItemInfo *m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item);
void m_UpdateSongList(bool sort_flag);
struct SSongInfo *m;
public:
- static int s_SortTitleAZ(const void *d1, const void *d2);
- static int s_SortTitleZA(const void *d1, const void *d2);
- static int s_SortArtistAZ(const void *d1, const void *d2);
- static int s_SortArtistZA(const void *d1, const void *d2);
- static int s_SortAlbumAZ(const void *d1, const void *d2);
- static int s_SortAlbumZA(const void *d1, const void *d2);
-
-public:
CSongInfo() : m(0) {}
virtual ~CSongInfo() {}
bool Create(void);
virtual void Destroy(void);
- bool FlagCreate(void);
int MemberId(void);
char *Artist(void);
min: 214 62;
image {
normal: MUSIC_IMAGE_ADDBTN_BG_NORMAL;
- border: 30 30 30 30;
+ border: 29 29 29 29;
border_scale: 1;
}
}
#include <string.h>
#include "dbg.h"
#include "i18n.h"
+#include <NameInfo.h>
#include "folder_info.h"
struct folder_info *folder_info_create()
};
-int CSongInfo::s_SortTitleAZ(const void *d1, const void *d2)
-{
- CSongInfo *sinfo1 = (CSongInfo *)d1;
- CSongInfo *sinfo2 = (CSongInfo *)d2;
- char *txt1;
- char *txt2;
-
- txt1 = sinfo1->Name();
- txt2 = sinfo2->Name();
-
- if (!txt1)
- return 1;
- if (!txt2)
- return -1;
-
- return strcasecmp(txt1, txt2);
-}
-
-
-int CSongInfo::s_SortTitleZA(const void *d1, const void *d2)
-{
- CSongInfo *sinfo1 = (CSongInfo *)d1;
- CSongInfo *sinfo2 = (CSongInfo *)d2;
- char *txt1;
- char *txt2;
-
- txt1 = sinfo1->Name();
- txt2 = sinfo2->Name();
-
- if (!txt2)
- return 1;
- if (!txt1)
- return -1;
-
- return strcasecmp(txt2, txt1);
-}
-
-
-int CSongInfo::s_SortArtistAZ(const void *d1, const void *d2)
-{
- CSongInfo *sinfo1 = (CSongInfo *)d1;
- CSongInfo *sinfo2 = (CSongInfo *)d2;
- char *txt1;
- char *txt2;
-
- txt1 = sinfo1->Artist();
- txt2 = sinfo2->Artist();
-
- if (!txt1)
- return 1;
- if (!txt2)
- return -1;
-
- return strcasecmp(txt1, txt2);
-}
-
-
-int CSongInfo::s_SortArtistZA(const void *d1, const void *d2)
-{
- CSongInfo *sinfo1 = (CSongInfo *)d1;
- CSongInfo *sinfo2 = (CSongInfo *)d2;
- char *txt1;
- char *txt2;
-
- txt1 = sinfo1->Artist();
- txt2 = sinfo2->Artist();
-
- if (!txt2)
- return 1;
- if (!txt1)
- return -1;
-
- return strcasecmp(txt2, txt1);
-}
-
-
-int CSongInfo::s_SortAlbumAZ(const void *d1, const void *d2)
-{
- CSongInfo *sinfo1 = (CSongInfo *)d1;
- CSongInfo *sinfo2 = (CSongInfo *)d2;
- char *txt1;
- char *txt2;
-
- txt1 = sinfo1->Album();
- txt2 = sinfo2->Album();
-
- if (!txt1)
- return 1;
- if (!txt2)
- return -1;
-
- return strcasecmp(txt1, txt2);
-}
-
-
-int CSongInfo::s_SortAlbumZA(const void *d1, const void *d2)
-{
- CSongInfo *sinfo1 = (CSongInfo *)d1;
- CSongInfo *sinfo2 = (CSongInfo *)d2;
- char *txt1;
- char *txt2;
-
- txt1 = sinfo1->Album();
- txt2 = sinfo2->Album();
-
- if (!txt2)
- return 1;
- if (!txt1)
- return -1;
-
- return strcasecmp(txt2, txt1);
-}
-
-
bool CSongInfo::Create(void)
{
if (m)
}
-bool CSongInfo::FlagCreate(void)
-{
- return !!m;
-}
-
-
int CSongInfo::MemberId(void)
{
if (!m)
#include <Elementary.h>
#include "dbg.h"
#include <InputHandler.h>
+#include <SortMgr.h>
#include "song_info.h"
#include "music-controller.h"
#include "define.h"
}
virtual void OnTerminate(void)
{
+ CSortMgr::Finalize();
CViewMgr::Finalize();
CMusicController::Finalize();
}
_DBG("");
+ CSortMgr::Initialize();
+
m_cBaseView = new CMusicBaseView(MUSIC_BASE_VIEW);
m_cPlaybackView = new CPlaybackView(MUSIC_PLAYBACK_VIEW);
m_cContextView = new CContextView(MUSIC_CONTEXT_VIEW);
Evas_Object *layout, *entry;
if (!base)
- return NULL;
+ return false;
m = new SEntryPopup;
if (!m) {
- return NULL;
+ return false;
}
layout = elm_layout_add(base);
if (!layout) {
delete m;
- return NULL;
+ return false;
}
elm_layout_file_set(layout, EDJEFILE, MUSIC_ENTRY_POPUP_LAYOUT);
if (!entry) {
evas_object_del(layout);
delete m;
- return NULL;
+ return false;
}
elm_object_style_set(entry, MUSIC_STYLE_ENTRY);
m->idler = ecore_idler_add(sm_CbFocusIdler, this);
Connect(entry);
+
+ return true;
}
#include "dbg.h"
#include "i18n.h"
#include "define.h"
+#include <SortMgr.h>
+#include <Sort.h>
#include "folder_info.h"
#include "song_info.h"
void CFolderLayout::m_SortFolderGrid(void)
{
- int sort_type;
+ int sortType;
+
int(*_sortfolders[])(const void *d1, const void *d2) = {
sortfolders_az,
sortfolders_za
};
- int(*_sortsongs[])(const void *d1, const void *d2) = {
- CSongInfo::s_SortTitleAZ,
- CSongInfo::s_SortTitleZA,
+
+ const char *songSortType[] = {
+ SORT_BY_NAME_AZ,
+ SORT_BY_NAME_ZA,
};
if (!m->flist)
return;
- sort_type = m->mhandle->SortType();
+ sortType = m->mhandle->SortType();
if (m->depth == E_DEPTH_SONG)
- m->flist = eina_list_sort(m->flist, 0,
- _sortsongs[sort_type]);
+ m->flist = CSort::Sort(m->flist, songSortType[sortType]);
else
m->flist = eina_list_sort(m->flist, 0,
- _sortfolders[sort_type]);
+ _sortfolders[sortType]);
}
#include <utilX.h>
#include "AppCommon.h"
#include "InputHandler.h"
+#include <SortMgr.h>
+#include <Sort.h>
#include "dbg.h"
#include "i18n.h"
#include "define.h"
}
+int CSongLayout::sm_CbSortArtistAZ(const void *d1, const void *d2)
+{
+ CSongInfo *sinfo1 = (CSongInfo *)d1;
+ CSongInfo *sinfo2 = (CSongInfo *)d2;
+ char *txt1 = NULL;
+ char *txt2 = NULL;
+
+ txt1 = sinfo1->Artist();
+ if (!txt1)
+ return 1;
+
+ txt2 = sinfo2->Artist();
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
+
+
+int CSongLayout::sm_CbSortArtistZA(const void *d1, const void *d2)
+{
+ CSongInfo *sinfo1 = (CSongInfo *)d1;
+ CSongInfo *sinfo2 = (CSongInfo *)d2;
+ char *txt1 = NULL;
+ char *txt2 = NULL;
+
+ txt1 = sinfo1->Artist();
+ if (!txt1)
+ return -1;
+
+ txt2 = sinfo2->Artist();
+ if (!txt2)
+ return 1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+
+int CSongLayout::sm_CbSortAlbumAZ(const void *d1, const void *d2)
+{
+ CSongInfo *sinfo1 = (CSongInfo *)d1;
+ CSongInfo *sinfo2 = (CSongInfo *)d2;
+ char *txt1 = NULL;
+ char *txt2 = NULL;
+
+ txt1 = sinfo1->Album();
+ if (!txt1)
+ return 1;
+
+ txt2 = sinfo2->Album();
+ if (!txt2)
+ return -1;
+
+ return strcasecmp(txt1, txt2);
+}
+
+
+int CSongLayout::sm_CbSortAlbumZA(const void *d1, const void *d2)
+{
+ CSongInfo *sinfo1 = (CSongInfo *)d1;
+ CSongInfo *sinfo2 = (CSongInfo *)d2;
+ char *txt1 = NULL;
+ char *txt2 = NULL;
+
+ txt1 = sinfo1->Album();
+ if (!txt1)
+ return -1;
+
+ txt2 = sinfo2->Album();
+ if (!txt2)
+ return 1;
+
+ return strcasecmp(txt2, txt1);
+}
+
+
SSongItemInfo *CSongLayout::m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item)
{
Eina_List *l;
void CSongLayout::m_SortSongList(void)
{
- int sort_type;
-
- int(*_sort_fn[])(const void *d1, const void *d2) = {
- CSongInfo::s_SortTitleAZ,
- CSongInfo::s_SortTitleZA,
- CSongInfo::s_SortArtistAZ,
- CSongInfo::s_SortArtistZA,
- CSongInfo::s_SortAlbumAZ,
- CSongInfo::s_SortAlbumZA,
+ int sortType;
+
+ const char *sortFuncId[] = {
+ SORT_BY_NAME_AZ,
+ SORT_BY_NAME_ZA,
+ SORT_BY_ARTIST_AZ,
+ SORT_BY_ARTIST_ZA,
+ SORT_BY_ALBUM_AZ,
+ SORT_BY_ALBUM_ZA
};
- sort_type = m->mhandle->SortType();
+ sortType = m->mhandle->SortType();
- m->slist = eina_list_sort(m->slist, 0, _sort_fn[sort_type]);
+ m->slist = CSort::Sort(m->slist, sortFuncId[sortType]);
}
void CSongLayout::m_EmptySongList(bool sort_flag)
return false;
}
+ CSortMgr::GetInstance()->RegisterSortFunction(SORT_BY_ARTIST_AZ, sm_CbSortArtistAZ);
+ CSortMgr::GetInstance()->RegisterSortFunction(SORT_BY_ARTIST_ZA, sm_CbSortArtistZA);
+ CSortMgr::GetInstance()->RegisterSortFunction(SORT_BY_ALBUM_AZ, sm_CbSortAlbumAZ);
+ CSortMgr::GetInstance()->RegisterSortFunction(SORT_BY_ALBUM_ZA, sm_CbSortAlbumZA);
+
if (uri) {
m->uri = new char[strlen(uri) + 1];
strcpy(m->uri, uri);