Skip to content

Commit

Permalink
DeviceGUI: removed destroy method. Part of #2159
Browse files Browse the repository at this point in the history
  • Loading branch information
f4exb committed Sep 7, 2024
1 parent 5d0fa7f commit 37e06de
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 297 deletions.
129 changes: 66 additions & 63 deletions plugins/channelrx/wdsprx/wdsprx.cpp

Large diffs are not rendered by default.

100 changes: 50 additions & 50 deletions plugins/channelrx/wdsprx/wdsprx.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,34 @@ class WDSPRx : public BasebandSampleSink, public ChannelAPI {
{ }
};

WDSPRx(DeviceAPI *deviceAPI);
virtual ~WDSPRx();
virtual void destroy() { delete this; }
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
explicit WDSPRx(DeviceAPI *deviceAPI);
~WDSPRx() final;
void destroy() final { delete this; }
void setDeviceAPI(DeviceAPI *deviceAPI) final;
DeviceAPI *getDeviceAPI() final { return m_deviceAPI; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }

using BasebandSampleSink::feed;
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start();
virtual void stop();
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); }
virtual QString getSinkName() { return objectName(); }

virtual void getIdentifier(QString& id) { id = objectName(); }
virtual QString getIdentifier() const { return objectName(); }
virtual void getTitle(QString& title) { title = m_settings.m_title; }
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; }
virtual void setCenterFrequency(qint64 frequency);

virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);

virtual int getNbSinkStreams() const { return 1; }
virtual int getNbSourceStreams() const { return 0; }
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }

virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po) final;
void start() final;
void stop() final;
void pushMessage(Message *msg) final { m_inputMessageQueue.push(msg); }
QString getSinkName() final { return objectName(); }

void getIdentifier(QString& id) final { id = objectName(); }
QString getIdentifier() const final { return objectName(); }
void getTitle(QString& title) final { title = m_settings.m_title; }
qint64 getCenterFrequency() const final { return m_settings.m_inputFrequencyOffset; }
void setCenterFrequency(qint64 frequency) final;

QByteArray serialize() const final;
bool deserialize(const QByteArray& data) final;

int getNbSinkStreams() const final { return 1; }
int getNbSourceStreams() const final { return 0; }
int getStreamIndex() const final { return m_settings.m_streamIndex; }

qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const final
{
(void) streamIndex;
(void) sinkElseSource;
Expand All @@ -116,32 +116,32 @@ class WDSPRx : public BasebandSampleSink, public ChannelAPI {
}
}

virtual int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage);
int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage) final;

virtual int webapiWorkspaceGet(
SWGSDRangel::SWGWorkspaceInfo& response,
QString& errorMessage);
int webapiWorkspaceGet(
SWGSDRangel::SWGWorkspaceInfo& response,
QString& errorMessage) final;

virtual int webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage);
int webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage) final;

virtual int webapiReportGet(
SWGSDRangel::SWGChannelReport& response,
QString& errorMessage);
int webapiReportGet(
SWGSDRangel::SWGChannelReport& response,
QString& errorMessage) final;

static void webapiFormatChannelSettings(
SWGSDRangel::SWGChannelSettings& response,
const WDSPRxSettings& settings);

static void webapiUpdateChannelSettings(
WDSPRxSettings& settings,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response);
WDSPRxSettings& settings,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response);

uint32_t getNumberOfDeviceStreams() const;

Expand All @@ -161,26 +161,26 @@ class WDSPRx : public BasebandSampleSink, public ChannelAPI {
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;

virtual bool handleMessage(const Message& cmd);
bool handleMessage(const Message& cmd) final;
void applySettings(const WDSPRxSettings& settings, bool force = false);
void sendSampleRateToDemodAnalyzer();
void sendSampleRateToDemodAnalyzer() const;
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const WDSPRxSettings& settings, bool force);
void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const WDSPRxSettings& settings, bool force);
void sendChannelSettings(
const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys,
const QList<QString>& channelSettingsKeys,
const WDSPRxSettings& settings,
bool force
);
) const;
void webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys,
const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const WDSPRxSettings& settings,
bool force
);
) const;

private slots:
void networkManagerFinished(QNetworkReply *reply);
void networkManagerFinished(QNetworkReply *reply) const;
void handleIndexInDeviceSetChanged(int index);
};

Expand Down
7 changes: 2 additions & 5 deletions plugins/channelrx/wdsprx/wdsprxgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ WDSPRxGUI* WDSPRxGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
return gui;
}

void WDSPRxGUI::destroy()
{
delete this;
}

void WDSPRxGUI::resetToDefaults()
{
m_settings.resetToDefaults();
Expand Down Expand Up @@ -610,6 +605,7 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam

WDSPRxGUI::~WDSPRxGUI()
{
qDebug("WDSPRxGUI::~WDSPRxGUI");
delete ui;
delete m_audioMuteRightClickEnabler;
delete m_agcRightClickEnabler;
Expand All @@ -620,6 +616,7 @@ WDSPRxGUI::~WDSPRxGUI()
delete m_equalizerRightClickEnabler;
delete m_panRightClickEnabler;
delete m_demodRightClickEnabler;
qDebug("WDSPRxGUI::~WDSPRxGUI: end");
}

bool WDSPRxGUI::blockApplySettings(bool block)
Expand Down
1 change: 0 additions & 1 deletion plugins/channelrx/wdsprx/wdsprxgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class WDSPRxGUI : public ChannelGUI {

public:
static WDSPRxGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel);
virtual void destroy();

void resetToDefaults() final;
QByteArray serialize() const final;
Expand Down
Loading

0 comments on commit 37e06de

Please sign in to comment.