Skip to content

Commit

Permalink
WIP saved emulate+config scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyweiss committed Jan 7, 2023
1 parent 7f3f3ad commit 52c51f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
15 changes: 11 additions & 4 deletions scenes/mag_scene_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ void mag_scene_emulate_on_enter(void* context) {
FuriString* tmp_str;
tmp_str = furi_string_alloc();

widget_add_button_element(widget, GuiButtonTypeLeft, "Back", mag_widget_callback, mag);
// Use strlcpy instead perhaps, to truncate to screen width, then add ellipses if needed?
furi_string_printf(tmp_str, "%s\r\n", mag->mag_dev->dev_name);

furi_string_printf(tmp_str, "Under construction!");
widget_add_icon_element(widget, 1, 1, &I_mag_10px);
widget_add_string_element(
widget, 64, 4, AlignCenter, AlignTop, FontPrimary, furi_string_get_cstr(tmp_str));
widget, 13, 2, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(tmp_str));
furi_string_reset(tmp_str);

furi_string_printf(tmp_str, furi_string_get_cstr(mag->mag_dev->dev_data));
widget_add_string_multiline_element(
widget, 0, 15, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(tmp_str));

widget_add_button_element(widget, GuiButtonTypeLeft, "Config", mag_widget_callback, mag);

view_dispatcher_switch_to_view(mag->view_dispatcher, MagViewWidget);
furi_string_free(tmp_str);
}
Expand All @@ -27,7 +34,7 @@ bool mag_scene_emulate_on_event(void* context, SceneManagerEvent event) {
if(event.event == GuiButtonTypeLeft) {
consumed = true;

scene_manager_previous_scene(scene_manager);
scene_manager_next_scene(scene_manager, MagSceneEmulateConfig);
}
}

Expand Down
4 changes: 2 additions & 2 deletions scenes/mag_scene_saved_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void mag_scene_saved_menu_on_enter(void* context) {
Submenu* submenu = mag->submenu;

submenu_add_item(
submenu, "Emulate", SubmenuIndexEmulate, mag_scene_saved_menu_submenu_callback, mag);
submenu, "Emulate WIP", SubmenuIndexEmulate, mag_scene_saved_menu_submenu_callback, mag);
submenu_add_item(
submenu, "Edit", SubmenuIndexEdit, mag_scene_saved_menu_submenu_callback, mag);
submenu_add_item(
Expand All @@ -41,7 +41,7 @@ bool mag_scene_saved_menu_on_event(void* context, SceneManagerEvent event) {

// TODO: replace with actual next scenes once built
if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(mag->scene_manager, MagSceneUnderConstruction);
scene_manager_next_scene(mag->scene_manager, MagSceneEmulate);
consumed = true;
} else if(event.event == SubmenuIndexEdit) {
scene_manager_next_scene(mag->scene_manager, MagSceneUnderConstruction);
Expand Down
6 changes: 0 additions & 6 deletions scenes/mag_scene_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

typedef enum {
SubmenuIndexEmulateTest,
SubmenuIndexConfigWip,
SubmenuIndexSaved,
SubmenuIndexAddManually,
} SubmenuIndex;
Expand All @@ -23,8 +22,6 @@ void mag_scene_start_on_enter(void* context) {
SubmenuIndexEmulateTest,
mag_scene_start_submenu_callback,
mag);
submenu_add_item(
submenu, "Config WIP", SubmenuIndexConfigWip, mag_scene_start_submenu_callback, mag);
submenu_add_item(submenu, "Saved", SubmenuIndexSaved, mag_scene_start_submenu_callback, mag);
submenu_add_item(
submenu, "Add Manually", SubmenuIndexAddManually, mag_scene_start_submenu_callback, mag);
Expand All @@ -46,9 +43,6 @@ bool mag_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.event == SubmenuIndexEmulateTest) {
scene_manager_next_scene(mag->scene_manager, MagSceneEmulateTest);
consumed = true;
} else if(event.event == SubmenuIndexConfigWip) {
scene_manager_next_scene(mag->scene_manager, MagSceneEmulateConfig);
consumed = true;
} else if(event.event == SubmenuIndexSaved) {
furi_string_set(mag->file_path, MAG_APP_FOLDER);
scene_manager_next_scene(mag->scene_manager, MagSceneFileSelect);
Expand Down

0 comments on commit 52c51f6

Please sign in to comment.