2017-10-24 18:29:18 +02:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 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 //
2019-04-11 14:43:33 +02:00
// (at your option) any later version. //
2017-10-24 18:29:18 +02:00
// //
// 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 <QFont>
2020-04-19 06:13:32 +02:00
#include <algorithm>
2017-10-24 18:29:18 +02:00
#include "dsp/spectrumvis.h"
#include "dsp/dspdevicesourceengine.h"
#include "dsp/dspdevicesinkengine.h"
2020-10-03 05:16:19 +02:00
#include "gui/glspectrum.h"
2022-09-29 13:48:04 +01:00
#include "gui/glspectrumview.h"
2020-10-03 05:16:19 +02:00
#include "gui/glspectrumgui.h"
2022-04-15 19:53:50 +02:00
// #include "gui/channelwindow.h"
2022-04-09 13:38:22 +02:00
#include "gui/workspace.h"
2022-11-03 19:00:13 +01:00
#include "gui/rollupcontents.h"
2020-10-05 19:23:13 +02:00
#include "device/devicegui.h"
2020-10-11 08:27:58 +02:00
#include "device/deviceset.h"
2022-04-09 13:38:22 +02:00
#include "device/deviceapi.h"
2017-10-30 22:45:53 +01:00
#include "plugin/pluginapi.h"
#include "plugin/plugininterface.h"
2019-08-02 01:58:59 +02:00
#include "channel/channelutils.h"
2020-10-03 05:16:19 +02:00
#include "channel/channelapi.h"
2020-10-04 06:16:15 +02:00
#include "channel/channelgui.h"
2022-04-09 13:38:22 +02:00
#include "mainspectrum/mainspectrumgui.h"
2017-10-30 22:45:53 +01:00
#include "settings/preset.h"
2023-08-24 15:51:50 +01:00
#include "util/simpleserializer.h"
2022-04-12 16:20:45 +02:00
#include "mainwindow.h"
2017-10-24 18:29:18 +02:00
#include "deviceuiset.h"
2022-04-09 13:38:22 +02:00
DeviceUISet :: DeviceUISet ( int deviceSetIndex , DeviceSet * deviceSet )
2017-10-24 18:29:18 +02:00
{
2022-09-29 13:48:04 +01:00
m_spectrum = new GLSpectrum ();
2022-06-25 02:53:11 +02:00
m_spectrum -> setIsDeviceSpectrum ( true );
2020-11-12 10:45:08 +01:00
m_spectrumVis = deviceSet -> m_spectrumVis ;
m_spectrumVis -> setGLSpectrum ( m_spectrum );
2017-10-24 18:29:18 +02:00
m_spectrumGUI = new GLSpectrumGUI ;
2022-09-29 13:48:04 +01:00
m_spectrumGUI -> setBuddies ( m_spectrumVis , m_spectrum );
m_mainSpectrumGUI = new MainSpectrumGUI ( m_spectrum , m_spectrumGUI );
2022-04-15 19:53:50 +02:00
// m_channelWindow = new ChannelWindow;
2019-05-20 16:31:15 +02:00
m_deviceAPI = nullptr ;
2020-10-03 06:58:57 +02:00
m_deviceGUI = nullptr ;
2019-05-20 16:31:15 +02:00
m_deviceSourceEngine = nullptr ;
m_deviceSinkEngine = nullptr ;
m_deviceMIMOEngine = nullptr ;
2022-04-09 13:38:22 +02:00
m_deviceSetIndex = deviceSetIndex ;
2020-10-11 08:27:58 +02:00
m_deviceSet = deviceSet ;
2019-05-18 15:40:00 +02:00
m_nbAvailableRxChannels = 0 ; // updated at enumeration for UI selector
m_nbAvailableTxChannels = 0 ; // updated at enumeration for UI selector
m_nbAvailableMIMOChannels = 0 ; // updated at enumeration for UI selector
2017-10-24 18:29:18 +02:00
// m_spectrum needs to have its font to be set since it cannot be inherited from the main window
QFont font ;
2018-05-06 17:51:18 +02:00
font . setFamily ( QStringLiteral ( "Liberation Sans" ));
2017-10-24 18:29:18 +02:00
font . setPointSize ( 9 );
m_spectrum -> setFont ( font );
}
DeviceUISet ::~ DeviceUISet ()
{
2022-04-15 19:53:50 +02:00
// delete m_channelWindow;
2022-04-09 13:38:22 +02:00
delete m_mainSpectrumGUI ;
// delete m_spectrumGUI; // done above
// delete m_spectrum;
2017-10-24 18:29:18 +02:00
}
2022-04-12 16:20:45 +02:00
void DeviceUISet :: setIndex ( int deviceSetIndex )
{
m_deviceGUI -> setIndex ( deviceSetIndex );
m_mainSpectrumGUI -> setIndex ( deviceSetIndex );
for ( auto & channelRegistation : m_channelInstanceRegistrations ) {
channelRegistation . m_gui -> setDeviceSetIndex ( deviceSetIndex );
}
m_deviceSetIndex = deviceSetIndex ;
}
2019-10-26 22:30:53 +02:00
void DeviceUISet :: setSpectrumScalingFactor ( float scalef )
{
2020-04-29 17:41:17 +02:00
m_spectrumVis -> setScalef ( scalef );
2019-10-26 22:30:53 +02:00
}
2017-10-31 00:07:55 +01:00
void DeviceUISet :: addChannelMarker ( ChannelMarker * channelMarker )
{
m_spectrum -> addChannelMarker ( channelMarker );
}
2022-04-16 16:45:53 +02:00
void DeviceUISet :: removeChannelMarker ( ChannelMarker * channelMarker )
{
m_spectrum -> removeChannelMarker ( channelMarker );
}
2020-10-15 08:52:30 +02:00
void DeviceUISet :: registerRxChannelInstance ( ChannelAPI * channelAPI , ChannelGUI * channelGUI )
2017-10-30 22:45:53 +01:00
{
2020-10-15 08:52:30 +02:00
m_channelInstanceRegistrations . append ( ChannelInstanceRegistration ( channelAPI , channelGUI , 0 ));
m_deviceSet -> addChannelInstance ( channelAPI );
2020-10-04 19:07:42 +02:00
QObject :: connect (
channelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( channelGUI ); },
Qt :: QueuedConnection
);
2017-10-30 22:45:53 +01:00
}
2020-10-15 08:52:30 +02:00
void DeviceUISet :: registerTxChannelInstance ( ChannelAPI * channelAPI , ChannelGUI * channelGUI )
2017-10-30 22:45:53 +01:00
{
2020-10-15 08:52:30 +02:00
m_channelInstanceRegistrations . append ( ChannelInstanceRegistration ( channelAPI , channelGUI , 1 ));
m_deviceSet -> addChannelInstance ( channelAPI );
2020-10-04 19:07:42 +02:00
QObject :: connect (
channelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( channelGUI ); },
Qt :: QueuedConnection
);
2019-09-08 00:44:56 +02:00
}
2020-10-15 08:52:30 +02:00
void DeviceUISet :: registerChannelInstance ( ChannelAPI * channelAPI , ChannelGUI * channelGUI )
2019-09-08 00:44:56 +02:00
{
2020-10-15 08:52:30 +02:00
m_channelInstanceRegistrations . append ( ChannelInstanceRegistration ( channelAPI , channelGUI , 2 ));
m_deviceSet -> addChannelInstance ( channelAPI );
2020-10-04 19:07:42 +02:00
QObject :: connect (
channelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( channelGUI ); },
Qt :: QueuedConnection
);
2017-10-30 22:45:53 +01:00
}
2022-04-16 16:45:53 +02:00
void DeviceUISet :: unregisterChannelInstanceAt ( int channelIndex )
{
if (( channelIndex >= 0 ) && ( channelIndex < m_channelInstanceRegistrations . count ()))
{
m_channelInstanceRegistrations . removeAt ( channelIndex );
m_deviceSet -> removeChannelInstanceAt ( channelIndex );
// Renumerate
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ ) {
m_channelInstanceRegistrations . at ( i ). m_gui -> setIndex ( i );
}
}
}
2019-09-08 00:44:56 +02:00
void DeviceUISet :: freeChannels ()
2017-12-23 23:41:37 +01:00
{
2019-09-08 00:44:56 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2017-12-23 23:41:37 +01:00
{
2020-10-15 08:52:30 +02:00
qDebug ( "DeviceUISet::freeChannels: destroying channel [%s]" , qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2021-04-21 12:28:56 +02:00
m_channelInstanceRegistrations [ i ]. m_gui -> destroy ();
2022-07-21 05:26:58 +02:00
m_channelInstanceRegistrations [ i ]. m_channelAPI -> destroy ();
2017-12-23 23:41:37 +01:00
}
2020-10-11 08:27:58 +02:00
2021-02-17 13:45:34 +01:00
m_channelInstanceRegistrations . clear ();
2020-10-11 08:27:58 +02:00
m_deviceSet -> clearChannels ();
2017-12-23 23:41:37 +01:00
}
2019-09-08 00:44:56 +02:00
void DeviceUISet :: deleteChannel ( int channelIndex )
2017-12-23 23:41:37 +01:00
{
2019-09-08 00:44:56 +02:00
if (( channelIndex >= 0 ) && ( channelIndex < m_channelInstanceRegistrations . count ()))
2017-12-23 23:41:37 +01:00
{
2019-09-08 00:44:56 +02:00
qDebug ( "DeviceUISet::deleteChannel: delete channel [%s] at %d" ,
2020-10-15 08:52:30 +02:00
qPrintable ( m_channelInstanceRegistrations [ channelIndex ]. m_channelAPI -> getURI ()),
2017-12-23 23:41:37 +01:00
channelIndex );
2021-04-21 12:28:56 +02:00
m_channelInstanceRegistrations [ channelIndex ]. m_gui -> destroy ();
2022-07-21 05:26:58 +02:00
m_channelInstanceRegistrations [ channelIndex ]. m_channelAPI -> destroy ();
2021-02-17 13:45:34 +01:00
m_channelInstanceRegistrations . removeAt ( channelIndex );
2017-12-23 23:41:37 +01:00
}
2020-10-11 08:27:58 +02:00
m_deviceSet -> removeChannelInstanceAt ( channelIndex );
2017-12-23 23:41:37 +01:00
}
2022-03-23 05:53:12 +01:00
ChannelAPI * DeviceUISet :: getChannelAt ( int channelIndex )
{
return m_deviceSet -> getChannelAt ( channelIndex );
}
2022-04-12 16:20:45 +02:00
ChannelGUI * DeviceUISet :: getChannelGUIAt ( int channelIndex )
{
return m_channelInstanceRegistrations [ channelIndex ]. m_gui ;
}
2023-08-24 15:51:50 +01:00
// Serialization is only used for Device and Spectrum settings in a Device preset
// To include channels, use a Device Set preset via loadDeviceSetSettings/saveDeviceSetSettings
QByteArray DeviceUISet :: serialize () const
{
SimpleSerializer s ( 1 );
s . writeBlob ( 1 , m_deviceAPI -> serialize ());
s . writeBlob ( 2 , m_deviceGUI -> serialize ());
s . writeBlob ( 3 , m_spectrumGUI -> serialize ());
return s . final ();
}
bool DeviceUISet :: deserialize ( const QByteArray & data )
{
SimpleDeserializer d ( data );
if ( ! d . isValid ()) {
return false ;
}
if ( d . getVersion () == 1 )
{
QByteArray data ;
d . readBlob ( 1 , & data );
m_deviceAPI -> deserialize ( data );
d . readBlob ( 2 , & data );
m_deviceGUI -> deserialize ( data );
d . readBlob ( 3 , & data );
m_spectrumGUI -> deserialize ( data );
2023-08-24 16:36:18 +01:00
return true ;
2023-08-24 15:51:50 +01:00
}
else
{
return false ;
}
}
2022-04-09 13:38:22 +02:00
void DeviceUISet :: loadDeviceSetSettings (
const Preset * preset ,
PluginAPI * pluginAPI ,
QList < Workspace *> * workspaces ,
Workspace * currentWorkspace
)
{
2022-04-15 06:10:45 +02:00
qDebug ( "DeviceUISet::loadDeviceSetSettings: preset: [%s, %s]" ,
qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
2022-04-09 13:38:22 +02:00
m_spectrumGUI -> deserialize ( preset -> getSpectrumConfig ());
2022-04-15 06:10:45 +02:00
m_mainSpectrumGUI -> restoreGeometry ( preset -> getSpectrumGeometry ());
m_deviceGUI -> restoreGeometry ( preset -> getDeviceGeometry ());
2022-04-09 13:38:22 +02:00
m_deviceAPI -> loadSamplingDeviceSettings ( preset );
2022-04-10 00:11:23 +02:00
if ( ! preset -> getShowSpectrum ()) {
m_mainSpectrumGUI -> hide ();
}
2022-04-09 13:38:22 +02:00
if ( m_deviceSourceEngine ) { // source device
2022-04-12 16:20:45 +02:00
loadRxChannelSettings ( preset , pluginAPI , workspaces , currentWorkspace );
2022-04-09 13:38:22 +02:00
} else if ( m_deviceSinkEngine ) { // sink device
2022-04-12 16:20:45 +02:00
loadTxChannelSettings ( preset , pluginAPI , workspaces , currentWorkspace );
2022-04-09 13:38:22 +02:00
} else if ( m_deviceMIMOEngine ) { // MIMO device
2022-04-12 16:20:45 +02:00
loadMIMOChannelSettings ( preset , pluginAPI , workspaces , currentWorkspace );
2022-04-09 13:38:22 +02:00
}
}
void DeviceUISet :: saveDeviceSetSettings ( Preset * preset ) const
{
2022-04-15 06:10:45 +02:00
qDebug ( "DeviceUISet::saveDeviceSetSettings: preset: [%s, %s]" ,
qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
2022-04-09 13:38:22 +02:00
preset -> setSpectrumConfig ( m_spectrumGUI -> serialize ());
preset -> setSpectrumWorkspaceIndex ( m_mainSpectrumGUI -> getWorkspaceIndex ());
preset -> setSpectrumGeometry ( m_mainSpectrumGUI -> saveGeometry ());
2022-04-15 06:10:45 +02:00
preset -> setDeviceGeometry ( m_deviceGUI -> saveGeometry ());
2022-04-10 00:11:23 +02:00
preset -> setShowSpectrum ( m_spectrumGUI -> isVisible ());
2022-04-09 13:38:22 +02:00
preset -> setSelectedDevice ( Preset :: SelectedDevice {
m_deviceAPI -> getSamplingDeviceId (),
m_deviceAPI -> getSamplingDeviceSerial (),
( int ) m_deviceAPI -> getSamplingDeviceSequence (),
( int ) m_deviceAPI -> getDeviceItemIndex ()
});
2022-04-14 03:07:33 +02:00
preset -> setDeviceWorkspaceIndex ( m_deviceGUI -> getWorkspaceIndex ());
2022-04-09 13:38:22 +02:00
preset -> clearChannels ();
if ( m_deviceSourceEngine ) // source device
{
preset -> setSourcePreset ();
saveRxChannelSettings ( preset );
}
else if ( m_deviceSinkEngine ) // sink device
{
preset -> setSinkPreset ();
saveTxChannelSettings ( preset );
}
else if ( m_deviceMIMOEngine ) // MIMO device
{
preset -> setMIMOPreset ();
saveMIMOChannelSettings ( preset );
}
m_deviceAPI -> saveSamplingDeviceSettings ( preset );
}
2022-04-12 16:20:45 +02:00
void DeviceUISet :: loadRxChannelSettings ( const Preset * preset , PluginAPI * pluginAPI , QList < Workspace *> * workspaces , Workspace * currentWorkspace )
2017-10-30 22:45:53 +01:00
{
if ( preset -> isSourcePreset ())
{
2020-10-04 19:07:42 +02:00
qDebug ( "DeviceUISet::loadRxChannelSettings: Loading preset [%s | %s]" ,
qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
2017-10-30 22:45:53 +01:00
// Available channel plugins
PluginAPI :: ChannelRegistrations * channelRegistrations = pluginAPI -> getRxChannelRegistrations ();
2020-10-04 19:07:42 +02:00
// clear list
2022-04-17 23:18:56 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2018-03-16 10:13:02 +01:00
{
2020-10-04 19:07:42 +02:00
qDebug ( "DeviceUISet::loadRxChannelSettings: destroying old channel [%s]" ,
2020-10-15 08:52:30 +02:00
qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2021-02-08 22:29:27 +01:00
m_channelInstanceRegistrations [ i ]. m_channelAPI -> setMessageQueueToGUI ( nullptr ); // have channel stop sending messages to its GUI
2021-04-21 12:28:56 +02:00
m_channelInstanceRegistrations [ i ]. m_gui -> destroy ();
2022-09-27 08:36:17 +02:00
m_channelInstanceRegistrations [ i ]. m_channelAPI -> destroy ();
2018-03-16 10:13:02 +01:00
}
2017-10-30 22:45:53 +01:00
2020-10-04 19:07:42 +02:00
m_channelInstanceRegistrations . clear ();
2020-10-11 08:27:58 +02:00
m_deviceSet -> clearChannels ();
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::loadRxChannelSettings: %d channel(s) in preset" , preset -> getChannelCount ());
for ( int i = 0 ; i < preset -> getChannelCount (); i ++ )
2017-10-30 22:45:53 +01:00
{
const Preset :: ChannelConfig & channelConfig = preset -> getChannelConfig ( i );
2020-10-04 06:16:15 +02:00
ChannelGUI * rxChannelGUI = nullptr ;
2022-04-12 16:20:45 +02:00
ChannelAPI * channelAPI = nullptr ;
2017-10-30 22:45:53 +01:00
2018-03-16 10:13:02 +01:00
// create channel instance
2017-10-30 22:45:53 +01:00
2022-04-17 23:18:56 +02:00
for ( int i = 0 ; i < channelRegistrations -> count (); i ++ )
2017-10-30 22:45:53 +01:00
{
2018-05-30 11:49:54 +02:00
//if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
2019-08-04 20:24:44 +02:00
if ( ChannelUtils :: compareChannelURIs (( * channelRegistrations )[ i ]. m_channelIdURI , channelConfig . m_channelIdURI ))
2017-10-30 22:45:53 +01:00
{
2018-05-30 11:49:54 +02:00
qDebug ( "DeviceUISet::loadRxChannelSettings: creating new channel [%s] from config [%s]" ,
qPrintable (( * channelRegistrations )[ i ]. m_channelIdURI ),
qPrintable ( channelConfig . m_channelIdURI ));
2020-10-01 22:47:30 +02:00
BasebandSampleSink * rxChannel ;
2022-04-17 10:20:07 +02:00
PluginInterface * pluginInterface = ( * channelRegistrations )[ i ]. m_plugin ;
pluginInterface -> createRxChannel ( m_deviceAPI , & rxChannel , & channelAPI );
rxChannelGUI = pluginInterface -> createRxChannelGUI ( this , rxChannel );
rxChannelGUI -> setDisplayedame ( pluginInterface -> getPluginDescriptor (). displayedName );
2020-10-15 08:52:30 +02:00
registerRxChannelInstance ( channelAPI , rxChannelGUI );
2020-10-04 19:07:42 +02:00
QObject :: connect (
rxChannelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( rxChannelGUI ); },
Qt :: QueuedConnection
);
2017-10-30 22:45:53 +01:00
break ;
}
}
2022-04-12 16:20:45 +02:00
if ( rxChannelGUI && channelAPI )
2017-10-30 22:45:53 +01:00
{
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::loadRxChannelSettings: deserializing channel [%s]" , qPrintable ( channelConfig . m_channelIdURI ));
2020-10-03 05:16:19 +02:00
rxChannelGUI -> deserialize ( channelConfig . m_config );
2022-04-12 16:20:45 +02:00
int originalWorkspaceIndex = rxChannelGUI -> getWorkspaceIndex ();
if ( workspaces && ( workspaces -> size () > 0 ) && ( originalWorkspaceIndex < workspaces -> size ())) // restore in original workspace
{
( * workspaces )[ originalWorkspaceIndex ] -> addToMdiArea (( QMdiSubWindow * ) rxChannelGUI );
}
else if ( currentWorkspace ) // restore in current workspace
{
rxChannelGUI -> setWorkspaceIndex ( currentWorkspace -> getIndex ());
currentWorkspace -> addToMdiArea (( QMdiSubWindow * ) rxChannelGUI );
}
2022-04-12 18:27:27 +02:00
if ( rxChannelGUI -> getHidden ()) {
rxChannelGUI -> hide ();
}
2022-04-12 16:20:45 +02:00
rxChannelGUI -> restoreGeometry ( rxChannelGUI -> getGeometryBytes ());
2022-11-03 19:00:13 +01:00
rxChannelGUI -> getRollupContents () -> arrangeRollups ();
2022-04-12 16:20:45 +02:00
rxChannelGUI -> setDeviceType ( ChannelGUI :: DeviceRx );
rxChannelGUI -> setDeviceSetIndex ( m_deviceSetIndex );
rxChannelGUI -> setIndex ( channelAPI -> getIndexInDeviceSet ());
2022-04-18 12:08:33 +02:00
rxChannelGUI -> setIndexToolTip ( m_deviceAPI -> getSamplingDeviceDisplayName ());
2022-04-12 16:20:45 +02:00
QObject :: connect (
rxChannelGUI ,
& ChannelGUI :: moveToWorkspace ,
this ,
[ = ]( int wsIndexDest ){ MainWindow :: getInstance () -> channelMove ( rxChannelGUI , wsIndexDest ); }
);
2022-04-15 18:59:29 +02:00
QObject :: connect (
rxChannelGUI ,
& ChannelGUI :: duplicateChannelEmitted ,
this ,
[ = ](){ MainWindow :: getInstance () -> channelDuplicate ( rxChannelGUI ); }
);
2022-04-16 16:45:53 +02:00
QObject :: connect (
rxChannelGUI ,
& ChannelGUI :: moveToDeviceSet ,
this ,
[ = ]( int dsIndexDest ){ MainWindow :: getInstance () -> channelMoveToDeviceSet ( rxChannelGUI , dsIndexDest ); }
);
2017-10-30 22:45:53 +01:00
}
}
}
else
{
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::loadRxChannelSettings: Loading preset [%s | %s] not a source preset" , qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
2017-10-30 22:45:53 +01:00
}
}
2022-04-09 13:38:22 +02:00
void DeviceUISet :: saveRxChannelSettings ( Preset * preset ) const
2017-10-30 22:45:53 +01:00
{
if ( preset -> isSourcePreset ())
{
2022-04-12 16:20:45 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2017-10-30 22:45:53 +01:00
{
2022-04-12 16:20:45 +02:00
ChannelGUI * channelGUI = m_channelInstanceRegistrations [ i ]. m_gui ;
2020-10-15 08:52:30 +02:00
qDebug ( "DeviceUISet::saveRxChannelSettings: saving channel [%s]" , qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2022-04-12 16:20:45 +02:00
channelGUI -> setGeometryBytes ( channelGUI -> saveGeometry ());
2022-04-12 18:27:27 +02:00
channelGUI -> zetHidden ( channelGUI -> isHidden ());
2022-04-12 16:20:45 +02:00
preset -> addChannel ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI (), channelGUI -> serialize ());
2017-10-30 22:45:53 +01:00
}
}
else
{
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::saveRxChannelSettings: not a source preset" );
2017-10-30 22:45:53 +01:00
}
}
2022-04-12 16:20:45 +02:00
void DeviceUISet :: loadTxChannelSettings ( const Preset * preset , PluginAPI * pluginAPI , QList < Workspace *> * workspaces , Workspace * currentWorkspace )
2017-10-31 22:37:57 +01:00
{
2019-09-13 13:40:31 +02:00
if ( preset -> isSinkPreset ())
2017-10-31 22:37:57 +01:00
{
2020-10-04 19:07:42 +02:00
qDebug ( "DeviceUISet::loadTxChannelSettings: Loading preset [%s | %s]" ,
qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
2017-10-31 22:37:57 +01:00
// Available channel plugins
PluginAPI :: ChannelRegistrations * channelRegistrations = pluginAPI -> getTxChannelRegistrations ();
2020-10-04 19:07:42 +02:00
// clear list
2022-04-17 23:18:56 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2018-03-16 10:13:02 +01:00
{
2020-10-04 19:07:42 +02:00
qDebug ( "DeviceUISet::loadTxChannelSettings: destroying old channel [%s]" ,
2020-10-15 08:52:30 +02:00
qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2021-02-08 22:29:27 +01:00
m_channelInstanceRegistrations [ i ]. m_channelAPI -> setMessageQueueToGUI ( nullptr ); // have channel stop sending messages to its GUI
2021-04-21 12:28:56 +02:00
m_channelInstanceRegistrations [ i ]. m_gui -> destroy ();
2022-09-27 08:36:17 +02:00
m_channelInstanceRegistrations [ i ]. m_channelAPI -> destroy ();
2018-03-16 10:13:02 +01:00
}
2020-10-04 19:07:42 +02:00
m_channelInstanceRegistrations . clear ();
2020-10-11 08:27:58 +02:00
m_deviceSet -> clearChannels ();
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::loadTxChannelSettings: %d channel(s) in preset" , preset -> getChannelCount ());
2017-10-31 22:37:57 +01:00
2022-04-17 23:18:56 +02:00
for ( int i = 0 ; i < preset -> getChannelCount (); i ++ )
2017-10-31 22:37:57 +01:00
{
const Preset :: ChannelConfig & channelConfig = preset -> getChannelConfig ( i );
2020-10-04 06:16:15 +02:00
ChannelGUI * txChannelGUI = nullptr ;
2022-04-12 16:20:45 +02:00
ChannelAPI * channelAPI = nullptr ;
2017-10-31 22:37:57 +01:00
2018-03-16 10:13:02 +01:00
// create channel instance
2017-10-31 22:37:57 +01:00
2022-04-17 23:18:56 +02:00
for ( int i = 0 ; i < channelRegistrations -> count (); i ++ )
2017-10-31 22:37:57 +01:00
{
2018-05-30 11:49:54 +02:00
if (( * channelRegistrations )[ i ]. m_channelIdURI == channelConfig . m_channelIdURI )
2017-10-31 22:37:57 +01:00
{
2018-05-30 11:49:54 +02:00
qDebug ( "DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s]" ,
qPrintable (( * channelRegistrations )[ i ]. m_channelIdURI ),
qPrintable ( channelConfig . m_channelIdURI ));
2020-10-01 22:47:30 +02:00
BasebandSampleSource * txChannel ;
2022-04-17 10:20:07 +02:00
PluginInterface * pluginInterface = ( * channelRegistrations )[ i ]. m_plugin ;
pluginInterface -> createTxChannel ( m_deviceAPI , & txChannel , & channelAPI );
txChannelGUI = pluginInterface -> createTxChannelGUI ( this , txChannel );
txChannelGUI -> setDisplayedame ( pluginInterface -> getPluginDescriptor (). displayedName );
2020-10-15 08:52:30 +02:00
registerTxChannelInstance ( channelAPI , txChannelGUI );
2020-10-04 19:07:42 +02:00
QObject :: connect (
txChannelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( txChannelGUI ); },
Qt :: QueuedConnection
);
2017-10-31 22:37:57 +01:00
break ;
}
}
2022-04-12 16:20:45 +02:00
if ( txChannelGUI && channelAPI )
2017-10-31 22:37:57 +01:00
{
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::loadTxChannelSettings: deserializing channel [%s]" , qPrintable ( channelConfig . m_channelIdURI ));
2020-10-03 05:16:19 +02:00
txChannelGUI -> deserialize ( channelConfig . m_config );
2022-04-12 16:20:45 +02:00
int originalWorkspaceIndex = txChannelGUI -> getWorkspaceIndex ();
if ( workspaces && ( workspaces -> size () > 0 ) && ( originalWorkspaceIndex < workspaces -> size ())) // restore in original workspace
{
( * workspaces )[ originalWorkspaceIndex ] -> addToMdiArea (( QMdiSubWindow * ) txChannelGUI );
}
else if ( currentWorkspace ) // restore in current workspace
{
txChannelGUI -> setWorkspaceIndex ( currentWorkspace -> getIndex ());
currentWorkspace -> addToMdiArea (( QMdiSubWindow * ) txChannelGUI );
}
2022-04-12 18:27:27 +02:00
if ( txChannelGUI -> getHidden ()) {
txChannelGUI -> hide ();
}
2022-04-12 16:20:45 +02:00
txChannelGUI -> restoreGeometry ( txChannelGUI -> getGeometryBytes ());
2022-11-03 19:00:13 +01:00
txChannelGUI -> getRollupContents () -> arrangeRollups ();
2022-05-02 02:01:10 +02:00
txChannelGUI -> setDeviceType ( ChannelGUI :: DeviceTx );
2022-04-12 16:20:45 +02:00
txChannelGUI -> setDeviceSetIndex ( m_deviceSetIndex );
txChannelGUI -> setIndex ( channelAPI -> getIndexInDeviceSet ());
2022-04-18 12:08:33 +02:00
txChannelGUI -> setIndexToolTip ( m_deviceAPI -> getSamplingDeviceDisplayName ());
2022-04-12 16:20:45 +02:00
QObject :: connect (
txChannelGUI ,
& ChannelGUI :: moveToWorkspace ,
this ,
[ = ]( int wsIndexDest ){ MainWindow :: getInstance () -> channelMove ( txChannelGUI , wsIndexDest ); }
);
2022-04-15 18:59:29 +02:00
QObject :: connect (
txChannelGUI ,
& ChannelGUI :: duplicateChannelEmitted ,
this ,
[ = ](){ MainWindow :: getInstance () -> channelDuplicate ( txChannelGUI ); }
);
2022-04-16 16:45:53 +02:00
QObject :: connect (
txChannelGUI ,
& ChannelGUI :: moveToDeviceSet ,
this ,
[ = ]( int dsIndexDest ){ MainWindow :: getInstance () -> channelMoveToDeviceSet ( txChannelGUI , dsIndexDest ); }
);
2017-10-31 22:37:57 +01:00
}
}
}
2019-09-13 13:40:31 +02:00
else
{
qDebug ( "DeviceUISet::loadTxChannelSettings: Loading preset [%s | %s] not a sink preset" , qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
}
2017-10-31 22:37:57 +01:00
}
2022-04-09 13:38:22 +02:00
void DeviceUISet :: saveTxChannelSettings ( Preset * preset ) const
2017-10-31 22:37:57 +01:00
{
2019-09-13 13:40:31 +02:00
if ( preset -> isSinkPreset ())
{
2022-04-12 16:20:45 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2019-09-13 13:40:31 +02:00
{
2022-04-12 16:20:45 +02:00
ChannelGUI * channelGUI = m_channelInstanceRegistrations [ i ]. m_gui ;
2020-10-15 08:52:30 +02:00
qDebug ( "DeviceUISet::saveTxChannelSettings: saving channel [%s]" , qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2022-04-12 16:20:45 +02:00
channelGUI -> setGeometryBytes ( channelGUI -> saveGeometry ());
2022-04-12 18:27:27 +02:00
channelGUI -> zetHidden ( channelGUI -> isHidden ());
2022-04-12 16:20:45 +02:00
preset -> addChannel ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI (), channelGUI -> serialize ());
2019-09-13 13:40:31 +02:00
}
}
else
2017-10-31 22:37:57 +01:00
{
2018-03-16 10:13:02 +01:00
qDebug ( "DeviceUISet::saveTxChannelSettings: not a sink preset" );
2017-10-31 22:37:57 +01:00
}
2019-09-13 13:40:31 +02:00
}
2022-04-12 16:20:45 +02:00
void DeviceUISet :: loadMIMOChannelSettings ( const Preset * preset , PluginAPI * pluginAPI , QList < Workspace *> * workspaces , Workspace * currentWorkspace )
2019-09-13 13:40:31 +02:00
{
if ( preset -> isMIMOPreset ())
{
2020-10-04 19:07:42 +02:00
qDebug ( "DeviceUISet::loadMIMOChannelSettings: Loading preset [%s | %s]" ,
qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
2019-09-13 13:40:31 +02:00
2020-10-04 19:07:42 +02:00
// clear list
2022-04-17 23:18:56 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2019-09-13 13:40:31 +02:00
{
2020-10-04 19:07:42 +02:00
qDebug ( "DeviceUISet::loadMIMOChannelSettings: destroying old channel [%s]" ,
2020-10-15 08:52:30 +02:00
qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2022-09-27 08:36:17 +02:00
m_channelInstanceRegistrations [ i ]. m_gui -> destroy (); // stop GUI first (issue #1427)
2021-04-21 12:28:56 +02:00
m_channelInstanceRegistrations [ i ]. m_channelAPI -> destroy (); // stop channel before (issue #860)
2019-09-13 13:40:31 +02:00
}
2020-10-04 19:07:42 +02:00
m_channelInstanceRegistrations . clear ();
2020-10-11 08:27:58 +02:00
m_deviceSet -> clearChannels ();
2019-09-13 13:40:31 +02:00
qDebug ( "DeviceUISet::loadMIMOChannelSettings: %d channel(s) in preset" , preset -> getChannelCount ());
for ( int i = 0 ; i < preset -> getChannelCount (); i ++ )
{
const Preset :: ChannelConfig & channelConfig = preset -> getChannelConfig ( i );
2022-04-17 23:18:56 +02:00
ChannelGUI * channelGUI = nullptr ;
2022-04-12 16:20:45 +02:00
ChannelAPI * channelAPI = nullptr ;
2019-09-13 13:40:31 +02:00
2022-04-17 23:18:56 +02:00
// Available MIMO channel plugins
PluginAPI :: ChannelRegistrations * channelMIMORegistrations = pluginAPI -> getMIMOChannelRegistrations ();
// create MIMO channel instance
for ( int i = 0 ; i < channelMIMORegistrations -> count (); i ++ )
2019-09-13 13:40:31 +02:00
{
2022-04-17 23:18:56 +02:00
if ( ChannelUtils :: compareChannelURIs (( * channelMIMORegistrations )[ i ]. m_channelIdURI , channelConfig . m_channelIdURI ))
2019-09-13 13:40:31 +02:00
{
2022-04-17 23:18:56 +02:00
qDebug ( "DeviceUISet::loadMIMOChannelSettings: creating new MIMO channel [%s] from config [%s]" ,
qPrintable (( * channelMIMORegistrations )[ i ]. m_channelIdURI ),
2019-09-13 13:40:31 +02:00
qPrintable ( channelConfig . m_channelIdURI ));
2020-10-01 22:47:30 +02:00
MIMOChannel * mimoChannel ;
2022-04-17 23:18:56 +02:00
PluginInterface * pluginInterface = ( * channelMIMORegistrations )[ i ]. m_plugin ;
2022-04-17 10:20:07 +02:00
pluginInterface -> createMIMOChannel ( m_deviceAPI , & mimoChannel , & channelAPI );
2022-04-17 23:18:56 +02:00
channelGUI = pluginInterface -> createMIMOChannelGUI ( this , mimoChannel );
channelGUI -> setDisplayedame ( pluginInterface -> getPluginDescriptor (). displayedName );
registerChannelInstance ( channelAPI , channelGUI );
QObject :: connect (
channelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( channelGUI ); },
Qt :: QueuedConnection
);
break ;
}
}
// Available Rx channel plugins
PluginAPI :: ChannelRegistrations * channelRxRegistrations = pluginAPI -> getRxChannelRegistrations ();
// create Rx channel instance
for ( int i = 0 ; i < channelRxRegistrations -> count (); i ++ )
{
if ( ChannelUtils :: compareChannelURIs (( * channelRxRegistrations )[ i ]. m_channelIdURI , channelConfig . m_channelIdURI ))
{
qDebug ( "DeviceUISet::loadMIMOChannelSettings: creating new Rx channel [%s] from config [%s]" ,
qPrintable (( * channelRxRegistrations )[ i ]. m_channelIdURI ),
qPrintable ( channelConfig . m_channelIdURI ));
BasebandSampleSink * rxChannel ;
PluginInterface * pluginInterface = ( * channelRxRegistrations )[ i ]. m_plugin ;
pluginInterface -> createRxChannel ( m_deviceAPI , & rxChannel , & channelAPI );
channelGUI = pluginInterface -> createRxChannelGUI ( this , rxChannel );
channelGUI -> setDisplayedame ( pluginInterface -> getPluginDescriptor (). displayedName );
registerRxChannelInstance ( channelAPI , channelGUI );
2020-10-04 19:07:42 +02:00
QObject :: connect (
2022-04-17 23:18:56 +02:00
channelGUI ,
2020-10-04 19:07:42 +02:00
& ChannelGUI :: closing ,
this ,
2022-04-17 23:18:56 +02:00
[ = ](){ this -> handleChannelGUIClosing ( channelGUI ); },
2020-10-04 19:07:42 +02:00
Qt :: QueuedConnection
);
2019-09-13 13:40:31 +02:00
break ;
}
}
2022-04-17 23:18:56 +02:00
// Available Tx channel plugins
PluginAPI :: ChannelRegistrations * channelTxRegistrations = pluginAPI -> getTxChannelRegistrations ();
// create Tx channel instance
for ( int i = 0 ; i < channelTxRegistrations -> count (); i ++ )
{
if ( ChannelUtils :: compareChannelURIs (( * channelTxRegistrations )[ i ]. m_channelIdURI , channelConfig . m_channelIdURI ))
{
qDebug ( "DeviceUISet::loadMIMOChannelSettings: creating new Tx channel [%s] from config [%s]" ,
qPrintable (( * channelTxRegistrations )[ i ]. m_channelIdURI ),
qPrintable ( channelConfig . m_channelIdURI ));
BasebandSampleSource * txChannel ;
PluginInterface * pluginInterface = ( * channelTxRegistrations )[ i ]. m_plugin ;
pluginInterface -> createTxChannel ( m_deviceAPI , & txChannel , & channelAPI );
channelGUI = pluginInterface -> createTxChannelGUI ( this , txChannel );
channelGUI -> setDisplayedame ( pluginInterface -> getPluginDescriptor (). displayedName );
registerTxChannelInstance ( channelAPI , channelGUI );
break ;
}
}
if ( channelGUI && channelAPI )
2019-09-13 13:40:31 +02:00
{
qDebug ( "DeviceUISet::loadMIMOChannelSettings: deserializing channel [%s]" , qPrintable ( channelConfig . m_channelIdURI ));
2022-04-17 23:18:56 +02:00
channelGUI -> deserialize ( channelConfig . m_config );
int originalWorkspaceIndex = channelGUI -> getWorkspaceIndex ();
2022-04-12 16:20:45 +02:00
if ( workspaces && ( workspaces -> size () > 0 ) && ( originalWorkspaceIndex < workspaces -> size ())) // restore in original workspace
{
2022-04-17 23:18:56 +02:00
( * workspaces )[ originalWorkspaceIndex ] -> addToMdiArea (( QMdiSubWindow * ) channelGUI );
2022-04-12 16:20:45 +02:00
}
else if ( currentWorkspace ) // restore in current workspace
{
2022-04-17 23:18:56 +02:00
channelGUI -> setWorkspaceIndex ( currentWorkspace -> getIndex ());
currentWorkspace -> addToMdiArea (( QMdiSubWindow * ) channelGUI );
2022-04-12 16:20:45 +02:00
}
2022-04-17 23:18:56 +02:00
if ( channelGUI -> getHidden ()) {
channelGUI -> hide ();
2022-04-12 18:27:27 +02:00
}
2022-04-17 23:18:56 +02:00
channelGUI -> restoreGeometry ( channelGUI -> getGeometryBytes ());
2022-11-03 19:00:13 +01:00
channelGUI -> getRollupContents () -> arrangeRollups ();
2022-05-02 02:01:10 +02:00
channelGUI -> setDeviceType ( ChannelGUI :: DeviceMIMO );
2022-04-17 23:18:56 +02:00
channelGUI -> setDeviceSetIndex ( m_deviceSetIndex );
channelGUI -> setIndex ( channelAPI -> getIndexInDeviceSet ());
2022-04-18 12:08:33 +02:00
channelGUI -> setIndexToolTip ( m_deviceAPI -> getSamplingDeviceDisplayName ());
2022-04-12 16:20:45 +02:00
QObject :: connect (
2022-04-17 23:18:56 +02:00
channelGUI ,
& ChannelGUI :: closing ,
this ,
[ = ](){ this -> handleChannelGUIClosing ( channelGUI ); },
Qt :: QueuedConnection
);
QObject :: connect (
channelGUI ,
2022-04-12 16:20:45 +02:00
& ChannelGUI :: moveToWorkspace ,
this ,
2022-04-17 23:18:56 +02:00
[ = ]( int wsIndexDest ){ MainWindow :: getInstance () -> channelMove ( channelGUI , wsIndexDest ); }
2022-04-12 16:20:45 +02:00
);
2022-04-15 18:59:29 +02:00
QObject :: connect (
2022-04-17 23:18:56 +02:00
channelGUI ,
2022-04-15 18:59:29 +02:00
& ChannelGUI :: duplicateChannelEmitted ,
this ,
2022-04-17 23:18:56 +02:00
[ = ](){ MainWindow :: getInstance () -> channelDuplicate ( channelGUI ); }
2022-04-15 18:59:29 +02:00
);
2022-04-16 16:45:53 +02:00
QObject :: connect (
2022-04-17 23:18:56 +02:00
channelGUI ,
2022-04-16 16:45:53 +02:00
& ChannelGUI :: moveToDeviceSet ,
this ,
2022-04-17 23:18:56 +02:00
[ = ]( int dsIndexDest ){ MainWindow :: getInstance () -> channelMoveToDeviceSet ( channelGUI , dsIndexDest ); }
2022-04-16 16:45:53 +02:00
);
2019-09-13 13:40:31 +02:00
}
}
}
2017-10-31 22:37:57 +01:00
else
2019-09-13 13:40:31 +02:00
{
qDebug ( "DeviceUISet::loadMIMOChannelSettings: Loading preset [%s | %s] not a MIMO preset" , qPrintable ( preset -> getGroup ()), qPrintable ( preset -> getDescription ()));
}
}
2022-04-09 13:38:22 +02:00
void DeviceUISet :: saveMIMOChannelSettings ( Preset * preset ) const
2019-09-13 13:40:31 +02:00
{
if ( preset -> isMIMOPreset ())
2017-10-31 22:37:57 +01:00
{
2022-04-12 16:20:45 +02:00
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ )
2017-10-31 22:37:57 +01:00
{
2022-04-12 16:20:45 +02:00
ChannelGUI * channelGUI = m_channelInstanceRegistrations [ i ]. m_gui ;
2020-10-15 08:52:30 +02:00
qDebug ( "DeviceUISet::saveMIMOChannelSettings: saving channel [%s]" , qPrintable ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI ()));
2022-04-12 16:20:45 +02:00
channelGUI -> setGeometryBytes ( channelGUI -> saveGeometry ());
2022-04-12 18:27:27 +02:00
channelGUI -> zetHidden ( channelGUI -> isHidden ());
2022-04-12 16:20:45 +02:00
preset -> addChannel ( m_channelInstanceRegistrations [ i ]. m_channelAPI -> getURI (), channelGUI -> serialize ());
2017-10-31 22:37:57 +01:00
}
}
2019-09-13 13:40:31 +02:00
else
{
qDebug ( "DeviceUISet::saveMIMOChannelSettings: not a MIMO preset" );
}
2017-10-31 22:37:57 +01:00
}
2017-10-30 22:45:53 +01:00
// sort by increasing delta frequency and type (i.e. name)
bool DeviceUISet :: ChannelInstanceRegistration :: operator < ( const ChannelInstanceRegistration & other ) const
{
2020-10-03 11:43:14 +02:00
if ( m_channelAPI && other . m_channelAPI )
2017-10-30 22:45:53 +01:00
{
2020-10-03 11:43:14 +02:00
if ( m_channelAPI -> getCenterFrequency () == other . m_channelAPI -> getCenterFrequency ())
2017-10-30 22:45:53 +01:00
{
2020-10-03 11:43:14 +02:00
return m_channelAPI -> getName () < other . m_channelAPI -> getName ();
2017-10-30 22:45:53 +01:00
}
else
{
2020-10-03 11:43:14 +02:00
return m_channelAPI -> getCenterFrequency () < other . m_channelAPI -> getCenterFrequency ();
2017-10-30 22:45:53 +01:00
}
}
else
{
return false ;
}
}
2017-10-24 18:29:18 +02:00
2020-10-04 19:07:42 +02:00
void DeviceUISet :: handleChannelGUIClosing ( ChannelGUI * channelGUI )
{
2022-04-12 16:20:45 +02:00
qDebug ( "DeviceUISet::handleChannelGUIClosing: %s: %d" , qPrintable ( channelGUI -> getTitle ()), channelGUI -> getIndex ());
2020-10-04 19:07:42 +02:00
for ( ChannelInstanceRegistrations :: iterator it = m_channelInstanceRegistrations . begin (); it != m_channelInstanceRegistrations . end (); ++ it )
{
if ( it -> m_gui == channelGUI )
{
2022-07-21 05:26:58 +02:00
ChannelAPI * channelAPI = it -> m_channelAPI ;
m_deviceSet -> removeChannelInstance ( channelAPI );
QObject :: connect (
channelGUI ,
& ChannelGUI :: destroyed ,
this ,
[ this , channelAPI ](){ this -> handleDeleteChannel ( channelAPI ); }
);
2020-10-04 19:07:42 +02:00
m_channelInstanceRegistrations . erase ( it );
break ;
}
}
2022-04-12 16:20:45 +02:00
// Renumerate
for ( int i = 0 ; i < m_channelInstanceRegistrations . count (); i ++ ) {
m_channelInstanceRegistrations . at ( i ). m_gui -> setIndex ( i );
}
2020-10-04 19:07:42 +02:00
}
2020-05-05 18:58:18 +02:00
2022-07-21 05:26:58 +02:00
void DeviceUISet :: handleDeleteChannel ( ChannelAPI * channelAPI )
{
channelAPI -> destroy ();
}
2020-05-05 18:58:18 +02:00
int DeviceUISet :: webapiSpectrumSettingsGet ( SWGSDRangel :: SWGGLSpectrum & response , QString & errorMessage ) const
{
return m_spectrumVis -> webapiSpectrumSettingsGet ( response , errorMessage );
}
2020-05-06 01:38:23 +02:00
int DeviceUISet :: webapiSpectrumSettingsPutPatch (
bool force ,
const QStringList & spectrumSettingsKeys ,
SWGSDRangel :: SWGGLSpectrum & response , // query + response
QString & errorMessage )
{
return m_spectrumVis -> webapiSpectrumSettingsPutPatch ( force , spectrumSettingsKeys , response , errorMessage );
}
2020-05-05 18:58:18 +02:00
int DeviceUISet :: webapiSpectrumServerGet ( SWGSDRangel :: SWGSpectrumServer & response , QString & errorMessage ) const
{
return m_spectrumVis -> webapiSpectrumServerGet ( response , errorMessage );
}
2020-05-06 01:38:23 +02:00
int DeviceUISet :: webapiSpectrumServerPost ( SWGSDRangel :: SWGSuccessResponse & response , QString & errorMessage )
{
return m_spectrumVis -> webapiSpectrumServerPost ( response , errorMessage );
}
int DeviceUISet :: webapiSpectrumServerDelete ( SWGSDRangel :: SWGSuccessResponse & response , QString & errorMessage )
{
return m_spectrumVis -> webapiSpectrumServerDelete ( response , errorMessage );
}