mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-06 11:28:30 -05:00
Multi device support: add a check button to confirm source input change
This commit is contained in:
parent
8e3e00e7e5
commit
ecbff75bf1
@ -39,6 +39,11 @@ QComboBox *SamplingDeviceControl::getDeviceSelector()
|
||||
return ui->deviceSelect;
|
||||
}
|
||||
|
||||
QPushButton *SamplingDeviceControl::getDeviceSelectionConfirm()
|
||||
{
|
||||
return ui->deviceConfirm;
|
||||
}
|
||||
|
||||
void SamplingDeviceControl::populateChannelSelector()
|
||||
{
|
||||
if (m_pluginManager)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "util/export.h"
|
||||
|
||||
@ -41,6 +42,7 @@ public:
|
||||
void setPluginManager(PluginManager *pluginManager) { m_pluginManager = pluginManager; }
|
||||
void setDeviceAPI(DeviceAPI *devieAPI) { m_deviceAPI = devieAPI; }
|
||||
QComboBox *getDeviceSelector();
|
||||
QPushButton *getDeviceSelectionConfirm();
|
||||
void populateChannelSelector();
|
||||
|
||||
private:
|
||||
|
@ -47,6 +47,32 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deviceConfirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Confirm and change sampling device</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/checkmark.png</normaloff>:/checkmark.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -201,7 +201,10 @@ void MainWindow::addDevice()
|
||||
|
||||
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(true);
|
||||
m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector());
|
||||
connect(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector(), SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
|
||||
|
||||
// connect(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector(), SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
|
||||
connect(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelectionConfirm(), SIGNAL(clicked(bool)), this, SLOT(on_sampleSource_confirmClicked(bool)));
|
||||
|
||||
m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(sampleSourceSignalsBlocked);
|
||||
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
|
||||
|
||||
@ -681,6 +684,25 @@ void MainWindow::on_sampleSource_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_sampleSource_confirmClicked(bool checked)
|
||||
{
|
||||
// Do it in the currently selected source tab
|
||||
int currentSourceTabIndex = ui->tabInputsSelect->currentIndex();
|
||||
|
||||
if (currentSourceTabIndex >= 0)
|
||||
{
|
||||
qDebug("MainWindow::on_sampleSource_currentIndexChanged: tab at %d", currentSourceTabIndex);
|
||||
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
|
||||
deviceUI->m_deviceAPI->saveSourceSettings(m_settings.getWorkingPreset());
|
||||
//deviceUI->m_pluginManager->saveSourceSettings(m_settings.getWorkingPreset());
|
||||
m_pluginManager->selectSampleSourceByIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex(), deviceUI->m_deviceAPI);
|
||||
m_settings.setSourceIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex());
|
||||
|
||||
//deviceUI->m_pluginManager->loadSourceSettings(m_settings.getWorkingPreset());
|
||||
deviceUI->m_deviceAPI->loadSourceSettings(m_settings.getWorkingPreset());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_About_triggered()
|
||||
{
|
||||
AboutDialog dlg(this);
|
||||
|
@ -148,6 +148,7 @@ private slots:
|
||||
void on_action_Audio_triggered();
|
||||
void on_action_DV_Serial_triggered(bool checked);
|
||||
void on_sampleSource_currentIndexChanged(int index);
|
||||
void on_sampleSource_confirmClicked(bool checked);
|
||||
void on_action_About_triggered();
|
||||
void on_action_addDevice_triggered();
|
||||
void on_action_removeDevice_triggered();
|
||||
|
@ -1,5 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>checkmark.png</file>
|
||||
<file>questionmark.png</file>
|
||||
<file>res.qrc</file>
|
||||
<file>export.png</file>
|
||||
|
Loading…
Reference in New Issue
Block a user