netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=a44500936b62bab519e21e30cc264cfbfff8a516

commit a44500936b62bab519e21e30cc264cfbfff8a516
Author: Alastair Poole <nets...@gmail.com>
Date:   Tue Sep 1 17:03:20 2020 +0100

    fun...
    
    Still needs work but...
---
 data/images/bolt.png         | Bin 0 -> 1061755 bytes
 data/images/clo.png          | Bin 0 -> 121369 bytes
 data/images/meson.build      |   1 +
 src/bin/ui/ui.c              |  52 ++++++++++++++++++---
 src/bin/ui/ui.h              |   5 +++
 src/bin/ui/ui_process_view.c |   2 +-
 src/bin/ui/ui_util.c         | 105 +++++++++++++++++++++++++++++++++++++++++++
 src/bin/ui/ui_util.h         |   3 ++
 8 files changed, 162 insertions(+), 6 deletions(-)

diff --git a/data/images/bolt.png b/data/images/bolt.png
new file mode 100644
index 0000000..a6d82c8
Binary files /dev/null and b/data/images/bolt.png differ
diff --git a/data/images/clo.png b/data/images/clo.png
new file mode 100644
index 0000000..4027581
Binary files /dev/null and b/data/images/clo.png differ
diff --git a/data/images/meson.build b/data/images/meson.build
index 8704f45..2240ad5 100644
--- a/data/images/meson.build
+++ b/data/images/meson.build
@@ -8,4 +8,5 @@ install_data('go-up.png', 'go-down.png',
              'memory.png', 'storage.png', 'misc.png',
              'sky_01.jpg', 'sky_02.jpg', 'sky_03.jpg',
              'sky_04.jpg', 'sky_05.jpg', 'effects.png',
+             'clo.png', 'bolt.png',
              install_dir: join_paths(dir_data, 'evisum/images'))
diff --git a/src/bin/ui/ui.c b/src/bin/ui/ui.c
index bbb7f43..d504351 100644
--- a/src/bin/ui/ui.c
+++ b/src/bin/ui/ui.c
@@ -1053,6 +1053,7 @@ _ui_content_system_add(Ui *ui)
 {
    Evas_Object *parent, *box, *box2, *hbox, *frame, *table;
    Evas_Object *entry, *pb, *button, *plist;
+   int r, g, b, a;
    int i = 0;
 
    parent = ui->content;
@@ -1077,6 +1078,12 @@ _ui_content_system_add(Ui *ui)
    evas_object_show(frame);
    elm_box_pack_end(hbox, frame);
 
+   if (evisum_ui_effects_enabled_get())
+     {
+        evas_object_color_get(ui->content, &r, &g, &b, &a);
+        evas_object_color_set(ui->content, r * 0.85, g * 0.85, b * 0.85, a * 
0.85);
+     }
+
    ui->progress_cpu = pb = elm_progressbar_add(parent);
    evas_object_size_hint_align_set(pb, FILL, FILL);
    evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
@@ -1093,6 +1100,12 @@ _ui_content_system_add(Ui *ui)
    evas_object_show(frame);
    elm_box_pack_end(hbox, frame);
 
+   if (evisum_ui_effects_enabled_get())
+     {
+        evas_object_color_get(frame, &r, &g, &b, &a);
+        evas_object_color_set(frame, r * 0.85, g * 0.85, b * 0.85, a * 0.85);
+     }
+
    ui->progress_mem = pb = elm_progressbar_add(parent);
    evas_object_size_hint_align_set(pb, FILL, FILL);
    evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
@@ -1192,6 +1205,12 @@ _ui_content_system_add(Ui *ui)
    elm_object_text_set(frame, "Processes");
    evas_object_show(frame);
 
+   if (evisum_ui_effects_enabled_get())
+     {
+        evas_object_color_get(frame, &r, &g, &b, &a);
+        evas_object_color_set(frame, r * 0.85, g * 0.85, b * 0.85, a * 0.85);
+     }
+
    box2 = elm_box_add(parent);
    evas_object_size_hint_weight_set(box2, EXPAND, EXPAND);
    evas_object_size_hint_align_set(box2, FILL, FILL);
@@ -1388,14 +1407,31 @@ _evisum_key_down_cb(void *data, Evas *e, Evas_Object 
*obj, void *event_info)
    _config_save(ui);
 }
 
