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

Tx ph.1: plugins: return Rx channels control to Plugin Manager

This commit is contained in:
f4exb 2016-10-14 02:04:22 +02:00
parent 9299eac9dd
commit 32aece4e4a
5 changed files with 44 additions and 101 deletions

View File

@ -44,28 +44,12 @@ QPushButton *SamplingDeviceControl::getDeviceSelectionConfirm()
return ui->deviceConfirm; return ui->deviceConfirm;
} }
void SamplingDeviceControl::populateChannelSelector() QComboBox *SamplingDeviceControl::getChannelSelector()
{ {
if (m_pluginManager) return ui->channelSelect;
{
m_pluginManager->populateRxChannelComboBox(ui->channelSelect);
}
} }
//void SamplingDeviceControl::on_showLoadedPlugins_clicked(bool checked) QPushButton *SamplingDeviceControl::getAddChannelButton()
//{
// if (m_pluginManager)
// {
// PluginsDialog pluginsDialog(m_pluginManager, this);
// pluginsDialog.exec();
// }
//}
void SamplingDeviceControl::on_addChannel_clicked(bool checked)
{ {
if (m_pluginManager) return ui->addChannel;
{
m_pluginManager->createRxChannelInstance(ui->channelSelect->currentIndex(), m_deviceAPI);
} }
}

View File

@ -43,16 +43,13 @@ public:
void setDeviceAPI(DeviceSourceAPI *devieAPI) { m_deviceAPI = devieAPI; } void setDeviceAPI(DeviceSourceAPI *devieAPI) { m_deviceAPI = devieAPI; }
QComboBox *getDeviceSelector(); QComboBox *getDeviceSelector();
QPushButton *getDeviceSelectionConfirm(); QPushButton *getDeviceSelectionConfirm();
void populateChannelSelector(); QComboBox *getChannelSelector();
QPushButton *getAddChannelButton();
private: private:
Ui::SamplingDeviceControl* ui; Ui::SamplingDeviceControl* ui;
PluginManager *m_pluginManager; PluginManager *m_pluginManager;
DeviceSourceAPI *m_deviceAPI; DeviceSourceAPI *m_deviceAPI;
private slots:
// void on_showLoadedPlugins_clicked(bool checked);
void on_addChannel_clicked(bool checked);
}; };

View File

@ -123,7 +123,7 @@ MainWindow::MainWindow(QWidget* parent) :
qDebug() << "MainWindow::MainWindow: add the first device..."; qDebug() << "MainWindow::MainWindow: add the first device...";
addDevice(); // add the first device addSourceDevice(); // add the first device
qDebug() << "MainWindow::MainWindow: load settings..."; qDebug() << "MainWindow::MainWindow: load settings...";
@ -170,7 +170,7 @@ MainWindow::~MainWindow()
delete ui; delete ui;
} }
void MainWindow::addDevice() void MainWindow::addSourceDevice()
{ {
DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine(); DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine();
dspDeviceSourceEngine->start(); dspDeviceSourceEngine->start();
@ -187,7 +187,9 @@ void MainWindow::addDevice()
m_deviceUIs.back()->m_deviceAPI = deviceAPI; m_deviceUIs.back()->m_deviceAPI = deviceAPI;
m_deviceUIs.back()->m_samplingDeviceControl->setDeviceAPI(deviceAPI); m_deviceUIs.back()->m_samplingDeviceControl->setDeviceAPI(deviceAPI);
m_deviceUIs.back()->m_samplingDeviceControl->setPluginManager(m_pluginManager); 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); dspDeviceSourceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, tabNameCStr); 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() void MainWindow::on_action_About_triggered()
{ {
AboutDialog dlg(this); AboutDialog dlg(this);
dlg.exec(); 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) if (m_deviceUIs.size() > 1)
{ {

View File

@ -131,7 +131,7 @@ private:
QTreeWidgetItem* addPresetToTree(const Preset* preset); QTreeWidgetItem* addPresetToTree(const Preset* preset);
void applySettings(); void applySettings();
void addDevice(); void addSourceDevice();
void removeLastDevice(); void removeLastDevice();
private slots: private slots:
@ -151,10 +151,11 @@ private slots:
void on_action_DV_Serial_triggered(bool checked); void on_action_DV_Serial_triggered(bool checked);
void on_action_My_Position_triggered(); void on_action_My_Position_triggered();
void on_sampleSource_confirmClicked(bool checked); void on_sampleSource_confirmClicked(bool checked);
void on_rxChannel_addClicked(bool checked);
void on_action_Loaded_Plugins_triggered(); void on_action_Loaded_Plugins_triggered();
void on_action_About_triggered(); void on_action_About_triggered();
void on_action_addDevice_triggered(); void on_action_addSourceDevice_triggered();
void on_action_removeDevice_triggered(); void on_action_removeLastDevice_triggered();
void on_action_Exit_triggered(); void on_action_Exit_triggered();
void tabInputViewIndexChanged(); void tabInputViewIndexChanged();
}; };

View File

@ -33,16 +33,7 @@
</font> </font>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin"> <property name="margin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -75,7 +66,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1012</width> <width>1012</width>
<height>21</height> <height>19</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@ -100,8 +91,8 @@
<property name="title"> <property name="title">
<string>&amp;Acquisition</string> <string>&amp;Acquisition</string>
</property> </property>
<addaction name="action_addDevice"/> <addaction name="action_addSourceDevice"/>
<addaction name="action_removeDevice"/> <addaction name="action_removeLastDevice"/>
</widget> </widget>
<widget class="QMenu" name="menu_View"> <widget class="QMenu" name="menu_View">
<property name="font"> <property name="font">
@ -172,16 +163,7 @@
</attribute> </attribute>
<widget class="QWidget" name="dockWidgetContents"> <widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<property name="leftMargin"> <property name="margin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -392,16 +374,7 @@
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<property name="leftMargin"> <property name="margin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
@ -432,16 +405,7 @@
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<property name="leftMargin"> <property name="margin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
@ -478,16 +442,7 @@
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<property name="leftMargin"> <property name="margin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
@ -515,16 +470,7 @@
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<property name="leftMargin"> <property name="margin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
@ -622,17 +568,17 @@
<font/> <font/>
</property> </property>
</action> </action>
<action name="action_addDevice"> <action name="action_addSourceDevice">
<property name="text"> <property name="text">
<string>Add device</string> <string>Add source device</string>
</property> </property>
<property name="font"> <property name="font">
<font/> <font/>
</property> </property>
</action> </action>
<action name="action_removeDevice"> <action name="action_removeLastDevice">
<property name="text"> <property name="text">
<string>Remove device</string> <string>Remove last device</string>
</property> </property>
<property name="font"> <property name="font">
<font/> <font/>