コード例 #1
0
void IOGenlistScenarioHomeView::clickFlashButton_cb()
{
        itemEmitSignal("text,inactive", "calaos");
        itemEmitSignal("off,anim", "calaos");

        elm_image_file_set(elm_object_content_get(object_button), ApplicationMain::getTheme(), "calaos/icons/action_button/play");
}
コード例 #2
0
void IOWODaliRVBHomeView::updateView()
{
    if (!io || !item)
        return;

    elm_genlist_item_fields_update(item, "text", ELM_GENLIST_ITEM_FIELD_TEXT);
    elm_genlist_item_fields_update(item, "text.value.red", ELM_GENLIST_ITEM_FIELD_TEXT);
    elm_genlist_item_fields_update(item, "text.value.green", ELM_GENLIST_ITEM_FIELD_TEXT);
    elm_genlist_item_fields_update(item, "text.value.blue", ELM_GENLIST_ITEM_FIELD_TEXT);
    elm_genlist_item_fields_update(item, "color.preview", ELM_GENLIST_ITEM_FIELD_CONTENT);

    ColorValue c(io->params["state"]);

    if (slider_red)
        slider_red->setDragValue("slider", c.getRed() / 255.0, 0.0);
    if (slider_green)
        slider_green->setDragValue("slider", c.getGreen() / 255.0, 0.0);
    if (slider_blue)
        slider_blue->setDragValue("slider", c.getBlue() / 255.0, 0.0);

    if (c.getRed() > 0 || c.getGreen() > 0 || c.getBlue() > 0)
    {
        itemEmitSignal("text,active,yellow", "calaos");
        itemEmitSignal("on,anim", "calaos");
    }
    else
    {
        itemEmitSignal("text,inactive", "calaos");
        itemEmitSignal("off,anim", "calaos");
    }
}
コード例 #3
0
string GenlistItemScenarioSchedule::getLabelItem(Evas_Object *obj, string part)
{
    string text;

    if (!scenario) return text;

    if (part == "text")
    {
        text = scenario->ioScenario->params["name"];
    }
    else if (part == "time")
    {
        text = "N/A";

        if (scenario->isScheduled())
        {
            auto getTimeForDate = [=,&text](vector<TimeRange> &range)
            {
                if (scheduleRangeNum >= 0 && scheduleRangeNum < range.size())
                {
                    TimeRange tr = range[scheduleRangeNum];
                    text = tr.getStartTimeSec(scDate.tm_year + 1900, scDate.tm_mon + 1, scDate.tm_mday);
                }
            };

            switch (scheduleRange)
            {
            case TimeRange::MONDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_monday); break;
            case TimeRange::TUESDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_tuesday); break;
            case TimeRange::WEDNESDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_wednesday); break;
            case TimeRange::THURSDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_thursday); break;
            case TimeRange::FRIDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_friday); break;
            case TimeRange::SATURDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_saturday); break;
            case TimeRange::SUNDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_sunday); break;
            default: break;
            }
        }
    }
    else if (part == "actions.text")
    {
        text = "Aucune actions.";
        if (scenario->scenario_data.steps.size() > 1)
            text = Utils::to_string(scenario->scenario_data.steps.size()) + " étapes.";
        else if (scenario->scenario_data.steps.size() == 1 &&
                 scenario->scenario_data.steps[0].actions.size() > 0)
            text = Utils::to_string(scenario->scenario_data.steps[0].actions.size()) + " actions.";
    }

    if (scenario->scenario_data.params["schedule"] != "false")
        itemEmitSignal("schedule,true", "calaos");
    else
        itemEmitSignal("schedule,false", "calaos");

    return text;
}
コード例 #4
0
void IOGenlistScenarioHomeView::buttonClickGo()
{
        if (!io) return;

        io->sendAction("true");

        if (io->params["ioBoolState"] == "")
        {
                itemEmitSignal("text,active,blue", "calaos");
                itemEmitSignal("on,anim", "calaos");

                elm_image_file_set(elm_object_content_get(object_button), ApplicationMain::getTheme(), "calaos/icons/action_button/stop");

                //If it's not a SimpleScenario, just flash button when user click it.
                EcoreTimer::singleShot(0.7, sigc::mem_fun(*this, &IOGenlistScenarioHomeView::clickFlashButton_cb));
        }
}
コード例 #5
0
void IOWODaliRVBHomeView::initView()
{
    if (!io || !item)
        return;

    ColorValue c(io->params["state"]);

    if (c.getRed() > 0 || c.getGreen() > 0 || c.getBlue() > 0)
    {
        itemEmitSignal("text,active,yellow", "calaos");
        itemEmitSignal("on,normal", "calaos");
    }
    else
    {
        itemEmitSignal("text,inactive", "calaos");
        itemEmitSignal("off,normal", "calaos");
    }
}
コード例 #6
0
Evas_Object *GenlistItemSimpleKeyValue::getPartItem(Evas_Object *obj, string part)
{
        Evas_Object *o = NULL;

        if (part == "icon")
        {
                if (icon != "")
                {
                        o = elm_icon_add(parent);
                        elm_image_file_set(o, ApplicationMain::getTheme(), icon.c_str());

                        itemEmitSignal("icon,enabled", "calaos");
                }
                else
                {
                        itemEmitSignal("icon,disabled", "calaos");
                }
        }

        return o;
}
コード例 #7
0
void IOGenlistScenarioHomeView::initView()
{
        if (!io || !item)
                return;

        elm_genlist_item_fields_update(item, "text", ELM_GENLIST_ITEM_FIELD_TEXT);

        //Don't change button state if it's not a SimpleScenario
        if (io->params["ioBoolState"] == "")
        {
                itemEmitSignal("text,inactive", "calaos");
                itemEmitSignal("off,anim", "calaos");

                elm_image_file_set(elm_object_content_get(object_button), ApplicationMain::getTheme(), "calaos/icons/action_button/play");

                return;
        }

        if (io->params["state"] == "true")
        {
                itemEmitSignal("text,active,blue", "calaos");
                itemEmitSignal("on,normal", "calaos");
        }
        else
        {
                itemEmitSignal("text,inactive", "calaos");
                itemEmitSignal("off,normal", "calaos");
        }
}
コード例 #8
0
Evas_Object *GenlistItemSimple::getPartItem(Evas_Object *obj, string part)
{
        Evas_Object *o = NULL;

        if (part == "icon")
        {
                if (icon != "")
                {
                        o = elm_icon_add(parent);
                        elm_image_file_set(o, ApplicationMain::getTheme(), icon.c_str());

                        itemEmitSignal("icon,enabled", "calaos");
                }
                else
                {
                        itemEmitSignal("icon,disabled", "calaos");
                }
        }
        else if (part == "button")
        {
                if (button_icon != "")
                {
                        o = elm_button_add(parent);
                        Evas_Object *_icon = elm_icon_add(o);
                        elm_image_file_set(_icon, ApplicationMain::getTheme(), button_icon.c_str());
                        elm_object_style_set(o, "calaos/action_button/blue");
                        elm_object_content_set(o, _icon);
                        evas_object_smart_callback_add(o, "clicked", _item_button_Pressed, this);

                        itemEmitSignal("button,enabled", "calaos");
                }
                else
                {
                        itemEmitSignal("button,disabled", "calaos");
                }
        }

        return o;
}
コード例 #9
0
void IOWOVoletSmartHomeView::updateView()
{
    if (!io || !item)
        return;

    elm_genlist_item_fields_update(item, "text", ELM_GENLIST_ITEM_FIELD_TEXT);
    elm_genlist_item_fields_update(item, "shutter.state", ELM_GENLIST_ITEM_FIELD_TEXT);
    elm_genlist_item_fields_update(item, "shutter.action", ELM_GENLIST_ITEM_FIELD_TEXT);

    int percent = io->getPercentVoletSmart();

    if (percent >= 100)
    {
        itemEmitSignal("text,active,blue", "calaos");
        itemEmitSignal("on,normal", "calaos");
    }
    else
    {
        itemEmitSignal("text,inactive", "calaos");
        itemEmitSignal("off,normal", "calaos");
    }

    if (window_slider) window_slider->setDragValue("object.shutter", 0.0, (double)percent / 100.0);
}