+static Eina_Bool
+_evisum_resize_timer_cb(void *data)
+{
+   Ui *ui = data;
+
+   ecore_timer_del(ui->timer_resize);
+   ui->timer_resize = NULL;
+
+   ui->ready = EINA_TRUE;
+   _process_list_update(ui);
+
+   return ECORE_CALLBACK_CANCEL;
+}
+
 static void
 _evisum_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
    Ui *ui = data;
 
+   ui->ready = EINA_FALSE;
    elm_genlist_clear(ui->genlist_procs);
-
-   _process_list_update(ui);
+   if (ui->timer_resize)
+     ecore_timer_reset(ui->timer_resize);
+   else
+     ui->timer_resize = ecore_timer_add(0.2, _evisum_resize_timer_cb, ui);
 
    _config_save(ui);
 }
@@ -1404,9 +1440,7 @@ void
 evisum_ui_shutdown(Ui *ui)
 {
    if (ui->shutdown_now)
-     {
-        exit(0);
-     }
+     exit(0);
 
    if (ui->win_cpu)
      evas_object_smart_callback_call(ui->win_cpu, "delete,request", NULL);
@@ -1517,6 +1551,8 @@ _system_info_all_poll_feedback_cb(void *data, 
Ecore_Thread *thread, void *msg)
 
    elm_progressbar_value_set(ui->progress_cpu, cpu_usage / 100);
 
+   ui->cpu_usage = cpu_usage;
+
    if (ui->zfs_mounted)
      info->memory.used += info->memory.zfs_arc_used;
 
@@ -1606,10 +1642,16 @@ _ui_init(Evas_Object *parent)
 
    _config_load(ui);
 
+   if (evisum_ui_effects_enabled_get())
+     evisum_ui_background_add(ui->win, evisum_ui_effects_enabled_get());
+
    _ui_content_add(parent, ui);
 
    _menu_setup(ui);
 
+   if (evisum_ui_effects_enabled_get())
+     evisum_ui_animate(ui);
+
    ui->cache = evisum_ui_item_cache_new(ui->genlist_procs, _item_create, 50);
 
    return ui;
diff --git a/src/bin/ui/ui.h b/src/bin/ui/ui.h
index 00f248f..973b397 100644
--- a/src/bin/ui/ui.h
+++ b/src/bin/ui/ui.h
@@ -33,6 +33,7 @@ typedef enum
 typedef struct Ui
 {
    Evas_Object     *win;
+   Evas_Object     *bg;
    Evas_Object     *menu;
    Evas_Object     *scroller;
    Evas_Object     *content;
@@ -90,12 +91,16 @@ typedef struct Ui
    Eina_Bool       show_self;
    Eina_Bool       shutdown_now;
    Eina_Bool       restart;
+   Ecore_Timer    *timer_resize;
 
+   Ecore_Animator *animator;
    Eina_Bool       zfs_mounted;
 
    uint64_t        incoming_max;
    uint64_t        outgoing_max;
    network_t       network_usage;
+
+   uint8_t         cpu_usage;
 } Ui;
 
 Ui *
diff --git a/src/bin/ui/ui_process_view.c b/src/bin/ui/ui_process_view.c
index ad9bc8e..97af705 100644
--- a/src/bin/ui/ui_process_view.c
+++ b/src/bin/ui/ui_process_view.c
@@ -511,7 +511,7 @@ _process_tab_add(Evas_Object *parent, Ui_Process *ui)
    Evas_Object *frame, *hbox, *table;
    Evas_Object *label, *entry, *button, *border;
    int i = 0;
-   int r, g, b , a;
+   int r, g, b, a;
 
    frame = elm_frame_add(parent);
    elm_object_text_set(frame, _("General"));
diff --git a/src/bin/ui/ui_util.c b/src/bin/ui/ui_util.c
index 818f169..5f85ff4 100644
--- a/src/bin/ui/ui_util.c
+++ b/src/bin/ui/ui_util.c
@@ -428,3 +428,108 @@ evisum_ui_effects_enabled_set(Eina_Bool enabled)
 {
    _effects_enabled = enabled;
 }
+
+typedef struct
+{
+   Ui *ui;
+
+   int pos;
+   Evas_Object *im;
+   Evas_Object *bolt;
+} Animation;
+
+static Eina_Bool
+_anim_clouds(void *data)
+{
+   Ui *ui;
+   Animation *anim;
+   Evas_Coord ww, wh, h, iw, ih;
+   time_t t;
+   int cpu;
+   static int bcount = 0;
+
+   anim = data;
+   ui = anim->ui;
+
+   evas_object_geometry_get(ui->win, NULL, NULL, &ww, &wh);
+   evas_object_image_size_get(anim->im, &iw, &ih);
+
+   if (ww > iw) iw = ww;
+
+   evas_object_resize(anim->im, iw, wh);
+   evas_object_image_fill_set(anim->im, anim->pos, 0, iw, wh);
+
+   cpu = (ui->cpu_usage / 10) > 0 ? ui->cpu_usage / 10  :  1;
+   anim->pos += cpu;
+
+   if (cpu >= 6 && !bcount)
+     {
+        if (cpu == 6 && (!(anim->pos % 2048))) bcount++;
+        else if (cpu == 7 && !(anim->pos % 1024)) bcount++;
+        else if (cpu == 8 && !(anim->pos % 512)) bcount++;
+        else if (cpu == 9 && !(anim->pos % 256)) bcount++;
+        else if (cpu == 10 && !(anim->pos % 128)) bcount++;
+     }
+
+   if (bcount)
+     {
+        ++bcount;
+        t = time(NULL);
+        srand(t);
+        evas_object_move(anim->bolt, rand() % ww, -(rand() % (wh / 2)));
+       if (!(t % 4)) evas_object_color_set(anim->bolt, 164, 192, 228, 255);
+       else if (!(t % 2)) evas_object_color_set(anim->bolt, 255, 255, 255, 
255);
+       else evas_object_color_set(anim->bolt, 255, 255, 158, 255);
+        evas_object_show(anim->bolt);
+     }
+
+   if (bcount % 2) evas_object_hide(anim->bolt);
+
+   if (bcount > 30)
+     {
+        evas_object_hide(anim->bolt);
+       bcount = 0;
+     }
+
+   if (anim->pos >= iw)
+     anim->pos = -iw;
+
+   return ECORE_CALLBACK_RENEW;
+}
+
+void
+evisum_ui_animate(void *data)
+{
+   Animation *anim;
+   Ui *ui;
+   Evas_Object *im;
+   Evas_Coord iw, ih, ww, wh;
+
+   ui = data;
+
+   evas_object_geometry_get(ui->win, NULL, NULL, &ww, &wh);
+
+   anim = calloc(1, sizeof(Animation));
+   anim->ui = ui;
+
+   anim->bolt = im = 
evas_object_image_filled_add(evas_object_evas_get(ui->win));
+   evas_object_pass_events_set(im, 1);
+   evas_object_image_file_set(im, evisum_icon_path_get("bolt"), NULL);
+   evas_object_image_size_get(im, &iw, &ih);
+   iw /=2; ih /=2;
+   evas_object_size_hint_min_set(im, iw, ih);
+   evas_object_resize(im, iw, ih);
+
+   anim->im = im = evas_object_image_add(evas_object_evas_get(ui->win));
+   evas_object_image_file_set(im, evisum_icon_path_get("clo"), NULL);
+   evas_object_image_size_get(im, &iw, &ih);
+   evas_object_image_fill_set(im, ww / 2, 0, iw, wh);
+   evas_object_resize(im, iw, wh);
+   evas_object_move(im, 0, 0);
+   evas_object_color_set(im, 192, 192, 192, 128);
+   evas_object_pass_events_set(im, 1);
+   evas_object_show(im);
+
+   ui->animator = ecore_animator_add(_anim_clouds, anim);
+}
+
diff --git a/src/bin/ui/ui_util.h b/src/bin/ui/ui_util.h
index af6cd50..ef8bf74 100644
--- a/src/bin/ui/ui_util.h
+++ b/src/bin/ui/ui_util.h
@@ -47,6 +47,9 @@ evisum_ui_effects_enabled_set(Eina_Bool enabled);
 Eina_Bool
 evisum_ui_effects_enabled_get(void);
 
+void
+evisum_ui_animate(void *data);
+
 int
 evisum_ui_textblock_font_size_get(Evas_Object *tb);
 

-- 


Reply via email to