mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
Format
This commit is contained in:
@@ -115,7 +115,13 @@ bool xtreme_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
|
||||
DialogMessage* msg = dialog_message_alloc();
|
||||
dialog_message_set_header(msg, "RGB Backlight", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(msg, "No", NULL, "Yes");
|
||||
dialog_message_set_text(msg, "This option requires installing\na hardware modification!\nIs it installed?", 64, 32, AlignCenter, AlignCenter);
|
||||
dialog_message_set_text(
|
||||
msg,
|
||||
"This option requires installing\na hardware modification!\nIs it installed?",
|
||||
64,
|
||||
32,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
if(dialog_message_show(app->dialogs, msg) == DialogMessageButtonRight) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,11 @@ bool bt_settings_load(BtSettings* bt_settings) {
|
||||
storage_common_remove(storage, BT_SETTINGS_OLD_PATH);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
ret = saved_struct_load(
|
||||
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
|
||||
BT_SETTINGS_PATH,
|
||||
bt_settings,
|
||||
sizeof(BtSettings),
|
||||
BT_SETTINGS_MAGIC,
|
||||
BT_SETTINGS_VERSION);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
|
||||
bool DESKTOP_SETTINGS_SAVE(DesktopSettings* x) {
|
||||
return saved_struct_save(
|
||||
DESKTOP_SETTINGS_PATH, x, sizeof(DesktopSettings), DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER);
|
||||
DESKTOP_SETTINGS_PATH,
|
||||
x,
|
||||
sizeof(DesktopSettings),
|
||||
DESKTOP_SETTINGS_MAGIC,
|
||||
DESKTOP_SETTINGS_VER);
|
||||
}
|
||||
|
||||
bool DESKTOP_SETTINGS_LOAD(DesktopSettings* x) {
|
||||
bool ret = saved_struct_load(
|
||||
DESKTOP_SETTINGS_PATH, x, sizeof(DesktopSettings), DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER);
|
||||
DESKTOP_SETTINGS_PATH,
|
||||
x,
|
||||
sizeof(DesktopSettings),
|
||||
DESKTOP_SETTINGS_MAGIC,
|
||||
DESKTOP_SETTINGS_VER);
|
||||
|
||||
if(!ret) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
@@ -15,7 +23,11 @@ bool DESKTOP_SETTINGS_LOAD(DesktopSettings* x) {
|
||||
storage_common_remove(storage, DESKTOP_SETTINGS_OLD_PATH);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
ret = saved_struct_load(
|
||||
DESKTOP_SETTINGS_PATH, x, sizeof(DesktopSettings), DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER);
|
||||
DESKTOP_SETTINGS_PATH,
|
||||
x,
|
||||
sizeof(DesktopSettings),
|
||||
DESKTOP_SETTINGS_MAGIC,
|
||||
DESKTOP_SETTINGS_VER);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -287,7 +287,10 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas_draw_str(canvas, start_pos, 22, "...");
|
||||
start_pos += 6;
|
||||
needed_string_width -= 8;
|
||||
for(uint off = 0; !furi_string_empty(str) && canvas_string_width(canvas, cstr) > needed_string_width && off < model->cursor_pos; off++) {
|
||||
for(uint off = 0;
|
||||
!furi_string_empty(str) && canvas_string_width(canvas, cstr) > needed_string_width &&
|
||||
off < model->cursor_pos;
|
||||
off++) {
|
||||
furi_string_right(str, 1);
|
||||
}
|
||||
}
|
||||
@@ -309,20 +312,15 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
const TextInputKey* keys = get_row(keyboards[model->selected_keyboard], row);
|
||||
|
||||
for(size_t column = 0; column < column_count; column++) {
|
||||
bool selected = !model->cursor_select && model->selected_row == row && model->selected_column == column;
|
||||
bool selected = !model->cursor_select && model->selected_row == row &&
|
||||
model->selected_column == column;
|
||||
const Icon* icon = NULL;
|
||||
if(keys[column].text == ENTER_KEY) {
|
||||
icon = selected
|
||||
? &I_KeySaveSelected_24x11
|
||||
: &I_KeySave_24x11;
|
||||
icon = selected ? &I_KeySaveSelected_24x11 : &I_KeySave_24x11;
|
||||
} else if(keys[column].text == SWITCH_KEYBOARD_KEY) {
|
||||
icon = selected
|
||||
? &I_KeyKeyboardSelected_10x11
|
||||
: &I_KeyKeyboard_10x11;
|
||||
icon = selected ? &I_KeyKeyboardSelected_10x11 : &I_KeyKeyboard_10x11;
|
||||
} else if(keys[column].text == BACKSPACE_KEY) {
|
||||
icon = selected
|
||||
? &I_KeyBackspaceSelected_16x9
|
||||
: &I_KeyBackspace_16x9;
|
||||
icon = selected ? &I_KeyBackspaceSelected_16x9 : &I_KeyBackspace_16x9;
|
||||
}
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
if(icon != NULL) {
|
||||
@@ -418,7 +416,8 @@ static void text_input_handle_right(TextInput* text_input, TextInputModel* model
|
||||
UNUSED(text_input);
|
||||
if(model->cursor_select) {
|
||||
model->cursor_pos = CLAMP(model->cursor_pos + 1, strlen(model->text_buffer), 0u);
|
||||
} else if(model->selected_column <
|
||||
} else if(
|
||||
model->selected_column <
|
||||
get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 1) {
|
||||
model->selected_column++;
|
||||
} else {
|
||||
|
||||
@@ -503,8 +503,7 @@ void storage_process_alias(
|
||||
} else if(furi_string_start_with(path, STORAGE_CFG_PATH_PREFIX)) {
|
||||
// Create config folder if it doesn't exist
|
||||
FuriString* config_path = furi_string_alloc_set(STORAGE_CFG_PATH_PREFIX);
|
||||
if(create_folders &&
|
||||
storage_process_common_stat(app, config_path, NULL) != FSE_OK) {
|
||||
if(create_folders && storage_process_common_stat(app, config_path, NULL) != FSE_OK) {
|
||||
storage_process_common_mkdir(app, config_path);
|
||||
}
|
||||
furi_string_free(config_path);
|
||||
|
||||
@@ -199,24 +199,27 @@ static bool update_task_post_update(UpdateTask* update_task) {
|
||||
update_task_set_progress(update_task, UpdateTaskStageSplashscreenInstall, 0);
|
||||
FuriString* tmp_path;
|
||||
tmp_path = furi_string_alloc_set(update_task->update_path);
|
||||
if(storage_common_stat(update_task->storage, XFWFIRSTBOOT_FLAG_PATH, NULL) == FSE_NOT_EXIST) {
|
||||
if(storage_common_stat(update_task->storage, XFWFIRSTBOOT_FLAG_PATH, NULL) ==
|
||||
FSE_NOT_EXIST) {
|
||||
File* file = storage_file_alloc(update_task->storage);
|
||||
if(storage_file_open(file, XFWFIRSTBOOT_FLAG_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||
if(storage_file_open(
|
||||
file, XFWFIRSTBOOT_FLAG_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||
storage_file_close(file);
|
||||
}
|
||||
storage_file_free(file);
|
||||
path_append(tmp_path, "xfwfirstboot.bin");
|
||||
if(storage_common_stat(update_task->storage, furi_string_get_cstr(tmp_path), NULL) != FSE_OK) {
|
||||
if(storage_common_stat(
|
||||
update_task->storage, furi_string_get_cstr(tmp_path), NULL) != FSE_OK) {
|
||||
furi_string_set(tmp_path, update_task->update_path);
|
||||
path_append(tmp_path, furi_string_get_cstr(update_task->manifest->splash_file));
|
||||
path_append(
|
||||
tmp_path, furi_string_get_cstr(update_task->manifest->splash_file));
|
||||
}
|
||||
} else {
|
||||
path_append(tmp_path, furi_string_get_cstr(update_task->manifest->splash_file));
|
||||
}
|
||||
if(storage_common_copy(
|
||||
update_task->storage,
|
||||
furi_string_get_cstr(tmp_path),
|
||||
SLIDESHOW_FS_PATH) != FSE_OK) {
|
||||
update_task->storage, furi_string_get_cstr(tmp_path), SLIDESHOW_FS_PATH) !=
|
||||
FSE_OK) {
|
||||
// actually, not critical
|
||||
}
|
||||
furi_string_free(tmp_path);
|
||||
|
||||
+8
-6
@@ -138,12 +138,14 @@ class Main(App):
|
||||
return 2
|
||||
|
||||
if self.args.splash:
|
||||
SlideshowMain(no_exit=True)([
|
||||
"-i",
|
||||
str(pathlib.Path(self.args.splash).parent / "xfwfirstboot"),
|
||||
"-o",
|
||||
join(self.args.directory, "xfwfirstboot.bin"),
|
||||
])
|
||||
SlideshowMain(no_exit=True)(
|
||||
[
|
||||
"-i",
|
||||
str(pathlib.Path(self.args.splash).parent / "xfwfirstboot"),
|
||||
"-o",
|
||||
join(self.args.directory, "xfwfirstboot.bin"),
|
||||
]
|
||||
)
|
||||
splash_args = [
|
||||
"-i",
|
||||
self.args.splash,
|
||||
|
||||
Reference in New Issue
Block a user