Files
Crosspoint/src/activities/home/FileBrowserActivity.h
T
Arthur Tazhitdinov 20fc5262c8 refactor: rename MyLibrary to FileBrowser (#1260)
## Summary

* Renames MyLibrary component to FileBrowser, as it better reflects what
it is, in my opinion

## Additional Context

* Frees the Library name for possible future library component that can
cache metadata, provide other ways of browsing than filesystem
structure, etc
---

### AI Usage

Did you use AI tools to help write this code? _**< YES >**_
2026-03-02 11:00:53 +01:00

36 lines
897 B
C++

#pragma once
#include <functional>
#include <string>
#include <vector>
#include "../Activity.h"
#include "RecentBooksStore.h"
#include "util/ButtonNavigator.h"
class FileBrowserActivity final : public Activity {
private:
// Deletion
void clearFileMetadata(const std::string& fullPath);
ButtonNavigator buttonNavigator;
size_t selectorIndex = 0;
// Files state
std::string basepath = "/";
std::vector<std::string> files;
// Data loading
void loadFiles();
size_t findEntry(const std::string& name) const;
public:
explicit FileBrowserActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialPath = "/")
: Activity("FileBrowser", renderer, mappedInput), basepath(initialPath.empty() ? "/" : std::move(initialPath)) {}
void onEnter() override;
void onExit() override;
void loop() override;
void render(RenderLock&&) override;
};