1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Fix renumberate deviceset without modifying claimed of SamplingDevice

This commit is contained in:
mxi-box 2024-02-28 06:46:35 +08:00
parent 480241fa8e
commit 2de9f16be4
3 changed files with 17 additions and 0 deletions

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QGlobalStatic> #include <QGlobalStatic>
#include <functional>
#include "deviceenumerator.h" #include "deviceenumerator.h"
@ -432,6 +433,20 @@ void DeviceEnumerator::removeMIMOSelection(int tabIndex)
} }
} }
void DeviceEnumerator::renumeratetabIndex(int skippedTabIndex)
{
std::reference_wrapper<DevicesEnumeration> denums[] = {m_rxEnumeration, m_txEnumeration, m_mimoEnumeration};
for (DevicesEnumeration &denum : denums)
{
for (DevicesEnumeration::iterator it = denum.begin(); it != denum.end(); ++it)
{
if (it->m_samplingDevice.claimed > skippedTabIndex) {
it->m_samplingDevice.claimed--;
}
}
}
}
int DeviceEnumerator::getFileInputDeviceIndex() const int DeviceEnumerator::getFileInputDeviceIndex() const
{ {
for (DevicesEnumeration::const_iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it) for (DevicesEnumeration::const_iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it)

View File

@ -52,6 +52,7 @@ public:
void removeRxSelection(int tabIndex); void removeRxSelection(int tabIndex);
void removeTxSelection(int tabIndex); void removeTxSelection(int tabIndex);
void removeMIMOSelection(int tabIndex); void removeMIMOSelection(int tabIndex);
void renumeratetabIndex(int skippedTabIndex);
int getNbRxSamplingDevices() const { return m_rxEnumeration.size(); } int getNbRxSamplingDevices() const { return m_rxEnumeration.size(); }
int getNbTxSamplingDevices() const { return m_txEnumeration.size(); } int getNbTxSamplingDevices() const { return m_txEnumeration.size(); }
int getNbMIMOSamplingDevices() const { return m_mimoEnumeration.size(); } int getNbMIMOSamplingDevices() const { return m_mimoEnumeration.size(); }

View File

@ -1072,6 +1072,7 @@ void MainWindow::removeDeviceSet(int deviceSetIndex)
m_deviceUIs.erase(m_deviceUIs.begin() + deviceSetIndex); m_deviceUIs.erase(m_deviceUIs.begin() + deviceSetIndex);
m_mainCore->removeDeviceSet(deviceSetIndex); m_mainCore->removeDeviceSet(deviceSetIndex);
DeviceEnumerator::instance()->renumeratetabIndex(deviceSetIndex);
// Renumerate // Renumerate
for (int i = 0; i < (int) m_deviceUIs.size(); i++) for (int i = 0; i < (int) m_deviceUIs.size(); i++)