1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

Removed sampling device control objects

This commit is contained in:
f4exb 2020-09-13 18:32:33 +02:00
parent 5af1e12f6d
commit 57943a9b6d
9 changed files with 9 additions and 646 deletions

View File

@ -45,7 +45,6 @@ set(sdrgui_SOURCES
gui/pluginsdialog.cpp
gui/presetitem.cpp
gui/rollupwidget.cpp
gui/samplingdevicecontrol.cpp
gui/samplingdevicedialog.cpp
gui/samplingdevicesdock.cpp
gui/scaleengine.cpp
@ -121,7 +120,6 @@ set(sdrgui_HEADERS
gui/pluginsdialog.h
gui/presetitem.h
gui/rollupwidget.h
gui/samplingdevicecontrol.h
gui/samplingdevicedialog.h
gui/samplingdevicesdock.h
gui/scaleengine.h
@ -172,7 +170,6 @@ set(sdrgui_FORMS
gui/pluginsdialog.ui
gui/audiodialog.ui
gui/audioselectdialog.ui
gui/samplingdevicecontrol.ui
gui/samplingdevicedialog.ui
gui/myposdialog.ui
gui/transverterdialog.ui

View File

@ -23,7 +23,6 @@
#include "dsp/spectrumvis.h"
#include "gui/glspectrumgui.h"
#include "gui/channelwindow.h"
#include "gui/samplingdevicecontrol.h"
#include "dsp/dspdevicesourceengine.h"
#include "dsp/dspdevicesinkengine.h"
#include "plugin/plugininstancegui.h"
@ -53,7 +52,6 @@ DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer)
m_spectrumGUI = new GLSpectrumGUI;
m_spectrumGUI->setBuddies(m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow;
m_samplingDeviceControl = new SamplingDeviceControl(tabIndex, deviceType);
m_deviceAPI = nullptr;
m_deviceSourceEngine = nullptr;
m_deviceSinkEngine = nullptr;
@ -72,7 +70,6 @@ DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer)
DeviceUISet::~DeviceUISet()
{
delete m_samplingDeviceControl;
delete m_channelWindow;
delete m_spectrumGUI;
delete m_spectrumVis;

View File

@ -27,7 +27,6 @@ class SpectrumVis;
class GLSpectrum;
class GLSpectrumGUI;
class ChannelWindow;
class SamplingDeviceControl;
class DeviceAPI;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
@ -44,7 +43,6 @@ public:
GLSpectrum *m_spectrum;
GLSpectrumGUI *m_spectrumGUI;
ChannelWindow *m_channelWindow;
SamplingDeviceControl *m_samplingDeviceControl;
DeviceAPI *m_deviceAPI;
DSPDeviceSourceEngine *m_deviceSourceEngine;
DSPDeviceSinkEngine *m_deviceSinkEngine;

View File

@ -1,99 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015-2017 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "samplingdevicecontrol.h"
#include "samplingdevicedialog.h"
#include "plugin/pluginmanager.h"
#include "device/deviceenumerator.h"
#include "ui_samplingdevicecontrol.h"
SamplingDeviceControl::SamplingDeviceControl(int tabIndex, int deviceType, QWidget* parent) :
QWidget(parent),
ui(new Ui::SamplingDeviceControl),
m_deviceTabIndex(tabIndex),
m_deviceType(deviceType),
m_selectedDeviceIndex(-1)
{
ui->setupUi(this);
ui->deviceSelectedText->setText("None");
}
SamplingDeviceControl::~SamplingDeviceControl()
{
delete ui;
}
void SamplingDeviceControl::on_deviceChange_clicked()
{
SamplingDeviceDialog dialog(m_deviceType, m_deviceTabIndex, this);
dialog.exec();
if (dialog.getSelectedDeviceIndex() >= 0)
{
m_selectedDeviceIndex = dialog.getSelectedDeviceIndex();
setSelectedDeviceIndex(m_selectedDeviceIndex);
emit changed();
}
}
void SamplingDeviceControl::on_deviceReload_clicked()
{
if (m_selectedDeviceIndex >= 0) {
emit changed();
}
}
void SamplingDeviceControl::setSelectedDeviceIndex(int index)
{
if (m_deviceType == 0) // Single Rx
{
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(index);
DeviceEnumerator::instance()->changeRxSelection(m_deviceTabIndex, index);
ui->deviceSelectedText->setText(samplingDevice->displayedName);
}
else if (m_deviceType == 1) // Single Tx
{
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(index);
DeviceEnumerator::instance()->changeTxSelection(m_deviceTabIndex, index);
ui->deviceSelectedText->setText(samplingDevice->displayedName);
}
else if (m_deviceType == 2) // MIMO
{
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(index);
DeviceEnumerator::instance()->changeMIMOSelection(m_deviceTabIndex, index);
ui->deviceSelectedText->setText(samplingDevice->displayedName);
}
m_selectedDeviceIndex = index;
}
void SamplingDeviceControl::removeSelectedDeviceIndex()
{
if (m_deviceType == 0) // Single Rx
{
DeviceEnumerator::instance()->removeRxSelection(m_deviceTabIndex);
ui->deviceSelectedText->setText("None");
}
else if (m_deviceType == 1) // Single Tx
{
DeviceEnumerator::instance()->removeTxSelection(m_deviceTabIndex);
ui->deviceSelectedText->setText("None");
}
m_selectedDeviceIndex = -1;
}

View File

@ -1,61 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_GUI_SAMPLINGDEVICECONTROL_H_
#define SDRBASE_GUI_SAMPLINGDEVICECONTROL_H_
#include <QWidget>
#include <QComboBox>
#include <QPushButton>
#include "export.h"
namespace Ui {
class SamplingDeviceControl;
}
class ChannelMarker;
class PluginManager;
class SDRGUI_API SamplingDeviceControl : public QWidget {
Q_OBJECT
public:
explicit SamplingDeviceControl(int tabIndex, int deviceType, QWidget* parent = 0);
~SamplingDeviceControl();
int getSelectedDeviceIndex() const { return m_selectedDeviceIndex; }
void setSelectedDeviceIndex(int index);
void removeSelectedDeviceIndex();
private slots:
void on_deviceChange_clicked();
void on_deviceReload_clicked();
private:
Ui::SamplingDeviceControl* ui;
int m_deviceTabIndex;
int m_deviceType;
int m_selectedDeviceIndex;
signals:
void changed();
};
#endif /* SDRBASE_GUI_SAMPLINGDEVICECONTROL_H_ */

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SamplingDeviceControl</class>
<widget class="QWidget" name="SamplingDeviceControl">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Title &amp; Color</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<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">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="deviceSelectLayout">
<item>
<widget class="QLabel" name="deviceSelectedText">
<property name="text">
<string>Device</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deviceChange">
<property name="minimumSize">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Change sampling device</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/choose.png</normaloff>:/choose.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deviceReload">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Reload sampling device</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../resources/res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -48,7 +48,6 @@
#include "gui/audiodialog.h"
#include "gui/loggingdialog.h"
#include "gui/deviceuserargsdialog.h"
#include "gui/samplingdevicecontrol.h"
#include "gui/sdrangelsplash.h"
#include "gui/mypositiondialog.h"
#include "gui/ambedevicesdialog.h"
@ -141,13 +140,11 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
// work around broken Qt dock widget ordering
removeDockWidget(ui->inputViewDock);
removeDockWidget(ui->inputSelectDock);
removeDockWidget(ui->spectraDisplayDock);
removeDockWidget(ui->presetDock);
removeDockWidget(ui->commandsDock);
removeDockWidget(ui->channelDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->inputViewDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->inputSelectDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->spectraDisplayDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->commandsDock);
@ -155,14 +152,12 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
addDockWidget(Qt::RightDockWidgetArea, ui->channelDock);
ui->inputViewDock->show();
ui->inputSelectDock->show();
ui->spectraDisplayDock->show();
ui->presetDock->show();
ui->commandsDock->show();
ui->channelDock->show();
ui->menu_Window->addAction(ui->inputViewDock->toggleViewAction());
ui->menu_Window->addAction(ui->inputSelectDock->toggleViewAction());
ui->menu_Window->addAction(ui->spectraDisplayDock->toggleViewAction());
ui->menu_Window->addAction(ui->presetDock->toggleViewAction());
ui->menu_Window->addAction(ui->commandsDock->toggleViewAction());
@ -173,11 +168,6 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
"QComboBox::item:selected { color: rgb(255,140,0); } "
"QTabWidget::pane { border: 1px solid #C06900; } "
"QTabBar::tab:selected { background: rgb(128,70,0); }");
ui->tabInputsSelect->setStyleSheet("QWidget { background: rgb(50,50,50); } "
"QToolButton::checked { background: rgb(128,70,0); } "
"QComboBox::item:selected { color: rgb(255,140,0); } "
"QTabWidget::pane { border: 1px solid #808080; } "
"QTabBar::tab:selected { background: rgb(100,100,100); }");
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
@ -326,11 +316,6 @@ void MainWindow::addSourceDevice(int deviceIndex)
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, tabNameCStr);
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr);
connect(m_deviceUIs.back()->m_samplingDeviceControl, SIGNAL(changed()), this, SLOT(sampleSourceChanged()));
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr));
// Create a file source instance by default if requested device was not enumerated (index = -1)
if (deviceIndex < 0) {
deviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
@ -352,7 +337,6 @@ void MainWindow::addSourceDevice(int deviceIndex)
m_deviceUIs.back()->m_deviceAPI->setHardwareUserArguments(userArgs);
}
m_deviceUIs.back()->m_samplingDeviceControl->setSelectedDeviceIndex(deviceIndex);
ui->inputViewDock->setSelectedDeviceIndex(deviceTabIndex, deviceIndex);
// delete previous plugin GUI
@ -407,11 +391,6 @@ void MainWindow::addSinkDevice()
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, tabNameCStr);
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr);
connect(m_deviceUIs.back()->m_samplingDeviceControl, SIGNAL(changed()), this, SLOT(sampleSinkChanged()));
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr));
// create a file sink by default
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
@ -430,7 +409,6 @@ void MainWindow::addSinkDevice()
m_deviceUIs.back()->m_deviceAPI->setHardwareUserArguments(userArgs);
}
m_deviceUIs.back()->m_samplingDeviceControl->setSelectedDeviceIndex(fileSinkDeviceIndex);
ui->inputViewDock->setSelectedDeviceIndex(deviceTabIndex, fileSinkDeviceIndex);
// delete previous plugin GUI if it exists
@ -461,6 +439,7 @@ void MainWindow::removeLastDevice()
ui->tabSpectraGUI->removeTab(ui->tabSpectraGUI->count() - 1);
ui->tabSpectra->removeTab(ui->tabSpectra->count() - 1);
ui->inputViewDock->removeLastDevice();
// deletes old UI and input object
m_deviceUIs.back()->freeChannels(); // destroys the channel instances
@ -471,12 +450,9 @@ void MainWindow::removeLastDevice()
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceAPI->getSampleSource());
m_deviceUIs.back()->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
m_deviceUIs.back()->m_samplingDeviceControl->removeSelectedDeviceIndex(); // This releases the device in the device list
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
ui->tabInputsSelect->removeTab(ui->tabInputsSelect->count() - 1);
m_deviceWidgetTabs.removeLast();
ui->tabInputsView->clear();
@ -503,6 +479,7 @@ void MainWindow::removeLastDevice()
ui->tabSpectraGUI->removeTab(ui->tabSpectraGUI->count() - 1);
ui->tabSpectra->removeTab(ui->tabSpectra->count() - 1);
ui->inputViewDock->removeLastDevice();
// deletes old UI and output object
m_deviceUIs.back()->freeChannels();
@ -513,12 +490,9 @@ void MainWindow::removeLastDevice()
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
m_deviceUIs.back()->m_deviceAPI->getSampleSink());
m_deviceUIs.back()->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
m_deviceUIs.back()->m_samplingDeviceControl->removeSelectedDeviceIndex(); // This releases the device in the device list
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
ui->tabInputsSelect->removeTab(ui->tabInputsSelect->count() - 1);
m_deviceWidgetTabs.removeLast();
ui->tabInputsView->clear();
@ -546,6 +520,7 @@ void MainWindow::removeLastDevice()
ui->tabSpectraGUI->removeTab(ui->tabSpectraGUI->count() - 1);
ui->tabSpectra->removeTab(ui->tabSpectra->count() - 1);
ui->inputViewDock->removeLastDevice();
// deletes old UI and output object
m_deviceUIs.back()->freeChannels();
@ -555,10 +530,8 @@ void MainWindow::removeLastDevice()
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceMIMO(
m_deviceUIs.back()->m_deviceAPI->getSampleMIMO());
m_deviceUIs.back()->m_samplingDeviceControl->removeSelectedDeviceIndex(); // This releases the device in the device list
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
ui->tabInputsSelect->removeTab(ui->tabInputsSelect->count() - 1);
m_deviceWidgetTabs.removeLast();
ui->tabInputsView->clear();
@ -961,25 +934,17 @@ bool MainWindow::handleMessage(const Message& cmd)
else if (MsgSetDevice::match(cmd))
{
MsgSetDevice& notif = (MsgSetDevice&) cmd;
ui->tabInputsSelect->setCurrentIndex(notif.getDeviceSetIndex());
ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex());
DeviceUISet *deviceUI = m_deviceUIs[notif.getDeviceSetIndex()];
deviceUI->m_samplingDeviceControl->setSelectedDeviceIndex(notif.getDeviceIndex());
ui->inputViewDock->setSelectedDeviceIndex(notif.getDeviceSetIndex(), notif.getDeviceIndex());
if (notif.getDeviceType() == 1) {
sampleSinkChanged();
} else if (notif.getDeviceType() == 0) {
sampleSourceChanged();
} else if (notif.getDeviceType() == 2) {
sampleMIMOChanged();
}
samplingDeviceChanged(notif.getDeviceType(), notif.getDeviceSetIndex(), notif.getDeviceIndex());
return true;
}
else if (MsgAddChannel::match(cmd))
{
MsgAddChannel& notif = (MsgAddChannel&) cmd;
ui->tabInputsSelect->setCurrentIndex(notif.getDeviceSetIndex());
ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex());
channelAddClicked(notif.getChannelRegistrationIndex());
return true;
@ -1199,7 +1164,7 @@ void MainWindow::on_commandRun_clicked()
if (item != 0)
{
int currentDeviceSetIndex = ui->tabInputsSelect->currentIndex();
int currentDeviceSetIndex = ui->tabInputsView->currentIndex();
if (item->type() == PItem) // run individual command
{
@ -1753,117 +1718,6 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex)
}
}
void MainWindow::sampleSourceChanged()
{
// Do it in the currently selected source tab
int currentSourceTabIndex = ui->tabInputsSelect->currentIndex();
if (currentSourceTabIndex >= 0)
{
qDebug("MainWindow::sampleSourceChanged: tab at %d", currentSourceTabIndex);
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_settings.getWorkingPreset()); // save old API settings
deviceUI->m_deviceAPI->stopDeviceEngine();
// deletes old UI and input object
deviceUI->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(nullptr); // have source stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
deviceUI->m_deviceAPI->getSampleSource());
deviceUI->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(
deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex());
deviceUI->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceUI->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
deviceUI->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
deviceUI->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
deviceUI->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
deviceUI->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
deviceUI->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex()));
if (deviceUI->m_deviceAPI->getSamplingDeviceId().size() == 0) // non existent device => replace by default
{
qDebug("MainWindow::sampleSourceChanged: non existent device replaced by File Input");
int deviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceIndex);
deviceUI->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceUI->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
deviceUI->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
deviceUI->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
deviceUI->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
deviceUI->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
deviceUI->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(deviceIndex));
}
QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
if (userArgs.size() > 0) {
deviceUI->m_deviceAPI->setHardwareUserArguments(userArgs);
}
// add to buddies list
std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin();
int nbOfBuddies = 0;
for (; it != m_deviceUIs.end(); ++it)
{
if (*it != deviceUI) // do not add to itself
{
if ((*it)->m_deviceSourceEngine) // it is a source device
{
if ((deviceUI->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
(deviceUI->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
{
(*it)->m_deviceAPI->addSourceBuddy(deviceUI->m_deviceAPI);
nbOfBuddies++;
}
}
if ((*it)->m_deviceSinkEngine) // it is a sink device
{
if ((deviceUI->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
(deviceUI->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
{
(*it)->m_deviceAPI->addSourceBuddy(deviceUI->m_deviceAPI);
nbOfBuddies++;
}
}
}
}
if (nbOfBuddies == 0) {
deviceUI->m_deviceAPI->setBuddyLeader(true);
}
// constructs new GUI and input object
DeviceSampleSource *source = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
deviceUI->m_deviceAPI->getSamplingDeviceId(), deviceUI->m_deviceAPI);
deviceUI->m_deviceAPI->setSampleSource(source);
QWidget *gui;
PluginInstanceGUI *pluginUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDeviceId(),
&gui,
deviceUI);
deviceUI->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginUI);
setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName());
deviceUI->m_deviceAPI->getSampleSource()->init();
deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_settings.getWorkingPreset()); // load new API settings
if (currentSourceTabIndex == 0) // save as default starting device
{
m_settings.setSourceIndex(samplingDevice->sequence);
m_settings.setSourceDeviceId(samplingDevice->id);
}
}
}
void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex)
{
if (tabIndex >= 0)
@ -1965,170 +1819,10 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex)
}
}
void MainWindow::sampleSinkChanged()
{
// Do it in the currently selected source tab
int currentSinkTabIndex = ui->tabInputsSelect->currentIndex();
if (currentSinkTabIndex >= 0)
{
qDebug("MainWindow::sampleSinkChanged: tab at %d", currentSinkTabIndex);
DeviceUISet *deviceUI = m_deviceUIs[currentSinkTabIndex];
deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_settings.getWorkingPreset()); // save old API settings
deviceUI->m_deviceAPI->stopDeviceEngine();
// deletes old UI and output object
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
deviceUI->m_deviceAPI->getSampleSink());
deviceUI->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex());
deviceUI->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceUI->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
deviceUI->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
deviceUI->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
deviceUI->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
deviceUI->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
deviceUI->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex()));
if (deviceUI->m_deviceAPI->getSamplingDeviceId().size() == 0) // non existent device => replace by default
{
qDebug("MainWindow::sampleSinkChanged: non existent device replaced by File Sink");
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
deviceUI->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceUI->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
deviceUI->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
deviceUI->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
deviceUI->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
deviceUI->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
deviceUI->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex));
}
QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
if (userArgs.size() > 0) {
deviceUI->m_deviceAPI->setHardwareUserArguments(userArgs);
}
// add to buddies list
std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin();
int nbOfBuddies = 0;
for (; it != m_deviceUIs.end(); ++it)
{
if (*it != deviceUI) // do not add to itself
{
if ((*it)->m_deviceSourceEngine) // it is a source device
{
if ((deviceUI->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
(deviceUI->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
{
(*it)->m_deviceAPI->addSinkBuddy(deviceUI->m_deviceAPI);
nbOfBuddies++;
}
}
if ((*it)->m_deviceSinkEngine) // it is a sink device
{
if ((deviceUI->m_deviceAPI->getHardwareId() == (*it)->m_deviceAPI->getHardwareId()) &&
(deviceUI->m_deviceAPI->getSamplingDeviceSerial() == (*it)->m_deviceAPI->getSamplingDeviceSerial()))
{
(*it)->m_deviceAPI->addSinkBuddy(deviceUI->m_deviceAPI);
nbOfBuddies++;
}
}
}
}
if (nbOfBuddies == 0) {
deviceUI->m_deviceAPI->setBuddyLeader(true);
}
// constructs new GUI and output object
DeviceSampleSink *sink = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
deviceUI->m_deviceAPI->getSamplingDeviceId(), deviceUI->m_deviceAPI);
deviceUI->m_deviceAPI->setSampleSink(sink);
QWidget *gui;
PluginInstanceGUI *pluginUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDeviceId(),
&gui,
deviceUI);
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginUI);
setDeviceGUI(currentSinkTabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName(), 1);
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->init();
deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_settings.getWorkingPreset()); // load new API settings
}
}
void MainWindow::sampleMIMOChanged()
{
// Do it in the currently selected source tab
int currentMIMOTabIndex = ui->tabInputsSelect->currentIndex();
if (currentMIMOTabIndex >= 0)
{
qDebug("MainWindow::sampleMIMOChanged: tab at %d", currentMIMOTabIndex);
DeviceUISet *deviceUI = m_deviceUIs[currentMIMOTabIndex];
deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_settings.getWorkingPreset()); // save old API settings
deviceUI->m_deviceAPI->stopDeviceEngine();
// deletes old UI and output object
deviceUI->m_deviceAPI->getSampleMIMO()->setMessageQueueToGUI(nullptr); // have sink stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceMIMO(
deviceUI->m_deviceAPI->getSampleMIMO());
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(
deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex());
deviceUI->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceUI->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
deviceUI->m_deviceAPI->setDeviceItemIndex(samplingDevice->deviceItemIndex);
deviceUI->m_deviceAPI->setHardwareId(samplingDevice->hardwareId);
deviceUI->m_deviceAPI->setSamplingDeviceId(samplingDevice->id);
deviceUI->m_deviceAPI->setSamplingDeviceSerial(samplingDevice->serial);
deviceUI->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName);
deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(
DeviceEnumerator::instance()->getMIMOPluginInterface(deviceUI->m_samplingDeviceControl->getSelectedDeviceIndex()));
QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence);
if (userArgs.size() > 0) {
deviceUI->m_deviceAPI->setHardwareUserArguments(userArgs);
}
// constructs new GUI and MIMO object
DeviceSampleMIMO *mimo = deviceUI->m_deviceAPI->getPluginInterface()->createSampleMIMOPluginInstance(
deviceUI->m_deviceAPI->getSamplingDeviceId(), deviceUI->m_deviceAPI);
deviceUI->m_deviceAPI->setSampleMIMO(mimo);
QWidget *gui;
PluginInstanceGUI *pluginUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleMIMOPluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDeviceId(),
&gui,
deviceUI);
deviceUI->m_deviceAPI->getSampleMIMO()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginUI);
setDeviceGUI(currentMIMOTabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName(), 2);
m_deviceUIs.back()->m_deviceAPI->getSampleMIMO()->init();
deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_settings.getWorkingPreset()); // load new API settings
}
}
void MainWindow::channelAddClicked(int channelIndex)
{
// Do it in the currently selected source tab
int currentSourceTabIndex = ui->tabInputsSelect->currentIndex();
int currentSourceTabIndex = ui->tabInputsView->currentIndex();
if (currentSourceTabIndex >= 0)
{
@ -2210,7 +1904,6 @@ void MainWindow::tabInputViewIndexChanged()
ui->tabSpectra->setCurrentIndex(inputViewIndex);
ui->tabChannels->setCurrentIndex(inputViewIndex);
ui->tabInputsSelect->setCurrentIndex(inputViewIndex);
ui->tabSpectraGUI->setCurrentIndex(inputViewIndex);
}
@ -2303,7 +1996,7 @@ void MainWindow::setLoggingOptions()
void MainWindow::commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release)
{
//qDebug("MainWindow::commandKeyPressed: key: %x mod: %x %s", (int) key, (int) keyModifiers, release ? "release" : "press");
int currentDeviceSetIndex = ui->tabInputsSelect->currentIndex();
int currentDeviceSetIndex = ui->tabInputsView->currentIndex();
for (int i = 0; i < m_settings.getCommandCount(); ++i)
{

View File

@ -400,9 +400,6 @@ private slots:
void on_action_My_Position_triggered();
void on_action_DeviceUserArguments_triggered();
void samplingDeviceChanged(int deviceType, int tabIndex, int newDeviceIndex);
void sampleSourceChanged();
void sampleSinkChanged();
void sampleMIMOChanged();
void channelAddClicked(int channelIndex);
void on_action_Loaded_Plugins_triggered();
void on_action_About_triggered();

View File

@ -691,52 +691,6 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="inputSelectDock">
<property name="windowTitle">
<string>Sampling devices control</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="intputSelectDockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<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">
<number>2</number>
</property>
<item>
<widget class="QTabWidget" name="tabInputsSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>110</height>
</size>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<action name="action_Exit">
<property name="text">
<string>E&amp;xit</string>