mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-21 14:09:12 -04:00
Wrap message handler registrations in class to subscribe/unsubscribe automatically.
This commit is contained in:
parent
e298e1ec5a
commit
7d4dd03418
18 changed files with 139 additions and 149 deletions
|
@ -21,8 +21,6 @@
|
|||
|
||||
#include "ui_baseband_stats_view.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -41,19 +39,6 @@ BasebandStatsView::BasebandStatsView() {
|
|||
} });
|
||||
}
|
||||
|
||||
void BasebandStatsView::on_show() {
|
||||
EventDispatcher::message_map().register_handler(Message::ID::BasebandStatistics,
|
||||
[this](const Message* const p) {
|
||||
this->on_statistics_update(static_cast<const BasebandStatisticsMessage*>(p)->statistics);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void BasebandStatsView::on_hide() {
|
||||
EventDispatcher::message_map().unregister_handler(Message::ID::BasebandStatistics);
|
||||
}
|
||||
|
||||
|
||||
static std::string ticks_to_percent_string(const uint32_t ticks) {
|
||||
constexpr size_t decimal_digits = 1;
|
||||
constexpr size_t decimal_factor = decimal_digits * 10;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue