Formatting fixes

This commit is contained in:
Jonas Diemer 2026-01-20 08:04:30 +01:00
parent de17b5da81
commit f20cb10365
2 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,7 @@
#include "EpubReaderMenuActivity.h" #include "EpubReaderMenuActivity.h"
#include <GfxRenderer.h> #include <GfxRenderer.h>
#include "fontIds.h" #include "fontIds.h"
void EpubReaderMenuActivity::onEnter() { void EpubReaderMenuActivity::onEnter() {
@ -46,11 +48,11 @@ void EpubReaderMenuActivity::loop() {
// Use local variables for items we need to check after potential deletion // Use local variables for items we need to check after potential deletion
if (mappedInput.wasReleased(MappedInputManager::Button::Up) || if (mappedInput.wasReleased(MappedInputManager::Button::Up) ||
mappedInput.wasReleased(MappedInputManager::Button::Left) ) { mappedInput.wasReleased(MappedInputManager::Button::Left)) {
selectedIndex = (selectedIndex + menuItems.size() - 1) % menuItems.size(); selectedIndex = (selectedIndex + menuItems.size() - 1) % menuItems.size();
updateRequired = true; updateRequired = true;
} else if (mappedInput.wasReleased(MappedInputManager::Button::Down) || } else if (mappedInput.wasReleased(MappedInputManager::Button::Down) ||
mappedInput.wasReleased(MappedInputManager::Button::Right)) { mappedInput.wasReleased(MappedInputManager::Button::Right)) {
selectedIndex = (selectedIndex + 1) % menuItems.size(); selectedIndex = (selectedIndex + 1) % menuItems.size();
updateRequired = true; updateRequired = true;
} else if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) { } else if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
@ -65,7 +67,7 @@ void EpubReaderMenuActivity::loop() {
return; return;
} else if (mappedInput.wasReleased(MappedInputManager::Button::Back)) { } else if (mappedInput.wasReleased(MappedInputManager::Button::Back)) {
onBack(); onBack();
return; // Also return here just in case return; // Also return here just in case
} }
} }

View File

@ -3,23 +3,21 @@
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/semphr.h> #include <freertos/semphr.h>
#include <freertos/task.h> #include <freertos/task.h>
#include <functional>
#include <vector>
#include <string>
#include "MappedInputManager.h" #include <functional>
#include <string>
#include <vector>
#include "../ActivityWithSubactivity.h" #include "../ActivityWithSubactivity.h"
#include "MappedInputManager.h"
class EpubReaderMenuActivity final : public ActivityWithSubactivity { class EpubReaderMenuActivity final : public ActivityWithSubactivity {
public: public:
enum class MenuAction { SELECT_CHAPTER, GO_HOME, DELETE_CACHE }; enum class MenuAction { SELECT_CHAPTER, GO_HOME, DELETE_CACHE };
explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
const std::function<void()>& onBack, const std::function<void()>& onBack, const std::function<void(MenuAction)>& onAction)
const std::function<void(MenuAction)>& onAction) : ActivityWithSubactivity("EpubReaderMenu", renderer, mappedInput), onBack(onBack), onAction(onAction) {}
: ActivityWithSubactivity("EpubReaderMenu", renderer, mappedInput),
onBack(onBack),
onAction(onAction) {}
void onEnter() override; void onEnter() override;
void onExit() override; void onExit() override;
@ -31,10 +29,9 @@ class EpubReaderMenuActivity final : public ActivityWithSubactivity {
std::string label; std::string label;
}; };
const std::vector<MenuItem> menuItems = { const std::vector<MenuItem> menuItems = {{MenuAction::SELECT_CHAPTER, "Select Chapter"},
{MenuAction::SELECT_CHAPTER, "Select Chapter"}, {MenuAction::GO_HOME, "Go Home"},
{MenuAction::GO_HOME, "Go Home"}, {MenuAction::DELETE_CACHE, "Delete Book Cache"}};
{MenuAction::DELETE_CACHE, "Delete Book Cache"}};
int selectedIndex = 0; int selectedIndex = 0;
bool updateRequired = false; bool updateRequired = false;