lvgl / lv_apps

Ready to use UIs and high level components for applications
MIT License
11 stars 12 forks source link

Need redefinition for version 7.x.x. #9

Closed HamidSaffari closed 4 years ago

HamidSaffari commented 4 years ago

Hi man. Since many things changed from version 6 to 7, we have got many errors:

lib\lv_apps\src\lv_settings\lv_settings.c: In function 'lv_settings_create': lib\lv_apps\src\lv_settings\lv_settings.c:114:41: error: 'lv_theme_t' {aka 'struct '} has no member named 'style' 114 | lv_style_copy(&style_menu_bg, th->style.cont); | ^~ lib\lv_apps\src\lv_settings\lv_settings.c:115:43: error: 'lv_theme_t' {aka 'struct '} has no member named 'style' 115 | lv_style_copy(&style_item_cont, th->style.list.btn.rel); | ^~ lib\lv_apps\src\lv_settings\lv_settings.c:117:40: error: 'lv_style_pretty' undeclared (first use in this function); did you mean 'lv_style_reset'? 117 | lv_style_copy(&style_menu_bg, &lv_style_pretty); | ^~~~~~~ | lv_style_reset lib\lv_apps\src\lv_settings\lv_settings.c:117:40: note: each undeclared identifier is reported only once for each function it appears in lib\lv_apps\src\lv_settings\lv_settings.c:118:42: error: 'lv_style_transp' undeclared (first use in this function); did you mean 'lv_style_reset'? 118 | lv_style_copy(&style_item_cont, &lv_style_transp); | ^~~~~~~ | lv_style_reset lib\lv_apps\src\lv_settings\lv_settings.c:121:31: error: 'lv_style_transp_tight' undeclared (first use in this function) 121 | lv_style_copy(&style_bg, &lv_style_transp_tight); | ^~~~~ lib\lv_apps\src\lv_settings\lv_settings.c:122:18: error: 'lv_style_t' {aka 'struct '} has no member named 'body' 122 | style_menu_bg.body.radius = 0; | ^ lib\lv_apps\src\lv_settings\lv_settings.c:124:20: error: 'lv_style_t' {aka 'struct '} has no member named 'body' 124 | style_item_cont.body.padding.left = LV_DPI / 5; | ^ lib\lv_apps\src\lv_settings\lv_settings.c:125:20: error: 'lv_style_t' {aka 'struct '} has no member named 'body' 125 | style_item_cont.body.padding.right = LV_DPI / 5; | ^ lib\lv_apps\src\lv_settings\lv_settings.c:126:20: error: 'lv_style_t' {aka 'struct '} has no member named 'body' 126 | style_item_cont.body.padding.top = LV_DPI / 10; | ^ lib\lv_apps\src\lv_settings\lv_settings.c:127:20: error: 'lv_style_t' {aka 'struct '} has no member named 'body' 127 | style_item_cont.body.padding.bottom = LV_DPI / 10; | ^ lib\lv_apps\src\lv_settings\lv_settings.c:128:20: error: 'lv_style_t' {aka 'struct '} has no member named 'body' 128 | style_item_cont.body.padding.inner = LV_DPI / 20; C ompiling .pio\build\genericSTM32F103ZE\lib226\Wire\Wire.cpp.o | ^ lib\lv_apps\src\lv_settings\lv_settings.c: In function 'create_page': lib\lv_apps\src\lv_settings\lv_settings.c:244:33: error: 'LV_CONT_STYLE_MAIN' undeclared (first use in this function); did you mean 'LV_CONT_PART_MAIN'? 244 | lv_cont_set_style(act_cont, LV_CONT_STYLE_MAIN, &style_menu_bg); | ^~~~~~ | LV_CONT_PART_MAIN lib\lv_apps\src\lv_settings\lv_settings.c:252:52: error: 'lv_style_transp_fit' undeclared (first use in this function); did you mean 'lv_style_reset'? 252 | lv_cont_set_style(header, LV_CONT_STYLE_MAIN, &lv_style_transp_fit); | ^~~~~~~ | lv_style_reset

. . . . . .

kisvegabor commented 4 years ago

Hi,

I was planning to archive this repo because most of the content was reimplemented in lv_examples.

Although lv_settings were not reimplemented. It's because I wasn't happy with its way of working. I found it not user friendly enough so haven't spent time with it. Hopefully, some new mechanisms of LVGL will make it easier to handle these kinds of things in the future.

HamidSaffari commented 4 years ago

image

But Gabor it's so fantasy. Which one of lv_examples is the same as lv_ex_settings?!

lv_ex_settings_2

Beside, many things have changed since the version updated to 7, is there any helper or document which tell us how we modifying our V.6 code to V.7?

kisvegabor commented 4 years ago

I've updated only the settings app to v7 in v7-test branch. Visually it's a little bit different due to the new themes but functionally it works here.

HamidSaffari commented 4 years ago

Thanks Man. I tested and It works fine. Why don't you put this "lv_settings" lib to the lv_examples repository?

kisvegabor commented 4 years ago

I'm not happy with the current concept of creating pages and elements. I find it too complicated and cumbersome.

I'm sure that there are better ways to achieve this but I'm working on other features now.

HamidSaffari commented 4 years ago

Hi, Gaber How can I give all objects in the settings the same defined style. for example this style:


    static lv_style_t style_btn;
    /*Create a simple button style*/
    lv_style_init(&style_btn);
    //lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10);
    lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
    lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
    lv_style_set_bg_grad_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
    lv_style_set_bg_grad_dir(&style_btn, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
    /*Swap the colors in pressed state*/
    lv_style_set_bg_color(&style_btn, LV_STATE_PRESSED, LV_COLOR_ORANGE);
    lv_style_set_bg_grad_color(&style_btn, LV_STATE_PRESSED, LV_COLOR_YELLOW);
    /*Add a border*/
    lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_BLACK);
    lv_style_set_border_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_70);
    lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 4);
    /*Different border color in focused state*/
    lv_style_set_border_color(&style_btn, LV_STATE_FOCUSED | LV_STATE_PRESSED, LV_COLOR_YELLOW);
    /*Set the text style*/
    lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_BLACK);
    /*Make the button smaller when pressed*/
    lv_style_set_transform_height(&style_btn, LV_STATE_PRESSED, -2);
    lv_style_set_transform_width(&style_btn, LV_STATE_PRESSED, -5);

    lv_obj_add_style(setting_btn, LV_BTN_PART_MAIN, &style_btn); 

to all objects.
kisvegabor commented 4 years ago

The easiest way to add it to lv_settings.c direcly. E.g. here: https://github.com/lvgl/lv_apps/blob/master/src/lv_settings/lv_settings.c#L367