Пример #1
0
Evas_Object *IOGenlistRoomGroupIcon::getPartItem(Evas_Object *obj, string part)
{
        Evas_Object *o = NULL;

        if (part == "icon")
        {
                string type = room->type;
                string t = type;

                if (type == "salon") t = "lounge";
                if (type == "chambre") t = "bedroom";
                if (type == "cuisine") t = "kitchen";
                if (type == "bureau") t = "office";
                if (type == "sam") t = "diningroom";
                if (type == "cave") t = "cellar";
                if (type == "divers") t = "various";
                if (type == "misc") t = "various";
                if (type == "exterieur") t = "outside";
                if (type == "sdb") t = "bathroom";
                if (type == "hall") t = "corridor";
                if (type == "couloir") t = "corridor";

                EdjeObject *icon = new EdjeObject(ApplicationMain::getTheme(), evas);
                string group = "calaos/icons/room/";

                try
                {
                    icon->LoadEdje(group + t);
                }
                catch(...)
                {
                        //room not found, load default
                        icon->LoadEdje("calaos/icons/room/various");
                }

                icon->setAutoDelete(true);
                o = icon->getEvasObject();
        }

        return o;
}
Пример #2
0
bool XmasWidget::LoadWidget(std::string, double _x, double _y, std::string _id)
{
        std::string witem = "calaos/widget/xmas";
        if (!LoadEdje(witem))
        {
                return false;
        }

        setLayer(500);
        EdjeObject::Show();

        clip = evas_object_rectangle_add(evas);
        evas_object_show(clip);
        edje_object_part_swallow(edje, "widget.swallow", clip);

        Resize(1024, 768);

        //create some flakes
        for (int i = 0;i < MAX_FLAKE;i++)
        {
                std::string type;
                if (i < MAX_FLAKE / 3) type = "flake_small";
                else if (i >= MAX_FLAKE / 3 && i < (MAX_FLAKE / 3) * 2) type = "flake_medium";
                else type = "flake_large";

                EdjeObject *o = new EdjeObject(theme, evas);
                if (!o->LoadEdje("calaos/widget/xmas/" + type))
                    cError() << "Error loading edje group calaos/widget/xmas/" + type;
                o->setLayer(500);
                evas_object_clip_set(o->getEvasObject(), clip);

                Flake *flake = new Flake(o);

                int tx = random() % clipw;
                int ty = random() % cliph;

                flake->Move(tx + clipx, ty + clipy);
                flake->Show();
                flake->setStart(ecore_time_get() + (double)(random() % (flake->getHeight() * 10)) / (double)flake->getHeight());

                if (type == "flake_small") flake->setSpeed(1);
                if (type == "flake_medium") flake->setSpeed(2);
                if (type == "flake_large") flake->setSpeed(3);

                flakes.push_back(flake);
        }

        return true;
}
Пример #3
0
EdjeObject *ActivityAudioListView::createRootButton(string title, string subtitle, string total, int row, int col)
{
    EdjeObject *obj = new EdjeObject(theme, evas);
    obj->LoadEdje("calaos/audio/browser/button");
    obj->setPartText("title", title);
    obj->setPartText("subtitle", subtitle);
    obj->setPartText("total", total);
    obj->Show();

    int w, h;
    edje_object_size_min_get(obj->getEvasObject(), &w, &h);
    obj->Resize(w, h);
    evas_object_size_hint_min_set(obj->getEvasObject(), w, h);

    browser_root_buttons.push_back(obj);

    if (!edje_object_part_table_pack(browser_root->getEvasObject(), "table", obj->getEvasObject(),
                                     col, row, 1, 1))
        cCritical() <<  "ActivityAudioListView::createRootButton(), failed to pack object into table !";

    return obj;
}
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());
                            });

}