1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 08:28:36 -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;
}
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;
}

View File

@ -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);
};

View File

@ -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)
{

View File

@ -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();
};

View File

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