2026-05-12 14:45:02 +02:00
|
|
|
#pragma once
|
|
|
|
|
// Custom screen — not part of upstream UITask.cpp
|
|
|
|
|
// Included by UITask.cpp just before HomeScreen.
|
|
|
|
|
|
|
|
|
|
class ToolsScreen : public UIScreen {
|
|
|
|
|
UITask* _task;
|
|
|
|
|
int _sel;
|
|
|
|
|
|
2026-05-25 08:22:12 +02:00
|
|
|
static const int ITEM_COUNT = 5;
|
2026-05-12 14:45:02 +02:00
|
|
|
static const char* ITEMS[ITEM_COUNT];
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ToolsScreen(UITask* task) : _task(task), _sel(0) {}
|
|
|
|
|
|
|
|
|
|
int render(DisplayDriver& display) override {
|
|
|
|
|
display.setTextSize(1);
|
|
|
|
|
display.setColor(DisplayDriver::LIGHT);
|
|
|
|
|
display.drawTextCentered(display.width() / 2, 0, "TOOLS");
|
2026-05-22 23:13:27 +02:00
|
|
|
display.fillRect(0, display.headerH() - 1, display.width(), display.sepH());
|
2026-05-22 18:34:20 +02:00
|
|
|
|
|
|
|
|
int item_h = display.lineStep();
|
|
|
|
|
int start_y = display.listStart();
|
|
|
|
|
int cw = display.getCharWidth();
|
2026-05-12 14:45:02 +02:00
|
|
|
|
|
|
|
|
for (int i = 0; i < ITEM_COUNT; i++) {
|
2026-05-22 18:34:20 +02:00
|
|
|
int y = start_y + i * item_h;
|
2026-05-12 14:45:02 +02:00
|
|
|
bool sel = (i == _sel);
|
2026-05-24 20:33:02 +02:00
|
|
|
display.drawSelectionRow(0, y - 1, display.width(), item_h, sel);
|
2026-05-12 14:45:02 +02:00
|
|
|
display.setCursor(0, y);
|
|
|
|
|
display.print(sel ? ">" : " ");
|
2026-05-22 18:34:20 +02:00
|
|
|
display.setCursor(cw + 2, y);
|
2026-05-12 14:45:02 +02:00
|
|
|
display.print(ITEMS[i]);
|
|
|
|
|
}
|
|
|
|
|
display.setColor(DisplayDriver::LIGHT);
|
|
|
|
|
return 500;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool handleInput(char c) override {
|
|
|
|
|
if (c == KEY_UP && _sel > 0) { _sel--; return true; }
|
|
|
|
|
if (c == KEY_DOWN && _sel < ITEM_COUNT - 1) { _sel++; return true; }
|
|
|
|
|
if (c == KEY_CANCEL || c == KEY_CONTEXT_MENU) { _task->gotoHomeScreen(); return true; }
|
|
|
|
|
if (c == KEY_ENTER) {
|
2026-05-14 16:08:33 +02:00
|
|
|
if (_sel == 0) { _task->gotoRingtoneEditor(); return true; }
|
|
|
|
|
if (_sel == 1) { _task->gotoBotScreen(); return true; }
|
|
|
|
|
if (_sel == 2) { _task->gotoNearbyScreen(); return true; }
|
|
|
|
|
if (_sel == 3) { _task->gotoAutoAdvertScreen(); return true; }
|
2026-05-25 09:10:40 +02:00
|
|
|
if (_sel == 4) { _task->gotoTrailScreen(); return true; }
|
2026-05-12 14:45:02 +02:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-05-25 09:10:40 +02:00
|
|
|
const char* ToolsScreen::ITEMS[5] = { "Ringtone Editor", "Auto-Reply Bot", "Nearby Nodes", "Auto-Advert", "Trail" };
|