This commit is contained in:
Willy-JL
2023-04-30 23:22:18 +01:00
parent da5bea9b7b
commit 91d09dc810
4 changed files with 52 additions and 55 deletions

View File

@@ -640,7 +640,8 @@ void elements_scrollable_text_line(
size_t scroll, size_t scroll,
bool ellipsis, bool ellipsis,
bool centered) { bool centered) {
elements_scrollable_text_line_str(canvas, x, y, width, furi_string_get_cstr(string), scroll, ellipsis, centered); elements_scrollable_text_line_str(
canvas, x, y, width, furi_string_get_cstr(string), scroll, ellipsis, centered);
} }
void elements_text_box( void elements_text_box(

View File

@@ -130,7 +130,8 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
} else { } else {
scroll_counter -= 1; scroll_counter -= 1;
} }
elements_scrollable_text_line_str(canvas, 22, 36, 98, item->label, scroll_counter, false, false); elements_scrollable_text_line_str(
canvas, 22, 36, 98, item->label, scroll_counter, false, false);
// Third line // Third line
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);
shift_position = (2 + position + items_count - 1) % items_count; shift_position = (2 + position + items_count - 1) % items_count;

View File

@@ -84,14 +84,7 @@ static void variable_item_list_draw_callback(Canvas* canvas, void* _model) {
canvas_draw_str(canvas, 6, item_text_y, item->label); canvas_draw_str(canvas, 6, item_text_y, item->label);
} else { } else {
elements_scrollable_text_line_str( elements_scrollable_text_line_str(
canvas, canvas, 6, item_text_y, 66, item->label, scroll_counter, false, false);
6,
item_text_y,
66,
item->label,
scroll_counter,
false,
false);
} }
if(item->locked) { if(item->locked) {

View File

@@ -47,56 +47,57 @@ void XTREME_SETTINGS_LOAD() {
return; return;
} }
XtremeSettings* x = xtreme_settings;
Storage* storage = furi_record_open(RECORD_STORAGE); Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage); FlipperFormat* file = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(file, XTREME_SETTINGS_PATH)) { if(flipper_format_file_open_existing(file, XTREME_SETTINGS_PATH)) {
FuriString* string = furi_string_alloc(); FuriString* string = furi_string_alloc();
if(flipper_format_read_string(file, "asset_pack", string)) { if(flipper_format_read_string(file, "asset_pack", string)) {
strlcpy(xtreme_settings->asset_pack, furi_string_get_cstr(string), MAX_PACK_NAME_LEN); strlcpy(x->asset_pack, furi_string_get_cstr(string), MAX_PACK_NAME_LEN);
} }
furi_string_free(string); furi_string_free(string);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_uint32(file, "anim_speed", &xtreme_settings->anim_speed, 1); flipper_format_read_uint32(file, "anim_speed", &x->anim_speed, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_int32(file, "cycle_anims", &xtreme_settings->cycle_anims, 1); flipper_format_read_int32(file, "cycle_anims", &x->cycle_anims, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "unlock_anims", &xtreme_settings->unlock_anims, 1); flipper_format_read_bool(file, "unlock_anims", &x->unlock_anims, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "fallback_anim", &xtreme_settings->fallback_anim, 1); flipper_format_read_bool(file, "fallback_anim", &x->fallback_anim, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "wii_menu", &xtreme_settings->wii_menu, 1); flipper_format_read_bool(file, "wii_menu", &x->wii_menu, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "bad_pins_format", &xtreme_settings->bad_pins_format, 1); flipper_format_read_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "lockscreen_time", &xtreme_settings->lockscreen_time, 1); flipper_format_read_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "lockscreen_seconds", &xtreme_settings->lockscreen_seconds, 1); flipper_format_read_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "lockscreen_date", &xtreme_settings->lockscreen_date, 1); flipper_format_read_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "lockscreen_statusbar", &xtreme_settings->lockscreen_statusbar, 1); flipper_format_read_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "lockscreen_prompt", &xtreme_settings->lockscreen_prompt, 1); flipper_format_read_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_uint32(file, "battery_icon", (uint32_t*)&xtreme_settings->battery_icon, 1); flipper_format_read_uint32(file, "battery_icon", (uint32_t*)&x->battery_icon, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "status_icons", &xtreme_settings->status_icons, 1); flipper_format_read_bool(file, "status_icons", &x->status_icons, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "bar_borders", &xtreme_settings->bar_borders, 1); flipper_format_read_bool(file, "bar_borders", &x->bar_borders, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "bar_background", &xtreme_settings->bar_background, 1); flipper_format_read_bool(file, "bar_background", &x->bar_background, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "sort_dirs_first", &xtreme_settings->sort_dirs_first, 1); flipper_format_read_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "dark_mode", &xtreme_settings->dark_mode, 1); flipper_format_read_bool(file, "dark_mode", &x->dark_mode, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "bad_bt", &xtreme_settings->bad_bt, 1); flipper_format_read_bool(file, "bad_bt", &x->bad_bt, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "bad_bt_remember", &xtreme_settings->bad_bt_remember, 1); flipper_format_read_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_int32(file, "butthurt_timer", &xtreme_settings->butthurt_timer, 1); flipper_format_read_int32(file, "butthurt_timer", &x->butthurt_timer, 1);
flipper_format_rewind(file); flipper_format_rewind(file);
flipper_format_read_bool(file, "rgb_backlight", &xtreme_settings->rgb_backlight, 1); flipper_format_read_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
} }
flipper_format_free(file); flipper_format_free(file);
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
@@ -112,31 +113,32 @@ void XTREME_SETTINGS_SAVE() {
return; return;
} }
XtremeSettings* x = xtreme_settings;
Storage* storage = furi_record_open(RECORD_STORAGE); Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage); FlipperFormat* file = flipper_format_file_alloc(storage);
if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) { if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) {
flipper_format_write_string_cstr(file, "asset_pack", xtreme_settings->asset_pack); flipper_format_write_string_cstr(file, "asset_pack", x->asset_pack);
flipper_format_write_uint32(file, "anim_speed", &xtreme_settings->anim_speed, 1); flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1);
flipper_format_write_int32(file, "cycle_anims", &xtreme_settings->cycle_anims, 1); flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1);
flipper_format_write_bool(file, "unlock_anims", &xtreme_settings->unlock_anims, 1); flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1);
flipper_format_write_bool(file, "fallback_anim", &xtreme_settings->fallback_anim, 1); flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1);
flipper_format_write_bool(file, "wii_menu", &xtreme_settings->wii_menu, 1); flipper_format_write_bool(file, "wii_menu", &x->wii_menu, 1);
flipper_format_write_bool(file, "bad_pins_format", &xtreme_settings->bad_pins_format, 1); flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
flipper_format_write_bool(file, "lockscreen_time", &xtreme_settings->lockscreen_time, 1); flipper_format_write_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
flipper_format_write_bool(file, "lockscreen_seconds", &xtreme_settings->lockscreen_seconds, 1); flipper_format_write_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
flipper_format_write_bool(file, "lockscreen_date", &xtreme_settings->lockscreen_date, 1); flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
flipper_format_write_bool(file, "lockscreen_statusbar", &xtreme_settings->lockscreen_statusbar, 1); flipper_format_write_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
flipper_format_write_bool(file, "lockscreen_prompt", &xtreme_settings->lockscreen_prompt, 1); flipper_format_write_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
flipper_format_write_uint32(file, "battery_icon", (uint32_t*)&xtreme_settings->battery_icon, 1); flipper_format_write_uint32(file, "battery_icon", (uint32_t*)&x->battery_icon, 1);
flipper_format_write_bool(file, "status_icons", &xtreme_settings->status_icons, 1); flipper_format_write_bool(file, "status_icons", &x->status_icons, 1);
flipper_format_write_bool(file, "bar_borders", &xtreme_settings->bar_borders, 1); flipper_format_write_bool(file, "bar_borders", &x->bar_borders, 1);
flipper_format_write_bool(file, "bar_background", &xtreme_settings->bar_background, 1); flipper_format_write_bool(file, "bar_background", &x->bar_background, 1);
flipper_format_write_bool(file, "sort_dirs_first", &xtreme_settings->sort_dirs_first, 1); flipper_format_write_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
flipper_format_write_bool(file, "dark_mode", &xtreme_settings->dark_mode, 1); flipper_format_write_bool(file, "dark_mode", &x->dark_mode, 1);
flipper_format_write_bool(file, "bad_bt", &xtreme_settings->bad_bt, 1); flipper_format_write_bool(file, "bad_bt", &x->bad_bt, 1);
flipper_format_write_bool(file, "bad_bt_remember", &xtreme_settings->bad_bt_remember, 1); flipper_format_write_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
flipper_format_write_int32(file, "butthurt_timer", &xtreme_settings->butthurt_timer, 1); flipper_format_write_int32(file, "butthurt_timer", &x->butthurt_timer, 1);
flipper_format_write_bool(file, "rgb_backlight", &xtreme_settings->rgb_backlight, 1); flipper_format_write_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
} }
flipper_format_free(file); flipper_format_free(file);
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);