Hello Michaël,
On 06/22/2012 11:52 PM, Michaël Bouchaud wrote:
My mind isn't fixed, look svn ^^
but if you can provide a better example, I take it ! :)
Your patch go in, thx !
cool, thanks. I have attached a patch with an example for the changed
signal. I hope this makes sense. I also attached a patch to add the
since keyword to the signal documentation. This does not seem to have
the intended effect, maybe someone with more knowledge about doxygen can
look into this?
Regards,
Daniel
2012/6/22 Daniel Willmann <d.willm...@samsung.com>
On 06/21/2012 11:34 PM, Michaël Bouchaud wrote:
Sorry, but I really cannot identify your use case. The only utility
that I see to emit a "changed" signal is to be noticed that the
progressbar value has changed ... But we will not use the value
later, but surely not to redefine a new format. format_func is here
to do that.
I agree that the example I have provided is dumb and redundant now that
format_func exists. I still think a signal has its merits as you are not
limited to changing the format function, but can do other stuff as well
(change the icon depending on the speed, progress, ...).
That said, I'm not going to follow up on this as it seems that your mind
is set.
Regards,
Daniel
2012/6/20 Daniel Willmann <d.willm...@samsung.com>
Hello,
On 06/19/2012 11:57 PM, Michaël Bouchaud wrote:
Damn !!! sorry raster, I've forget to send my draft answer. I
have talked to the author on irc, but I don't warned you to not
apply it....
just to clarify, raster asked me about the patch on irc and I told
him that you already applied a modified version. The we discussed
if the changed signal might have its own merits. I believe it does,
since you are a lot more flexible with a signal. You could add a
function that calculates the ETA based on the progress over time
and displays that somewhere, changes the background, an icon, etc.
I think it would make sense to have both features side-by-side,
each for their own use case.
Regards, Daniel
2012/6/19 Carsten Haitzler<ras...@rasterman.com>
On Thu, 14 Jun 2012 15:04:40 +0100 Daniel
Willmann<d.willmann@samsung.**
com <d.willm...@samsung.com>
said:
thanks! in svn it is!
Some more discussion in IRC led to the conclusion that this
should be a
handled in a signal callback I've attached the new patch
where I also updated the progress bar example.
-- ------------- Codito, ergo sum - "I code, therefore I am"
-------------- The Rasterman (Carsten Haitzler)
ras...@rasterman.com
From c2272fae54d2c9d5f356e02663019b5b804ce733 Mon Sep 17 00:00:00 2001
From: Daniel Willmann <d.willm...@samsung.com>
Date: Wed, 27 Jun 2012 17:17:23 +0100
Subject: [PATCH] elementary: Add example for progressbar "changed" signal
This example calculates the ETA for the progress and displays the value
in a label.
Signed-off-by: Daniel Willmann <d.willm...@samsung.com>
---
.../elementary/src/examples/progressbar_example.c | 81 ++++++++++++++++----
1 file changed, 68 insertions(+), 13 deletions(-)
diff --git a/trunk/elementary/src/examples/progressbar_example.c b/trunk/elementary/src/examples/progressbar_example.c
index 2d4be20..c6dca5f 100644
--- a/trunk/elementary/src/examples/progressbar_example.c
+++ b/trunk/elementary/src/examples/progressbar_example.c
@@ -11,15 +11,18 @@
#include <Elementary.h>
+#include <time.h>
+
typedef struct Progressbar_Example
{
Evas_Object *pb1;
Evas_Object *pb2; /* pulsing */
Evas_Object *pb3;
Evas_Object *pb4;
- Evas_Object *pb5; /* pulsing */
- Evas_Object *pb6;
- Evas_Object *pb7; /* pulsing */
+ Evas_Object *pb5;
+ Evas_Object *pb6; /* pulsing */
+ Evas_Object *pb7;
+ Evas_Object *pb8; /* pulsing */
Eina_Bool run;
Ecore_Timer *timer;
@@ -40,7 +43,8 @@ _progressbar_example_value_set(void *data)
elm_progressbar_value_set(example_data.pb1, progress);
elm_progressbar_value_set(example_data.pb3, progress);
elm_progressbar_value_set(example_data.pb4, progress);
- elm_progressbar_value_set(example_data.pb6, progress);
+ elm_progressbar_value_set(example_data.pb5, progress);
+ elm_progressbar_value_set(example_data.pb7, progress);
if (progress < 1.0) return ECORE_CALLBACK_RENEW;
@@ -54,8 +58,8 @@ _progressbar_example_start(void *data,
void *event_info)
{
elm_progressbar_pulse(example_data.pb2, EINA_TRUE);
- elm_progressbar_pulse(example_data.pb5, EINA_TRUE);
- elm_progressbar_pulse(example_data.pb7, EINA_TRUE);
+ elm_progressbar_pulse(example_data.pb6, EINA_TRUE);
+ elm_progressbar_pulse(example_data.pb8, EINA_TRUE);
if (!example_data.run)
{
@@ -72,8 +76,8 @@ _progressbar_example_stop(void *data,
void *event_info)
{
elm_progressbar_pulse(example_data.pb2, EINA_FALSE);
- elm_progressbar_pulse(example_data.pb5, EINA_FALSE);
- elm_progressbar_pulse(example_data.pb7, EINA_FALSE);
+ elm_progressbar_pulse(example_data.pb6, EINA_FALSE);
+ elm_progressbar_pulse(example_data.pb8, EINA_FALSE);
if (example_data.run)
{
@@ -99,6 +103,39 @@ _progress_format_free(char *str)
}
static void
+_on_changed(void *data,
+ Evas_Object *obj,
+ void *event_info)
+{
+ static char buf[30];
+ static time_t tstart = 0;
+ static double eta = 0;
+ time_t tdiff;
+ double val;
+ Evas_Object *label = (Evas_Object *)data;
+
+ val = elm_progressbar_value_get(obj);
+ if (val == 0)
+ {
+ tstart = 0;
+ elm_object_text_set(label, "ETA: N/A");
+ return;
+ }
+
+ /* First invocation */
+ if (tstart == 0)
+ {
+ tstart = time(NULL);
+ }
+
+ /* Calculate ETA and update */
+ tdiff = time(NULL) - tstart;
+ eta = 0.3*eta + 0.7*(tdiff/val)*(1-val);
+ snprintf(buf, 30, "ETA: %.0fs", eta);
+ elm_object_text_set(label, buf);
+}
+
+static void
_on_done(void *data,
Evas_Object *obj,
void *event_info)
@@ -111,7 +148,7 @@ EAPI_MAIN int
elm_main(int argc,
char **argv)
{
- Evas_Object *win, *bg, *pb, *bx, *hbx, *bt, *bt_bx, *ic1, *ic2;
+ Evas_Object *win, *bg, *pb, *bx, *hbx, *bt, *bt_bx, *ic1, *ic2, *label;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "images/logo_small.png");
@@ -167,6 +204,24 @@ elm_main(int argc,
evas_object_show(pb);
example_data.pb3 = pb;
+ /* pb with label and changed trigger */
+ pb = elm_progressbar_add(win);
+ elm_object_text_set(pb, "Label");
+ evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, pb);
+ evas_object_show(pb);
+
+ label = elm_label_add(win);
+ elm_object_text_set(label, "ETA: N/A");
+ evas_object_size_hint_align_set(label, 0.5, 0.5);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, label);
+ evas_object_show(label);
+
+ evas_object_smart_callback_add(pb, "changed", _on_changed, label);
+ example_data.pb4 = pb;
+
hbx = elm_box_add(win);
elm_box_horizontal_set(hbx, EINA_TRUE);
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -182,7 +237,7 @@ elm_main(int argc,
elm_box_pack_end(hbx, pb);
elm_object_text_set(pb, "percent");
evas_object_show(pb);
- example_data.pb4 = pb;
+ example_data.pb5 = pb;
/* vertical pb, with pulse and custom (small) span size */
pb = elm_progressbar_add(win);
@@ -195,7 +250,7 @@ elm_main(int argc,
elm_object_text_set(pb, "Infinite bounce");
elm_box_pack_end(hbx, pb);
evas_object_show(pb);
- example_data.pb5 = pb;
+ example_data.pb6 = pb;
ic2 = elm_icon_add(win);
elm_image_file_set(ic2, buf, NULL);
@@ -214,7 +269,7 @@ elm_main(int argc,
elm_box_pack_end(hbx, pb);
evas_object_show(ic2);
evas_object_show(pb);
- example_data.pb6 = pb;
+ example_data.pb7 = pb;
/* "wheel" style progress bar */
pb = elm_progressbar_add(win);
@@ -224,7 +279,7 @@ elm_main(int argc,
evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, pb);
evas_object_show(pb);
- example_data.pb7 = pb;
+ example_data.pb8 = pb;
bt_bx = elm_box_add(win);
elm_box_horizontal_set(bt_bx, EINA_TRUE);
--
1.7.9.5
From b31efa4a8508d698d3f63661f49fc45ca1796b2d Mon Sep 17 00:00:00 2001
From: Daniel Willmann <d.willm...@samsung.com>
Date: Wed, 27 Jun 2012 17:22:26 +0100
Subject: [PATCH] elementary: Add @since to docs for progressbar "changed"
signal
Signed-off-by: Daniel Willmann <d.willm...@samsung.com>
---
trunk/elementary/src/lib/elm_progressbar.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/trunk/elementary/src/lib/elm_progressbar.h b/trunk/elementary/src/lib/elm_progressbar.h
index 75b7a1d..8a6e44e 100644
--- a/trunk/elementary/src/lib/elm_progressbar.h
+++ b/trunk/elementary/src/lib/elm_progressbar.h
@@ -35,7 +35,7 @@
*
* This widget emits the following signals, besides the ones sent from
* @ref Layout:
- * @li @c "changed" - when the value is changed
+ * @li @c "changed" - when the value is changed @since 1.1
*
* This widget has the following styles:
* - @c "default"
--
1.7.9.5
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel