Date and time display widget

Disabled handwriting text input (not that useful for now)
Bugfix: Trim long filenames in fileman
Slight cleanup of 7-seg display widget
This commit is contained in:
furrtek 2017-09-20 07:50:59 +01:00
parent 37ce81383d
commit c0f51c2690
11 changed files with 162 additions and 143 deletions

View file

@ -28,6 +28,7 @@
#include "ui_painter.hpp"
#include "ui_focus.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "rtc_time.hpp"
#include "radio.hpp"
#include "portapack.hpp"
@ -235,6 +236,25 @@ private:
std::vector<Label> labels_;
};
class LiveDateTime : public Widget {
public:
LiveDateTime(Rect parent_rect);
~LiveDateTime();
void paint(Painter& painter) override;
std::string& string() {
return text;
}
private:
void on_tick_second();
rtc::RTC datetime { };
SignalToken signal_token_tick_second { };
std::string text { };
};
class BigFrequency : public Widget {
public:
BigFrequency(Rect parent_rect, rf::Frequency frequency);
@ -246,6 +266,8 @@ public:
private:
rf::Frequency _frequency;
static constexpr Dim digit_width = 32;
const uint8_t segment_font[11] = {
0b00111111, // 0: ABCDEF
0b00000110, // 1: AB
@ -259,6 +281,16 @@ private:
0b01101111, // 9: ABCDFG
0b01000000 // -: G
};
const Rect segments[7] = {
{{4, 0}, {20, 4}},
{{24, 4}, {4, 20}},
{{24, 28}, {4, 20}},
{{4, 48}, {20, 4}},
{{0, 28}, {4, 20}},
{{0, 4}, {4, 20}},
{{4, 24}, {20, 4}}
};
};
class ProgressBar : public Widget {