예제 #1
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");
}