From e2ce645c7409e62ffd6acec756adaa517dcfca4d Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 23 Aug 2017 23:44:50 +0200 Subject: [PATCH] UDP sink plugin: implemented new rollup menu behavior --- plugins/channeltx/udpsink/udpsinkgui.cpp | 13 +++++++++++-- plugins/channeltx/udpsink/udpsinkgui.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/channeltx/udpsink/udpsinkgui.cpp b/plugins/channeltx/udpsink/udpsinkgui.cpp index 00df4b431..84fe9aa79 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.cpp +++ b/plugins/channeltx/udpsink/udpsinkgui.cpp @@ -227,6 +227,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* m_tickCount(0), m_channelMarker(this), m_basicSettingsShown(false), + m_bcsw(0), m_doApplySettings(true) { ui->setupUi(this); @@ -278,6 +279,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* UDPSinkGUI::~UDPSinkGUI() { + if (m_bcsw) delete m_bcsw; m_deviceAPI->removeChannelInstance(this); m_deviceAPI->removeThreadedSource(m_threadedChannelizer); delete m_threadedChannelizer; @@ -546,8 +548,15 @@ void UDPSinkGUI::onMenuDoubleClicked() if (!m_basicSettingsShown) { m_basicSettingsShown = true; - BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this); - bcsw->show(); + m_bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this); + m_bcsw->show(); + } + else + { + m_basicSettingsShown = false; + m_bcsw->hide(); + delete m_bcsw; + m_bcsw = 0; } } diff --git a/plugins/channeltx/udpsink/udpsinkgui.h b/plugins/channeltx/udpsink/udpsinkgui.h index 04470f9b6..88541990f 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.h +++ b/plugins/channeltx/udpsink/udpsinkgui.h @@ -31,6 +31,7 @@ class ThreadedBasebandSampleSource; class UpChannelizer; class UDPSink; class SpectrumVis; +class BasicChannelSettingsWidget; namespace Ui { class UDPSinkGUI; @@ -96,6 +97,7 @@ private: QString m_udpAddress; int m_udpPort; bool m_basicSettingsShown; + BasicChannelSettingsWidget *m_bcsw; bool m_doApplySettings; explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);