ActivityConfigClockView::ActivityConfigClockView(Evas *_e, Evas_Object *_parent): ActivityView(_e, _parent, "calaos/page/config/clock") { printf("Clock view constructor\n"); TimeZone tz; tzList = elm_genlist_add(_parent); setPartText("tab1.text", _("Action and positions of widgets")); setPartText("tab1.text.detail", _("Resume : <light_blue>Current settings</light_blue><br><small>Configure Date and Time !</small")); setPartText("tab2.text", _("About")); setPartText("tab2.text.detail", _("About : <light_blue>Calaos products</light_blue><br><small>Touchscreen solutions.</small>")); elm_object_style_set(tzList, "calaos"); elm_genlist_select_mode_set(tzList, ELM_OBJECT_SELECT_MODE_ALWAYS); evas_object_size_hint_fill_set(tzList, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(tzList, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(tzList); Swallow(tzList, "timezone_list.swallow"); for(unsigned int i = 0; i < tz.timeZone.size(); i++) { GenlistItemSimple *_item; _item = new GenlistItemSimple(evas, tzList, tz.timeZone[i].key, true); _item->Append(tzList); } }
void ActivityWebView::_webLoadProgress() { setDragValue("progress.level", elm_web_load_progress_get(web), 0.0); string t = Utils::to_string((int)(elm_web_load_progress_get(web) * 100)) + " %"; setPartText("progress.text", t); }
void ActivityScenariosView::reloadCalendar() { elm_genlist_clear(schedule_list); string weekday; switch (currDate.tm_wday) { case 0: weekday = _("Sunday"); break; case 1: weekday = _("Monday"); break; case 2: weekday = _("Tuesday"); break; case 3: weekday = _("Wednesday"); break; case 4: weekday = _("Thursday"); break; case 5: weekday = _("Friday"); break; case 6: weekday = _("Saturday"); break; default: break; } string month; switch (currDate.tm_mon) { case 0: month = _("January"); break; case 1: month = _("February"); break; case 2: month = _("Mars"); break; case 3: month = _("April"); break; case 4: month = _("May"); break; case 5: month = _("June"); break; case 6: month = _("July"); break; case 7: month = _("August"); break; case 8: month = _("September"); break; case 9: month = _("October"); break; case 10: month = _("November"); break; case 11: month = _("December"); break; default: break; } string label = _("On <blue>%1, %2 %3, %4</blue>"); Utils::replace_str(label, "%1", weekday); Utils::replace_str(label, "%2", month); Utils::replace_str(label, "%3", Utils::to_string(currDate.tm_mday)); Utils::replace_str(label, "%4", Utils::to_string(currDate.tm_year + 1900)); setPartText("schedule.date", label); list<ScenarioSchedule> lst = CalaosModel::Instance().getScenario()->getScenarioForDate(currDate); for (auto i = lst.begin();i != lst.end();i++) { ScenarioSchedule sc = *i; GenlistItemScenarioSchedule *item = new GenlistItemScenarioSchedule(evas, parent, true, sc.scenario); item->setScheduleRange(sc.day, sc.timeRangeNum, currDate); item->schedule_add_click.connect(sigc::mem_fun(schedule_add_click, &sigc::signal<void, Scenario *>::emit)); item->schedule_modify_click.connect(sigc::mem_fun(schedule_modify_click, &sigc::signal<void, Scenario *>::emit)); item->schedule_del_click.connect(sigc::mem_fun(schedule_del_click, &sigc::signal<void, Scenario *>::emit)); item->Append(schedule_list); } }
ActivityWebView::ActivityWebView(Evas *_e, Evas_Object *_parent): ActivityView(_e, _parent, "calaos/page/web") { setPartText("header.label", _("Web browser")); keyboard = new KeyboardView(evas, parent); Swallow(keyboard, "keyboard"); if (elm_need_web()) { web = elm_web_add(parent); Swallow(web, "webkit"); evas_object_show(web); elm_object_focus_set(web, true); elm_web_useragent_set(web, USER_AGENT); elm_web_inwin_mode_set(web, true); evas_object_smart_callback_add(web, "load,started", _web_load_started, this); evas_object_smart_callback_add(web, "load,progress", _web_load_progress, this); evas_object_smart_callback_add(web, "load,finished", _web_load_finished, this); evas_object_smart_callback_add(web, "load,error", _web_load_finished, this); evas_object_smart_callback_add(web, "title,changed", _web_title_changed, this); evas_object_smart_callback_add(web, "inputmethod,changed", _web_inputmethod_changed, this); #ifdef HAVE_EWEBKIT Evas_Object *eview = elm_web_webkit_view_get(web); ewk_view_setting_enable_auto_resize_window_set(eview, false); #endif goToCallback(DEFAULT_BROWSER_URL); } Evas_Object *btn = edje_object_part_external_object_get(edje, "button.back"); elm_object_text_set(btn, _("Back to menu")); btn = edje_object_part_external_object_get(edje, "button.reload"); elm_object_text_set(btn, _("Reload")); btn = edje_object_part_external_object_get(edje, "button.stop"); elm_object_text_set(btn, _("Stop")); btn = edje_object_part_external_object_get(edje, "button.home"); elm_object_text_set(btn, _("Home page")); btn = edje_object_part_external_object_get(edje, "button.go"); elm_object_text_set(btn, _("Go to...")); btn = edje_object_part_external_object_get(edje, "button.bookmark"); elm_object_text_set(btn, _("Add to favorites")); addCallback("button.*", "pressed", sigc::mem_fun(*this, &ActivityWebView::buttonCallback)); }
void ActivityAudioListView::setEditMode() { EmitSignal("open,edit,playlist", "calaos"); in_edit_mode = true; Params &stats = player_current->getPlayer()->getDBStats(); string s = _("<small><blue>Media library : </blue>") + stats["albums"] + _(" albums with ") + stats["tracks"] + _(" tracks by ") + stats["artists"] + _(" artists.</small>"); setPartText("browser.message", s); createRootBrowserPage(); }
ActivityScenariosView::ActivityScenariosView(Evas *_e, Evas_Object *_parent): ActivityView(_e, _parent, "calaos/page/scenarios"), view_mode(VIEW_MODE_ALL) { setPartText("header.label", _("Scenario management")); addCallback("button.*", "pressed", sigc::mem_fun(*this, &ActivityScenariosView::buttonPressed)); schedule_list = elm_genlist_add(parent); Swallow(schedule_list, "scenario_schedule.list"); elm_object_style_set(schedule_list, "calaos"); elm_genlist_homogeneous_set(schedule_list, true); evas_object_show(schedule_list); scenario_list = elm_genlist_add(parent); Swallow(scenario_list, "scenario.list"); elm_object_style_set(scenario_list, "calaos"); elm_genlist_homogeneous_set(scenario_list, true); evas_object_show(scenario_list); Evas_Object *btn = edje_object_part_external_object_get(edje, "button.calendar.today"); elm_object_text_set(btn, _("Today")); btn = edje_object_part_external_object_get(edje, "button.create"); elm_object_text_set(btn, _("Create a new scenario")); btn = edje_object_part_external_object_get(edje, "button.list.all"); elm_object_text_set(btn, _("All")); btn = edje_object_part_external_object_get(edje, "button.list.light"); elm_object_text_set(btn, _("Lights")); btn = edje_object_part_external_object_get(edje, "button.list.shutters"); elm_object_text_set(btn, _("Shutters")); btn = edje_object_part_external_object_get(edje, "button.list.schedule"); elm_object_text_set(btn, _("Scheduled")); //default to today time_t t = time(0); currDate = *localtime(&t); if (CalaosModel::Instance().getScenario()) scenarioChangeCon = CalaosModel::Instance().getScenario()->scenario_change.connect([=](Scenario *) { reloadCalendar(); }); }
void ActivityWebView::buttonCallback(void *data, Evas_Object *edje_object, string emission, string source) { if (source == "button.back") elm_web_back(web); else if (source == "button.forward") elm_web_forward(web); else if (source == "button.reload") elm_web_reload_full(web); else if (source == "button.stop") elm_web_stop(web); else if (source == "button.forward") elm_web_forward(web); else if (source == "button.home") goToCallback(DEFAULT_BROWSER_URL); else if (source == "button.go") { ApplicationMain::Instance().ShowKeyboard("Entrez une URL ci-dessous", sigc::mem_fun(*this, &ActivityWebView::goToCallback), false, elm_web_uri_get(web)); } else if (source == "button.bookmark") { string url = elm_web_uri_get(web); string _url = DEFAULT_BROWSER_URL; _url += "Bookmark.php?new=" + url_encode(url); _url += "&title=" + url_encode(elm_web_title_get(web)); _url += "&thumb_file=/tmp/thumb.png"; setDragValue("progress.level", 0.0, 0.0); setPartText("progress.text", "Saving..."); EmitSignal("saving,bookmark", "calaos"); FileDownloader *fdownloader = new FileDownloader(_url, "/dev/null", true); fdownloader->Start(); } }
ActivityScheduleScenarioView::ActivityScheduleScenarioView(Evas *_e, Evas_Object *_parent): ActivityView(_e, _parent, "calaos/page/schedule_scenario"), schedule_list(NULL), month_list(NULL) { setPartText("header.label", _("Scheduling")); addCallback("button.*", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonPressed)); schedule_list = elm_genlist_add(parent); Swallow(schedule_list, "schedule.list"); elm_object_style_set(schedule_list, "calaos"); elm_genlist_homogeneous_set(schedule_list, true); evas_object_show(schedule_list); month_list = elm_genlist_add(parent); Swallow(month_list, "month.list"); elm_object_style_set(month_list, "calaos"); elm_genlist_homogeneous_set(month_list, true); evas_object_show(month_list); elm_genlist_multi_select_set(month_list, true); GenlistItemScenarioHeader *header; GenlistItemSimple *item; header = new GenlistItemScenarioHeader(evas, parent, _("Month of year")); header->Append(month_list); item = new GenlistItemSimple(evas, parent, _("All year"), true, false, NULL, "check"); item->Append(month_list); item_all = item; item_all->setSelected(true); item = new GenlistItemSimple(evas, parent, _("January"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("February"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("March"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("April"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("May"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("June"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("July"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("August"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("September"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("October"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("November"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); item = new GenlistItemSimple(evas, parent, _("December"), true, false, NULL, "check"); item->Append(month_list); items_months.push_back(item); /* * Can't use that for now. Seasons are not the same all over the world at the same monthes * (northern hemisphere/southern hemisphere have the opposite) We need to handle that * maybe from longitude/latitude in local_config.xml * header = new GenlistItemScenarioHeader(evas, parent, "Périodes prédéfinies"); header->Append(month_list); item = new GenlistItemSimple(evas, parent, _("Spring"), true, false, NULL, "check"); item->Append(month_list); items_periods.push_back(item); item = new GenlistItemSimple(evas, parent, _("Summer"), true, false, NULL, "check"); item->Append(month_list); items_periods.push_back(item); item = new GenlistItemSimple(evas, parent, _("Fall"), true, false, NULL, "check"); item->Append(month_list); items_periods.push_back(item); item = new GenlistItemSimple(evas, parent, _("Winter"), true, false, NULL, "check"); item->Append(month_list); items_periods.push_back(item); */ //Set up selection callback item_all->item_selected.connect([=](void *data) { if (item_all->isSelected()) { for (uint i = 0;i < items_months.size();i++) items_months[i]->setSelected(false); } }); for (uint i = 0;i < items_months.size();i++) { GenlistItemSimple *it = items_months[i]; it->item_selected.connect([=](void *data) { if (item_all->isSelected()) item_all->setSelected(false); }); } // for (uint i = 0;i < items_periods.size();i++) // items_periods[i]->item_selected.connect(sigc::bind(sigc::mem_fun(*this, &ActivityScheduleScenarioView::itemPeriodSelected), items_periods[i])); Evas_Object *btn = edje_object_part_external_object_get(edje, "button.valid"); elm_object_text_set(btn, _("Apply")); btn = edje_object_part_external_object_get(edje, "button.add"); elm_object_text_set(btn, _("Add")); setPartText("hours_text", _("<big><disabled>Hours of execution</disabled></big>")); setPartText("month_text", _("<big><disabled>Specific schedule</disabled></big>")); }
void ActivityWebView::_webTitleChanged() { const char *t = elm_web_title_get(web); if (t) setPartText("page.title", t); }
ActivityConfigScreensaverView::ActivityConfigScreensaverView(Evas *_e, Evas_Object *_parent): ActivityView(_e, _parent, "calaos/page/config/screensaver") { EdjeObject *slider; setPartText("tab1.text", _("Configure Touch Screen")); setPartText("tab1.text.detail", _("Resume : <light_blue>Touch Screen</light_blue><br><small>Configure your Touch Screen !</small>")); setPartText("tab2.text", _("About")); setPartText("tab2.text.detail", _("About : <light_blue>Calaos products</light_blue><br><small>Touchscreen solutions.</small>")); setPartText("module_screen", _("Configure power management settings")); setPartText("module_screen_desc", _("Enable if you want to activate automatic screen blanking and the delay after wich the screen will be turned off. You can also ask for a password when the screen is turned on again.")); setPartText("tab1.title_icon", _("TouchScreen")); setPartText("tab1.subtitle_icon", _("TouchScreen configuration.")); setPartText("tab2.web.label", _("Web Site : ")); setPartText("tab2.web", CALAOS_WEBSITE_URL); setPartText("tab2.mail.label", _("Email : ")); setPartText("tab2.mail", CALAOS_CONTACT_EMAIL); setPartText("tab2.copyright", CALAOS_COPYRIGHT_TEXT); setPartText("module_screen_time_desc", _("Time before screensaver activation : ")); setPartText("module_screen suspend_desc", _("Enable screen saver : ")); // Create a new slider for the DPMS standby option slider = new EdjeObject(ApplicationMain::getTheme(), evas); slider->setAutoDelete(true); double slider_val; string option_val; option_val = get_config_option("dpms_standby"); from_string(option_val, slider_val); setPartText("module_screen_time_value", to_string((int)(slider_val / 60.0)) + _(" minutes")); slider->addCallback("object", "*", [=](void *data, Evas_Object *edje_object, string emission, string source) { // Change value on screen when slider move if (emission == "slider,move") { double x; string val; slider->getDragValue("slider", &x, NULL); val = to_string((int)(x * DPMS_STANDBY_MAX_VALUE)) + _(" minutes"); setPartText("module_screen_time_value", val); } // Set new value in local_config.xml when slider,changed is received else if (emission == "slider,changed") { double x; slider->getDragValue("slider", &x, NULL); // Value is store in seconds set_config_option("dpms_standby", to_string((int)(x * 60.0 * DPMS_STANDBY_MAX_VALUE))); } } ); slider->LoadEdje("calaos/slider/horizontal/default"); slider->Show(); slider->setDragValue("slider", slider_val / 60.0 / DPMS_STANDBY_MAX_VALUE, slider_val / 60.0 / DPMS_STANDBY_MAX_VALUE); Swallow(slider, "dpms_standby_slider.swallow", true); addCallback("object", "*", [=](void *data, Evas_Object *edje_object, string emission, string source) { printf("Emission : %s | Source : %s\n", emission.c_str(), source.c_str()); }); }