1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-05 07:24:44 -04:00

Web API: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex} DELETE implemented in GUI also

This commit is contained in:
f4exb
2017-12-23 23:41:37 +01:00
parent b011185e42
commit ead034e21d
90 changed files with 1866 additions and 1714 deletions
+24
View File
@@ -69,6 +69,7 @@ MESSAGE_CLASS_DEFINITION(MainWindow::MsgAddDeviceSet, Message)
MESSAGE_CLASS_DEFINITION(MainWindow::MsgRemoveLastDeviceSet, Message)
MESSAGE_CLASS_DEFINITION(MainWindow::MsgSetDevice, Message)
MESSAGE_CLASS_DEFINITION(MainWindow::MsgAddChannel, Message)
MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeleteChannel, Message)
MainWindow *MainWindow::m_instance = 0;
@@ -456,6 +457,23 @@ void MainWindow::removeLastDevice()
m_deviceUIs.pop_back();
}
void MainWindow::deleteChannel(int deviceSetIndex, int channelIndex)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_deviceUIs[deviceSetIndex];
if (deviceSet->m_deviceSourceEngine) // source device => Rx channels
{
deviceSet->deleteRxChannel(channelIndex);
}
else if (deviceSet->m_deviceSinkEngine) // sink device => Tx channels
{
deviceSet->deleteTxChannel(channelIndex);
}
}
}
void MainWindow::addChannelRollup(int deviceTabIndex, QWidget* widget)
{
if (deviceTabIndex < ui->tabInputsView->count())
@@ -755,6 +773,12 @@ bool MainWindow::handleMessage(const Message& cmd)
return true;
}
else if (MsgDeleteChannel::match(cmd))
{
MsgDeleteChannel& notif = (MsgDeleteChannel&) cmd;
deleteChannel(notif.getDeviceSetIndex(), notif.getChannelIndex());
return true;
}
return false;
}