Remove obsolete TODO comments and clarify code

Clean up outdated TODO comments that are no longer relevant and improve comment clarity in activity classes and parsers.
This commit is contained in:
Justin Mitchell
2026-06-19 15:54:44 -04:00
parent 57c389c0b6
commit 1511ab35d5
15 changed files with 6 additions and 26 deletions
@@ -150,7 +150,6 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
if (self->state == IN_PACKAGE && (strcmp(name, "guide") == 0 || strcmp(name, "opf:guide") == 0)) { if (self->state == IN_PACKAGE && (strcmp(name, "guide") == 0 || strcmp(name, "opf:guide") == 0)) {
self->state = IN_GUIDE; self->state = IN_GUIDE;
// TODO Remove print
LOG_DBG("COF", "Entering guide state."); LOG_DBG("COF", "Entering guide state.");
if (!Storage.openFileForRead("COF", self->cachePath + itemCacheFile, self->tempItemStore)) { if (!Storage.openFileForRead("COF", self->cachePath + itemCacheFile, self->tempItemStore)) {
LOG_ERR("COF", "Couldn't open temp items file for reading. This is probably going to be a fatal error."); LOG_ERR("COF", "Couldn't open temp items file for reading. This is probably going to be a fatal error.");
-1
View File
@@ -3,7 +3,6 @@
#include <FreeInkUI.h> #include <FreeInkUI.h>
#include <GfxRenderer.h> #include <GfxRenderer.h>
#include <algorithm>
#include <cstdlib> #include <cstdlib>
#include "CrossPointSettings.h" #include "CrossPointSettings.h"
+1 -2
View File
@@ -56,8 +56,7 @@ class Activity {
// Finish this activity and return to the previous one on the stack (if any) // Finish this activity and return to the previous one on the stack (if any)
void finish(); void finish();
// Convenience method to facilitate API transition to ActivityManager // Convenience method to facilitate API transition to ActivityManager.
// TODO: remove this in near future
void onGoHome(HomeMenuItem item = HomeMenuItem::NONE); void onGoHome(HomeMenuItem item = HomeMenuItem::NONE);
void onSelectBook(const std::string& path); void onSelectBook(const std::string& path);
}; };
@@ -33,7 +33,6 @@ void OpdsBookBrowserActivity::onEnter() {
currentPath = ""; currentPath = "";
selectorIndex = 0; selectorIndex = 0;
consumeConfirm = false; consumeConfirm = false;
consumeBack = false;
errorMessage.clear(); errorMessage.clear();
statusMessage = tr(STR_CHECKING_WIFI); statusMessage = tr(STR_CHECKING_WIFI);
requestUpdate(); requestUpdate();
@@ -62,10 +61,6 @@ void OpdsBookBrowserActivity::loop() {
consumeConfirm = false; consumeConfirm = false;
return; return;
} }
if (consumeBack && mappedInput.wasReleased(MappedInputManager::Button::Back)) {
consumeBack = false;
return;
}
if (state == BrowserState::ERROR) { if (state == BrowserState::ERROR) {
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) { if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
@@ -33,7 +33,6 @@ class OpdsBookBrowserActivity final : public Activity {
std::string currentPath; std::string currentPath;
std::string searchTemplate; std::string searchTemplate;
bool consumeConfirm = false; bool consumeConfirm = false;
bool consumeBack = false; // Added missing member
int selectorIndex = 0; int selectorIndex = 0;
std::string errorMessage; std::string errorMessage;
std::string statusMessage; std::string statusMessage;
@@ -51,7 +51,6 @@ void NetworkModeSelectionActivity::loop() {
return; return;
} }
// Handle navigation
buttonNavigator.onNext([this] { buttonNavigator.onNext([this] {
selectedIndex = ButtonNavigator::nextIndex(selectedIndex, MENU_ITEM_COUNT); selectedIndex = ButtonNavigator::nextIndex(selectedIndex, MENU_ITEM_COUNT);
requestUpdate(); requestUpdate();
@@ -86,7 +85,6 @@ void NetworkModeSelectionActivity::render(RenderLock&&) {
[](int index) { return std::string(I18N.get(menuItems[index])); }, [](int index) { return std::string(I18N.get(menuItems[index])); },
[](int index) { return std::string(I18N.get(menuDescs[index])); }, [](int index) { return menuIcons[index]; }); [](int index) { return std::string(I18N.get(menuDescs[index])); }, [](int index) { return menuIcons[index]; });
// Draw help text at bottom
const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN)); const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN));
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
@@ -463,7 +463,6 @@ void WifiSelectionActivity::loop() {
} }
} }
// Handle navigation
buttonNavigator.onNext([this] { buttonNavigator.onNext([this] {
selectedNetworkIndex = ButtonNavigator::nextIndex(selectedNetworkIndex, networks.size()); selectedNetworkIndex = ButtonNavigator::nextIndex(selectedNetworkIndex, networks.size());
requestUpdate(); requestUpdate();
@@ -723,7 +723,6 @@ void EpubReaderActivity::pageTurn(bool isForwardTurn) {
requestUpdate(); requestUpdate();
} }
// TODO: Failure handling
void EpubReaderActivity::render(RenderLock&& lock) { void EpubReaderActivity::render(RenderLock&& lock) {
if (!epub) { if (!epub) {
return; return;
@@ -20,7 +20,11 @@ void EpubReaderFootnotesActivity::onEnter() {
void EpubReaderFootnotesActivity::onExit() { Activity::onExit(); } void EpubReaderFootnotesActivity::onExit() { Activity::onExit(); }
void EpubReaderFootnotesActivity::loop() { void EpubReaderFootnotesActivity::loop() {
const int visibleCount = std::max(1, renderer.getScreenHeight() / 36); constexpr int lineHeight = 36;
const auto orientation = renderer.getOrientation();
const bool isPortraitInverted = orientation == GfxRenderer::Orientation::PortraitInverted;
const int contentY = isPortraitInverted ? 50 : 0;
const int visibleCount = std::max(1, (renderer.getScreenHeight() - contentY) / lineHeight);
if (mappedInput.wasListScroll(selectedIndex, static_cast<int>(footnotes.size()), visibleCount)) { if (mappedInput.wasListScroll(selectedIndex, static_cast<int>(footnotes.size()), visibleCount)) {
requestUpdate(); requestUpdate();
return; return;
@@ -46,7 +46,6 @@ void EpubReaderMenuActivity::onEnter() {
void EpubReaderMenuActivity::onExit() { Activity::onExit(); } void EpubReaderMenuActivity::onExit() { Activity::onExit(); }
void EpubReaderMenuActivity::loop() { void EpubReaderMenuActivity::loop() {
// Handle navigation
buttonNavigator.onNext([this] { buttonNavigator.onNext([this] {
selectedIndex = ButtonNavigator::nextIndex(selectedIndex, static_cast<int>(menuItems.size())); selectedIndex = ButtonNavigator::nextIndex(selectedIndex, static_cast<int>(menuItems.size()));
requestUpdate(); requestUpdate();
@@ -52,7 +52,6 @@ void KOReaderSettingsActivity::loop() {
return; return;
} }
// Handle navigation
buttonNavigator.onNext([this] { buttonNavigator.onNext([this] {
selectedIndex = (selectedIndex + 1) % MENU_ITEMS; selectedIndex = (selectedIndex + 1) % MENU_ITEMS;
requestUpdate(); requestUpdate();
@@ -156,7 +155,6 @@ void KOReaderSettingsActivity::render(RenderLock&&) {
}, },
true); true);
// Draw help text at bottom
const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN)); const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN));
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
@@ -57,7 +57,6 @@ void LanguageSelectActivity::loop() {
return; return;
} }
// Handle navigation
buttonNavigator.onNextRelease([this] { buttonNavigator.onNextRelease([this] {
selectedIndex = ButtonNavigator::nextIndex(static_cast<int>(selectedIndex), totalItems); selectedIndex = ButtonNavigator::nextIndex(static_cast<int>(selectedIndex), totalItems);
requestUpdate(); requestUpdate();
@@ -189,7 +189,6 @@ void SettingsActivity::loop() {
return; return;
} }
// Handle navigation
buttonNavigator.onNextRelease([this] { buttonNavigator.onNextRelease([this] {
selectedSettingIndex = ButtonNavigator::nextIndex(selectedSettingIndex, settingsCount + 1); selectedSettingIndex = ButtonNavigator::nextIndex(selectedSettingIndex, settingsCount + 1);
requestUpdate(); requestUpdate();
@@ -429,7 +428,6 @@ void SettingsActivity::render(RenderLock&&) {
}, },
true); true);
// Draw help text
const auto confirmLabel = const auto confirmLabel =
(selectedSettingIndex == 0) (selectedSettingIndex == 0)
? I18N.get(categoryNames[(selectedCategoryIndex + 1) % categoryCount]) ? I18N.get(categoryNames[(selectedCategoryIndex + 1) % categoryCount])
@@ -150,7 +150,6 @@ void StatusBarSettingsActivity::loop() {
return; return;
} }
// Handle navigation
buttonNavigator.onNextRelease([this] { buttonNavigator.onNextRelease([this] {
selectedIndex = ButtonNavigator::nextIndex(selectedIndex, visibleItemCount); selectedIndex = ButtonNavigator::nextIndex(selectedIndex, visibleItemCount);
requestUpdate(); requestUpdate();
@@ -107,13 +107,9 @@ void BmpViewerActivity::onEnter() {
GUI.fillPopupProgress(renderer, popupRect, 50); GUI.fillPopupProgress(renderer, popupRect, 50);
renderer.clearScreen(); renderer.clearScreen();
// Assuming drawBitmap defaults to 0,0 crop if omitted, or pass explicitly: drawBitmap(bitmap, x, y, pageWidth,
// pageHeight, 0, 0)
renderer.drawBitmap(bitmap, x, y, pageWidth, pageHeight, 0, 0); renderer.drawBitmap(bitmap, x, y, pageWidth, pageHeight, 0, 0);
// Draw UI hints on the base layer
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
// Single pass for non-grayscale images
renderer.displayBuffer(HalDisplay::FAST_REFRESH); renderer.displayBuffer(HalDisplay::FAST_REFRESH);