Пример #1
0
void ActivityAudioListView::createRootBrowserPage()
{
    browser_root = new EdjeObject(theme, evas);
    browser_root->LoadEdje("calaos/audio/browser/root");
    browser_root->setAutoDelete(true);

    EdjeObject *obj;
    Params &stats = player_current->getPlayer()->getDBStats();

    obj = createRootButton(_("My Albums"), _("Access to your albums."), stats["albums"], 0, 0);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowAlbums));

    obj = createRootButton(_("Artists"), _("Display by artists."), stats["artists"], 0, 1);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowArtists));

    obj = createRootButton(_("Years"), _("Sort songs by year."), stats["years"], 1, 0);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowYears));

    obj = createRootButton(_("Genre"), "Afficher les titres par genres.", stats["genres"], 1, 1);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowGenres));

    obj = createRootButton(_("Music Directory"), "Navigate your music library by directory.", "", 2, 0);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowFolders));

    obj = createRootButton(_("Playlists"), "Your saved playlists", stats["playlists"], 2, 1);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowPlaylists));

    obj = createRootButton(_("Radios"), _("Web radios web and online service."), "", 3, 0);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowRadios));

    obj = createRootButton(_("Search..."), _("Search into your music library."), "", 3, 1);
    obj->addCallback("button", "pressed", sigc::mem_fun(*this, &ActivityAudioListView::browserShowSearch));

    it_browser_root = elm_naviframe_item_push(pager_browser, NULL, NULL, NULL, browser_root->getEvasObject(), "calaos");
}
void ActivityScheduleScenarioView::showTimeSelection(void *data)
{
    int *user_data = reinterpret_cast<int *>(data);

    if (editState == EDIT_START_OFFSET && user_data)
    {
        editStatesHist.push(editState);
        if (*user_data == 0)
        {
            edit_range.start_offset = 0;
            edit_range.shour = "0";
            edit_range.smin = "0";
            edit_range.ssec = "0";

            if (cycle)
            {
                editState = EDIT_END_TYPE;
                createTimeSelectTypeList(NULL, NULL, "", "");

                return;
            }
            else
            {
                editState = EDIT_WEEK;
                showWeekSelection(NULL, NULL, "", "");

                return;
            }
        }
        else if (*user_data == 1)
        {
            edit_range.start_offset = 1;
            editState  = EDIT_START_TIME_OFFSET;
        }
        else if (*user_data == 2)
        {
            edit_range.start_offset = -1;
            editState  = EDIT_START_TIME_OFFSET;
        }
    }

    if (editState == EDIT_END_OFFSET && user_data)
    {
        editStatesHist.push(editState);
        if (*user_data == 0)
        {
            edit_range.end_offset = 0;
            edit_range.ehour = "0";
            edit_range.emin = "0";
            edit_range.esec = "0";

            editState = EDIT_WEEK;
            showWeekSelection(NULL, NULL, "", "");

            return;
        }
        else if (*user_data == 1)
        {
            edit_range.end_offset = 1;
            editState  = EDIT_END_TIME_OFFSET;
        }
        else if (*user_data == 2)
        {
            edit_range.end_offset = -1;
            editState  = EDIT_END_TIME_OFFSET;
        }
    }

    EdjeObject *page = new EdjeObject(ApplicationMain::getTheme(), evas);
    page->LoadEdje("calaos/popup/page/time_schedule");
    page->setAutoDelete(true);

    page->addCallback("button.back", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonBackClick));

    if (cycle && editState < EDIT_END_TYPE)
        page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::createTimeSelectTypeList));
    else
        page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::showWeekSelection));
    string t;
    if (editState == EDIT_START_TIME)
        t = _("<b>Choose a scheduling</b><br><light_blue><small>Start time of scenario</small></light_blue>");
    else if (editState == EDIT_END_TIME)
        t = _("<b>Choose a scheduling</b><br><light_blue><small>End time of scenario</small></light_blue>");
    else if (editState == EDIT_START_TIME_OFFSET)
        t = _("<b>Choose a time shift</b><br><light_blue><small>Shifting start of scenario</small></light_blue>");
    else if (editState == EDIT_END_TIME_OFFSET)
        t = _("<b>Choose a time shift</b><br><light_blue><small>Shifteng end of scenario</small></light_blue>");
    page->setPartText("text", t);

    int hour_value, min_value, sec_value;
    Evas_Object **spin_hour = NULL, **spin_min = NULL, **spin_sec = NULL;
    if (editState == EDIT_START_TIME || editState == EDIT_START_TIME_OFFSET)
    {
        from_string(edit_range.shour, hour_value);
        from_string(edit_range.smin, min_value);
        from_string(edit_range.ssec, sec_value);

        spin_hour = &spin_start_hours;
        spin_min = &spin_start_min;
        spin_sec = &spin_start_sec;
    }
    else if (editState == EDIT_END_TIME || editState == EDIT_END_TIME_OFFSET)
    {
        from_string(edit_range.ehour, hour_value);
        from_string(edit_range.emin, min_value);
        from_string(edit_range.esec, sec_value);

        spin_hour = &spin_end_hours;
        spin_min = &spin_end_min;
        spin_sec = &spin_end_sec;
    }

    *spin_hour = elm_spinner_add(parent);
    elm_object_style_set(*spin_hour, "calaos/time/vertical");
    elm_spinner_label_format_set(*spin_hour, _("%.0f<br><subtitle>Hours</subtitle>"));
    elm_spinner_min_max_set(*spin_hour, 0, 99);
    elm_spinner_step_set(*spin_hour, 1);
    elm_spinner_interval_set(*spin_hour, 0.15);
    elm_spinner_value_set(*spin_hour, hour_value);
    evas_object_show(*spin_hour);
    page->Swallow(*spin_hour, "spinner.hours", true);

    *spin_min = elm_spinner_add(parent);
    elm_object_style_set(*spin_min, "calaos/time/vertical");
    elm_spinner_label_format_set(*spin_min, _("%.0f<br><subtitle>Min.</subtitle>"));
    elm_spinner_min_max_set(*spin_min, 0, 59);
    elm_spinner_step_set(*spin_min, 1);
    elm_spinner_interval_set(*spin_min, 0.15);
    elm_spinner_value_set(*spin_min, min_value);
    evas_object_show(*spin_min);
    page->Swallow(*spin_min, "spinner.minutes", true);

    *spin_sec = elm_spinner_add(parent);
    elm_object_style_set(*spin_sec, "calaos/time/vertical");
    elm_spinner_label_format_set(*spin_sec, _("%.0f<br><subtitle>Sec.</subtitle>"));
    elm_spinner_min_max_set(*spin_sec, 0, 59);
    elm_spinner_step_set(*spin_sec, 1);
    elm_spinner_interval_set(*spin_sec, 0.15);
    elm_spinner_value_set(*spin_sec, sec_value);
    evas_object_show(*spin_sec);
    page->Swallow(*spin_sec, "spinner.seconds", true);

    evas_object_size_hint_min_set(page->getEvasObject(), 300, 300);
    page->Show();

    elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, page->getEvasObject(), "calaos");
}
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());
                            });

}