diff --git a/src/activities/ActivityManager.cpp b/src/activities/ActivityManager.cpp index cb8336fa..3cf115b1 100644 --- a/src/activities/ActivityManager.cpp +++ b/src/activities/ActivityManager.cpp @@ -5,8 +5,8 @@ #include "boot_sleep/BootActivity.h" #include "boot_sleep/SleepActivity.h" #include "browser/OpdsBookBrowserActivity.h" +#include "home/FileBrowserActivity.h" #include "home/HomeActivity.h" -#include "home/MyLibraryActivity.h" #include "home/RecentBooksActivity.h" #include "network/CrossPointWebServerActivity.h" #include "reader/ReaderActivity.h" @@ -169,8 +169,8 @@ void ActivityManager::goToFileTransfer() { void ActivityManager::goToSettings() { replaceActivity(std::make_unique(renderer, mappedInput)); } -void ActivityManager::goToMyLibrary(std::string path) { - replaceActivity(std::make_unique(renderer, mappedInput, std::move(path))); +void ActivityManager::goToFileBrowser(std::string path) { + replaceActivity(std::make_unique(renderer, mappedInput, std::move(path))); } void ActivityManager::goToRecentBooks() { diff --git a/src/activities/ActivityManager.h b/src/activities/ActivityManager.h index 047276f0..bc24c42e 100644 --- a/src/activities/ActivityManager.h +++ b/src/activities/ActivityManager.h @@ -79,7 +79,7 @@ class ActivityManager { // goTo... functions are convenient wrapper for replaceActivity() void goToFileTransfer(); void goToSettings(); - void goToMyLibrary(std::string path = {}); + void goToFileBrowser(std::string path = {}); void goToRecentBooks(); void goToBrowser(); void goToReader(std::string path); diff --git a/src/activities/home/MyLibraryActivity.cpp b/src/activities/home/FileBrowserActivity.cpp similarity index 91% rename from src/activities/home/MyLibraryActivity.cpp rename to src/activities/home/FileBrowserActivity.cpp index eb919c6d..1e394d14 100644 --- a/src/activities/home/MyLibraryActivity.cpp +++ b/src/activities/home/FileBrowserActivity.cpp @@ -1,4 +1,4 @@ -#include "MyLibraryActivity.h" +#include "FileBrowserActivity.h" #include #include @@ -69,7 +69,7 @@ void sortFileList(std::vector& strs) { }); } -void MyLibraryActivity::loadFiles() { +void FileBrowserActivity::loadFiles() { files.clear(); auto root = Storage.open(basepath.c_str()); @@ -104,7 +104,7 @@ void MyLibraryActivity::loadFiles() { sortFileList(files); } -void MyLibraryActivity::onEnter() { +void FileBrowserActivity::onEnter() { Activity::onEnter(); loadFiles(); @@ -113,20 +113,20 @@ void MyLibraryActivity::onEnter() { requestUpdate(); } -void MyLibraryActivity::onExit() { +void FileBrowserActivity::onExit() { Activity::onExit(); files.clear(); } -void MyLibraryActivity::clearFileMetadata(const std::string& fullPath) { +void FileBrowserActivity::clearFileMetadata(const std::string& fullPath) { // Only clear cache for .epub files if (StringUtils::checkFileExtension(fullPath, ".epub")) { Epub(fullPath, "/.crosspoint").clearCache(); - LOG_DBG("MyLibrary", "Cleared metadata cache for: %s", fullPath.c_str()); + LOG_DBG("FileBrowser", "Cleared metadata cache for: %s", fullPath.c_str()); } } -void MyLibraryActivity::loop() { +void FileBrowserActivity::loop() { // Long press BACK (1s+) goes to root folder if (mappedInput.isPressed(MappedInputManager::Button::Back) && mappedInput.getHeldTime() >= GO_HOME_MS && basepath != "/") { @@ -152,10 +152,10 @@ void MyLibraryActivity::loop() { auto handler = [this, fullPath](const ActivityResult& res) { if (!res.isCancelled) { - LOG_DBG("MyLibrary", "Attempting to delete: %s", fullPath.c_str()); + LOG_DBG("FileBrowser", "Attempting to delete: %s", fullPath.c_str()); clearFileMetadata(fullPath); if (Storage.remove(fullPath.c_str())) { - LOG_DBG("MyLibrary", "Deleted successfully"); + LOG_DBG("FileBrowser", "Deleted successfully"); loadFiles(); if (files.empty()) { selectorIndex = 0; @@ -166,10 +166,10 @@ void MyLibraryActivity::loop() { requestUpdate(true); } else { - LOG_ERR("MyLibrary", "Failed to delete file: %s", fullPath.c_str()); + LOG_ERR("FileBrowser", "Failed to delete file: %s", fullPath.c_str()); } } else { - LOG_DBG("MyLibrary", "Delete cancelled by user"); + LOG_DBG("FileBrowser", "Delete cancelled by user"); } }; @@ -244,7 +244,7 @@ std::string getFileName(std::string filename) { return filename.substr(0, pos); } -void MyLibraryActivity::render(RenderLock&&) { +void FileBrowserActivity::render(RenderLock&&) { renderer.clearScreen(); const auto pageWidth = renderer.getScreenWidth(); @@ -274,7 +274,7 @@ void MyLibraryActivity::render(RenderLock&&) { renderer.displayBuffer(); } -size_t MyLibraryActivity::findEntry(const std::string& name) const { +size_t FileBrowserActivity::findEntry(const std::string& name) const { for (size_t i = 0; i < files.size(); i++) if (files[i] == name) return i; return 0; diff --git a/src/activities/home/MyLibraryActivity.h b/src/activities/home/FileBrowserActivity.h similarity index 67% rename from src/activities/home/MyLibraryActivity.h rename to src/activities/home/FileBrowserActivity.h index 3e7e8841..c4f359dd 100644 --- a/src/activities/home/MyLibraryActivity.h +++ b/src/activities/home/FileBrowserActivity.h @@ -8,7 +8,7 @@ #include "RecentBooksStore.h" #include "util/ButtonNavigator.h" -class MyLibraryActivity final : public Activity { +class FileBrowserActivity final : public Activity { private: // Deletion void clearFileMetadata(const std::string& fullPath); @@ -26,8 +26,8 @@ class MyLibraryActivity final : public Activity { size_t findEntry(const std::string& name) const; public: - explicit MyLibraryActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialPath = "/") - : Activity("MyLibrary", renderer, mappedInput), basepath(initialPath.empty() ? "/" : std::move(initialPath)) {} + 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; diff --git a/src/activities/home/HomeActivity.cpp b/src/activities/home/HomeActivity.cpp index 6ee6d74d..bfab4874 100644 --- a/src/activities/home/HomeActivity.cpp +++ b/src/activities/home/HomeActivity.cpp @@ -20,7 +20,7 @@ #include "util/StringUtils.h" int HomeActivity::getMenuItemCount() const { - int count = 4; // My Library, Recents, File transfer, Settings + int count = 4; // File Browser, Recents, File transfer, Settings if (!recentBooks.empty()) { count += recentBooks.size(); } @@ -189,7 +189,7 @@ void HomeActivity::loop() { // Calculate dynamic indices based on which options are available int idx = 0; int menuSelectedIndex = selectorIndex - static_cast(recentBooks.size()); - const int myLibraryIdx = idx++; + const int fileBrowserIdx = idx++; const int recentsIdx = idx++; const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1; const int fileTransferIdx = idx++; @@ -197,8 +197,8 @@ void HomeActivity::loop() { if (selectorIndex < recentBooks.size()) { onSelectBook(recentBooks[selectorIndex].path); - } else if (menuSelectedIndex == myLibraryIdx) { - onMyLibraryOpen(); + } else if (menuSelectedIndex == fileBrowserIdx) { + onFileBrowserOpen(); } else if (menuSelectedIndex == recentsIdx) { onRecentsOpen(); } else if (menuSelectedIndex == opdsLibraryIdx) { @@ -231,7 +231,7 @@ void HomeActivity::render(RenderLock&&) { std::vector menuIcons = {Folder, Recent, Transfer, Settings}; if (hasOpdsUrl) { - // Insert OPDS Browser after My Library + // Insert OPDS Browser after File Browser menuItems.insert(menuItems.begin() + 2, tr(STR_OPDS_BROWSER)); menuIcons.insert(menuIcons.begin() + 2, Library); } @@ -261,7 +261,7 @@ void HomeActivity::render(RenderLock&&) { void HomeActivity::onSelectBook(const std::string& path) { activityManager.goToReader(path); } -void HomeActivity::onMyLibraryOpen() { activityManager.goToMyLibrary(); } +void HomeActivity::onFileBrowserOpen() { activityManager.goToFileBrowser(); } void HomeActivity::onRecentsOpen() { activityManager.goToRecentBooks(); } diff --git a/src/activities/home/HomeActivity.h b/src/activities/home/HomeActivity.h index 6b69d516..e2b24bea 100644 --- a/src/activities/home/HomeActivity.h +++ b/src/activities/home/HomeActivity.h @@ -3,7 +3,7 @@ #include #include "../Activity.h" -#include "./MyLibraryActivity.h" +#include "./FileBrowserActivity.h" #include "util/ButtonNavigator.h" struct RecentBook; @@ -21,7 +21,7 @@ class HomeActivity final : public Activity { uint8_t* coverBuffer = nullptr; // HomeActivity's own buffer for cover image std::vector recentBooks; void onSelectBook(const std::string& path); - void onMyLibraryOpen(); + void onFileBrowserOpen(); void onRecentsOpen(); void onSettingsOpen(); void onFileTransferOpen(); diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index b99cd07e..d889df5f 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -180,7 +180,7 @@ void EpubReaderActivity::loop() { // Long press BACK (1s+) goes to file selection if (mappedInput.isPressed(MappedInputManager::Button::Back) && mappedInput.getHeldTime() >= goHomeMs) { - activityManager.goToMyLibrary(epub ? epub->getPath() : ""); + activityManager.goToFileBrowser(epub ? epub->getPath() : ""); return; } diff --git a/src/activities/reader/ReaderActivity.cpp b/src/activities/reader/ReaderActivity.cpp index 82a1e23f..a7842a9e 100644 --- a/src/activities/reader/ReaderActivity.cpp +++ b/src/activities/reader/ReaderActivity.cpp @@ -80,7 +80,7 @@ std::unique_ptr ReaderActivity::loadTxt(const std::string& path) { void ReaderActivity::goToLibrary(const std::string& fromBookPath) { // If coming from a book, start in that book's folder; otherwise start from root auto initialPath = fromBookPath.empty() ? "/" : extractFolderPath(fromBookPath); - activityManager.goToMyLibrary(std::move(initialPath)); + activityManager.goToFileBrowser(std::move(initialPath)); } void ReaderActivity::onGoToEpubReader(std::unique_ptr epub) { diff --git a/src/activities/reader/ReaderActivity.h b/src/activities/reader/ReaderActivity.h index 601a35f7..6a3756db 100644 --- a/src/activities/reader/ReaderActivity.h +++ b/src/activities/reader/ReaderActivity.h @@ -2,7 +2,7 @@ #include #include "../Activity.h" -#include "activities/home/MyLibraryActivity.h" +#include "activities/home/FileBrowserActivity.h" class Epub; class Xtc; diff --git a/src/activities/reader/TxtReaderActivity.cpp b/src/activities/reader/TxtReaderActivity.cpp index 994492ee..756b7749 100644 --- a/src/activities/reader/TxtReaderActivity.cpp +++ b/src/activities/reader/TxtReaderActivity.cpp @@ -76,7 +76,7 @@ void TxtReaderActivity::onExit() { void TxtReaderActivity::loop() { // Long press BACK (1s+) goes to file selection if (mappedInput.isPressed(MappedInputManager::Button::Back) && mappedInput.getHeldTime() >= goHomeMs) { - activityManager.goToMyLibrary(txt ? txt->getPath() : ""); + activityManager.goToFileBrowser(txt ? txt->getPath() : ""); return; } diff --git a/src/activities/reader/XtcReaderActivity.cpp b/src/activities/reader/XtcReaderActivity.cpp index a10d1025..84cc51da 100644 --- a/src/activities/reader/XtcReaderActivity.cpp +++ b/src/activities/reader/XtcReaderActivity.cpp @@ -70,7 +70,7 @@ void XtcReaderActivity::loop() { // Long press BACK (1s+) goes to file selection if (mappedInput.isPressed(MappedInputManager::Button::Back) && mappedInput.getHeldTime() >= goHomeMs) { - activityManager.goToMyLibrary(xtc ? xtc->getPath() : ""); + activityManager.goToFileBrowser(xtc ? xtc->getPath() : ""); return; }