- Added MainUIHandler class to manage the main UI and polling for arrival data. - Introduced SettingsUI class for displaying QR code and configuration options. - Created SettingsUIHandler to manage settings UI lifecycle and web server interactions. - Developed WebHandler to handle HTTP requests for MTR route settings, including adding and removing routes. - Implemented web endpoints for fetching MTR lines, routes, and saving settings. - Enhanced UI with responsive design for e-ink displays and added error handling for web interactions.
39 lines
784 B
C++
39 lines
784 B
C++
#pragma once
|
|
|
|
#include "lvgl.h"
|
|
#include "esp_err.h"
|
|
#include <string>
|
|
|
|
namespace travel {
|
|
|
|
/**
|
|
* @brief Settings UI for Travel app
|
|
*
|
|
* Displays QR code for web configuration.
|
|
* E-ink optimized: no animations, static layout.
|
|
*/
|
|
class SettingsUI {
|
|
public:
|
|
SettingsUI();
|
|
~SettingsUI();
|
|
|
|
esp_err_t init(lv_obj_t* parent);
|
|
esp_err_t deinit();
|
|
|
|
void update_qr_code(const std::string& url);
|
|
void update_status_message(const std::string& message);
|
|
|
|
private:
|
|
lv_obj_t* parent_ = nullptr;
|
|
lv_obj_t* container_ = nullptr;
|
|
lv_obj_t* title_label_ = nullptr;
|
|
lv_obj_t* qr_code_ = nullptr;
|
|
lv_obj_t* url_label_ = nullptr;
|
|
lv_obj_t* status_label_ = nullptr;
|
|
lv_obj_t* instruction_label_ = nullptr;
|
|
|
|
static constexpr int QR_CODE_SIZE = 160;
|
|
};
|
|
|
|
} // namespace travel
|