diff --git a/sdrbase/gui/samplingdevicecontrol.cpp b/sdrbase/gui/samplingdevicecontrol.cpp index 88cc0670c..14ff53b7a 100644 --- a/sdrbase/gui/samplingdevicecontrol.cpp +++ b/sdrbase/gui/samplingdevicecontrol.cpp @@ -44,28 +44,12 @@ QPushButton *SamplingDeviceControl::getDeviceSelectionConfirm() return ui->deviceConfirm; } -void SamplingDeviceControl::populateChannelSelector() +QComboBox *SamplingDeviceControl::getChannelSelector() { - if (m_pluginManager) - { - m_pluginManager->populateRxChannelComboBox(ui->channelSelect); - } + return ui->channelSelect; } -//void SamplingDeviceControl::on_showLoadedPlugins_clicked(bool checked) -//{ -// if (m_pluginManager) -// { -// PluginsDialog pluginsDialog(m_pluginManager, this); -// pluginsDialog.exec(); -// } -//} - -void SamplingDeviceControl::on_addChannel_clicked(bool checked) +QPushButton *SamplingDeviceControl::getAddChannelButton() { - if (m_pluginManager) - { - m_pluginManager->createRxChannelInstance(ui->channelSelect->currentIndex(), m_deviceAPI); - } + return ui->addChannel; } - diff --git a/sdrbase/gui/samplingdevicecontrol.h b/sdrbase/gui/samplingdevicecontrol.h index 04d47c225..665ddd000 100644 --- a/sdrbase/gui/samplingdevicecontrol.h +++ b/sdrbase/gui/samplingdevicecontrol.h @@ -43,16 +43,13 @@ public: void setDeviceAPI(DeviceSourceAPI *devieAPI) { m_deviceAPI = devieAPI; } QComboBox *getDeviceSelector(); QPushButton *getDeviceSelectionConfirm(); - void populateChannelSelector(); + QComboBox *getChannelSelector(); + QPushButton *getAddChannelButton(); private: Ui::SamplingDeviceControl* ui; PluginManager *m_pluginManager; DeviceSourceAPI *m_deviceAPI; - -private slots: -// void on_showLoadedPlugins_clicked(bool checked); - void on_addChannel_clicked(bool checked); }; diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index e4bfe2087..96e7c29d5 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -123,7 +123,7 @@ MainWindow::MainWindow(QWidget* parent) : qDebug() << "MainWindow::MainWindow: add the first device..."; - addDevice(); // add the first device + addSourceDevice(); // add the first device qDebug() << "MainWindow::MainWindow: load settings..."; @@ -170,7 +170,7 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::addDevice() +void MainWindow::addSourceDevice() { DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine(); dspDeviceSourceEngine->start(); @@ -187,7 +187,9 @@ void MainWindow::addDevice() m_deviceUIs.back()->m_deviceAPI = deviceAPI; m_deviceUIs.back()->m_samplingDeviceControl->setDeviceAPI(deviceAPI); m_deviceUIs.back()->m_samplingDeviceControl->setPluginManager(m_pluginManager); - m_deviceUIs.back()->m_samplingDeviceControl->populateChannelSelector(); + m_pluginManager->populateRxChannelComboBox(m_deviceUIs.back()->m_samplingDeviceControl->getChannelSelector()); + + connect(m_deviceUIs.back()->m_samplingDeviceControl->getAddChannelButton(), SIGNAL(clicked(bool)), this, SLOT(on_rxChannel_addClicked(bool))); dspDeviceSourceEngine->addSink(m_deviceUIs.back()->m_spectrumVis); ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, tabNameCStr); @@ -675,18 +677,31 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked) } } +void MainWindow::on_rxChannel_addClicked(bool checked) +{ + // Do it in the currently selected source tab + int currentSourceTabIndex = ui->tabInputsSelect->currentIndex(); + + if (currentSourceTabIndex >= 0) + { + DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex]; + m_pluginManager->createRxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI->m_deviceAPI); + } + +} + void MainWindow::on_action_About_triggered() { AboutDialog dlg(this); dlg.exec(); } -void MainWindow::on_action_addDevice_triggered() +void MainWindow::on_action_addSourceDevice_triggered() { - addDevice(); + addSourceDevice(); } -void MainWindow::on_action_removeDevice_triggered() +void MainWindow::on_action_removeLastDevice_triggered() { if (m_deviceUIs.size() > 1) { diff --git a/sdrbase/mainwindow.h b/sdrbase/mainwindow.h index c71f45e9a..339512901 100644 --- a/sdrbase/mainwindow.h +++ b/sdrbase/mainwindow.h @@ -131,7 +131,7 @@ private: QTreeWidgetItem* addPresetToTree(const Preset* preset); void applySettings(); - void addDevice(); + void addSourceDevice(); void removeLastDevice(); private slots: @@ -151,10 +151,11 @@ private slots: void on_action_DV_Serial_triggered(bool checked); void on_action_My_Position_triggered(); void on_sampleSource_confirmClicked(bool checked); + void on_rxChannel_addClicked(bool checked); void on_action_Loaded_Plugins_triggered(); void on_action_About_triggered(); - void on_action_addDevice_triggered(); - void on_action_removeDevice_triggered(); + void on_action_addSourceDevice_triggered(); + void on_action_removeLastDevice_triggered(); void on_action_Exit_triggered(); void tabInputViewIndexChanged(); }; diff --git a/sdrbase/mainwindow.ui b/sdrbase/mainwindow.ui index 6b4135207..5dc56225c 100644 --- a/sdrbase/mainwindow.ui +++ b/sdrbase/mainwindow.ui @@ -33,16 +33,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -75,7 +66,7 @@ 0 0 1012 - 21 + 19 @@ -100,8 +91,8 @@ &Acquisition - - + + @@ -172,16 +163,7 @@ - - 2 - - - 2 - - - 2 - - + 2 @@ -392,16 +374,7 @@ 3 - - 2 - - - 2 - - - 2 - - + 2 @@ -432,16 +405,7 @@ 3 - - 2 - - - 2 - - - 2 - - + 2 @@ -478,16 +442,7 @@ 3 - - 2 - - - 2 - - - 2 - - + 2 @@ -515,16 +470,7 @@ 3 - - 2 - - - 2 - - - 2 - - + 2 @@ -622,17 +568,17 @@ - + - Add device + Add source device - + - Remove device + Remove last device