1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-26 12:04:13 -04:00

Multi device support: Main window: created a method to add a new device and associated objects

This commit is contained in:
f4exb
2016-05-13 09:23:33 +02:00
parent 7053d3775c
commit df661cc366
4 changed files with 66 additions and 20 deletions
+42 -18
View File
@@ -102,25 +102,25 @@ MainWindow::MainWindow(QWidget* parent) :
qDebug() << "MainWindow::MainWindow: m_pluginManager->loadPlugins ...";
// TODO: This will go in a create new device and device tab method:
addDevice(); // add the first device
DSPDeviceEngine *dspDeviceEngine = m_dspEngine->getDeviceEngineByIndex(0);
dspDeviceEngine->start();
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
m_pluginManager->loadPlugins();
ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, "X0");
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, "X0");
dspDeviceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, "X0");
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, "X0");
// DSPDeviceEngine *dspDeviceEngine = m_dspEngine->addDeviceEngine();
// dspDeviceEngine->start();
//
// m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
//
// m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
// m_pluginManager->loadPlugins();
//
// ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, "X0");
// ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, "X0");
// dspDeviceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
// ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, "X0");
// bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
// m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
// connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
// m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
// ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, "X0");
qDebug() << "MainWindow::MainWindow: loadSettings...";
@@ -180,6 +180,30 @@ MainWindow::~MainWindow()
delete ui;
}
void MainWindow::addDevice()
{
DSPDeviceEngine *dspDeviceEngine = m_dspEngine->addDeviceEngine();
dspDeviceEngine->start();
char tabNameCStr[16];
sprintf(tabNameCStr, "R%d", dspDeviceEngine->getUID());
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
m_pluginManager->loadPlugins();
ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, tabNameCStr);
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, tabNameCStr);
dspDeviceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr);
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr);
}
void MainWindow::addChannelCreateAction(QAction* action)
{
ui->menu_Channels->addAction(action);