ui: Fonts and Sorting.

Fonts should be normal sized. If fonts aren't looking good, just
bump up the overall ELM scaling, it works much better!

Indicate which sort we are using in the process list.
This commit is contained in:
Alastair Poole 2020-06-30 11:28:20 +01:00
parent 045f1766b5
commit 4df3d73fe0
7 changed files with 62 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -595,8 +595,30 @@ _process_list(void *data, Ecore_Thread *thread)
} }
} }
static Evas_Object *_selected = NULL;
static void static void
_btn_icon_state_set(Evas_Object *button, Eina_Bool reverse) _btn_icon_state_update(Evas_Object *button, Eina_Bool reverse)
{
Evas_Object *icon = elm_icon_add(button);
if (_selected)
evas_object_color_set(_selected, 47, 153, 255, 255);
if (reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-down"));
else
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
_selected = icon;
evas_object_color_set(_selected, 192, 192, 192, 255);
elm_object_part_content_set(button, "icon", icon);
evas_object_show(icon);
}
static void
_btn_icon_state_init(Evas_Object *button, Eina_Bool reverse, Eina_Bool selected)
{ {
Evas_Object *icon = elm_icon_add(button); Evas_Object *icon = elm_icon_add(button);
@ -605,15 +627,22 @@ _btn_icon_state_set(Evas_Object *button, Eina_Bool reverse)
else else
elm_icon_standard_set(icon, evisum_icon_path_get("go-up")); elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_object_part_content_set(button, "icon", icon); if (!selected)
evas_object_color_set(icon, 47, 153, 255, 255);
else
{
_selected = icon;
evas_object_color_set(icon, 192, 192, 192, 255);
}
elm_object_part_content_set(button, "icon", icon);
evas_object_show(icon); evas_object_show(icon);
} }
static void static void
_btn_clicked_state_save(Ui *ui, Evas_Object *btn) _btn_clicked_state_save(Ui *ui, Evas_Object *btn)
{ {
_btn_icon_state_set(btn, ui->sort_reverse); _btn_icon_state_update(btn, ui->sort_reverse);
_config_save(ui); _config_save(ui);
_process_list_update(ui); _process_list_update(ui);
@ -957,8 +986,9 @@ _ui_content_system_add(Ui *ui)
evas_object_show(table); evas_object_show(table);
ui->btn_pid = button = elm_button_add(parent); ui->btn_pid = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_PID ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_PID ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_PID);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("PID")); elm_object_text_set(button, _("PID"));
@ -966,8 +996,9 @@ _ui_content_system_add(Ui *ui)
elm_table_pack(table, button, i++, 0, 1, 1); elm_table_pack(table, button, i++, 0, 1, 1);
ui->btn_uid = button = elm_button_add(parent); ui->btn_uid = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_UID ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_UID ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_UID);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("User")); elm_object_text_set(button, _("User"));
@ -975,8 +1006,9 @@ _ui_content_system_add(Ui *ui)
elm_table_pack(table, button, i++, 0, 1, 1); elm_table_pack(table, button, i++, 0, 1, 1);
ui->btn_size = button = elm_button_add(parent); ui->btn_size = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_SIZE ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_SIZE ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_SIZE);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("Size")); elm_object_text_set(button, _("Size"));
@ -984,8 +1016,9 @@ _ui_content_system_add(Ui *ui)
elm_table_pack(table, button, i++, 0, 1, 1); elm_table_pack(table, button, i++, 0, 1, 1);
ui->btn_rss = button = elm_button_add(parent); ui->btn_rss = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_RSS ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_RSS ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_RSS);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("Res")); elm_object_text_set(button, _("Res"));
@ -993,8 +1026,9 @@ _ui_content_system_add(Ui *ui)
elm_table_pack(table, button, i++, 0, 1, 1); elm_table_pack(table, button, i++, 0, 1, 1);
ui->btn_cmd = button = elm_button_add(parent); ui->btn_cmd = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_CMD ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_CMD ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_CMD);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("Command")); elm_object_text_set(button, _("Command"));
@ -1002,8 +1036,9 @@ _ui_content_system_add(Ui *ui)
elm_table_pack(table, button, i++, 0, 1, 1); elm_table_pack(table, button, i++, 0, 1, 1);
ui->btn_state = button = elm_button_add(parent); ui->btn_state = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_STATE ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_STATE ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_STATE);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("State")); elm_object_text_set(button, _("State"));
@ -1011,8 +1046,9 @@ _ui_content_system_add(Ui *ui)
elm_table_pack(table, button, i++, 0, 1, 1); elm_table_pack(table, button, i++, 0, 1, 1);
ui->btn_cpu_usage = button = elm_button_add(parent); ui->btn_cpu_usage = button = elm_button_add(parent);
_btn_icon_state_set(button, _btn_icon_state_init(button,
ui->sort_type == SORT_BY_CPU_USAGE ? ui->sort_reverse : EINA_FALSE); ui->sort_type == SORT_BY_CPU_USAGE ? ui->sort_reverse : EINA_FALSE,
ui->sort_type == SORT_BY_CPU_USAGE);
evas_object_size_hint_weight_set(button, EXPAND, EXPAND); evas_object_size_hint_weight_set(button, EXPAND, EXPAND);
evas_object_size_hint_align_set(button, FILL, FILL); evas_object_size_hint_align_set(button, FILL, FILL);
elm_object_text_set(button, _("CPU %")); elm_object_text_set(button, _("CPU %"));

