void GenlistItemScenarioSchedule::scenarioDelete(void *data) { if (!scenario) return; Evas_Object *table = createPaddingTable(evas, parent, 280, 260); Evas_Object *glist = elm_genlist_add(table); elm_object_style_set(glist, "calaos"); elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS); evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(glist); string title_label = _("Confirmation<br><small><light_blue>Are you sure you want to delete this scenarios?</light_blue></small>"); GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label); header->Append(glist); GenlistItemSimple *_item = new GenlistItemSimple(evas, parent, _("Yes, delete the scenario"), true); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::deleteScenarioValid)); _item = new GenlistItemSimple(evas, parent, _("No"), true); _item->Append(glist, header); _item->item_selected.connect(sigc::bind(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::deleteScenarioCancel), _item)); elm_table_pack(table, glist, 1, 1, 1, 1); elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos"); }
void ActivityScheduleScenarioView::reloadTimeRanges() { elm_genlist_clear(schedule_list); vector<TimeRange> trange_sorted; auto sortTimeRange = [&trange_sorted](vector<TimeRange> &range, int day) { for (TimeRange &t: range) { auto it = std::find(trange_sorted.begin(), trange_sorted.end(), t); if (it != trange_sorted.end()) { //timerange already in trange_sorted, add the day of week flag it->dayOfWeek.set(day); } else { TimeRange newtr = t; newtr.dayOfWeek.reset(); newtr.dayOfWeek.set(day); trange_sorted.push_back(newtr); } } }; sortTimeRange(range_infos.range_monday, 0); sortTimeRange(range_infos.range_tuesday, 1); sortTimeRange(range_infos.range_wednesday, 2); sortTimeRange(range_infos.range_thursday, 3); sortTimeRange(range_infos.range_friday, 4); sortTimeRange(range_infos.range_saturday, 5); sortTimeRange(range_infos.range_sunday, 6); for (TimeRange &t: trange_sorted) { GenlistItemScenarioScheduleTime *item = new GenlistItemScenarioScheduleTime(evas, parent, t); item->Append(schedule_list); item->edit_click.connect([=]() { is_edit = true; old_range = t; edit_range = t; editState = EDIT_START_TYPE; showTimeRangePopup(); }); item->del_click.connect([=]() { Evas_Object *table = createPaddingTable(evas, parent, 280, 260); Evas_Object *glist = elm_genlist_add(table); elm_object_style_set(glist, "calaos"); elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS); evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(glist); string title_label = _("Confirmation"); title_label += "<br><small><light_blue>"; title_label += _("Are you sure to delete this schedule?"); title_label += "</light_blue></small>"; GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label); header->Append(glist); Evas_Object *popup_del = elm_ctxpopup_add(parent); GenlistItemSimple *_item = new GenlistItemSimple(evas, parent, _("Yes, delete this schedule"), true); _item->Append(glist, header); _item->item_selected.connect([=](void *) { deleteTimeRange(t); elm_ctxpopup_dismiss(popup_del); reloadTimeRanges(); }); _item = new GenlistItemSimple(evas, parent, "Non", true); _item->Append(glist, header); _item->item_selected.connect([=](void *) { elm_ctxpopup_dismiss(popup_del); }); elm_table_pack(table, glist, 1, 1, 1, 1); elm_object_content_set(popup_del, table); elm_object_style_set(popup_del, "calaos"); elm_ctxpopup_direction_priority_set(popup_del, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT); Evas_Coord x,y; evas_pointer_canvas_xy_get(evas, &x, &y); evas_object_move(popup_del, x, y); evas_object_show(popup_del); }); } //reload months if (range_infos.range_months.all()) { //all months are selected item_all->setSelected(true); for (uint i = 0;i < items_months.size();i++) items_months[i]->setSelected(false); } else { item_all->setSelected(false); for (uint i = 0;i < items_months.size();i++) items_months[i]->setSelected(range_infos.range_months.test(i)); } }
void GenlistItemScenarioSchedule::buttonClickMore() { if (!scenario) return; Evas_Object *table = createPaddingTable(evas, parent, 280, 260); Evas_Object *glist = elm_genlist_add(table); elm_object_style_set(glist, "calaos"); elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS); evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(glist); string title_label = _("Scenario parameters<br><small><light_blue>Modify, add or delete a schedule.</light_blue></small>"); GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label); header->Append(glist); GenlistItemSimple *_item; _item = new GenlistItemSimple(evas, glist, _("Modify the scenario"), true); _item->setIcon("calaos/icons/genlist/edit"); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioModify)); _item = new GenlistItemSimple(evas, glist, _("Delete the scenario"), true); _item->setIcon("calaos/icons/genlist/trash"); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioDelete)); _item = new GenlistItemSimple(evas, glist, _("Run the scenario now"), true); _item->setIcon("calaos/icons/genlist/play"); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioPlay)); if (scenario->scenario_data.params["schedule"] == "false") { _item = new GenlistItemSimple(evas, glist, _("Add a schedule"), true); _item->setIcon("calaos/icons/genlist/plus"); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleAdd)); } else { _item = new GenlistItemSimple(evas, glist, _("Schedule modification"), true); _item->setIcon("calaos/icons/genlist/clock"); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleModify)); _item = new GenlistItemSimple(evas, glist, _("Delete schedule"), true); _item->setIcon("calaos/icons/genlist/trash"); _item->Append(glist, header); _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleDelete)); } elm_table_pack(table, glist, 1, 1, 1, 1); pager_popup = elm_naviframe_add(parent); evas_object_show(pager_popup); popup = elm_ctxpopup_add(parent); elm_object_content_set(popup, pager_popup); elm_object_style_set(popup, "calaos"); elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT); Evas_Coord x,y; evas_pointer_canvas_xy_get(evas, &x, &y); evas_object_move(popup, x, y); evas_object_show(popup); elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos"); }
void GenlistItemTrack::buttonClickMore() { Evas_Object *table = createPaddingTable(evas, parent, 260, 200); Evas_Object *glist = elm_genlist_add(parent); elm_object_style_set(glist, "calaos"); elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS); evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(glist); string title_label = "Info de la <light_blue>piste #" + Utils::to_string(item_id + 1) + "</light_blue><br><small>Détails de la piste.</small>"; GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label); header->Append(glist); string infolabel; if (item_infos["artist"] != "") { infolabel = item_infos["artist"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Artiste :", infolabel); it->Append(glist, header); } if (item_infos["album"] != "") { infolabel = item_infos["album"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Album :", infolabel); it->Append(glist, header); } if (item_infos["title"] != "") { infolabel = item_infos["title"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Titre :", infolabel); it->Append(glist, header); } if (item_infos["duration"] != "") { double dur; from_string(item_infos["duration"], dur); infolabel = Utils::time2string_digit((long)dur); GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Durée :", infolabel); it->Append(glist, header); } if (item_infos["genre"] != "") { infolabel = item_infos["genre"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Genre :", infolabel); it->Append(glist, header); } if (item_infos["type"] != "") { infolabel = item_infos["type"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Type de flux :", infolabel); it->Append(glist, header); } if (item_infos["bitrate"] != "") { infolabel = item_infos["bitrate"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Débit :", infolabel); it->Append(glist, header); } if (item_infos["filesize"] != "") { long int s; from_string(item_infos["filesize"], s); s /= 1024; s /= 1024; infolabel = Utils::to_string(s) + " Mo"; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Taille :", infolabel); it->Append(glist, header); } if (item_infos["samplerate"] != "") { infolabel = item_infos["samplerate"] + " Hz"; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Echantillonage :", infolabel); it->Append(glist, header); } if (item_infos["tagversion"] != "") { infolabel = item_infos["tagversion"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Version du tag :", infolabel); it->Append(glist, header); } if (item_infos["comment"] != "") { infolabel = item_infos["comment"]; GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Commentaire :", infolabel); it->Append(glist, header); } elm_table_pack(table, glist, 1, 1, 1, 1); Evas_Object *popup_position = elm_ctxpopup_add(parent); elm_object_style_set(popup_position, "calaos"); evas_object_size_hint_min_set(popup_position, 300, 240); elm_object_content_set(popup_position, table); Evas_Coord x,y; evas_pointer_canvas_xy_get(evas, &x, &y); evas_object_move(popup_position, x, y); evas_object_show(popup_position); }