Ejemplo n.º 1
0
void ActivityAudioListView::itemListLoaded(list<Params> &infos)
{
    list<Params>::iterator it = infos.begin();

    CREATE_GENLIST_HELPER(glist);

    for (;it != infos.end();it++)
    {
        Params &pitem = *it;

        if (pitem["type"] == "track")
        {
            int track_id;
            from_string(pitem["id"], track_id);
            GenlistItemTrack *item = new GenlistItemTrack(evas, parent, player_current->getPlayer(), track_id, GenlistItemTrack::TRACK_ID, 0);
            item->Append(glist, NULL);
        }
        else if (pitem["type"] == "folder")
        {
            GenlistItemSimple *item = new GenlistItemSimple(evas, parent, pitem["name"], true);
            item->setIcon("calaos/icons/genlist/folder");
            item->Append(glist);
            item->setUserData(item);
            item->item_selected.connect(sigc::bind(sigc::mem_fun(*this, &ActivityAudioListView::folderSelected),
                                                   pitem["id"]));
        }
        else if (pitem["type"] == "playlist")
        {
            GenlistItemBrowserPlaylist *item = new GenlistItemBrowserPlaylist(evas, parent, player_current->getPlayer(), pitem);
            item->Append(glist);
            item->setUserData(item);
            item->item_selected.connect(sigc::mem_fun(*this, &ActivityAudioListView::playlistSelected));
        }
    }

    elm_naviframe_item_push(pager_browser, NULL, NULL, NULL, glist, "calaos");

    EmitSignal("browser,loading,stop", "calaos");
}
Ejemplo n.º 2
0
void ActivityAudioListView::itemRadioLoaded(list<Params> &infos)
{
    list<Params>::iterator it = infos.begin();

    CREATE_GENLIST_HELPER(glist);
    elm_genlist_homogeneous_set(glist, false);
    elm_genlist_mode_set(glist, ELM_LIST_COMPRESS);

    for (;it != infos.end();it++)
    {
        Params &pitem = *it;

        cDebug() << "item type: " << pitem.toString();

        if (pitem["type"] == "xmlbrowser")
        {
            GenlistItemSimple *item = new GenlistItemSimple(evas, parent, pitem["name"], true);
            item->setIcon("calaos/icons/genlist/radio");
            item->Append(glist);
            item->setUserData(item);
            item->item_selected.connect(sigc::bind(
                                            sigc::mem_fun(*this, &ActivityAudioListView::radioSelected),
                                            pitem["id"], ""));
        }
        else
        {
            if (pitem["isaudio"] == "1")
            {
                pitem.Add("radio_id", radio_id);
                GenlistItemRadio *item = new GenlistItemRadio(evas, parent, player_current->getPlayer(), pitem);
                item->Append(glist);

                if (pitem["hasitems"] == "1")
                {
                    item->setUserData(item);
                    item->item_selected.connect(sigc::bind(
                                                    sigc::mem_fun(*this, &ActivityAudioListView::radioSelected),
                                                    radio_id ,pitem["id"]));
                }
            }
            else
            {
                if (pitem["hasitems"] == "1" && pitem["type"] != "search" && pitem["type"] != "xmlbrowser_search")
                {
                    GenlistItemSimple *item;
                    if (pitem["type"] == "text" || pitem["type"] == "textarea")
                        item = new GenlistItemSimple(evas, parent, pitem["name"], true, true);
                    else
                        item = new GenlistItemSimple(evas, parent, pitem["name"], true);
                    item->setIcon("calaos/icons/genlist/folder");
                    item->Append(glist);
                    item->setUserData(item);
                    item->item_selected.connect(sigc::bind(
                                                    sigc::mem_fun(*this, &ActivityAudioListView::radioSelected),
                                                    radio_id ,pitem["id"]));
                }
                else
                {
                    GenlistItemSimple *item = new GenlistItemSimple(evas, parent, pitem["name"], false, true);
                    item->Append(glist);

                    if (pitem["type"] == "search" || pitem["type"] == "xmlbrowser_search")
                    {
                        item->setIcon("calaos/icons/genlist/search");
                        item->item_selected.connect(sigc::bind(
                                                        sigc::mem_fun(*this, &ActivityAudioListView::searchRadioSelected),
                                                        radio_id ,pitem["id"]));
                    }
                }
            }
        }
    }

    elm_naviframe_item_push(pager_browser, NULL, NULL, NULL, glist, "calaos");

    EmitSignal("browser,loading,stop", "calaos");
}