refactor: Removed SdCardFontGlobals.h (#1962)
## Summary First of several changes to decouple and clean up SD card fonts integration. This change eliminates SdCardFontGlobals.h: - Simply declare the `extern SdCardFontSystem sdFontSystem` in SdCardFontSystem.h. - `ActivityManager::goToReader` should not care about loading SD card fonts. Instead do the same work in `ReaderActivity::onEnter`, after the previous activity has exited and after ReaderActivity has validated the file path. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**NO**_
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "SdCardFontSystem.h"
|
||||
|
||||
class GfxRenderer;
|
||||
|
||||
// Global SD card font system instance (defined in main.cpp).
|
||||
extern SdCardFontSystem sdFontSystem;
|
||||
|
||||
// Ensure the correct SD card font family is loaded for current settings.
|
||||
// Defined in main.cpp; call before entering the reader or after settings change.
|
||||
extern void ensureSdFontLoaded();
|
||||
@@ -50,3 +50,6 @@ class SdCardFontSystem {
|
||||
SdCardFontManager manager_;
|
||||
std::atomic<bool> registryDirty_{false};
|
||||
};
|
||||
|
||||
// Global SD card font system instance (defined in main.cpp).
|
||||
extern SdCardFontSystem sdFontSystem;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "OpdsServerStore.h"
|
||||
#include "SdCardFontGlobals.h"
|
||||
#include "boot_sleep/BootActivity.h"
|
||||
#include "boot_sleep/SleepActivity.h"
|
||||
#include "browser/OpdsBookBrowserActivity.h"
|
||||
@@ -194,7 +193,6 @@ void ActivityManager::goToBrowser() {
|
||||
}
|
||||
|
||||
void ActivityManager::goToReader(std::string path) {
|
||||
ensureSdFontLoaded();
|
||||
replaceActivity(std::make_unique<ReaderActivity>(renderer, mappedInput, std::move(path)));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "CrossPointSettings.h"
|
||||
#include "Epub.h"
|
||||
#include "EpubReaderActivity.h"
|
||||
#include "SdCardFontSystem.h"
|
||||
#include "Txt.h"
|
||||
#include "TxtReaderActivity.h"
|
||||
#include "Xtc.h"
|
||||
@@ -103,6 +104,8 @@ void ReaderActivity::onEnter() {
|
||||
return;
|
||||
}
|
||||
|
||||
sdFontSystem.ensureLoaded(renderer);
|
||||
|
||||
currentBookPath = initialBookPath;
|
||||
if (isBmpFile(initialBookPath)) {
|
||||
onGoToBmpViewer(initialBookPath);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <esp_rom_crc.h>
|
||||
|
||||
#include "MappedInputManager.h"
|
||||
#include "SdCardFontGlobals.h"
|
||||
#include "SdCardFontSystem.h"
|
||||
#include "activities/network/WifiSelectionActivity.h"
|
||||
#include "activities/util/ConfirmationActivity.h"
|
||||
#include "components/UITheme.h"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "MappedInputManager.h"
|
||||
#include "OpdsServerListActivity.h"
|
||||
#include "OtaUpdateActivity.h"
|
||||
#include "SdCardFontGlobals.h"
|
||||
#include "SdCardFontSystem.h"
|
||||
#include "SdFirmwareUpdateActivity.h"
|
||||
#include "SettingsList.h"
|
||||
#include "StatusBarSettingsActivity.h"
|
||||
|
||||
@@ -197,8 +197,6 @@ void enterDeepSleep() {
|
||||
powerManager.startDeepSleep(gpio);
|
||||
}
|
||||
|
||||
void ensureSdFontLoaded() { sdFontSystem.ensureLoaded(renderer); }
|
||||
|
||||
void setupDisplayAndFonts() {
|
||||
display.begin();
|
||||
renderer.begin();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "CrossPointSettings.h"
|
||||
#include "FontInstaller.h"
|
||||
#include "OpdsServerStore.h"
|
||||
#include "SdCardFontGlobals.h"
|
||||
#include "SdCardFontSystem.h"
|
||||
#include "SettingsList.h"
|
||||
#include "WebDAVHandler.h"
|
||||
|
||||
Reference in New Issue
Block a user