Преглед на файлове

Rename Menus to Scenes

[Problem]
Right now the naming for the menu folder is incorrect, as these
are actually scenes. As a result, it should be renamed.

[Solution]
Renamed the folder and corresponding dependencies.

[Testing]
Confirmed still builds and runs on device.
Gerald McAlister преди 2 години
родител
ревизия
a054c2a257
променени са 5 файла, в които са добавени 27 реда и са изтрити 27 реда
  1. 1 1
      application.fam
  2. 0 11
      src/menus/main_menu.h
  3. 11 11
      src/scenes/starting_scene.c
  4. 11 0
      src/scenes/starting_scene.h
  5. 4 4
      src/tone_gen.c

+ 1 - 1
application.fam

@@ -13,5 +13,5 @@ App(
     fap_author="Gerald McAlister",
     fap_weburl="https://github.com/GEMISIS/tone_gen",
     fap_icon_assets="images",  # Image assets to compile for this application
-    sources=["src/*.c", "src/menus/*.c", "src/utils/*.c"],
+    sources=["src/*.c", "src/scenes/*.c", "src/utils/*.c"],
 )

+ 0 - 11
src/menus/main_menu.h

@@ -1,11 +0,0 @@
-#ifndef _MAIN_MENU_H_
-
-#define _MAIN_MENU_H_
-
-#include <gui/scene_manager.h>
-
-void scene_on_enter_main_menu(void* context);
-bool scene_on_event_main_menu(void* context, SceneManagerEvent event);
-void scene_on_exit_main_menu(void* context);
-
-#endif

+ 11 - 11
src/menus/main_menu.c → src/scenes/starting_scene.c

@@ -1,7 +1,7 @@
 #include <gui/modules/menu.h>
 #include <gui/modules/popup.h>
 
-#include "main_menu.h"
+#include "starting_scene.h"
 #include "../app_context.h"
 #include "../tone_gen.h"
 #include "../utils/linked_list.h"
@@ -13,8 +13,8 @@ typedef enum {
 } ToneGenAppMenuSelection;
 
 /** main menu callback - sends a custom event to the scene manager based on the menu selection */
-void menu_callback_main_menu(void* context, uint32_t index) {
-    FURI_LOG_I(TAG, "menu_callback_main_menu");
+void menu_callback_starting_scene(void* context, uint32_t index) {
+    FURI_LOG_I(TAG, "menu_callback_starting_scene");
     UNUSED(context);
     // struct AppContext_t* app = context;
     switch(index) {
@@ -30,8 +30,8 @@ void menu_callback_main_menu(void* context, uint32_t index) {
 }
 
 /** resets the menu, gives it content, callbacks and selection enums */
-void scene_on_enter_main_menu(void* context) {
-    FURI_LOG_I(TAG, "scene_on_enter_main_menu");
+void scene_on_enter_starting_scene(void* context) {
+    FURI_LOG_I(TAG, "scene_on_enter_starting_scene");
     struct AppContext_t* app = (struct AppContext_t*)context;
     // Setup our menu
     FURI_LOG_D(TAG, "Adding view menu");
@@ -55,21 +55,21 @@ void scene_on_enter_main_menu(void* context) {
         "Play Tone",
         NULL,
         ToneGenAppMenuSelection_Play,
-        menu_callback_main_menu,
+        menu_callback_starting_scene,
         app);
     menu_add_item(
         menuView->viewData,
         "Adjust Tone",
         NULL,
         ToneGenAppMenuSelection_Adjust,
-        menu_callback_main_menu,
+        menu_callback_starting_scene,
         app);
     view_dispatcher_switch_to_view(app->view_dispatcher, ToneGenAppView_Menu);
 }
 
 /** main menu event handler - switches scene based on the event */
-bool scene_on_event_main_menu(void* context, SceneManagerEvent event) {
-    FURI_LOG_I(TAG, "scene_on_event_main_menu");
+bool scene_on_event_starting_scene(void* context, SceneManagerEvent event) {
+    FURI_LOG_I(TAG, "scene_on_event_starting_scene");
     UNUSED(context);
     // struct AppContext_t* app = context;
     bool consumed = false;
@@ -93,8 +93,8 @@ bool scene_on_event_main_menu(void* context, SceneManagerEvent event) {
     return consumed;
 }
 
-void scene_on_exit_main_menu(void* context) {
-    FURI_LOG_I(TAG, "scene_on_exit_main_menu");
+void scene_on_exit_starting_scene(void* context) {
+    FURI_LOG_I(TAG, "scene_on_exit_starting_scene");
     struct AppContext_t* app = context;
     freeAppContextViews(&app);
 }

+ 11 - 0
src/scenes/starting_scene.h

@@ -0,0 +1,11 @@
+#ifndef _STARTING_SCENE_H_
+
+#define _STARTING_SCENE_H_
+
+#include <gui/scene_manager.h>
+
+void scene_on_enter_starting_scene(void* context);
+bool scene_on_event_starting_scene(void* context, SceneManagerEvent event);
+void scene_on_exit_starting_scene(void* context);
+
+#endif

+ 4 - 4
src/tone_gen.c

@@ -6,21 +6,21 @@
 #include "app_context.h"
 #include "tone_gen.h"
 
-#include "menus/main_menu.h"
+#include "scenes/starting_scene.h"
 
 /** collection of all scene on_enter handlers - in the same order as their enum */
 void (*const scene_on_enter_handlers[])(void*) = {
-    scene_on_enter_main_menu,
+    scene_on_enter_starting_scene,
 };
 
 /** collection of all scene on event handlers - in the same order as their enum */
 bool (*const scene_on_event_handlers[])(void*, SceneManagerEvent) = {
-    scene_on_event_main_menu,
+    scene_on_event_starting_scene,
 };
 
 /** collection of all scene on exit handlers - in the same order as their enum */
 void (*const scene_on_exit_handlers[])(void*) = {
-    scene_on_exit_main_menu,
+    scene_on_exit_starting_scene,
 };
 
 const SceneManagerHandlers scene_event_handlers = {