diff --git a/data/themes/default/elm/elm_genlist_item_simple.edc b/data/themes/default/elm/elm_genlist_item_simple.edc
index 0c161ead..8d56e0a4 100644
--- a/data/themes/default/elm/elm_genlist_item_simple.edc
+++ b/data/themes/default/elm/elm_genlist_item_simple.edc
@@ -486,6 +486,115 @@ group
}
}
+group
+{
+ name: "elm/genlist/item/simple_header/navigation/default";
+ alias: "elm/genlist/item_compress/simple_header/navigation/default";
+
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ data.item: "contents" "button.valid button.back";
+
+ parts
+ {
+ part
+ {
+ name: "item_back";
+ type: RECT;
+ description
+ {
+ state: "default" 0.0;
+ min: 50 82;
+ fixed: 0 0;
+ color: 255 255 255 0;
+ }
+ }
+ part
+ {
+ name: "bg";
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ image.normal: "popup_carbon.png";
+ fill { smooth: 1; size { relative: 0.0 0.0; offset: 8 8;} }
+ rel1 { relative: 0.0 0.0; offset: 0 0; };
+ rel2 { relative: 1.0 1.0; offset: -1 -1; };
+ }
+ }
+
+ part
+ {
+ name: "button.back";
+ type: SWALLOW;
+ description
+ {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 7 7; }
+ rel2 { relative: 0.0 0.0; offset: 7+76 7+31; }
+ }
+ description
+ {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ part
+ {
+ name: "button.valid";
+ type: SWALLOW;
+ description
+ {
+ state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; offset: -7-36 7; }
+ rel2 { relative: 1.0 0.0; offset: -7 7+31; }
+ }
+ description
+ {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+
+ part
+ {
+ name: "elm.text";
+ type: TEXTBLOCK;
+ description
+ {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.0; offset: 10 4; }
+ rel2 { relative: 1.0 1.0; offset: -5 -4; }
+ rel1 { relative: 0.0 1.0; offset: 10 7; to_y: "button.back"; }
+ rel2 { relative: 1.0 1.0; offset: -5 -4; }
+ text { align: 0.0 1.0; style: "TabWidgetTitle"; text: "Titre de l'item
Sous titre"; }
+ }
+ }
+
+ part
+ {
+ name: "sep";
+ type: RECT;
+ description
+ {
+ state: "default" 0.0;
+ fixed: 1 1;
+ color: 255 255 255 28;
+ rel1 { relative: 0.0 1.0; offset: 0 -2; }
+ rel2 { relative: 1.0 1.0; offset: -1 -1; }
+ }
+ }
+ }
+
+ programs
+ {
+ }
+}
+
group
{
name: "elm/genlist/item/simple_info/default";
diff --git a/data/themes/default/structure/popup_actions_pages.edc b/data/themes/default/structure/popup_actions_pages.edc
index ffd7cb2f..7d646e0a 100644
--- a/data/themes/default/structure/popup_actions_pages.edc
+++ b/data/themes/default/structure/popup_actions_pages.edc
@@ -38,6 +38,12 @@ group
string: "label" "Actions";
}
}
+ description
+ {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
}
part
@@ -56,6 +62,12 @@ group
string: "icon" "calaos/icons/action_button/popup/valid";
}
}
+ description
+ {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
}
part
@@ -85,6 +97,27 @@ group
}
}
}
+
+ programs
+ {
+ program
+ {
+ name: "hide_back";
+ signal: "hide,back";
+ source: "calaos";
+ action: STATE_SET "hidden" 0.0;
+ target: "button.back";
+ }
+
+ program
+ {
+ name: "hide_valid";
+ signal: "hide,valid";
+ source: "calaos";
+ action: STATE_SET "hidden" 0.0;
+ target: "button.valid";
+ }
+ }
}
group
diff --git a/src/bin/calaos_home/controllers/ActivityScheduleScenarioController.cpp b/src/bin/calaos_home/controllers/ActivityScheduleScenarioController.cpp
index 4e05a938..eceddd53 100644
--- a/src/bin/calaos_home/controllers/ActivityScheduleScenarioController.cpp
+++ b/src/bin/calaos_home/controllers/ActivityScheduleScenarioController.cpp
@@ -39,11 +39,13 @@ void ActivityScheduleScenarioController::createView()
ActivityScheduleScenarioView *scView = dynamic_cast(view);
if (scenario->isScheduled())
{
- scView->setTimeRangeInfos(scenario->ioScenario->range_infos);
+ scView->setTimeRangeInfos(scenario->ioScenario->range_infos, (scenario->scenario_data.params["cycle"] == "true"));
scView->buttonValidPressed.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioController::validModifySchedule));
}
else
{
+ scenario->ioScenario->range_infos = TimeRangeInfos(); //clear if needed
+ scView->setTimeRangeInfos(scenario->ioScenario->range_infos, (scenario->scenario_data.params["cycle"] == "true"));
scView->buttonValidPressed.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioController::validAddSchedule));
}
}
diff --git a/src/bin/calaos_home/views/ActivityScheduleScenarioView.cpp b/src/bin/calaos_home/views/ActivityScheduleScenarioView.cpp
index ab714f95..51f1aec7 100644
--- a/src/bin/calaos_home/views/ActivityScheduleScenarioView.cpp
+++ b/src/bin/calaos_home/views/ActivityScheduleScenarioView.cpp
@@ -22,6 +22,7 @@
#include "ApplicationMain.h"
#include "GenlistItemScenarioHeader.h"
#include "GenlistItemScenarioScheduleTime.h"
+#include "GenlistItemSimpleHeader.h"
ActivityScheduleScenarioView::ActivityScheduleScenarioView(Evas *_e, Evas_Object *_parent):
ActivityView(_e, _parent, "calaos/page/schedule_scenario"),
@@ -146,6 +147,238 @@ void ActivityScheduleScenarioView::buttonPressed(void *data, Evas_Object *_edje,
{
buttonValidPressed.emit(range_infos);
}
+ else if (source == "button.add")
+ {
+ pager_popup = elm_naviframe_add(parent);
+ evas_object_show(pager_popup);
+
+ EdjeObject *page = new EdjeObject(ApplicationMain::getTheme(), evas);
+ page->LoadEdje("calaos/popup/page/time");
+ page->setAutoDelete(true);
+ if (cycle)
+ page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonValidEndClick));
+ else
+ page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonValidWeekClick));
+ string t = "Choisir une heure de planification
Heure de départ du scénario";
+ page->setPartText("text", t);
+
+ page->EmitSignal("hide,back", "calaos");
+
+ spin_start_hours = elm_spinner_add(parent);
+ elm_object_style_set(spin_start_hours, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_start_hours, "%.0f
Heures");
+ elm_spinner_min_max_set(spin_start_hours, 0, 99);
+ elm_spinner_step_set(spin_start_hours, 1);
+ elm_spinner_interval_set(spin_start_hours, 0.15);
+ elm_spinner_value_set(spin_start_hours, 12);
+ evas_object_show(spin_start_hours);
+ page->Swallow(spin_start_hours, "spinner.hours", true);
+
+ spin_start_min = elm_spinner_add(parent);
+ elm_object_style_set(spin_start_min, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_start_min, "%.0f
Min.");
+ elm_spinner_min_max_set(spin_start_min, 0, 59);
+ elm_spinner_step_set(spin_start_min, 1);
+ elm_spinner_interval_set(spin_start_min, 0.15);
+ elm_spinner_value_set(spin_start_min, 0);
+ evas_object_show(spin_start_min);
+ page->Swallow(spin_start_min, "spinner.minutes", true);
+
+ spin_start_sec = elm_spinner_add(parent);
+ elm_object_style_set(spin_start_sec, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_start_sec, "%.0f
Sec.");
+ elm_spinner_min_max_set(spin_start_sec, 0, 59);
+ elm_spinner_step_set(spin_start_sec, 1);
+ elm_spinner_interval_set(spin_start_sec, 0.15);
+ elm_spinner_value_set(spin_start_sec, 0);
+ evas_object_show(spin_start_sec);
+ page->Swallow(spin_start_sec, "spinner.seconds", true);
+
+ spin_start_ms = elm_spinner_add(parent);
+ elm_object_style_set(spin_start_ms, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_start_ms, "%.0f
Ms.");
+ elm_spinner_min_max_set(spin_start_ms, 0, 999);
+ elm_spinner_step_set(spin_start_ms, 1);
+ elm_spinner_interval_set(spin_start_ms, 0.15);
+ elm_spinner_value_set(spin_start_ms, 0);
+ evas_object_show(spin_start_ms);
+ page->Swallow(spin_start_ms, "spinner.miliseconds", true);
+
+ evas_object_size_hint_min_set(page->getEvasObject(), 300, 260);
+ page->Show();
+
+ //create popup
+ popup = elm_ctxpopup_add(parent);
+ elm_object_content_set(popup, pager_popup);
+ elm_object_style_set(popup, "calaos");
+ elm_ctxpopup_direction_priority_set(popup,
+ ELM_CTXPOPUP_DIRECTION_DOWN,
+ ELM_CTXPOPUP_DIRECTION_RIGHT,
+ ELM_CTXPOPUP_DIRECTION_LEFT,
+ ELM_CTXPOPUP_DIRECTION_UP);
+
+ Evas_Coord x,y;
+ evas_pointer_canvas_xy_get(evas, &x, &y);
+ evas_object_move(popup, x, y);
+ evas_object_show(popup);
+
+ elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, page->getEvasObject(), "calaos");
+ }
+}
+
+void ActivityScheduleScenarioView::buttonValidEndClick(void *data, Evas_Object *edje_object, string emission, string source)
+{
+ //Ask for an end hour if the scenario is cycling
+ EdjeObject *page = new EdjeObject(ApplicationMain::getTheme(), evas);
+ page->LoadEdje("calaos/popup/page/time");
+ page->setAutoDelete(true);
+ page->addCallback("button.back", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonBackClick));
+ page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonValidWeekClick));
+ string t = "Choisir une heure de planification
Heure d'arrêt du scénario";
+ page->setPartText("text", t);
+
+ if (edje_object_part_exists(page->getEvasObject(), "button.back"))
+ {
+ Evas_Object *button = edje_object_part_external_object_get(page->getEvasObject(), "button.back");
+ elm_object_text_set(button, "Début");
+ }
+
+ spin_end_hours = elm_spinner_add(parent);
+ elm_object_style_set(spin_end_hours, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_end_hours, "%.0f
Heures");
+ elm_spinner_min_max_set(spin_end_hours, 0, 99);
+ elm_spinner_step_set(spin_end_hours, 1);
+ elm_spinner_interval_set(spin_end_hours, 0.15);
+ elm_spinner_value_set(spin_end_hours, 13);
+ evas_object_show(spin_end_hours);
+ page->Swallow(spin_end_hours, "spinner.hours", true);
+
+ spin_end_min = elm_spinner_add(parent);
+ elm_object_style_set(spin_end_min, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_end_min, "%.0f
Min.");
+ elm_spinner_min_max_set(spin_end_min, 0, 59);
+ elm_spinner_step_set(spin_end_min, 1);
+ elm_spinner_interval_set(spin_end_min, 0.15);
+ elm_spinner_value_set(spin_end_min, 0);
+ evas_object_show(spin_end_min);
+ page->Swallow(spin_end_min, "spinner.minutes", true);
+
+ spin_end_sec = elm_spinner_add(parent);
+ elm_object_style_set(spin_end_sec, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_end_sec, "%.0f
Sec.");
+ elm_spinner_min_max_set(spin_end_sec, 0, 59);
+ elm_spinner_step_set(spin_end_sec, 1);
+ elm_spinner_interval_set(spin_end_sec, 0.15);
+ elm_spinner_value_set(spin_end_sec, 0);
+ evas_object_show(spin_end_sec);
+ page->Swallow(spin_end_sec, "spinner.seconds", true);
+
+ spin_end_ms = elm_spinner_add(parent);
+ elm_object_style_set(spin_end_ms, "calaos/time/vertical");
+ elm_spinner_label_format_set(spin_end_ms, "%.0f
Ms.");
+ elm_spinner_min_max_set(spin_end_ms, 0, 999);
+ elm_spinner_step_set(spin_end_ms, 1);
+ elm_spinner_interval_set(spin_end_ms, 0.15);
+ elm_spinner_value_set(spin_end_ms, 0);
+ evas_object_show(spin_end_ms);
+ page->Swallow(spin_end_ms, "spinner.miliseconds", true);
+
+ evas_object_size_hint_min_set(page->getEvasObject(), 300, 260);
+ page->Show();
+
+ elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, page->getEvasObject(), "calaos");
+}
+
+void ActivityScheduleScenarioView::buttonValidWeekClick(void *data, Evas_Object *edje_object, string emission, string source)
+{
+ Evas_Object *table = createPaddingTable(evas, parent, 300, 260);
+
+ Evas_Object *glist = elm_genlist_add(table);
+ elm_object_style_set(glist, "calaos");
+ elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_genlist_multi_select_set(glist, true);
+ evas_object_show(glist);
+
+ string title_label = "Jours de la semaine
Jours de la semaine où le scénario sera exécuté.";
+ GenlistItemSimpleHeader *header = new GenlistItemSimpleHeader(evas, glist, title_label, "navigation");
+ header->Append(glist);
+
+ if (cycle)
+ header->setButtonLabel("button.back", "Fin");
+ else
+ header->setButtonLabel("button.back", "Début");
+ header->button_click.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::headerWeekButtonClick));
+
+ week_days.clear();
+ week_days.reserve(8);
+ GenlistItemSimple *item;
+
+ for (int i = 0;i < 8;i++)
+ {
+ string label;
+ switch (i)
+ {
+ case 0: label = "Tous les jours"; break;
+ case 1: label = "Lundi"; break;
+ case 2: label = "Mardi"; break;
+ case 3: label = "Mercredi"; break;
+ case 4: label = "Jeudi"; break;
+ case 5: label = "Vendredi"; break;
+ case 6: label = "Samedi"; break;
+ case 7: label = "Dimanche"; break;
+ default: label = "ERROR";
+ }
+
+ item = new GenlistItemSimple(evas, glist, label, true, false, NULL, "check");
+ item->Append(glist, header);
+ week_days.push_back(item);
+
+ if (i == 0)
+ {
+ item->item_selected.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::unselectWeekDays));
+ item->setSelected(true);
+ }
+ else
+ {
+ item->item_selected.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::unselectAllWeekDays));
+ }
+ }
+
+ elm_table_pack(table, glist, 1, 1, 1, 1);
+
+ elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos");
+}
+
+void ActivityScheduleScenarioView::headerWeekButtonClick(string bt)
+{
+ if (bt == "button.back")
+ {
+ elm_naviframe_item_pop(pager_popup);
+ }
+ else if (bt == "button.valid")
+ {
+ //TODO,add to TimeRange and update genlist
+
+ elm_ctxpopup_dismiss(popup);
+ }
+}
+
+void ActivityScheduleScenarioView::buttonBackClick(void *data, Evas_Object *edje_object, string emission, string source)
+{
+ elm_naviframe_item_pop(pager_popup);
+}
+
+void ActivityScheduleScenarioView::unselectWeekDays(void *data)
+{
+ for (uint i = 1;i < week_days.size();i++)
+ week_days[i]->setSelected(false);
+}
+
+void ActivityScheduleScenarioView::unselectAllWeekDays(void *data)
+{
+ week_days[0]->setSelected(false);
}
void ActivityScheduleScenarioView::itemAllYearSelected(void *data)
diff --git a/src/bin/calaos_home/views/ActivityScheduleScenarioView.h b/src/bin/calaos_home/views/ActivityScheduleScenarioView.h
index 282194ae..eb290d58 100644
--- a/src/bin/calaos_home/views/ActivityScheduleScenarioView.h
+++ b/src/bin/calaos_home/views/ActivityScheduleScenarioView.h
@@ -40,6 +40,23 @@ class ActivityScheduleScenarioView: public ActivityView
vector items_months;
vector items_periods;
+ Evas_Object *popup;
+ Evas_Object *pager_popup;
+
+ Evas_Object *spin_start_hours;
+ Evas_Object *spin_start_min;
+ Evas_Object *spin_start_sec;
+ Evas_Object *spin_start_ms;
+
+ Evas_Object *spin_end_hours;
+ Evas_Object *spin_end_min;
+ Evas_Object *spin_end_sec;
+ Evas_Object *spin_end_ms;
+
+ vector week_days;
+
+ bool cycle;
+
void buttonPressed(void *data, Evas_Object *_edje, std::string emission, std::string source);
void itemAllYearSelected(void *data);
@@ -48,13 +65,22 @@ class ActivityScheduleScenarioView: public ActivityView
void reloadTimeRanges();
+ void buttonValidEndClick(void *data, Evas_Object *edje_object, string emission, string source);
+ void buttonValidWeekClick(void *data, Evas_Object *edje_object, string emission, string source);
+ void buttonBackClick(void *data, Evas_Object *edje_object, string emission, string source);
+
+ void unselectWeekDays(void *data);
+ void unselectAllWeekDays(void *data);
+
+ void headerWeekButtonClick(string bt);
+
public:
ActivityScheduleScenarioView(Evas *evas, Evas_Object *parent);
~ActivityScheduleScenarioView();
virtual void resetView();
- void setTimeRangeInfos(TimeRangeInfos &tr) { range_infos = tr; reloadTimeRanges(); }
+ void setTimeRangeInfos(TimeRangeInfos &tr, bool _cycle) { range_infos = tr; reloadTimeRanges(); cycle = _cycle; }
sigc::signal buttonValidPressed;
};
diff --git a/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.cpp b/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.cpp
index 30fa84bd..92e22521 100644
--- a/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.cpp
+++ b/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.cpp
@@ -20,9 +20,13 @@
******************************************************************************/
#include "GenlistItemSimpleHeader.h"
+#include "ApplicationMain.h"
-GenlistItemSimpleHeader::GenlistItemSimpleHeader(Evas *_evas, Evas_Object *_parent, string _label):
- GenlistItemBase(_evas, _parent, "simple_header", ELM_GENLIST_ITEM_GROUP),
+ITEM_BUTTON_CALLBACK(GenlistItemSimpleHeader, Back)
+ITEM_BUTTON_CALLBACK(GenlistItemSimpleHeader, Valid)
+
+GenlistItemSimpleHeader::GenlistItemSimpleHeader(Evas *_evas, Evas_Object *_parent, string _label, string style_addition):
+ GenlistItemBase(_evas, _parent, string("simple_header") + string((style_addition != "")? "/" + style_addition:""), ELM_GENLIST_ITEM_GROUP),
label(_label)
{
}
@@ -35,3 +39,37 @@ string GenlistItemSimpleHeader::getLabelItem(Evas_Object *obj, string part)
{
return label;
}
+
+Evas_Object *GenlistItemSimpleHeader::getPartItem(Evas_Object *obj, string part)
+{
+ Evas_Object *o = NULL;
+
+ if (part == "button.valid")
+ {
+ o = elm_button_add(parent);
+ Evas_Object *icon = elm_icon_add(o);
+ elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/popup/valid");
+ elm_object_style_set(o, "calaos/action_button/green");
+ elm_object_content_set(o, icon);
+ evas_object_smart_callback_add(o, "clicked", _item_button_Valid, this);
+ }
+ else if (part == "button.back")
+ {
+ o = elm_button_add(parent);
+ elm_object_style_set(o, "calaos/action_button/label/back");
+ elm_object_text_set(o, bt_labels[part].c_str());
+ evas_object_smart_callback_add(o, "clicked", _item_button_Back, this);
+ }
+
+ return o;
+}
+
+void GenlistItemSimpleHeader::buttonClickValid()
+{
+ button_click.emit("button.valid");
+}
+
+void GenlistItemSimpleHeader::buttonClickBack()
+{
+ button_click.emit("button.back");
+}
diff --git a/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.h b/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.h
index 7bd75bfe..92fdfce9 100644
--- a/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.h
+++ b/src/bin/calaos_home/views/GenlistItems/GenlistItemSimpleHeader.h
@@ -32,11 +32,21 @@ class GenlistItemSimpleHeader: public GenlistItemBase
private:
string label;
+ Params bt_labels;
+
public:
- GenlistItemSimpleHeader(Evas *evas, Evas_Object *parent, string label);
+ GenlistItemSimpleHeader(Evas *evas, Evas_Object *parent, string label, string style_addition = "");
virtual ~GenlistItemSimpleHeader();
virtual string getLabelItem(Evas_Object *obj, string part);
+ virtual Evas_Object *getPartItem(Evas_Object *obj, string part);
+
+ void setButtonLabel(string _button, string _label) { bt_labels.Add(_button, _label); }
+
+ void buttonClickBack();
+ void buttonClickValid();
+
+ sigc::signal button_click; //special headers can have buttons
};
#endif // GENLISTITEMSIMPLEHEADER_H