Add Receiver sub-menu, Transponders item and sub-menu.

This commit is contained in:
Jared Boone 2016-01-24 22:38:36 -08:00
parent e04e72abe7
commit 5ecc6d0330
10 changed files with 46 additions and 22 deletions

View File

@ -297,7 +297,7 @@ void AISRecentEntryDetailView::set_entry(const AISRecentEntry& entry) {
set_dirty();
}
AISAppView::AISAppView() {
AISAppView::AISAppView(NavigationView&) {
add_children({ {
&recent_entries_view,
&recent_entry_detail_view,

View File

@ -23,6 +23,8 @@
#define __AIS_APP_H__
#include "ui_widget.hpp"
#include "ui_navigation.hpp"
#include "log_file.hpp"
#include "ais_packet.hpp"
@ -129,7 +131,7 @@ private:
class AISAppView : public View {
public:
AISAppView();
AISAppView(NavigationView& nav);
~AISAppView();
void set_parent_rect(const Rect new_parent_rect) override;

View File

@ -93,7 +93,7 @@ void RecentEntriesView<ERTRecentEntries>::draw(
painter.draw_string(target_rect.pos, draw_style, line);
}
ERTAppView::ERTAppView() {
ERTAppView::ERTAppView(NavigationView&) {
add_children({ {
&recent_entries_view,
} });

View File

@ -22,6 +22,8 @@
#ifndef __ERT_APP_H__
#define __ERT_APP_H__
#include "ui_navigation.hpp"
#include "log_file.hpp"
#include "ert_packet.hpp"
@ -72,7 +74,7 @@ using ERTRecentEntriesView = RecentEntriesView<ERTRecentEntries>;
class ERTAppView : public View {
public:
ERTAppView();
ERTAppView(NavigationView& nav);
~ERTAppView();
void set_parent_rect(const Rect new_parent_rect) override;

View File

@ -199,7 +199,7 @@ void RecentEntriesView<TPMSRecentEntries>::draw(
painter.draw_string(target_rect.pos, draw_style, line);
}
TPMSAppView::TPMSAppView() {
TPMSAppView::TPMSAppView(NavigationView&) {
add_children({ {
&recent_entries_view,
} });

View File

@ -22,6 +22,8 @@
#ifndef __TPMS_APP_H__
#define __TPMS_APP_H__
#include "ui_navigation.hpp"
#include "field_reader.hpp"
#include "baseband_packet.hpp"
#include "manchester.hpp"
@ -195,7 +197,7 @@ using TPMSRecentEntriesView = RecentEntriesView<TPMSRecentEntries>;
class TPMSAppView : public View {
public:
TPMSAppView();
TPMSAppView(NavigationView& nav);
~TPMSAppView();
void set_parent_rect(const Rect new_parent_rect) override;

View File

@ -28,6 +28,10 @@
#include "ui_debug.hpp"
#include "ui_receiver.hpp"
#include "ais_app.hpp"
#include "ert_app.hpp"
#include "tpms_app.hpp"
#include "m4_startup.hpp"
namespace ui {
@ -88,11 +92,30 @@ void NavigationView::focus() {
}
}
/* TransceiversMenuView **************************************************/
TranspondersMenuView::TranspondersMenuView(NavigationView& nav) {
add_items<3>({ {
{ "AIS: Boats", [&nav](){ nav.push<AISAppView>(); } },
{ "ERT: Utility Meters", [&nav](){ nav.push<ERTAppView>(); } },
{ "TPMS: Cars", [&nav](){ nav.push<TPMSAppView>(); } },
} });
}
/* ReceiverMenuView ******************************************************/
ReceiverMenuView::ReceiverMenuView(NavigationView& nav) {
add_items<2>({ {
{ "Audio", [&nav](){ nav.push<ReceiverView>(); } },
{ "Transponders", [&nav](){ nav.push<TranspondersMenuView>(); } },
} });
}
/* SystemMenuView ********************************************************/
SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items<7>({ {
{ "Receiver", [&nav](){ nav.push<ReceiverView>(); } },
{ "Receiver", [&nav](){ nav.push<ReceiverMenuView>(); } },
{ "Capture", [&nav](){ nav.push<NotImplementedView>(); } },
{ "Analyze", [&nav](){ nav.push<NotImplementedView>(); } },
{ "Setup", [&nav](){ nav.push<SetupMenuView>(); } },

View File

@ -76,6 +76,16 @@ private:
View* push_view(std::unique_ptr<View> new_view);
};
class TranspondersMenuView : public MenuView {
public:
TranspondersMenuView(NavigationView& nav);
};
class ReceiverMenuView : public MenuView {
public:
ReceiverMenuView(NavigationView& nav);
};
class SystemMenuView : public MenuView {
public:
SystemMenuView(NavigationView& nav);

View File

@ -514,22 +514,10 @@ void ReceiverView::on_modulation_changed(ReceiverModel::Mode mode) {
widget_content = std::make_unique<AnalogAudioView>(mode);
break;
case ReceiverModel::Mode::AIS:
widget_content = std::make_unique<AISAppView>();
break;
case ReceiverModel::Mode::SpectrumAnalysis:
widget_content = std::make_unique<SpectrumAnalysisView>();
break;
case ReceiverModel::Mode::TPMS:
widget_content = std::make_unique<TPMSAppView>();
break;
case ReceiverModel::Mode::ERT:
widget_content = std::make_unique<ERTAppView>();
break;
default:
break;
}

View File

@ -407,9 +407,6 @@ private:
{ " AM ", toUType(ReceiverModel::Mode::AMAudio) },
{ "NFM ", toUType(ReceiverModel::Mode::NarrowbandFMAudio) },
{ "WFM ", toUType(ReceiverModel::Mode::WidebandFMAudio) },
{ "AIS ", toUType(ReceiverModel::Mode::AIS) },
{ "TPMS", toUType(ReceiverModel::Mode::TPMS) },
{ "ERT", toUType(ReceiverModel::Mode::ERT) },
{ "SPEC", toUType(ReceiverModel::Mode::SpectrumAnalysis) },
}
};