View File

@ -63,7 +63,7 @@ _ui_disk_add(Ui *ui, File_System *inf)
evas_object_show(label); evas_object_show(label);
elm_box_pack_end(vbox, label); elm_box_pack_end(vbox, label);
elm_object_text_set(label, eina_slstr_printf("<big>%s</big>", elm_object_text_set(label, eina_slstr_printf("%s",
inf->mount)); inf->mount));
hbox = elm_box_add(parent); hbox = elm_box_add(parent);
@ -107,7 +107,7 @@ _ui_disk_add(Ui *ui, File_System *inf)
evas_object_show(label); evas_object_show(label);
elm_object_text_set(label, elm_object_text_set(label,
eina_slstr_printf("<big>%s <b>(%s)</b></big>", eina_slstr_printf("%s <b>(%s)</b>",
inf->path, type)); inf->path, type));
elm_box_pack_end(vbox, label); elm_box_pack_end(vbox, label);

View File

@ -15,7 +15,7 @@ _label_mem(Evas_Object *parent, const char *text)
Evas_Object *label = elm_label_add(parent); Evas_Object *label = elm_label_add(parent);
evas_object_size_hint_weight_set(label, 0, EXPAND); evas_object_size_hint_weight_set(label, 0, EXPAND);
evas_object_size_hint_align_set(label, FILL, FILL); evas_object_size_hint_align_set(label, FILL, FILL);
elm_object_text_set(label, eina_slstr_printf("<big>%s</big>",text)); elm_object_text_set(label, eina_slstr_printf("%s",text));
evas_object_show(label); evas_object_show(label);
return label; return label;

View File

@ -30,9 +30,9 @@ _battery_usage_add(Evas_Object *box, power_t *power)
elm_box_pack_end(vbox, label); elm_box_pack_end(vbox, label);
if (power->have_ac && i == 0) if (power->have_ac && i == 0)
fmt = _("<big>%s (plugged in) </big>"); fmt = _("%s (plugged in)");
else else
fmt = _("<big>%s</big>"); fmt = _("%s");
elm_object_text_set(label, eina_slstr_printf(fmt, elm_object_text_set(label, eina_slstr_printf(fmt,
power->batteries[i]->name)); power->batteries[i]->name));
@ -94,7 +94,7 @@ _sensor_usage_add(Evas_Object *box, sensor_t **sensors, int count)
evas_object_show(label); evas_object_show(label);
elm_box_pack_end(vbox, label); elm_box_pack_end(vbox, label);
elm_object_text_set(label, eina_slstr_printf("<big>%s</big>", elm_object_text_set(label, eina_slstr_printf("%s",
snsr->name)); snsr->name));
hbox = elm_box_add(box); hbox = elm_box_add(box);
@ -171,9 +171,9 @@ _network_usage_add(Ui *ui, Evas_Object *box, uint64_t bytes, Eina_Bool incoming)
label = elm_label_add(box); label = elm_label_add(box);
if (incoming) if (incoming)
elm_object_text_set(label, _("<big>Network Incoming</big>")); elm_object_text_set(label, _("Network Incoming"));
else else
elm_object_text_set(label, _("<big>Network Outgoing</big>")); elm_object_text_set(label, _("Network Outgoing"));
evas_object_size_hint_align_set(label, 1.0, FILL); evas_object_size_hint_align_set(label, 1.0, FILL);
evas_object_size_hint_weight_set(label, EXPAND, EXPAND); evas_object_size_hint_weight_set(label, EXPAND, EXPAND);

View File

@ -643,6 +643,7 @@ _btn_icon_state_set(Evas_Object *button, Eina_Bool reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-up")); elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_object_part_content_set(button, "icon", icon); elm_object_part_content_set(button, "icon", icon);
evas_object_color_set(icon, 47, 153, 255, 255);
evas_object_show(icon); evas_object_show(icon);
} }