Multi device support: create a dedicated UI for devices control

This commit is contained in:
f4exb 2016-05-14 14:12:57 +02:00
parent 2e78803cfa
commit 942bd0a733
4 changed files with 53 additions and 28 deletions

View File

@ -131,6 +131,7 @@ set(sdrbase_SOURCES
sdrbase/gui/audiodialog.cpp
sdrbase/gui/presetitem.cpp
sdrbase/gui/rollupwidget.cpp
sdrbase/gui/samplingdevicecontrol.cpp
sdrbase/gui/scale.cpp
sdrbase/gui/scaleengine.cpp
sdrbase/gui/valuedial.cpp
@ -216,6 +217,7 @@ set(sdrbase_HEADERS
sdrbase/gui/audiodialog.h
sdrbase/gui/presetitem.h
sdrbase/gui/rollupwidget.h
sdrbase/gui/samplingdevicecontrol.h
sdrbase/gui/scale.h
sdrbase/gui/scaleengine.h
sdrbase/gui/valuedial.h
@ -258,6 +260,7 @@ set(sdrbase_FORMS
sdrbase/gui/glspectrumgui.ui
sdrbase/gui/pluginsdialog.ui
sdrbase/gui/audiodialog.ui
sdrbase/gui/samplingdevicecontrol.ui
)
set(sdrbase_RESOURCES

View File

@ -18,7 +18,7 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QLabel>
#include <QComboBox>
//#include <QComboBox>
#include <QFile>
#include <QFileInfo>
#include <QFileDialog>
@ -38,6 +38,7 @@
#include "gui/rollupwidget.h"
#include "gui/channelwindow.h"
#include "gui/audiodialog.h"
#include "gui/samplingdevicecontrol.h"
#include "dsp/dspengine.h"
#include "dsp/spectrumvis.h"
#include "dsp/dspcommands.h"
@ -144,9 +145,13 @@ MainWindow::MainWindow(QWidget* parent) :
//ui->sampleSource->setCurrentIndex(sampleSourceIndex);
//ui->sampleSource->blockSignals(sampleSourceSignalsBlocked);
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
m_deviceUIs.back()->m_sampleSource->setCurrentIndex(sampleSourceIndex);
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
// bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
// m_deviceUIs.back()->m_sampleSource->setCurrentIndex(sampleSourceIndex);
// m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(true);
m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->setCurrentIndex(sampleSourceIndex);
m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(sampleSourceSignalsBlocked);
}
qDebug() << "MainWindow::MainWindow: load current preset settings...";
@ -213,11 +218,18 @@ void MainWindow::addDevice()
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, tabNameCStr);
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr);
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
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->tabInputsSelect->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr);
// bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
// 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);
// int tabInputsSelectIndex = ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr);
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(true);
pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector());
connect(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector(), SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(sampleSourceSignalsBlocked);
// ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector(), tabNameCStr);
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
// if (dspDeviceEngineUID == 0)
// {
@ -255,7 +267,7 @@ void MainWindow::removeLastDevice()
m_deviceUIs.pop_back();
}
void MainWindow::addChannelCreateAction(QAction* action)
void MainWindow::addChannelCreateAction(QAction* action) // TODO: move to some tabbed UI
{
ui->menu_Channels->addAction(action);
}
@ -646,12 +658,15 @@ void MainWindow::on_presetTree_itemActivated(QTreeWidgetItem *item, int column)
on_presetLoad_clicked();
}
//void MainWindow::on_action_Loaded_Plugins_triggered()
//{
// PluginsDialog pluginsDialog(m_pluginManager, this);
//
// pluginsDialog.exec();
//}
void MainWindow::on_action_Loaded_Plugins_triggered() // TODO: to be moved to a tabbed UI
{
if (m_deviceUIs.size() > 0)
{
DeviceUISet *deviceUISet = m_deviceUIs[0];
PluginsDialog pluginsDialog(deviceUISet->m_pluginManager, this);
pluginsDialog.exec();
}
}
void MainWindow::on_action_Audio_triggered()
{
@ -701,8 +716,13 @@ void MainWindow::on_sampleSource_currentIndexChanged(int index)
{
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->selectSampleSourceByIndex(m_deviceUIs.back()->m_sampleSource->currentIndex());
// m_settings.setSourceIndex(deviceUI->m_sampleSource->currentIndex());
deviceUI->m_pluginManager->selectSampleSourceByIndex(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->currentIndex());
m_settings.setSourceIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex());
deviceUI->m_pluginManager->loadSourceSettings(m_settings.getWorkingPreset());
}
}
@ -749,7 +769,7 @@ MainWindow::DeviceUISet::DeviceUISet(QTimer& timer)
m_spectrumGUI = new GLSpectrumGUI;
m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow;
m_sampleSource = new QComboBox;
m_samplingDeviceControl = new SamplingDeviceControl;
m_deviceEngine = 0;
m_pluginManager = 0;
@ -763,7 +783,7 @@ MainWindow::DeviceUISet::DeviceUISet(QTimer& timer)
MainWindow::DeviceUISet::~DeviceUISet()
{
delete m_sampleSource;
delete m_samplingDeviceControl;
delete m_channelWindow;
delete m_spectrumGUI;
delete m_spectrumVis;

View File

@ -27,7 +27,8 @@
class QLabel;
class QTreeWidgetItem;
class QDir;
class QComboBox;
//class QComboBox;
class SamplingDeviceControl;
class AudioDeviceInfo;
class DSPEngine;
@ -58,7 +59,8 @@ public:
GLSpectrum *m_spectrum;
GLSpectrumGUI *m_spectrumGUI;
ChannelWindow *m_channelWindow;
QComboBox *m_sampleSource;
// QComboBox *m_sampleSource;
SamplingDeviceControl *m_samplingDeviceControl;
DSPDeviceEngine *m_deviceEngine;
PluginManager *m_pluginManager;
@ -75,8 +77,8 @@ public:
void addChannelRollup(QWidget* widget);
void addViewAction(QAction* action);
void addChannelMarker(ChannelMarker* channelMarker);
void removeChannelMarker(ChannelMarker* channelMarker);
void addChannelMarker(ChannelMarker* channelMarker); // TODO: review this
void removeChannelMarker(ChannelMarker* channelMarker); // TODO: review this
void setInputGUI(int deviceTabIndex, QWidget* gui);
const QTimer& getMasterTimer() const { return m_masterTimer; }
@ -141,7 +143,7 @@ private slots:
void on_presetDelete_clicked();
void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_presetTree_itemActivated(QTreeWidgetItem *item, int column);
// void on_action_Loaded_Plugins_triggered();
void on_action_Loaded_Plugins_triggered(); // TODO: to be moved to a tabbed UI
void on_action_Audio_triggered();
void on_action_DV_Serial_triggered(bool checked);
void on_sampleSource_currentIndexChanged(int index);

View File

@ -400,7 +400,7 @@
</widget>
<widget class="QDockWidget" name="inputSelectDock">
<property name="windowTitle">
<string>Select Sample Source</string>
<string>Sampling devices control</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
@ -424,7 +424,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
<height>80</height>
</size>
</property>
<property name="currentIndex">
@ -437,7 +437,7 @@
</widget>
<widget class="QDockWidget" name="inputViewDock">
<property name="windowTitle">
<string>Sample Source</string>
<string>Sampling devices</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>