mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
Merge 8349ea8c9f into 78d6e5931c
This commit is contained in:
commit
490f6db521
@ -102,6 +102,7 @@ The Settings screen allows you to configure the device's behavior. There are a f
|
|||||||
- "Custom" - Custom images from the SD card; see [Sleep Screen](#36-sleep-screen) below for more information
|
- "Custom" - Custom images from the SD card; see [Sleep Screen](#36-sleep-screen) below for more information
|
||||||
- "Cover" - The book cover image (Note: this is experimental and may not work as expected)
|
- "Cover" - The book cover image (Note: this is experimental and may not work as expected)
|
||||||
- "None" - A blank screen
|
- "None" - A blank screen
|
||||||
|
- "Cover + Custom" - The book cover image, fallbacks to "Custom" behavior
|
||||||
- **Sleep Screen Cover Mode**: How to display the book cover when "Cover" sleep screen is selected:
|
- **Sleep Screen Cover Mode**: How to display the book cover when "Cover" sleep screen is selected:
|
||||||
- "Fit" (default) - Scale the image down to fit centered on the screen, padding with white borders as necessary
|
- "Fit" (default) - Scale the image down to fit centered on the screen, padding with white borders as necessary
|
||||||
- "Crop" - Scale the image down and crop as necessary to try to to fill the screen (Note: this is experimental and may not work as expected)
|
- "Crop" - Scale the image down and crop as necessary to try to to fill the screen (Note: this is experimental and may not work as expected)
|
||||||
|
|||||||
@ -15,7 +15,15 @@ class CrossPointSettings {
|
|||||||
CrossPointSettings(const CrossPointSettings&) = delete;
|
CrossPointSettings(const CrossPointSettings&) = delete;
|
||||||
CrossPointSettings& operator=(const CrossPointSettings&) = delete;
|
CrossPointSettings& operator=(const CrossPointSettings&) = delete;
|
||||||
|
|
||||||
enum SLEEP_SCREEN_MODE { DARK = 0, LIGHT = 1, CUSTOM = 2, COVER = 3, BLANK = 4, SLEEP_SCREEN_MODE_COUNT };
|
enum SLEEP_SCREEN_MODE {
|
||||||
|
DARK = 0,
|
||||||
|
LIGHT = 1,
|
||||||
|
CUSTOM = 2,
|
||||||
|
COVER = 3,
|
||||||
|
BLANK = 4,
|
||||||
|
COVER_CUSTOM = 5,
|
||||||
|
SLEEP_SCREEN_MODE_COUNT
|
||||||
|
};
|
||||||
enum SLEEP_SCREEN_COVER_MODE { FIT = 0, CROP = 1, SLEEP_SCREEN_COVER_MODE_COUNT };
|
enum SLEEP_SCREEN_COVER_MODE { FIT = 0, CROP = 1, SLEEP_SCREEN_COVER_MODE_COUNT };
|
||||||
enum SLEEP_SCREEN_COVER_FILTER {
|
enum SLEEP_SCREEN_COVER_FILTER {
|
||||||
NO_FILTER = 0,
|
NO_FILTER = 0,
|
||||||
|
|||||||
@ -18,19 +18,17 @@ void SleepActivity::onEnter() {
|
|||||||
|
|
||||||
ScreenComponents::drawPopup(renderer, "Entering Sleep...");
|
ScreenComponents::drawPopup(renderer, "Entering Sleep...");
|
||||||
|
|
||||||
if (SETTINGS.sleepScreen == CrossPointSettings::SLEEP_SCREEN_MODE::BLANK) {
|
switch (SETTINGS.sleepScreen) {
|
||||||
|
case (CrossPointSettings::SLEEP_SCREEN_MODE::BLANK):
|
||||||
return renderBlankSleepScreen();
|
return renderBlankSleepScreen();
|
||||||
}
|
case (CrossPointSettings::SLEEP_SCREEN_MODE::CUSTOM):
|
||||||
|
|
||||||
if (SETTINGS.sleepScreen == CrossPointSettings::SLEEP_SCREEN_MODE::CUSTOM) {
|
|
||||||
return renderCustomSleepScreen();
|
return renderCustomSleepScreen();
|
||||||
}
|
case (CrossPointSettings::SLEEP_SCREEN_MODE::COVER):
|
||||||
|
case (CrossPointSettings::SLEEP_SCREEN_MODE::COVER_CUSTOM):
|
||||||
if (SETTINGS.sleepScreen == CrossPointSettings::SLEEP_SCREEN_MODE::COVER) {
|
|
||||||
return renderCoverSleepScreen();
|
return renderCoverSleepScreen();
|
||||||
|
default:
|
||||||
|
return renderDefaultSleepScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDefaultSleepScreen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepActivity::renderCustomSleepScreen() const {
|
void SleepActivity::renderCustomSleepScreen() const {
|
||||||
@ -198,8 +196,18 @@ void SleepActivity::renderBitmapSleepScreen(const Bitmap& bitmap) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SleepActivity::renderCoverSleepScreen() const {
|
void SleepActivity::renderCoverSleepScreen() const {
|
||||||
|
void (SleepActivity::*renderNoCoverSleepScreen)() const;
|
||||||
|
switch (SETTINGS.sleepScreen) {
|
||||||
|
case (CrossPointSettings::SLEEP_SCREEN_MODE::COVER_CUSTOM):
|
||||||
|
renderNoCoverSleepScreen = &SleepActivity::renderCustomSleepScreen;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
renderNoCoverSleepScreen = &SleepActivity::renderDefaultSleepScreen;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (APP_STATE.openEpubPath.empty()) {
|
if (APP_STATE.openEpubPath.empty()) {
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string coverBmpPath;
|
std::string coverBmpPath;
|
||||||
@ -212,12 +220,12 @@ void SleepActivity::renderCoverSleepScreen() const {
|
|||||||
Xtc lastXtc(APP_STATE.openEpubPath, "/.crosspoint");
|
Xtc lastXtc(APP_STATE.openEpubPath, "/.crosspoint");
|
||||||
if (!lastXtc.load()) {
|
if (!lastXtc.load()) {
|
||||||
Serial.println("[SLP] Failed to load last XTC");
|
Serial.println("[SLP] Failed to load last XTC");
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lastXtc.generateCoverBmp()) {
|
if (!lastXtc.generateCoverBmp()) {
|
||||||
Serial.println("[SLP] Failed to generate XTC cover bmp");
|
Serial.println("[SLP] Failed to generate XTC cover bmp");
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
coverBmpPath = lastXtc.getCoverBmpPath();
|
coverBmpPath = lastXtc.getCoverBmpPath();
|
||||||
@ -226,12 +234,12 @@ void SleepActivity::renderCoverSleepScreen() const {
|
|||||||
Txt lastTxt(APP_STATE.openEpubPath, "/.crosspoint");
|
Txt lastTxt(APP_STATE.openEpubPath, "/.crosspoint");
|
||||||
if (!lastTxt.load()) {
|
if (!lastTxt.load()) {
|
||||||
Serial.println("[SLP] Failed to load last TXT");
|
Serial.println("[SLP] Failed to load last TXT");
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lastTxt.generateCoverBmp()) {
|
if (!lastTxt.generateCoverBmp()) {
|
||||||
Serial.println("[SLP] No cover image found for TXT file");
|
Serial.println("[SLP] No cover image found for TXT file");
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
coverBmpPath = lastTxt.getCoverBmpPath();
|
coverBmpPath = lastTxt.getCoverBmpPath();
|
||||||
@ -240,17 +248,17 @@ void SleepActivity::renderCoverSleepScreen() const {
|
|||||||
Epub lastEpub(APP_STATE.openEpubPath, "/.crosspoint");
|
Epub lastEpub(APP_STATE.openEpubPath, "/.crosspoint");
|
||||||
if (!lastEpub.load()) {
|
if (!lastEpub.load()) {
|
||||||
Serial.println("[SLP] Failed to load last epub");
|
Serial.println("[SLP] Failed to load last epub");
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lastEpub.generateCoverBmp(cropped)) {
|
if (!lastEpub.generateCoverBmp(cropped)) {
|
||||||
Serial.println("[SLP] Failed to generate cover bmp");
|
Serial.println("[SLP] Failed to generate cover bmp");
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
coverBmpPath = lastEpub.getCoverBmpPath(cropped);
|
coverBmpPath = lastEpub.getCoverBmpPath(cropped);
|
||||||
} else {
|
} else {
|
||||||
return renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
FsFile file;
|
FsFile file;
|
||||||
@ -263,7 +271,7 @@ void SleepActivity::renderCoverSleepScreen() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDefaultSleepScreen();
|
return (this->*renderNoCoverSleepScreen)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepActivity::renderBlankSleepScreen() const {
|
void SleepActivity::renderBlankSleepScreen() const {
|
||||||
|
|||||||
@ -14,7 +14,8 @@ namespace {
|
|||||||
constexpr int displaySettingsCount = 6;
|
constexpr int displaySettingsCount = 6;
|
||||||
const SettingInfo displaySettings[displaySettingsCount] = {
|
const SettingInfo displaySettings[displaySettingsCount] = {
|
||||||
// Should match with SLEEP_SCREEN_MODE
|
// Should match with SLEEP_SCREEN_MODE
|
||||||
SettingInfo::Enum("Sleep Screen", &CrossPointSettings::sleepScreen, {"Dark", "Light", "Custom", "Cover", "None"}),
|
SettingInfo::Enum("Sleep Screen", &CrossPointSettings::sleepScreen,
|
||||||
|
{"Dark", "Light", "Custom", "Cover", "None", "Cover + Custom"}),
|
||||||
SettingInfo::Enum("Sleep Screen Cover Mode", &CrossPointSettings::sleepScreenCoverMode, {"Fit", "Crop"}),
|
SettingInfo::Enum("Sleep Screen Cover Mode", &CrossPointSettings::sleepScreenCoverMode, {"Fit", "Crop"}),
|
||||||
SettingInfo::Enum("Sleep Screen Cover Filter", &CrossPointSettings::sleepScreenCoverFilter,
|
SettingInfo::Enum("Sleep Screen Cover Filter", &CrossPointSettings::sleepScreenCoverFilter,
|
||||||
{"None", "Contrast", "Inverted"}),
|
{"None", "Contrast", "Inverted"}),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user