cleanup & formatting

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 23ef7a9609
commit 8639a7829d
4 changed files with 24 additions and 24 deletions
@@ -117,7 +117,6 @@ class FlashDialog: public FullScreenDialog
device(device), device(device),
progress(this, {LCD_W / 2 - 50, LCD_H / 2, 100, 15}) progress(this, {LCD_W / 2 - 50, LCD_H / 2, 100, 15})
{ {
// setFocus();
} }
void deleteLater(bool detach = true, bool trash = true) override void deleteLater(bool detach = true, bool trash = true) override
+21 -16
View File
@@ -160,28 +160,33 @@ class DateTimeWindow : public FormGroup {
} }
}; };
class WindowButtonGroup : public FormGroup { class WindowButtonGroup : public FormGroup
public: {
WindowButtonGroup(FormGroup * parent, const rect_t & rect, std::vector<std::pair<const char*, std::function<void()> >> windows) : public:
WindowButtonGroup(
FormGroup* parent, const rect_t& rect,
std::vector<std::pair<const char*, std::function<void()>>> windows) :
FormGroup(parent, rect, FORWARD_SCROLL | FORM_FORWARD_FOCUS), FormGroup(parent, rect, FORWARD_SCROLL | FORM_FORWARD_FOCUS),
windows(windows) windows(windows)
{ {
build(); build();
} }
protected: protected:
std::vector<std::pair<const char*, std::function<void()> >> windows; std::vector<std::pair<const char*, std::function<void()>>> windows;
void build() void build()
{ {
FormGridLayout grid; FormGridLayout grid;
for(auto entry: windows) for (auto entry : windows) {
{ new TextButton(this, grid.getLabelSlot(), entry.first, [&, entry]() {
new TextButton(this, grid.getLabelSlot(), entry.first, [&, entry](){entry.second(); return 1;}); entry.second();
grid.nextLine(); return 0;
} });
grid.nextLine();
} }
}
}; };
static const lv_coord_t line_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), static const lv_coord_t line_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
+2 -6
View File
@@ -259,12 +259,6 @@ void ViewMain::onEvent(event_t event)
new ScreenMenu(); new ScreenMenu();
break; break;
// // do not use KEY_FIRST as it would
// // interfere with the menu CLICKED event
// case EVT_KEY_FIRST(KEY_ENTER):
// openMenu();
// break;
#if defined(KEYS_GPIO_REG_PGUP) #if defined(KEYS_GPIO_REG_PGUP)
case EVT_KEY_FIRST(KEY_PGDN): case EVT_KEY_FIRST(KEY_PGDN):
#else #else
@@ -284,6 +278,8 @@ void ViewMain::onEvent(event_t event)
previousMainView(); previousMainView();
break; break;
// TODO: find something to activate widget selection via keys
// case EVT_ROTARY_LEFT: // case EVT_ROTARY_LEFT:
// // decrement // // decrement
// case EVT_ROTARY_RIGHT: // case EVT_ROTARY_RIGHT: