mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Switching between waterfall and console mode.
Also remove an unused Console constructor.
This commit is contained in:
parent
d0f35cf89d
commit
be94c9fa9b
@ -32,12 +32,6 @@ namespace ui {
|
||||
|
||||
class Console : public Widget {
|
||||
public:
|
||||
constexpr Console(
|
||||
const Rect parent_rect
|
||||
) : Widget { parent_rect }
|
||||
{
|
||||
}
|
||||
|
||||
void clear();
|
||||
void write(const std::string message);
|
||||
void writeln(const std::string message);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "ui_navigation.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
#include "receiver_model.hpp"
|
||||
|
||||
#include "ui_setup.hpp"
|
||||
@ -93,7 +94,7 @@ void NavigationView::focus() {
|
||||
|
||||
SystemMenuView::SystemMenuView(NavigationView& nav) {
|
||||
add_items<7>({ {
|
||||
{ "Receiver", [&nav](){ nav.push(new ReceiverView { nav, receiver_model }); } },
|
||||
{ "Receiver", [&nav](){ nav.push(new ReceiverView { nav, portapack::receiver_model }); } },
|
||||
{ "Capture", [&nav](){ nav.push(new NotImplementedView { nav }); } },
|
||||
{ "Analyze", [&nav](){ nav.push(new NotImplementedView { nav }); } },
|
||||
{ "Setup", [&nav](){ nav.push(new SetupMenuView { nav }); } },
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
#include "ui_receiver.hpp"
|
||||
|
||||
#include "ui_spectrum.hpp"
|
||||
#include "ui_console.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
using namespace portapack;
|
||||
|
||||
@ -402,7 +405,6 @@ ReceiverView::ReceiverView(
|
||||
&field_volume,
|
||||
&view_frequency_options,
|
||||
&view_rf_gain_options,
|
||||
&waterfall,
|
||||
} });
|
||||
|
||||
button_done.on_select = [&nav](Button&){
|
||||
@ -562,6 +564,26 @@ void ReceiverView::on_modulation_changed(int32_t modulation) {
|
||||
break;
|
||||
}
|
||||
|
||||
remove_child(widget_content.get());
|
||||
widget_content.reset();
|
||||
|
||||
switch(modulation) {
|
||||
case 3:
|
||||
widget_content = std::make_unique<Console>();
|
||||
add_child(widget_content.get());
|
||||
break;
|
||||
|
||||
default:
|
||||
widget_content = std::make_unique<spectrum::WaterfallWidget>();
|
||||
add_child(widget_content.get());
|
||||
break;
|
||||
}
|
||||
|
||||
if( widget_content ) {
|
||||
const ui::Dim header_height = 3 * 16;
|
||||
const ui::Rect rect { 0, header_height, parent_rect.width(), static_cast<ui::Dim>(parent_rect.height() - header_height) };
|
||||
widget_content->set_parent_rect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
void ReceiverView::on_show_options_frequency() {
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_painter.hpp"
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_spectrum.hpp"
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
@ -456,7 +455,7 @@ private:
|
||||
&style_options_group
|
||||
};
|
||||
|
||||
spectrum::WaterfallWidget waterfall;
|
||||
std::unique_ptr<Widget> widget_content;
|
||||
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
void on_baseband_bandwidth_changed(uint32_t bandwidth_hz);
|
||||
|
Loading…
Reference in New Issue
Block a user