forked from enlightenment/evisum
parent
551ee1810f
commit
a44500936b
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
|
@ -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'))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue