forked from enlightenment/evisum
menu: improve hope
This commit is contained in:
parent
94e0500977
commit
8b7375e124
Binary file not shown.
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 733 KiB After Width: | Height: | Size: 598 KiB |
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -9,4 +9,5 @@ install_data('go-up.png', 'go-down.png',
|
||||||
'sky_01.jpg', 'sky_02.jpg', 'sky_03.jpg',
|
'sky_01.jpg', 'sky_02.jpg', 'sky_03.jpg',
|
||||||
'sky_04.jpg', 'effects.png',
|
'sky_04.jpg', 'effects.png',
|
||||||
'clo.png', 'bolt.png', 'menu.png',
|
'clo.png', 'bolt.png', 'menu.png',
|
||||||
|
'lovethisdogharvey.png',
|
||||||
install_dir: join_paths(dir_data, 'evisum/images'))
|
install_dir: join_paths(dir_data, 'evisum/images'))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
#define CONFIG_VERSION 0x0003
|
#define CONFIG_VERSION 0x0004
|
||||||
|
|
||||||
typedef struct _Evisum_Config
|
typedef struct _Evisum_Config
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ typedef struct _Evisum_Config
|
||||||
Eina_Bool sort_reverse;
|
Eina_Bool sort_reverse;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
int poll_delay;
|
||||||
Eina_Bool effects;
|
Eina_Bool effects;
|
||||||
} Evisum_Config;
|
} Evisum_Config;
|
||||||
|
|
||||||
|
|
173
src/bin/ui/ui.c
173
src/bin/ui/ui.c
|
@ -29,6 +29,7 @@ _config_save(Ui *ui)
|
||||||
_evisum_config->width = w;
|
_evisum_config->width = w;
|
||||||
_evisum_config->height = h;
|
_evisum_config->height = h;
|
||||||
_evisum_config->effects = evisum_ui_effects_enabled_get();
|
_evisum_config->effects = evisum_ui_effects_enabled_get();
|
||||||
|
_evisum_config->poll_delay = ui->poll_delay;
|
||||||
|
|
||||||
config_save(_evisum_config);
|
config_save(_evisum_config);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +41,7 @@ _config_load(Ui *ui)
|
||||||
|
|
||||||
ui->sort_type = _evisum_config->sort_type;
|
ui->sort_type = _evisum_config->sort_type;
|
||||||
ui->sort_reverse = _evisum_config->sort_reverse;
|
ui->sort_reverse = _evisum_config->sort_reverse;
|
||||||
|
ui->poll_delay = _evisum_config->poll_delay;
|
||||||
|
|
||||||
if ((_evisum_config->width > 0) && (_evisum_config->height > 0))
|
if ((_evisum_config->width > 0) && (_evisum_config->height > 0))
|
||||||
evas_object_resize(ui->win, _evisum_config->width, _evisum_config->height);
|
evas_object_resize(ui->win, _evisum_config->width, _evisum_config->height);
|
||||||
|
@ -1133,54 +1135,12 @@ _main_menu_dismissed_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
{
|
{
|
||||||
Ui *ui = data;
|
Ui *ui = data;
|
||||||
|
|
||||||
elm_menu_close(ui->main_menu);
|
elm_ctxpopup_dismiss(ui->main_menu);
|
||||||
evas_object_del(ui->main_menu);
|
evas_object_del(ui->main_menu);
|
||||||
|
|
||||||
ui->main_menu = NULL;
|
ui->main_menu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_main_menu_create(Ui *ui)
|
|
||||||
{
|
|
||||||
Evas_Object *menu;
|
|
||||||
Elm_Object_Item *menu_it;
|
|
||||||
|
|
||||||
menu = elm_menu_add(ui->win);
|
|
||||||
menu_it = elm_menu_item_add(menu, NULL, NULL, _("File"), NULL, NULL);
|
|
||||||
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("exit"), _("Quit"), _quit_cb, ui);
|
|
||||||
menu_it = elm_menu_item_add(menu, NULL, NULL, _("View"), NULL, NULL);
|
|
||||||
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("cpu"), _("CPU"),
|
|
||||||
_menu_cpu_activity_clicked_cb, ui);
|
|
||||||
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("memory"), _("Memory"),
|
|
||||||
_menu_memory_activity_clicked_cb, ui);
|
|
||||||
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("storage"), _("Storage"),
|
|
||||||
_menu_disk_activity_clicked_cb, ui);
|
|
||||||
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("misc"), _("Misc"),
|
|
||||||
_menu_misc_activity_clicked_cb, ui);
|
|
||||||
elm_menu_item_separator_add(menu, menu_it);
|
|
||||||
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("effects"), _("Effects"),
|
|
||||||
_menu_effects_clicked_cb, ui);
|
|
||||||
menu_it = elm_menu_item_add(menu, NULL, NULL, _("Help"), NULL, NULL);
|
|
||||||
elm_menu_item_add(menu, menu_it, "evisum", _("About"), _about_clicked_cb, ui);
|
|
||||||
evas_object_show(menu);
|
|
||||||
|
|
||||||
ui->main_menu = menu;
|
|
||||||
|
|
||||||
evas_object_smart_callback_add(menu, "dismissed", _main_menu_dismissed_cb, ui);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_btn_menu_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|
||||||
void *event_info EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Ui *ui = data;
|
|
||||||
|
|
||||||
if (!ui->main_menu)
|
|
||||||
_main_menu_create(ui);
|
|
||||||
else
|
|
||||||
_main_menu_dismissed_cb(ui, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_btn_create(Evas_Object *parent, const char *icon, const char *text, void *cb, void *data)
|
_btn_create(Evas_Object *parent, const char *icon, const char *text, void *cb, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1203,6 +1163,122 @@ _btn_create(Evas_Object *parent, const char *icon, const char *text, void *cb, v
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_main_menu_slider_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Ui *ui = data;
|
||||||
|
|
||||||
|
ui->poll_delay = elm_slider_value_get(obj) + 0.5;
|
||||||
|
|
||||||
|
_config_save(ui);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_main_menu_create(Ui *ui, Evas_Object *btn)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *bx, *hbox, *sep, *fr, *sli;
|
||||||
|
Evas_Coord ox, oy, ow, oh;
|
||||||
|
int r, g, b, a;
|
||||||
|
|
||||||
|
evas_object_geometry_get(btn, &ox, &oy, &ow, &oh);
|
||||||
|
o = elm_ctxpopup_add(ui->win);
|
||||||
|
evas_object_size_hint_weight_set(o, EXPAND, EXPAND);
|
||||||
|
evas_object_size_hint_align_set(o, FILL, FILL);
|
||||||
|
elm_object_style_set(o, "noblock");
|
||||||
|
evas_object_color_get(o, &r, &g, &b, &a);
|
||||||
|
evas_object_color_set(o, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
|
||||||
|
|
||||||
|
bx = elm_box_add(o);
|
||||||
|
evas_object_size_hint_weight_set(bx, EXPAND, EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bx, FILL, FILL);
|
||||||
|
evas_object_show(bx);
|
||||||
|
|
||||||
|
fr = elm_frame_add(o);
|
||||||
|
elm_object_text_set(fr, _("Options"));
|
||||||
|
evas_object_size_hint_weight_set(fr, EXPAND, EXPAND);
|
||||||
|
evas_object_size_hint_align_set(fr, FILL, FILL);
|
||||||
|
evas_object_show(fr);
|
||||||
|
|
||||||
|
hbox = elm_box_add(o);
|
||||||
|
elm_box_horizontal_set(hbox, 1);
|
||||||
|
evas_object_size_hint_align_set(hbox, FILL, FILL);
|
||||||
|
evas_object_size_hint_weight_set(hbox, EXPAND, EXPAND);
|
||||||
|
evas_object_show(hbox);
|
||||||
|
|
||||||
|
btn = _btn_create(hbox, "cpu", _("CPU"), _menu_cpu_activity_clicked_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
|
btn = _btn_create(hbox, "memory", _("Memory"), _menu_memory_activity_clicked_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
|
btn = _btn_create(hbox, "storage", _("Storage"), _menu_disk_activity_clicked_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
|
btn = _btn_create(hbox, "misc", _("Misc"), _menu_misc_activity_clicked_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
|
sep = elm_separator_add(hbox);
|
||||||
|
evas_object_size_hint_align_set(sep, FILL, FILL);
|
||||||
|
evas_object_size_hint_weight_set(sep, EXPAND, EXPAND);
|
||||||
|
elm_separator_horizontal_set(sep, 0);
|
||||||
|
evas_object_show(sep);
|
||||||
|
elm_box_pack_end(hbox, sep);
|
||||||
|
|
||||||
|
btn = _btn_create(hbox, "effects", _("Effects"), _menu_effects_clicked_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
|
sep = elm_separator_add(hbox);
|
||||||
|
evas_object_size_hint_align_set(sep, FILL, FILL);
|
||||||
|
evas_object_size_hint_weight_set(sep, EXPAND, EXPAND);
|
||||||
|
elm_separator_horizontal_set(sep, 0);
|
||||||
|
evas_object_show(sep);
|
||||||
|
elm_box_pack_end(hbox, sep);
|
||||||
|
|
||||||
|
btn = _btn_create(hbox, "evisum", _("About"), _about_clicked_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
btn = _btn_create(hbox, "exit", _("Quit"), _quit_cb, ui);
|
||||||
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
|
sli = elm_slider_add(o);
|
||||||
|
evas_object_size_hint_weight_set(sli, EXPAND, EXPAND);
|
||||||
|
elm_slider_min_max_set(sli, 1.0, 10.0);
|
||||||
|
elm_slider_span_size_set(sli, 10.0);
|
||||||
|
elm_slider_step_set(sli, 1 / 10.0);
|
||||||
|
elm_slider_indicator_format_set(sli, "%1.0f");
|
||||||
|
elm_slider_unit_format_set(sli, _("%1.0f secs"));
|
||||||
|
elm_slider_value_set(sli, ui->poll_delay);
|
||||||
|
evas_object_size_hint_align_set(sli, FILL, FILL);
|
||||||
|
elm_object_tooltip_text_set(sli, _("Poll delay (seconds)"));
|
||||||
|
evas_object_smart_callback_add(sli, "slider,drag,stop", _main_menu_slider_changed_cb, ui);
|
||||||
|
evas_object_smart_callback_add(sli, "delay,changed", _main_menu_slider_changed_cb, ui);
|
||||||
|
evas_object_show(sli);
|
||||||
|
|
||||||
|
elm_box_pack_end(bx, hbox);
|
||||||
|
elm_box_pack_end(bx, sli);
|
||||||
|
|
||||||
|
evas_object_size_hint_min_set(fr, 100, 100);
|
||||||
|
elm_object_content_set(fr, bx);
|
||||||
|
elm_object_content_set(o, fr);
|
||||||
|
|
||||||
|
elm_ctxpopup_direction_priority_set(o, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_DOWN,
|
||||||
|
ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
|
||||||
|
evas_object_move(o, ox + (ow / 2), oy);
|
||||||
|
evas_object_show(o);
|
||||||
|
ui->main_menu = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_btn_menu_clicked_cb(void *data, Evas_Object *obj,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Ui *ui = data;
|
||||||
|
|
||||||
|
if (!ui->main_menu)
|
||||||
|
_main_menu_create(ui, obj);
|
||||||
|
else
|
||||||
|
_main_menu_dismissed_cb(ui, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ui_content_system_add(Ui *ui)
|
_ui_content_system_add(Ui *ui)
|
||||||
{
|
{
|
||||||
|
@ -1374,7 +1450,7 @@ _ui_content_system_add(Ui *ui)
|
||||||
evas_object_show(hbox);
|
evas_object_show(hbox);
|
||||||
elm_box_pack_end(box2, hbox);
|
elm_box_pack_end(box2, hbox);
|
||||||
|
|
||||||
btn = _btn_create(hbox, "menu", _("Menu"), _btn_menu_clicked_cb, ui);
|
btn = _btn_create(hbox, "menu", NULL, _btn_menu_clicked_cb, ui);
|
||||||
elm_box_pack_end(hbox, btn);
|
elm_box_pack_end(hbox, btn);
|
||||||
|
|
||||||
ui->entry_search = entry = elm_entry_add(parent);
|
ui->entry_search = entry = elm_entry_add(parent);
|
||||||
|
@ -1510,6 +1586,9 @@ _evisum_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
eina_lock_release(&_lock);
|
eina_lock_release(&_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui->main_menu)
|
||||||
|
_main_menu_dismissed_cb(ui, NULL, NULL);
|
||||||
|
|
||||||
_config_save(ui);
|
_config_save(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,7 +1668,7 @@ _system_info_all_poll(void *data, Ecore_Thread *thread)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ecore_thread_feedback(thread, info);
|
ecore_thread_feedback(thread, info);
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4 * ui->poll_delay; i++)
|
||||||
{
|
{
|
||||||
if (ecore_thread_check(thread)) return;
|
if (ecore_thread_check(thread)) return;
|
||||||
|
|
||||||
|
@ -1695,12 +1774,8 @@ _ui_init(Evas_Object *parent)
|
||||||
|
|
||||||
_config_load(ui);
|
_config_load(ui);
|
||||||
|
|
||||||
// **** it!!! full steam ahead
|
|
||||||
if (evisum_ui_effects_enabled_get())
|
if (evisum_ui_effects_enabled_get())
|
||||||
{
|
|
||||||
evisum_ui_background_random_add(ui->win, 1);
|
evisum_ui_background_random_add(ui->win, 1);
|
||||||
ui->poll_delay = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ui_content_add(parent, ui);
|
_ui_content_add(parent, ui);
|
||||||
|
|
||||||
|
|
|
@ -229,8 +229,10 @@ evisum_child_window_show(Evas_Object *parent, Evas_Object *win)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Ui *ui;
|
Ui *ui;
|
||||||
Evas_Object *label;
|
Evas_Object *label;
|
||||||
|
Evas_Object *win;
|
||||||
Evas_Object *version;
|
Evas_Object *version;
|
||||||
Evas_Object *bg;
|
Evas_Object *bg;
|
||||||
|
Evas_Object *im;
|
||||||
Ecore_Animator *animator;
|
Ecore_Animator *animator;
|
||||||
int pos;
|
int pos;
|
||||||
} Animate_Data;
|
} Animate_Data;
|
||||||
|
@ -278,7 +280,9 @@ evisum_about_window_show(void *data)
|
||||||
{
|
{
|
||||||
Ui *ui;
|
Ui *ui;
|
||||||
Animate_Data *about;
|
Animate_Data *about;
|
||||||
Evas_Object *win, *bg, *box, *version, *label, *btn;
|
Evas_Object *win, *bg, *box, *version, *label, *btn, *im;
|
||||||
|
Evas_Coord x, y, w, h;
|
||||||
|
Evas_Coord iw, ih;
|
||||||
const char *copyright =
|
const char *copyright =
|
||||||
"<font color=#ffffff>"
|
"<font color=#ffffff>"
|
||||||
"<small>"
|
"<small>"
|
||||||
|
@ -306,7 +310,7 @@ evisum_about_window_show(void *data)
|
||||||
|
|
||||||
if (ui->win_about) return;
|
if (ui->win_about) return;
|
||||||
|
|
||||||
ui->win_about = win = elm_win_add(ui->win, "evisum", ELM_WIN_DIALOG_BASIC);
|
ui->win_about = win = elm_win_add(ui->win, "evisum", ELM_WIN_BASIC);
|
||||||
elm_win_title_set(win, "About Evisum");
|
elm_win_title_set(win, "About Evisum");
|
||||||
|
|
||||||
bg = elm_bg_add(win);
|
bg = elm_bg_add(win);
|
||||||
|
@ -334,18 +338,31 @@ evisum_about_window_show(void *data)
|
||||||
eina_slstr_printf("<font color=#ffffff><b>%s</b>",
|
eina_slstr_printf("<font color=#ffffff><b>%s</b>",
|
||||||
PACKAGE_VERSION));
|
PACKAGE_VERSION));
|
||||||
|
|
||||||
|
evas_object_geometry_get(win, &x, &y, &w, &h);
|
||||||
|
|
||||||
|
im = evas_object_image_filled_add(evas_object_evas_get(bg));
|
||||||
|
evas_object_image_file_set(im, evisum_icon_path_get("lovethisdogharvey"), NULL);
|
||||||
|
evas_object_image_size_get(im, &iw, &ih);
|
||||||
|
evas_object_size_hint_min_set(im, iw, ih);
|
||||||
|
evas_object_resize(im, iw, ih);
|
||||||
|
evas_object_pass_events_set(im, 1);
|
||||||
|
evas_object_move(im, x + (iw), y + (ih / 2));
|
||||||
|
evas_object_show(im);
|
||||||
|
|
||||||
about = malloc(sizeof(Animate_Data));
|
about = malloc(sizeof(Animate_Data));
|
||||||
|
about->win = win;
|
||||||
about->bg = bg;
|
about->bg = bg;
|
||||||
about->label = label;
|
about->label = label;
|
||||||
about->version = version;
|
about->version = version;
|
||||||
about->pos = elm_config_scale_get() * 320;
|
about->pos = elm_config_scale_get() * 320;
|
||||||
about->ui = ui;
|
about->ui = ui;
|
||||||
|
about->im = im;
|
||||||
about->animator = ecore_animator_add(about_anim, about);
|
about->animator = ecore_animator_add(about_anim, about);
|
||||||
|
|
||||||
btn = elm_button_add(win);
|
btn = elm_button_add(win);
|
||||||
evas_object_size_hint_align_set(btn, 0.5, 0.9);
|
evas_object_size_hint_align_set(btn, 0.5, 0.9);
|
||||||
evas_object_size_hint_weight_set(btn, EXPAND, EXPAND);
|
evas_object_size_hint_weight_set(btn, EXPAND, EXPAND);
|
||||||
elm_object_text_set(btn, _("Okay!"));
|
elm_object_text_set(btn, _("Close"));
|
||||||
evas_object_show(btn);
|
evas_object_show(btn);
|
||||||
|
|
||||||
evas_object_smart_callback_add(btn, "clicked", _win_del_cb, about);
|
evas_object_smart_callback_add(btn, "clicked", _win_del_cb, about);
|
||||||
|
|
Loading…
Reference in New Issue