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

Multi device support: interim state #1

This commit is contained in:
f4exb 2016-05-13 15:45:42 +02:00
parent dec0addc25
commit f612327a51
2 changed files with 52 additions and 25 deletions

View File

@ -129,7 +129,7 @@ MainWindow::MainWindow(QWidget* parent) :
qDebug() << "MainWindow::MainWindow: select SampleSource from settings..."; qDebug() << "MainWindow::MainWindow: select SampleSource from settings...";
int sampleSourceIndex = m_settings.getSourceIndex(); int sampleSourceIndex = m_settings.getSourceIndex();
sampleSourceIndex = m_pluginManager->selectSampleSourceByIndex(sampleSourceIndex); sampleSourceIndex = m_deviceUIs.back()->m_pluginManager->selectSampleSourceByIndex(sampleSourceIndex);
if (sampleSourceIndex >= 0) if (sampleSourceIndex >= 0)
{ {
@ -210,10 +210,10 @@ void MainWindow::addDevice()
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked); m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr); ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr);
if (dspDeviceEngineUID == 0) // if (dspDeviceEngineUID == 0)
{ // {
m_pluginManager = pluginManager; // m_pluginManager = pluginManager;
} // }
} }
void MainWindow::removeLastDevice() void MainWindow::removeLastDevice()
@ -270,6 +270,7 @@ void MainWindow::removeChannelMarker(ChannelMarker* channelMarker)
void MainWindow::setInputGUI(QWidget* gui) void MainWindow::setInputGUI(QWidget* gui)
{ {
// FIXME: Ceci est un tres tres gros CACA!
if(m_inputGUI != 0) if(m_inputGUI != 0)
ui->inputDock->widget()->layout()->removeWidget(m_inputGUI); ui->inputDock->widget()->layout()->removeWidget(m_inputGUI);
if(gui != 0) if(gui != 0)
@ -295,8 +296,18 @@ void MainWindow::loadPresetSettings(const Preset* preset)
qPrintable(preset->getGroup()), qPrintable(preset->getGroup()),
qPrintable(preset->getDescription())); qPrintable(preset->getDescription()));
m_deviceUIs.back()->m_spectrumGUI->deserialize(preset->getSpectrumConfig()); // Load into currently selected source tab
m_pluginManager->loadSettings(preset); int currentSourceTabIndex = ui->tabInputs->currentIndex();
if (currentSourceTabIndex >= 0)
{
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
deviceUI->m_spectrumGUI->deserialize(preset->getSpectrumConfig());
deviceUI->m_pluginManager->loadSettings(preset);
}
// m_deviceUIs.back()->m_spectrumGUI->deserialize(preset->getSpectrumConfig());
// m_pluginManager->loadSettings(preset);
// has to be last step // has to be last step
restoreState(preset->getLayout()); restoreState(preset->getLayout());
@ -318,7 +329,15 @@ void MainWindow::savePresetSettings(Preset* preset)
preset->setSpectrumConfig(m_deviceUIs.back()->m_spectrumGUI->serialize()); preset->setSpectrumConfig(m_deviceUIs.back()->m_spectrumGUI->serialize());
preset->clearChannels(); preset->clearChannels();
m_pluginManager->saveSettings(preset);
// Save from currently selected source tab
int currentSourceTabIndex = ui->tabInputs->currentIndex();
if (currentSourceTabIndex >= 0)
{
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
deviceUI->m_pluginManager->saveSettings(preset);
}
preset->setLayout(saveState()); preset->setLayout(saveState());
} }
@ -399,11 +418,12 @@ void MainWindow::handleMessages()
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()) != 0)
{ {
qDebug("MainWindow::handleMessages: message: %s", message->getIdentifier()); qDebug("MainWindow::handleMessages: message: %s", message->getIdentifier());
delete message;
if (!m_pluginManager->handleMessage(*message)) //
{ // if (!m_pluginManager->handleMessage(*message))
delete message; // {
} // delete message;
// }
} }
} }
@ -599,12 +619,12 @@ void MainWindow::on_presetTree_itemActivated(QTreeWidgetItem *item, int column)
on_presetLoad_clicked(); on_presetLoad_clicked();
} }
void MainWindow::on_action_Loaded_Plugins_triggered() //void MainWindow::on_action_Loaded_Plugins_triggered()
{ //{
PluginsDialog pluginsDialog(m_pluginManager, this); // PluginsDialog pluginsDialog(m_pluginManager, this);
//
pluginsDialog.exec(); // pluginsDialog.exec();
} //}
void MainWindow::on_action_Audio_triggered() void MainWindow::on_action_Audio_triggered()
{ {
@ -647,10 +667,17 @@ void MainWindow::on_action_DV_Serial_triggered(bool checked)
void MainWindow::on_sampleSource_currentIndexChanged(int index) void MainWindow::on_sampleSource_currentIndexChanged(int index)
{ {
m_pluginManager->saveSourceSettings(m_settings.getWorkingPreset()); // Do it in the currently selected source tab
m_pluginManager->selectSampleSourceByIndex(m_deviceUIs.back()->m_sampleSource->currentIndex()); int currentSourceTabIndex = ui->tabInputs->currentIndex();
m_settings.setSourceIndex(m_deviceUIs.back()->m_sampleSource->currentIndex());
m_pluginManager->loadSourceSettings(m_settings.getWorkingPreset()); if (currentSourceTabIndex >= 0)
{
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
deviceUI->m_pluginManager->saveSourceSettings(m_settings.getWorkingPreset());
deviceUI->m_pluginManager->selectSampleSourceByIndex(m_deviceUIs.back()->m_sampleSource->currentIndex());
m_settings.setSourceIndex(deviceUI->m_sampleSource->currentIndex());
deviceUI->m_pluginManager->loadSourceSettings(m_settings.getWorkingPreset());
}
} }
void MainWindow::on_action_About_triggered() void MainWindow::on_action_About_triggered()

View File

@ -112,7 +112,7 @@ private:
quint64 m_centerFrequency; quint64 m_centerFrequency;
std::string m_sampleFileName; std::string m_sampleFileName;
PluginManager* m_pluginManager; // PluginManager* m_pluginManager;
void loadSettings(); void loadSettings();
void loadPresetSettings(const Preset* preset); void loadPresetSettings(const Preset* preset);
@ -141,7 +141,7 @@ private slots:
void on_presetDelete_clicked(); void on_presetDelete_clicked();
void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_presetTree_itemActivated(QTreeWidgetItem *item, int column); void on_presetTree_itemActivated(QTreeWidgetItem *item, int column);
void on_action_Loaded_Plugins_triggered(); // void on_action_Loaded_Plugins_triggered();
void on_action_Audio_triggered(); void on_action_Audio_triggered();
void on_action_DV_Serial_triggered(bool checked); void on_action_DV_Serial_triggered(bool checked);
void on_sampleSource_currentIndexChanged(int index); void on_sampleSource_currentIndexChanged(int index);