Delete Feature in FeatureUISet

pull/655/head
f4exb 2020-10-04 10:30:49 +02:00
rodzic b1c9a35dcb
commit e9a32528d7
4 zmienionych plików z 10 dodań i 7 usunięć

Wyświetl plik

@ -145,7 +145,6 @@ RigCtlServerGUI::RigCtlServerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISe
RigCtlServerGUI::~RigCtlServerGUI()
{
delete m_rigCtlServer; // When the GUI closes it has to delete the demodulator because it can be done with (x)
delete ui;
}

Wyświetl plik

@ -160,7 +160,6 @@ SimplePTTGUI::SimplePTTGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Fea
SimplePTTGUI::~SimplePTTGUI()
{
delete m_simplePTT; // When the GUI closes it has to delete the demodulator because it can be done with (x)
delete ui;
}

Wyświetl plik

@ -33,6 +33,7 @@ FeatureUISet::FeatureUISet(int tabIndex)
FeatureUISet::~FeatureUISet()
{
freeFeatures();
delete m_featureWindow;
}
@ -48,7 +49,7 @@ void FeatureUISet::registerFeatureInstance(const QString& featureURI, FeatureGUI
featureGUI,
&FeatureGUI::closing,
this,
[=](){ this->handleClosingFeatureGUI(featureGUI); },
[=](){ this->handleClosingFeatureGUI(featureGUI, feature); },
Qt::QueuedConnection
);
}
@ -81,6 +82,7 @@ void FeatureUISet::freeFeatures()
{
qDebug("FeatureUISet::freeFeatures: destroying feature [%s]", qPrintable(m_featureInstanceRegistrations[i].m_featureURI));
m_featureInstanceRegistrations[i].m_gui->destroy();
m_featureInstanceRegistrations[i].m_feature->destroy();
}
}
@ -92,6 +94,7 @@ void FeatureUISet::deleteFeature(int featureIndex)
qPrintable(m_featureInstanceRegistrations[featureIndex].m_featureURI),
featureIndex);
m_featureInstanceRegistrations[featureIndex].m_gui->destroy();
m_featureInstanceRegistrations[featureIndex].m_feature->destroy();
}
}
@ -128,6 +131,7 @@ void FeatureUISet::loadFeatureSetSettings(const FeatureSetPreset *preset, Plugin
{
qDebug("FeatureUISet::loadFeatureSetSettings: destroying old feature [%s]", qPrintable(openFeatures[i].m_featureURI));
openFeatures[i].m_gui->destroy();
openFeatures[i].m_feature->destroy();
}
qDebug("FeatureUISet::loadFeatureSetSettings: %d feature(s) in preset", preset->getFeatureCount());
@ -175,8 +179,8 @@ void FeatureUISet::saveFeatureSetSettings(FeatureSetPreset *preset)
}
void FeatureUISet::handleClosingFeatureGUI(FeatureGUI *featureGUI)
void FeatureUISet::handleClosingFeatureGUI(FeatureGUI *featureGUI, Feature *feature)
{
qDebug("FeatureUISet::handleClosingFeatureGUI");
removeFeatureInstance(featureGUI);
feature->destroy();
}

Wyświetl plik

@ -43,7 +43,6 @@ public:
int getNumberOfFeatures() const { return m_featureInstanceRegistrations.size(); }
void registerFeatureInstance(const QString& featureURI, FeatureGUI* featureGUI, Feature *feature);
void removeFeatureInstance(FeatureGUI* featureGUI);
void freeFeatures();
void deleteFeature(int featureIndex);
const Feature *getFeatureAt(int featureIndex) const;
Feature *getFeatureAt(int featureIndex);
@ -79,8 +78,10 @@ private:
FeatureInstanceRegistrations m_featureInstanceRegistrations;
int m_featureTabIndex;
void freeFeatures();
private slots:
void handleClosingFeatureGUI(FeatureGUI *featureGUI);
void handleClosingFeatureGUI(FeatureGUI *featureGUI, Feature *feature);
};
#endif // SDRGUI_FEATURE_FEATUREUISET_H_