AISView constructors out of header.

This commit is contained in:
Jared Boone 2016-01-13 16:44:01 -08:00
parent f8a063312c
commit 94b73d7825
2 changed files with 15 additions and 12 deletions

View File

@ -129,6 +129,18 @@ bool AISModel::on_packet(const ais::Packet& packet) {
namespace ui { namespace ui {
AISView::AISView() {
flags.focusable = true;
packet_signal_token = model.packet_signal += [this](const ais::Packet& packet) {
this->on_packet(packet);
};
}
AISView::~AISView() {
model.packet_signal -= packet_signal_token;
}
void AISView::truncate_entries() { void AISView::truncate_entries() {
while(recent.size() > 64) { while(recent.size() > 64) {
recent.pop_back(); recent.pop_back();

View File

@ -84,18 +84,9 @@ namespace ui {
class AISView : public View { class AISView : public View {
public: public:
AISView() { AISView();
flags.focusable = true; ~AISView();
packet_signal_token = model.packet_signal += [this](const ais::Packet& packet) {
this->on_packet(packet);
};
}
~AISView() {
model.packet_signal -= packet_signal_token;
}
void paint(Painter& painter) override; void paint(Painter& painter) override;
void on_focus() override; void on_focus() override;